# HG changeset patch # User jwe # Date 962357446 0 # Node ID 9143cd2129c4eb945311de26d5b203769f5858d4 # Parent 8aea513ff224fa83c49f34c8bb11e06ca1968c13 [project @ 2000-06-30 09:30:44 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2000-06-29 John W. Eaton + + * dMatrix.h (read_int): Provide declaration. + 2000-06-29 James R. Van Zandt * data-conv.cc (read_doubles): Handle EIGHT_BYTE_INT cases. diff --git a/liboctave/dMatrix.h b/liboctave/dMatrix.h --- a/liboctave/dMatrix.h +++ b/liboctave/dMatrix.h @@ -255,6 +255,9 @@ MARRAY_FORWARD_DEFS (MArray2, Matrix, double) +template +void read_int (std::istream& is, bool swap_bytes, T& val); + #endif /* diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,6 @@ 2000-06-29 James R. Van Zandt - * load-save.cc (read_int): New template function. Instantiate it - for various integer types. - (load_save_format): New value, LS_MAT5_BINARY. + * load-save.cc (load_save_format): New value, LS_MAT5_BINARY. (arrayclasstype, mat5_data_type): New enums. (read_mat5_binary_data): New function. (read_mat5_tag): New function. diff --git a/src/load-save.cc b/src/load-save.cc --- a/src/load-save.cc +++ b/src/load-save.cc @@ -70,48 +70,6 @@ #define PAD(l) (((l)<=4)?4:(((l)+7)/8)*8) #define TAGLENGTH(l) ((l)<=4?4:8) -template -void -read_int (std::istream& is, bool swap_bytes, T& val) -{ - is.read (X_CAST (char *, &val), sizeof (T)); - - if (swap_bytes) - { - switch (sizeof (T)) - { - case 1: - break; - - case 2: - swap_2_bytes (X_CAST (char *, &val)); - break; - - case 4: - swap_4_bytes (X_CAST (char *, &val)); - break; - - case 8: - swap_8_bytes (X_CAST (char *, &val)); - break; - - default: - (*current_liboctave_error_handler) - ("read_int: unrecognized data format!"); - } - } -} - -template void read_int (std::istream&, bool, char&); -template void read_int (std::istream&, bool, signed char&); -template void read_int (std::istream&, bool, unsigned char&); -template void read_int (std::istream&, bool, short&); -template void read_int (std::istream&, bool, unsigned short&); -template void read_int (std::istream&, bool, int&); -template void read_int (std::istream&, bool, unsigned int&); -template void read_int (std::istream&, bool, long&); -template void read_int (std::istream&, bool, unsigned long&); - // Write octave-core file if Octave crashes or is killed by a signal. static bool Vcrash_dumps_octave_core;