# HG changeset patch # User jwe # Date 845232138 0 # Node ID 68c5868dbe832d8f3beca103764b3f8d8f1f20a3 # Parent 3a413ee505176f1d48a767b0d0459e6dcacddf9f [project @ 1996-10-13 18:39:19 by jwe] diff -r 3a413ee50517 -r 68c5868dbe83 src/ChangeLog --- a/src/ChangeLog Sun Oct 13 16:52:12 1996 +0000 +++ b/src/ChangeLog Sun Oct 13 18:42:18 1996 +0000 @@ -1,8 +1,16 @@ Sun Oct 13 10:52:28 1996 John W. Eaton + * variables.cc (print_symbol_info_line): Never print negative + diminsions. + + * symtab.h (octave_symbol_record_info): Store const_type as string. + (octave_symbol_record_info::init): Delete. Fix constructors. + (octave_symbol_record_info::type_name): Handle const_type as string. + * octave.cc (maximum_braindamage): Replace "true" with 1.0 and "false" with 0.0 in calls to bind_builtin_variable(). Include sun-utils.h here. + (intern_argv): Also bind __argv__. Sat Oct 12 13:40:21 1996 John W. Eaton diff -r 3a413ee50517 -r 68c5868dbe83 src/octave.cc --- a/src/octave.cc Sun Oct 13 16:52:12 1996 +0000 +++ b/src/octave.cc Sun Oct 13 18:42:18 1996 +0000 @@ -179,6 +179,7 @@ octave_argv[i-1] = argv[i]; bind_builtin_variable ("argv", octave_argv, 1, 1, 0); + bind_builtin_variable ("__argv__", octave_argv, 1, 1, 0); } bind_builtin_variable ("nargin", (double) argc-1, 1, 1, 0); diff -r 3a413ee50517 -r 68c5868dbe83 src/symtab.cc --- a/src/symtab.cc Sun Oct 13 16:52:12 1996 +0000 +++ b/src/symtab.cc Sun Oct 13 18:42:18 1996 +0000 @@ -723,39 +723,29 @@ // A structure for handling verbose information about a symbol_record. symbol_record_info::symbol_record_info (void) -{ - init_state (); -} + : initialized (0), nr (-1), nc (-1), type (symbol_def::UNKNOWN), + hides (SR_INFO_NONE), eternal (0), read_only (0), nm (), + const_type () { } symbol_record_info::symbol_record_info (const symbol_record& sr) + : initialized (0), nr (-1), nc (-1), type (sr.type ()), + hides (SR_INFO_NONE), eternal (0), read_only (0), nm (), + const_type () { - init_state (); - - type = sr.type (); - if (sr.is_variable () && sr.is_defined ()) { // Would be nice to avoid this cast. XXX FIXME XXX tree_constant *tmp = (tree_constant *) sr.def (); - if (tmp->is_real_scalar ()) - const_type = SR_INFO_SCALAR; - else if (tmp->is_complex_scalar ()) - const_type = SR_INFO_COMPLEX_SCALAR; - else if (tmp->is_real_matrix ()) - const_type = SR_INFO_MATRIX; - else if (tmp->is_complex_matrix ()) - const_type = SR_INFO_COMPLEX_MATRIX; - else if (tmp->is_range ()) - const_type = SR_INFO_RANGE; - else if (tmp->is_string ()) - const_type = SR_INFO_STRING; + + const_type = tmp->type_name (); nr = tmp->rows (); nc = tmp->columns (); symbol_def *sr_def = sr.definition; symbol_def *hidden_def = sr_def->next_elem; + if (hidden_def) { if (hidden_def->is_user_function ()) @@ -774,32 +764,24 @@ } symbol_record_info::symbol_record_info (const symbol_record_info& s) -{ - type = s.type; - const_type = s.const_type; - hides = s.hides; - eternal = s.eternal; - read_only = s.read_only; - nr = s.nr; - nc = s.nc; - nm = s.nm; - initialized = s.initialized; -} + : initialized (s.initialized), nr (s.nr), nc (s.nc), type (s.type), + hides (s.hides), eternal (s.eternal), read_only (s.read_only), + nm (s.nm), const_type (s.const_type) { } symbol_record_info& symbol_record_info::operator = (const symbol_record_info& s) { if (this != &s) { + initialized = s.initialized; + nr = s.nr; + nc = s.nc; type = s.type; - const_type = s.const_type; hides = s.hides; eternal = s.eternal; read_only = s.read_only; - nr = s.nr; - nc = s.nc; nm = s.nm; - initialized = s.initialized; + const_type = s.const_type; } return *this; } @@ -837,34 +819,32 @@ string symbol_record_info::type_name (void) const { + string retval; + if (type == symbol_def::USER_FUNCTION) - return "user function"; - else if (type == symbol_def::BUILTIN_FUNCTION) - return "builtin function"; - else + retval = "user function"; + else if (type & symbol_def::BUILTIN_FUNCTION) { - if (const_type == SR_INFO_SCALAR) - return "real scalar"; - else if (const_type == SR_INFO_COMPLEX_SCALAR) - return "complex scalar"; - else if (const_type == SR_INFO_MATRIX) - return "real matrix"; - else if (const_type == SR_INFO_COMPLEX_MATRIX) - return "complex matrix"; - else if (const_type == SR_INFO_RANGE) - return "range"; - else if (const_type == SR_INFO_STRING) - return "string"; + if (type & symbol_def::TEXT_FUNCTION) + retval = "text function"; + else if (type & symbol_def::MAPPER_FUNCTION) + retval = "mapper function"; else - return ""; + retval = "builtin function"; } + else + retval = const_type; + + return retval; } int symbol_record_info::is_function (void) const { return (type == symbol_def::USER_FUNCTION - || type == symbol_def::BUILTIN_FUNCTION); + || type == symbol_def::BUILTIN_FUNCTION + || symbol_def::TEXT_FUNCTION + || symbol_def::MAPPER_FUNCTION); } int @@ -885,19 +865,6 @@ return nm; } -void -symbol_record_info::init_state (void) -{ - initialized = 0; - type = symbol_def::UNKNOWN; - const_type = SR_INFO_UNKNOWN; - hides = SR_INFO_NONE; - eternal = 0; - read_only = 0; - nr = -1; - nc = -1; -} - // A symbol table. symbol_table::symbol_table (void) diff -r 3a413ee50517 -r 68c5868dbe83 src/symtab.h --- a/src/symtab.h Sun Oct 13 16:52:12 1996 +0000 +++ b/src/symtab.h Sun Oct 13 18:42:18 1996 +0000 @@ -249,31 +249,17 @@ SR_INFO_BUILTIN_FUNCTION = 2 }; - enum CONST_TYPE - { - SR_INFO_UNKNOWN = 0, - SR_INFO_SCALAR = 1, - SR_INFO_COMPLEX_SCALAR = 2, - SR_INFO_MATRIX = 4, - SR_INFO_COMPLEX_MATRIX = 8, - SR_INFO_RANGE = 16, - SR_INFO_STRING = 32 - }; - private: - void init_state (void); - - unsigned type : 4; - unsigned const_type : 6; + int initialized; + int nr; + int nc; + unsigned type : 6; unsigned hides : 2; unsigned eternal : 1; unsigned read_only : 1; - int nr; - int nc; string nm; - - int initialized; + string const_type; }; // A symbol table. diff -r 3a413ee50517 -r 68c5868dbe83 src/variables.cc --- a/src/variables.cc Sun Oct 13 16:52:12 1996 +0000 +++ b/src/variables.cc Sun Oct 13 18:42:18 1996 +0000 @@ -1026,13 +1026,20 @@ os << (s.hides_fcn () ? "f" : (s.hides_builtin () ? "F" : "-")); #endif os.form (" %-16s", s.type_name ().c_str ()); - if (s.is_function ()) - os << " - -"; + + int nr = s.rows (); + int nc = s.columns (); + + if (nr < 0) + os << " -"; else - { - os.form ("%7d", s.rows ()); - os.form ("%7d", s.columns ()); - } + os.form ("%7d", nr); + + if (nc < 0) + os << " -"; + else + os.form ("%7d", nc); + os << " " << s.name () << "\n"; }