comparison libinterp/corefcn/load-save.cc @ 20657:c6224b4e7774

maint: Rename instances of LS_ASCII to LS_TEXT for clarity. Octave's default save format is '-text' which is confusingly referred to in the code base as LS_ASCII (looks like '-ascii' mode). * ls-oct-text.cc, ls-oct-text.h: Renamed from ls-oct-ascii.[cc|h]. * ls-oct-ascii.cc, ls-oct-ascii.h: Removed files. * libinterp/corefcn/module.mk: Add ls-oct-text.cc, ls-oct-text.h to build system. * load-save.h (load_save_format_type): Change first value of enum from LS_ASCII to LS_TEXT. * load-save.cc: Rename instances of LS_ASCII to LS_TEXT. Rename instances of read_ascii_data to read_text_data. * ov-base-diag.cc, ov-base-int.cc, ov-base-sparse.cc, ov-bool-mat.cc, ov-bool.cc, ov-complex.cc, ov-cx-mat.cc ov-fcn-inline.cc, ov-float.cc, ov-flt-complex.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-perm.cc, ov-re-mat.cc, ov-scalar.cc, ov-str-mat.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc: Use '#include "ls-oct-text.h"' rather than ls-oct-ascii.h. ov-cell.cc, ov-class.cc, ov-fcn-handle.cc, ov-lazy-idx.cc, ov-struct.cc: Use '#include "ls-oct-text.h"' rather than ls-oct-ascii.h. Rename save_ascii_data to save_text_data, read_ascii_data to read_text_data.
author Rik <rik@octave.org>
date Mon, 17 Aug 2015 09:20:03 -0700
parents 610c74748518
children 1690807b226c
comparison
equal deleted inserted replaced
20654:ab2c5e84954a 20657:c6224b4e7774
75 75
76 #include "ls-hdf5.h" 76 #include "ls-hdf5.h"
77 #include "ls-mat-ascii.h" 77 #include "ls-mat-ascii.h"
78 #include "ls-mat4.h" 78 #include "ls-mat4.h"
79 #include "ls-mat5.h" 79 #include "ls-mat5.h"
80 #include "ls-oct-ascii.h" 80 #include "ls-oct-text.h"
81 #include "ls-oct-binary.h" 81 #include "ls-oct-binary.h"
82 82
83 // Remove gnulib definitions, if any. 83 // Remove gnulib definitions, if any.
84 #ifdef close 84 #ifdef close
85 #undef close 85 #undef close
268 268
269 std::string name_val = extract_keyword (file, "name"); 269 std::string name_val = extract_keyword (file, "name");
270 std::string type_val = extract_keyword (file, "type"); 270 std::string type_val = extract_keyword (file, "type");
271 271
272 if (name_val.empty () != true && type_val.empty () != true) 272 if (name_val.empty () != true && type_val.empty () != true)
273 retval = LS_ASCII; 273 retval = LS_TEXT;
274 else 274 else
275 { 275 {
276 file.clear (); 276 file.clear ();
277 file.seekg (0, std::ios::beg); 277 file.seekg (0, std::ios::beg);
278 278
361 std::string name; 361 std::string name;
362 std::string doc; 362 std::string doc;
363 363
364 switch (format.type) 364 switch (format.type)
365 { 365 {
366 case LS_ASCII: 366 case LS_TEXT:
367 name = read_ascii_data (stream, orig_fname, global, tc, count); 367 name = read_text_data (stream, orig_fname, global, tc, count);
368 break; 368 break;
369 369
370 case LS_BINARY: 370 case LS_BINARY:
371 name = read_binary_data (stream, swap, flt_fmt, orig_fname, 371 name = read_binary_data (stream, swap, flt_fmt, orig_fname,
372 global, tc, doc); 372 global, tc, doc);
707 { 707 {
708 warning ("load: -import ignored"); 708 warning ("load: -import ignored");
709 } 709 }
710 else if (argv[i] == "-text" || argv[i] == "-t") 710 else if (argv[i] == "-text" || argv[i] == "-t")
711 { 711 {
712 format = LS_ASCII; 712 format = LS_TEXT;
713 } 713 }
714 else 714 else
715 break; 715 break;
716 } 716 }
717 717
926 const std::string& name, const std::string& help, 926 const std::string& name, const std::string& help,
927 bool global, load_save_format fmt, bool save_as_floats) 927 bool global, load_save_format fmt, bool save_as_floats)
928 { 928 {
929 switch (fmt.type) 929 switch (fmt.type)
930 { 930 {
931 case LS_ASCII: 931 case LS_TEXT:
932 save_ascii_data (os, tc, name, global, 0); 932 save_text_data (os, tc, name, global, 0);
933 break; 933 break;
934 934
935 case LS_BINARY: 935 case LS_BINARY:
936 save_binary_data (os, tc, name, help, global, save_as_floats); 936 save_binary_data (os, tc, name, help, global, save_as_floats);
937 break; 937 break;
1068 { 1068 {
1069 do_tabs = true; 1069 do_tabs = true;
1070 } 1070 }
1071 else if (argv[i] == "-text" || argv[i] == "-t") 1071 else if (argv[i] == "-text" || argv[i] == "-t")
1072 { 1072 {
1073 format = LS_ASCII; 1073 format = LS_TEXT;
1074 } 1074 }
1075 else if (argv[i] == "-binary" || argv[i] == "-b") 1075 else if (argv[i] == "-binary" || argv[i] == "-b")
1076 { 1076 {
1077 format = LS_BINARY; 1077 format = LS_BINARY;
1078 } 1078 }
1227 break; 1227 break;
1228 1228
1229 #ifdef HAVE_HDF5 1229 #ifdef HAVE_HDF5
1230 case LS_HDF5: 1230 case LS_HDF5:
1231 #endif /* HAVE_HDF5 */ 1231 #endif /* HAVE_HDF5 */
1232 case LS_ASCII: 1232 case LS_TEXT:
1233 { 1233 {
1234 octave_localtime now; 1234 octave_localtime now;
1235 1235
1236 std::string comment_string = now.strftime (Vsave_header_format_string); 1236 std::string comment_string = now.strftime (Vsave_header_format_string);
1237 1237
1613 // Here is where we would get the default save format if it were 1613 // Here is where we would get the default save format if it were
1614 // stored in a user preference variable. 1614 // stored in a user preference variable.
1615 1615
1616 bool save_as_floats = false; 1616 bool save_as_floats = false;
1617 1617
1618 load_save_format format = LS_ASCII; 1618 load_save_format format = LS_TEXT;
1619 1619
1620 bool append = false; 1620 bool append = false;
1621 1621
1622 bool use_zlib = false; 1622 bool use_zlib = false;
1623 1623
1638 { 1638 {
1639 print_usage (); 1639 print_usage ();
1640 return retval; 1640 return retval;
1641 } 1641 }
1642 1642
1643 if (save_as_floats && format == LS_ASCII) 1643 if (save_as_floats && format == LS_TEXT)
1644 { 1644 {
1645 error ("save: cannot specify both -ascii and -float-binary"); 1645 error ("save: cannot specify both -ascii and -float-binary");
1646 return retval; 1646 return retval;
1647 } 1647 }
1648 1648