Mercurial > hg > octave-avbm
changeset 2668:0d865ef7478f
[project @ 1997-02-13 18:21:47 by jwe]
author | jwe |
---|---|
date | Thu, 13 Feb 1997 18:22:39 +0000 |
parents | 1d2a83e8a9a3 |
children | c821858188b6 |
files | liboctave/ChangeLog liboctave/file-ops.cc liboctave/file-ops.h liboctave/lo-ieee.cc src/gripes.cc src/gripes.h src/ov-str-mat.cc |
diffstat | 7 files changed, 117 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,17 @@ +Tue Feb 11 19:44:28 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * lo-ieee.cc: Declare quiet_nan() and infinity(). + +Mon Feb 10 01:17:45 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * file-ops.cc (oct_unlink (const string&, string&)): + New two-arg version. + (oct_rmdir (const string&, string&)): New two-arg version. + (oct_mkdir (const string&, mode_t, string&)): New three-arg version. + (oct_mkfifo (const string&, mode_t, string&)): New three-arg version. + (oct_rename (const string&, const string&, string&)): + New three-arg version. + Fri Feb 7 13:15:55 1997 John W. Eaton <jwe@bevo.che.wisc.edu> * idx-vector.h (idx_vector::orig_empty): New function.
--- a/liboctave/file-ops.cc +++ b/liboctave/file-ops.cc @@ -238,6 +238,19 @@ return mkdir (name.c_str (), mode); } +int +oct_mkdir (const string& name, mode_t mode, string& msg) +{ + msg = string (); + + int status = mkdir (name.c_str (), mode); + + if (status < 0) + msg = strerror (errno); + + return status; +} + // I don't know how to emulate this on systems that don't provide it. int @@ -251,6 +264,24 @@ #endif } +int +oct_mkfifo (const string& name, mode_t mode, string& msg) +{ + msg = string (); + +#if defined (HAVE_MKFIFO) + int status = mkfifo (name.c_str (), mode); + + if (status < 0) + msg = strerror (errno); + + return status; +#else + ::error ("mkfifo: not implemented on this system"); + return -1; +#endif +} + // We provide a replacement for rename(). int @@ -259,6 +290,19 @@ return rename (from.c_str (), to.c_str ()); } +int +oct_rename (const string& from, const string& to, string& msg) +{ + msg = string (); + + int status = rename (from.c_str (), to.c_str ()); + + if (status < 0) + msg = strerror (errno); + + return status; +} + // We provide a replacement for rmdir(). int @@ -267,6 +311,19 @@ return rmdir (name.c_str ()); } +int +oct_rmdir (const string& name, string& msg) +{ + msg = string (); + + int status = rmdir (name.c_str ()); + + if (status < 0) + msg = strerror (errno); + + return status; +} + // We provide a replacement for tempnam(). string @@ -305,6 +362,19 @@ return unlink (name.c_str ()); } +int +oct_unlink (const string& name, string& errmsg) +{ + errmsg = string (); + + int status = unlink (name.c_str ()); + + if (status < 0) + errmsg = strerror (errno); + + return status; +} + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/liboctave/file-ops.h +++ b/liboctave/file-ops.h @@ -192,12 +192,23 @@ extern int is_newer (const string&, time_t); extern int oct_mkdir (const string&, mode_t); +extern int oct_mkdir (const string&, mode_t, string&); + extern int oct_mkfifo (const string&, mode_t); +extern int oct_mkfifo (const string&, mode_t, string&); + extern int oct_rename (const string&, const string&); +extern int oct_rename (const string&, const string&, string&); + extern int oct_rmdir (const string&); +extern int oct_rmdir (const string&, string&); + extern string oct_tempnam (void); + extern int oct_umask (mode_t); + extern int oct_unlink (const string&); +extern int oct_unlink (const string&, string&); #endif
--- a/liboctave/lo-ieee.cc +++ b/liboctave/lo-ieee.cc @@ -41,6 +41,14 @@ #endif #endif +#if defined (HAVE_INFINITY) +#extern "C" double infinity (); +#endif + +#if defined (HAVE_QUIET_NAN) +#extern "C" double quiet_nan (long); +#endif + #include "lo-ieee.h" // Octave's idea of infinity. @@ -58,7 +66,7 @@ // trying to make Inf and NaN. #if defined (HAVE_INFINITY) - octave_Inf = (double) infinity (); + octave_Inf = infinity (); #elif defined (linux) octave_Inf = HUGE_VAL; #elif defined (__alpha__) @@ -84,7 +92,7 @@ #if defined (HAVE_ISNAN) #if defined (HAVE_QUIET_NAN) - octave_NaN = (double) quiet_nan (); + octave_NaN = quiet_nan (0L); #elif defined (linux) octave_NaN = NAN; #elif defined (__alpha__)
--- a/src/gripes.cc +++ b/src/gripes.cc @@ -123,6 +123,13 @@ } void +gripe_wrong_type_arg (const char *name, const string& s) +{ + string type = tc.type_name (); + error ("%s: wrong type argument `%s'", name, s.c_str ()); +} + +void gripe_wrong_type_arg (const char *name, const octave_value& tc) { string type = tc.type_name ();
--- a/src/gripes.h +++ b/src/gripes.h @@ -42,6 +42,7 @@ extern void gripe_unrecognized_float_fmt (void); extern void gripe_unrecognized_data_fmt (const char *warn_for); extern void gripe_data_conversion (const char *from, const char *to); +extern void gripe_wrong_type_arg (const char *name, const string& s); extern void gripe_wrong_type_arg (const char *name, const octave_value& tc); extern void gripe_wrong_type_arg_for_unary_op (const octave_value& op); extern void gripe_wrong_type_arg_for_binary_op (const octave_value& op);
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -38,9 +38,11 @@ #include "gripes.h" #include "pr-output.h" -int octave_char_matrix_str::t_id = -1; +int +octave_char_matrix_str::t_id (-1); -const string octave_char_matrix_str::t_name ("string"); +const string +octave_char_matrix_str::t_name ("string"); static octave_value * default_numeric_conversion_function (const octave_value& a)