# HG changeset patch # User jwe # Date 975543551 0 # Node ID 35daf9714b9adc6711eb609c0e176a21a8327b83 # Parent 078fde449ebcaf0772e573e057b914d36b9e256a [project @ 2000-11-30 00:19:10 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2000-11-29 John W. Eaton + * defun.h (DEFUNX): New macro. + * defun-int.h (DEFUNX_INTERNAL, DECLARE_FUNX): New macro. + (DECLARE_FUN): Define in terms of DECLARE_FUNX. + * mkdefs: Read and print one line at a time, so we can force patterns to match only at the beginning of a line. diff --git a/src/defun-int.h b/src/defun-int.h --- a/src/defun-int.h +++ b/src/defun-int.h @@ -62,9 +62,12 @@ extern void alias_builtin (const std::string& alias, const std::string& name); -#define DECLARE_FUN(name, args_name, nargout_name) \ +#define DECLARE_FUNX(name, args_name, nargout_name) \ octave_value_list \ - F ## name (const octave_value_list& args_name, int nargout_name) + name (const octave_value_list& args_name, int nargout_name) + +#define DECLARE_FUN(name, args_name, nargout_name) \ + DECLARE_FUNX (F ## name, args_name, nargout_name) // Define the code that will be used to insert the new function into // the symbol table. We look for this name instead of the actual @@ -96,6 +99,12 @@ XDEFUN_INTERNAL (name, args_name, nargout_name, is_text_fcn, doc) \ END_INSTALL_BUILTIN +#define DEFUNX_INTERNAL(name, fname, args_name, nargout_name, \ + is_text_fcn, doc) \ + BEGIN_INSTALL_BUILTIN \ + XDEFUN_INTERNAL (name, args_name, nargout_name, is_text_fcn, doc) \ + END_INSTALL_BUILTIN + // Generate code to install name in the symbol table. The script // mkdefs will create a .def file for every .cc file that uses // DEFUN_DLD. @@ -144,6 +153,10 @@ #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ DECLARE_FUN (name, args_name, nargout_name) +#define DEFUNX_INTERNAL(name, fname, args_name, nargout_name, \ + is_text_fcn, doc) \ + DECLARE_FUNX (fname, args_name, nargout_name) + // No definition is required for an alias. #define DEFALIAS_INTERNAL(name, alias) diff --git a/src/defun.h b/src/defun.h --- a/src/defun.h +++ b/src/defun.h @@ -60,7 +60,7 @@ // This one can be used when `name' cannot be used directly (if it is // already defined as a macro). In that case, name is already a -// quoted string, and the name of the structure has to be passed too. +// quoted string, and the name of the structure must to be passed too. #define DEFCONSTX(name, sname, defn, doc) \ DEFCONSTX_INTERNAL (name, sname, defn, doc) @@ -80,6 +80,14 @@ #define DEFUN(name, args_name, nargout_name, doc) \ DEFUN_INTERNAL (name, args_name, nargout_name, false, doc) +// This one can be used when `name' cannot be used directly (if it is +// already defined as a macro). In that case, name is already a +// quoted string, and the internal name of the function must be passed +// too (the convetion is to use a prefix of "F", so "foo" becomes "Ffoo"). + +#define DEFUNX(name, fname, args_name, nargout_name, doc) \ + DEFUNX_INTERNAL (name, fname, args_name, nargout_name, false, doc) + // Define a builtin text-style function. // // This is like DEFUN, except that it defines a function that can be diff --git a/src/ov-usr-fcn.cc b/src/ov-usr-fcn.cc --- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -486,7 +486,7 @@ nargout_sr->define (static_cast (nargout)); } -DEFUN (va_arg, args, , +DEFUNX ("va_arg", Fva_arg, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} va_arg ()\n\ Return the value of hte next available argument and move the internal\n\