# HG changeset patch # User jwe # Date 863728025 0 # Node ID 641689f6767390a93f4c7af3beba850c9ebcba03 # Parent b9c107cbe388335aa8675285aa95b5543b46556f [project @ 1997-05-15 20:27:04 by jwe] diff -r b9c107cbe388 -r 641689f67673 src/ChangeLog --- a/src/ChangeLog Thu May 15 20:02:55 1997 +0000 +++ b/src/ChangeLog Thu May 15 20:27:05 1997 +0000 @@ -1,3 +1,83 @@ +Thu May 15 11:48:10 1997 John W. Eaton + + * defun.cc: New file. Move functions for installing objects in + the symbol table here from variables.cc. + + * oct-obj.h, oct-obj.cc: Add custom allocator, fwiw. + + * toplev.cc (main_loop): Correctly increment command number. + + * TEMPLATE-INST/SLList-tm.cc: Don't instantiate lists of pointers + to tree_matrix_row objects. + * TEMPLATE-INST/SLList-misc.cc: Do instantiate lists of pointers + to tree_argument_list objects. + + * DLD-FUNCTIONS/dassl.cc: Update to use new octave_function + interface to user-supplied functions. + * DLD-FUNCTIONS/fsolve.cc: Likewise. + * DLD-FUNCTIONS/lsode.cc: Likewise. + * DLD-FUNCTIONS/npsol.cc: Likewise. + * DLD-FUNCTIONS/quad.cc: Likewise. + + * dynamic-ld.h, dynamic-ld.cc (builtin_fcn_installer typedef): + Rename from builtin_fcn. + (octave_dynamic_loader::load_fcn_from_dot_oct_file): + Simplify by using new installer function defined by DEFUN_DLD. + + * defun-dld.h (DEFUN_DLD): Use DEFINE_FUN_INSTALLER_FUN instead of + DEFINE_FUN_STRUCT_FUN. + * defun.h (DEFUN_MAPPER): Use DEFUN_MAPPER_INTERNAL. + * defun-int.h (DEFVAR_INTERNAL): Rename from DEFVAR_INT and move + here from defun.h. Change all uses. + (DEFUN_MAPPER_INTERNAL): New macro. + (DEFINE_FUN_INSTALLER_FUN): New macro to define function that the + dynamic loader calls to do all the work of installing a new function. + (DEFINE_FUN_STRUCT_FUN): Delete. + + * parse.y: Rewrite to handle more general expressions. + * lex.l: Corresponding changes. + + * pt-walk.h, pt-pr-code.h, pt-pr-code.cc: Cope with new parse tree + object structure. + + * pt-misc.cc (class tree_for_command): Split into + tree_simple_for_command and tree_complex_for_command classes. + + * pt-misc.h, pt-misc.cc (tree_statement::eval): Handle identifier + lookup and printing and binding ans here. + (tree_statement_list::eval): Simplify. + (tree_argument_list::all_elements_are_constant): New function. + (class tree_decl_elt): Now contains id and expr, not an assignment + expression. + + * pt-exp-base.h pt-exp.h pt-id.h pt-indir.h pt-mat.h pt-const.h, + pt-exp-base.cc pt-exp.cc pt-id.cc pt-indir.cc pt-mat.cc pt-const.cc: + Replace eval functions with rvalue and lvalue functions. + Change all uses. + (lvalue_ok, rvalue_ok): New functions, for future compile-time + semantic checks. + + * oct-var-ref.h (is_defined, is_map): New functions. + + * pt-exp.h (class tree_oct_obj): Delete. + + * variables.cc (extract_function, is_valid_function): Return + pointer to octave_function, not octave_symbol. + (link_to_global_variable): Rewrite. Handle errors in + symbol_record::mark_as_linked_to_global. + + * symtab.h, symtab.cc (class symbol_def, class symbol_record): + Symbols are now stored as octave_value objects only. + + * ov.cc (install_types): Register function types here. + * ov-fcn.h, ov-fcn.cc, ov-builtin.h, ov-builtin.cc, ov-mapper.h, + ov-mapper.cc, ov-usr-fcn.h, ov-usr-fcn.cc: New classes for + functions as values. + * ov.h (class octave_value): Don't derive from octave_symbol. + * oct-fcn.h, oct-fcn.cc, oct-builtin.h, oct-builtin.cc, + oct-mapper.h, oct-mapper.cc, oct-usr-fcn.h, oct-usr-fcn.cc, + oct-sym.h, oct-sym.cc: Delete. + Sun May 11 17:51:22 1997 John W. Eaton * help.cc (Ftype): Make it work again for functions. @@ -51,6 +131,9 @@ * oct-var-ref.cc (octave_variable_ref::assign): Clear idx after assignment. + * octave_value classes: Add is_constant, is_function, and + function_value functions. + * ov.h, ov.cc (assign): Return void, not reference to octave_value. (do_index_op): Rename, from index. (do_struct_elt_index_op): Rename, from struct_elt_val. diff -r b9c107cbe388 -r 641689f67673 src/help.cc --- a/src/help.cc Thu May 15 20:02:55 1997 +0000 +++ b/src/help.cc Thu May 15 20:27:05 1997 +0000 @@ -53,7 +53,7 @@ #include "help.h" #include "input.h" #include "oct-obj.h" -#include "oct-usr-fcn.h" +#include "ov-usr-fcn.h" #include "pager.h" #include "pathsearch.h" #include "pt-pr-code.h" @@ -366,6 +366,9 @@ warning ("no usage message found for `%s'", nm.c_str ()); } +// XXX FIXME XXX -- this needs a major overhaul to cope with new +// symbol table stuff. + static void display_names_from_help_list (ostream& os, help_list *list, const char *desc) @@ -387,9 +390,11 @@ if (sym_rec->is_user_function ()) { - octave_symbol *defn = sym_rec->def (); + octave_value tmp = sym_rec->def (); - string fn = defn->fcn_file_name (); + octave_function *defn = tmp.function_value (); + + string fn = defn ? defn->fcn_file_name () : string (); if (! fn.empty ()) { @@ -783,13 +788,13 @@ { if (sym_rec->is_user_function ()) { - octave_symbol *tmp = sym_rec->def (); + octave_value tmp = sym_rec->def (); + + octave_function *defn = tmp.function_value (); - octave_user_function *defn - = static_cast (tmp); + string fn = defn ? defn->fcn_file_name () : string (); - string fn = defn->fcn_file_name (); - string ff = fcn_file_in_path (fn); + string ff = fn.empty () ? string () : fcn_file_in_path (fn); if (pr_orig_txt && ! ff.empty ()) { @@ -833,22 +838,17 @@ else if (sym_rec->is_user_variable () || sym_rec->is_builtin_variable ()) { - octave_symbol *defn = sym_rec->def (); + octave_value defn = sym_rec->def (); - assert (defn && defn->is_constant ()); + assert (defn.is_constant ()); int var_ok = 1; // XXX FIXME XXX -- need to handle structure // references correctly. - if (defn) - { - octave_value vtmp = defn->eval (); - - if (vtmp.is_map ()) - error ("type: operations on structs not implemented"); - } + if (defn.is_map ()) + error ("type: operations on structs not implemented"); if (! error_state) { @@ -873,14 +873,6 @@ << "' has unknown type!\n"; } } - - tree_print_code tpc (output_buf, "", pr_orig_txt); - - // XXX FIXME XXX - // defn->accept (tpc); - - if (nargout == 0) - output_buf << "\n"; } } else diff -r b9c107cbe388 -r 641689f67673 src/ov-fcn.h --- a/src/ov-fcn.h Thu May 15 20:02:55 1997 +0000 +++ b/src/ov-fcn.h Thu May 15 20:27:05 1997 +0000 @@ -35,6 +35,8 @@ #include "ov-base.h" #include "ov-typeinfo.h" +class tree_walker; + // Functions. class @@ -71,6 +73,8 @@ string doc_string (void) const { return doc; } + virtual void accept (tree_walker&) { } + protected: octave_function (const string& nm, const string& ds)