Mercurial > hg > octave-max
changeset 5369:4bbde94b5cf8
[project @ 2005-05-23 23:39:28 by jwe]
author | jwe |
---|---|
date | Mon, 23 May 2005 23:39:28 +0000 |
parents | 720dc7f7a75e |
children | f07a9653b844 |
files | src/ChangeLog src/load-save.cc |
diffstat | 2 files changed, 23 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2005-05-23 John W. Eaton <jwe@octave.org> + * load-save.cc (gripe_file_open): New function. + (get_file_format, Fload, Fsave): Use it. + * DLD-FUNCTIONS/sort.cc (mx_sort, mx_sort_indexed): Return appropriately sized empty values for empty args.
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -107,6 +107,17 @@ // no newline characters. static std::string Vsave_header_format_string; +static void +gripe_file_open (const std::string& fcn, const std::string& file) +{ + if (fcn == "load") + error ("%s: unable to open input file `%s'", fcn.c_str (), file.c_str ()); + else if (fcn == "save") + error ("%s: unable to open output file `%s'", fcn.c_str (), file.c_str ()); + else + error ("%s: unable to open file `%s'", fcn.c_str (), file.c_str ()); +} + // XXX FIXME XXX -- shouldn't this be implemented in terms of other // functions that are already available? @@ -285,7 +296,7 @@ else { if (! quiet) - error ("load: can't read binary file"); + error ("load: unable to read read binary file"); return -1; } @@ -418,7 +429,7 @@ #endif } else - error ("load: couldn't open input file `%s'", orig_fname.c_str ()); + gripe_file_open ("load", orig_fname); return retval; } @@ -800,7 +811,7 @@ file_mat_exist.close (); else { - error ("load: nonexistent file: `%s'", orig_fname.c_str ()); + gripe_file_open ("load", orig_fname); return retval; } } @@ -824,8 +835,7 @@ hdf5_file.close (); } else - error ("load: couldn't open input file `%s'", - orig_fname.c_str ()); + gripe_file_open ("load", orig_fname); } else #endif /* HAVE_HDF5 */ @@ -878,8 +888,7 @@ file.close (); } else - error ("load: couldn't open input file `%s'", - orig_fname.c_str ()); + gripe_file_open ("load", orig_fname); } else #endif @@ -913,7 +922,7 @@ file.close (); } else - error ("load: couldn't open input file `%s'", + error ("load: unable open input file `%s'", orig_fname.c_str ()); } } @@ -1659,7 +1668,7 @@ } else { - error ("save: couldn't open output file `%s'", fname.c_str ()); + gripe_file_open ("save", fname); return retval; } } @@ -1686,8 +1695,7 @@ } else { - error ("save: couldn't open output file `%s'", - fname.c_str ()); + gripe_file_open ("save", fname); return retval; } } @@ -1709,8 +1717,7 @@ } else { - error ("save: couldn't open output file `%s'", - fname.c_str ()); + gripe_file_open ("save", fname); return retval; } }