# HG changeset patch # User jwe # Date 1144869806 0 # Node ID 65208d959bf1681c18fd3adec4f4f9daa1d74bf2 # Parent 958e365b875e2924b8367141e8e63bb1e2aa6ae5 [project @ 2006-04-12 19:23:26 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2006-04-12 John W. Eaton + * 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. diff --git a/src/gripes.cc b/src/gripes.cc --- 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) diff --git a/src/ov-str-mat.cc b/src/ov-str-mat.cc --- 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++ *** diff --git a/src/ov.cc b/src/ov.cc --- 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"); } /* diff --git a/src/ov.h b/src/ov.h --- 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;