# HG changeset patch # User jwe # Date 773711532 0 # Node ID be155b3d5a2fb6bffaef025c903d2df275fa3f5f # Parent dbb8a47acc3aa5167220c98f59b890b7acd8074c [project @ 1994-07-08 23:45:33 by jwe] diff --git a/src/oct-obj.h b/src/oct-obj.h --- a/src/oct-obj.h +++ b/src/oct-obj.h @@ -21,12 +21,17 @@ */ +#if !defined (octave_oct_obj_h) +#define octave_oct_obj_h 1 + #include "Array.h" class tree_constant; typedef Array Octave_object; +#endif + /* ;;; Local Variables: *** ;;; mode: C++ *** diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -1042,6 +1042,13 @@ quote_is_transpose = 0; $$ = (tree_parameter_list *) NULL; } + | '(' ELLIPSIS ')' + { + quote_is_transpose = 0; + tree_parameter_list *tmp = new tree_parameter_list (); + tmp->mark_varargs_only (); + $$ = tmp; + } | param_list1 ')' { quote_is_transpose = 0; @@ -1057,6 +1064,7 @@ tmp->mark_varargs (); $$ = tmp; } + ; param_list1 : '(' identifier { $$ = new tree_parameter_list ($2); } @@ -1077,8 +1085,11 @@ ; identifier : NAME - { $$ = new tree_identifier - ($1->sym_rec (), $1->line (), $1->column ()); } + { + $$ = new tree_identifier + ($1->sym_rec (), $1->line (), $1->column ()); + } + ; arg_list : arg_list1 { $$ = $1->reverse (); } diff --git a/src/pt-const.h b/src/pt-const.h --- a/src/pt-const.h +++ b/src/pt-const.h @@ -30,7 +30,6 @@ #include -#include "Array.h" #include "mx-base.h" #include "Range.h" diff --git a/src/pt-exp-base.cc b/src/pt-exp-base.cc --- a/src/pt-exp-base.cc +++ b/src/pt-exp-base.cc @@ -1151,6 +1151,7 @@ { int nargout = maybe_do_ans_assign ? 0 : 1; +// int nargin = (ans->is_constant ()) ? 0 : 1; Octave_object tmp_args; Octave_object tmp = ans->eval (0, nargout, tmp_args, 0); @@ -1512,7 +1513,8 @@ unwind_protect_int (num_named_args); unwind_protect_int (curr_arg_number); - if (param_list != (tree_parameter_list *) NULL) + if (param_list != (tree_parameter_list *) NULL + && ! param_list->varargs_only ()) { param_list->define_from_arg_vector (args, nargin); if (error_state) @@ -2841,6 +2843,18 @@ return marked_for_varargs; } +void +tree_parameter_list::mark_varargs_only (void) +{ + marked_for_varargs = -1; +} + +int +tree_parameter_list::varargs_only (void) +{ + return (marked_for_varargs < 0); +} + tree_identifier * tree_parameter_list::define (tree_constant *t) { diff --git a/src/pt-exp-base.h b/src/pt-exp-base.h --- a/src/pt-exp-base.h +++ b/src/pt-exp-base.h @@ -30,8 +30,6 @@ #include -#include "Array.h" - #include "builtins.h" #include "error.h" #include "oct-obj.h" @@ -582,6 +580,9 @@ void mark_varargs (void); int takes_varargs (void) const; + void mark_varargs_only (void); + int varargs_only (void); + tree_identifier *define (tree_constant *t); void define_from_arg_vector (const Octave_object& args, int nargin); diff --git a/src/tc-rep.cc b/src/tc-rep.cc --- a/src/tc-rep.cc +++ b/src/tc-rep.cc @@ -38,6 +38,7 @@ #include "mx-base.h" #include "Range.h" +#include "arith-ops.h" #include "variables.h" #include "error.h" #include "gripes.h" @@ -5098,7 +5099,7 @@ } break; default: - ::error ("illegal number of arguments for scalar type"); + ::error ("invalid number of arguments for scalar type"); return tree_constant (); break; }