Mercurial > hg > octave-lojdl
changeset 3564:403039c85792
[project @ 2000-02-03 06:23:11 by jwe]
author | jwe |
---|---|
date | Thu, 03 Feb 2000 06:28:19 +0000 |
parents | 7031786b3f27 |
children | 4290f11c8d3b |
files | src/ChangeLog src/defun-int.h src/mappers.cc |
diffstat | 3 files changed, 50 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,17 @@ +2000-02-03 John W. Eaton <jwe@bevo.che.wisc.edu> + + * mappers.cc (xconj, ximag, xreal): New functions. Use them in + DEFUN_MAPPER calls. + + * defun-int.h (DEFUN_MAPPER_INTERNAL): Cast function pointer args + to octave_mapper constructor. + 2000-02-02 John W. Eaton <jwe@bevo.che.wisc.edu> + * procstream.cc (procstreambase::procstreambase, + procstreambase::open, procstreambase::close): + Call std::ios::setstate, not set. + * lex.l (plot_axes_token): Declare plot_axes as const char *. Declare tmp const char **.
--- a/src/defun-int.h +++ b/src/defun-int.h @@ -172,13 +172,21 @@ // How mapper functions are actually installed. +// XXX FIXME XXX -- Really want to avoid the following casts, since +// (as always with casts) it may mask some real errors... + #define DEFUN_MAPPER_INTERNAL(name, ch_map, d_b_map, c_b_map, d_d_map, \ d_c_map, c_c_map, lo, hi, \ can_ret_cmplx_for_real, doc) \ install_builtin_mapper \ - (new octave_mapper (ch_map, d_b_map, c_b_map, d_d_map, d_c_map, \ - c_c_map, lo, hi, \ - can_ret_cmplx_for_real, #name)) + (new octave_mapper \ + (X_CAST (octave_mapper::ch_mapper, ch_map), \ + X_CAST (octave_mapper::d_b_mapper, d_b_map), \ + X_CAST (octave_mapper::c_b_mapper, c_b_map), \ + X_CAST (octave_mapper::d_d_mapper, d_d_map), \ + X_CAST (octave_mapper::d_c_mapper, d_c_map), \ + X_CAST (octave_mapper::c_c_mapper, c_c_map), \ + lo, hi, can_ret_cmplx_for_real, #name)) #endif /* ! MAKE_BUILTINS */
--- a/src/mappers.cc +++ b/src/mappers.cc @@ -128,6 +128,30 @@ return toupper (c); } +static Complex +xconj (const Complex& x) +{ + return conj (x); +} + +static double +xconj (double x) +{ + return x; +} + +static Complex +ximag (const Complex& x) +{ + return Complex (0.0, x.imag ()); +} + +static Complex +xreal (const Complex& x) +{ + return Complex (x.real (), 0.0); +} + void install_mapper_functions (void) { @@ -230,7 +254,7 @@ complex, return @code{ceil (real (@var{x})) + ceil (imag (@var{x})) * I}.\n\ @end deftypefn"); - DEFUN_MAPPER (conj, 0, 0, 0, conj, 0, conj, 0.0, 0.0, 0, + DEFUN_MAPPER (conj, 0, 0, 0, xconj, 0, xconj, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} conj (@var{z})\n\ Return the complex conjugate of @var{z}, defined as\n\ @@ -357,7 +381,7 @@ \n\ @seealso{gammai and lgamma}"); - DEFUN_MAPPER (imag, 0, 0, 0, imag, imag, 0, 0.0, 0.0, 0, + DEFUN_MAPPER (imag, 0, 0, 0, imag, ximag, 0, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} imag (@var{z})\n\ Return the imaginary part of @var{z} as a real number.\n\ @@ -491,7 +515,7 @@ @end deftypefn\n\ @seealso{log, log2, logspace, and exp}"); - DEFUN_MAPPER (real, 0, 0, 0, real, real, 0, 0.0, 0.0, 0, + DEFUN_MAPPER (real, 0, 0, 0, real, xreal, 0, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} real (@var{z})\n\ Return the real part of @var{z}.\n\