116 ", %a %b %d %H:%M:%S %Y %Z <")
132 error (
"%s: unable to open input file '%s'", fcn.c_str (), file.c_str ());
133 else if (fcn ==
"save")
134 error (
"%s: unable to open output file '%s'", fcn.c_str (), file.c_str ());
136 error (
"%s: unable to open file '%s'", fcn.c_str (), file.c_str ());
145 bool global,
const std::string& )
161 int num_pat,
const std::string& name)
163 for (
int i = pat_idx; i < num_pat; i++)
167 if (pattern.
match (name))
178 const int magic_len = 10;
179 char magic[magic_len+1];
180 is.read (magic, magic_len);
181 magic[magic_len] =
'\0';
183 if (strncmp (magic,
"Octave-1-L", magic_len) == 0)
185 else if (strncmp (magic,
"Octave-1-B", magic_len) == 0)
190 error (
"load: unable to read read binary file");
202 error (
"load: unrecognized binary format!");
215 std::ifstream file (fname.c_str ());
218 if (file.read (reinterpret_cast<char *> (magic), 2) && magic[0] == 0x1f
241 file.seekg (0, std::ios::beg);
243 int32_t mopt, nr, nc,
imag, len;
253 file.seekg (0, std::ios::beg);
260 file.seekg (0, std::ios::beg);
266 file.seekg (0, std::ios::beg);
271 if (name_val.empty () !=
true && type_val.empty () !=
true)
276 file.seekg (0, std::ios::beg);
296 bool &use_zlib,
bool quiet =
false)
302 if (H5Fis_hdf5 (fname.c_str ()) > 0)
314 std::ifstream file (fname.c_str ());
341 do_load (std::istream& stream,
const std::string& orig_fname,
343 bool list_only,
bool swap,
bool verbose,
344 const string_vector& argv,
int argv_idx,
int argc,
int nargout)
350 std::ostringstream output_buf;
351 std::list<std::string> symbol_names;
385 argv, argv_idx, argc);
407 warning (
"load: loaded ASCII file '%s' -- ignoring extra args",
408 orig_fname.c_str ());
421 <<
"type rows cols name\n"
422 <<
"==== ==== ==== ====\n";
426 << std::setw (16) << tc.
type_name () . c_str ()
427 << std::setiosflags (std::ios::right)
428 << std::setw (7) << tc.
rows ()
429 << std::setw (7) << tc.
columns ()
430 <<
" " << name <<
"\n";
433 symbol_names.push_back (name);
442 retstruct.
assign (name, tc);
455 error (
"load: unable to load variable '%s'", name.c_str ());
460 error (
"load: are you sure '%s' is an Octave data file?",
461 orig_fname.c_str ());
467 if (list_only && count)
471 std::string msg = output_buf.str ();
492 else if (retstruct.
nfields () != 0)
503 size_t dot_pos = fname.rfind (
".");
506 if (dot_pos == std::string::npos
507 || (sep_pos != std::string::npos && dot_pos < sep_pos))
525 error (
"load: unable to find file %s", orig_name.c_str ());
535 bool use_zlib =
false;
539 DEFUN (load, args, nargout,
541 @deftypefn {Command} {} load file\n\
542 @deftypefnx {Command} {} load options file\n\
543 @deftypefnx {Command} {} load options file v1 v2 @dots{}\n\
544 @deftypefnx {Command} {S =} load (\"options\", \"file\", \"v1\", \"v2\", @dots{})\n\
545 @deftypefnx {Command} {} load file options\n\
546 @deftypefnx {Command} {} load file options v1 v2 @dots{}\n\
547 @deftypefnx {Command} {S =} load (\"file\", \"options\", \"v1\", \"v2\", @dots{})\n\
548 Load the named variables @var{v1}, @var{v2}, @dots{}, from the file\n\
551 If no variables are specified then all variables found in the\n\
552 file will be loaded. As with @code{save}, the list of variables to extract\n\
553 can be full names or use a pattern syntax. The format of the file is\n\
554 automatically detected but may be overridden by supplying the appropriate\n\
557 If load is invoked using the functional form\n\
560 load (\"-option1\", @dots{}, \"file\", \"v1\", @dots{})\n\
564 then the @var{options}, @var{file}, and variable name arguments\n\
565 (@var{v1}, @dots{}) must be specified as character strings.\n\
567 If a variable that is not marked as global is loaded from a file when a\n\
568 global symbol with the same name already exists, it is loaded in the\n\
569 global symbol table. Also, if a variable is marked as global in a file\n\
570 and a local symbol exists, the local symbol is moved to the global\n\
571 symbol table and given the value from the file.\n\
573 If invoked with a single output argument, Octave returns data instead\n\
574 of inserting variables in the symbol table. If the data file contains\n\
575 only numbers (TAB- or space-delimited columns), a matrix of values is\n\
576 returned. Otherwise, @code{load} returns a structure with members\n\
577 corresponding to the names of the variables in the file.\n\
579 The @code{load} command can read data stored in Octave's text and\n\
580 binary formats, and @sc{matlab}'s binary format. If compiled with zlib\n\
581 support, it can also load gzip-compressed files. It will automatically\n\
582 detect the type of file and do conversion from different floating point\n\
583 formats (currently only IEEE big and little endian, though other formats\n\
584 may be added in the future).\n\
586 Valid options for @code{load} are listed in the following table.\n\
590 This option is accepted for backward compatibility but is ignored.\n\
591 Octave now overwrites variables currently in memory with\n\
592 those of the same name found in the file.\n\
595 Force Octave to assume the file contains columns of numbers in text format\n\
596 without any header or other information. Data in the file will be loaded\n\
597 as a single numeric matrix with the name of the variable derived from the\n\
601 Force Octave to assume the file is in Octave's binary format.\n\
604 Force Octave to assume the file is in @sc{hdf5} format.\n\
605 (@sc{hdf5} is a free, portable binary format developed by the National\n\
606 Center for Supercomputing Applications at the University of Illinois.)\n\
607 Note that Octave can read @sc{hdf5} files not created by itself, but may\n\
608 skip some datasets in formats that it cannot support. This format is\n\
609 only available if Octave was built with a link to the @sc{hdf5} libraries.\n\
612 This option is accepted for backward compatibility but is ignored.\n\
613 Octave can now support multi-dimensional HDF data and automatically\n\
614 modifies variable names if they are invalid Octave identifiers.\n\
617 @itemx -mat-binary\n\
622 Force Octave to assume the file is in @sc{matlab}'s version 6 or 7 binary\n\
625 @item -mat4-binary\n\
629 Force Octave to assume the file is in the binary format written by\n\
630 @sc{matlab} version 4.\n\
633 Force Octave to assume the file is in Octave's text format.\n\
635 @seealso{save, dlmwrite, csvwrite, fwrite}\n\
640 int argc = args.
length () + 1;
648 std::string orig_fname =
"";
651 if (argc > 1 && ! argv[1].empty () && argv[1].at (0) !=
'-')
653 orig_fname = argv[1];
663 bool list_only =
false;
664 bool verbose =
false;
667 for (; i < argc; i++)
669 if (argv[i] ==
"-force" || argv[i] ==
"-f")
674 else if (argv[i] ==
"-list" || argv[i] ==
"-l")
678 else if (argv[i] ==
"-verbose" || argv[i] ==
"-v")
682 else if (argv[i] ==
"-ascii" || argv[i] ==
"-a")
686 else if (argv[i] ==
"-binary" || argv[i] ==
"-b")
690 else if (argv[i] ==
"-mat-binary" || argv[i] ==
"-mat" || argv[i] ==
"-m"
691 || argv[i] ==
"-6" || argv[i] ==
"-v6")
695 else if (argv[i] ==
"-7" || argv[i] ==
"-v7")
699 else if (argv[i] ==
"-mat4-binary" || argv[i] ==
"-V4"
700 || argv[i] ==
"-v4" || argv[i] ==
"-4")
704 else if (argv[i] ==
"-hdf5" || argv[i] ==
"-h")
709 error (
"load: octave executable was not linked with HDF5 library");
713 else if (argv[i] ==
"-import" || argv[i] ==
"-i")
715 warning (
"load: -import ignored");
717 else if (argv[i] ==
"-text" || argv[i] ==
"-t")
725 if (orig_fname ==
"")
733 orig_fname = argv[i];
742 if (orig_fname ==
"-")
748 error (
"load: cannot read HDF5 format from stdin");
758 retval =
do_load (std::cin, orig_fname, format, flt_fmt,
759 list_only, swap, verbose, argv, i, argc,
763 error (
"load: must specify file format if reading from stdin");
774 bool use_zlib =
false;
786 if (hdf5_file.file_id >= 0)
788 retval =
do_load (hdf5_file, orig_fname, format,
789 flt_fmt, list_only, swap, verbose,
790 argv, i, argc, nargout);
807 std::ios::openmode mode = std::ios::in | std::ios::binary;
820 if (file) file.
close ();
830 if (file) file.close ();
835 retval =
do_load (file, orig_fname, format,
836 flt_fmt, list_only, swap, verbose,
837 argv, i, argc, nargout);
847 std::ifstream file (fname.c_str (), mode);
855 if (file) file.close ();
865 if (file) file.close ();
870 retval =
do_load (file, orig_fname, format,
871 flt_fmt, list_only, swap, verbose,
872 argv, i, argc, nargout);
877 error (
"load: unable to open input file '%s'",
878 orig_fname.c_str ());
883 error (
"load: unable to determine file format of '%s'",
884 orig_fname.c_str ());
898 int len = pattern.length ();
900 for (
int i = 0; i < len; i++)
933 const std::string& name,
const std::string& help,
949 warning (
"save: unable to save %s in ASCII format", name.c_str ());
986 std::string name = sr.
name ();
990 do_save (os, val, name, help, global, fmt, save_as_floats);
999 const std::string& pattern,
1008 std::string empty_str;
1013 0, fmt, save_as_floats);
1033 typedef std::list<symbol_table::symbol_record>::const_iterator
1034 const_vars_iterator;
1036 for (const_vars_iterator p = vars.begin (); p != vars.end (); p++)
1038 do_save (os, *p, fmt, save_as_floats);
1052 bool &save_as_floats,
bool &use_zlib)
1055 int argc = argv.
length ();
1057 bool do_double =
false;
1058 bool do_tabs =
false;
1060 for (
int i = 0; i < argc; i++)
1062 if (argv[i] ==
"-append")
1066 else if (argv[i] ==
"-ascii" || argv[i] ==
"-a")
1070 else if (argv[i] ==
"-double")
1074 else if (argv[i] ==
"-tabs")
1078 else if (argv[i] ==
"-text" || argv[i] ==
"-t")
1082 else if (argv[i] ==
"-binary" || argv[i] ==
"-b")
1086 else if (argv[i] ==
"-hdf5" || argv[i] ==
"-h")
1091 error (
"save: octave executable was not linked with HDF5 library");
1094 else if (argv[i] ==
"-mat-binary" || argv[i] ==
"-mat"
1095 || argv[i] ==
"-m" || argv[i] ==
"-6" || argv[i] ==
"-v6"
1096 || argv[i] ==
"-V6")
1101 else if (argv[i] ==
"-mat7-binary" || argv[i] ==
"-7"
1102 || argv[i] ==
"-v7" || argv[i] ==
"-V7")
1107 else if (argv[i] ==
"-mat4-binary" || argv[i] ==
"-V4"
1108 || argv[i] ==
"-v4" || argv[i] ==
"-4")
1112 else if (argv[i] ==
"-float-binary" || argv[i] ==
"-f")
1115 save_as_floats =
true;
1117 else if (argv[i] ==
"-float-hdf5")
1121 save_as_floats =
true;
1123 error (
"save: octave executable was not linked with HDF5 library");
1127 else if (argv[i] ==
"-zip" || argv[i] ==
"-z")
1132 else if (argv[i] ==
"-struct")
1136 else if (argv[i][0] ==
'-' && argv[i] !=
"-")
1138 error (
"save: Unrecognized option '%s'", argv[i].c_str ());
1149 warning (
"save: \"-double\" option only has an effect with \"-ascii\"");
1157 warning (
"save: \"-tabs\" option only has an effect with \"-ascii\"");
1165 bool &append,
bool &save_as_floats,
1168 std::istringstream is (arg);
1185 switch (format.
type)
1190 ?
"Octave-1-B" :
"Octave-1-L");
1204 char const * versionmagic;
1205 int16_t number = *(
reinterpret_cast<const int16_t *
>(
"\x00\x01"));
1208 char headertext[128];
1211 bdt = *gnulib::gmtime (&now);
1212 memset (headertext,
' ', 124);
1214 nstrftime (headertext, 124,
"MATLAB 5.0 MAT-file, written by Octave "
1225 versionmagic =
"\x01\x00\x4d\x49";
1227 versionmagic =
"\x00\x01\x49\x4d";
1229 memcpy (headertext+124, versionmagic, 4);
1230 os.write (headertext, 128);
1244 if (! comment_string.empty ())
1250 H5Gset_comment (hs.
file_id,
"/", comment_string.c_str ());
1254 os << comment_string <<
"\n";
1283 bool save_as_floats,
bool write_header_info)
1285 if (write_header_info)
1288 if (argv_idx == argc)
1290 save_vars (os,
"*", fmt, save_as_floats);
1292 else if (argv[argv_idx] ==
"-struct")
1294 if (++argv_idx >= argc)
1296 error (
"save: missing struct name");
1300 std::string struct_name = argv[argv_idx];
1304 error (
"save: no such variable: '%s'", struct_name.c_str ());
1310 if (! struct_var.
is_map () || struct_var.
numel () != 1)
1312 error (
"save: '%s' is not a scalar structure",
1313 struct_name.c_str ());
1320 if (argv_idx < argc)
1322 for (
int i = argv_idx; i < argc; i++)
1324 if (!
save_fields (os, struct_var_map, argv[i], fmt,
1327 warning (
"save: no such field '%s.%s'",
1328 struct_name.c_str (), argv[i].c_str ());
1333 save_fields (os, struct_var_map,
"*", fmt, save_as_floats);
1337 for (
int i = argv_idx; i < argc; i++)
1341 if (!
save_vars (os, argv[i], fmt, save_as_floats))
1342 warning (
"save: no such variable '%s'", argv[i].c_str ());
1349 bool save_as_floats)
1353 std::list<symbol_table::symbol_record>
vars
1356 double save_mem_size = 0;
1358 typedef std::list<symbol_table::symbol_record>::const_iterator
1359 const_vars_iterator;
1361 for (const_vars_iterator p = vars.begin (); p != vars.end (); p++)
1367 std::string name = p->name ();
1369 bool global = p->is_global ();
1371 double val_size = val.
byte_size () / 1024;
1375 if (Voctave_core_file_limit < 0
1376 || save_mem_size + val_size < Voctave_core_file_limit)
1378 save_mem_size += val_size;
1380 do_save (os, val, name, help, global, fmt, save_as_floats);
1388 message (0,
"save to '%s' complete", fname);
1400 message (0,
"attempting to save variables to '%s'...", fname);
1404 bool save_as_floats =
false;
1406 bool append =
false;
1408 bool use_zlib =
false;
1411 save_as_floats, use_zlib);
1413 std::ios::openmode mode = std::ios::out;
1426 mode |= std::ios::binary;
1428 mode |= append ? std::ios::ate : std::ios::trunc;
1442 warning (
"unable to open '%s' for writing...", fname);
1461 warning (
"unable to open '%s' for writing...", fname);
1466 std::ofstream file (fname, mode);
1475 warning (
"unable to open '%s' for writing...", fname);
1481 DEFUN (save, args, nargout,
1483 @deftypefn {Command} {} save file\n\
1484 @deftypefnx {Command} {} save options file\n\
1485 @deftypefnx {Command} {} save options file @var{v1} @var{v2} @dots{}\n\
1486 @deftypefnx {Command} {} save options file -struct @var{STRUCT} @var{f1} @var{f2} @dots{}\n\
1487 @deftypefnx {Command} {} save @code{\"-\"} @var{v1} @var{v2} @dots{}\n\
1488 @deftypefnx {Built-in Function} {@var{s} =} save (@code{\"-\"} @var{v1} @var{v2} @dots{})\n\
1489 Save the named variables @var{v1}, @var{v2}, @dots{}, in the file\n\
1492 The special filename @samp{-} may be used to return the\n\
1493 content of the variables as a string. If no variable names are listed,\n\
1494 Octave saves all the variables in the current scope. Otherwise, full\n\
1495 variable names or pattern syntax can be used to specify the variables to\n\
1496 save. If the @option{-struct} modifier is used, fields @var{f1} @var{f2}\n\
1497 @dots{} of the scalar structure @var{STRUCT} are saved as if they were\n\
1498 variables with corresponding names. Valid options for the @code{save}\n\
1499 command are listed in the following table. Options that modify the output\n\
1500 format override the format specified by @code{save_default_options}.\n\
1502 If save is invoked using the functional form\n\
1505 save (\"-option1\", @dots{}, \"file\", \"v1\", @dots{})\n\
1509 then the @var{options}, @var{file}, and variable name arguments\n\
1510 (@var{v1}, @dots{}) must be specified as character strings.\n\
1512 If called with a filename of @qcode{\"-\"}, write the output to stdout\n\
1513 if nargout is 0, otherwise return the output in a character string.\n\
1517 Append to the destination instead of overwriting.\n\
1520 Save a single matrix in a text file without header or any other information.\n\
1523 Save the data in Octave's binary data format.\n\
1525 @item -float-binary\n\
1526 Save the data in Octave's binary data format but only using single\n\
1527 precision. Only use this format if you know that all the\n\
1528 values to be saved can be represented in single precision.\n\
1531 Save the data in @sc{hdf5} format.\n\
1532 (HDF5 is a free, portable binary format developed by the National\n\
1533 Center for Supercomputing Applications at the University of Illinois.)\n\
1534 This format is only available if Octave was built with a link to the\n\
1535 @sc{hdf5} libraries.\n\
1537 @item -float-hdf5\n\
1538 Save the data in @sc{hdf5} format but only using single precision.\n\
1539 Only use this format if you know that all the\n\
1540 values to be saved can be represented in single precision.\n\
1545 @itemx -mat7-binary\n\
1546 Save the data in @sc{matlab}'s v7 binary data format.\n\
1552 @itemx -mat-binary\n\
1553 Save the data in @sc{matlab}'s v6 binary data format.\n\
1558 @itemx -mat4-binary\n\
1559 Save the data in the binary format written by @sc{matlab} version 4.\n\
1562 Save the data in Octave's text data format. (default).\n\
1566 Use the gzip algorithm to compress the file. This works equally on files\n\
1567 that are compressed with gzip outside of octave, and gzip can equally be\n\
1568 used to convert the files for backward compatibility.\n\
1569 This option is only available if Octave was built with a link to the zlib\n\
1573 The list of variables to save may use wildcard patterns containing\n\
1574 the following special characters:\n\
1578 Match any single character.\n\
1581 Match zero or more characters.\n\
1583 @item [ @var{list} ]\n\
1584 Match the list of characters specified by @var{list}. If the first\n\
1585 character is @code{!} or @code{^}, match all characters except those\n\
1586 specified by @var{list}. For example, the pattern @code{[a-zA-Z]} will\n\
1587 match all lower and uppercase alphabetic characters.\n\
1589 Wildcards may also be used in the field name specifications when using\n\
1590 the @option{-struct} modifier (but not in the struct name itself).\n\
1594 Except when using the @sc{matlab} binary data file format or the\n\
1595 @samp{-ascii} format, saving global\n\
1596 variables also saves the global status of the variable. If the variable\n\
1597 is restored at a later time using @samp{load}, it will be restored as a\n\
1603 save -binary data a b*\n\
1607 saves the variable @samp{a} and all variables beginning with @samp{b} to\n\
1608 the file @file{data} in Octave's binary format.\n\
1609 @seealso{load, save_default_options, save_header_format_string, dlmread, csvread, fread}\n\
1622 bool save_as_floats =
false;
1626 bool append =
false;
1628 bool use_zlib =
false;
1637 int argc = argv.
length ();
1649 if (save_as_floats && format ==
LS_ASCII)
1651 error (
"save: cannot specify both -ascii and -float-binary");
1661 error (
"save: cannot write HDF5 format to stdout");
1668 warning (
"save: ignoring -append option for output to stdout");
1671 save_vars (argv, i, argc, std::cout, format, save_as_floats,
true);
1674 std::ostringstream output_buf;
1675 save_vars (argv, i, argc, output_buf, format, save_as_floats,
true);
1698 std::ios::openmode mode
1699 = append ? (std::ios::app | std::ios::ate) : std::ios::out;
1708 mode |= std::ios::binary;
1716 error (
"save: appending to HDF5 files is not implemented");
1720 bool write_header_info
1721 = ! (append && H5Fis_hdf5 (fname.c_str ()) > 0);
1725 if (hdf5_file.file_id != -1)
1727 save_vars (argv, i, argc, hdf5_file, format,
1728 save_as_floats, write_header_info);
1750 bool write_header_info = ! file.tellp ();
1753 save_as_floats, write_header_info);
1766 std::ofstream file (fname.c_str (), mode);
1770 bool write_header_info = ! file.tellp ();
1773 save_as_floats, write_header_info);
1789 DEFUN (crash_dumps_octave_core, args, nargout,
1791 @deftypefn {Built-in Function} {@var{val} =} crash_dumps_octave_core ()\n\
1792 @deftypefnx {Built-in Function} {@var{old_val} =} crash_dumps_octave_core (@var{new_val})\n\
1793 @deftypefnx {Built-in Function} {} crash_dumps_octave_core (@var{new_val}, \"local\")\n\
1794 Query or set the internal variable that controls whether Octave tries\n\
1795 to save all current variables to the file @file{octave-workspace} if it\n\
1796 crashes or receives a hangup, terminate or similar signal.\n\
1798 When called from inside a function with the @qcode{\"local\"} option, the\n\
1799 variable is changed locally for the function and any subroutines it calls.\n\
1800 The original variable value is restored when exiting the function.\n\
1801 @seealso{octave_core_file_limit, octave_core_file_name, octave_core_file_options}\n\
1807 DEFUN (save_default_options, args, nargout,
1809 @deftypefn {Built-in Function} {@var{val} =} save_default_options ()\n\
1810 @deftypefnx {Built-in Function} {@var{old_val} =} save_default_options (@var{new_val})\n\
1811 @deftypefnx {Built-in Function} {} save_default_options (@var{new_val}, \"local\")\n\
1812 Query or set the internal variable that specifies the default options\n\
1813 for the @code{save} command, and defines the default format.\n\
1815 Typical values include @qcode{\"-ascii\"}, @qcode{\"-text -zip\"}.\n\
1816 The default value is @option{-text}.\n\
1818 When called from inside a function with the @qcode{\"local\"} option, the\n\
1819 variable is changed locally for the function and any subroutines it calls.\n\
1820 The original variable value is restored when exiting the function.\n\
1827 DEFUN (octave_core_file_limit, args, nargout,
1829 @deftypefn {Built-in Function} {@var{val} =} octave_core_file_limit ()\n\
1830 @deftypefnx {Built-in Function} {@var{old_val} =} octave_core_file_limit (@var{new_val})\n\
1831 @deftypefnx {Built-in Function} {} octave_core_file_limit (@var{new_val}, \"local\")\n\
1832 Query or set the internal variable that specifies the maximum amount\n\
1833 of memory (in kilobytes) of the top-level workspace that Octave will\n\
1834 attempt to save when writing data to the crash dump file (the name of\n\
1835 the file is specified by @var{octave_core_file_name}).\n\
1837 If @var{octave_core_file_options} flags specify a binary format,\n\
1838 then @var{octave_core_file_limit} will be approximately the maximum\n\
1839 size of the file. If a text file format is used, then the file could\n\
1840 be much larger than the limit. The default value is -1 (unlimited)\n\
1842 When called from inside a function with the @qcode{\"local\"} option, the\n\
1843 variable is changed locally for the function and any subroutines it calls.\n\
1844 The original variable value is restored when exiting the function.\n\
1845 @seealso{crash_dumps_octave_core, octave_core_file_name, octave_core_file_options}\n\
1851 DEFUN (octave_core_file_name, args, nargout,
1853 @deftypefn {Built-in Function} {@var{val} =} octave_core_file_name ()\n\
1854 @deftypefnx {Built-in Function} {@var{old_val} =} octave_core_file_name (@var{new_val})\n\
1855 @deftypefnx {Built-in Function} {} octave_core_file_name (@var{new_val}, \"local\")\n\
1856 Query or set the internal variable that specifies the name of the file\n\
1857 used for saving data from the top-level workspace if Octave aborts.\n\
1859 The default value is @qcode{\"octave-workspace\"}\n\
1861 When called from inside a function with the @qcode{\"local\"} option, the\n\
1862 variable is changed locally for the function and any subroutines it calls.\n\
1863 The original variable value is restored when exiting the function.\n\
1864 @seealso{crash_dumps_octave_core, octave_core_file_name, octave_core_file_options}\n\
1870 DEFUN (octave_core_file_options, args, nargout,
1872 @deftypefn {Built-in Function} {@var{val} =} octave_core_file_options ()\n\
1873 @deftypefnx {Built-in Function} {@var{old_val} =} octave_core_file_options (@var{new_val})\n\
1874 @deftypefnx {Built-in Function} {} octave_core_file_options (@var{new_val}, \"local\")\n\
1875 Query or set the internal variable that specifies the options used for\n\
1876 saving the workspace data if Octave aborts.\n\
1878 The value of @code{octave_core_file_options} should follow the same format\n\
1879 as the options for the @code{save} function. The default value is Octave's\n\
1882 When called from inside a function with the @qcode{\"local\"} option, the\n\
1883 variable is changed locally for the function and any subroutines it calls.\n\
1884 The original variable value is restored when exiting the function.\n\
1885 @seealso{crash_dumps_octave_core, octave_core_file_name, octave_core_file_limit}\n\
1891 DEFUN (save_header_format_string, args, nargout,
1893 @deftypefn {Built-in Function} {@var{val} =} save_header_format_string ()\n\
1894 @deftypefnx {Built-in Function} {@var{old_val} =} save_header_format_string (@var{new_val})\n\
1895 @deftypefnx {Built-in Function} {} save_header_format_string (@var{new_val}, \"local\")\n\
1896 Query or set the internal variable that specifies the format\n\
1897 string used for the comment line written at the beginning of\n\
1898 text-format data files saved by Octave.\n\
1900 The format string is passed to @code{strftime} and should begin with the\n\
1901 character @samp{#} and contain no newline characters. If the value of\n\
1902 @code{save_header_format_string} is the empty string, the header comment is\n\
1903 omitted from text-format data files. The default value is\n\
1904 @c Set example in small font to prevent overfull line\n\
1907 \"# Created by Octave VERSION, %a %b %d %H:%M:%S %Y %Z <USER@@HOST>\"\n\
1908 @end smallexample\n\
1910 When called from inside a function with the @qcode{\"local\"} option, the\n\
1911 variable is changed locally for the function and any subroutines it calls.\n\
1912 The original variable value is restored when exiting the function.\n\
1913 @seealso{strftime, save}\n\
static std::string Voctave_core_file_name
static std::string default_save_header_format(void)
static void do_save(std::ostream &os, const octave_value &tc, const std::string &name, const std::string &help, bool global, load_save_format fmt, bool save_as_floats)
std::string find_data_file_in_load_path(const std::string &fcn, const std::string &file, bool require_regular_file)
octave_idx_type nfields(void) const
static bool Vcrash_dumps_octave_core
std::string read_mat_ascii_data(std::istream &is, const std::string &filename, octave_value &tc)
octave_idx_type rows(void) const
std::string read_hdf5_data(std::istream &is, const std::string &, bool &global, octave_value &tc, std::string &doc, const string_vector &argv, int argv_idx, int argc)
void octave_prepare_hdf5(void)
bool is_octave_data_file(const std::string &fname)
OCTINTERP_API void print_usage(void)
std::string strftime(const std::string &fmt) const
octave_idx_type length(void) const
static std::list< symbol_record > all_variables(scope_id scope=xcurrent_scope, context_id context=xdefault_context, bool defined_only=true, unsigned int exclude=symbol_record::hidden)
const octave_value & contents(const_iterator p) const
bool is_defined(void) const
bool looks_like_mat_ascii_file(std::istream &is, const std::string &filename)
std::ostream & list_in_columns(std::ostream &, int width=0, const std::string &prefix=std::string()) const
Gzipped file output stream class.
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
#define SET_INTERNAL_VARIABLE(NM)
octave_value varval(context_id context=xdefault_context) const
static string_vector names(const map_type &lst)
octave_value do_load(std::istream &stream, const std::string &orig_fname, load_save_format format, oct_mach_info::float_format flt_fmt, bool list_only, bool swap, bool verbose, const string_vector &argv, int argv_idx, int argc, int nargout)
static std::map< std::string, std::string > vars
static std::string Voctave_core_file_options
static bool glob_pattern_p(const std::string &pattern)
bool save_mat5_binary_element(std::ostream &os, const octave_value &tc, const std::string &name, bool mark_as_global, bool mat7_format, bool save_as_floats, bool compressing)
static void mark_global(const std::string &name)
static std::list< symbol_record > glob(const std::string &pattern)
static void clear(const std::string &name)
std::string read_mat5_binary_element(std::istream &is, const std::string &filename, bool swap, bool &global, octave_value &tc)
static void read_mat_binary_data(std::istream &is, double *data, int precision, int len, bool swap, oct_mach_info::float_format flt_fmt)
static octave_value varval(const std::string &name, scope_id scope=xcurrent_scope, context_id context=xdefault_context)
static std::string tilde_expand(const std::string &)
static scope_id top_scope(void)
bool save_mat_ascii_data(std::ostream &os, const octave_value &val, int precision, bool tabs)
int read_mat_file_header(std::istream &is, bool &swap, int32_t &mopt, int32_t &nr, int32_t &nc, int32_t &imag, int32_t &len, int quiet)
void message(const char *name, const char *fmt,...)
octave_idx_type columns(void) const
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
static bool check_gzip_magic(const std::string &fname)
octave_fields::const_iterator const_iterator
static size_t save_fields(std::ostream &os, const octave_scalar_map &m, const std::string &pattern, load_save_format fmt, bool save_as_floats)
const_iterator begin(void) const
std::string key(const_iterator p) const
octave_idx_type numel(const octave_value_list &idx)
bool is_global(void) const
bool save_ascii_data(std::ostream &os, const octave_value &val_arg, const std::string &name, bool mark_as_global, int precision)
static void global_assign(const std::string &name, const octave_value &value=octave_value())
string_vector & append(const std::string &s)
int float_format_to_mopt_digit(oct_mach_info::float_format flt_fmt)
static bool is_variable(const std::string &name)
const_iterator end(void) const
void close()
Close gzipped file.
bool match(const std::string &str) const
void gripe_unrecognized_data_fmt(const char *warn_for)
static string_vector parse_save_options(const string_vector &argv, load_save_format &format, bool &append, bool &save_as_floats, bool &use_zlib)
static void assign(const std::string &name, const octave_value &value=octave_value(), scope_id scope=xcurrent_scope, context_id context=xdefault_context, bool force_add=false)
std::string read_binary_data(std::istream &is, bool swap, oct_mach_info::float_format fmt, const std::string &filename, bool &global, octave_value &tc, std::string &doc)
static bool words_big_endian(void)
int read_mat5_binary_file_header(std::istream &is, bool &swap, bool quiet, const std::string &filename)
oct_mach_info::float_format mopt_digit_to_float_format(int mach)
#define SET_NONEMPTY_INTERNAL_STRING_VARIABLE(NM)
static double Voctave_core_file_limit
static void install_loaded_variable(const std::string &name, const octave_value &val, bool global, const std::string &)
bool save_hdf5_data(std::ostream &os, const octave_value &tc, const std::string &name, const std::string &doc, bool mark_as_global, bool save_as_floats)
Gzipped file input stream class.
void warning(const char *fmt,...)
static std::string dir_sep_chars(void)
std::string type_name(void) const
octave_idx_type length(void) const
Number of elements in the array.
octave_scalar_map scalar_map_value(void) const
static float_format native_float_format(void)
bool save_binary_data(std::ostream &os, const octave_value &tc, const std::string &name, const std::string &doc, bool mark_as_global, bool save_as_floats)
bool save_mat_binary_data(std::ostream &os, const octave_value &tc, const std::string &name)
void octave_finalize_hdf5(void)
void assign(const std::string &k, const octave_value &val)
static std::string get_user_name(void)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
static void gripe_file_open(const std::string &fcn, const std::string &file)
int read_binary_file_header(std::istream &is, bool &swap, oct_mach_info::float_format &flt_fmt, bool quiet)
ColumnVector imag(const ComplexColumnVector &a)
std::string find_file_to_load(const std::string &name, const std::string &orig_name)
void write_header(std::ostream &os, load_save_format format)
void close()
Close gzipped file.
static load_save_format get_file_format(std::istream &file, const std::string &filename)
static std::string get_host_name(void)
static std::string Vsave_header_format_string
static size_t save_vars(std::ostream &os, const std::string &pattern, load_save_format fmt, bool save_as_floats)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
static void dump_octave_core(std::ostream &os, const char *fname, load_save_format fmt, bool save_as_floats)
static bool matches_patterns(const string_vector &patterns, int pat_idx, int num_pat, const std::string &name)
std::string read_ascii_data(std::istream &is, const std::string &filename, bool &global, octave_value &tc, octave_idx_type count)
size_t byte_size(void) const
static std::string Vsave_default_options
const std::string & name(void) const