Mercurial > hg > octave-nkf
diff src/ops.h @ 7997:2b8952e133c9
implement checked conversions between integers
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 30 Jul 2008 15:20:13 +0200 |
parents | 935be827eaf8 |
children | 283989f2da9b |
line wrap: on
line diff
--- a/src/ops.h +++ b/src/ops.h @@ -207,6 +207,14 @@ return new octave_ ## ovtto (tto ## NDArray (v.e ## array_value ())); \ } +#define DEFCONVFNX2(name, tfrom, ovtto, e) \ + CONVDECL (name) \ + { \ + CAST_CONV_ARG (const octave_ ## tfrom&); \ + \ + return new octave_ ## ovtto (v.e ## array_value ()); \ + } + #define DEFDBLCONVFN(name, ovtfrom, e) \ CONVDECL (name) \ { \ @@ -222,10 +230,10 @@ DEFCONVFNX(name, tfrom, matrix, , char_) #define DEFCONVFN(name, tfrom, tto) \ - DEFCONVFNX (name, tfrom, tto ## _matrix, tto, ) + DEFCONVFNX2 (name, tfrom, tto ## _matrix, tto ## _) #define DEFCONVFN2(name, tfrom, sm, tto) \ - DEFCONVFNX (name, tfrom ## _ ## sm, tto ## _matrix, tto, tfrom ## _) + DEFCONVFNX2 (name, tfrom ## _ ## sm, tto ## _matrix, tto ## _) #define UNOPDECL(name, a) \ static octave_value \