comparison src/data.c @ 1104:8b464283e891

[xemacs-hg @ 2002-11-12 18:58:13 by james] Unconditionally compile the LISP_FLOAT_TYPE code. Remove all !LISP_FLOAT_TYPE code and the LISP_FLOAT_TYPE identifier itself.
author james
date Tue, 12 Nov 2002 18:58:41 +0000
parents 86012f228185
children e22b0213b713
comparison
equal deleted inserted replaced
1103:80d9ab2e9855 1104:8b464283e891
533 CHARP (object) || 533 CHARP (object) ||
534 MARKERP (object)) 534 MARKERP (object))
535 ? Qt : Qnil; 535 ? Qt : Qnil;
536 } 536 }
537 537
538 #ifdef LISP_FLOAT_TYPE
539 DEFUN ("floatp", Ffloatp, 1, 1, 0, /* 538 DEFUN ("floatp", Ffloatp, 1, 1, 0, /*
540 Return t if OBJECT is a floating point number. 539 Return t if OBJECT is a floating point number.
541 */ 540 */
542 (object)) 541 (object))
543 { 542 {
544 return FLOATP (object) ? Qt : Qnil; 543 return FLOATP (object) ? Qt : Qnil;
545 } 544 }
546 #endif /* LISP_FLOAT_TYPE */
547 545
548 DEFUN ("type-of", Ftype_of, 1, 1, 0, /* 546 DEFUN ("type-of", Ftype_of, 1, 1, 0, /*
549 Return a symbol representing the type of OBJECT. 547 Return a symbol representing the type of OBJECT.
550 */ 548 */
551 (object)) 549 (object))
817 retry: 815 retry:
818 p->int_p = 1; 816 p->int_p = 1;
819 if (INTP (obj)) p->c.ival = XINT (obj); 817 if (INTP (obj)) p->c.ival = XINT (obj);
820 else if (CHARP (obj)) p->c.ival = XCHAR (obj); 818 else if (CHARP (obj)) p->c.ival = XCHAR (obj);
821 else if (MARKERP (obj)) p->c.ival = marker_position (obj); 819 else if (MARKERP (obj)) p->c.ival = marker_position (obj);
822 #ifdef LISP_FLOAT_TYPE
823 else if (FLOATP (obj)) p->c.dval = XFLOAT_DATA (obj), p->int_p = 0; 820 else if (FLOATP (obj)) p->c.dval = XFLOAT_DATA (obj), p->int_p = 0;
824 #endif
825 else 821 else
826 { 822 {
827 obj = wrong_type_argument (Qnumber_char_or_marker_p, obj); 823 obj = wrong_type_argument (Qnumber_char_or_marker_p, obj);
828 goto retry; 824 goto retry;
829 } 825 }
834 { 830 {
835 retry: 831 retry:
836 if (INTP (obj)) return (double) XINT (obj); 832 if (INTP (obj)) return (double) XINT (obj);
837 else if (CHARP (obj)) return (double) XCHAR (obj); 833 else if (CHARP (obj)) return (double) XCHAR (obj);
838 else if (MARKERP (obj)) return (double) marker_position (obj); 834 else if (MARKERP (obj)) return (double) marker_position (obj);
839 #ifdef LISP_FLOAT_TYPE
840 else if (FLOATP (obj)) return XFLOAT_DATA (obj); 835 else if (FLOATP (obj)) return XFLOAT_DATA (obj);
841 #endif
842 else 836 else
843 { 837 {
844 obj = wrong_type_argument (Qnumber_char_or_marker_p, obj); 838 obj = wrong_type_argument (Qnumber_char_or_marker_p, obj);
845 goto retry; 839 goto retry;
846 } 840 }
963 (number)) 957 (number))
964 { 958 {
965 retry: 959 retry:
966 if (INTP (number)) 960 if (INTP (number))
967 return EQ (number, Qzero) ? Qt : Qnil; 961 return EQ (number, Qzero) ? Qt : Qnil;
968 #ifdef LISP_FLOAT_TYPE
969 else if (FLOATP (number)) 962 else if (FLOATP (number))
970 return XFLOAT_DATA (number) == 0.0 ? Qt : Qnil; 963 return XFLOAT_DATA (number) == 0.0 ? Qt : Qnil;
971 #endif /* LISP_FLOAT_TYPE */
972 else 964 else
973 { 965 {
974 number = wrong_type_argument (Qnumberp, number); 966 number = wrong_type_argument (Qnumberp, number);
975 goto retry; 967 goto retry;
976 } 968 }
1012 */ 1004 */
1013 (number)) 1005 (number))
1014 { 1006 {
1015 CHECK_INT_OR_FLOAT (number); 1007 CHECK_INT_OR_FLOAT (number);
1016 1008
1017 #ifdef LISP_FLOAT_TYPE
1018 if (FLOATP (number)) 1009 if (FLOATP (number))
1019 { 1010 {
1020 char pigbuf[350]; /* see comments in float_to_string */ 1011 char pigbuf[350]; /* see comments in float_to_string */
1021 1012
1022 float_to_string (pigbuf, XFLOAT_DATA (number)); 1013 float_to_string (pigbuf, XFLOAT_DATA (number));
1023 return build_string (pigbuf); 1014 return build_string (pigbuf);
1024 } 1015 }
1025 #endif /* LISP_FLOAT_TYPE */
1026 1016
1027 { 1017 {
1028 char buffer[DECIMAL_PRINT_SIZE (long)]; 1018 char buffer[DECIMAL_PRINT_SIZE (long)];
1029 1019
1030 long_to_string (buffer, XINT (number)); 1020 long_to_string (buffer, XINT (number));
1074 /* Skip any whitespace at the front of the number. Some versions of 1064 /* Skip any whitespace at the front of the number. Some versions of
1075 atoi do this anyway, so we might as well make Emacs lisp consistent. */ 1065 atoi do this anyway, so we might as well make Emacs lisp consistent. */
1076 while (*p == ' ' || *p == '\t') 1066 while (*p == ' ' || *p == '\t')
1077 p++; 1067 p++;
1078 1068
1079 #ifdef LISP_FLOAT_TYPE
1080 if (isfloat_string (p) && b == 10) 1069 if (isfloat_string (p) && b == 10)
1081 return make_float (atof (p)); 1070 return make_float (atof (p));
1082 #endif /* LISP_FLOAT_TYPE */
1083 1071
1084 if (b == 10) 1072 if (b == 10)
1085 { 1073 {
1086 /* Use the system-provided functions for base 10. */ 1074 /* Use the system-provided functions for base 10. */
1087 #if SIZEOF_EMACS_INT == SIZEOF_INT 1075 #if SIZEOF_EMACS_INT == SIZEOF_INT
1459 { 1447 {
1460 int_or_double iod1, iod2; 1448 int_or_double iod1, iod2;
1461 number_char_or_marker_to_int_or_double (x, &iod1); 1449 number_char_or_marker_to_int_or_double (x, &iod1);
1462 number_char_or_marker_to_int_or_double (y, &iod2); 1450 number_char_or_marker_to_int_or_double (y, &iod2);
1463 1451
1464 #ifdef LISP_FLOAT_TYPE
1465 if (!iod1.int_p || !iod2.int_p) 1452 if (!iod1.int_p || !iod2.int_p)
1466 { 1453 {
1467 double dval1 = iod1.int_p ? (double) iod1.c.ival : iod1.c.dval; 1454 double dval1 = iod1.int_p ? (double) iod1.c.ival : iod1.c.dval;
1468 double dval2 = iod2.int_p ? (double) iod2.c.ival : iod2.c.dval; 1455 double dval2 = iod2.int_p ? (double) iod2.c.ival : iod2.c.dval;
1469 if (dval2 == 0) goto divide_by_zero; 1456 if (dval2 == 0) goto divide_by_zero;
1473 if (dval2 < 0 ? dval1 > 0 : dval1 < 0) 1460 if (dval2 < 0 ? dval1 > 0 : dval1 < 0)
1474 dval1 += dval2; 1461 dval1 += dval2;
1475 1462
1476 return make_float (dval1); 1463 return make_float (dval1);
1477 } 1464 }
1478 #endif /* LISP_FLOAT_TYPE */ 1465
1479 { 1466 {
1480 EMACS_INT ival; 1467 EMACS_INT ival;
1481 if (iod2.c.ival == 0) goto divide_by_zero; 1468 if (iod2.c.ival == 0) goto divide_by_zero;
1482 1469
1483 ival = iod1.c.ival % iod2.c.ival; 1470 ival = iod1.c.ival % iod2.c.ival;
1533 retry: 1520 retry:
1534 1521
1535 if (INTP (number)) return make_int (XINT (number) + 1); 1522 if (INTP (number)) return make_int (XINT (number) + 1);
1536 if (CHARP (number)) return make_int (XCHAR (number) + 1); 1523 if (CHARP (number)) return make_int (XCHAR (number) + 1);
1537 if (MARKERP (number)) return make_int (marker_position (number) + 1); 1524 if (MARKERP (number)) return make_int (marker_position (number) + 1);
1538 #ifdef LISP_FLOAT_TYPE
1539 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) + 1.0); 1525 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) + 1.0);
1540 #endif /* LISP_FLOAT_TYPE */
1541 1526
1542 number = wrong_type_argument (Qnumber_char_or_marker_p, number); 1527 number = wrong_type_argument (Qnumber_char_or_marker_p, number);
1543 goto retry; 1528 goto retry;
1544 } 1529 }
1545 1530
1552 retry: 1537 retry:
1553 1538
1554 if (INTP (number)) return make_int (XINT (number) - 1); 1539 if (INTP (number)) return make_int (XINT (number) - 1);
1555 if (CHARP (number)) return make_int (XCHAR (number) - 1); 1540 if (CHARP (number)) return make_int (XCHAR (number) - 1);
1556 if (MARKERP (number)) return make_int (marker_position (number) - 1); 1541 if (MARKERP (number)) return make_int (marker_position (number) - 1);
1557 #ifdef LISP_FLOAT_TYPE
1558 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) - 1.0); 1542 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) - 1.0);
1559 #endif /* LISP_FLOAT_TYPE */
1560 1543
1561 number = wrong_type_argument (Qnumber_char_or_marker_p, number); 1544 number = wrong_type_argument (Qnumber_char_or_marker_p, number);
1562 goto retry; 1545 goto retry;
1563 } 1546 }
1564 1547
2486 DEFSYMBOL (Qnumberp); 2469 DEFSYMBOL (Qnumberp);
2487 DEFSYMBOL (Qnumber_char_or_marker_p); 2470 DEFSYMBOL (Qnumber_char_or_marker_p);
2488 DEFSYMBOL (Qcdr); 2471 DEFSYMBOL (Qcdr);
2489 DEFSYMBOL (Qerror_lacks_explanatory_string); 2472 DEFSYMBOL (Qerror_lacks_explanatory_string);
2490 DEFSYMBOL_MULTIWORD_PREDICATE (Qweak_listp); 2473 DEFSYMBOL_MULTIWORD_PREDICATE (Qweak_listp);
2491
2492 #ifdef LISP_FLOAT_TYPE
2493 DEFSYMBOL (Qfloatp); 2474 DEFSYMBOL (Qfloatp);
2494 #endif /* LISP_FLOAT_TYPE */
2495 2475
2496 DEFSUBR (Fwrong_type_argument); 2476 DEFSUBR (Fwrong_type_argument);
2497 2477
2498 DEFSUBR (Feq); 2478 DEFSUBR (Feq);
2499 DEFSUBR (Fold_eq); 2479 DEFSUBR (Fold_eq);
2515 DEFSUBR (Finteger_or_char_p); 2495 DEFSUBR (Finteger_or_char_p);
2516 DEFSUBR (Finteger_char_or_marker_p); 2496 DEFSUBR (Finteger_char_or_marker_p);
2517 DEFSUBR (Fnumberp); 2497 DEFSUBR (Fnumberp);
2518 DEFSUBR (Fnumber_or_marker_p); 2498 DEFSUBR (Fnumber_or_marker_p);
2519 DEFSUBR (Fnumber_char_or_marker_p); 2499 DEFSUBR (Fnumber_char_or_marker_p);
2520 #ifdef LISP_FLOAT_TYPE
2521 DEFSUBR (Ffloatp); 2500 DEFSUBR (Ffloatp);
2522 #endif /* LISP_FLOAT_TYPE */
2523 DEFSUBR (Fnatnump); 2501 DEFSUBR (Fnatnump);
2524 DEFSUBR (Fsymbolp); 2502 DEFSUBR (Fsymbolp);
2525 DEFSUBR (Fkeywordp); 2503 DEFSUBR (Fkeywordp);
2526 DEFSUBR (Fstringp); 2504 DEFSUBR (Fstringp);
2527 DEFSUBR (Fvectorp); 2505 DEFSUBR (Fvectorp);