Mercurial > hg > octave-nkf
diff src/mappers.cc @ 7503:8c32f95c2639
convert mapper functions to new format
author | David Bateman <dbateman@free.fr> |
---|---|
date | Wed, 20 Feb 2008 04:22:50 -0500 |
parents | 8b7b4f58199f |
children | 26d8a92644de |
line wrap: on
line diff
--- a/src/mappers.cc +++ b/src/mappers.cc @@ -34,148 +34,9 @@ #include "defun.h" #include "error.h" -#include "ov-mapper.h" #include "variables.h" -// FIXME -- perhaps this could be avoided by determining -// whether the is* functions are actually functions or just macros. - -static int -xabs (int c) -{ - return static_cast<unsigned char> (c); -} - -static int -xisalnum (int c) -{ - return isalnum (c); -} - -static int -xisalpha (int c) -{ - return isalpha (c); -} - -static int -xisascii (int c) -{ - return isascii (c); -} - -static int -xiscntrl (int c) -{ - return iscntrl (c); -} - -static int -xisdigit (int c) -{ - return isdigit (c); -} - -static int -xisgraph (int c) -{ - return isgraph (c); -} - -static int -xislower (int c) -{ - return islower (c); -} - -static int -xisprint (int c) -{ - return isprint (c); -} - -static int -xispunct (int c) -{ - return ispunct (c); -} - -static int -xisspace (int c) -{ - return isspace (c); -} - -static int -xisupper (int c) -{ - return isupper (c); -} - -static int -xisxdigit (int c) -{ - return isxdigit (c); -} - -static int -xtoascii (int c) -{ - return toascii (c); -} - -static int -xtolower (int c) -{ - return tolower (c); -} - -static int -xtoupper (int c) -{ - return toupper (c); -} - -static double -xabs (const Complex& x) -{ - return (xisinf (x.real ()) || xisinf (x.imag ())) ? octave_Inf : abs (x); -} - -static Complex -xconj (const Complex& x) -{ - return conj (x); -} - -static double -xconj (double x) -{ - return x; -} - -static double -ximag (const Complex& x) -{ - return x.imag (); -} - -static double -xreal (const Complex& x) -{ - return x.real (); -} - -static int -dummyp (int) -{ - return 0; -} - -void -install_mapper_functions (void) -{ - DEFUN_MAPPER (abs, xabs, 0, 0, fabs, xabs, 0, 0.0, 0.0, 1, 0, +DEFUN (abs, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} abs (@var{z})\n\ Compute the magnitude of @var{z}, defined as\n\ @@ -196,27 +57,64 @@ @result{} 5\n\ @end group\n\ @end example\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).abs (); + else + print_usage (); - DEFUN_MAPPER (acos, 0, 0, 0, acos, 0, acos, -1.0, 1.0, 0, 1, + return retval; +} + +DEFUN (acos, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} acos (@var{x})\n\ Compute the inverse cosine of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).acos (); + else + print_usage (); - DEFUN_MAPPER (acosh, 0, 0, 0, acosh, 0, acosh, 1.0, octave_Inf, 0, 1, + return retval; +} + + +DEFUN (acosh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} acosh (@var{x})\n\ Compute the inverse hyperbolic cosine of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).acosh (); + else + print_usage (); - DEFUN_MAPPER (angle, 0, 0, 0, arg, std::arg, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (angle, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} angle (@var{z})\n\ See arg.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).arg (); + else + print_usage (); - DEFUN_MAPPER (arg, 0, 0, 0, arg, std::arg, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (arg, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} arg (@var{z})\n\ @deftypefnx {Mapping Function} {} angle (@var{z})\n\ @@ -240,13 +138,31 @@ @result{} 0.92730\n\ @end group\n\ @end example\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).arg (); + else + print_usage (); - DEFUN_MAPPER (asin, 0, 0, 0, asin, 0, asin, -1.0, 1.0, 0, 1, + return retval; +} + +DEFUN (asin, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} asin (@var{x})\n\ Compute the inverse sine of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).asin (); + else + print_usage (); + + return retval; +} /* %!test @@ -259,32 +175,68 @@ %!error asin (1, 2); */ - DEFUN_MAPPER (asinh, 0, 0, 0, asinh, 0, asinh, 0.0, 0.0, 0, 0, +DEFUN (asinh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} asinh (@var{x})\n\ Compute the inverse hyperbolic sine of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).asinh (); + else + print_usage (); - DEFUN_MAPPER (atan, 0, 0, 0, atan, 0, atan, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (atan, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} atan (@var{x})\n\ Compute the inverse tangent of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).atan (); + else + print_usage (); - DEFUN_MAPPER (atanh, 0, 0, 0, atanh, 0, atanh, -1.0, 1.0, 0, 1, + return retval; +} + +DEFUN (atanh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} atanh (@var{x})\n\ Compute the inverse hyperbolic tangent of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).atanh (); + else + print_usage (); - DEFUN_MAPPER (ceil, 0, 0, 0, ceil, 0, ceil, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (ceil, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} ceil (@var{x})\n\ Return the smallest integer not less than @var{x}. If @var{x} is\n\ complex, return @code{ceil (real (@var{x})) + ceil (imag (@var{x})) * I}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).ceil (); + else + print_usage (); - DEFUN_MAPPER (conj, 0, 0, 0, xconj, 0, xconj, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (conj, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} conj (@var{z})\n\ Return the complex conjugate of @var{z}, defined as\n\ @@ -297,21 +249,48 @@ @code{conj (@var{z})} = @var{x} - @var{i}@var{y}.\n\ @end ifinfo\n\ @seealso{real, imag}\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).conj (); + else + print_usage (); - DEFUN_MAPPER (cos, 0, 0, 0, cos, 0, std::cos, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (cos, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} cos (@var{x})\n\ Compute the cosine of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).cos (); + else + print_usage (); - DEFUN_MAPPER (cosh, 0, 0, 0, cosh, 0, std::cosh, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (cosh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} cosh (@var{x})\n\ Compute the hyperbolic cosine of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).cosh (); + else + print_usage (); - DEFUN_MAPPER (erf, 0, 0, 0, erf, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (erf, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} erf (@var{z})\n\ Computes the error function,\n\ @@ -333,9 +312,18 @@ @end smallexample\n\ @end ifinfo\n\ @seealso{erfc, erfinv}\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).erf (); + else + print_usage (); - DEFUN_MAPPER (erfc, 0, 0, 0, erfc, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (erfc, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} erfc (@var{z})\n\ Computes the complementary error function,\n\ @@ -348,16 +336,34 @@ @code{1 - erf (@var{z})}.\n\ @end ifinfo\n\ @seealso{erf, erfinv}\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).erfc (); + else + print_usage (); - DEFUN_MAPPER (exp, 0, 0, 0, exp, 0, std::exp, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (exp, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} exp (@var{x})\n\ Compute the exponential of @var{x}. To compute the matrix exponential,\n\ see @ref{Linear Algebra}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).exp (); + else + print_usage (); - DEFUN_MAPPER (finite, dummyp, xfinite, xfinite, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (finite, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} finite (@var{x})\n\ Return 1 for elements of @var{x} that are finite values and zero\n\ @@ -369,23 +375,51 @@ @result{} [ 1, 0, 0, 0 ]\n\ @end group\n\ @end example\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).finite (); + else + print_usage (); - DEFUN_MAPPER (fix, 0, 0, 0, fix, 0, fix, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (fix, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} fix (@var{x})\n\ Truncate @var{x} toward zero. If @var{x} is complex, return\n\ @code{fix (real (@var{x})) + fix (imag (@var{x})) * I}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).fix (); + else + print_usage (); - DEFUN_MAPPER (floor, 0, 0, 0, floor, 0, floor, 0.0, 0.0, 0, 0, + return retval; +} + + +DEFUN (floor, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} floor (@var{x})\n\ Return the largest integer not greater than @var{x}. If @var{x} is\n\ complex, return @code{floor (real (@var{x})) + floor (imag (@var{x})) * I}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).floor (); + else + print_usage (); - DEFUN_MAPPER (gamma, 0, 0, 0, xgamma, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (gamma, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} gamma (@var{z})\n\ Computes the Gamma function,\n\ @@ -407,53 +441,116 @@ @end example\n\ @end ifinfo\n\ @seealso{gammai, lgamma}\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).gamma (); + else + print_usage (); - DEFUN_MAPPER (imag, 0, 0, 0, imag, ximag, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (imag, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} imag (@var{z})\n\ Return the imaginary part of @var{z} as a real number.\n\ @seealso{real, conj}\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).imag (); + else + print_usage (); - DEFUN_MAPPER (isalnum, xisalnum, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isalnum, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isalnum (@var{s})\n\ Return 1 for characters that are letters or digits (@code{isalpha\n\ (@var{s})} or @code{isdigit (@var{s})} is true).\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isalnum (); + else + print_usage (); - DEFUN_MAPPER (isalpha, xisalpha, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isalpha, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isalpha (@var{s})\n\ @deftypefnx {Mapping Function} {} isletter (@var{s})\n\ Return true for characters that are letters (@code{isupper (@var{s})}\n\ or @code{islower (@var{s})} is true).\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isalpha (); + else + print_usage (); + + return retval; +} #ifdef isascii #undef isascii #endif - DEFUN_MAPPER (isascii, xisascii, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, +DEFUN (isascii, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isascii (@var{s})\n\ Return 1 for characters that are ASCII (in the range 0 to 127 decimal).\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isascii (); + else + print_usage (); - DEFUN_MAPPER (iscntrl, xiscntrl, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (iscntrl, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} iscntrl (@var{s})\n\ Return 1 for control characters.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).iscntrl (); + else + print_usage (); - DEFUN_MAPPER (isdigit, xisdigit, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isdigit, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isdigit (@var{s})\n\ Return 1 for characters that are decimal digits.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isdigit (); + else + print_usage (); - DEFUN_MAPPER (isinf, dummyp, xisinf, xisinf, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isinf, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isinf (@var{x})\n\ Return 1 for elements of @var{x} that are infinite and zero\n\ @@ -465,21 +562,48 @@ @result{} [ 0, 1, 0, 0 ]\n\ @end group\n\ @end example\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isinf (); + else + print_usage (); - DEFUN_MAPPER (isgraph, xisgraph, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isgraph, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isgraph (@var{s})\n\ Return 1 for printable characters (but not the space character).\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isgraph (); + else + print_usage (); - DEFUN_MAPPER (islower, xislower, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (islower, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} islower (@var{s})\n\ Return 1 for characters that are lower case letters.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).islower (); + else + print_usage (); - DEFUN_MAPPER (isna, dummyp, octave_is_NA, octave_is_NA, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isna, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isna (@var{x})\n\ Return 1 for elements of @var{x} that are NA (missing) values and zero\n\ @@ -491,9 +615,18 @@ @result{} [ 0, 0, 1, 0 ]\n\ @end group\n\ @end example\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isna (); + else + print_usage (); - DEFUN_MAPPER (isnan, dummyp, xisnan, xisnan, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isnan, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isnan (@var{x})\n\ Return 1 for elements of @var{x} that are NaN values and zero\n\ @@ -505,79 +638,178 @@ @result{} [ 0, 0, 1, 1 ]\n\ @end group\n\ @end example\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isnan (); + else + print_usage (); - DEFUN_MAPPER (isprint, xisprint, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isprint, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isprint (@var{s})\n\ Return 1 for printable characters (including the space character).\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isprint (); + else + print_usage (); - DEFUN_MAPPER (ispunct, xispunct, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (ispunct, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} ispunct (@var{s})\n\ Return 1 for punctuation characters.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).ispunct (); + else + print_usage (); - DEFUN_MAPPER (isspace, xisspace, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isspace, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isspace (@var{s})\n\ Return 1 for whitespace characters (space, formfeed, newline,\n\ carriage return, tab, and vertical tab).\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isspace (); + else + print_usage (); - DEFUN_MAPPER (isupper, xisupper, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isupper, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isupper (@var{s})\n\ Return 1 for upper case letters.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isupper (); + else + print_usage (); - DEFUN_MAPPER (isxdigit, xisxdigit, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (isxdigit, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} isxdigit (@var{s})\n\ Return 1 for characters that are hexadecimal digits.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).isxdigit (); + else + print_usage (); - DEFUN_MAPPER (lgamma, 0, 0, 0, xlgamma, 0, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (lgamma, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} lgamma (@var{x})\n\ @deftypefnx {Mapping Function} {} gammaln (@var{x})\n\ Return the natural logarithm of the absolute value of the gamma\n\ function of @var{x}.\n\ @seealso{gamma, gammai}\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).lgamma (); + else + print_usage (); - DEFUN_MAPPER (log, 0, 0, 0, log, 0, std::log, 0.0, octave_Inf, 0, 1, + return retval; +} + +DEFUN (log, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} log (@var{x})\n\ Compute the natural logarithm for each element of @var{x}. To compute the\n\ matrix logarithm, see @ref{Linear Algebra}.\n\ @seealso{log2, log10, logspace, exp}\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).log (); + else + print_usage (); - DEFUN_MAPPER (log10, 0, 0, 0, log10, 0, std::log10, 0.0, octave_Inf, 0, 1, + return retval; +} + +DEFUN (log10, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} log10 (@var{x})\n\ Compute the base-10 logarithm for each element of @var{x}.\n\ @seealso{log, log2, logspace, exp}\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).log10 (); + else + print_usage (); - DEFUN_MAPPER (real, 0, 0, 0, real, xreal, 0, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (real, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} real (@var{z})\n\ Return the real part of @var{z}.\n\ @seealso{imag, conj}\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).real (); + else + print_usage (); - DEFUN_MAPPER (round, 0, 0, 0, xround, 0, xround, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (round, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} round (@var{x})\n\ Return the integer nearest to @var{x}. If @var{x} is complex, return\n\ @code{round (real (@var{x})) + round (imag (@var{x})) * I}.\n\ @seealso{rem}\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).round (); + else + print_usage (); - DEFUN_MAPPER (sign, 0, 0, 0, signum, 0, signum, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (sign, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} sign (@var{x})\n\ Compute the @dfn{signum} function, which is defined as\n\ @@ -598,45 +830,99 @@ @end ifinfo\n\ \n\ For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).signum (); + else + print_usage (); - DEFUN_MAPPER (sin, 0, 0, 0, sin, 0, std::sin, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (sin, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} sin (@var{x})\n\ Compute the sine of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).sin (); + else + print_usage (); - DEFUN_MAPPER (sinh, 0, 0, 0, sinh, 0, std::sinh, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (sinh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} sinh (@var{x})\n\ Compute the hyperbolic sine of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).sinh (); + else + print_usage (); - DEFUN_MAPPER (sqrt, 0, 0, 0, sqrt, 0, std::sqrt, 0.0, octave_Inf, 0, 1, + return retval; +} + +DEFUN (sqrt, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} sqrt (@var{x})\n\ Compute the square root of @var{x}. If @var{x} is negative, a complex\n\ result is returned. To compute the matrix square root, see\n\ @ref{Linear Algebra}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).sqrt (); + else + print_usage (); - DEFUN_MAPPER (tan, 0, 0, 0, tan, 0, std::tan, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (tan, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} tan (@var{z})\n\ Compute tangent of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).tan (); + else + print_usage (); - DEFUN_MAPPER (tanh, 0, 0, 0, tanh, 0, std::tanh, 0.0, 0.0, 0, 0, + return retval; +} + +DEFUN (tanh, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} tanh (@var{x})\n\ Compute hyperbolic tangent of each element of @var{x}.\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).tanh (); + else + print_usage (); + + return retval; +} #ifdef toascii #undef toascii #endif - DEFUN_MAPPER (toascii, xtoascii, 0, 0, 0, 0, 0, 0.0, 0.0, 1, 0, +DEFUN (toascii, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} toascii (@var{s})\n\ Return ASCII representation of @var{s} in a matrix. For example,\n\ @@ -648,9 +934,18 @@ @end group\n\ \n\ @end example\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).toascii (); + else + print_usage (); - DEFUN_MAPPER (tolower, xtolower, 0, 0, 0, 0, 0, 0.0, 0.0, 2, 0, + return retval; +} + +DEFUN (tolower, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} tolower (@var{s})\n\ Return a copy of the string @var{s}, with each upper-case character\n\ @@ -661,9 +956,18 @@ tolower (\"MiXeD cAsE 123\")\n\ @result{} \"mixed case 123\"\n\ @end example\n\ -@end deftypefn"); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).tolower (); + else + print_usage (); - DEFUN_MAPPER (toupper, xtoupper, 0, 0, 0, 0, 0, 0.0, 0.0, 2, 0, + return retval; +} + +DEFUN (toupper, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} toupper (@var{s})\n\ Return a copy of the string @var{s}, with each lower-case character\n\ @@ -676,14 +980,20 @@ @result{} \"MIXED CASE 123\"\n\ @end group\n\ @end example\n\ -@end deftypefn"); - - DEFALIAS (gammaln, lgamma); +@end deftypefn") +{ + octave_value retval; + if (args.length () == 1) + retval = args(0).toupper (); + else + print_usage (); - DEFALIAS (isfinite, finite); + return retval; +} - // Leave the previous new line, mkgendoc needs it! -} +DEFALIAS (gammaln, lgamma); + +DEFALIAS (isfinite, finite); /* ;;; Local Variables: ***