diff src/variables.cc @ 3259:fa345875edea

[project @ 1999-07-22 04:30:18 by jwe]
author jwe
date Thu, 22 Jul 1999 04:30:25 +0000
parents 4964d5391acc
children 2efa28a91e7a
line wrap: on
line diff
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -857,6 +857,10 @@
   if (show_builtins)
     {
       pad_after += global_sym_tab->maybe_list
+	("*** built-in constants:", pats, octave_stdout,
+	 show_verbose, symbol_record::BUILTIN_CONSTANT, SYMTAB_ALL_SCOPES);
+
+      pad_after += global_sym_tab->maybe_list
 	("*** built-in variables:", pats, octave_stdout,
 	 show_verbose, symbol_record::BUILTIN_VARIABLE, SYMTAB_ALL_SCOPES);
 
@@ -954,6 +958,32 @@
     }
 }
 
+// Give a global constant a definition.  This will insert the symbol
+// in the global table if necessary.
+
+// How is this different than install_builtin_constant?  Are both
+// functions needed?
+
+void
+bind_builtin_constant (const string& name, const octave_value& val,
+		       bool protect, bool eternal, const string& help)
+{
+  symbol_record *sym_rec = global_sym_tab->lookup (name, true);
+  sym_rec->unprotect ();
+
+  string tmp_help = help.empty () ? sym_rec->help () : help;
+
+  sym_rec->define_builtin_const (val);
+
+  sym_rec->document (tmp_help);
+
+  if (protect)
+    sym_rec->protect ();
+
+  if (eternal)
+    sym_rec->make_eternal ();
+}
+
 // Give a global variable a definition.  This will insert the symbol
 // in the global table if necessary.