Mercurial > hg > octave-nkf
changeset 5758:65208d959bf1
[project @ 2006-04-12 19:23:26 by jwe]
author | jwe |
---|---|
date | Wed, 12 Apr 2006 19:23:26 +0000 |
parents | 958e365b875e |
children | ce79d238f142 |
files | src/ChangeLog src/gripes.cc src/ov-str-mat.cc src/ov.cc src/ov.h |
diffstat | 5 files changed, 50 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2006-04-12 John W. Eaton <jwe@octave.org> + * ov-str-mat.cc (warn_str_to_num): Move here, from ov.cc. + (Vwarn_str_to_num): Likewise. Now static. + (symbols_of_ov_str_mat): New function. Move DEFVAR for + warn_str_to_num here from symbols_of_ov in ov.cc. + * ov.h (Vwarn_str_to_num): Delete decl. + * ov-struct.cc (octave_struct::load_ascii): Pass loop counter, not count, to read_ascii. * ov-list.cc (octave_list::load_ascii): Likewise.
--- a/src/gripes.cc +++ b/src/gripes.cc @@ -32,7 +32,7 @@ #include "utils.h" // Allow divide by zero errors to be suppressed. -bool Vwarn_divide_by_zero; +static bool Vwarn_divide_by_zero; void gripe_not_supported (const char *fcn)
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -33,20 +33,21 @@ #include "mach-info.h" #include "mx-base.h" +#include "defun.h" +#include "byte-swap.h" +#include "gripes.h" +#include "ls-oct-ascii.h" +#include "ls-hdf5.h" +#include "ls-utils.h" #include "oct-obj.h" #include "oct-stream.h" #include "ops.h" #include "ov-scalar.h" #include "ov-re-mat.h" #include "ov-str-mat.h" -#include "gripes.h" #include "pr-output.h" #include "pt-mat.h" - -#include "byte-swap.h" -#include "ls-oct-ascii.h" -#include "ls-hdf5.h" -#include "ls-utils.h" +#include "utils.h" DEFINE_OCTAVE_ALLOCATOR (octave_char_matrix_str); DEFINE_OCTAVE_ALLOCATOR (octave_char_matrix_sq_str); @@ -54,6 +55,13 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_str, "string", "char"); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_sq_str, "sq_string", "char"); +// If TRUE, warn for operations like +// +// octave> 'abc' + 0 +// 97 98 99 +// +static bool Vwarn_str_to_num; + static octave_value * default_numeric_conversion_function (const octave_value& a) { @@ -756,6 +764,35 @@ #endif +static int +warn_str_to_num (void) +{ + Vwarn_str_to_num = check_preference ("warn_str_to_num"); + + return 0; +} + +void +symbols_of_ov_str_mat (void) +{ + DEFVAR (warn_str_to_num, false, warn_str_to_num, + "-*- texinfo -*-\n\ +@defvr {Built-in Variable} warn_str_to_num\n\ +If the value of @code{warn_str_to_num} is nonzero, a warning is printed\n\ +for implicit conversions of strings to their numeric ASCII equivalents.\n\ +For example,\n\ +@example\n\ +@group\n\ +\"abc\" + 0\n\ + @result{} 97 98 99\n\ +@end group\n\ +@end example\n\ +elicits a warning if @code{warn_str_to_num} is nonzero. The default\n\ +value is 0.\n\ +@end defvr"); +} + + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/ov.cc +++ b/src/ov.cc @@ -100,13 +100,6 @@ // to a character string? bool Vwarn_num_to_str; -// If TRUE, warn for operations like -// -// octave> 'abc' + 0 -// 97 98 99 -// -int Vwarn_str_to_num; - // If TRUE, print the name along with the value. bool Vprint_answer_id_name; @@ -2273,14 +2266,6 @@ } static int -warn_str_to_num (void) -{ - Vwarn_str_to_num = check_preference ("warn_str_to_num"); - - return 0; -} - -static int print_answer_id_name (void) { Vprint_answer_id_name = check_preference ("print_answer_id_name"); @@ -2381,21 +2366,6 @@ indices outside the current bounds. The default value is 0.\n\ @end defvr"); - DEFVAR (warn_str_to_num, false, warn_str_to_num, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_str_to_num\n\ -If the value of @code{warn_str_to_num} is nonzero, a warning is printed\n\ -for implicit conversions of strings to their numeric ASCII equivalents.\n\ -For example,\n\ -@example\n\ -@group\n\ -\"abc\" + 0\n\ - @result{} 97 98 99\n\ -@end group\n\ -@end example\n\ -elicits a warning if @code{warn_str_to_num} is nonzero. The default\n\ -value is 0.\n\ -@end defvr"); } /*
--- a/src/ov.h +++ b/src/ov.h @@ -962,13 +962,6 @@ // to a character string? extern bool Vwarn_num_to_str; -// If TRUE, warn for operations like -// -// octave> 'abc' + 0 -// 97 98 99 -// -extern int Vwarn_str_to_num; - // Should we warn about conversions from complex to real? extern int Vwarn_imag_to_real;