comparison src/symtab.h @ 5794:1138ced03f14

[project @ 2006-05-08 20:23:04 by jwe]
author jwe
date Mon, 08 May 2006 20:23:07 +0000
parents cbf717bf8150
children 080c08b192d8
comparison
equal deleted inserted replaced
5793:395382df0d8a 5794:1138ced03f14
72 USER_VARIABLE = 2, 72 USER_VARIABLE = 2,
73 DLD_FUNCTION = 4, 73 DLD_FUNCTION = 4,
74 BUILTIN_FUNCTION = 8, 74 BUILTIN_FUNCTION = 8,
75 COMMAND = 16, 75 COMMAND = 16,
76 RAWCOMMAND = 32, 76 RAWCOMMAND = 32,
77 MAPPER_FUNCTION = 64, 77 MAPPER_FUNCTION = 64
78 BUILTIN_VARIABLE = 128
79 }; 78 };
80 79
81 private: 80 private:
82 81
83 // Variables or functions. 82 // Variables or functions.
92 definition (val), count (1) { } 91 definition (val), count (1) { }
93 92
94 ~symbol_def (void) { } 93 ~symbol_def (void) { }
95 94
96 bool is_variable (void) const 95 bool is_variable (void) const
97 { 96 { return (symbol_type & symbol_record::USER_VARIABLE); }
98 return (symbol_type & symbol_record::USER_VARIABLE
99 || symbol_type & symbol_record::BUILTIN_VARIABLE);
100 }
101 97
102 // It's not necessary to check for COMMAND and MAPPER_FUNCTION 98 // It's not necessary to check for COMMAND and MAPPER_FUNCTION
103 // here. Those tags are just used as additional qualifiers for 99 // here. Those tags are just used as additional qualifiers for
104 // the other types of functions. 100 // the other types of functions.
105 101
137 { return (symbol_type & symbol_record::MAPPER_FUNCTION); } 133 { return (symbol_type & symbol_record::MAPPER_FUNCTION); }
138 134
139 bool is_user_function (void) const 135 bool is_user_function (void) const
140 { return (symbol_type & symbol_record::USER_FUNCTION); } 136 { return (symbol_type & symbol_record::USER_FUNCTION); }
141 137
142 bool is_builtin_variable (void) const
143 { return (symbol_type & symbol_record::BUILTIN_VARIABLE); }
144
145 bool is_builtin_function (void) const 138 bool is_builtin_function (void) const
146 { return (symbol_type & symbol_record::BUILTIN_FUNCTION); } 139 { return (symbol_type & symbol_record::BUILTIN_FUNCTION); }
147 140
148 bool is_dld_function (void) const 141 bool is_dld_function (void) const
149 { return (symbol_type & symbol_record::DLD_FUNCTION); } 142 { return (symbol_type & symbol_record::DLD_FUNCTION); }
328 { return definition->is_variable (); } 321 { return definition->is_variable (); }
329 322
330 bool is_user_variable (void) const 323 bool is_user_variable (void) const
331 { return definition->is_user_variable (); } 324 { return definition->is_user_variable (); }
332 325
333 bool is_builtin_variable (void) const
334 { return definition->is_builtin_variable (); }
335
336 bool is_map_element (const std::string& elts) const 326 bool is_map_element (const std::string& elts) const
337 { return definition->is_map_element (elts); } 327 { return definition->is_map_element (elts); }
338 328
339 unsigned int type (void) const { return definition->type (); } 329 unsigned int type (void) const { return definition->type (); }
340 330
355 bool is_visible (void) const { return visible; } 345 bool is_visible (void) const { return visible; }
356 346
357 void set_change_function (change_function f) { chg_fcn = f; } 347 void set_change_function (change_function f) { chg_fcn = f; }
358 348
359 void define (const octave_value& v, unsigned int sym_type = USER_VARIABLE); 349 void define (const octave_value& v, unsigned int sym_type = USER_VARIABLE);
360
361 void define_builtin_var (const octave_value& v);
362 350
363 bool define (octave_function *f, unsigned int sym_type); 351 bool define (octave_function *f, unsigned int sym_type);
364 352
365 void document (const std::string& h) { definition->document (h); } 353 void document (const std::string& h) { definition->document (h); }
366 354
464 452
465 void push_alias_to_clear (symbol_record *s) 453 void push_alias_to_clear (symbol_record *s)
466 { aliases_to_clear.push (s); } 454 { aliases_to_clear.push (s); }
467 455
468 bool read_only_error (const char *action); 456 bool read_only_error (const char *action);
469
470 void link_to_builtin_variable (void);
471 457
472 void maybe_delete_def (void) 458 void maybe_delete_def (void)
473 { 459 {
474 if (--definition->count <= 0) 460 if (--definition->count <= 0)
475 delete definition; 461 delete definition;
493 | symbol_record::USER_VARIABLE \ 479 | symbol_record::USER_VARIABLE \
494 | symbol_record::DLD_FUNCTION \ 480 | symbol_record::DLD_FUNCTION \
495 | symbol_record::BUILTIN_FUNCTION \ 481 | symbol_record::BUILTIN_FUNCTION \
496 | symbol_record::COMMAND \ 482 | symbol_record::COMMAND \
497 | symbol_record::RAWCOMMAND \ 483 | symbol_record::RAWCOMMAND \
498 | symbol_record::MAPPER_FUNCTION \ 484 | symbol_record::MAPPER_FUNCTION)
499 | symbol_record::BUILTIN_VARIABLE) 485
500 486 #define SYMTAB_VARIABLES (symbol_record::USER_VARIABLE)
501 #define SYMTAB_VARIABLES (symbol_record::USER_VARIABLE \
502 | symbol_record::BUILTIN_VARIABLE)
503 487
504 class 488 class
505 symbol_table 489 symbol_table
506 { 490 {
507 public: 491 public: