Mercurial > hg > octave-lyh
diff src/symtab.h @ 5397:b12c0f920da0
[project @ 2005-06-17 07:52:28 by jwe]
author | jwe |
---|---|
date | Fri, 17 Jun 2005 07:52:28 +0000 |
parents | 4c8a2e4e0717 |
children | db34dff19947 |
line wrap: on
line diff
--- a/src/symtab.h +++ b/src/symtab.h @@ -90,7 +90,7 @@ symbol_def (const octave_value& val = octave_value (), unsigned int sym_type = 0) : symbol_type (sym_type), eternal (0), read_only (0), help_string (), - definition (val), count (1) { } + definition (val), visible (true), count (1) { } ~symbol_def (void) { } @@ -209,6 +209,10 @@ void make_eternal (void) { eternal = 1; } + void hide (void) { visible = false; } + void show (void) { visible = true; } + bool is_visible (void) const { return visible; } + octave_value& def (void) { return definition; } std::string help (void) const { return help_string; } @@ -240,6 +244,9 @@ // The value of this definition. See ov.h and related files. octave_value definition; + // Should this symbol show up in listings? + bool visible; + // Reference count. int count; @@ -349,6 +356,10 @@ void make_eternal (void) { definition->make_eternal (); } + void hide (void) { definition->hide (); } + void show (void) { definition->show (); } + bool is_visible (void) const { return definition->is_visible (); } + void set_change_function (change_function f) { chg_fcn = f; } void define (const octave_value& v, unsigned int sym_type = USER_VARIABLE); @@ -363,7 +374,7 @@ void clear (void); - void alias (symbol_record *s); + void alias (symbol_record *s, bool mark_to_clear = false); void mark_as_formal_parameter (void); bool is_formal_parameter (void) const { return formal_param; } @@ -444,10 +455,21 @@ std::stack <symbol_def *> context; std::stack <unsigned int> global_link_context; + std::stack <symbol_record *> aliases_to_clear; + + void push_alias_to_clear (symbol_record *s) + { aliases_to_clear.push (s); } + bool read_only_error (const char *action); void link_to_builtin_variable (void); + void maybe_delete_def (void) + { + if (--definition->count <= 0) + delete definition; + } + // No copying! symbol_record (const symbol_record& s);