Mercurial > hg > octave-lojdl
changeset 2891:1a30f46e1870
[project @ 1997-04-28 01:49:00 by jwe]
author | jwe |
---|---|
date | Mon, 28 Apr 1997 02:01:22 +0000 |
parents | 42901f9a9266 |
children | aef2d43edbc2 |
files | src/Makefile.in src/defun-dld.h src/defun-int.h src/help.cc src/lex.l src/ov.cc src/ov.h src/parse.y src/pr-output.cc src/pt-cmd.cc src/pt-const.h src/pt-exp.cc src/pt-mat.cc src/pt-misc.cc src/pt-mvr-base.h src/pt-mvr.cc src/pt-plot.cc src/pt-pr-code.cc src/pt-pr-code.h src/pt-walk.h src/toplev.cc src/toplev.h |
diffstat | 22 files changed, 135 insertions(+), 127 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -69,8 +69,8 @@ oct-map.h oct-obj.h oct-prcstrm.h oct-procbuf.h \ oct-stdstrm.h oct-stream.h oct-strstrm.h pager.h parse.h \ pathlen.h pr-output.h procstream.h pt-base.h pt-cmd.h \ - pt-const.h pt-exp-base.h pt-exp.h pt-fcn.h pt-fvc-base.h \ - pt-fvc.h pt-mat.h pt-misc.h pt-mvr-base.h pt-mvr.h \ + pt-const.h pt-exp-base.h pt-exp.h pt-id.h pt-indir.h \ + pt-mat.h pt-misc.h pt-mvr-base.h pt-mvr.h \ pt-plot.h pt-pr-code.h pt-walk.h sighandlers.h symtab.h \ syscalls.h sysdep.h systime.h syswait.h token.h toplev.h \ unwind-prot.h utils.h variables.h version.h xdiv.h xpow.h \ @@ -81,7 +81,8 @@ op-b-b.h op-bm-bm.h op-cm-cm.h op-cm-cs.h op-cm-m.h op-cm-s.h \ op-cs-cm.h op-cs-cs.h op-cs-m.h op-cs-s.h op-m-cm.h op-m-cs.h \ op-m-m.h op-m-s.h op-s-cm.h op-s-cs.h op-s-m.h op-s-s.h \ - op-str-str.h oct-sym.h oct-fcn.h oct-builtin.h oct-mapper.h + op-str-str.h oct-sym.h oct-fcn.h oct-builtin.h oct-mapper.h \ + oct-usr-fcn.h TI_SRC := Array-oc.cc Array-os.cc Array-tc.cc Map-fnc.cc Map-tc.cc \ SLList-expr.cc SLList-misc.cc SLList-plot.cc SLList-tc.cc \ @@ -104,8 +105,8 @@ oct-iostrm.cc oct-map.cc oct-obj.cc oct-prcstrm.cc \ oct-procbuf.cc oct-stdstrm.cc oct-stream.cc oct-strstrm.cc \ pager.cc parse.y pr-output.cc procstream.cc pt-base.cc \ - pt-cmd.cc pt-const.cc pt-exp-base.cc pt-exp.cc pt-fcn.cc \ - pt-fvc-base.cc pt-fvc.cc pt-mat.cc pt-misc.cc pt-mvr-base.cc \ + pt-cmd.cc pt-const.cc pt-exp-base.cc pt-exp.cc pt-id.cc \ + pt-indir.cc pt-mat.cc pt-misc.cc pt-mvr-base.cc \ pt-mvr.cc pt-plot.cc pt-pr-code.cc sighandlers.cc \ strcasecmp.c strncase.c strfns.cc strftime.c symtab.cc \ syscalls.cc sysdep.cc token.cc toplev.cc unwind-prot.cc \ @@ -117,7 +118,7 @@ op-cm-m.cc op-cm-s.cc op-cs-cm.cc op-cs-cs.cc op-cs-m.cc \ op-cs-s.cc op-m-cm.cc op-m-cs.cc op-m-m.cc op-m-s.cc \ op-s-cm.cc op-s-cs.cc op-s-m.cc op-s-s.cc op-str-str.cc \ - oct-fcn.cc oct-builtin.cc oct-mapper.cc + oct-fcn.cc oct-builtin.cc oct-mapper.cc oct-usr-fcn.cc OBJECTS_4 := $(SOURCES) OBJECTS_3 := $(patsubst %.l, %.o, $(OBJECTS_4))
--- a/src/defun-dld.h +++ b/src/defun-dld.h @@ -47,8 +47,7 @@ #else #define DEFUN_DLD(name, args_name, nargout_name, doc) \ DECLARE_FUN (name, args_name, nargout_name); \ - DEFINE_FUN_STRUCT (name, 0, doc); \ - DEFINE_FUN_STRUCT_FUN (name) \ + DEFINE_FUN_STRUCT_FUN (name, doc) \ DECLARE_FUN (name, args_name, nargout_name) #endif
--- a/src/defun-int.h +++ b/src/defun-int.h @@ -23,6 +23,7 @@ #if !defined (octave_defun_int_h) #define octave_defun_int_h 1 +#include "oct-builtin.h" #include "variables.h" // MAKE_BUILTINS is defined to extract function names and related @@ -38,8 +39,8 @@ #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ BEGIN_INSTALL_BUILTIN \ extern DECLARE_FUN (name, args_name, nargout_name); \ - DEFINE_FUN_STRUCT (name, is_text_fcn, doc); \ - install_builtin_function (S ## name); \ + install_builtin_function \ + (new octave_builtin (F ## name, #name, doc), is_text_fcn); \ END_INSTALL_BUILTIN // Generate code for making another name for an existing function. @@ -66,14 +67,14 @@ // Define the structure that will be used to insert this function into // the symbol table. -#define DEFINE_FUN_STRUCT(name, is_text_fcn, doc) \ - static builtin_function S ## name (#name, is_text_fcn, F ## name, doc) - -#define DEFINE_FUN_STRUCT_FUN(name) \ - builtin_function& \ +#define DEFINE_FUN_STRUCT_FUN(name, doc) \ + octave_builtin * \ FS ## name (void) \ { \ - return S ## name; \ + static octave_builtin *s = 0; \ + if (! s) \ + s = new octave_builtin (F ## name, #name, doc); \ + return s; \ } #define DECLARE_FUN(name, args_name, nargout_name) \
--- a/src/help.cc +++ b/src/help.cc @@ -387,7 +387,7 @@ if (sym_rec->is_user_function ()) { - tree_fvc *defn = sym_rec->def (); + octave_symbol *defn = sym_rec->def (); string fn = defn->fcn_file_name (); @@ -782,7 +782,7 @@ { if (sym_rec->is_user_function ()) { - tree_fvc *defn = sym_rec->def (); + octave_symbol *defn = sym_rec->def (); string fn = defn->fcn_file_name (); string ff = fcn_file_in_path (fn); @@ -815,7 +815,8 @@ tree_print_code tpc (output_buf, "", pr_orig_txt); - defn->accept (tpc); + // XXX FIXME XXX + // defn->accept (tpc); } } @@ -829,7 +830,7 @@ else if (sym_rec->is_user_variable () || sym_rec->is_builtin_variable ()) { - tree_fvc *defn = sym_rec->def (); + octave_symbol *defn = sym_rec->def (); assert (defn && defn->is_constant ()); @@ -874,7 +875,8 @@ tree_print_code tpc (output_buf, "", pr_orig_txt); - tmp->accept (tpc); + // XXX FIXME XXX + // tmp->accept (tpc); if (nargout == 0) output_buf << "\n";
--- a/src/lex.l +++ b/src/lex.l @@ -47,17 +47,18 @@ #include "error.h" #include "input.h" #include "lex.h" -#include "toplev.h" +#include "ov.h" #include "parse.h" -#include "symtab.h" -#include "token.h" #include "pt-base.h" #include "pt-cmd.h" -#include "ov.h" +#include "pt-const.h" #include "pt-exp.h" #include "pt-mat.h" #include "pt-misc.h" #include "pt-plot.h" +#include "symtab.h" +#include "token.h" +#include "toplev.h" #include "utils.h" #include "variables.h" #include <y.tab.h>
--- a/src/ov.cc +++ b/src/ov.cc @@ -523,6 +523,12 @@ return *this; } +octave_value_list +octave_value::eval (int, const octave_value_list& idx) +{ + return (idx.length () > 0) ? index (idx) : *this; +} + Octave_map octave_value::map_value (void) const {
--- a/src/ov.h +++ b/src/ov.h @@ -320,8 +320,15 @@ virtual bool is_zero_by_zero (void) const { return rep->is_zero_by_zero (); } + bool is_constant (void) const + { return true; } + // Values. + octave_value eval (void) { return *this; } + + octave_value_list eval (int, const octave_value_list& idx); + virtual double double_value (bool frc_str_conv = false) const { return rep->double_value (frc_str_conv); }
--- a/src/parse.y +++ b/src/parse.y @@ -44,17 +44,18 @@ #include "input.h" #include "lex.h" #include "oct-hist.h" +#include "oct-usr-fcn.h" #include "toplev.h" #include "pager.h" #include "parse.h" #include "pt-cmd.h" #include "pt-const.h" -#include "pt-fcn.h" -#include "pt-fvc.h" +#include "pt-exp.h" +#include "pt-id.h" +#include "pt-indir.h" #include "pt-mat.h" +#include "pt-misc.h" #include "pt-mvr.h" -#include "pt-exp.h" -#include "pt-misc.h" #include "pt-plot.h" #include "pt-pr-code.h" #include "symtab.h" @@ -216,20 +217,20 @@ (tree_matrix_row *mr, tree_expression *rhs, token *eq_tok); // Begin defining a function. -static tree_function *start_function_def +static octave_user_function *start_function (tree_parameter_list *param_list, tree_statement_list *body); // Do most of the work for defining a function. -static tree_function *frob_function_def - (tree_identifier *id, tree_function *fcn); +static octave_user_function *frob_function + (tree_identifier *id, octave_user_function *fcn); // Finish defining a function. -static tree_function *finish_function_def - (tree_identifier *id, tree_function *fcn); +static octave_user_function *finish_function + (tree_identifier *id, octave_user_function *fcn); // Finish defining a function a different way. -static tree_function *finish_function_def - (tree_parameter_list *ret_list, tree_function *fcn); +static octave_user_function *finish_function + (tree_parameter_list *ret_list, octave_user_function *fcn); // Reset state after parsing function. static void recover_from_parsing_function (void); @@ -269,10 +270,10 @@ %union { -// The type of the basic tokens returned by the lexer. + // The type of the basic tokens returned by the lexer. token *tok_val; -// Types for the nonterminals we generate. + // Types for the nonterminals we generate. char sep_type; tree *tree_type; tree_matrix *tree_matrix_type; @@ -281,7 +282,6 @@ tree_constant *tree_constant_type; tree_identifier *tree_identifier_type; tree_indirect_ref *tree_indirect_ref_type; - tree_function *tree_function_type; tree_index_expression *tree_index_expression_type; tree_colon_expression *tree_colon_expression_type; tree_argument_list *tree_argument_list_type; @@ -305,6 +305,7 @@ plot_range *plot_range_type; subplot_using *subplot_using_type; subplot_style *subplot_style_type; + octave_user_function *octave_user_function_type; } // Tokens with line and column information. @@ -348,13 +349,13 @@ %type <tree_expression_type> ans_expression title matrix %type <tree_identifier_type> identifier %type <tree_indirect_ref_type> indirect_ref indirect_ref1 -%type <tree_function_type> func_def1 func_def2 func_def3 +%type <octave_user_function_type> function1 function2 function3 %type <tree_index_expression_type> variable word_list_cmd %type <tree_colon_expression_type> colon_expr %type <tree_argument_list_type> arg_list word_list %type <tree_parameter_list_type> param_list param_list1 %type <tree_parameter_list_type> return_list return_list1 -%type <tree_command_type> command func_def +%type <tree_command_type> command function %type <tree_if_command_type> if_command %type <tree_if_clause_type> elseif_clause else_clause %type <tree_if_command_list_type> if_cmd_list1 if_cmd_list @@ -366,7 +367,7 @@ %type <tree_decl_command_type> declaration %type <tree_statement_type> statement %type <tree_statement_list_type> simple_list simple_list1 list list1 -%type <tree_statement_list_type> opt_list input1 func_def4 +%type <tree_statement_list_type> opt_list input1 function4 %type <tree_plot_command_type> plot_command %type <subplot_type> plot_command2 plot_options %type <subplot_list_type> plot_command1 @@ -629,7 +630,7 @@ command : plot_command { $$ = $1; } - | func_def + | function { $$ = $1; } | declaration { $$ = $1; } @@ -912,8 +913,6 @@ } ; -// This is truly disgusting. - global_symtab : // empty { curr_sym_tab = global_sym_tab; } ; @@ -932,9 +931,6 @@ return_list_beg : '[' local_symtab in_return_list ; -return_list_end : global_symtab ']' - ; - return_list : return_list_beg return_list_end { lexer_flags.looking_at_return_list = false; @@ -969,50 +965,53 @@ } ; -func_begin : FCN global_symtab +return_list_end : global_symtab ']' ; -func_def : func_begin func_def2 +function_beg : FCN global_symtab + ; + +function : function_beg function2 { recover_from_parsing_function (); $$ = 0; } - | func_begin identifier func_def1 + | function_beg identifier function1 { - finish_function_def ($2, $3); + finish_function ($2, $3); recover_from_parsing_function (); $$ = 0; } - | func_begin return_list func_def1 + | function_beg return_list function1 { - finish_function_def ($2, $3); + finish_function ($2, $3); recover_from_parsing_function (); $$ = 0; } ; -func_def1 : global_symtab '=' func_def2 +function1 : global_symtab '=' function2 { $$ = $3; } ; -func_def2 : identifier local_symtab parsed_fcn_name func_def3 +function2 : identifier local_symtab parsed_fcn_name function3 { - if (! ($$ = frob_function_def ($1, $4))) + if (! ($$ = frob_function ($1, $4))) ABORT_PARSE; } ; -func_def3 : param_list func_def4 - { $$ = start_function_def ($1, $2); } - | func_def4 - { $$ = start_function_def (0, $1); } +function3 : param_list function4 + { $$ = start_function ($1, $2); } + | function4 + { $$ = start_function (0, $1); } ; -func_def4 : opt_sep opt_list fcn_end_or_eof +function4 : opt_sep opt_list function_end { $$ = $2; } ; -fcn_end_or_eof : END +function_end : END { if (end_token_ok ($1, token::function_end)) { @@ -1131,7 +1130,7 @@ ; arg_list : magic_colon - { $$ = new tree_argument_list (colon); } + { $$ = new tree_argument_list ($1); } | expression { $$ = new tree_argument_list ($1); } | ALL_VA_ARGS @@ -2211,23 +2210,23 @@ // Begin defining a function. -static tree_function * -start_function_def (tree_parameter_list *param_list, - tree_statement_list *body) +static octave_user_function * +start_function (tree_parameter_list *param_list, tree_statement_list *body) { body->mark_as_function_body (); - tree_function *fcn = new tree_function (body, curr_sym_tab); - - fcn->define_param_list (param_list); + // We'll fill in the return list later. + + octave_user_function *fcn + = new octave_user_function (param_list, 0, body, curr_sym_tab); return fcn; } // Do most of the work for defining a function. -static tree_function * -frob_function_def (tree_identifier *id, tree_function *fcn) +static octave_user_function * +frob_function (tree_identifier *id, octave_user_function *fcn) { string id_name = id->name (); @@ -2276,7 +2275,7 @@ else panic_impossible (); - id->define (fcn); + id->define (fcn, symbol_def::USER_FUNCTION); id->document (help_buf); @@ -2285,8 +2284,8 @@ // Finish defining a function. -static tree_function * -finish_function_def (tree_identifier *id, tree_function *fcn) +static octave_user_function * +finish_function (tree_identifier *id, octave_user_function *fcn) { tree_parameter_list *tpl = new tree_parameter_list (id); @@ -2297,8 +2296,8 @@ // Finish defining a function a different way. -static tree_function * -finish_function_def (tree_parameter_list *ret_list, tree_function *fcn) +static octave_user_function * +finish_function (tree_parameter_list *ret_list, octave_user_function *fcn) { ret_list->mark_as_formal_parameters ();
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -36,6 +36,7 @@ #include "CMatrix.h" #include "Range.h" #include "dMatrix.h" +#include "lo-mappers.h" #include "mach-info.h" #include "oct-cmplx.h" #include "oct-math.h" @@ -46,7 +47,6 @@ #include "error.h" #include "gripes.h" #include "help.h" -#include "mappers.h" #include "oct-obj.h" #include "pager.h" #include "pr-output.h"
--- a/src/pt-cmd.cc +++ b/src/pt-cmd.cc @@ -47,7 +47,8 @@ #include "pt-cmd.h" #include "ov.h" #include "pt-exp.h" -#include "pt-fvc.h" +#include "pt-id.h" +#include "pt-indir.h" #include "pt-misc.h" #include "pt-mvr.h" #include "pt-walk.h"
--- a/src/pt-const.h +++ b/src/pt-const.h @@ -33,7 +33,7 @@ #include "oct-alloc.h" -#include "pt-fvc.h" +#include "pt-mvr-base.h" class octave_value_list; @@ -42,18 +42,18 @@ #include "ov.h" class -tree_constant : public tree_fvc +tree_constant : public tree_multi_val_ret { public: tree_constant (int l = -1, int c = -1) - : tree_fvc (l, c), val (), orig_text () { } + : tree_multi_val_ret (l, c), val (), orig_text () { } tree_constant (const octave_value& v, int l = -1, int c = -1) - : tree_fvc (l, c), val (v), orig_text () { } + : tree_multi_val_ret (l, c), val (v), orig_text () { } tree_constant (const tree_constant& a) - : tree_fvc (), val (a.val), orig_text () { } + : tree_multi_val_ret (-1, -1), val (a.val), orig_text () { } ~tree_constant (void) { } @@ -61,7 +61,7 @@ { if (this != &a) { - tree_fvc::operator = (a); + tree_multi_val_ret::operator = (a); val = a.val; } return *this;
--- a/src/pt-exp.cc +++ b/src/pt-exp.cc @@ -40,7 +40,8 @@ #include "pager.h" #include "ov.h" #include "pt-exp.h" -#include "pt-fvc.h" +#include "pt-id.h" +#include "pt-indir.h" #include "pt-misc.h" #include "pt-mvr.h" #include "pt-pr-code.h"
--- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -35,7 +35,6 @@ #include "error.h" #include "oct-obj.h" #include "pt-exp.h" -#include "pt-fvc.h" #include "pt-mat.h" #include "pt-misc.h" #include "pt-mvr.h"
--- a/src/pt-misc.cc +++ b/src/pt-misc.cc @@ -40,13 +40,14 @@ #include "error.h" #include "input.h" #include "oct-obj.h" +#include "oct-usr-fcn.h" #include "ov.h" #include "pager.h" #include "pt-cmd.h" #include "pt-const.h" #include "pt-exp.h" -#include "pt-fcn.h" -#include "pt-fvc.h" +#include "pt-id.h" +#include "pt-indir.h" #include "pt-misc.h" #include "pt-mvr.h" #include "pt-pr-code.h" @@ -343,8 +344,6 @@ { tree_identifier *elt = this->operator () (p); - tree_constant *tmp = 0; - if (i < nargin) { if (args(i).is_defined () && args(i).is_magic_colon ()) @@ -352,10 +351,11 @@ ::error ("invalid use of colon in function argument list"); return; } - tmp = new tree_constant (args (i)); + + elt->define (args(i)); } - - elt->define (tmp); + else + elt->define (octave_value ()); next (p); }
--- a/src/pt-mvr-base.h +++ b/src/pt-mvr-base.h @@ -41,6 +41,7 @@ tree_multi_val_ret (int l = -1, int c = -1) : tree_expression (l, c) { } + // XXX FIXME XXX -- this can't be right! tree_multi_val_ret (int l = -1, int c = -1, tree_expression::type et) : tree_expression (l, c, et) { }
--- a/src/pt-mvr.cc +++ b/src/pt-mvr.cc @@ -35,7 +35,8 @@ #include "pager.h" #include "pt-const.h" #include "pt-exp.h" -#include "pt-fvc.h" +#include "pt-id.h" +#include "pt-indir.h" #include "pt-misc.h" #include "pt-mvr.h" #include "pt-walk.h"
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -47,6 +47,7 @@ #include "procstream.h" #include "file-ops.h" +#include "lo-mappers.h" #include "str-vec.h" #include "defun.h" @@ -54,7 +55,6 @@ #include "gripes.h" #include "help.h" #include "load-save.h" -#include "mappers.h" #include "oct-obj.h" #include "pt-cmd.h" #include "pt-exp.h"
--- a/src/pt-pr-code.cc +++ b/src/pt-pr-code.cc @@ -31,12 +31,13 @@ #include <iostream.h> #include "error.h" +#include "oct-usr-fcn.h" #include "pr-output.h" #include "pt-cmd.h" #include "pt-const.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-misc.h" #include "pt-mvr.h" @@ -99,13 +100,6 @@ } void -tree_print_code::visit_builtin (tree_builtin& fcn) -{ - os << fcn.name () - << " can't be printed because it is a built-in function\n"; -} - -void tree_print_code::visit_colon_expression (tree_colon_expression& expr) { indent (); @@ -234,11 +228,11 @@ } void -tree_print_code::visit_function (tree_function& fcn) +tree_print_code::visit_octave_user_function (octave_user_function& fcn) { reset (); - visit_function_header (fcn); + visit_octave_user_function_header (fcn); tree_statement_list *cmd_list = fcn.body (); @@ -249,11 +243,11 @@ decrement_indent_level (); } - visit_function_trailer (fcn); + visit_octave_user_function_trailer (fcn); } void -tree_print_code::visit_function_header (tree_function& fcn) +tree_print_code::visit_octave_user_function_header (octave_user_function& fcn) { indent (); @@ -325,7 +319,7 @@ } void -tree_print_code::visit_function_trailer (tree_function&) +tree_print_code::visit_octave_user_function_trailer (octave_user_function&) { indent ();
--- a/src/pt-pr-code.h +++ b/src/pt-pr-code.h @@ -50,8 +50,6 @@ void visit_break_command (tree_break_command&); - void visit_builtin (tree_builtin&); - void visit_colon_expression (tree_colon_expression&); void visit_continue_command (tree_continue_command&); @@ -64,11 +62,11 @@ void visit_for_command (tree_for_command&); - void visit_function (tree_function&); + void visit_octave_user_function (octave_user_function&); - void visit_function_header (tree_function&); + void visit_octave_user_function_header (octave_user_function&); - void visit_function_trailer (tree_function&); + void visit_octave_user_function_trailer (octave_user_function&); void visit_identifier (tree_identifier&);
--- a/src/pt-walk.h +++ b/src/pt-walk.h @@ -26,14 +26,13 @@ class tree_argument_list; class tree_binary_expression; class tree_break_command; -class tree_builtin; class tree_colon_expression; class tree_continue_command; class tree_decl_command; class tree_decl_elt; class tree_decl_init_list; class tree_for_command; -class tree_function; +class octave_user_function; class tree_identifier; class tree_if_clause; class tree_if_command; @@ -84,9 +83,6 @@ visit_break_command (tree_break_command&) = 0; virtual void - visit_builtin (tree_builtin&) = 0; - - virtual void visit_colon_expression (tree_colon_expression&) = 0; virtual void @@ -105,7 +101,7 @@ visit_for_command (tree_for_command&) = 0; virtual void - visit_function (tree_function&) = 0; + visit_octave_user_function (octave_user_function&) = 0; virtual void visit_identifier (tree_identifier&) = 0;
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -61,12 +61,12 @@ #include "oct-hist.h" #include "oct-map.h" #include "oct-obj.h" +#include "oct-sym.h" #include "pager.h" #include "parse.h" #include "pathsearch.h" #include "procstream.h" #include "ov.h" -#include "pt-fvc.h" #include "pt-misc.h" #include "pt-plot.h" #include "sighandlers.h" @@ -128,7 +128,7 @@ tree_statement_list *global_command = 0; // Pointer to function that is currently being evaluated. -tree_function *curr_function = 0; +octave_user_function *curr_function = 0; // Nonzero means input is coming from startup file. int input_from_startup_file = 0; @@ -497,7 +497,8 @@ { octave_value_list retval; - tree_fvc *fcn = is_valid_function (args(0), "feval", 1); + octave_symbol *fcn = is_valid_function (args(0), "feval", 1); + if (fcn) { int tmp_nargin = args.length () - 1; @@ -505,7 +506,7 @@ tmp_args.resize (tmp_nargin); for (int i = 0; i < tmp_nargin; i++) tmp_args(i) = args(i+1); - retval = fcn->eval (false, nargout, tmp_args); + retval = fcn->eval (nargout, tmp_args); } return retval;
--- a/src/toplev.h +++ b/src/toplev.h @@ -27,7 +27,7 @@ class octave_value; class octave_value_list; -class tree_function; +class octave_user_function; class tree_statement_list; class charMatrix; @@ -86,7 +86,7 @@ extern tree_statement_list *global_command; // Pointer to function that is currently being evaluated. -extern tree_function *curr_function; +extern octave_user_function *curr_function; // Nonzero means input is coming from startup file. extern int input_from_startup_file;