Mercurial > hg > xemacs-beta
comparison src/number.h @ 5125:b5df3737028a ben-lisp-object
merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 24 Feb 2010 01:58:04 -0600 |
parents | d1247f3cc363 db2db229ee82 |
children | 53b88477345d |
comparison
equal
deleted
inserted
replaced
5124:623d57b7fbe8 | 5125:b5df3737028a |
---|---|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 for more details. | 14 for more details. |
15 | 15 |
16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
17 along with XEmacs; see the file COPYING. If not, write to | 17 along with XEmacs; see the file COPYING. If not, write to |
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 the Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, |
19 Boston, MA 02111-1307, USA. */ | 19 Boston, MA 02111-1301, USA. */ |
20 | 20 |
21 /* Synched up with: Not in FSF. */ | 21 /* Synched up with: Not in FSF. */ |
22 | 22 |
23 #ifndef INCLUDED_number_h_ | 23 #ifndef INCLUDED_number_h_ |
24 #define INCLUDED_number_h_ | 24 #define INCLUDED_number_h_ |
128 extern Lisp_Object Qbignump; | 128 extern Lisp_Object Qbignump; |
129 EXFUN (Fbignump, 1); | 129 EXFUN (Fbignump, 1); |
130 | 130 |
131 | 131 |
132 /********************************* Integers *********************************/ | 132 /********************************* Integers *********************************/ |
133 extern Lisp_Object Qintegerp; | 133 /* Qintegerp in lisp.h */ |
134 | |
135 #define INTEGERP(x) (INTP(x) || BIGNUMP(x)) | 134 #define INTEGERP(x) (INTP(x) || BIGNUMP(x)) |
136 #define CHECK_INTEGER(x) do { \ | 135 #define CHECK_INTEGER(x) do { \ |
137 if (!INTEGERP (x)) \ | 136 if (!INTEGERP (x)) \ |
138 dead_wrong_type_argument (Qintegerp, x); \ | 137 dead_wrong_type_argument (Qintegerp, x); \ |
139 } while (0) | 138 } while (0) |
283 | 282 |
284 extern Lisp_Object Qbigfloatp; | 283 extern Lisp_Object Qbigfloatp; |
285 EXFUN (Fbigfloatp, 1); | 284 EXFUN (Fbigfloatp, 1); |
286 | 285 |
287 /********************************* Floating *********************************/ | 286 /********************************* Floating *********************************/ |
288 extern Lisp_Object Qfloatingp, Qbigfloat; | 287 extern Lisp_Object Qfloatingp; |
289 extern Lisp_Object Qread_default_float_format, Vread_default_float_format; | 288 extern Lisp_Object Qread_default_float_format, Vread_default_float_format; |
290 | 289 |
291 #define FLOATINGP(x) (FLOATP (x) || BIGFLOATP (x)) | 290 #define FLOATINGP(x) (FLOATP (x) || BIGFLOATP (x)) |
292 #define CHECK_FLOATING(x) do { \ | 291 #define CHECK_FLOATING(x) do { \ |
293 if (!FLOATINGP (x)) \ | 292 if (!FLOATINGP (x)) \ |
317 | 316 |
318 EXFUN (Frealp, 1); | 317 EXFUN (Frealp, 1); |
319 | 318 |
320 | 319 |
321 /********************************* Numbers **********************************/ | 320 /********************************* Numbers **********************************/ |
322 extern Lisp_Object Qnumberp; | 321 /* Qnumberp in lisp.h */ |
323 | |
324 #define NUMBERP(x) REALP (x) | 322 #define NUMBERP(x) REALP (x) |
325 #define CHECK_NUMBER(x) do { \ | 323 #define CHECK_NUMBER(x) do { \ |
326 if (!NUMBERP (x)) \ | 324 if (!NUMBERP (x)) \ |
327 dead_wrong_type_argument (Qnumberp, x); \ | 325 dead_wrong_type_argument (Qnumberp, x); \ |
328 } while (0) | 326 } while (0) |
336 enum number_type {FIXNUM_T, BIGNUM_T, RATIO_T, FLOAT_T, BIGFLOAT_T}; | 334 enum number_type {FIXNUM_T, BIGNUM_T, RATIO_T, FLOAT_T, BIGFLOAT_T}; |
337 | 335 |
338 extern enum number_type get_number_type (Lisp_Object); | 336 extern enum number_type get_number_type (Lisp_Object); |
339 extern enum number_type promote_args (Lisp_Object *, Lisp_Object *); | 337 extern enum number_type promote_args (Lisp_Object *, Lisp_Object *); |
340 | 338 |
339 #ifdef WITH_NUMBER_TYPES | |
340 DECLARE_INLINE_HEADER ( | |
341 int | |
342 non_fixnum_number_p (Lisp_Object object)) | |
343 { | |
344 if (LRECORDP (object)) | |
345 { | |
346 switch (XRECORD_LHEADER (object)->type) | |
347 { | |
348 case lrecord_type_float: | |
349 #ifdef HAVE_BIGNUM | |
350 case lrecord_type_bignum: | |
351 #endif | |
352 #ifdef HAVE_RATIO | |
353 case lrecord_type_ratio: | |
354 #endif | |
355 #ifdef HAVE_BIGFLOAT | |
356 case lrecord_type_bigfloat: | |
357 #endif | |
358 return 1; | |
359 } | |
360 } | |
361 return 0; | |
362 } | |
363 #define NON_FIXNUM_NUMBER_P(X) non_fixnum_number_p (X) | |
364 | |
365 #else | |
366 #define NON_FIXNUM_NUMBER_P FLOATP | |
367 #endif | |
368 | |
369 | |
341 #endif /* INCLUDED_number_h_ */ | 370 #endif /* INCLUDED_number_h_ */ |