# HG changeset patch # User jwe # Date 1144867156 0 # Node ID 493849caf7e96178242af7194d6dcad6350f70e8 # Parent ca40a52804f4d3b1f8582cb434c2888fb277088d [project @ 2006-04-12 18:39:16 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-struct.cc (struct_levels_to_print): Move here from ov.cc. + (Vstruct-levels_to_print): Likewise. Now static. + (symbols_of_ov_struct): New function. Move DEFVAR for + struct_levels_to_print here from symbols_of_ov in ov.cc. + * ov.h (Vstruct-levels_to_print): Delete decl. + * gripes.cc (warn_divide_by_zero): Move here from ov.cc. (Vwarn_divide_by_zero): Likewise. Now static. (symbols_of_gripes): New function. Move DEFVAR for diff --git a/src/ov-struct.cc b/src/ov-struct.cc --- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -49,6 +49,9 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_struct, "struct", "struct"); +// How many levels of structure elements should we print? +static int Vstruct_levels_to_print; + Cell octave_struct::dotref (const octave_value_list& idx) { @@ -1046,7 +1049,7 @@ // recurse to read cell elements std::string nm - = read_ascii_data (is, std::string (), dummy, t2, count); + = read_ascii_data (is, std::string (), dummy, t2, j); if (!is) break; @@ -1263,6 +1266,35 @@ #endif +static int +struct_levels_to_print (void) +{ + double val; + if (builtin_real_scalar_variable ("struct_levels_to_print", val) + && ! xisnan (val)) + { + int ival = NINT (val); + if (ival == val) + { + Vstruct_levels_to_print = ival; + return 0; + } + } + gripe_invalid_value_specified ("struct_levels_to_print"); + return -1; +} + +void +symbols_of_ov_struct (void) +{ + DEFVAR (struct_levels_to_print, 2.0, struct_levels_to_print, + "-*- texinfo -*-\n\ +@defvr {Built-in Variable} struct_levels_to_print\n\ +You can tell Octave how many structure levels to display by setting the\n\ +built-in variable @code{struct_levels_to_print}. The default value is 2.\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 @@ -110,9 +110,6 @@ // If TRUE, print the name along with the value. bool Vprint_answer_id_name; -// How many levels of structure elements should we print? -int Vstruct_levels_to_print; - // If TRUE, print a warning when a matrix is resized by an indexed // assignment with indices outside the current bounds. bool Vwarn_resize_on_range_error; @@ -2310,24 +2307,6 @@ return 0; } -static int -struct_levels_to_print (void) -{ - double val; - if (builtin_real_scalar_variable ("struct_levels_to_print", val) - && ! xisnan (val)) - { - int ival = NINT (val); - if (ival == val) - { - Vstruct_levels_to_print = ival; - return 0; - } - } - gripe_invalid_value_specified ("struct_levels_to_print"); - return -1; -} - void symbols_of_ov (void) { @@ -2360,13 +2339,6 @@ depending on the value of @code{silent_functions}.\n\ @end defvr"); - DEFVAR (struct_levels_to_print, 2.0, struct_levels_to_print, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} struct_levels_to_print\n\ -You can tell Octave how many structure levels to display by setting the\n\ -built-in variable @code{struct_levels_to_print}. The default value is 2.\n\ -@end defvr"); - DEFVAR (warn_fortran_indexing, false, warn_fortran_indexing, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_fortran_indexing\n\ diff --git a/src/ov.h b/src/ov.h --- a/src/ov.h +++ b/src/ov.h @@ -975,9 +975,6 @@ // If TRUE, print the name along with the value. extern bool Vprint_answer_id_name; -// How many levels of structure elements should we print? -extern int Vstruct_levels_to_print; - // If TRUE, print a warning when a matrix is resized by an indexed // assignment with indices outside the current bounds. extern bool Vwarn_resize_on_range_error;