Mercurial > hg > xemacs-beta
comparison src/data.c @ 5581:56144c8593a8
Mechanically change INT to FIXNUM in our sources.
src/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT (where it refers to non-bignum Lisp
integers) to FIXNUM in our sources. Done for the following
functions, enums, and macros: Lisp_Type_Int_Even,
Lisp_Type_Int_Odd, INT_GCBITS, INT_VALBITS, make_int(), INTP(),
XINT(), CHECK_INT(), XREALINT(), INT_PLUS(), INT_MINUS(),
EMACS_INT_MAX (to MOST_POSITIVE_FIXNUM), EMACS_INT_MIN (to
MOST_NEGATIVE_FIXNUM), NUMBER_FITS_IN_AN_EMACS_INT() to
NUMBER_FITS_IN_A_FIXNUM(), XFLOATINT, XCHAR_OR_INT, INT_OR_FLOAT.
The EMACS_INT typedef was not changed, it does not describe
non-bignum Lisp integers.
Script that did the change available in
http://mid.gmane.org/20067.17650.181273.12014@parhasard.net .
modules/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers. See the src/ChangeLog entry for more details.
man/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
* internals/internals.texi (How Lisp Objects Are Represented in C):
* internals/internals.texi (Integers and Characters):
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 09 Oct 2011 09:51:57 +0100 |
parents | 6b3caa55668c |
children | 873d7425c1ad |
comparison
equal
deleted
inserted
replaced
5580:a0e81357194e | 5581:56144c8593a8 |
---|---|
76 | 76 |
77 int | 77 int |
78 eq_with_ebola_notice (Lisp_Object obj1, Lisp_Object obj2) | 78 eq_with_ebola_notice (Lisp_Object obj1, Lisp_Object obj2) |
79 { | 79 { |
80 if (debug_issue_ebola_notices | 80 if (debug_issue_ebola_notices |
81 && ((CHARP (obj1) && INTP (obj2)) || (CHARP (obj2) && INTP (obj1)))) | 81 && ((CHARP (obj1) && FIXNUMP (obj2)) || (CHARP (obj2) && FIXNUMP (obj1)))) |
82 { | 82 { |
83 /* #### It would be really nice if this were a proper warning | 83 /* #### It would be really nice if this were a proper warning |
84 instead of brain-dead print to Qexternal_debugging_output. */ | 84 instead of brain-dead print to Qexternal_debugging_output. */ |
85 write_msg_string | 85 write_msg_string |
86 (Qexternal_debugging_output, | 86 (Qexternal_debugging_output, |
319 Return minimum number of args built-in function SUBR may be called with. | 319 Return minimum number of args built-in function SUBR may be called with. |
320 */ | 320 */ |
321 (subr)) | 321 (subr)) |
322 { | 322 { |
323 CHECK_SUBR (subr); | 323 CHECK_SUBR (subr); |
324 return make_int (XSUBR (subr)->min_args); | 324 return make_fixnum (XSUBR (subr)->min_args); |
325 } | 325 } |
326 | 326 |
327 DEFUN ("subr-max-args", Fsubr_max_args, 1, 1, 0, /* | 327 DEFUN ("subr-max-args", Fsubr_max_args, 1, 1, 0, /* |
328 Return maximum number of args built-in function SUBR may be called with, | 328 Return maximum number of args built-in function SUBR may be called with, |
329 or nil if it takes an arbitrary number of arguments or is a special operator. | 329 or nil if it takes an arbitrary number of arguments or is a special operator. |
334 CHECK_SUBR (subr); | 334 CHECK_SUBR (subr); |
335 nargs = XSUBR (subr)->max_args; | 335 nargs = XSUBR (subr)->max_args; |
336 if (nargs == MANY || nargs == UNEVALLED) | 336 if (nargs == MANY || nargs == UNEVALLED) |
337 return Qnil; | 337 return Qnil; |
338 else | 338 else |
339 return make_int (nargs); | 339 return make_fixnum (nargs); |
340 } | 340 } |
341 | 341 |
342 DEFUN ("subr-interactive", Fsubr_interactive, 1, 1, 0, /* | 342 DEFUN ("subr-interactive", Fsubr_interactive, 1, 1, 0, /* |
343 Return the interactive spec of the subr object SUBR, or nil. | 343 Return the interactive spec of the subr object SUBR, or nil. |
344 If non-nil, the return value will be a list whose first element is | 344 If non-nil, the return value will be a list whose first element is |
393 character sets were loaded, etc., and you should not depend on them. | 393 character sets were loaded, etc., and you should not depend on them. |
394 */ | 394 */ |
395 (character)) | 395 (character)) |
396 { | 396 { |
397 CHECK_CHAR (character); | 397 CHECK_CHAR (character); |
398 return make_int (XCHAR (character)); | 398 return make_fixnum (XCHAR (character)); |
399 } | 399 } |
400 | 400 |
401 DEFUN ("int-to-char", Fint_to_char, 1, 1, 0, /* | 401 DEFUN ("int-to-char", Fint_to_char, 1, 1, 0, /* |
402 Convert integer INTEGER into the equivalent character. | 402 Convert integer INTEGER into the equivalent character. |
403 Not all integers correspond to valid characters; use `char-int-p' to | 403 Not all integers correspond to valid characters; use `char-int-p' to |
406 */ | 406 */ |
407 (integer)) | 407 (integer)) |
408 { | 408 { |
409 CHECK_INTEGER (integer); | 409 CHECK_INTEGER (integer); |
410 if (CHAR_INTP (integer)) | 410 if (CHAR_INTP (integer)) |
411 return make_char (XINT (integer)); | 411 return make_char (XFIXNUM (integer)); |
412 else | 412 else |
413 return Qnil; | 413 return Qnil; |
414 } | 414 } |
415 | 415 |
416 DEFUN ("char-int-p", Fchar_int_p, 1, 1, 0, /* | 416 DEFUN ("char-int-p", Fchar_int_p, 1, 1, 0, /* |
450 contrasts with bignums, integers where the values are limited by your | 450 contrasts with bignums, integers where the values are limited by your |
451 available memory. | 451 available memory. |
452 */ | 452 */ |
453 (object)) | 453 (object)) |
454 { | 454 { |
455 return INTP (object) ? Qt : Qnil; | 455 return FIXNUMP (object) ? Qt : Qnil; |
456 } | 456 } |
457 DEFUN ("integerp", Fintegerp, 1, 1, 0, /* | 457 DEFUN ("integerp", Fintegerp, 1, 1, 0, /* |
458 Return t if OBJECT is an integer, nil otherwise. | 458 Return t if OBJECT is an integer, nil otherwise. |
459 | 459 |
460 On builds without bignum support, this function is identical to `fixnump'. | 460 On builds without bignum support, this function is identical to `fixnump'. |
712 { | 712 { |
713 EMACS_INT idx; | 713 EMACS_INT idx; |
714 | 714 |
715 retry: | 715 retry: |
716 | 716 |
717 if (INTP (index_)) idx = XINT (index_); | 717 if (FIXNUMP (index_)) idx = XFIXNUM (index_); |
718 else if (CHARP (index_)) idx = XCHAR (index_); /* yuck! */ | 718 else if (CHARP (index_)) idx = XCHAR (index_); /* yuck! */ |
719 #ifdef HAVE_BIGNUM | 719 #ifdef HAVE_BIGNUM |
720 else if (BIGNUMP (index_)) | 720 else if (BIGNUMP (index_)) |
721 { | 721 { |
722 Lisp_Object canon = Fcanonicalize_number (index_); | 722 Lisp_Object canon = Fcanonicalize_number (index_); |
744 } | 744 } |
745 else if (BIT_VECTORP (array)) | 745 else if (BIT_VECTORP (array)) |
746 { | 746 { |
747 if (idx >= (EMACS_INT) bit_vector_length (XBIT_VECTOR (array))) | 747 if (idx >= (EMACS_INT) bit_vector_length (XBIT_VECTOR (array))) |
748 goto range_error; | 748 goto range_error; |
749 return make_int (bit_vector_bit (XBIT_VECTOR (array), idx)); | 749 return make_fixnum (bit_vector_bit (XBIT_VECTOR (array), idx)); |
750 } | 750 } |
751 else if (STRINGP (array)) | 751 else if (STRINGP (array)) |
752 { | 752 { |
753 if (idx >= string_char_length (array)) goto range_error; | 753 if (idx >= string_char_length (array)) goto range_error; |
754 return make_char (string_ichar (array, idx)); | 754 return make_char (string_ichar (array, idx)); |
773 { | 773 { |
774 EMACS_INT idx; | 774 EMACS_INT idx; |
775 | 775 |
776 retry: | 776 retry: |
777 | 777 |
778 if (INTP (index_)) idx = XINT (index_); | 778 if (FIXNUMP (index_)) idx = XFIXNUM (index_); |
779 else if (CHARP (index_)) idx = XCHAR (index_); /* yuck! */ | 779 else if (CHARP (index_)) idx = XCHAR (index_); /* yuck! */ |
780 #ifdef HAVE_BIGNUM | 780 #ifdef HAVE_BIGNUM |
781 else if (BIGNUMP (index_)) | 781 else if (BIGNUMP (index_)) |
782 { | 782 { |
783 Lisp_Object canon = Fcanonicalize_number (index_); | 783 Lisp_Object canon = Fcanonicalize_number (index_); |
849 static void | 849 static void |
850 number_char_or_marker_to_int_or_double (Lisp_Object obj, int_or_double *p) | 850 number_char_or_marker_to_int_or_double (Lisp_Object obj, int_or_double *p) |
851 { | 851 { |
852 retry: | 852 retry: |
853 p->int_p = 1; | 853 p->int_p = 1; |
854 if (INTP (obj)) p->c.ival = XINT (obj); | 854 if (FIXNUMP (obj)) p->c.ival = XFIXNUM (obj); |
855 else if (CHARP (obj)) p->c.ival = XCHAR (obj); | 855 else if (CHARP (obj)) p->c.ival = XCHAR (obj); |
856 else if (MARKERP (obj)) p->c.ival = marker_position (obj); | 856 else if (MARKERP (obj)) p->c.ival = marker_position (obj); |
857 else if (FLOATP (obj)) p->c.dval = XFLOAT_DATA (obj), p->int_p = 0; | 857 else if (FLOATP (obj)) p->c.dval = XFLOAT_DATA (obj), p->int_p = 0; |
858 else | 858 else |
859 { | 859 { |
864 | 864 |
865 static double | 865 static double |
866 number_char_or_marker_to_double (Lisp_Object obj) | 866 number_char_or_marker_to_double (Lisp_Object obj) |
867 { | 867 { |
868 retry: | 868 retry: |
869 if (INTP (obj)) return (double) XINT (obj); | 869 if (FIXNUMP (obj)) return (double) XFIXNUM (obj); |
870 else if (CHARP (obj)) return (double) XCHAR (obj); | 870 else if (CHARP (obj)) return (double) XCHAR (obj); |
871 else if (MARKERP (obj)) return (double) marker_position (obj); | 871 else if (MARKERP (obj)) return (double) marker_position (obj); |
872 else if (FLOATP (obj)) return XFLOAT_DATA (obj); | 872 else if (FLOATP (obj)) return XFLOAT_DATA (obj); |
873 else | 873 else |
874 { | 874 { |
880 | 880 |
881 static EMACS_INT | 881 static EMACS_INT |
882 fixnum_char_or_marker_to_int (Lisp_Object obj) | 882 fixnum_char_or_marker_to_int (Lisp_Object obj) |
883 { | 883 { |
884 retry: | 884 retry: |
885 if (INTP (obj)) return XINT (obj); | 885 if (FIXNUMP (obj)) return XFIXNUM (obj); |
886 else if (CHARP (obj)) return XCHAR (obj); | 886 else if (CHARP (obj)) return XCHAR (obj); |
887 else if (MARKERP (obj)) return marker_position (obj); | 887 else if (MARKERP (obj)) return marker_position (obj); |
888 else | 888 else |
889 { | 889 { |
890 /* On bignum builds, we can only be called from #'lognot, which | 890 /* On bignum builds, we can only be called from #'lognot, which |
937 obj1 = args[i - 1]; \ | 937 obj1 = args[i - 1]; \ |
938 obj2 = args[i]; \ | 938 obj2 = args[i]; \ |
939 switch (promote_args (&obj1, &obj2)) \ | 939 switch (promote_args (&obj1, &obj2)) \ |
940 { \ | 940 { \ |
941 case FIXNUM_T: \ | 941 case FIXNUM_T: \ |
942 if (!(XREALINT (obj1) c_op XREALINT (obj2))) \ | 942 if (!(XREALFIXNUM (obj1) c_op XREALFIXNUM (obj2))) \ |
943 return Qnil; \ | 943 return Qnil; \ |
944 break; \ | 944 break; \ |
945 BIGNUM_CASE (op) \ | 945 BIGNUM_CASE (op) \ |
946 RATIO_CASE (op) \ | 946 RATIO_CASE (op) \ |
947 case FLOAT_T: \ | 947 case FLOAT_T: \ |
1067 { | 1067 { |
1068 obj2 = args[j]; | 1068 obj2 = args[j]; |
1069 switch (promote_args (&obj1, &obj2)) | 1069 switch (promote_args (&obj1, &obj2)) |
1070 { | 1070 { |
1071 case FIXNUM_T: | 1071 case FIXNUM_T: |
1072 if (XREALINT (obj1) == XREALINT (obj2)) | 1072 if (XREALFIXNUM (obj1) == XREALFIXNUM (obj2)) |
1073 return Qnil; | 1073 return Qnil; |
1074 break; | 1074 break; |
1075 #ifdef HAVE_BIGNUM | 1075 #ifdef HAVE_BIGNUM |
1076 case BIGNUM_T: | 1076 case BIGNUM_T: |
1077 if (bignum_eql (XBIGNUM_DATA (obj1), XBIGNUM_DATA (obj2))) | 1077 if (bignum_eql (XBIGNUM_DATA (obj1), XBIGNUM_DATA (obj2))) |
1128 Return t if NUMBER is zero. | 1128 Return t if NUMBER is zero. |
1129 */ | 1129 */ |
1130 (number)) | 1130 (number)) |
1131 { | 1131 { |
1132 retry: | 1132 retry: |
1133 if (INTP (number)) | 1133 if (FIXNUMP (number)) |
1134 return EQ (number, Qzero) ? Qt : Qnil; | 1134 return EQ (number, Qzero) ? Qt : Qnil; |
1135 #ifdef HAVE_BIGNUM | 1135 #ifdef HAVE_BIGNUM |
1136 else if (BIGNUMP (number)) | 1136 else if (BIGNUMP (number)) |
1137 return bignum_sign (XBIGNUM_DATA (number)) == 0 ? Qt : Qnil; | 1137 return bignum_sign (XBIGNUM_DATA (number)) == 0 ? Qt : Qnil; |
1138 #endif | 1138 #endif |
1161 for internal purposes (such as when calling record_unwind_protect()), | 1161 for internal purposes (such as when calling record_unwind_protect()), |
1162 try using make_opaque_ptr()/get_opaque_ptr() instead. */ | 1162 try using make_opaque_ptr()/get_opaque_ptr() instead. */ |
1163 Lisp_Object | 1163 Lisp_Object |
1164 word_to_lisp (unsigned int item) | 1164 word_to_lisp (unsigned int item) |
1165 { | 1165 { |
1166 return Fcons (make_int (item >> 16), make_int (item & 0xffff)); | 1166 return Fcons (make_fixnum (item >> 16), make_fixnum (item & 0xffff)); |
1167 } | 1167 } |
1168 | 1168 |
1169 unsigned int | 1169 unsigned int |
1170 lisp_to_word (Lisp_Object item) | 1170 lisp_to_word (Lisp_Object item) |
1171 { | 1171 { |
1172 if (INTP (item)) | 1172 if (FIXNUMP (item)) |
1173 return XINT (item); | 1173 return XFIXNUM (item); |
1174 else | 1174 else |
1175 { | 1175 { |
1176 Lisp_Object top = Fcar (item); | 1176 Lisp_Object top = Fcar (item); |
1177 Lisp_Object bot = Fcdr (item); | 1177 Lisp_Object bot = Fcdr (item); |
1178 CHECK_INT (top); | 1178 CHECK_FIXNUM (top); |
1179 CHECK_INT (bot); | 1179 CHECK_FIXNUM (bot); |
1180 return (XINT (top) << 16) | (XINT (bot) & 0xffff); | 1180 return (XFIXNUM (top) << 16) | (XFIXNUM (bot) & 0xffff); |
1181 } | 1181 } |
1182 } | 1182 } |
1183 | 1183 |
1184 | 1184 |
1185 DEFUN ("number-to-string", Fnumber_to_string, 1, 1, 0, /* | 1185 DEFUN ("number-to-string", Fnumber_to_string, 1, 1, 0, /* |
1228 #endif | 1228 #endif |
1229 | 1229 |
1230 { | 1230 { |
1231 Ascbyte buffer[DECIMAL_PRINT_SIZE (long)]; | 1231 Ascbyte buffer[DECIMAL_PRINT_SIZE (long)]; |
1232 | 1232 |
1233 long_to_string (buffer, XINT (number)); | 1233 long_to_string (buffer, XFIXNUM (number)); |
1234 return build_ascstring (buffer); | 1234 return build_ascstring (buffer); |
1235 } | 1235 } |
1236 } | 1236 } |
1237 | 1237 |
1238 #ifndef HAVE_BIGNUM | 1238 #ifndef HAVE_BIGNUM |
1268 | 1268 |
1269 if (NILP (base)) | 1269 if (NILP (base)) |
1270 b = 10; | 1270 b = 10; |
1271 else | 1271 else |
1272 { | 1272 { |
1273 check_integer_range (base, make_int (2), make_int (16)); | 1273 check_integer_range (base, make_fixnum (2), make_fixnum (16)); |
1274 b = XINT (base); | 1274 b = XFIXNUM (base); |
1275 } | 1275 } |
1276 | 1276 |
1277 p = XSTRING_DATA (string); | 1277 p = XSTRING_DATA (string); |
1278 | 1278 |
1279 /* Skip any whitespace at the front of the number. Some versions of | 1279 /* Skip any whitespace at the front of the number. Some versions of |
1377 (b > 10 && *end >= 'A' && *end <= 'A' + b - 11)) | 1377 (b > 10 && *end >= 'A' && *end <= 'A' + b - 11)) |
1378 end++; | 1378 end++; |
1379 save = *end; | 1379 save = *end; |
1380 *end = '\0'; | 1380 *end = '\0'; |
1381 if (*p == '\0') | 1381 if (*p == '\0') |
1382 retval = make_int (0); | 1382 retval = make_fixnum (0); |
1383 else | 1383 else |
1384 { | 1384 { |
1385 bignum_set_string (scratch_bignum, (const char *) p, b); | 1385 bignum_set_string (scratch_bignum, (const char *) p, b); |
1386 retval = Fcanonicalize_number (make_bignum_bg (scratch_bignum)); | 1386 retval = Fcanonicalize_number (make_bignum_bg (scratch_bignum)); |
1387 } | 1387 } |
1391 #else | 1391 #else |
1392 if (b == 10) | 1392 if (b == 10) |
1393 { | 1393 { |
1394 /* Use the system-provided functions for base 10. */ | 1394 /* Use the system-provided functions for base 10. */ |
1395 #if SIZEOF_EMACS_INT == SIZEOF_INT | 1395 #if SIZEOF_EMACS_INT == SIZEOF_INT |
1396 return make_int (atoi ((char*) p)); | 1396 return make_fixnum (atoi ((char*) p)); |
1397 #elif SIZEOF_EMACS_INT == SIZEOF_LONG | 1397 #elif SIZEOF_EMACS_INT == SIZEOF_LONG |
1398 return make_int (atol ((char*) p)); | 1398 return make_fixnum (atol ((char*) p)); |
1399 #elif SIZEOF_EMACS_INT == SIZEOF_LONG_LONG | 1399 #elif SIZEOF_EMACS_INT == SIZEOF_LONG_LONG |
1400 return make_int (atoll ((char*) p)); | 1400 return make_fixnum (atoll ((char*) p)); |
1401 #endif | 1401 #endif |
1402 } | 1402 } |
1403 else | 1403 else |
1404 { | 1404 { |
1405 int negative = 1; | 1405 int negative = 1; |
1417 int digit = digit_to_number (*p++, b); | 1417 int digit = digit_to_number (*p++, b); |
1418 if (digit < 0) | 1418 if (digit < 0) |
1419 break; | 1419 break; |
1420 v = v * b + digit; | 1420 v = v * b + digit; |
1421 } | 1421 } |
1422 return make_int (negative * v); | 1422 return make_fixnum (negative * v); |
1423 } | 1423 } |
1424 #endif /* HAVE_BIGNUM */ | 1424 #endif /* HAVE_BIGNUM */ |
1425 } | 1425 } |
1426 | 1426 |
1427 | 1427 |
1433 */ | 1433 */ |
1434 (int nargs, Lisp_Object *args)) | 1434 (int nargs, Lisp_Object *args)) |
1435 { | 1435 { |
1436 #ifdef WITH_NUMBER_TYPES | 1436 #ifdef WITH_NUMBER_TYPES |
1437 REGISTER int i; | 1437 REGISTER int i; |
1438 Lisp_Object accum = make_int (0), addend; | 1438 Lisp_Object accum = make_fixnum (0), addend; |
1439 | 1439 |
1440 for (i = 0; i < nargs; i++) | 1440 for (i = 0; i < nargs; i++) |
1441 { | 1441 { |
1442 addend = args[i]; | 1442 addend = args[i]; |
1443 switch (promote_args (&accum, &addend)) | 1443 switch (promote_args (&accum, &addend)) |
1444 { | 1444 { |
1445 case FIXNUM_T: | 1445 case FIXNUM_T: |
1446 accum = make_integer (XREALINT (accum) + XREALINT (addend)); | 1446 accum = make_integer (XREALFIXNUM (accum) + XREALFIXNUM (addend)); |
1447 break; | 1447 break; |
1448 #ifdef HAVE_BIGNUM | 1448 #ifdef HAVE_BIGNUM |
1449 case BIGNUM_T: | 1449 case BIGNUM_T: |
1450 bignum_add (scratch_bignum, XBIGNUM_DATA (accum), | 1450 bignum_add (scratch_bignum, XBIGNUM_DATA (accum), |
1451 XBIGNUM_DATA (addend)); | 1451 XBIGNUM_DATA (addend)); |
1492 daccum += number_char_or_marker_to_double (*args++); | 1492 daccum += number_char_or_marker_to_double (*args++); |
1493 return make_float (daccum); | 1493 return make_float (daccum); |
1494 } | 1494 } |
1495 } | 1495 } |
1496 | 1496 |
1497 return make_int (iaccum); | 1497 return make_fixnum (iaccum); |
1498 #endif /* WITH_NUMBER_TYPES */ | 1498 #endif /* WITH_NUMBER_TYPES */ |
1499 } | 1499 } |
1500 | 1500 |
1501 DEFUN ("-", Fminus, 1, MANY, 0, /* | 1501 DEFUN ("-", Fminus, 1, MANY, 0, /* |
1502 Negate number or subtract numbers, characters or markers. | 1502 Negate number or subtract numbers, characters or markers. |
1512 Lisp_Object accum = args[0], subtrahend; | 1512 Lisp_Object accum = args[0], subtrahend; |
1513 | 1513 |
1514 if (nargs == 1) | 1514 if (nargs == 1) |
1515 { | 1515 { |
1516 if (CHARP (accum)) | 1516 if (CHARP (accum)) |
1517 accum = make_int (XCHAR (accum)); | 1517 accum = make_fixnum (XCHAR (accum)); |
1518 else if (MARKERP (accum)) | 1518 else if (MARKERP (accum)) |
1519 accum = make_int (marker_position (accum)); | 1519 accum = make_fixnum (marker_position (accum)); |
1520 | 1520 |
1521 /* Invert the sign of accum */ | 1521 /* Invert the sign of accum */ |
1522 CHECK_NUMBER (accum); | 1522 CHECK_NUMBER (accum); |
1523 switch (get_number_type (accum)) | 1523 switch (get_number_type (accum)) |
1524 { | 1524 { |
1525 case FIXNUM_T: | 1525 case FIXNUM_T: |
1526 return make_integer (-XREALINT (accum)); | 1526 return make_integer (-XREALFIXNUM (accum)); |
1527 #ifdef HAVE_BIGNUM | 1527 #ifdef HAVE_BIGNUM |
1528 case BIGNUM_T: | 1528 case BIGNUM_T: |
1529 bignum_neg (scratch_bignum, XBIGNUM_DATA (accum)); | 1529 bignum_neg (scratch_bignum, XBIGNUM_DATA (accum)); |
1530 return Fcanonicalize_number (make_bignum_bg (scratch_bignum)); | 1530 return Fcanonicalize_number (make_bignum_bg (scratch_bignum)); |
1531 #endif | 1531 #endif |
1551 { | 1551 { |
1552 subtrahend = args[i]; | 1552 subtrahend = args[i]; |
1553 switch (promote_args (&accum, &subtrahend)) | 1553 switch (promote_args (&accum, &subtrahend)) |
1554 { | 1554 { |
1555 case FIXNUM_T: | 1555 case FIXNUM_T: |
1556 accum = make_integer (XREALINT (accum) - XREALINT (subtrahend)); | 1556 accum = make_integer (XREALFIXNUM (accum) - XREALFIXNUM (subtrahend)); |
1557 break; | 1557 break; |
1558 #ifdef HAVE_BIGNUM | 1558 #ifdef HAVE_BIGNUM |
1559 case BIGNUM_T: | 1559 case BIGNUM_T: |
1560 bignum_sub (scratch_bignum, XBIGNUM_DATA (accum), | 1560 bignum_sub (scratch_bignum, XBIGNUM_DATA (accum), |
1561 XBIGNUM_DATA (subtrahend)); | 1561 XBIGNUM_DATA (subtrahend)); |
1612 daccum = (double) iaccum - iod.c.dval; | 1612 daccum = (double) iaccum - iod.c.dval; |
1613 goto do_float; | 1613 goto do_float; |
1614 } | 1614 } |
1615 } | 1615 } |
1616 | 1616 |
1617 return make_int (iaccum); | 1617 return make_fixnum (iaccum); |
1618 | 1618 |
1619 do_float: | 1619 do_float: |
1620 for (; args < args_end; args++) | 1620 for (; args < args_end; args++) |
1621 daccum -= number_char_or_marker_to_double (*args); | 1621 daccum -= number_char_or_marker_to_double (*args); |
1622 return make_float (daccum); | 1622 return make_float (daccum); |
1688 daccum *= number_char_or_marker_to_double (*args++); | 1688 daccum *= number_char_or_marker_to_double (*args++); |
1689 return make_float (daccum); | 1689 return make_float (daccum); |
1690 } | 1690 } |
1691 } | 1691 } |
1692 | 1692 |
1693 return make_int (iaccum); | 1693 return make_fixnum (iaccum); |
1694 #endif /* WITH_NUMBER_TYPES */ | 1694 #endif /* WITH_NUMBER_TYPES */ |
1695 } | 1695 } |
1696 | 1696 |
1697 #ifdef HAVE_RATIO | 1697 #ifdef HAVE_RATIO |
1698 DEFUN ("div", Fdiv, 1, MANY, 0, /* | 1698 DEFUN ("div", Fdiv, 1, MANY, 0, /* |
1709 Lisp_Object accum, divisor; | 1709 Lisp_Object accum, divisor; |
1710 | 1710 |
1711 if (nargs == 1) | 1711 if (nargs == 1) |
1712 { | 1712 { |
1713 i = 0; | 1713 i = 0; |
1714 accum = make_int (1); | 1714 accum = make_fixnum (1); |
1715 } | 1715 } |
1716 else | 1716 else |
1717 { | 1717 { |
1718 i = 1; | 1718 i = 1; |
1719 accum = args[0]; | 1719 accum = args[0]; |
1722 { | 1722 { |
1723 divisor = args[i]; | 1723 divisor = args[i]; |
1724 switch (promote_args (&accum, &divisor)) | 1724 switch (promote_args (&accum, &divisor)) |
1725 { | 1725 { |
1726 case FIXNUM_T: | 1726 case FIXNUM_T: |
1727 if (XREALINT (divisor) == 0) goto divide_by_zero; | 1727 if (XREALFIXNUM (divisor) == 0) goto divide_by_zero; |
1728 bignum_set_long (scratch_bignum, XREALINT (accum)); | 1728 bignum_set_long (scratch_bignum, XREALFIXNUM (accum)); |
1729 bignum_set_long (scratch_bignum2, XREALINT (divisor)); | 1729 bignum_set_long (scratch_bignum2, XREALFIXNUM (divisor)); |
1730 accum = make_ratio_bg (scratch_bignum, scratch_bignum2); | 1730 accum = make_ratio_bg (scratch_bignum, scratch_bignum2); |
1731 break; | 1731 break; |
1732 case BIGNUM_T: | 1732 case BIGNUM_T: |
1733 if (bignum_sign (XBIGNUM_DATA (divisor)) == 0) goto divide_by_zero; | 1733 if (bignum_sign (XBIGNUM_DATA (divisor)) == 0) goto divide_by_zero; |
1734 accum = make_ratio_bg (XBIGNUM_DATA (accum), XBIGNUM_DATA (divisor)); | 1734 accum = make_ratio_bg (XBIGNUM_DATA (accum), XBIGNUM_DATA (divisor)); |
1779 Lisp_Object accum, divisor; | 1779 Lisp_Object accum, divisor; |
1780 | 1780 |
1781 if (nargs == 1) | 1781 if (nargs == 1) |
1782 { | 1782 { |
1783 i = 0; | 1783 i = 0; |
1784 accum = make_int (1); | 1784 accum = make_fixnum (1); |
1785 } | 1785 } |
1786 else | 1786 else |
1787 { | 1787 { |
1788 i = 1; | 1788 i = 1; |
1789 accum = args[0]; | 1789 accum = args[0]; |
1792 { | 1792 { |
1793 divisor = args[i]; | 1793 divisor = args[i]; |
1794 switch (promote_args (&accum, &divisor)) | 1794 switch (promote_args (&accum, &divisor)) |
1795 { | 1795 { |
1796 case FIXNUM_T: | 1796 case FIXNUM_T: |
1797 if (XREALINT (divisor) == 0) goto divide_by_zero; | 1797 if (XREALFIXNUM (divisor) == 0) goto divide_by_zero; |
1798 accum = make_integer (XREALINT (accum) / XREALINT (divisor)); | 1798 accum = make_integer (XREALFIXNUM (accum) / XREALFIXNUM (divisor)); |
1799 break; | 1799 break; |
1800 #ifdef HAVE_BIGNUM | 1800 #ifdef HAVE_BIGNUM |
1801 case BIGNUM_T: | 1801 case BIGNUM_T: |
1802 if (bignum_sign (XBIGNUM_DATA (divisor)) == 0) goto divide_by_zero; | 1802 if (bignum_sign (XBIGNUM_DATA (divisor)) == 0) goto divide_by_zero; |
1803 bignum_div (scratch_bignum, XBIGNUM_DATA (accum), | 1803 bignum_div (scratch_bignum, XBIGNUM_DATA (accum), |
1866 daccum = (double) iaccum / iod.c.dval; | 1866 daccum = (double) iaccum / iod.c.dval; |
1867 goto divide_floats; | 1867 goto divide_floats; |
1868 } | 1868 } |
1869 } | 1869 } |
1870 | 1870 |
1871 return make_int (iaccum); | 1871 return make_fixnum (iaccum); |
1872 | 1872 |
1873 divide_floats: | 1873 divide_floats: |
1874 for (; args < args_end; args++) | 1874 for (; args < args_end; args++) |
1875 { | 1875 { |
1876 double dval = number_char_or_marker_to_double (*args); | 1876 double dval = number_char_or_marker_to_double (*args); |
1900 Lisp_Object comp1, comp2; | 1900 Lisp_Object comp1, comp2; |
1901 | 1901 |
1902 while (!(CHARP (args[0]) || MARKERP (args[0]) || REALP (args[0]))) | 1902 while (!(CHARP (args[0]) || MARKERP (args[0]) || REALP (args[0]))) |
1903 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); | 1903 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); |
1904 if (CHARP (args[0])) | 1904 if (CHARP (args[0])) |
1905 args[0] = make_int (XCHAR (args[0])); | 1905 args[0] = make_fixnum (XCHAR (args[0])); |
1906 else if (MARKERP (args[0])) | 1906 else if (MARKERP (args[0])) |
1907 args[0] = make_int (marker_position (args[0])); | 1907 args[0] = make_fixnum (marker_position (args[0])); |
1908 for (i = 1; i < nargs; i++) | 1908 for (i = 1; i < nargs; i++) |
1909 { | 1909 { |
1910 comp1 = args[maxindex]; | 1910 comp1 = args[maxindex]; |
1911 comp2 = args[i]; | 1911 comp2 = args[i]; |
1912 switch (promote_args (&comp1, &comp2)) | 1912 switch (promote_args (&comp1, &comp2)) |
1913 { | 1913 { |
1914 case FIXNUM_T: | 1914 case FIXNUM_T: |
1915 if (XREALINT (comp1) < XREALINT (comp2)) | 1915 if (XREALFIXNUM (comp1) < XREALFIXNUM (comp2)) |
1916 maxindex = i; | 1916 maxindex = i; |
1917 break; | 1917 break; |
1918 #ifdef HAVE_BIGNUM | 1918 #ifdef HAVE_BIGNUM |
1919 case BIGNUM_T: | 1919 case BIGNUM_T: |
1920 if (bignum_lt (XBIGNUM_DATA (comp1), XBIGNUM_DATA (comp2))) | 1920 if (bignum_lt (XBIGNUM_DATA (comp1), XBIGNUM_DATA (comp2))) |
1968 if (dmax < iod.c.dval) dmax = iod.c.dval; | 1968 if (dmax < iod.c.dval) dmax = iod.c.dval; |
1969 goto max_floats; | 1969 goto max_floats; |
1970 } | 1970 } |
1971 } | 1971 } |
1972 | 1972 |
1973 return make_int (imax); | 1973 return make_fixnum (imax); |
1974 | 1974 |
1975 max_floats: | 1975 max_floats: |
1976 while (args < args_end) | 1976 while (args < args_end) |
1977 { | 1977 { |
1978 double dval = number_char_or_marker_to_double (*args++); | 1978 double dval = number_char_or_marker_to_double (*args++); |
1997 Lisp_Object comp1, comp2; | 1997 Lisp_Object comp1, comp2; |
1998 | 1998 |
1999 while (!(CHARP (args[0]) || MARKERP (args[0]) || REALP (args[0]))) | 1999 while (!(CHARP (args[0]) || MARKERP (args[0]) || REALP (args[0]))) |
2000 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); | 2000 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); |
2001 if (CHARP (args[0])) | 2001 if (CHARP (args[0])) |
2002 args[0] = make_int (XCHAR (args[0])); | 2002 args[0] = make_fixnum (XCHAR (args[0])); |
2003 else if (MARKERP (args[0])) | 2003 else if (MARKERP (args[0])) |
2004 args[0] = make_int (marker_position (args[0])); | 2004 args[0] = make_fixnum (marker_position (args[0])); |
2005 for (i = 1; i < nargs; i++) | 2005 for (i = 1; i < nargs; i++) |
2006 { | 2006 { |
2007 comp1 = args[minindex]; | 2007 comp1 = args[minindex]; |
2008 comp2 = args[i]; | 2008 comp2 = args[i]; |
2009 switch (promote_args (&comp1, &comp2)) | 2009 switch (promote_args (&comp1, &comp2)) |
2010 { | 2010 { |
2011 case FIXNUM_T: | 2011 case FIXNUM_T: |
2012 if (XREALINT (comp1) > XREALINT (comp2)) | 2012 if (XREALFIXNUM (comp1) > XREALFIXNUM (comp2)) |
2013 minindex = i; | 2013 minindex = i; |
2014 break; | 2014 break; |
2015 #ifdef HAVE_BIGNUM | 2015 #ifdef HAVE_BIGNUM |
2016 case BIGNUM_T: | 2016 case BIGNUM_T: |
2017 if (bignum_gt (XBIGNUM_DATA (comp1), XBIGNUM_DATA (comp2))) | 2017 if (bignum_gt (XBIGNUM_DATA (comp1), XBIGNUM_DATA (comp2))) |
2065 if (dmin > iod.c.dval) dmin = iod.c.dval; | 2065 if (dmin > iod.c.dval) dmin = iod.c.dval; |
2066 goto min_floats; | 2066 goto min_floats; |
2067 } | 2067 } |
2068 } | 2068 } |
2069 | 2069 |
2070 return make_int (imin); | 2070 return make_fixnum (imin); |
2071 | 2071 |
2072 min_floats: | 2072 min_floats: |
2073 while (args < args_end) | 2073 while (args < args_end) |
2074 { | 2074 { |
2075 double dval = number_char_or_marker_to_double (*args++); | 2075 double dval = number_char_or_marker_to_double (*args++); |
2090 #ifdef HAVE_BIGNUM | 2090 #ifdef HAVE_BIGNUM |
2091 REGISTER int i; | 2091 REGISTER int i; |
2092 Lisp_Object result, other; | 2092 Lisp_Object result, other; |
2093 | 2093 |
2094 if (nargs == 0) | 2094 if (nargs == 0) |
2095 return make_int (~0); | 2095 return make_fixnum (~0); |
2096 | 2096 |
2097 while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0]))) | 2097 while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0]))) |
2098 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); | 2098 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); |
2099 | 2099 |
2100 result = args[0]; | 2100 result = args[0]; |
2101 if (CHARP (result)) | 2101 if (CHARP (result)) |
2102 result = make_int (XCHAR (result)); | 2102 result = make_fixnum (XCHAR (result)); |
2103 else if (MARKERP (result)) | 2103 else if (MARKERP (result)) |
2104 result = make_int (marker_position (result)); | 2104 result = make_fixnum (marker_position (result)); |
2105 for (i = 1; i < nargs; i++) | 2105 for (i = 1; i < nargs; i++) |
2106 { | 2106 { |
2107 while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i]))) | 2107 while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i]))) |
2108 args[i] = wrong_type_argument (Qnumber_char_or_marker_p, args[i]); | 2108 args[i] = wrong_type_argument (Qnumber_char_or_marker_p, args[i]); |
2109 other = args[i]; | 2109 other = args[i]; |
2110 switch (promote_args (&result, &other)) | 2110 switch (promote_args (&result, &other)) |
2111 { | 2111 { |
2112 case FIXNUM_T: | 2112 case FIXNUM_T: |
2113 result = make_int (XREALINT (result) & XREALINT (other)); | 2113 result = make_fixnum (XREALFIXNUM (result) & XREALFIXNUM (other)); |
2114 break; | 2114 break; |
2115 case BIGNUM_T: | 2115 case BIGNUM_T: |
2116 bignum_and (scratch_bignum, XBIGNUM_DATA (result), | 2116 bignum_and (scratch_bignum, XBIGNUM_DATA (result), |
2117 XBIGNUM_DATA (other)); | 2117 XBIGNUM_DATA (other)); |
2118 result = make_bignum_bg (scratch_bignum); | 2118 result = make_bignum_bg (scratch_bignum); |
2125 Lisp_Object *args_end = args + nargs; | 2125 Lisp_Object *args_end = args + nargs; |
2126 | 2126 |
2127 while (args < args_end) | 2127 while (args < args_end) |
2128 bits &= fixnum_char_or_marker_to_int (*args++); | 2128 bits &= fixnum_char_or_marker_to_int (*args++); |
2129 | 2129 |
2130 return make_int (bits); | 2130 return make_fixnum (bits); |
2131 #endif /* HAVE_BIGNUM */ | 2131 #endif /* HAVE_BIGNUM */ |
2132 } | 2132 } |
2133 | 2133 |
2134 DEFUN ("logior", Flogior, 0, MANY, 0, /* | 2134 DEFUN ("logior", Flogior, 0, MANY, 0, /* |
2135 Return bitwise-or of all the arguments. | 2135 Return bitwise-or of all the arguments. |
2142 #ifdef HAVE_BIGNUM | 2142 #ifdef HAVE_BIGNUM |
2143 REGISTER int i; | 2143 REGISTER int i; |
2144 Lisp_Object result, other; | 2144 Lisp_Object result, other; |
2145 | 2145 |
2146 if (nargs == 0) | 2146 if (nargs == 0) |
2147 return make_int (0); | 2147 return make_fixnum (0); |
2148 | 2148 |
2149 while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0]))) | 2149 while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0]))) |
2150 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); | 2150 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); |
2151 | 2151 |
2152 result = args[0]; | 2152 result = args[0]; |
2153 if (CHARP (result)) | 2153 if (CHARP (result)) |
2154 result = make_int (XCHAR (result)); | 2154 result = make_fixnum (XCHAR (result)); |
2155 else if (MARKERP (result)) | 2155 else if (MARKERP (result)) |
2156 result = make_int (marker_position (result)); | 2156 result = make_fixnum (marker_position (result)); |
2157 for (i = 1; i < nargs; i++) | 2157 for (i = 1; i < nargs; i++) |
2158 { | 2158 { |
2159 while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i]))) | 2159 while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i]))) |
2160 args[i] = wrong_type_argument (Qnumber_char_or_marker_p, args[i]); | 2160 args[i] = wrong_type_argument (Qnumber_char_or_marker_p, args[i]); |
2161 other = args[i]; | 2161 other = args[i]; |
2162 switch (promote_args (&result, &other)) | 2162 switch (promote_args (&result, &other)) |
2163 { | 2163 { |
2164 case FIXNUM_T: | 2164 case FIXNUM_T: |
2165 result = make_int (XREALINT (result) | XREALINT (other)); | 2165 result = make_fixnum (XREALFIXNUM (result) | XREALFIXNUM (other)); |
2166 break; | 2166 break; |
2167 case BIGNUM_T: | 2167 case BIGNUM_T: |
2168 bignum_ior (scratch_bignum, XBIGNUM_DATA (result), | 2168 bignum_ior (scratch_bignum, XBIGNUM_DATA (result), |
2169 XBIGNUM_DATA (other)); | 2169 XBIGNUM_DATA (other)); |
2170 result = make_bignum_bg (scratch_bignum); | 2170 result = make_bignum_bg (scratch_bignum); |
2177 Lisp_Object *args_end = args + nargs; | 2177 Lisp_Object *args_end = args + nargs; |
2178 | 2178 |
2179 while (args < args_end) | 2179 while (args < args_end) |
2180 bits |= fixnum_char_or_marker_to_int (*args++); | 2180 bits |= fixnum_char_or_marker_to_int (*args++); |
2181 | 2181 |
2182 return make_int (bits); | 2182 return make_fixnum (bits); |
2183 #endif /* HAVE_BIGNUM */ | 2183 #endif /* HAVE_BIGNUM */ |
2184 } | 2184 } |
2185 | 2185 |
2186 DEFUN ("logxor", Flogxor, 0, MANY, 0, /* | 2186 DEFUN ("logxor", Flogxor, 0, MANY, 0, /* |
2187 Return bitwise-exclusive-or of all the arguments. | 2187 Return bitwise-exclusive-or of all the arguments. |
2194 #ifdef HAVE_BIGNUM | 2194 #ifdef HAVE_BIGNUM |
2195 REGISTER int i; | 2195 REGISTER int i; |
2196 Lisp_Object result, other; | 2196 Lisp_Object result, other; |
2197 | 2197 |
2198 if (nargs == 0) | 2198 if (nargs == 0) |
2199 return make_int (0); | 2199 return make_fixnum (0); |
2200 | 2200 |
2201 while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0]))) | 2201 while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0]))) |
2202 args[0] = wrong_type_argument (Qinteger_char_or_marker_p, args[0]); | 2202 args[0] = wrong_type_argument (Qinteger_char_or_marker_p, args[0]); |
2203 | 2203 |
2204 result = args[0]; | 2204 result = args[0]; |
2205 if (CHARP (result)) | 2205 if (CHARP (result)) |
2206 result = make_int (XCHAR (result)); | 2206 result = make_fixnum (XCHAR (result)); |
2207 else if (MARKERP (result)) | 2207 else if (MARKERP (result)) |
2208 result = make_int (marker_position (result)); | 2208 result = make_fixnum (marker_position (result)); |
2209 for (i = 1; i < nargs; i++) | 2209 for (i = 1; i < nargs; i++) |
2210 { | 2210 { |
2211 while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i]))) | 2211 while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i]))) |
2212 args[i] = wrong_type_argument (Qinteger_char_or_marker_p, args[i]); | 2212 args[i] = wrong_type_argument (Qinteger_char_or_marker_p, args[i]); |
2213 other = args[i]; | 2213 other = args[i]; |
2214 if (promote_args (&result, &other) == FIXNUM_T) | 2214 if (promote_args (&result, &other) == FIXNUM_T) |
2215 { | 2215 { |
2216 result = make_int (XREALINT (result) ^ XREALINT (other)); | 2216 result = make_fixnum (XREALFIXNUM (result) ^ XREALFIXNUM (other)); |
2217 } | 2217 } |
2218 else | 2218 else |
2219 { | 2219 { |
2220 bignum_xor (scratch_bignum, XBIGNUM_DATA (result), | 2220 bignum_xor (scratch_bignum, XBIGNUM_DATA (result), |
2221 XBIGNUM_DATA (other)); | 2221 XBIGNUM_DATA (other)); |
2228 Lisp_Object *args_end = args + nargs; | 2228 Lisp_Object *args_end = args + nargs; |
2229 | 2229 |
2230 while (args < args_end) | 2230 while (args < args_end) |
2231 bits ^= fixnum_char_or_marker_to_int (*args++); | 2231 bits ^= fixnum_char_or_marker_to_int (*args++); |
2232 | 2232 |
2233 return make_int (bits); | 2233 return make_fixnum (bits); |
2234 #endif /* !HAVE_BIGNUM */ | 2234 #endif /* !HAVE_BIGNUM */ |
2235 } | 2235 } |
2236 | 2236 |
2237 DEFUN ("lognot", Flognot, 1, 1, 0, /* | 2237 DEFUN ("lognot", Flognot, 1, 1, 0, /* |
2238 Return the bitwise complement of NUMBER. | 2238 Return the bitwise complement of NUMBER. |
2249 bignum_not (scratch_bignum, XBIGNUM_DATA (number)); | 2249 bignum_not (scratch_bignum, XBIGNUM_DATA (number)); |
2250 return make_bignum_bg (scratch_bignum); | 2250 return make_bignum_bg (scratch_bignum); |
2251 } | 2251 } |
2252 #endif /* HAVE_BIGNUM */ | 2252 #endif /* HAVE_BIGNUM */ |
2253 | 2253 |
2254 return make_int (~ fixnum_char_or_marker_to_int (number)); | 2254 return make_fixnum (~ fixnum_char_or_marker_to_int (number)); |
2255 } | 2255 } |
2256 | 2256 |
2257 DEFUN ("%", Frem, 2, 2, 0, /* | 2257 DEFUN ("%", Frem, 2, 2, 0, /* |
2258 Return remainder of first arg divided by second. | 2258 Return remainder of first arg divided by second. |
2259 Both must be integers, characters or markers. | 2259 Both must be integers, characters or markers. |
2266 while (!(CHARP (number2) || MARKERP (number2) || INTEGERP (number2))) | 2266 while (!(CHARP (number2) || MARKERP (number2) || INTEGERP (number2))) |
2267 number2 = wrong_type_argument (Qnumber_char_or_marker_p, number2); | 2267 number2 = wrong_type_argument (Qnumber_char_or_marker_p, number2); |
2268 | 2268 |
2269 if (promote_args (&number1, &number2) == FIXNUM_T) | 2269 if (promote_args (&number1, &number2) == FIXNUM_T) |
2270 { | 2270 { |
2271 if (XREALINT (number2) == 0) | 2271 if (XREALFIXNUM (number2) == 0) |
2272 Fsignal (Qarith_error, Qnil); | 2272 Fsignal (Qarith_error, Qnil); |
2273 return make_int (XREALINT (number1) % XREALINT (number2)); | 2273 return make_fixnum (XREALFIXNUM (number1) % XREALFIXNUM (number2)); |
2274 } | 2274 } |
2275 else | 2275 else |
2276 { | 2276 { |
2277 if (bignum_sign (XBIGNUM_DATA (number2)) == 0) | 2277 if (bignum_sign (XBIGNUM_DATA (number2)) == 0) |
2278 Fsignal (Qarith_error, Qnil); | 2278 Fsignal (Qarith_error, Qnil); |
2285 EMACS_INT ival2 = fixnum_char_or_marker_to_int (number2); | 2285 EMACS_INT ival2 = fixnum_char_or_marker_to_int (number2); |
2286 | 2286 |
2287 if (ival2 == 0) | 2287 if (ival2 == 0) |
2288 Fsignal (Qarith_error, Qnil); | 2288 Fsignal (Qarith_error, Qnil); |
2289 | 2289 |
2290 return make_int (ival1 % ival2); | 2290 return make_fixnum (ival1 % ival2); |
2291 #endif /* HAVE_BIGNUM */ | 2291 #endif /* HAVE_BIGNUM */ |
2292 } | 2292 } |
2293 | 2293 |
2294 /* Note, ANSI *requires* the presence of the fmod() library routine. | 2294 /* Note, ANSI *requires* the presence of the fmod() library routine. |
2295 If your system doesn't have it, complain to your vendor, because | 2295 If your system doesn't have it, complain to your vendor, because |
2322 switch (promote_args (&x, &y)) | 2322 switch (promote_args (&x, &y)) |
2323 { | 2323 { |
2324 case FIXNUM_T: | 2324 case FIXNUM_T: |
2325 { | 2325 { |
2326 EMACS_INT ival; | 2326 EMACS_INT ival; |
2327 if (XREALINT (y) == 0) goto divide_by_zero; | 2327 if (XREALFIXNUM (y) == 0) goto divide_by_zero; |
2328 ival = XREALINT (x) % XREALINT (y); | 2328 ival = XREALFIXNUM (x) % XREALFIXNUM (y); |
2329 /* If the "remainder" comes out with the wrong sign, fix it. */ | 2329 /* If the "remainder" comes out with the wrong sign, fix it. */ |
2330 if (XREALINT (y) < 0 ? ival > 0 : ival < 0) | 2330 if (XREALFIXNUM (y) < 0 ? ival > 0 : ival < 0) |
2331 ival += XREALINT (y); | 2331 ival += XREALFIXNUM (y); |
2332 return make_int (ival); | 2332 return make_fixnum (ival); |
2333 } | 2333 } |
2334 #ifdef HAVE_BIGNUM | 2334 #ifdef HAVE_BIGNUM |
2335 case BIGNUM_T: | 2335 case BIGNUM_T: |
2336 if (bignum_sign (XBIGNUM_DATA (y)) == 0) goto divide_by_zero; | 2336 if (bignum_sign (XBIGNUM_DATA (y)) == 0) goto divide_by_zero; |
2337 bignum_mod (scratch_bignum, XBIGNUM_DATA (x), XBIGNUM_DATA (y)); | 2337 bignum_mod (scratch_bignum, XBIGNUM_DATA (x), XBIGNUM_DATA (y)); |
2396 | 2396 |
2397 /* If the "remainder" comes out with the wrong sign, fix it. */ | 2397 /* If the "remainder" comes out with the wrong sign, fix it. */ |
2398 if (iod2.c.ival < 0 ? ival > 0 : ival < 0) | 2398 if (iod2.c.ival < 0 ? ival > 0 : ival < 0) |
2399 ival += iod2.c.ival; | 2399 ival += iod2.c.ival; |
2400 | 2400 |
2401 return make_int (ival); | 2401 return make_fixnum (ival); |
2402 } | 2402 } |
2403 #endif /* WITH_NUMBER_TYPES */ | 2403 #endif /* WITH_NUMBER_TYPES */ |
2404 | 2404 |
2405 divide_by_zero: | 2405 divide_by_zero: |
2406 Fsignal (Qarith_error, Qnil); | 2406 Fsignal (Qarith_error, Qnil); |
2414 This function cannot be applied to bignums, as there is no leftmost sign bit | 2414 This function cannot be applied to bignums, as there is no leftmost sign bit |
2415 to be duplicated. Use `lsh' instead. | 2415 to be duplicated. Use `lsh' instead. |
2416 */ | 2416 */ |
2417 (value, count)) | 2417 (value, count)) |
2418 { | 2418 { |
2419 CHECK_INT_COERCE_CHAR (value); | 2419 CHECK_FIXNUM_COERCE_CHAR (value); |
2420 CONCHECK_INT (count); | 2420 CONCHECK_FIXNUM (count); |
2421 | 2421 |
2422 return make_int (XINT (count) > 0 ? | 2422 return make_fixnum (XFIXNUM (count) > 0 ? |
2423 XINT (value) << XINT (count) : | 2423 XFIXNUM (value) << XFIXNUM (count) : |
2424 XINT (value) >> -XINT (count)); | 2424 XFIXNUM (value) >> -XFIXNUM (count)); |
2425 } | 2425 } |
2426 | 2426 |
2427 DEFUN ("lsh", Flsh, 2, 2, 0, /* | 2427 DEFUN ("lsh", Flsh, 2, 2, 0, /* |
2428 Return VALUE with its bits shifted left by COUNT. | 2428 Return VALUE with its bits shifted left by COUNT. |
2429 If COUNT is negative, shifting is actually to the right. | 2429 If COUNT is negative, shifting is actually to the right. |
2436 wrong_type_argument (Qnumber_char_or_marker_p, value); | 2436 wrong_type_argument (Qnumber_char_or_marker_p, value); |
2437 CONCHECK_INTEGER (count); | 2437 CONCHECK_INTEGER (count); |
2438 | 2438 |
2439 if (promote_args (&value, &count) == FIXNUM_T) | 2439 if (promote_args (&value, &count) == FIXNUM_T) |
2440 { | 2440 { |
2441 if (XREALINT (count) <= 0) | 2441 if (XREALFIXNUM (count) <= 0) |
2442 return make_int (XREALINT (value) >> -XREALINT (count)); | 2442 return make_fixnum (XREALFIXNUM (value) >> -XREALFIXNUM (count)); |
2443 /* Use bignums to avoid overflow */ | 2443 /* Use bignums to avoid overflow */ |
2444 bignum_set_long (scratch_bignum2, XREALINT (value)); | 2444 bignum_set_long (scratch_bignum2, XREALFIXNUM (value)); |
2445 bignum_lshift (scratch_bignum, scratch_bignum2, XREALINT (count)); | 2445 bignum_lshift (scratch_bignum, scratch_bignum2, XREALFIXNUM (count)); |
2446 return Fcanonicalize_number (make_bignum_bg (scratch_bignum)); | 2446 return Fcanonicalize_number (make_bignum_bg (scratch_bignum)); |
2447 } | 2447 } |
2448 else | 2448 else |
2449 { | 2449 { |
2450 if (bignum_sign (XBIGNUM_DATA (count)) <= 0) | 2450 if (bignum_sign (XBIGNUM_DATA (count)) <= 0) |
2463 bignum_to_ulong (XBIGNUM_DATA (count))); | 2463 bignum_to_ulong (XBIGNUM_DATA (count))); |
2464 } | 2464 } |
2465 return Fcanonicalize_number (make_bignum_bg (scratch_bignum2)); | 2465 return Fcanonicalize_number (make_bignum_bg (scratch_bignum2)); |
2466 } | 2466 } |
2467 #else /* !HAVE_BIGNUM */ | 2467 #else /* !HAVE_BIGNUM */ |
2468 CHECK_INT_COERCE_CHAR (value); | 2468 CHECK_FIXNUM_COERCE_CHAR (value); |
2469 CONCHECK_INT (count); | 2469 CONCHECK_FIXNUM (count); |
2470 | 2470 |
2471 return make_int (XINT (count) > 0 ? | 2471 return make_fixnum (XFIXNUM (count) > 0 ? |
2472 XUINT (value) << XINT (count) : | 2472 XUINT (value) << XFIXNUM (count) : |
2473 XUINT (value) >> -XINT (count)); | 2473 XUINT (value) >> -XFIXNUM (count)); |
2474 #endif /* HAVE_BIGNUM */ | 2474 #endif /* HAVE_BIGNUM */ |
2475 } | 2475 } |
2476 | 2476 |
2477 DEFUN ("1+", Fadd1, 1, 1, 0, /* | 2477 DEFUN ("1+", Fadd1, 1, 1, 0, /* |
2478 Return NUMBER plus one. NUMBER may be a number, character or marker. | 2478 Return NUMBER plus one. NUMBER may be a number, character or marker. |
2480 */ | 2480 */ |
2481 (number)) | 2481 (number)) |
2482 { | 2482 { |
2483 retry: | 2483 retry: |
2484 | 2484 |
2485 if (INTP (number)) return make_integer (XINT (number) + 1); | 2485 if (FIXNUMP (number)) return make_integer (XFIXNUM (number) + 1); |
2486 if (CHARP (number)) return make_integer (XCHAR (number) + 1); | 2486 if (CHARP (number)) return make_integer (XCHAR (number) + 1); |
2487 if (MARKERP (number)) return make_integer (marker_position (number) + 1); | 2487 if (MARKERP (number)) return make_integer (marker_position (number) + 1); |
2488 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) + 1.0); | 2488 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) + 1.0); |
2489 #ifdef HAVE_BIGNUM | 2489 #ifdef HAVE_BIGNUM |
2490 if (BIGNUMP (number)) | 2490 if (BIGNUMP (number)) |
2524 */ | 2524 */ |
2525 (number)) | 2525 (number)) |
2526 { | 2526 { |
2527 retry: | 2527 retry: |
2528 | 2528 |
2529 if (INTP (number)) return make_integer (XINT (number) - 1); | 2529 if (FIXNUMP (number)) return make_integer (XFIXNUM (number) - 1); |
2530 if (CHARP (number)) return make_integer (XCHAR (number) - 1); | 2530 if (CHARP (number)) return make_integer (XCHAR (number) - 1); |
2531 if (MARKERP (number)) return make_integer (marker_position (number) - 1); | 2531 if (MARKERP (number)) return make_integer (marker_position (number) - 1); |
2532 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) - 1.0); | 2532 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) - 1.0); |
2533 #ifdef HAVE_BIGNUM | 2533 #ifdef HAVE_BIGNUM |
2534 if (BIGNUMP (number)) | 2534 if (BIGNUMP (number)) |
3648 dump_add_weak_object_chain (&Vall_weak_boxes); | 3648 dump_add_weak_object_chain (&Vall_weak_boxes); |
3649 | 3649 |
3650 DEFVAR_CONST_INT ("most-negative-fixnum", &Vmost_negative_fixnum /* | 3650 DEFVAR_CONST_INT ("most-negative-fixnum", &Vmost_negative_fixnum /* |
3651 The fixnum closest in value to negative infinity. | 3651 The fixnum closest in value to negative infinity. |
3652 */); | 3652 */); |
3653 Vmost_negative_fixnum = EMACS_INT_MIN; | 3653 Vmost_negative_fixnum = MOST_NEGATIVE_FIXNUM; |
3654 | 3654 |
3655 DEFVAR_CONST_INT ("most-positive-fixnum", &Vmost_positive_fixnum /* | 3655 DEFVAR_CONST_INT ("most-positive-fixnum", &Vmost_positive_fixnum /* |
3656 The fixnum closest in value to positive infinity. | 3656 The fixnum closest in value to positive infinity. |
3657 */); | 3657 */); |
3658 Vmost_positive_fixnum = EMACS_INT_MAX; | 3658 Vmost_positive_fixnum = MOST_POSITIVE_FIXNUM; |
3659 | 3659 |
3660 #ifdef DEBUG_XEMACS | 3660 #ifdef DEBUG_XEMACS |
3661 DEFVAR_BOOL ("debug-issue-ebola-notices", &debug_issue_ebola_notices /* | 3661 DEFVAR_BOOL ("debug-issue-ebola-notices", &debug_issue_ebola_notices /* |
3662 If non-zero, note when your code may be suffering from char-int confoundance. | 3662 If non-zero, note when your code may be suffering from char-int confoundance. |
3663 That is to say, if XEmacs encounters a usage of `eq', `memq', `equal', | 3663 That is to say, if XEmacs encounters a usage of `eq', `memq', `equal', |