changeset 6223:a6cc01dd09f9

[project @ 2007-01-03 20:59:28 by jwe]
author jwe
date Wed, 03 Jan 2007 20:59:28 +0000
parents 07d967f75dba
children d86ea52f5f43
files src/ChangeLog src/data.cc src/ov-base.h src/ov-intx.h src/ov.h
diffstat 5 files changed, 36 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Jan 03 20:15:16 2007 +0000
+++ b/src/ChangeLog	Wed Jan 03 20:59:28 2007 +0000
@@ -1,3 +1,11 @@
+2007-01-03  John W. Eaton  <jwe@octave.org>
+
+	* data.cc (Fisinteger): New function.
+	* ov-intx.h (OCTAVE_VALUE_INT_MATRIX_T::is_integer_type,
+	OCTAVE_VALUE_INT_SCALAR_T::is_integer_type): New function.
+	* ov.h (octave_value::is_integer_type): New function.
+	* ov-base.h (octave_base_value::is_integer_type): New virtual function.
+
 2007-01-03  Michael Goffioul  <michael.goffioul@swing.be>
 
 	* toplev.cc (Fsystem): Handle async calls on Windows systems.
--- a/src/data.cc	Wed Jan 03 20:15:16 2007 +0000
+++ b/src/data.cc	Wed Jan 03 20:59:28 2007 +0000
@@ -1239,6 +1239,25 @@
 
 DEFALIAS (islogical, isbool);
 
+DEFUN (isinteger, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} isreal (@var{x})\n\
+Return true if @var{x} is an integer object (int8, uint8, int16, etc.).\n\
+Note that @code{isinteger (14)} is false because numeric constants in\n\
+are double precision floating point values.\n\
+@seealso{isreal, isnumeric, class, isa}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    retval = args(0).is_integer_type ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
 DEFUN (iscomplex, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} iscomplex (@var{x})\n\
@@ -1375,7 +1394,6 @@
   return retval;
 }
 
-
 DEFUN (isreal, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} isreal (@var{x})\n\
--- a/src/ov-base.h	Wed Jan 03 20:15:16 2007 +0000
+++ b/src/ov-base.h	Wed Jan 03 20:59:28 2007 +0000
@@ -257,6 +257,8 @@
 
   virtual bool is_bool_type (void) const { return false; }
 
+  virtual bool is_integer_type (void) const { return false; }
+
   virtual bool is_real_type (void) const { return false; }
 
   virtual bool is_complex_type (void) const { return false; }
--- a/src/ov-intx.h	Wed Jan 03 20:15:16 2007 +0000
+++ b/src/ov-intx.h	Wed Jan 03 20:59:28 2007 +0000
@@ -60,6 +60,8 @@
 
   bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; }
 
+  bool is_integer_type (void) const { return true; }
+
   int8NDArray
   int8_array_value (void) const { return int8NDArray (matrix); }
 
@@ -279,6 +281,8 @@
 
   bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; }
 
+  bool is_integer_type (void) const { return true; }
+
   octave_int8
   int8_scalar_value (void) const { return octave_int8 (scalar); }
 
--- a/src/ov.h	Wed Jan 03 20:15:16 2007 +0000
+++ b/src/ov.h	Wed Jan 03 20:59:28 2007 +0000
@@ -487,6 +487,9 @@
   bool is_bool_type (void) const
     { return rep->is_bool_type (); }
 
+  bool is_integer_type (void) const
+    { return rep->is_integer_type (); }
+
   bool is_real_type (void) const
     { return rep->is_real_type (); }