comparison src/load-save.cc @ 4329:d53c33d93440

[project @ 2003-02-18 20:00:48 by jwe]
author jwe
date Tue, 18 Feb 2003 20:08:20 +0000
parents fd7d9a6e15ff
children e41906608e0f
comparison
equal deleted inserted replaced
4328:f7b63f362168 4329:d53c33d93440
92 92
93 #ifndef OCT_RBV 93 #ifndef OCT_RBV
94 #define OCT_RBV DBL_MAX / 100.0 94 #define OCT_RBV DBL_MAX / 100.0
95 #endif 95 #endif
96 96
97 enum load_save_format 97 enum arrayclasstype
98 {
99 LS_ASCII,
100 LS_BINARY,
101 LS_MAT_ASCII,
102 LS_MAT_BINARY,
103 LS_MAT5_BINARY,
104 #ifdef HAVE_HDF5
105 LS_HDF5,
106 #endif /* HAVE_HDF5 */
107 LS_UNKNOWN
108 };
109
110 enum arrayclasstype
111 { 98 {
112 mxCELL_CLASS=1, // cell array 99 mxCELL_CLASS=1, // cell array
113 mxSTRUCT_CLASS, // structure 100 mxSTRUCT_CLASS, // structure
114 mxOBJECT_CLASS, // object 101 mxOBJECT_CLASS, // object
115 mxCHAR_CLASS, // character array 102 mxCHAR_CLASS, // character array
2833 } 2820 }
2834 2821
2835 return false; 2822 return false;
2836 } 2823 }
2837 2824
2838 static int 2825 int
2839 read_binary_file_header (std::istream& is, bool& swap, 2826 read_binary_file_header (std::istream& is, bool& swap,
2840 oct_mach_info::float_format& flt_fmt, 2827 oct_mach_info::float_format& flt_fmt, bool quiet)
2841 bool quiet = false)
2842 { 2828 {
2843 const int magic_len = 10; 2829 const int magic_len = 10;
2844 char magic[magic_len+1]; 2830 char magic[magic_len+1];
2845 is.read (X_CAST (char *, magic), magic_len); 2831 is.read (X_CAST (char *, magic), magic_len);
2846 magic[magic_len] = '\0'; 2832 magic[magic_len] = '\0';
2951 orig_fname.c_str ()); 2937 orig_fname.c_str ());
2952 2938
2953 return retval; 2939 return retval;
2954 } 2940 }
2955 2941
2956 static octave_value 2942 octave_value
2957 do_load (std::istream& stream, const std::string& orig_fname, bool force, 2943 do_load (std::istream& stream, const std::string& orig_fname, bool force,
2958 load_save_format format, oct_mach_info::float_format flt_fmt, 2944 load_save_format format, oct_mach_info::float_format flt_fmt,
2959 bool list_only, bool swap, bool verbose, bool import, 2945 bool list_only, bool swap, bool verbose, bool import,
2960 const string_vector& argv, int argv_idx, int argc, int nargout) 2946 const string_vector& argv, int argv_idx, int argc, int nargout)
2961 { 2947 {
4634 return save_ascii_data (os, t, name, infnan_warned, true, false, 0); 4620 return save_ascii_data (os, t, name, infnan_warned, true, false, 0);
4635 } 4621 }
4636 4622
4637 // Save the info from sr on stream os in the format specified by fmt. 4623 // Save the info from sr on stream os in the format specified by fmt.
4638 4624
4639 static void 4625 void
4640 do_save (std::ostream& os, symbol_record *sr, load_save_format fmt, 4626 do_save (std::ostream& os, symbol_record *sr, load_save_format fmt,
4641 int save_as_floats, bool& infnan_warned) 4627 int save_as_floats, bool& infnan_warned)
4642 { 4628 {
4643 if (! sr->is_variable ()) 4629 if (! sr->is_variable ())
4644 { 4630 {
4748 #endif /* HAVE_HDF5 */ 4734 #endif /* HAVE_HDF5 */
4749 4735
4750 return retval; 4736 return retval;
4751 } 4737 }
4752 4738
4753 static void 4739 void
4754 write_header (std::ostream& os, load_save_format format) 4740 write_header (std::ostream& os, load_save_format format)
4755 { 4741 {
4756 switch (format) 4742 switch (format)
4757 { 4743 {
4758 case LS_BINARY: 4744 case LS_BINARY: