diff src/variables.cc @ 2892:aef2d43edbc2

[project @ 1997-04-28 02:04:28 by jwe]
author jwe
date Mon, 28 Apr 1997 02:04:28 +0000
parents 55cca18e943a
children f1c5f8151397
line wrap: on
line diff
--- a/src/variables.cc	Mon Apr 28 02:01:22 1997 +0000
+++ b/src/variables.cc	Mon Apr 28 02:04:28 1997 +0000
@@ -46,6 +46,7 @@
 #endif
 
 #include "file-ops.h"
+#include "lo-mappers.h"
 #include "oct-glob.h"
 #include "str-vec.h"
 
@@ -69,11 +70,15 @@
 #include "parse.h"
 #include "symtab.h"
 #include "sysdep.h"
+#include "oct-sym.h"
+#include "oct-builtin.h"
+#include "oct-mapper.h"
+#include "oct-usr-fcn.h"
 #include "pt-const.h"
 #include "oct-obj.h"
 #include "pt-exp.h"
-#include "pt-fcn.h"
-#include "pt-fvc.h"
+#include "pt-id.h"
+#include "pt-indir.h"
 #include "pt-mat.h"
 #include "pt-plot.h"
 #include "pr-output.h"
@@ -237,10 +242,10 @@
 
 // Is this octave_value a valid function?
 
-tree_fvc *
+octave_symbol *
 is_valid_function (const octave_value& arg, const string& warn_for, bool warn)
 {
-  tree_fvc *ans = 0;
+  octave_symbol *ans = 0;
 
   string fcn_name;
 
@@ -274,12 +279,12 @@
   return ans;
 }
 
-tree_fvc *
+octave_symbol *
 extract_function (const octave_value& arg, const string& warn_for,
 		  const string& fname, const string& header,
 		  const string& trailer)
 {
-  tree_fvc *retval = 0;
+  octave_symbol *retval = 0;
 
   retval = is_valid_function (arg, warn_for, 0);
 
@@ -449,7 +454,7 @@
 
   if (sr)
     {
-      tree_fvc *ans = sr->def ();
+      octave_symbol *ans = sr->def ();
       if (ans)
 	{
 	  string ff = ans->fcn_file_name ();
@@ -843,12 +848,10 @@
 
   if (sr)
     {
-      // Do something with the value in foo.
-
-      tree_fvc *sr_def = sr->def ();
+      octave_symbol *sr_def = sr->def ();
 
       if (sr_def)
-	retval  = sr_def->eval (true);
+	retval  = sr_def->eval ();
       else
 	error ("get_global_by_name: undefined symbol `%s'", nm.c_str ());
     }
@@ -907,7 +910,7 @@
 
   string retval;
 
-  tree_fvc *defn = sr->def ();
+  octave_symbol *defn = sr->def ();
 
   if (defn)
     {
@@ -934,7 +937,7 @@
 
   assert (sr);
 
-  tree_fvc *defn = sr->def ();
+  octave_symbol *defn = sr->def ();
 
   if (defn)
     {
@@ -963,7 +966,7 @@
 
   assert (sr);
 
-  tree_fvc *defn = sr->def ();
+  octave_symbol *defn = sr->def ();
 
   if (defn)
     retval = defn->eval ();
@@ -1405,31 +1408,34 @@
 // Install variables and functions in the symbol tables.
 
 void
-install_builtin_mapper (const builtin_mapper_function& mf)
+install_builtin_mapper (octave_mapper *mf)
 {
-  symbol_record *sym_rec = global_sym_tab->lookup (mf.name, true);
-  sym_rec->unprotect ();
+  symbol_record *sym_rec = global_sym_tab->lookup (mf->name (), true);
 
-  tree_builtin *def = new tree_builtin (mf, mf.name);
+  unsigned int t
+    = symbol_def::BUILTIN_FUNCTION | symbol_def::MAPPER_FUNCTION;
 
-  sym_rec->define (def);
-
-  sym_rec->document (mf.help_string);
+  sym_rec->unprotect ();
+  sym_rec->define (mf, t);
+  sym_rec->document (mf->doc_string ());
   sym_rec->make_eternal ();
   sym_rec->protect ();
 }
 
 void
-install_builtin_function (const builtin_function& f)
+install_builtin_function (octave_builtin *f, bool is_text_fcn)
 {
-  symbol_record *sym_rec = global_sym_tab->lookup (f.name, true);
-  sym_rec->unprotect ();
+  symbol_record *sym_rec = global_sym_tab->lookup (f->name (), true);
+
+  unsigned int t
+    = symbol_def::BUILTIN_FUNCTION | symbol_def::MAPPER_FUNCTION;
 
-  tree_builtin *def = new tree_builtin (f.fcn, f.name);
+  if (is_text_fcn)
+    t |= symbol_def::TEXT_FUNCTION;
 
-  sym_rec->define (def, f.is_text_fcn);
-
-  sym_rec->document (f.help_string);
+  sym_rec->unprotect ();
+  sym_rec->define (f, t);
+  sym_rec->document (f->doc_string ());
   sym_rec->make_eternal ();
   sym_rec->protect ();
 }
@@ -1705,10 +1711,10 @@
   symbols_of_input ();
   symbols_of_lex ();
   symbols_of_load_save ();
+  symbols_of_oct_usr_fcn ();
   symbols_of_pager ();
   symbols_of_parse ();
   symbols_of_pr_output ();
-  symbols_of_pt_fcn ();
   symbols_of_pt_mat ();
   symbols_of_pt_plot ();
   symbols_of_syscalls ();