Mercurial > hg > octave-thorsten
changeset 1488:89c587478067
[project @ 1995-09-26 22:49:48 by jwe]
line wrap: on
line diff
--- a/src/balance.cc +++ b/src/balance.cc @@ -43,7 +43,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("balance", Fbalance, Sbalance, 4, 4, +DEFUN_DLD_BUILTIN ("balance", Fbalance, Sbalance, 11, "AA = balance (A [, OPT]) or [[DD,] AA] = balance (A [, OPT])\n\ \n\ generalized eigenvalue problem:\n\
--- a/src/chol.cc +++ b/src/chol.cc @@ -36,7 +36,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("chol", Fchol, Schol, 2, 1, +DEFUN_DLD_BUILTIN ("chol", Fchol, Schol, 11, "R = chol (X): cholesky factorization") { Octave_object retval;
--- a/src/colloc.cc +++ b/src/colloc.cc @@ -33,7 +33,7 @@ #include "tree-const.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("colloc", Fcolloc, Scolloc, 7, 4, +DEFUN_DLD_BUILTIN ("colloc", Fcolloc, Scolloc, 10, "[R, A, B, Q] = colloc (N [, \"left\"] [, \"right\"]): collocation weights") { Octave_object retval;
--- a/src/dassl.cc +++ b/src/dassl.cc @@ -103,7 +103,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("dassl", Fdassl, Sdassl, 5, 2, +DEFUN_DLD_BUILTIN ("dassl", Fdassl, Sdassl, 10, "dassl (\"function_name\", x_0, xdot_0, t_out)\n\ dassl (F, X_0, XDOT_0, T_OUT, T_CRIT)\n\ \n\ @@ -125,7 +125,7 @@ } dassl_fcn = is_valid_function (args(0), "dassl", 1); - if (! dassl_fcn || takes_correct_nargs (dassl_fcn, 3, "dassl", 1) != 1) + if (! dassl_fcn) return retval; ColumnVector state = args(1).vector_value (); @@ -315,7 +315,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("dassl_options", Fdassl_options, Sdassl_options, -1, 1, +DEFUN_DLD_BUILTIN ("dassl_options", Fdassl_options, Sdassl_options, 10, "dassl_options (KEYWORD, VALUE)\n\ \n\ Set or show options for dassl. Keywords may be abbreviated\n\
--- a/src/data.cc +++ b/src/data.cc @@ -50,7 +50,7 @@ #define ABS(x) (((x) < 0) ? (-x) : (x)) #endif -DEFUN ("all", Fall, Sall, 1, 1, +DEFUN ("all", Fall, Sall, 10, "all (X): are all elements of X nonzero?") { Octave_object retval; @@ -65,7 +65,7 @@ return retval; } -DEFUN ("any", Fany, Sany, 1, 1, +DEFUN ("any", Fany, Sany, 10, "any (X): are any elements of X nonzero?") { Octave_object retval; @@ -134,7 +134,7 @@ return retval; } -DEFUN ("atan2", Fatan2, Satan2, 2, 1, +DEFUN ("atan2", Fatan2, Satan2, 10, "atan2 (Y, X): atan (Y / X) in range -pi to pi") { Octave_object retval; @@ -220,7 +220,7 @@ return retval; } -DEFUN ("cumprod", Fcumprod, Scumprod, 1, 1, +DEFUN ("cumprod", Fcumprod, Scumprod, 10, "cumprod (X): cumulative products") { Octave_object retval; @@ -257,7 +257,7 @@ return retval; } -DEFUN ("cumsum", Fcumsum, Scumsum, 1, 1, +DEFUN ("cumsum", Fcumsum, Scumsum, 10, "cumsum (X): cumulative sums") { Octave_object retval; @@ -539,7 +539,7 @@ return retval; } -DEFUN ("diag", Fdiag, Sdiag, 2, 1, +DEFUN ("diag", Fdiag, Sdiag, 10, "diag (X [,k]): form/extract diagonals") { Octave_object retval; @@ -556,7 +556,7 @@ return retval; } -DEFUN ("prod", Fprod, Sprod, 1, 1, +DEFUN ("prod", Fprod, Sprod, 10, "prod (X): products") { Octave_object retval; @@ -593,7 +593,7 @@ return retval; } -DEFUN ("size", Fsize, Ssize, 2, 1, +DEFUN ("size", Fsize, Ssize, 11, "[m, n] = size (x): return rows and columns of X\n\ \n\ d = size (x): return number of rows and columns of x as a row vector\n\ @@ -645,7 +645,7 @@ return retval; } -DEFUN ("sum", Fsum, Ssum, 1, 1, +DEFUN ("sum", Fsum, Ssum, 10, "sum (X): sum of elements") { Octave_object retval; @@ -682,7 +682,7 @@ return retval; } -DEFUN ("sumsq", Fsumsq, Ssumsq, 1, 1, +DEFUN ("sumsq", Fsumsq, Ssumsq, 10, "sumsq (X): sum of squares of elements") { Octave_object retval; @@ -719,7 +719,7 @@ return retval; } -DEFUN ("is_struct", Fis_struct, Sis_struct, 1, 1, +DEFUN ("is_struct", Fis_struct, Sis_struct, 10, "is_struct (x): return nonzero if x is a structure") { Octave_object retval; @@ -741,7 +741,7 @@ return retval; } -DEFUN ("struct_elements", Fstruct_elements, Sstruct_elements, 1, 1, +DEFUN ("struct_elements", Fstruct_elements, Sstruct_elements, 10, "struct_elements (S)\n\ \n\ Return a list of the names of the elements of the structure S.") @@ -776,7 +776,7 @@ return retval; } -DEFUN ("struct_contains", Fstruct_contains, Sstruct_contains, 1, 2, +DEFUN ("struct_contains", Fstruct_contains, Sstruct_contains, 10, "struct_contains (S, NAME)\n\ \n\ return nonzero if S is a structure with element NAME") @@ -894,7 +894,7 @@ return m; } -DEFUN ("ones", Fones, Sones, 2, 1, +DEFUN ("ones", Fones, Sones, 10, "ones (N), ones (N, M), ones (X): create a matrix of all ones") { Octave_object retval; @@ -923,7 +923,7 @@ return retval; } -DEFUN ("zeros", Fzeros, Szeros, 2, 1, +DEFUN ("zeros", Fzeros, Szeros, 10, "zeros (N), zeros (N, M), zeros (X): create a matrix of all zeros") { Octave_object retval; @@ -994,7 +994,7 @@ return m; } -DEFUN ("eye", Feye, Seye, 2, 1, +DEFUN ("eye", Feye, Seye, 10, "eye (N), eye (N, M), eye (X): create an identity matrix") { Octave_object retval; @@ -1023,7 +1023,7 @@ return retval; } -DEFUN ("linspace", Flinspace, Slinspace, 2, 1, +DEFUN ("linspace", Flinspace, Slinspace, 10, "usage: linspace (x1, x2, n)\n\ \n\ Return a vector of n equally spaced points between x1 and x2\n\
--- a/src/defun-dld.h +++ b/src/defun-dld.h @@ -38,20 +38,20 @@ #if defined (OCTAVE_LITE) && defined (MAKE_BUILTINS) #if defined (WITH_DLD) -#define DEFUN_DLD_BUILTIN(name, fname, sname, nargin_max, nargout_max, doc) \ +#define DEFUN_DLD_BUILTIN(name, fname, sname, unused_arg_flags, doc) \ BEGIN_INSTALL_BUILTIN \ - DEFINE_FUN_STRUCT (name, 0, sname, nargin_max, nargout_max, 0, doc); \ + DEFINE_FUN_STRUCT (name, 0, sname, unused_arg_flags, 0, doc); \ install_builtin_function (&sname); \ END_INSTALL_BUILTIN #else -#define DEFUN_DLD_BUILTIN(name, fname, sname, nargin_max, nargout_max, doc) \ +#define DEFUN_DLD_BUILTIN(name, fname, sname, unused_arg_flags, doc) \ BEGIN_INSTALL_BUILTIN \ const char *sname = name " not included with --enable-lite-kernel"; \ END_INSTALL_BUILTIN #endif #else -#define DEFUN_DLD_BUILTIN(name, fname, sname, nargin_max, nargout_max, doc) \ - DEFUN_INTERNAL (name, fname, sname, nargin_max, nargout_max, 0, doc) +#define DEFUN_DLD_BUILTIN(name, fname, sname, unused_arg_flags, doc) \ + DEFUN_INTERNAL (name, fname, sname, unused_arg_flags, 0, doc) #endif // Define a function that may be loaded dynamically at run time. @@ -63,9 +63,9 @@ // definition of the function. #if ! defined (MAKE_BUILTINS) -#define DEFUN_DLD(name, fname, sname, fsname, nargin_max, nargout_max, doc) \ +#define DEFUN_DLD(name, fname, sname, fsname, unused_arg_flags, doc) \ DECLARE_FUN (fname); \ - DEFINE_FUN_STRUCT (name, fname, sname, nargin_max, nargout_max, 0, doc); \ + DEFINE_FUN_STRUCT (name, fname, sname, unused_arg_flags, 0, doc); \ DEFINE_FUN_STRUCT_FUN (sname, fsname) \ DECLARE_FUN (fname) #endif
--- a/src/defun-int.h +++ b/src/defun-int.h @@ -34,12 +34,11 @@ // mkdefs will create a .def file for every .cc file that uses DEFUN, // DEFUN_TEXT, or DEFUN_DLD. -#define DEFUN_INTERNAL(name, fname, sname, nargin_max, nargout_max, \ +#define DEFUN_INTERNAL(name, fname, sname, unused_arg_flags, \ is_text_fcn, doc) \ BEGIN_INSTALL_BUILTIN \ - extern DECLARE_FUN (fname); \ - DEFINE_FUN_STRUCT (name, fname, sname, nargin_max, nargout_max, \ - is_text_fcn, doc); \ + extern DECLARE_FUN_ ## unused_arg_flags (fname); \ + DEFINE_FUN_STRUCT (name, fname, sname, is_text_fcn, doc); \ install_builtin_function (&sname); \ END_INSTALL_BUILTIN @@ -55,9 +54,9 @@ // Generate the first line of the function definition. This ensures // that the internal functions all have the same signature. -#define DEFUN_INTERNAL(name, fname, sname, nargin_max, nargout_max, \ +#define DEFUN_INTERNAL(name, fname, sname, unused_arg_flags, \ is_text_fcn, doc) \ - DECLARE_FUN (fname) + DECLARE_FUN_ ## unused_arg_flags (fname) // No definition is required for an alias. @@ -68,10 +67,9 @@ // Define the structure that will be used to insert this function into // the symbol table. -#define DEFINE_FUN_STRUCT(name, fname, sname, nargin_max, \ - nargout_max, is_text_fcn, doc) \ +#define DEFINE_FUN_STRUCT(name, fname, sname, is_text_fcn, doc) \ static builtin_function sname = \ - { name, nargin_max, nargout_max, is_text_fcn, fname, doc } + { name, is_text_fcn, fname, doc } #define DEFINE_FUN_STRUCT_FUN(sname, fsname) \ builtin_function * \ @@ -82,11 +80,22 @@ // Declare an internal function named fname. This is the interface // used by all internal functions in Octave that are also callable -// from the Octave language. +// from the Octave language. The funny suffixes are used to help us +// avoid warnings from g++ about unused arguments. + +#define DECLARE_FUN_00(fname) \ + Octave_object fname (const Octave_object&, int) -#define DECLARE_FUN(fname) \ - Octave_object \ - fname (const Octave_object& args, int nargout) +#define DECLARE_FUN_01(fname) \ + Octave_object fname (const Octave_object&, int nargout) + +#define DECLARE_FUN_10(fname) \ + Octave_object fname (const Octave_object& args, int) + +#define DECLARE_FUN_11(fname) \ + Octave_object fname (const Octave_object& args, int nargout) + +#define DECLARE_FUN_(fname) DECLARE_FUN_11 (fname) // XXX FIXME XXX -- eliminate the need for these in the functions that // use them?
--- a/src/defun.h +++ b/src/defun.h @@ -102,16 +102,19 @@ // table. By convention, it is constructed by prefixing name with // the character S. // -// nargin_max is the maximum number of arguments this function can -// accept. XXX FIXME XXX -- is this really used now? +// unused_arg_flags is used to decide how to declare the function so +// that g++ doesn't complain about unused arguments. It can be +// one of: // -// nargout_max is the maximum number of outputs this function can -// produce. XXX FIXME XXX -- is this really used now? +// 00: Both of the arguments args and nargout are unused. +// 10: The argument args is unused. +// 01: The argument nargout is unused. +// 11 or missing: Both of the arguments args and nargout are used. // // doc is the simple help text for the function. -#define DEFUN(name, fname, sname, nargin_max, nargout_max, doc) \ - DEFUN_INTERNAL (name, fname, sname, nargin_max, nargout_max, 0, doc) +#define DEFUN(name, fname, sname, unused_arg_flags, doc) \ + DEFUN_INTERNAL (name, fname, sname, unused_arg_flags, 0, doc) // Define a builtin text-style function. // @@ -119,8 +122,8 @@ // called from the Octave language without using parenthesis to // surround the arguments). -#define DEFUN_TEXT(name, fname, sname, nargin_max, nargout_max, doc) \ - DEFUN_INTERNAL (name, fname, sname, nargin_max, nargout_max, 1, doc) +#define DEFUN_TEXT(name, fname, sname, unused_arg_flags, doc) \ + DEFUN_INTERNAL (name, fname, sname, unused_arg_flags, 1, doc) // Define a mapper function. //
--- a/src/det.cc +++ b/src/det.cc @@ -36,7 +36,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("det", Fdet, Sdet, 2, 1, +DEFUN_DLD_BUILTIN ("det", Fdet, Sdet, 10, "det (X): determinant of a square matrix") { Octave_object retval;
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -356,7 +356,7 @@ return cd_ok; } -DEFUN_TEXT ("cd", Fcd, Scd, 2, 1, +DEFUN_TEXT ("cd", Fcd, Scd, 10, "cd [dir]\n\ \n\ change current working directory\n\ @@ -404,7 +404,7 @@ // Get a directory listing. -DEFUN_TEXT ("ls", Fls, Sls, -1, 1, +DEFUN_TEXT ("ls", Fls, Sls, 10, "ls [options]\n\ \n\ print a directory listing") @@ -454,7 +454,7 @@ DEFALIAS (dir, ls); -DEFUN ("pwd", Fpwd, Spwd, 1, 0, +DEFUN ("pwd", Fpwd, Spwd, 00, "pwd (): print current working directory") { Octave_object retval; @@ -485,7 +485,7 @@ return retval; } -DEFUN ("readdir", Freaddir, Sreaddir, 1, 0, +DEFUN ("readdir", Freaddir, Sreaddir, 10, "readdir (NAME)\n\ \n\ Return an array of strings containing the list of all files in the @@ -563,7 +563,7 @@ // XXX FIXME XXX -- should probably also allow second arg to specify // mode. -DEFUN ("mkdir", Fmkdir, Smkdir, 1, 0, +DEFUN ("mkdir", Fmkdir, Smkdir, 10, "mkdir (NAME)\n\ \n\ Create the directory named by NAME. If successful, returns 0;\n\ @@ -594,7 +594,7 @@ return retval; } -DEFUN ("rmdir", Frmdir, Srmdir, 1, 0, +DEFUN ("rmdir", Frmdir, Srmdir, 10, "rmdir (NAME)\n\ \n\ Remove the directory named by NAME. If successful, returns 0;\n\ @@ -625,7 +625,7 @@ return retval; } -DEFUN ("rename", Frename, Srename, 1, 0, +DEFUN ("rename", Frename, Srename, 10, "rename (FROM, TO)\n\ \n\ Rename a file. If successful, returns 0;\n\
--- a/src/dynamic-ld.cc +++ b/src/dynamic-ld.cc @@ -246,6 +246,7 @@ #ifdef WITH_DLD return dld_octave_builtin (name); #else + (void) name; return 0; #endif } @@ -256,6 +257,7 @@ #ifdef WITH_DLD return dld_octave_oct_file (name); #endif + (void) name; return 0; }
--- a/src/eig.cc +++ b/src/eig.cc @@ -35,7 +35,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("eig", Feig, Seig, 2, 1, +DEFUN_DLD_BUILTIN ("eig", Feig, Seig, 11, "eig (X) or [V, D] = eig (X): compute eigenvalues and eigenvectors of X") { Octave_object retval;
--- a/src/error.cc +++ b/src/error.cc @@ -172,7 +172,7 @@ abort (); } -DEFUN ("error", Ferror, Serror, 1, 1, +DEFUN ("error", Ferror, Serror, 10, "error (MESSAGE): print MESSAGE and set the error state.\n\ This should eventually take us up to the top level, possibly\n\ printing traceback messages as we go.\n\ @@ -204,7 +204,7 @@ return retval; } -DEFUN ("warning", Fwarning, Swarning, 1, 1, +DEFUN ("warning", Fwarning, Swarning, 10, "warning (MESSAGE): print a warning MESSAGE.\n\ \n\ See also: error") @@ -233,7 +233,7 @@ return retval; } -DEFUN ("usage", Fusage, Susage, 1, 1, +DEFUN ("usage", Fusage, Susage, 10, "usage (MESSAGE): print a usage MESSAGE.\n\ \n\ See also: error")
--- a/src/expm.cc +++ b/src/expm.cc @@ -55,7 +55,7 @@ const int&, double*); } -DEFUN_DLD_BUILTIN ("expm", Fexpm, Sexpm, 2, 1, +DEFUN_DLD_BUILTIN ("expm", Fexpm, Sexpm, 10, "expm (X): matrix exponential, e^A") { Octave_object retval;
--- a/src/fft.cc +++ b/src/fft.cc @@ -38,7 +38,7 @@ // This function should be merged with Fifft. -DEFUN_DLD_BUILTIN ("fft", Ffft, Sfft, 3, 1, +DEFUN_DLD_BUILTIN ("fft", Ffft, Sfft, 10, "fft (X [, N]): fast fourier transform of a vector") { Octave_object retval;
--- a/src/fft2.cc +++ b/src/fft2.cc @@ -38,7 +38,7 @@ // This function should be merged with Fifft2. -DEFUN_DLD_BUILTIN ("fft2", Ffft2, Sfft2, 3, 1, +DEFUN_DLD_BUILTIN ("fft2", Ffft2, Sfft2, 10, "fft2 (X [, N] [, M])\n\ \n\ two dimensional fast fourier transform of a vector")
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -236,7 +236,7 @@ return retval; } -DEFUN ("fclose", Ffclose, Sfclose, 1, 1, +DEFUN ("fclose", Ffclose, Sfclose, 10, "fclose (FILENAME or FILENUM): close a file") { Octave_object retval; @@ -287,7 +287,7 @@ return retval; } -DEFUN ("fflush", Ffflush, Sfflush, 1, 1, +DEFUN ("fflush", Ffflush, Sfflush, 10, "fflush (FILENAME or FILENUM): flush buffered data to output file") { Octave_object retval; @@ -406,7 +406,7 @@ return retval; } -DEFUN ("fgetl", Ffgetl, Sfgetl, 2, 2, +DEFUN ("fgetl", Ffgetl, Sfgetl, 11, "[STRING, LENGTH] = fgetl (FILENAME or FILENUM [, LENGTH])\n\ \n\ read a string from a file") @@ -423,7 +423,7 @@ return retval; } -DEFUN ("fgets", Ffgets, Sfgets, 2, 2, +DEFUN ("fgets", Ffgets, Sfgets, 11, "[STRING, LENGTH] = fgets (FILENAME or FILENUM [, LENGTH])\n\ \n\ read a string from a file") @@ -503,7 +503,7 @@ return retval; } -DEFUN ("fopen", Ffopen, Sfopen, 2, 1, +DEFUN ("fopen", Ffopen, Sfopen, 10, "FILENUM = fopen (FILENAME, MODE): open a file\n\ \n\ Valid values for mode include:\n\ @@ -553,7 +553,7 @@ return retval; } -DEFUN ("freport", Ffreport, Sfreport, 0, 1, +DEFUN ("freport", Ffreport, Sfreport, 10, "freport (): list open files and their status") { Octave_object retval; @@ -584,7 +584,7 @@ return retval; } -DEFUN ("frewind", Ffrewind, Sfrewind, 1, 1, +DEFUN ("frewind", Ffrewind, Sfrewind, 10, "frewind (FILENAME or FILENUM): set file position at beginning of file") { Octave_object retval; @@ -680,7 +680,7 @@ return retval; } -DEFUN ("fseek", Ffseek, Sfseek, 3, 1, +DEFUN ("fseek", Ffseek, Sfseek, 10, "fseek (FILENAME or FILENUM, OFFSET [, ORIGIN])\n\ \n\ set file position for reading or writing") @@ -720,7 +720,7 @@ return retval; } -DEFUN ("ftell", Fftell, Sftell, 1, 1, +DEFUN ("ftell", Fftell, Sftell, 10, "POSITION = ftell (FILENAME or FILENUM): returns the current file position") { Octave_object retval; @@ -970,7 +970,7 @@ // Formatted printing to a file. static Octave_object -do_printf (const char *type, const Octave_object& args, int nargout) +do_printf (const char *type, const Octave_object& args) { Octave_object retval; fmt_arg_count = 0; @@ -1072,7 +1072,7 @@ return retval; } -DEFUN ("fprintf", Ffprintf, Sfprintf, -1, 1, +DEFUN ("fprintf", Ffprintf, Sfprintf, 10, "fprintf (FILENAME or FILENUM, FORMAT, ...)") { Octave_object retval; @@ -1082,14 +1082,14 @@ if (nargin < 2) print_usage ("fprintf"); else - retval = do_printf ("fprintf", args, nargout); + retval = do_printf ("fprintf", args); return retval; } // Formatted printing. -DEFUN ("printf", Fprintf, Sprintf, -1, 1, +DEFUN ("printf", Fprintf, Sprintf, 10, "printf (FORMAT, ...)") { Octave_object retval; @@ -1099,14 +1099,14 @@ if (nargin < 1) print_usage ("printf"); else - retval = do_printf ("printf", args, nargout); + retval = do_printf ("printf", args); return retval; } // Formatted printing to a string. -DEFUN ("sprintf", Fsprintf, Ssprintf, -1, 1, +DEFUN ("sprintf", Fsprintf, Ssprintf, 10, "s = sprintf (FORMAT, ...)") { Octave_object retval; @@ -1116,7 +1116,7 @@ if (nargin < 1) print_usage ("sprintf"); else - retval = do_printf ("sprintf", args, nargout); + retval = do_printf ("sprintf", args); return retval; } @@ -1438,7 +1438,7 @@ return retval; } -DEFUN ("fscanf", Ffscanf, Sfscanf, 2, -1, +DEFUN ("fscanf", Ffscanf, Sfscanf, 11, "[A, B, C, ...] = fscanf (FILENAME or FILENUM, FORMAT)") { Octave_object retval; @@ -1455,7 +1455,7 @@ // Formatted reading. -DEFUN ("scanf", Fscanf, Sscanf, 1, -1, +DEFUN ("scanf", Fscanf, Sscanf, 11, "[A, B, C, ...] = scanf (FORMAT)") { Octave_object retval; @@ -1472,7 +1472,7 @@ // Formatted reading from a string. -DEFUN ("sscanf", Fsscanf, Ssscanf, 2, -1, +DEFUN ("sscanf", Fsscanf, Ssscanf, 11, "[A, B, C, ...] = sscanf (STRING, FORMAT)") { Octave_object retval; @@ -1696,7 +1696,7 @@ return retval; } -DEFUN ("fread", Ffread, Sfread, 3, 2, +DEFUN ("fread", Ffread, Sfread, 11, "[DATA, COUNT] = fread (FILENUM, SIZE, PRECISION)\n\ \n\ Reads data in binary form of type PRECISION from a file.\n\ @@ -1739,7 +1739,7 @@ // count : the number of elements written static Octave_object -fwrite_internal (const Octave_object& args, int nargout) +fwrite_internal (const Octave_object& args) { Octave_object retval; @@ -1778,7 +1778,7 @@ return retval; } -DEFUN ("fwrite", Ffwrite, Sfwrite, 3, 1, +DEFUN ("fwrite", Ffwrite, Sfwrite, 10, "COUNT = fwrite (FILENUM, DATA, PRECISION)\n\ \n\ Writes data to a file in binary form of size PRECISION\n\ @@ -1799,7 +1799,7 @@ if (nargin < 2 || nargin > 3) print_usage ("fwrite"); else - retval = fwrite_internal (args, nargout); + retval = fwrite_internal (args); return retval; } @@ -1812,7 +1812,7 @@ // eof : non zero for an end of file condition static Octave_object -feof_internal (const Octave_object& args, int nargout) +feof_internal (const Octave_object& args) { Octave_object retval; @@ -1828,7 +1828,7 @@ return retval; } -DEFUN ("feof", Ffeof, Sfeof, 1, 1, +DEFUN ("feof", Ffeof, Sfeof, 10, "ERROR = feof (FILENAME or FILENUM)\n\ \n\ Returns a non zero value for an end of file condition for the\n\ @@ -1841,7 +1841,7 @@ if (nargin != 1) print_usage ("feof"); else - retval = feof_internal (args, nargout); + retval = feof_internal (args); return retval; } @@ -1876,7 +1876,7 @@ return retval; } -DEFUN ("ferror", Fferror, Sferror, 1, 1, +DEFUN ("ferror", Fferror, Sferror, 11, "ERROR = ferror (FILENAME or FILENUM)\n\ \n\ Returns a non zero value for an error condition on the\n\ @@ -1956,7 +1956,7 @@ return retval; } -DEFUN ("popen", Fpopen, Spopen, 2, 1, +DEFUN ("popen", Fpopen, Spopen, 10, "FILENUM = popen (FILENAME, MODE)\n\ \n\ start a process and create a pipe. Valid values for mode are:\n\ @@ -2008,7 +2008,7 @@ return retval; } -DEFUN ("pclose", Fpclose, Spclose, 1, 1, +DEFUN ("pclose", Fpclose, Spclose, 10, "pclose (FILENAME or FILENUM)\n\ \n\ Close a pipe and terminate the associated process") @@ -2026,7 +2026,7 @@ } static Octave_object -execute_internal (const Octave_object& args, int nargout) +execute_internal (const Octave_object& args) { Octave_object retval (3, tree_constant (-1.0)); @@ -2108,7 +2108,7 @@ return retval; } -DEFUN ("execute", Fexecute, Sexecute, 1, 3, +DEFUN ("execute", Fexecute, Sexecute, 10, "[STDIN, STDOUT, PID] = execute (COMMAND)\n\ \n\ Start a program and redirect its stdin to STDIN and its stdout to STDOUT") @@ -2120,7 +2120,7 @@ if (nargin != 1) print_usage ("execute"); else - retval = execute_internal (args, nargout); + retval = execute_internal (args); return retval; } @@ -2142,7 +2142,7 @@ return retval; } -DEFUN ("sync_system", Fsync_system, Ssync_system, 1, 1, +DEFUN ("sync_system", Fsync_system, Ssync_system, 10, "RETCODE = sync_system (FILENAME)\n\ \n\ Start a program and wait until it terminates") @@ -2195,7 +2195,7 @@ } } -DEFUN ("async_system", Fasync_system, Sasync_system, 1, 1, +DEFUN ("async_system", Fasync_system, Sasync_system, 10, "PID = async_system (FILENAME)\n\ \n\ Create a new process and start FILENAME") @@ -2254,7 +2254,7 @@ return retval; } -DEFUN ("waitpid", Fwaitpid, Swaitpid, 1, 1, +DEFUN ("waitpid", Fwaitpid, Swaitpid, 10, "STATUS = waitpid (PID, OPTIONS)\n\ \n\ wait for process PID to terminate\n\ @@ -2319,7 +2319,7 @@ return retval; } -DEFUN ("mkfifo", Fmkfifo, Smkfifo, 2, 1, +DEFUN ("mkfifo", Fmkfifo, Smkfifo, 10, "STATUS = mkfifo (NAME, MODE)\n\ \n\ Create a FIFO special file named NAME with file mode MODE\n\ @@ -2360,7 +2360,7 @@ return retval; } -DEFUN ("unlink", Funlink, Sunlink, 1, 1, +DEFUN ("unlink", Funlink, Sunlink, 10, "STATUS = unlink (NAME)\n\ \n\ Delete the file NAME\n\ @@ -2414,7 +2414,7 @@ return m; } -DEFUN ("stat", Fstat, Sstat, 1, 1, +DEFUN ("stat", Fstat, Sstat, 10, "stat (NAME)\n\ \n\ Given the name of a file, return a structure with the following @@ -2465,7 +2465,7 @@ return retval; } -DEFUN ("lstat", Flstat, Slstat, 1, 1, +DEFUN ("lstat", Flstat, Slstat, 10, "lstat (NAME)\n\ \n\ Like stat (NAME), but if NAME refers to a symbolic link, returns\n\ @@ -2529,7 +2529,7 @@ return retval; } -DEFUN ("umask", Fumask, Sumask, 2, 1, +DEFUN ("umask", Fumask, Sumask, 10, "umask (MASK)\n\ \n\ Change the file permission mask for file creation for the current
--- a/src/find.cc +++ b/src/find.cc @@ -33,7 +33,7 @@ static Octave_object find_to_fortran_idx (const ColumnVector i_idx, const ColumnVector j_idx, - const tree_constant& val, int nr, int nc, int nargout) + const tree_constant& val, int nr, int nargout) { Octave_object retval; @@ -115,7 +115,7 @@ } tree_constant tmp (v, 1); - return find_to_fortran_idx (i_idx, j_idx, tmp, m_nr, m_nc, nargout); + return find_to_fortran_idx (i_idx, j_idx, tmp, m_nr, nargout); } static Octave_object @@ -155,10 +155,10 @@ } tree_constant tmp (v, 1); - return find_to_fortran_idx (i_idx, j_idx, tmp, m_nr, m_nc, nargout); + return find_to_fortran_idx (i_idx, j_idx, tmp, m_nr, nargout); } -DEFUN_DLD_BUILTIN ("find", Ffind, Sfind, 2, 3, +DEFUN_DLD_BUILTIN ("find", Ffind, Sfind, 11, "find (X) or [I, J, V] = find (X): Return indices of nonzero elements") { Octave_object retval;
--- a/src/fsolve.cc +++ b/src/fsolve.cc @@ -119,7 +119,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("fsolve", Ffsolve, Sfsolve, 2, 1, +DEFUN_DLD_BUILTIN ("fsolve", Ffsolve, Sfsolve, 11, "Solve nonlinear equations using Minpack. Usage:\n\ \n\ [X, INFO] = fsolve (F, X0)\n\ @@ -142,7 +142,7 @@ } fsolve_fcn = is_valid_function (args(0), "fsolve", 1); - if (! fsolve_fcn || takes_correct_nargs (fsolve_fcn, 1, "fsolve", 1) != 1) + if (! fsolve_fcn) return retval; ColumnVector x = args(1).vector_value (); @@ -281,7 +281,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("fsolve_options", Ffsolve_options, Sfsolve_options, -1, 1, +DEFUN_DLD_BUILTIN ("fsolve_options", Ffsolve_options, Sfsolve_options, 10, "fsolve_options (KEYWORD, VALUE)\n\ \n\ Set or show options for fsolve. Keywords may be abbreviated\n\
--- a/src/fsqp.cc +++ b/src/fsqp.cc @@ -54,12 +54,12 @@ #endif #if defined (FSQP_MISSING) -DEFUN_DLD_BUILTIN ("fsqp", Ffsqp, Sfsqp, 11, 3, +DEFUN_DLD_BUILTIN ("fsqp", Ffsqp, Sfsqp, 00, "This function requires FSQP, which is not freely\n\ redistributable. For more information, read the file\n\ libcruft/fsqp/README.MISSING in the source distribution.") #else -DEFUN_DLD_BUILTIN ("fsqp", Ffsqp, Sfsqp, 11, 3, +DEFUN_DLD_BUILTIN ("fsqp", Ffsqp, Sfsqp, 00, "[X, PHI] = fsqp (X, PHI [, LB, UB] [, LB, A, UB] [, LB, G, UB])\n\ \n\ Groups of arguments surrounded in `[]' are optional, but\n\ @@ -89,12 +89,12 @@ } #if defined (FSQP_MISSING) -DEFUN_DLD_BUILTIN ("fsqp_options", Ffsqp_options, Sfsqp_options, -1, 1, +DEFUN_DLD_BUILTIN ("fsqp_options", Ffsqp_options, Sfsqp_options, 00, "This function requires FSQP, which is not freely\n\ redistributable. For more information, read the file\n\ libcruft/fsqp/README.MISSING in the source distribution.") #else -DEFUN_DLD_BUILTIN ("fsqp_options", Ffsqp_options, Sfsqp_options, -1, 1, +DEFUN_DLD_BUILTIN ("fsqp_options", Ffsqp_options, Sfsqp_options, 00, "fsqp_options (KEYWORD, VALUE)\n\ \n\ Set or show options for fsqp. Keywords may be abbreviated\n\
--- a/src/givens.cc +++ b/src/givens.cc @@ -47,7 +47,7 @@ double&, Complex&, Complex&); } -DEFUN_DLD_BUILTIN ("givens", Fgivens, Sgivens, 3, 2, +DEFUN_DLD_BUILTIN ("givens", Fgivens, Sgivens, 11, "G = givens (X, Y)\n\ \n\ compute orthogonal matrix G = [c s; -conj (s) c]\n\
--- a/src/help.cc +++ b/src/help.cc @@ -673,12 +673,12 @@ } #ifdef USE_GNU_INFO -DEFUN_TEXT ("help", Fhelp, Shelp, -1, 1, +DEFUN_TEXT ("help", Fhelp, Shelp, 10, "help [-i] [topic ...]\n\ \n\ print cryptic yet witty messages") #else -DEFUN_TEXT ("help", Fhelp, Shelp, -1, 1, +DEFUN_TEXT ("help", Fhelp, Shelp, 10, "help [topic ...]\n\ \n\ print cryptic yet witty messages") @@ -712,7 +712,7 @@ return retval; } -DEFUN_TEXT ("type", Ftype, Stype, -1, 1, +DEFUN_TEXT ("type", Ftype, Stype, 11, "type NAME ...]\n\ \n\ display the definition of each NAME that refers to a function") @@ -853,7 +853,7 @@ return retval; } -DEFUN_TEXT ("which", Fwhich, Swhich, -1, 1, +DEFUN_TEXT ("which", Fwhich, Swhich, 11, "which NAME ...]\n\ \n\ display the type of each NAME. If NAME is defined from an function\n\
--- a/src/hess.cc +++ b/src/hess.cc @@ -36,7 +36,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("hess", Fhess, Shess, 2, 2, +DEFUN_DLD_BUILTIN ("hess", Fhess, Shess, 11, "[P, H] = hess (A) or H = hess (A): Hessenberg decomposition") { Octave_object retval;
--- a/src/ifft.cc +++ b/src/ifft.cc @@ -38,7 +38,7 @@ // This function should be merged with Ffft. -DEFUN_DLD_BUILTIN ("ifft", Fifft, Sifft, 3, 1, +DEFUN_DLD_BUILTIN ("ifft", Fifft, Sifft, 10, "ifft (X [, N]): inverse fast fourier transform of a vector") { Octave_object retval;
--- a/src/ifft2.cc +++ b/src/ifft2.cc @@ -38,7 +38,7 @@ // This function should be merged with Ffft2. -DEFUN_DLD_BUILTIN ("ifft2", Fifft2, Sifft2, 3, 1, +DEFUN_DLD_BUILTIN ("ifft2", Fifft2, Sifft2, 10, "ifft2 (X [, N] [, M])\n\ \n\ two dimensional inverse fast fourier transform of a vector")
--- a/src/input.cc +++ b/src/input.cc @@ -159,9 +159,6 @@ // A line of input from readline. static char *octave_gets_line = 0; -extern tree_constant eval_string (const char *string, int print, - int ans_assign, int& parse_status); - // Append SOURCE to TARGET at INDEX. SIZE is the current amount of // space allocated to TARGET. SOURCE can be NULL, in which case // nothing happens. Gets rid of SOURCE by free ()ing it. Returns @@ -852,7 +849,7 @@ } static char ** -command_completer (char *text, int start, int end) +command_completer (char *text, int /* start */, int /* end */) { char **matches = 0; matches = completion_matches (text, command_generator); @@ -902,7 +899,7 @@ } static void -operate_and_get_next (int count, int c) +operate_and_get_next (int /* count */, int /* c */) { int where; @@ -972,7 +969,7 @@ // If the user simply hits return, this will produce an empty matrix. static Octave_object -get_user_input (const Octave_object& args, int nargout, int debug = 0) +get_user_input (const Octave_object& args, int debug = 0) { tree_constant retval; @@ -1033,7 +1030,7 @@ else { int parse_status = 0; - retval = eval_string (input_buf, 0, 0, parse_status); + retval = eval_string (input_buf, 0, parse_status); if (retval.is_defined ()) { if (debug) @@ -1052,7 +1049,7 @@ return retval; } -DEFUN ("input", Finput, Sinput, 2, 1, +DEFUN ("input", Finput, Sinput, 10, "input (PROMPT [, S])\n\ \n\ Prompt user for input. If the second argument is present, return @@ -1063,14 +1060,14 @@ int nargin = args.length (); if (nargin == 1 || nargin == 2) - retval = get_user_input (args, nargout); + retval = get_user_input (args); else print_usage ("input"); return retval; } -DEFUN ("keyboard", Fkeyboard, Skeyboard, 1, 1, +DEFUN ("keyboard", Fkeyboard, Skeyboard, 10, "keyboard (PROMPT)\n\ \n\ maybe help in debugging function files") @@ -1080,7 +1077,7 @@ int nargin = args.length (); if (nargin == 0 || nargin == 1) - retval = get_user_input (args, nargout, 1); + retval = get_user_input (args, 1); else print_usage ("keyboard");
--- a/src/inv.cc +++ b/src/inv.cc @@ -36,7 +36,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("inv", Finv, Sinv, 2, 1, +DEFUN_DLD_BUILTIN ("inv", Finv, Sinv, 10, "inv (X): inverse of a square matrix") { Octave_object retval; @@ -115,7 +115,7 @@ // alias_builtin() won't do the right thing if we are actually using // dynamic linking. -DEFUN_DLD_BUILTIN ("inverse", Finverse, Sinverse, 2, 1, +DEFUN_DLD_BUILTIN ("inverse", Finverse, Sinverse, 11, "inverse (X): inverse of a square matrix") { return Finv (args, nargout);
--- a/src/lex.l +++ b/src/lex.l @@ -1198,8 +1198,8 @@ return ((spc_prev && spc_next) || ! spc_prev); } -// Duh. - +// Duh. This seems to no longer be needed. +#if 0 static int next_char_is_space (void) { @@ -1207,6 +1207,7 @@ yyunput (c, yytext); return (c == ' ' || c == '\t'); } +#endif // Try to determine if the next token should be treated as a postfix // unary operator. This is ugly, but it seems to do the right thing.
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -214,19 +214,19 @@ } static void -VAX_D_double_to_IEEE_little_double (double *d, int len) +VAX_D_double_to_IEEE_little_double (double * /* d */, int /* len */) { gripe_data_conversion ("VAX D float", "IEEE little endian format"); } static void -VAX_G_double_to_IEEE_little_double (double *d, int len) +VAX_G_double_to_IEEE_little_double (double * /* d */, int /* len */) { gripe_data_conversion ("VAX G float", "IEEE little endian format"); } static void -Cray_to_IEEE_little_double (double *d, int len) +Cray_to_IEEE_little_double (double * /* d */, int /* len */) { gripe_data_conversion ("Cray", "IEEE little endian format"); } @@ -238,19 +238,19 @@ } static void -VAX_D_float_to_IEEE_little_float (float *d, int len) +VAX_D_float_to_IEEE_little_float (float * /* d */, int /* len */) { gripe_data_conversion ("VAX D float", "IEEE little endian format"); } static void -VAX_G_float_to_IEEE_little_float (float *d, int len) +VAX_G_float_to_IEEE_little_float (float * /* d */, int /* len */) { gripe_data_conversion ("VAX G float", "IEEE little endian format"); } static void -Cray_to_IEEE_little_float (float *d, int len) +Cray_to_IEEE_little_float (float * /* d */, int /* len */) { gripe_data_conversion ("Cray", "IEEE little endian format"); } @@ -262,19 +262,19 @@ } static void -VAX_D_double_to_IEEE_big_double (double *d, int len) +VAX_D_double_to_IEEE_big_double (double * /* d */, int /* len */) { gripe_data_conversion ("VAX D float", "IEEE big endian format"); } static void -VAX_G_double_to_IEEE_big_double (double *d, int len) +VAX_G_double_to_IEEE_big_double (double * /* d */, int /* len */) { gripe_data_conversion ("VAX G float", "IEEE big endian format"); } static void -Cray_to_IEEE_big_double (double *d, int len) +Cray_to_IEEE_big_double (double * /* d */, int /* len */) { gripe_data_conversion ("Cray", "IEEE big endian format"); } @@ -286,115 +286,115 @@ } static void -VAX_D_float_to_IEEE_big_float (float *d, int len) +VAX_D_float_to_IEEE_big_float (float * /* d */, int /* len */) { gripe_data_conversion ("VAX D float", "IEEE big endian format"); } static void -VAX_G_float_to_IEEE_big_float (float *d, int len) +VAX_G_float_to_IEEE_big_float (float * /* d */, int /* len */) { gripe_data_conversion ("VAX G float", "IEEE big endian format"); } static void -Cray_to_IEEE_big_float (float *d, int len) +Cray_to_IEEE_big_float (float * /* d */, int /* len */) { gripe_data_conversion ("Cray", "IEEE big endian format"); } static void -IEEE_little_double_to_VAX_D_double (double *d, int len) +IEEE_little_double_to_VAX_D_double (double * /* d */, int /* len */) { gripe_data_conversion ("IEEE little endian", "VAX D"); } static void -IEEE_big_double_to_VAX_D_double (double *d, int len) +IEEE_big_double_to_VAX_D_double (double * /* d */, int /* len */) { gripe_data_conversion ("IEEE big endian", "VAX D"); } static void -VAX_G_double_to_VAX_D_double (double *d, int len) +VAX_G_double_to_VAX_D_double (double * /* d */, int /* len */) { gripe_data_conversion ("VAX G float", "VAX D"); } static void -Cray_to_VAX_D_double (double *d, int len) +Cray_to_VAX_D_double (double * /* d */, int /* len */) { gripe_data_conversion ("Cray", "VAX D"); } static void -IEEE_little_float_to_VAX_D_float (float *d, int len) +IEEE_little_float_to_VAX_D_float (float * /* d */, int /* len */) { gripe_data_conversion ("IEEE little endian", "VAX D"); } static void -IEEE_big_float_to_VAX_D_float (float *d, int len) +IEEE_big_float_to_VAX_D_float (float * /* d */, int /* len */) { gripe_data_conversion ("IEEE big endian", "VAX D"); } static void -VAX_G_float_to_VAX_D_float (float *d, int len) +VAX_G_float_to_VAX_D_float (float * /* d */, int /* len */) { gripe_data_conversion ("VAX G float", "VAX D"); } static void -Cray_to_VAX_D_float (float *d, int len) +Cray_to_VAX_D_float (float * /* d */, int /* len */) { gripe_data_conversion ("Cray", "VAX D"); } static void -IEEE_little_double_to_VAX_G_double (double *d, int len) +IEEE_little_double_to_VAX_G_double (double * /* d */, int /* len */) { gripe_data_conversion ("IEEE little endian", "VAX G"); } static void -IEEE_big_double_to_VAX_G_double (double *d, int len) +IEEE_big_double_to_VAX_G_double (double * /* d */, int /* len */) { gripe_data_conversion ("IEEE big endian", "VAX G"); } static void -VAX_D_double_to_VAX_G_double (double *d, int len) +VAX_D_double_to_VAX_G_double (double * /* d */, int /* len */) { gripe_data_conversion ("VAX D float", "VAX G"); } static void -Cray_to_VAX_G_double (double *d, int len) +Cray_to_VAX_G_double (double * /* d */, int /* len */) { gripe_data_conversion ("VAX G float", "VAX G"); } static void -IEEE_little_float_to_VAX_G_float (float *d, int len) +IEEE_little_float_to_VAX_G_float (float * /* d */, int /* len */) { gripe_data_conversion ("IEEE little endian", "VAX G"); } static void -IEEE_big_float_to_VAX_G_float (float *d, int len) +IEEE_big_float_to_VAX_G_float (float * /* d */, int /* len */) { gripe_data_conversion ("IEEE big endian", "VAX G"); } static void -VAX_D_float_to_VAX_G_float (float *d, int len) +VAX_D_float_to_VAX_G_float (float * /* d */, int /* len */) { gripe_data_conversion ("VAX D float", "VAX G"); } static void -Cray_to_VAX_G_float (float *d, int len) +Cray_to_VAX_G_float (float * /* d */, int /* len */) { gripe_data_conversion ("VAX G float", "VAX G"); } @@ -2162,7 +2162,7 @@ return retval; } -DEFUN_TEXT ("load", Fload, Sload, -1, 1, +DEFUN_TEXT ("load", Fload, Sload, 11, "load [-force] [-ascii] [-binary] [-mat-binary] file [pattern ...]\n\ \n\ Load variables from a file.\n\ @@ -2993,7 +2993,7 @@ warning ("unable to open `%s' for writing...", fname); } -DEFUN_TEXT ("save", Fsave, Ssave, -1, 1, +DEFUN_TEXT ("save", Fsave, Ssave, 10, "save [-ascii] [-binary] [-float-binary] [-mat-binary] \n\ [-save-builtins] file [pattern ...]\n\ \n\
--- a/src/log.cc +++ b/src/log.cc @@ -38,7 +38,7 @@ // XXX FIXME XXX -- the next two functions should really be just // one... -DEFUN_DLD_BUILTIN ("logm", Flogm, Slogm, 2, 1, +DEFUN_DLD_BUILTIN ("logm", Flogm, Slogm, 10, "logm (X): matrix logarithm") { Octave_object retval; @@ -150,7 +150,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("sqrtm", Fsqrtm, Ssqrtm, 2, 1, +DEFUN_DLD_BUILTIN ("sqrtm", Fsqrtm, Ssqrtm, 10, "sqrtm (X): matrix sqrt") { Octave_object retval;
--- a/src/lpsolve.cc +++ b/src/lpsolve.cc @@ -32,7 +32,7 @@ #include "help.h" #include "tree-const.h" -DEFUN_DLD_BUILTIN ("lp_solve", Flp_solve, Slp_solve, 11, 3, +DEFUN_DLD_BUILTIN ("lp_solve", Flp_solve, Slp_solve, 00, "lp_solve (): solve linear programs using lp_solve.") { Octave_object retval; @@ -50,7 +50,7 @@ } DEFUN_DLD_BUILTIN ("lp_solve_options", Flp_solve_options, - Slp_solve_options, -1, 1, + Slp_solve_options, 00, "lp_solve_options (KEYWORD, VALUE)\n\ \n\ Set or show options for lp_solve. Keywords may be abbreviated\n\
--- a/src/lsode.cc +++ b/src/lsode.cc @@ -92,7 +92,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("lsode", Flsode, Slsode, 4, 1, +DEFUN_DLD_BUILTIN ("lsode", Flsode, Slsode, 11, "lsode (F, X0, T_OUT, T_CRIT)\n\ \n\ The first argument is the name of the function to call to\n\ @@ -113,7 +113,7 @@ } lsode_fcn = is_valid_function (args(0), "lsode", 1); - if (! lsode_fcn || takes_correct_nargs (lsode_fcn, 2, "lsode", 1) != 1) + if (! lsode_fcn) return retval; ColumnVector state = args(1).vector_value (); @@ -296,7 +296,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("lsode_options", Flsode_options, Slsode_options, -1, 1, +DEFUN_DLD_BUILTIN ("lsode_options", Flsode_options, Slsode_options, 10, "lsode_options (KEYWORD, VALUE)\n\ \n\ Set or show options for lsode. Keywords may be abbreviated\n\
--- a/src/lu.cc +++ b/src/lu.cc @@ -35,7 +35,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("lu", Flu, Slu, 2, 3, +DEFUN_DLD_BUILTIN ("lu", Flu, Slu, 11, "[L, U, P] = lu (A): LU factorization") { Octave_object retval;
--- a/src/minmax.cc +++ b/src/minmax.cc @@ -362,7 +362,7 @@ return result; } -DEFUN_DLD_BUILTIN ("min", Fmin, Smin, 3, 2, +DEFUN_DLD_BUILTIN ("min", Fmin, Smin, 11, "min (X): minimum value(s) of a vector (matrix)") { Octave_object retval; @@ -590,7 +590,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("max", Fmax, Smax, 3, 2, +DEFUN_DLD_BUILTIN ("max", Fmax, Smax, 11, "max (X): maximum value(s) of a vector (matrix)") { Octave_object retval;
--- a/src/npsol.cc +++ b/src/npsol.cc @@ -228,12 +228,12 @@ #endif #if defined (NPSOL_MISSING) -DEFUN_DLD_BUILTIN ("npsol", Fnpsol, Snpsol, 10, 4, +DEFUN_DLD_BUILTIN ("npsol", Fnpsol, Snpsol, 11, "This function requires NPSOL, which is not freely\n\ redistributable. For more information, read the file\n\ libcruft/npsol/README.MISSING in the source distribution.") #else -DEFUN_DLD_BUILTIN ("npsol", Fnpsol, Snpsol, 10, 4, +DEFUN_DLD_BUILTIN ("npsol", Fnpsol, Snpsol, 11, "[X, OBJ, INFO, LAMBDA] = npsol (X, PHI [, LB, UB] [, LB, A, UB] [, LB, G, UB])\n\ \n\ Groups of arguments surrounded in `[]' are optional, but\n\ @@ -302,8 +302,7 @@ } npsol_objective = is_valid_function (args(1), "npsol", 1); - if (! npsol_objective - || takes_correct_nargs (npsol_objective, 1, "npsol", 1) != 1) + if (! npsol_objective) return retval; Objective func (npsol_objective_function); @@ -407,37 +406,34 @@ } else { - if (takes_correct_nargs (npsol_constraints, 1, "npsol", 1)) - { - ColumnVector nlub = args(nargin-1).vector_value (); - ColumnVector nllb = args(nargin-3).vector_value (); + ColumnVector nlub = args(nargin-1).vector_value (); + ColumnVector nllb = args(nargin-3).vector_value (); - if (error_state - || (! nonlinear_constraints_ok - (x, nllb, npsol_constraint_function, nlub, "npsol", 1))) - return retval; + if (error_state + || (! nonlinear_constraints_ok + (x, nllb, npsol_constraint_function, nlub, "npsol", 1))) + return retval; - NLFunc const_func (npsol_constraint_function); - NLConst nonlinear_constraints (nllb, const_func, nlub); + NLFunc const_func (npsol_constraint_function); + NLConst nonlinear_constraints (nllb, const_func, nlub); - if (nargin == 5) - { - // 8. npsol (x, phi, nllb, g, nlub) + if (nargin == 5) + { + // 8. npsol (x, phi, nllb, g, nlub) - NPSOL nlp (x, func, nonlinear_constraints); - nlp.copy (npsol_opts); - soln = nlp.minimize (objf, inform, lambda); - } - else - { - // 5. npsol (x, phi, lb, ub, nllb, g, nlub) + NPSOL nlp (x, func, nonlinear_constraints); + nlp.copy (npsol_opts); + soln = nlp.minimize (objf, inform, lambda); + } + else + { + // 5. npsol (x, phi, lb, ub, nllb, g, nlub) - NPSOL nlp (x, func, bounds, nonlinear_constraints); - nlp.copy (npsol_opts); - soln = nlp.minimize (objf, inform, lambda); - } - goto solved; + NPSOL nlp (x, func, bounds, nonlinear_constraints); + nlp.copy (npsol_opts); + soln = nlp.minimize (objf, inform, lambda); } + goto solved; } } @@ -451,61 +447,58 @@ } else { - if (takes_correct_nargs (npsol_constraints, 1, "npsol", 1)) - { - ColumnVector nlub = args(nargin-1).vector_value (); - ColumnVector nllb = args(nargin-3).vector_value (); + ColumnVector nlub = args(nargin-1).vector_value (); + ColumnVector nllb = args(nargin-3).vector_value (); - if (error_state - || (! nonlinear_constraints_ok - (x, nllb, npsol_constraint_function, nlub, "npsol", 1))) - return retval; + if (error_state + || (! nonlinear_constraints_ok + (x, nllb, npsol_constraint_function, nlub, "npsol", 1))) + return retval; + + NLFunc const_func (npsol_constraint_function); + NLConst nonlinear_constraints (nllb, const_func, nlub); - NLFunc const_func (npsol_constraint_function); - NLConst nonlinear_constraints (nllb, const_func, nlub); - - ColumnVector lub = args(nargin-4).vector_value (); - ColumnVector llb = args(nargin-6).vector_value (); + ColumnVector lub = args(nargin-4).vector_value (); + ColumnVector llb = args(nargin-6).vector_value (); - if (error_state || llb.capacity () == 0 || lub.capacity () == 0) - { - error ("npsol: bounds for linear constraints must be vectors"); - return retval; - } + if (error_state || llb.capacity () == 0 || lub.capacity () == 0) + { + error ("npsol: bounds for linear constraints must be vectors"); + return retval; + } - Matrix c = args(nargin-5).matrix_value (); + Matrix c = args(nargin-5).matrix_value (); - if (error_state) - { - error ("npsol: invalid linear constraint matrix"); - return retval; - } + if (error_state) + { + error ("npsol: invalid linear constraint matrix"); + return retval; + } - if (! linear_constraints_ok (x, llb, c, lub, "npsol", 1)) - return retval; + if (! linear_constraints_ok (x, llb, c, lub, "npsol", 1)) + return retval; - LinConst linear_constraints (llb, c, lub); + LinConst linear_constraints (llb, c, lub); - if (nargin == 8) - { - // 6. npsol (x, phi, llb, c, lub, nllb, g, nlub) + if (nargin == 8) + { + // 6. npsol (x, phi, llb, c, lub, nllb, g, nlub) - NPSOL nlp (x, func, linear_constraints, - nonlinear_constraints); - nlp.copy (npsol_opts); - soln = nlp.minimize (objf, inform, lambda); - } - else - { - // 4. npsol (x, phi, lb, ub, llb, c, lub, nllb, g, nlub) + NPSOL nlp (x, func, linear_constraints, + nonlinear_constraints); + nlp.copy (npsol_opts); + soln = nlp.minimize (objf, inform, lambda); + } + else + { + // 4. npsol (x, phi, lb, ub, llb, c, lub, nllb, g, nlub) - NPSOL nlp (x, func, bounds, linear_constraints, - nonlinear_constraints); - nlp.copy (npsol_opts); - soln = nlp.minimize (objf, inform, lambda); - } - goto solved; + NPSOL nlp (x, func, bounds, linear_constraints, + nonlinear_constraints); + nlp.copy (npsol_opts); + soln = nlp.minimize (objf, inform, lambda); } + goto solved; } } @@ -776,12 +769,12 @@ #endif #if defined (NPSOL_MISSING) -DEFUN_DLD_BUILTIN ("npsol_options", Fnpsol_options, Snpsol_options, -1, 1, +DEFUN_DLD_BUILTIN ("npsol_options", Fnpsol_options, Snpsol_options, 10, "This function requires NPSOL, which is not freely\n\ redistributable. For more information, read the file\n\ libcruft/npsol/README.MISSING in the source distribution.") #else -DEFUN_DLD_BUILTIN ("npsol_options", Fnpsol_options, Snpsol_options, -1, 1, +DEFUN_DLD_BUILTIN ("npsol_options", Fnpsol_options, Snpsol_options, 10, "npsol_options (KEYWORD, VALUE)\n\ \n\ Set or show options for npsol. Keywords may be abbreviated\n\
--- a/src/oct-hist.cc +++ b/src/oct-hist.cc @@ -636,7 +636,7 @@ } -DEFUN_TEXT ("edit_history", Fedit_history, Sedit_history, -1, 1, +DEFUN_TEXT ("edit_history", Fedit_history, Sedit_history, 10, "edit_history [first] [last]\n\ \n\ edit commands from the history list") @@ -652,7 +652,7 @@ return retval; } -DEFUN_TEXT ("history", Fhistory, Shistory, -1, 1, +DEFUN_TEXT ("history", Fhistory, Shistory, 10, "history [N] [-w file] [-r file] [-q]\n\ \n\ display, save, or load command history") @@ -668,7 +668,7 @@ return retval; } -DEFUN_TEXT ("run_history", Frun_history, Srun_history, -1, 1, +DEFUN_TEXT ("run_history", Frun_history, Srun_history, 10, "run_history [first] [last]\n\ \n\ run commands from the history list")
--- a/src/octave.cc +++ b/src/octave.cc @@ -745,7 +745,7 @@ clean_up_and_exit (retval); } -DEFUN_TEXT ("casesen", Fcasesen, Scasesen, 2, 1, +DEFUN_TEXT ("casesen", Fcasesen, Scasesen, 10, "casesen [on|off]") { Octave_object retval; @@ -764,7 +764,7 @@ return retval; } -DEFUN ("computer", Fcomputer, Scomputer, 1, 0, +DEFUN ("computer", Fcomputer, Scomputer, 11, "computer ():\n\ \n\ Have Octave ask the system, \"What kind of computer are you?\"") @@ -799,7 +799,7 @@ return retval; } -DEFUN ("flops", Fflops, Sflops, 0, 1, +DEFUN ("flops", Fflops, Sflops, 10, "flops (): count floating point operations") { int nargin = args.length (); @@ -812,7 +812,7 @@ return 0.0; } -DEFUN ("quit", Fquit, Squit, 0, 0, +DEFUN ("quit", Fquit, Squit, 00, "quit (): exit Octave gracefully") { Octave_object retval; @@ -823,7 +823,7 @@ DEFALIAS (exit, quit); -DEFUN ("warranty", Fwarranty, Swarranty, 0, 0, +DEFUN ("warranty", Fwarranty, Swarranty, 00, "warranty (): describe copying conditions") { Octave_object retval; @@ -872,7 +872,7 @@ return retval; } -DEFUN ("feval", Ffeval, Sfeval, -1, 1, +DEFUN ("feval", Ffeval, Sfeval, 11, "feval (NAME, ARGS, ...)\n\ \n\ evaluate NAME as a function, passing ARGS as its arguments") @@ -890,8 +890,8 @@ } static Octave_object -eval_string (const char *string, int print, int ans_assign, - int& parse_status, int nargout) +eval_string (const char *string, int print, int& parse_status, + int nargout) { begin_unwind_frame ("eval_string"); @@ -936,13 +936,11 @@ } tree_constant -eval_string (const char *string, int print, int ans_assign, - int& parse_status) +eval_string (const char *string, int print, int& parse_status) { tree_constant retval; - Octave_object tmp = eval_string (string, print, ans_assign, - parse_status, 1); + Octave_object tmp = eval_string (string, print, parse_status, 1); retval = tmp(0); @@ -962,10 +960,10 @@ // Yes Virginia, we always print here... - return eval_string (string, 1, 1, parse_status, nargout); + return eval_string (string, 1, parse_status, nargout); } -DEFUN ("eval", Feval, Seval, 2, 1, +DEFUN ("eval", Feval, Seval, 11, "eval (TRY, CATCH)\n\ \n\ Evaluate the string TRY as octave code. If that fails, evaluate the\n\ @@ -1006,7 +1004,7 @@ // Execute a shell command. -DEFUN ("system", Fsystem, Ssystem, 2, 1, +DEFUN ("system", Fsystem, Ssystem, 11, "system (string [, return_output]): execute shell commands") { Octave_object retval;
--- a/src/pager.cc +++ b/src/pager.cc @@ -204,7 +204,7 @@ diary_stream << s; } -DEFUN_TEXT ("diary", Fdiary, Sdiary, -1, 1, +DEFUN_TEXT ("diary", Fdiary, Sdiary, 10, "diary [on|off]\n\ diary [file]\n\ \n\ @@ -253,7 +253,7 @@ return retval; } -DEFUN_TEXT ("more", Fmore, Smore, -1, 1, +DEFUN_TEXT ("more", Fmore, Smore, 10, "more on\n\ more off\n\ \n\
--- a/src/pinv.cc +++ b/src/pinv.cc @@ -36,7 +36,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("pinv", Fpinv, Spinv, 3, 1, +DEFUN_DLD_BUILTIN ("pinv", Fpinv, Spinv, 10, "pinv ( [, tol])\n\ Returns the pseudoinverse of X; singular values less than tol are ignored.") {
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -872,14 +872,14 @@ { \ unsigned char ctmp = c; \ char stmp[9]; \ - stmp[0] = (c & 0x80) ? '1' : '0'; \ - stmp[1] = (c & 0x40) ? '1' : '0'; \ - stmp[2] = (c & 0x20) ? '1' : '0'; \ - stmp[3] = (c & 0x10) ? '1' : '0'; \ - stmp[4] = (c & 0x08) ? '1' : '0'; \ - stmp[5] = (c & 0x04) ? '1' : '0'; \ - stmp[6] = (c & 0x02) ? '1' : '0'; \ - stmp[7] = (c & 0x01) ? '1' : '0'; \ + stmp[0] = (ctmp & 0x80) ? '1' : '0'; \ + stmp[1] = (ctmp & 0x40) ? '1' : '0'; \ + stmp[2] = (ctmp & 0x20) ? '1' : '0'; \ + stmp[3] = (ctmp & 0x10) ? '1' : '0'; \ + stmp[4] = (ctmp & 0x08) ? '1' : '0'; \ + stmp[5] = (ctmp & 0x04) ? '1' : '0'; \ + stmp[6] = (ctmp & 0x02) ? '1' : '0'; \ + stmp[7] = (ctmp & 0x01) ? '1' : '0'; \ stmp[8] = '\0'; \ os.form ("%s", stmp); \ } \ @@ -890,14 +890,14 @@ { \ unsigned char ctmp = c; \ char stmp[9]; \ - stmp[0] = (c & 0x01) ? '1' : '0'; \ - stmp[1] = (c & 0x02) ? '1' : '0'; \ - stmp[2] = (c & 0x04) ? '1' : '0'; \ - stmp[3] = (c & 0x08) ? '1' : '0'; \ - stmp[4] = (c & 0x10) ? '1' : '0'; \ - stmp[5] = (c & 0x20) ? '1' : '0'; \ - stmp[6] = (c & 0x40) ? '1' : '0'; \ - stmp[7] = (c & 0x80) ? '1' : '0'; \ + stmp[0] = (ctmp & 0x01) ? '1' : '0'; \ + stmp[1] = (ctmp & 0x02) ? '1' : '0'; \ + stmp[2] = (ctmp & 0x04) ? '1' : '0'; \ + stmp[3] = (ctmp & 0x08) ? '1' : '0'; \ + stmp[4] = (ctmp & 0x10) ? '1' : '0'; \ + stmp[5] = (ctmp & 0x20) ? '1' : '0'; \ + stmp[6] = (ctmp & 0x40) ? '1' : '0'; \ + stmp[7] = (ctmp & 0x80) ? '1' : '0'; \ stmp[8] = '\0'; \ os.form ("%s", stmp); \ } \ @@ -1479,7 +1479,7 @@ os << " ]"; } -DEFUN ("disp", Fdisp, Sdisp, 1, 1, +DEFUN ("disp", Fdisp, Sdisp, 10, "disp (X): display value without name tag") { Octave_object retval; @@ -1641,7 +1641,7 @@ } } -DEFUN_TEXT ("format", Fformat, Sformat, -1, 1, +DEFUN_TEXT ("format", Fformat, Sformat, 10, "format [style]\n\ \n\ set output formatting style")
--- a/src/pt-const.cc +++ b/src/pt-const.cc @@ -96,7 +96,7 @@ } void -tree_constant::operator delete (void *p, size_t size) +tree_constant::operator delete (void *p, size_t /* size */) { tree_constant *tmp = (tree_constant *) p; tmp->freeptr = tc_newlist; @@ -843,7 +843,7 @@ } void -TC_REP::operator delete (void *p, size_t size) +TC_REP::operator delete (void *p, size_t /* size */) { TC_REP *tmp = (TC_REP *) p; tmp->freeptr = tc_rep_newlist; @@ -3599,7 +3599,7 @@ } tree_constant -TC_REP::do_matrix_index (TC_REP::constant_type mci, +TC_REP::do_matrix_index (TC_REP::constant_type /* mci */, const tree_constant& j_arg) const { tree_constant retval; @@ -5658,7 +5658,7 @@ // -*- MA4 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, - TC_REP::constant_type i, + TC_REP::constant_type /* i */, const tree_constant& j_arg) { tree_constant tmp_j = j_arg.make_numeric_or_range_or_magic ();
--- a/src/pt-exp-base.cc +++ b/src/pt-exp-base.cc @@ -182,7 +182,7 @@ // Expressions. tree_constant -tree_expression::eval (int print) +tree_expression::eval (int /* print */) { panic ("invalid evaluation of generic expression"); return tree_constant (); @@ -291,7 +291,7 @@ // Less ugly than before, anyway. tree_constant -tree_matrix::eval (int print) +tree_matrix::eval (int /* print */) { tree_constant retval; @@ -647,7 +647,7 @@ // A base class for objects that can be return multiple values tree_constant -tree_multi_val_ret::eval (int print) +tree_multi_val_ret::eval (int /* print */) { panic ("invalid evaluation of generic expression"); return tree_constant (); @@ -656,13 +656,14 @@ // Used internally. tree_constant -tree_oct_obj::eval (int print) +tree_oct_obj::eval (int /* print */) { return values(0); } Octave_object -tree_oct_obj::eval (int print, int nargout, const Octave_object& args) +tree_oct_obj::eval (int /* print */, int /* nargout */, + const Octave_object& /* args */) { return values; } @@ -670,14 +671,15 @@ // A base class for objects that can be evaluated with argument lists. tree_constant -tree_fvc::assign (tree_constant& t, const Octave_object& args) +tree_fvc::assign (tree_constant& /* t */, const Octave_object& /* args */) { panic_impossible (); return tree_constant (); } tree_constant -tree_fvc::lookup_map_element (SLList<char*>& list, int insert, int silent) +tree_fvc::lookup_map_element (SLList<char*>& /* list */, + int /* insert */, int /* silent */) { static tree_constant retval; @@ -1253,8 +1255,6 @@ eval_error (); else { - int nargin = args.length (); - if (error_state) eval_error (); else @@ -1288,7 +1288,8 @@ } Octave_object -tree_index_expression::eval (int print, int nargout, const Octave_object& args) +tree_index_expression::eval (int print, int nargout, + const Octave_object& /* args */) { Octave_object retval; @@ -1300,21 +1301,19 @@ // Extract the arguments into a simple vector. Don't pass null // args. - Octave_object args = list->convert_to_const_vector (); + Octave_object tmp_args = list->convert_to_const_vector (); if (error_state) eval_error (); else { - int nargin = args.length (); - if (error_state) eval_error (); else { - if (all_args_defined (args)) + if (all_args_defined (tmp_args)) { - retval = id->eval (print, nargout, args); + retval = id->eval (print, nargout, tmp_args); if (error_state) eval_error (); @@ -1545,7 +1544,7 @@ // Unary expressions. tree_constant -tree_unary_expression::eval (int print) +tree_unary_expression::eval (int /* print */) { if (error_state) return tree_constant (); @@ -1663,7 +1662,7 @@ // Binary expressions. tree_constant -tree_binary_expression::eval (int print) +tree_binary_expression::eval (int /* print */) { if (error_state) return tree_constant (); @@ -2051,7 +2050,7 @@ Octave_object tree_multi_assignment_expression::eval (int print, int nargout, - const Octave_object& args) + const Octave_object& /* args */) { assert (etype == tree_expression::multi_assignment); @@ -2199,7 +2198,7 @@ } tree_constant -tree_colon_expression::eval (int print) +tree_colon_expression::eval (int /* print */) { tree_constant retval; @@ -2313,37 +2312,29 @@ tree_builtin::tree_builtin (const char *nm) { - nargin_max = -1; - nargout_max = -1; is_mapper = 0; fcn = 0; if (nm) my_name = strsave (nm); } -tree_builtin::tree_builtin (int i_max, int o_max, Mapper_fcn& m_fcn, - const char *nm) +tree_builtin::tree_builtin (Mapper_fcn& m_fcn, const char *nm) { - nargin_max = i_max; - nargout_max = o_max; mapper_fcn = m_fcn; is_mapper = 1; fcn = 0; my_name = nm ? strsave (nm) : 0; } -tree_builtin::tree_builtin (int i_max, int o_max, Octave_builtin_fcn g_fcn, - const char *nm) +tree_builtin::tree_builtin (Octave_builtin_fcn g_fcn, const char *nm) { - nargin_max = i_max; - nargout_max = o_max; is_mapper = 0; fcn = g_fcn; my_name = nm ? strsave (nm) : 0; } tree_constant -tree_builtin::eval (int print) +tree_builtin::eval (int /* print */) { tree_constant retval; @@ -2377,7 +2368,8 @@ } static tree_constant -apply_mapper_fcn (const tree_constant& arg, Mapper_fcn& m_fcn, int print) +apply_mapper_fcn (const tree_constant& arg, Mapper_fcn& m_fcn, + int /* print */) { tree_constant retval; @@ -2457,7 +2449,7 @@ } Octave_object -tree_builtin::eval (int print, int nargout, const Octave_object& args) +tree_builtin::eval (int /* print */, int nargout, const Octave_object& args) { Octave_object retval; @@ -2477,9 +2469,12 @@ } else if (is_mapper) { - if (nargin > nargin_max) - ::error ("%s: too many arguments", my_name); - else if (nargin > 0 && args(0).is_defined ()) +// XXX FIXME XXX -- should we just assume nargin_max == 1? +// +// if (nargin > nargin_max) +// ::error ("%s: too many arguments", my_name); +// else + if (nargin > 0 && args(0).is_defined ()) { tree_constant tmp = apply_mapper_fcn (args(0), mapper_fcn, 0); retval(0) = tmp; @@ -2498,17 +2493,6 @@ return retval; } -int -tree_builtin::max_expected_args (void) -{ - int ea = nargin_max; - if (nargin_max < 0) - ea = INT_MAX; - else - ea = nargin_max; - return ea; -} - // User defined functions. void @@ -2707,7 +2691,7 @@ } Octave_object -tree_function::eval (int print, int nargout, const Octave_object& args) +tree_function::eval (int /* print */, int nargout, const Octave_object& args) { Octave_object retval; @@ -2825,20 +2809,6 @@ return retval; } -int -tree_function::max_expected_args (void) -{ - if (param_list) - { - if (param_list->takes_varargs ()) - return -1; - else - return param_list->length (); - } - else - return 1; -} - void tree_function::traceback_error (void) { @@ -2918,7 +2888,7 @@ print_code_new_line (os); } -DEFUN ("va_arg", Fva_arg, Sva_arg, 0, 1, +DEFUN ("va_arg", Fva_arg, Sva_arg, 10, "va_arg (): return next argument in a function that takes a\n\ variable number of parameters") { @@ -2947,7 +2917,7 @@ return retval; } -DEFUN ("va_start", Fva_start, Sva_start, 0, 0, +DEFUN ("va_start", Fva_start, Sva_start, 10, "va_start (): reset the pointer to the list of optional arguments\n\ to the beginning") { @@ -2976,7 +2946,7 @@ return retval; } -DEFUN ("vr_val", Fvr_val, Svr_val, 1, 0, +DEFUN ("vr_val", Fvr_val, Svr_val, 10, "vr_val (X): append X to the list of optional return values for a function that allows a variable number of return values") {
--- a/src/pt-exp-base.h +++ b/src/pt-exp-base.h @@ -263,9 +263,6 @@ virtual tree_constant lookup_map_element (SLList<char*>& list, int insert = 0, int silent = 0); - virtual int max_expected_args (void) - { panic_impossible (); return 0; } - virtual char *fcn_file_name (void) { return 0; } @@ -810,11 +807,9 @@ public: tree_builtin (const char *nm = 0); - tree_builtin (int i_max, int o_max, Mapper_fcn& m_fcn, - const char *nm = 0); + tree_builtin (Mapper_fcn& m_fcn, const char *nm = 0); - tree_builtin (int i_max, int o_max, Octave_builtin_fcn f, - const char *nm = 0); + tree_builtin (Octave_builtin_fcn f, const char *nm = 0); ~tree_builtin (void) { } // XXX ?? XXX @@ -830,16 +825,12 @@ char *name (void) const { return my_name; } - int max_expected_args (void); - void print_code (ostream& os) { os << my_name << " can't be printed because it is a builtin function\n"; } private: - int nargin_max; - int nargout_max; int is_mapper; Mapper_fcn mapper_fcn; Octave_builtin_fcn fcn; @@ -931,8 +922,6 @@ Octave_object eval (int print, int nargout, const Octave_object& args); - int max_expected_args (void); - void traceback_error (void); void print_code (ostream& os);
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -1109,7 +1109,7 @@ } } -DEFUN ("clearplot", Fclearplot, Sclearplot, 0, 0, +DEFUN ("clearplot", Fclearplot, Sclearplot, 00, "clearplot (): clear the plot window") { Octave_object retval; @@ -1135,7 +1135,7 @@ DEFALIAS (clg, clearplot); -DEFUN ("closeplot", Fcloseplot, Scloseplot, 0, 0, +DEFUN ("closeplot", Fcloseplot, Scloseplot, 00, "closeplot (): close the stream to plotter") { Octave_object retval; @@ -1143,7 +1143,7 @@ return retval; } -DEFUN_TEXT ("hold", Fhold, Shold, 1, 0, +DEFUN_TEXT ("hold", Fhold, Shold, 10, "hold [on|off]\n\ \n\ determine whether the plot window is cleared before the next line is\n\ @@ -1178,7 +1178,7 @@ return retval; } -DEFUN ("ishold", Fishold, Sishold, 0, 1, +DEFUN ("ishold", Fishold, Sishold, 00, "ishold\n\ \n\ Return 1 if hold is on, otherwise return 0.") @@ -1186,7 +1186,7 @@ return (double) (! clear_before_plotting); } -DEFUN ("purge_tmp_files", Fpurge_tmp_files, Spurge_tmp_files, 0, 0, +DEFUN ("purge_tmp_files", Fpurge_tmp_files, Spurge_tmp_files, 00, "delete temporary data files used for plotting") { Octave_object retval; @@ -1194,7 +1194,7 @@ return retval; } -DEFUN_TEXT ("set", Fset, Sset, -1, 0, +DEFUN_TEXT ("set", Fset, Sset, 10, "set [options]\n\ \n\ set plotting options") @@ -1237,7 +1237,7 @@ return retval; } -DEFUN_TEXT ("show", Fshow, Sshow, -1, 0, +DEFUN_TEXT ("show", Fshow, Sshow, 10, "show [options]\n\ \n\ show plotting options")
--- a/src/qpsol.cc +++ b/src/qpsol.cc @@ -52,12 +52,12 @@ #endif #if defined (QPSOL_MISSING) -DEFUN_DLD_BUILTIN ("qpsol", Fqpsol, Sqpsol, 9, 3, +DEFUN_DLD_BUILTIN ("qpsol", Fqpsol, Sqpsol, 11, "This function requires QPSOL, which is not freely\n\ redistributable. For more information, read the file\n\ libcruft/qpsol/README.MISSING in the source distribution.") #else -DEFUN_DLD_BUILTIN ("qpsol", Fqpsol, Sqpsol, 9, 3, +DEFUN_DLD_BUILTIN ("qpsol", Fqpsol, Sqpsol, 11, "[X, OBJ, INFO, LAMBDA] = qpsol (X, H, C [, LB, UB] [, LB, A, UB])\n\ \n\ Groups of arguments surrounded in `[]' are optional, but\n\ @@ -385,12 +385,12 @@ #endif #if defined (QPSOL_MISSING) -DEFUN_DLD_BUILTIN ("qpsol_options", Fqpsol_options, Sqpsol_options, -1, 1, +DEFUN_DLD_BUILTIN ("qpsol_options", Fqpsol_options, Sqpsol_options, 10, "This function requires QPSOL, which is not freely\n\ redistributable. For more information, read the file\n\ libcruft/qpsol/README.MISSING in the source distribution.") #else -DEFUN_DLD_BUILTIN ("qpsol_options", Fqpsol_options, Sqpsol_options, -1, 1, +DEFUN_DLD_BUILTIN ("qpsol_options", Fqpsol_options, Sqpsol_options, 10, "qpsol_options (KEYWORD, VALUE)\n \n\ Set or show options for qpsol. Keywords may be abbreviated\n\
--- a/src/qr.cc +++ b/src/qr.cc @@ -37,7 +37,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("qr", Fqr, Sqr, 2, 2, +DEFUN_DLD_BUILTIN ("qr", Fqr, Sqr, 11, "[Q, R] = qr (X): form Q unitary and R upper triangular such\n\ that Q * R = X\n\ \n\
--- a/src/quad.cc +++ b/src/quad.cc @@ -83,7 +83,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("quad", Fquad, Squad, 5, 3, +DEFUN_DLD_BUILTIN ("quad", Fquad, Squad, 11, "[V, IER, NFUN] = quad (F, A, B [, TOL] [, SING])\n\ \n\ Where the first argument is the name of the function to call to\n\ @@ -115,7 +115,7 @@ } quad_fcn = is_valid_function (args(0), "quad", 1); - if (! quad_fcn || takes_correct_nargs (quad_fcn, 1, "quad", 1) != 1) + if (! quad_fcn) return retval; double a = args(1).double_value (); @@ -353,7 +353,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("quad_options", Fquad_options, Squad_options, -1, 1, +DEFUN_DLD_BUILTIN ("quad_options", Fquad_options, Squad_options, 10, "quad_options (KEYWORD, VALUE)\n\ \n\ Set or show options for quad. Keywords may be abbreviated\n\
--- a/src/qzval.cc +++ b/src/qzval.cc @@ -56,7 +56,7 @@ const long&, double*); } -DEFUN_DLD_BUILTIN ("qzval", Fqzval, Sqzval, 3, 1, +DEFUN_DLD_BUILTIN ("qzval", Fqzval, Sqzval, 11, "X = qzval (A, B)\n\ \n\ compute generalized eigenvalues of the matrix pencil (A - lambda B).\n\
--- a/src/rand.cc +++ b/src/rand.cc @@ -104,7 +104,7 @@ } } -DEFUN_DLD_BUILTIN ("rand", Frand, Srand, 2, 1, +DEFUN_DLD_BUILTIN ("rand", Frand, Srand, 11, "rand -- generate a random value\n\ \n\ rand (N) -- generate N x N matrix\n\
--- a/src/resource.cc +++ b/src/resource.cc @@ -100,7 +100,7 @@ return m; } -DEFUN ("getrusage", Fgetrusage, Sgetrusage, 0, 0, +DEFUN ("getrusage", Fgetrusage, Sgetrusage, 00, "getrusage ()\n\ \n\ Return system resource statistics.")
--- a/src/schur.cc +++ b/src/schur.cc @@ -36,7 +36,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("schur", Fschur, Sschur, 3, 2, +DEFUN_DLD_BUILTIN ("schur", Fschur, Sschur, 11, "[U, S] = schur (A) or S = schur (A)\n\ \n\ or, for ordered Schur:\n\
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -146,7 +146,7 @@ #if defined (__alpha__) static RETSIGTYPE -sigfpe_handler (int sig) +sigfpe_handler (int /* sig */) { // Can this ever cause trouble on systems that don't forget signal // handlers when they are invoked? @@ -175,7 +175,7 @@ // signal interface if it is available. static RETSIGTYPE -sigint_handler (int sig) +sigint_handler (int /* sig */) { // Can this ever cause trouble on systems that don't forget signal // handlers when they are invoked? @@ -196,7 +196,7 @@ } static RETSIGTYPE -sigpipe_handler (int sig) +sigpipe_handler (int /* sig */) { // Can this ever cause trouble on systems that don't forget signal // handlers when they are invoked?
--- a/src/sort.cc +++ b/src/sort.cc @@ -281,7 +281,7 @@ return retval; } -DEFUN_DLD_BUILTIN ("sort", Fsort, Ssort, 2, 2, +DEFUN_DLD_BUILTIN ("sort", Fsort, Ssort, 11, "[S, I] = sort (X)\n\ \n\ sort the columns of X, optionally return sort index")
--- a/src/strfns.cc +++ b/src/strfns.cc @@ -37,7 +37,7 @@ #include "tree-const.h" #include "utils.h" -DEFUN ("isstr", Fisstr, Sisstr, 1, 1, +DEFUN ("isstr", Fisstr, Sisstr, 10, "isstr (X): return 1 if X is a string, 0 otherwise") { Octave_object retval; @@ -52,7 +52,7 @@ return retval; } -DEFUN ("setstr", Fsetstr, Ssetstr, 1, 1, +DEFUN ("setstr", Fsetstr, Ssetstr, 10, "setstr (V): convert a vector to a string") { Octave_object retval; @@ -67,7 +67,7 @@ return retval; } -DEFUN ("toascii", Ftoascii, Stoascii, 1, 1, +DEFUN ("toascii", Ftoascii, Stoascii, 10, "toascii (STRING): return ASCII representation of STRING in a matrix") { Octave_object retval;
--- a/src/svd.cc +++ b/src/svd.cc @@ -38,7 +38,7 @@ #include "user-prefs.h" #include "utils.h" -DEFUN_DLD_BUILTIN ("svd", Fsvd, Ssvd, 2, 3, +DEFUN_DLD_BUILTIN ("svd", Fsvd, Ssvd, 11, "S = svd (X) or [U, S, V] = svd (X [, 0])\n\ \n\ Compute the singular value decomposition of X. Given a second input\n\
--- a/src/syl.cc +++ b/src/syl.cc @@ -57,7 +57,7 @@ int&, long, long); } -DEFUN_DLD_BUILTIN ("syl", Fsyl, Ssyl, 4, 1, +DEFUN_DLD_BUILTIN ("syl", Fsyl, Ssyl, 11, "X = syl (A, B, C): solve the Sylvester equation A X + X B + C = 0") { Octave_object retval;
--- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -508,7 +508,7 @@ #endif } -DEFUN ("clc", Fclc, Sclc, 0, 0, +DEFUN ("clc", Fclc, Sclc, 00, "clc (): clear screen") { Octave_object retval; @@ -532,7 +532,7 @@ DEFALIAS (home, clc); -DEFUN ("getenv", Fgetenv, Sgetenv, 1, 1, +DEFUN ("getenv", Fgetenv, Sgetenv, 10, "getenv (STRING): get environment variable values") { Octave_object retval; @@ -558,7 +558,7 @@ return retval; } -DEFUN ("kbhit", Fkbhit, Skbhit, 0, 1, +DEFUN ("kbhit", Fkbhit, Skbhit, 00, "kbhit: get a single character from the terminal") { Octave_object retval; @@ -577,7 +577,7 @@ return retval; } -DEFUN ("pause", Fpause, Spause, 1, 1, +DEFUN ("pause", Fpause, Spause, 10, "pause (seconds): suspend program execution") { Octave_object retval; @@ -625,7 +625,7 @@ // XXX FIXME XXX -- maybe this should only return 1 if IEEE floating // point functions really work. -DEFUN ("isieee", Fisieee, Sisieee, 1, 1, +DEFUN ("isieee", Fisieee, Sisieee, 00, "isieee (): return 1 if host uses IEEE floating point") { return (double) (native_float_format == OCTAVE_IEEE_LITTLE
--- a/src/timefns.cc +++ b/src/timefns.cc @@ -86,7 +86,7 @@ return &tm; } -DEFUN ("time", Ftime, Stime, 1, 0, +DEFUN ("time", Ftime, Stime, 00, "time ()\n\ \n\ Return current time. On Unix systems, this is the number of\n\ @@ -118,7 +118,7 @@ return (double) now + fraction; } -DEFUN ("gmtime", Fgmtime, Sgmtime, 1, 1, +DEFUN ("gmtime", Fgmtime, Sgmtime, 10, "gmtime (TIME)\n\ \n\ Given a value returned from time(), return a structure like that\n\ @@ -146,7 +146,7 @@ return retval; } -DEFUN ("localtime", Flocaltime, Slocaltime, 1, 1, +DEFUN ("localtime", Flocaltime, Slocaltime, 10, "localtime (TIME)\n\ \n\ Given a value returned from time(), return a structure with\n\ @@ -185,7 +185,7 @@ return retval; } -DEFUN ("mktime", Fmktime, Smktime, 1, 2, +DEFUN ("mktime", Fmktime, Smktime, 10, "mktime (TMSTRUCT)") { Octave_object retval; @@ -207,7 +207,7 @@ return retval; } -DEFUN ("strftime", Fstrftime, Sstrftime, 1, 2, +DEFUN ("strftime", Fstrftime, Sstrftime, 10, "strftime (FMT, TMSTRUCT)\n\ \n\ Performs `%' substitutions similar to those in printf. Except where\n\
--- a/src/token.cc +++ b/src/token.cc @@ -53,7 +53,7 @@ orig_text = 0; } -token::token (double d, char *s, int l, int c) +token::token (double d, char * /* s */, int l, int c) { line_num = l; column_num = c; @@ -149,13 +149,13 @@ return orig_text; } -token::token (const token& tok) +token::token (const token& /* tok */) { panic_impossible (); } token& -token::operator = (const token& tok) +token::operator = (const token& /* tok */) { panic_impossible (); }
--- a/src/toplev.h +++ b/src/toplev.h @@ -26,8 +26,9 @@ #include <cstdio> +class tree_constant; +class tree_function; class tree_statement_list; -class tree_function; class Octave_str_obj; extern void clean_up_and_exit (int) NORETURN; @@ -35,6 +36,9 @@ extern void parse_and_execute (FILE *f, int print = 0); extern void parse_and_execute (char *s, int print = 0, int verbose = 0); +extern tree_constant eval_string (const char *string, int print, + int& parse_status); + // argv[0] for this program. extern char *raw_prog_name;
--- a/src/unwind-prot.cc +++ b/src/unwind-prot.cc @@ -200,7 +200,6 @@ saved_variable (void); saved_variable (int *p, int v); saved_variable (void **p, void *v); - saved_variable (void *p, void *v, size_t sz); ~saved_variable (void); void restore_value (void); @@ -247,14 +246,6 @@ size = sizeof (void *); } -saved_variable::saved_variable (void *p, void *v, size_t sz) -{ - gen_ptr = v; - gen_ptr_value = new char [sz]; - memcpy (gen_ptr_value, v, sz); - size = sz; -} - saved_variable::~saved_variable (void) { if (type_tag == generic) @@ -306,13 +297,6 @@ add_unwind_protect (restore_saved_variable, (void *) s); } -void -unwind_protect_var_internal (void *ptr, void *value, size_t size) -{ - saved_variable *s = new saved_variable (ptr, value, size); - add_unwind_protect (restore_saved_variable, (void *) s); -} - /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/unwind-prot.h +++ b/src/unwind-prot.h @@ -54,9 +54,6 @@ #define unwind_protect_ptr(p) \ unwind_protect_ptr_internal ((void **) &(p), (void *) (p)) -#define unwind_protect_var(i) \ - unwind_protect_var_internal ((void *) &(i), (void *) &(i), sizeof (int)) - class unwind_elem {
--- a/src/utils.cc +++ b/src/utils.cc @@ -181,7 +181,7 @@ } DEFUN ("octave_tmp_file_name", Foctave_tmp_file_name, - Soctave_tmp_file_name, 0, 1, + Soctave_tmp_file_name, 10, "octave_tmp_file_name ()") { tree_constant retval; @@ -646,7 +646,7 @@ return retval; } -DEFUN ("file_in_path", Ffile_in_path, Sfile_in_path, 3, 1, +DEFUN ("file_in_path", Ffile_in_path, Sfile_in_path, 10, "file_in_path (PATH, NAME)") { Octave_object retval; @@ -790,7 +790,7 @@ } DEFUN ("undo_string_escapes", Fundo_string_escapes, - Sundo_string_escapes, 1, 1, + Sundo_string_escapes, 10, "undo_string_escapes (STRING)") { tree_constant retval;
--- a/src/variables.cc +++ b/src/variables.cc @@ -154,25 +154,7 @@ return ans; } -// Does this function take the right number of arguments? - -int -takes_correct_nargs (tree_fvc *fcn, int expected_nargin, char *warn_for, - int warn) -{ - int nargin = fcn->max_expected_args (); - int e_nargin = expected_nargin; - if (nargin != e_nargin) - { - if (warn) - error ("%s: expecting function to take %d argument%s", - warn_for, e_nargin, (e_nargin == 1 ? "" : "s")); - return 0; - } - return 1; -} - -DEFUN ("is_global", Fis_global, Sis_global, 1, 1, +DEFUN ("is_global", Fis_global, Sis_global, 10, "is_global (X): return 1 if the string X names a global variable\n\ otherwise, return 0.") { @@ -201,7 +183,7 @@ return retval; } -DEFUN ("exist", Fexist, Sexist, 1, 1, +DEFUN ("exist", Fexist, Sexist, 10, "exist (NAME): check if variable or file exists\n\ \n\ return 0 if NAME is undefined, 1 if it is a variable, or 2 if it is\n\ @@ -1188,7 +1170,7 @@ return status; } -DEFUN_TEXT ("document", Fdocument, Sdocument, -1, 1, +DEFUN_TEXT ("document", Fdocument, Sdocument, 10, "document symbol string ...\n\ \n\ Associate a cryptic message with a variable name.") @@ -1226,7 +1208,7 @@ // naming the variables to look for. static Octave_object -do_who (int argc, char **argv, int nargout) +do_who (int argc, char **argv) { Octave_object retval; @@ -1322,7 +1304,7 @@ return retval; } -DEFUN_TEXT ("who", Fwho, Swho, -1, 1, +DEFUN_TEXT ("who", Fwho, Swho, 10, "who [-all] [-builtins] [-functions] [-long] [-variables]\n\ \n\ List currently defined symbol(s). Options may be shortened to one\n\ @@ -1332,14 +1314,14 @@ DEFINE_ARGV("who"); - retval = do_who (argc, argv, nargout); + retval = do_who (argc, argv); DELETE_ARGV; return retval; } -DEFUN_TEXT ("whos", Fwhos, Swhos, -1, 1, +DEFUN_TEXT ("whos", Fwhos, Swhos, 10, "whos [-all] [-builtins] [-functions] [-long] [-variables]\n\ \n\ List currently defined symbol(s). Options may be shortened to one\n\ @@ -1360,7 +1342,7 @@ if (error_state) return retval; - retval = do_who (argc, argv, nargout); + retval = do_who (argc, argv); while (--argc >= 0) delete [] argv[argc]; @@ -1386,7 +1368,7 @@ mfcn.d_c_mapper = mf->d_c_mapper; mfcn.c_c_mapper = mf->c_c_mapper; - tree_builtin *def = new tree_builtin (1, 1, mfcn, mf->name); + tree_builtin *def = new tree_builtin (mfcn, mf->name); sym_rec->define (def); @@ -1401,8 +1383,7 @@ symbol_record *sym_rec = global_sym_tab->lookup (f->name, 1); sym_rec->unprotect (); - tree_builtin *def = new tree_builtin (f->nargin_max, f->nargout_max, - f->fcn, f->name); + tree_builtin *def = new tree_builtin (f->fcn, f->name); sym_rec->define (def, f->is_text_fcn); @@ -1812,7 +1793,7 @@ // Deleting names from the symbol tables. -DEFUN_TEXT ("clear", Fclear, Sclear, -1, 1, +DEFUN_TEXT ("clear", Fclear, Sclear, 10, "clear [-x] [name ...]\n\ \n\ Clear symbol(s) matching a list of globbing patterns.\n\
--- a/src/variables.h +++ b/src/variables.h @@ -55,8 +55,6 @@ struct builtin_function { char *name; - int nargin_max; - int nargout_max; int is_text_fcn; Octave_builtin_fcn fcn; char *help_string; @@ -86,7 +84,6 @@ extern tree_fvc *is_valid_function (const tree_constant&, char *, int warn = 0); -extern int takes_correct_nargs (tree_fvc *, int, char *, int warn = 0); extern char **make_name_list (void);
--- a/src/xdiv.cc +++ b/src/xdiv.cc @@ -55,7 +55,7 @@ } static inline int -mx_leftdiv_conform (int a_nr, int a_nc, int b_nr, int warn = 1) +mx_leftdiv_conform (int a_nr, int b_nr) { if (a_nr != b_nr) { @@ -67,7 +67,7 @@ } static inline int -mx_div_conform (int b_nr, int b_nc, int a_nc, int warn = 1) +mx_div_conform (int b_nc, int a_nc) { if (a_nc != b_nc) { @@ -91,7 +91,7 @@ tree_constant xdiv (const Matrix& a, const Matrix& b) { - if (! mx_div_conform (b.rows (), b.columns (), a.columns ())) + if (! mx_div_conform (b.columns (), a.columns ())) return tree_constant (); Matrix atmp = a.transpose (); @@ -116,7 +116,7 @@ tree_constant xdiv (const Matrix& a, const ComplexMatrix& b) { - if (! mx_div_conform (b.rows (), b.columns (), a.columns ())) + if (! mx_div_conform (b.columns (), a.columns ())) return tree_constant (); Matrix atmp = a.transpose (); @@ -141,7 +141,7 @@ tree_constant xdiv (const ComplexMatrix& a, const Matrix& b) { - if (! mx_div_conform (b.rows (), b.columns (), a.columns ())) + if (! mx_div_conform (b.columns (), a.columns ())) return tree_constant (); ComplexMatrix atmp = a.hermitian (); @@ -166,7 +166,7 @@ tree_constant xdiv (const ComplexMatrix& a, const ComplexMatrix& b) { - if (! mx_div_conform (b.rows (), b.columns (), a.columns ())) + if (! mx_div_conform (b.columns (), a.columns ())) return tree_constant (); ComplexMatrix atmp = a.hermitian (); @@ -269,7 +269,7 @@ tree_constant xleftdiv (const Matrix& a, const Matrix& b) { - if (! mx_leftdiv_conform (a.rows (), a.columns (), b.rows ())) + if (! mx_leftdiv_conform (a.rows (), b.rows ())) return tree_constant (); int info; @@ -291,7 +291,7 @@ tree_constant xleftdiv (const Matrix& a, const ComplexMatrix& b) { - if (! mx_leftdiv_conform (a.rows (), a.columns (), b.rows ())) + if (! mx_leftdiv_conform (a.rows (), b.rows ())) return tree_constant (); int info; @@ -313,7 +313,7 @@ tree_constant xleftdiv (const ComplexMatrix& a, const Matrix& b) { - if (! mx_leftdiv_conform (a.rows (), a.columns (), b.rows ())) + if (! mx_leftdiv_conform (a.rows (), b.rows ())) return tree_constant (); int info; @@ -335,7 +335,7 @@ tree_constant xleftdiv (const ComplexMatrix& a, const ComplexMatrix& b) { - if (! mx_leftdiv_conform (a.rows (), a.columns (), b.rows ())) + if (! mx_leftdiv_conform (a.rows (), b.rows ())) return tree_constant (); int info;