comparison libinterp/corefcn/load-save.cc @ 20939:b17fda023ca6

maint: Use new C++ archetype in more files. Place input validation first in files. Move declaration of retval down in function to be closer to point of usage. Eliminate else clause after if () error. Use "return ovl()" where it makes sense. * find.cc, gammainc.cc, gcd.cc, getgrent.cc, getpwent.cc, givens.cc, graphics.cc, help.cc, hess.cc, hex2num.cc, input.cc, kron.cc, load-path.cc, load-save.cc, lookup.cc, mappers.cc, matrix_type.cc, mgorth.cc, nproc.cc, ordschur.cc, pager.cc, pinv.cc, pr-output.cc, profiler.cc, psi.cc, quad.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc, sparse.cc, str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symtab.cc, syscalls.cc, sysdep.cc, time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc, __delaunayn__.cc, __eigs__.cc, __glpk__.cc, __magick_read__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, chol.cc, colamd.cc, dmperm.cc, fftw.cc, qr.cc, symbfact.cc, symrcm.cc, ov-bool-mat.cc, ov-cell.cc, ov-class.cc, ov-classdef.cc, ov-fcn-handle.cc, ov-fcn-inline.cc, ov-flt-re-mat.cc, ov-java.cc, ov-null-mat.cc, ov-oncleanup.cc, ov-re-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov-usr-fcn.cc, ov.cc, octave.cc: Use new C++ archetype in more files.
author Rik <rik@octave.org>
date Fri, 18 Dec 2015 15:37:22 -0800
parents 1142cf6abc0d
children 48b2ad5ee801
comparison
equal deleted inserted replaced
20938:aac911d8847b 20939:b17fda023ca6
1580 saves the variable @samp{a} and all variables beginning with @samp{b} to\n\ 1580 saves the variable @samp{a} and all variables beginning with @samp{b} to\n\
1581 the file @file{data} in Octave's binary format.\n\ 1581 the file @file{data} in Octave's binary format.\n\
1582 @seealso{load, save_default_options, save_header_format_string, dlmread, csvread, fread}\n\ 1582 @seealso{load, save_default_options, save_header_format_string, dlmread, csvread, fread}\n\
1583 @end deftypefn") 1583 @end deftypefn")
1584 { 1584 {
1585 octave_value_list retval;
1586
1587 string_vector argv = args.make_argv ();
1588
1589 // Here is where we would get the default save format if it were 1585 // Here is where we would get the default save format if it were
1590 // stored in a user preference variable. 1586 // stored in a user preference variable.
1591 1587 load_save_format format = LS_TEXT;
1592 bool save_as_floats = false; 1588 bool save_as_floats = false;
1593
1594 load_save_format format = LS_TEXT;
1595
1596 bool append = false; 1589 bool append = false;
1597
1598 bool use_zlib = false; 1590 bool use_zlib = false;
1599 1591
1600 // get default options 1592 // get default options
1601 parse_save_options (Vsave_default_options, format, append, save_as_floats, 1593 parse_save_options (Vsave_default_options, format, append, save_as_floats,
1602 use_zlib); 1594 use_zlib);
1603 1595
1604 // override from command line 1596 // override from command line
1597 string_vector argv = args.make_argv ();
1598
1605 argv = parse_save_options (argv, format, append, save_as_floats, 1599 argv = parse_save_options (argv, format, append, save_as_floats,
1606 use_zlib); 1600 use_zlib);
1601
1607 int argc = argv.numel (); 1602 int argc = argv.numel ();
1608 int i = 0; 1603 int i = 0;
1609 1604
1610 if (i == argc) 1605 if (i == argc)
1611 print_usage (); 1606 print_usage ();
1612 1607
1613 if (save_as_floats && format == LS_TEXT) 1608 if (save_as_floats && format == LS_TEXT)
1614 error ("save: cannot specify both -text and -float-binary"); 1609 error ("save: cannot specify both -text and -float-binary");
1610
1611 octave_value_list retval;
1615 1612
1616 if (argv[i] == "-") 1613 if (argv[i] == "-")
1617 { 1614 {
1618 i++; 1615 i++;
1619 1616