Mercurial > hg > octave-nkf
changeset 1161:0326a802cd5c
[project @ 1995-02-27 16:14:48 by jwe]
author | jwe |
---|---|
date | Mon, 27 Feb 1995 16:15:02 +0000 |
parents | 74397545c242 |
children | c210c5a25a48 |
files | src/pt-exp-base.cc src/pt-exp-base.h src/variables.cc |
diffstat | 3 files changed, 29 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pt-exp-base.cc +++ b/src/pt-exp-base.cc @@ -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
--- a/src/pt-exp-base.h +++ b/src/pt-exp-base.h @@ -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
--- a/src/variables.cc +++ b/src/variables.cc @@ -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.