# HG changeset patch # User jwe # Date 793901702 0 # Node ID 0326a802cd5cef7936278bc5ddcba4f19a860dff # Parent 74397545c242753a680ac45c276d58dc3b13b09c [project @ 1995-02-27 16:14:48 by jwe] diff -r 74397545c242 -r 0326a802cd5c src/pt-exp-base.cc --- a/src/pt-exp-base.cc Mon Feb 27 16:11:17 1995 +0000 +++ b/src/pt-exp-base.cc Mon Feb 27 16:15:02 1995 +0000 @@ -2556,6 +2556,25 @@ // User defined functions. +void +tree_function::install_nargin_and_nargout (void) +{ + nargin_sr = sym_tab->lookup ("nargin", 1, 0); + nargout_sr = sym_tab->lookup ("nargout", 1, 0); +} + +void +tree_function::bind_nargin_and_nargout (int nargin, int nargout) +{ + tree_constant *tmp; + + tmp = new tree_constant (nargin); + nargin_sr->define (tmp); + + tmp = new tree_constant (nargout); + nargout_sr->define (tmp); +} + #if 0 tree_function * tree_function::define (tree statement_list *t) @@ -2789,7 +2808,7 @@ // variables. { - bind_nargin_and_nargout (sym_tab, nargin, nargout); + bind_nargin_and_nargout (nargin, nargout); // Evaluate the commands that make up the function. Always turn on // printing for commands inside functions. Maybe this should be diff -r 74397545c242 -r 0326a802cd5c src/pt-exp-base.h --- a/src/pt-exp-base.h Mon Feb 27 16:11:17 1995 +0000 +++ b/src/pt-exp-base.h Mon Feb 27 16:15:02 1995 +0000 @@ -805,6 +805,10 @@ tree_function : public tree_fvc { private: + void install_nargin_and_nargout (void); + + void bind_nargin_and_nargout (int nargin, int nargout); + void init (void) { call_depth = 0; @@ -833,6 +837,7 @@ init (); sym_tab = st; cmd_list = cl; + install_nargin_and_nargout (); } // tree_function *define (tree_statement_list *t); @@ -898,6 +903,8 @@ int num_args_passed; int curr_va_arg_number; tree_va_return_list *vr_list; + symbol_record *nargin_sr; + symbol_record *nargout_sr; }; #endif diff -r 74397545c242 -r 0326a802cd5c src/variables.cc --- a/src/variables.cc Mon Feb 27 16:11:17 1995 +0000 +++ b/src/variables.cc Mon Feb 27 16:15:02 1995 +0000 @@ -1386,6 +1386,7 @@ // Defining variables. +#if 0 void bind_nargin_and_nargout (symbol_table *sym_tab, int nargin, int nargout) { @@ -1402,6 +1403,7 @@ tmp = new tree_constant (nargout); sr->define (tmp); } +#endif // Give a global variable a definition. This will insert the symbol // in the global table if necessary.