Mercurial > hg > octave-max
changeset 2404:68c5868dbe83
[project @ 1996-10-13 18:39:19 by jwe]
author | jwe |
---|---|
date | Sun, 13 Oct 1996 18:42:18 +0000 |
parents | 3a413ee50517 |
children | e6adec89527e |
files | src/ChangeLog src/octave.cc src/symtab.cc src/symtab.h src/variables.cc |
diffstat | 5 files changed, 59 insertions(+), 90 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,16 @@ Sun Oct 13 10:52:28 1996 John W. Eaton <jwe@bevo.che.wisc.edu> + * 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 <jwe@bevo.che.wisc.edu>
--- a/src/octave.cc +++ b/src/octave.cc @@ -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);
--- a/src/symtab.cc +++ b/src/symtab.cc @@ -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)
--- a/src/symtab.h +++ b/src/symtab.h @@ -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.
--- a/src/variables.cc +++ b/src/variables.cc @@ -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"; }