Mercurial > hg > xemacs-beta
comparison src/fns.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 | 58b38d5b32d0 |
children | 10f179710250 |
comparison
equal
deleted
inserted
replaced
5580:a0e81357194e | 5581:56144c8593a8 |
---|---|
104 Elemcount i; | 104 Elemcount i; |
105 Lisp_Bit_Vector *v = XBIT_VECTOR (obj); | 105 Lisp_Bit_Vector *v = XBIT_VECTOR (obj); |
106 Elemcount len = bit_vector_length (v); | 106 Elemcount len = bit_vector_length (v); |
107 Elemcount last = len; | 107 Elemcount last = len; |
108 | 108 |
109 if (INTP (Vprint_length)) | 109 if (FIXNUMP (Vprint_length)) |
110 last = min (len, XINT (Vprint_length)); | 110 last = min (len, XFIXNUM (Vprint_length)); |
111 write_ascstring (printcharfun, "#*"); | 111 write_ascstring (printcharfun, "#*"); |
112 for (i = 0; i < last; i++) | 112 for (i = 0; i < last; i++) |
113 { | 113 { |
114 if (bit_vector_bit (v, i)) | 114 if (bit_vector_bit (v, i)) |
115 write_ascstring (printcharfun, "1"); | 115 write_ascstring (printcharfun, "1"); |
619 FROB (eql, 0); | 619 FROB (eql, 0); |
620 else if (SUBRP (test)) | 620 else if (SUBRP (test)) |
621 { | 621 { |
622 force_eq_check: | 622 force_eq_check: |
623 FROB (eq, 0); | 623 FROB (eq, 0); |
624 else FROB (equal, (SYMBOLP (item) || INTP (item) || CHARP (item))); | 624 else FROB (equal, (SYMBOLP (item) || FIXNUMP (item) || CHARP (item))); |
625 else FROB (equalp, (SYMBOLP (item))); | 625 else FROB (equalp, (SYMBOLP (item))); |
626 else if (EQ (test, XSYMBOL_FUNCTION (Qstring_match))) | 626 else if (EQ (test, XSYMBOL_FUNCTION (Qstring_match))) |
627 { | 627 { |
628 if (EQ (Qidentity, key)) | 628 if (EQ (Qidentity, key)) |
629 { | 629 { |
822 are less random than the higher ones. We do this by using the | 822 are less random than the higher ones. We do this by using the |
823 quotient rather than the remainder. At the high end of the RNG | 823 quotient rather than the remainder. At the high end of the RNG |
824 it's possible to get a quotient larger than limit; discarding | 824 it's possible to get a quotient larger than limit; discarding |
825 these values eliminates the bias that would otherwise appear | 825 these values eliminates the bias that would otherwise appear |
826 when using a large limit. */ | 826 when using a large limit. */ |
827 denominator = ((unsigned long)1 << INT_VALBITS) / XINT (limit); | 827 denominator = ((unsigned long)1 << FIXNUM_VALBITS) / XFIXNUM (limit); |
828 do | 828 do |
829 val = get_random () / denominator; | 829 val = get_random () / denominator; |
830 while (val >= XINT (limit)); | 830 while (val >= XFIXNUM (limit)); |
831 } | 831 } |
832 else | 832 else |
833 val = get_random (); | 833 val = get_random (); |
834 | 834 |
835 return make_int (val); | 835 return make_fixnum (val); |
836 } | 836 } |
837 | 837 |
838 /* Random data-structure functions */ | 838 /* Random data-structure functions */ |
839 | 839 |
840 void | 840 void |
852 */ | 852 */ |
853 (sequence)) | 853 (sequence)) |
854 { | 854 { |
855 retry: | 855 retry: |
856 if (STRINGP (sequence)) | 856 if (STRINGP (sequence)) |
857 return make_int (string_char_length (sequence)); | 857 return make_fixnum (string_char_length (sequence)); |
858 else if (CONSP (sequence)) | 858 else if (CONSP (sequence)) |
859 { | 859 { |
860 Elemcount len; | 860 Elemcount len; |
861 GET_EXTERNAL_LIST_LENGTH (sequence, len); | 861 GET_EXTERNAL_LIST_LENGTH (sequence, len); |
862 return make_int (len); | 862 return make_fixnum (len); |
863 } | 863 } |
864 else if (VECTORP (sequence)) | 864 else if (VECTORP (sequence)) |
865 return make_int (XVECTOR_LENGTH (sequence)); | 865 return make_fixnum (XVECTOR_LENGTH (sequence)); |
866 else if (NILP (sequence)) | 866 else if (NILP (sequence)) |
867 return Qzero; | 867 return Qzero; |
868 else if (BIT_VECTORP (sequence)) | 868 else if (BIT_VECTORP (sequence)) |
869 return make_int (bit_vector_length (XBIT_VECTOR (sequence))); | 869 return make_fixnum (bit_vector_length (XBIT_VECTOR (sequence))); |
870 else | 870 else |
871 { | 871 { |
872 check_losing_bytecode ("length", sequence); | 872 check_losing_bytecode ("length", sequence); |
873 sequence = wrong_type_argument (Qsequencep, sequence); | 873 sequence = wrong_type_argument (Qsequencep, sequence); |
874 goto retry; | 874 goto retry; |
892 { | 892 { |
893 if (len & 1) | 893 if (len & 1) |
894 tortoise = XCDR (tortoise); | 894 tortoise = XCDR (tortoise); |
895 } | 895 } |
896 | 896 |
897 return make_int (len); | 897 return make_fixnum (len); |
898 } | 898 } |
899 | 899 |
900 /* This is almost the above, but is defined by Common Lisp. We need it in C | 900 /* This is almost the above, but is defined by Common Lisp. We need it in C |
901 for shortest_length_among_sequences(), below, for the various sequence | 901 for shortest_length_among_sequences(), below, for the various sequence |
902 functions that can usefully operate on circular lists. */ | 902 functions that can usefully operate on circular lists. */ |
921 if (!LISTP (hare)) | 921 if (!LISTP (hare)) |
922 { | 922 { |
923 signal_malformed_list_error (list); | 923 signal_malformed_list_error (list); |
924 } | 924 } |
925 | 925 |
926 return EQ (hare, tortoise) && len != 0 ? Qnil : make_int (len); | 926 return EQ (hare, tortoise) && len != 0 ? Qnil : make_fixnum (len); |
927 } | 927 } |
928 | 928 |
929 static Lisp_Object string_count_from_end (Lisp_Object, Lisp_Object , | 929 static Lisp_Object string_count_from_end (Lisp_Object, Lisp_Object , |
930 check_test_func_t, Boolint, | 930 check_test_func_t, Boolint, |
931 Lisp_Object, Lisp_Object, | 931 Lisp_Object, Lisp_Object, |
943 static Lisp_Object | 943 static Lisp_Object |
944 count_with_tail (Lisp_Object *tail_out, int nargs, Lisp_Object *args, | 944 count_with_tail (Lisp_Object *tail_out, int nargs, Lisp_Object *args, |
945 Lisp_Object caller) | 945 Lisp_Object caller) |
946 { | 946 { |
947 Lisp_Object item = args[0], sequence = args[1]; | 947 Lisp_Object item = args[0], sequence = args[1]; |
948 Elemcount starting = 0, ending = EMACS_INT_MAX, encountered = 0; | 948 Elemcount starting = 0, ending = MOST_POSITIVE_FIXNUM, encountered = 0; |
949 Elemcount len, ii = 0, counting = EMACS_INT_MAX; | 949 Elemcount len, ii = 0, counting = MOST_POSITIVE_FIXNUM; |
950 Boolint test_not_unboundp = 1; | 950 Boolint test_not_unboundp = 1; |
951 check_test_func_t check_test = NULL; | 951 check_test_func_t check_test = NULL; |
952 | 952 |
953 PARSE_KEYWORDS_8 (caller, nargs, args, 9, | 953 PARSE_KEYWORDS_8 (caller, nargs, args, 9, |
954 (test, key, start, end, from_end, test_not, count, | 954 (test, key, start, end, from_end, test_not, count, |
955 if_, if_not), (start = Qzero), 2, 0); | 955 if_, if_not), (start = Qzero), 2, 0); |
956 | 956 |
957 CHECK_SEQUENCE (sequence); | 957 CHECK_SEQUENCE (sequence); |
958 CHECK_NATNUM (start); | 958 CHECK_NATNUM (start); |
959 starting = BIGNUMP (start) ? 1 + EMACS_INT_MAX : XINT (start); | 959 starting = BIGNUMP (start) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (start); |
960 | 960 |
961 if (!NILP (end)) | 961 if (!NILP (end)) |
962 { | 962 { |
963 CHECK_NATNUM (end); | 963 CHECK_NATNUM (end); |
964 ending = BIGNUMP (end) ? 1 + EMACS_INT_MAX : XINT (end); | 964 ending = BIGNUMP (end) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (end); |
965 } | 965 } |
966 | 966 |
967 if (!NILP (count)) | 967 if (!NILP (count)) |
968 { | 968 { |
969 CHECK_INTEGER (count); | 969 CHECK_INTEGER (count); |
970 counting = BIGNUMP (count) ? EMACS_INT_MAX + 1 : XINT (count); | 970 counting = BIGNUMP (count) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (count); |
971 | 971 |
972 /* Our callers should have filtered out non-positive COUNT. */ | 972 /* Our callers should have filtered out non-positive COUNT. */ |
973 assert (counting >= 0); | 973 assert (counting >= 0); |
974 /* And we're not prepared to handle COUNT from any other caller at the | 974 /* And we're not prepared to handle COUNT from any other caller at the |
975 moment. */ | 975 moment. */ |
1002 interested in (a zero or negative COUNT won't ever reach | 1002 interested in (a zero or negative COUNT won't ever reach |
1003 count_with_tail(), our callers will return immediately on seeing | 1003 count_with_tail(), our callers will return immediately on seeing |
1004 it). */ | 1004 it). */ |
1005 if (!NILP (count) && !NILP (from_end)) | 1005 if (!NILP (count) && !NILP (from_end)) |
1006 { | 1006 { |
1007 counting = EMACS_INT_MAX; | 1007 counting = MOST_POSITIVE_FIXNUM; |
1008 } | 1008 } |
1009 | 1009 |
1010 { | 1010 { |
1011 GC_EXTERNAL_LIST_LOOP_3 (elt, sequence, tail) | 1011 GC_EXTERNAL_LIST_LOOP_3 (elt, sequence, tail) |
1012 { | 1012 { |
1087 } | 1087 } |
1088 else | 1088 else |
1089 { | 1089 { |
1090 Lisp_Object object = Qnil; | 1090 Lisp_Object object = Qnil; |
1091 | 1091 |
1092 len = XINT (Flength (sequence)); | 1092 len = XFIXNUM (Flength (sequence)); |
1093 check_sequence_range (sequence, start, end, make_int (len)); | 1093 check_sequence_range (sequence, start, end, make_fixnum (len)); |
1094 | 1094 |
1095 ending = min (ending, len); | 1095 ending = min (ending, len); |
1096 if (0 == len) | 1096 if (0 == len) |
1097 { | 1097 { |
1098 /* Catches the case where we have nil. */ | 1098 /* Catches the case where we have nil. */ |
1101 | 1101 |
1102 if (NILP (from_end)) | 1102 if (NILP (from_end)) |
1103 { | 1103 { |
1104 for (ii = starting; ii < ending && encountered < counting; ii++) | 1104 for (ii = starting; ii < ending && encountered < counting; ii++) |
1105 { | 1105 { |
1106 object = Faref (sequence, make_int (ii)); | 1106 object = Faref (sequence, make_fixnum (ii)); |
1107 if (check_test (test, key, item, object) == test_not_unboundp) | 1107 if (check_test (test, key, item, object) == test_not_unboundp) |
1108 { | 1108 { |
1109 encountered++; | 1109 encountered++; |
1110 } | 1110 } |
1111 } | 1111 } |
1112 } | 1112 } |
1113 else | 1113 else |
1114 { | 1114 { |
1115 for (ii = ending - 1; ii >= starting && encountered < counting; ii--) | 1115 for (ii = ending - 1; ii >= starting && encountered < counting; ii--) |
1116 { | 1116 { |
1117 object = Faref (sequence, make_int (ii)); | 1117 object = Faref (sequence, make_fixnum (ii)); |
1118 if (check_test (test, key, item, object) == test_not_unboundp) | 1118 if (check_test (test, key, item, object) == test_not_unboundp) |
1119 { | 1119 { |
1120 encountered++; | 1120 encountered++; |
1121 } | 1121 } |
1122 } | 1122 } |
1130 list_count_from_end (Lisp_Object item, Lisp_Object sequence, | 1130 list_count_from_end (Lisp_Object item, Lisp_Object sequence, |
1131 check_test_func_t check_test, Boolint test_not_unboundp, | 1131 check_test_func_t check_test, Boolint test_not_unboundp, |
1132 Lisp_Object test, Lisp_Object key, | 1132 Lisp_Object test, Lisp_Object key, |
1133 Lisp_Object start, Lisp_Object end) | 1133 Lisp_Object start, Lisp_Object end) |
1134 { | 1134 { |
1135 Elemcount length = XINT (Flength (sequence)), ii = 0, starting = XINT (start); | 1135 Elemcount length = XFIXNUM (Flength (sequence)), ii = 0, starting = XFIXNUM (start); |
1136 Elemcount ending = NILP (end) ? length : XINT (end), encountered = 0; | 1136 Elemcount ending = NILP (end) ? length : XFIXNUM (end), encountered = 0; |
1137 Lisp_Object *storage; | 1137 Lisp_Object *storage; |
1138 struct gcpro gcpro1; | 1138 struct gcpro gcpro1; |
1139 | 1139 |
1140 check_sequence_range (sequence, start, end, make_integer (length)); | 1140 check_sequence_range (sequence, start, end, make_integer (length)); |
1141 | 1141 |
1174 check_test_func_t check_test, Boolint test_not_unboundp, | 1174 check_test_func_t check_test, Boolint test_not_unboundp, |
1175 Lisp_Object test, Lisp_Object key, | 1175 Lisp_Object test, Lisp_Object key, |
1176 Lisp_Object start, Lisp_Object end) | 1176 Lisp_Object start, Lisp_Object end) |
1177 { | 1177 { |
1178 Elemcount length = string_char_length (sequence), ii = 0; | 1178 Elemcount length = string_char_length (sequence), ii = 0; |
1179 Elemcount starting = XINT (start), ending = NILP (end) ? length : XINT (end); | 1179 Elemcount starting = XFIXNUM (start), ending = NILP (end) ? length : XFIXNUM (end); |
1180 Elemcount encountered = 0; | 1180 Elemcount encountered = 0; |
1181 Ibyte *cursor = XSTRING_DATA (sequence); | 1181 Ibyte *cursor = XSTRING_DATA (sequence); |
1182 Ibyte *endp = cursor + XSTRING_LENGTH (sequence); | 1182 Ibyte *endp = cursor + XSTRING_LENGTH (sequence); |
1183 Ichar *storage; | 1183 Ichar *storage; |
1184 | 1184 |
1306 &matching)); | 1306 &matching)); |
1307 | 1307 |
1308 if (!res) | 1308 if (!res) |
1309 return Qt; | 1309 return Qt; |
1310 else if (res > 0) | 1310 else if (res > 0) |
1311 return make_int (1 + matching); | 1311 return make_fixnum (1 + matching); |
1312 else | 1312 else |
1313 return make_int (-1 - matching); | 1313 return make_fixnum (-1 - matching); |
1314 } | 1314 } |
1315 | 1315 |
1316 DEFUN ("string-lessp", Fstring_lessp, 2, 2, 0, /* | 1316 DEFUN ("string-lessp", Fstring_lessp, 2, 2, 0, /* |
1317 Return t if first arg string is less than second in lexicographic order. | 1317 Return t if first arg string is less than second in lexicographic order. |
1318 Comparison is simply done on a character-by-character basis using the | 1318 Comparison is simply done on a character-by-character basis using the |
1383 of the string are changed (e.g. with `aset'). It wraps around occasionally. | 1383 of the string are changed (e.g. with `aset'). It wraps around occasionally. |
1384 */ | 1384 */ |
1385 (string)) | 1385 (string)) |
1386 { | 1386 { |
1387 CHECK_STRING (string); | 1387 CHECK_STRING (string); |
1388 if (CONSP (XSTRING_PLIST (string)) && INTP (XCAR (XSTRING_PLIST (string)))) | 1388 if (CONSP (XSTRING_PLIST (string)) && FIXNUMP (XCAR (XSTRING_PLIST (string)))) |
1389 return XCAR (XSTRING_PLIST (string)); | 1389 return XCAR (XSTRING_PLIST (string)); |
1390 else | 1390 else |
1391 return Qzero; | 1391 return Qzero; |
1392 } | 1392 } |
1393 | 1393 |
1401 if there is one. */ | 1401 if there is one. */ |
1402 #endif | 1402 #endif |
1403 /* skip over extent info if it's there */ | 1403 /* skip over extent info if it's there */ |
1404 if (CONSP (*ptr) && EXTENT_INFOP (XCAR (*ptr))) | 1404 if (CONSP (*ptr) && EXTENT_INFOP (XCAR (*ptr))) |
1405 ptr = &XCDR (*ptr); | 1405 ptr = &XCDR (*ptr); |
1406 if (CONSP (*ptr) && INTP (XCAR (*ptr))) | 1406 if (CONSP (*ptr) && FIXNUMP (XCAR (*ptr))) |
1407 XCAR (*ptr) = make_int (1+XINT (XCAR (*ptr))); | 1407 XCAR (*ptr) = make_fixnum (1+XFIXNUM (XCAR (*ptr))); |
1408 else | 1408 else |
1409 *ptr = Fcons (make_int (1), *ptr); | 1409 *ptr = Fcons (make_fixnum (1), *ptr); |
1410 } | 1410 } |
1411 | 1411 |
1412 | 1412 |
1413 enum concat_target_type { c_cons, c_string, c_vector, c_bit_vector }; | 1413 enum concat_target_type { c_cons, c_string, c_vector, c_bit_vector }; |
1414 static Lisp_Object concat (int nargs, Lisp_Object *args, | 1414 static Lisp_Object concat (int nargs, Lisp_Object *args, |
1628 if (LISTP (seq)) | 1628 if (LISTP (seq)) |
1629 ; | 1629 ; |
1630 else if (VECTORP (seq) || STRINGP (seq) || BIT_VECTORP (seq)) | 1630 else if (VECTORP (seq) || STRINGP (seq) || BIT_VECTORP (seq)) |
1631 ; | 1631 ; |
1632 #if 0 /* removed for XEmacs 21 */ | 1632 #if 0 /* removed for XEmacs 21 */ |
1633 else if (INTP (seq)) | 1633 else if (FIXNUMP (seq)) |
1634 /* This is too revolting to think about but maintains | 1634 /* This is too revolting to think about but maintains |
1635 compatibility with FSF (and lots and lots of old code). */ | 1635 compatibility with FSF (and lots and lots of old code). */ |
1636 args[argnum] = Fnumber_to_string (seq); | 1636 args[argnum] = Fnumber_to_string (seq); |
1637 #endif | 1637 #endif |
1638 else | 1638 else |
1656 with Bytecounts in strings */ | 1656 with Bytecounts in strings */ |
1657 Charcount total_length; | 1657 Charcount total_length; |
1658 | 1658 |
1659 for (argnum = 0, total_length = 0; argnum < nargs; argnum++) | 1659 for (argnum = 0, total_length = 0; argnum < nargs; argnum++) |
1660 { | 1660 { |
1661 Charcount thislen = XINT (Flength (args[argnum])); | 1661 Charcount thislen = XFIXNUM (Flength (args[argnum])); |
1662 total_length += thislen; | 1662 total_length += thislen; |
1663 } | 1663 } |
1664 | 1664 |
1665 switch (target_type) | 1665 switch (target_type) |
1666 { | 1666 { |
1669 { | 1669 { |
1670 unbind_to (sdep); | 1670 unbind_to (sdep); |
1671 /* In append, if all but last arg are nil, return last arg */ | 1671 /* In append, if all but last arg are nil, return last arg */ |
1672 RETURN_UNGCPRO (last_tail); | 1672 RETURN_UNGCPRO (last_tail); |
1673 } | 1673 } |
1674 val = Fmake_list (make_int (total_length), Qnil); | 1674 val = Fmake_list (make_fixnum (total_length), Qnil); |
1675 break; | 1675 break; |
1676 case c_vector: | 1676 case c_vector: |
1677 val = make_vector (total_length, Qnil); | 1677 val = make_vector (total_length, Qnil); |
1678 break; | 1678 break; |
1679 case c_bit_vector: | 1679 case c_bit_vector: |
1717 Ibyte *string_source_ptr = 0; | 1717 Ibyte *string_source_ptr = 0; |
1718 Ibyte *string_prev_result_ptr = string_result_ptr; | 1718 Ibyte *string_prev_result_ptr = string_result_ptr; |
1719 | 1719 |
1720 if (!CONSP (seq)) | 1720 if (!CONSP (seq)) |
1721 { | 1721 { |
1722 thisleni = XINT (Flength (seq)); | 1722 thisleni = XFIXNUM (Flength (seq)); |
1723 } | 1723 } |
1724 if (STRINGP (seq)) | 1724 if (STRINGP (seq)) |
1725 string_source_ptr = XSTRING_DATA (seq); | 1725 string_source_ptr = XSTRING_DATA (seq); |
1726 | 1726 |
1727 while (1) | 1727 while (1) |
1749 INC_IBYTEPTR (string_source_ptr); | 1749 INC_IBYTEPTR (string_source_ptr); |
1750 } | 1750 } |
1751 else if (VECTORP (seq)) | 1751 else if (VECTORP (seq)) |
1752 elt = XVECTOR_DATA (seq)[thisindex]; | 1752 elt = XVECTOR_DATA (seq)[thisindex]; |
1753 else if (BIT_VECTORP (seq)) | 1753 else if (BIT_VECTORP (seq)) |
1754 elt = make_int (bit_vector_bit (XBIT_VECTOR (seq), | 1754 elt = make_fixnum (bit_vector_bit (XBIT_VECTOR (seq), |
1755 thisindex)); | 1755 thisindex)); |
1756 else | 1756 else |
1757 elt = Felt (seq, make_int (thisindex)); | 1757 elt = Felt (seq, make_fixnum (thisindex)); |
1758 thisindex++; | 1758 thisindex++; |
1759 } | 1759 } |
1760 | 1760 |
1761 /* Store into result */ | 1761 /* Store into result */ |
1762 if (toindex < 0) | 1762 if (toindex < 0) |
1769 else if (VECTORP (val)) | 1769 else if (VECTORP (val)) |
1770 XVECTOR_DATA (val)[toindex++] = elt; | 1770 XVECTOR_DATA (val)[toindex++] = elt; |
1771 else if (BIT_VECTORP (val)) | 1771 else if (BIT_VECTORP (val)) |
1772 { | 1772 { |
1773 CHECK_BIT (elt); | 1773 CHECK_BIT (elt); |
1774 set_bit_vector_bit (XBIT_VECTOR (val), toindex++, XINT (elt)); | 1774 set_bit_vector_bit (XBIT_VECTOR (val), toindex++, XFIXNUM (elt)); |
1775 } | 1775 } |
1776 else | 1776 else |
1777 { | 1777 { |
1778 CHECK_CHAR_COERCE_INT (elt); | 1778 CHECK_CHAR_COERCE_INT (elt); |
1779 string_result_ptr += set_itext_ichar (string_result_ptr, | 1779 string_result_ptr += set_itext_ichar (string_result_ptr, |
1898 See also `substring-no-properties', which only operates on strings, and does | 1898 See also `substring-no-properties', which only operates on strings, and does |
1899 not copy extent data. | 1899 not copy extent data. |
1900 */ | 1900 */ |
1901 (sequence, start, end)) | 1901 (sequence, start, end)) |
1902 { | 1902 { |
1903 Elemcount len, ss, ee = EMACS_INT_MAX, ii; | 1903 Elemcount len, ss, ee = MOST_POSITIVE_FIXNUM, ii; |
1904 Lisp_Object result = Qnil; | 1904 Lisp_Object result = Qnil; |
1905 | 1905 |
1906 CHECK_SEQUENCE (sequence); | 1906 CHECK_SEQUENCE (sequence); |
1907 CHECK_INT (start); | 1907 CHECK_FIXNUM (start); |
1908 ss = XINT (start); | 1908 ss = XFIXNUM (start); |
1909 | 1909 |
1910 if (!NILP (end)) | 1910 if (!NILP (end)) |
1911 { | 1911 { |
1912 CHECK_INT (end); | 1912 CHECK_FIXNUM (end); |
1913 ee = XINT (end); | 1913 ee = XFIXNUM (end); |
1914 } | 1914 } |
1915 | 1915 |
1916 if (STRINGP (sequence)) | 1916 if (STRINGP (sequence)) |
1917 { | 1917 { |
1918 Bytecount bstart, blen; | 1918 Bytecount bstart, blen; |
1930 { | 1930 { |
1931 Lisp_Object result_tail, saved = sequence; | 1931 Lisp_Object result_tail, saved = sequence; |
1932 | 1932 |
1933 if (ss < 0 || ee < 0) | 1933 if (ss < 0 || ee < 0) |
1934 { | 1934 { |
1935 len = XINT (Flength (sequence)); | 1935 len = XFIXNUM (Flength (sequence)); |
1936 if (ss < 0) | 1936 if (ss < 0) |
1937 { | 1937 { |
1938 ss = len + ss; | 1938 ss = len + ss; |
1939 start = make_integer (ss); | 1939 start = make_integer (ss); |
1940 } | 1940 } |
1950 } | 1950 } |
1951 } | 1951 } |
1952 | 1952 |
1953 if (0 != ss) | 1953 if (0 != ss) |
1954 { | 1954 { |
1955 sequence = Fnthcdr (make_int (ss), sequence); | 1955 sequence = Fnthcdr (make_fixnum (ss), sequence); |
1956 } | 1956 } |
1957 | 1957 |
1958 ii = ss + 1; | 1958 ii = ss + 1; |
1959 | 1959 |
1960 if (ss < ee && !NILP (sequence)) | 1960 if (ss < ee && !NILP (sequence)) |
1987 check_sequence_range (saved, start, end, Flength (saved)); | 1987 check_sequence_range (saved, start, end, Flength (saved)); |
1988 } | 1988 } |
1989 } | 1989 } |
1990 else | 1990 else |
1991 { | 1991 { |
1992 len = XINT (Flength (sequence)); | 1992 len = XFIXNUM (Flength (sequence)); |
1993 if (ss < 0) | 1993 if (ss < 0) |
1994 { | 1994 { |
1995 ss = len + ss; | 1995 ss = len + ss; |
1996 start = make_integer (ss); | 1996 start = make_integer (ss); |
1997 } | 1997 } |
2004 else | 2004 else |
2005 { | 2005 { |
2006 ee = min (len, ee); | 2006 ee = min (len, ee); |
2007 } | 2007 } |
2008 | 2008 |
2009 check_sequence_range (sequence, start, end, make_int (len)); | 2009 check_sequence_range (sequence, start, end, make_fixnum (len)); |
2010 | 2010 |
2011 if (VECTORP (sequence)) | 2011 if (VECTORP (sequence)) |
2012 { | 2012 { |
2013 result = Fvector (ee - ss, XVECTOR_DATA (sequence) + ss); | 2013 result = Fvector (ee - ss, XVECTOR_DATA (sequence) + ss); |
2014 } | 2014 } |
2258 { | 2258 { |
2259 /* This function can GC */ | 2259 /* This function can GC */ |
2260 REGISTER EMACS_INT i; | 2260 REGISTER EMACS_INT i; |
2261 REGISTER Lisp_Object tail = list; | 2261 REGISTER Lisp_Object tail = list; |
2262 CHECK_NATNUM (n); | 2262 CHECK_NATNUM (n); |
2263 for (i = BIGNUMP (n) ? 1 + EMACS_INT_MAX : XINT (n); i; i--) | 2263 for (i = BIGNUMP (n) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (n); i; i--) |
2264 { | 2264 { |
2265 if (CONSP (tail)) | 2265 if (CONSP (tail)) |
2266 tail = XCDR (tail); | 2266 tail = XCDR (tail); |
2267 else if (NILP (tail)) | 2267 else if (NILP (tail)) |
2268 return Qnil; | 2268 return Qnil; |
2290 */ | 2290 */ |
2291 (sequence, n)) | 2291 (sequence, n)) |
2292 { | 2292 { |
2293 /* This function can GC */ | 2293 /* This function can GC */ |
2294 retry: | 2294 retry: |
2295 CHECK_INT_COERCE_CHAR (n); /* yuck! */ | 2295 CHECK_FIXNUM_COERCE_CHAR (n); /* yuck! */ |
2296 if (LISTP (sequence)) | 2296 if (LISTP (sequence)) |
2297 { | 2297 { |
2298 Lisp_Object tem = Fnthcdr (n, sequence); | 2298 Lisp_Object tem = Fnthcdr (n, sequence); |
2299 /* #### Utterly, completely, fucking disgusting. | 2299 /* #### Utterly, completely, fucking disgusting. |
2300 * #### The whole point of "elt" is that it operates on | 2300 * #### The whole point of "elt" is that it operates on |
2340 if (NILP (n)) | 2340 if (NILP (n)) |
2341 int_n = 1; | 2341 int_n = 1; |
2342 else | 2342 else |
2343 { | 2343 { |
2344 CHECK_NATNUM (n); | 2344 CHECK_NATNUM (n); |
2345 int_n = BIGNUMP (n) ? 1 + EMACS_INT_MAX : XINT (n); | 2345 int_n = BIGNUMP (n) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (n); |
2346 } | 2346 } |
2347 | 2347 |
2348 for (retval = tortoise = hare = list, count = 0; | 2348 for (retval = tortoise = hare = list, count = 0; |
2349 CONSP (hare); | 2349 CONSP (hare); |
2350 hare = XCDR (hare), | 2350 hare = XCDR (hare), |
2375 CHECK_LIST (list); | 2375 CHECK_LIST (list); |
2376 | 2376 |
2377 if (!NILP (n)) | 2377 if (!NILP (n)) |
2378 { | 2378 { |
2379 CHECK_NATNUM (n); | 2379 CHECK_NATNUM (n); |
2380 int_n = BIGNUMP (n) ? 1 + EMACS_INT_MAX : XINT (n); | 2380 int_n = BIGNUMP (n) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (n); |
2381 } | 2381 } |
2382 | 2382 |
2383 if (CONSP (list)) | 2383 if (CONSP (list)) |
2384 { | 2384 { |
2385 Lisp_Object last_cons = list; | 2385 Lisp_Object last_cons = list; |
2423 CHECK_LIST (list); | 2423 CHECK_LIST (list); |
2424 | 2424 |
2425 if (!NILP (n)) | 2425 if (!NILP (n)) |
2426 { | 2426 { |
2427 CHECK_NATNUM (n); | 2427 CHECK_NATNUM (n); |
2428 int_n = BIGNUMP (n) ? 1 + EMACS_INT_MAX : XINT (n); | 2428 int_n = BIGNUMP (n) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (n); |
2429 } | 2429 } |
2430 | 2430 |
2431 if (CONSP (list)) | 2431 if (CONSP (list)) |
2432 { | 2432 { |
2433 Lisp_Object tail = list; | 2433 Lisp_Object tail = list; |
2515 Boolint reverse_test_order, | 2515 Boolint reverse_test_order, |
2516 Lisp_Object start, Lisp_Object end) | 2516 Lisp_Object start, Lisp_Object end) |
2517 { | 2517 { |
2518 struct gcpro gcpro1; | 2518 struct gcpro gcpro1; |
2519 Lisp_Object tail_before = Qnil; | 2519 Lisp_Object tail_before = Qnil; |
2520 Elemcount ii = 0, starting = XINT (start); | 2520 Elemcount ii = 0, starting = XFIXNUM (start); |
2521 Elemcount ending = NILP (end) ? EMACS_INT_MAX : XINT (end); | 2521 Elemcount ending = NILP (end) ? MOST_POSITIVE_FIXNUM : XFIXNUM (end); |
2522 | 2522 |
2523 GCPRO1 (tail_before); | 2523 GCPRO1 (tail_before); |
2524 | 2524 |
2525 if (check_test == check_eq_nokey) | 2525 if (check_test == check_eq_nokey) |
2526 { | 2526 { |
2880 check_test_func_t check_test, Boolint test_not_unboundp, | 2880 check_test_func_t check_test, Boolint test_not_unboundp, |
2881 Lisp_Object test, Lisp_Object key, Lisp_Object start, Lisp_Object end, | 2881 Lisp_Object test, Lisp_Object key, Lisp_Object start, Lisp_Object end, |
2882 Lisp_Object from_end, Lisp_Object default_, Lisp_Object caller) | 2882 Lisp_Object from_end, Lisp_Object default_, Lisp_Object caller) |
2883 { | 2883 { |
2884 Lisp_Object result = Qnil; | 2884 Lisp_Object result = Qnil; |
2885 Elemcount starting = 0, ending = EMACS_INT_MAX, len, ii = 0; | 2885 Elemcount starting = 0, ending = MOST_POSITIVE_FIXNUM, len, ii = 0; |
2886 | 2886 |
2887 CHECK_SEQUENCE (sequence); | 2887 CHECK_SEQUENCE (sequence); |
2888 CHECK_NATNUM (start); | 2888 CHECK_NATNUM (start); |
2889 starting = INTP (start) ? XINT (start) : 1 + EMACS_INT_MAX; | 2889 starting = FIXNUMP (start) ? XFIXNUM (start) : 1 + MOST_POSITIVE_FIXNUM; |
2890 | 2890 |
2891 if (!NILP (end)) | 2891 if (!NILP (end)) |
2892 { | 2892 { |
2893 CHECK_NATNUM (end); | 2893 CHECK_NATNUM (end); |
2894 ending = INTP (end) ? XINT (end) : 1 + EMACS_INT_MAX; | 2894 ending = FIXNUMP (end) ? XFIXNUM (end) : 1 + MOST_POSITIVE_FIXNUM; |
2895 } | 2895 } |
2896 | 2896 |
2897 *object_out = default_; | 2897 *object_out = default_; |
2898 | 2898 |
2899 if (CONSP (sequence)) | 2899 if (CONSP (sequence)) |
2979 } | 2979 } |
2980 } | 2980 } |
2981 else | 2981 else |
2982 { | 2982 { |
2983 Lisp_Object object = Qnil; | 2983 Lisp_Object object = Qnil; |
2984 len = XINT (Flength (sequence)); | 2984 len = XFIXNUM (Flength (sequence)); |
2985 check_sequence_range (sequence, start, end, make_int (len)); | 2985 check_sequence_range (sequence, start, end, make_fixnum (len)); |
2986 | 2986 |
2987 ending = min (ending, len); | 2987 ending = min (ending, len); |
2988 if (0 == len) | 2988 if (0 == len) |
2989 { | 2989 { |
2990 /* Catches the case where we have nil. */ | 2990 /* Catches the case where we have nil. */ |
2993 | 2993 |
2994 if (NILP (from_end)) | 2994 if (NILP (from_end)) |
2995 { | 2995 { |
2996 for (ii = starting; ii < ending; ii++) | 2996 for (ii = starting; ii < ending; ii++) |
2997 { | 2997 { |
2998 object = Faref (sequence, make_int (ii)); | 2998 object = Faref (sequence, make_fixnum (ii)); |
2999 if (check_test (test, key, item, object) == test_not_unboundp) | 2999 if (check_test (test, key, item, object) == test_not_unboundp) |
3000 { | 3000 { |
3001 result = make_integer (ii); | 3001 result = make_integer (ii); |
3002 *object_out = object; | 3002 *object_out = object; |
3003 return result; | 3003 return result; |
3006 } | 3006 } |
3007 else | 3007 else |
3008 { | 3008 { |
3009 for (ii = ending - 1; ii >= starting; ii--) | 3009 for (ii = ending - 1; ii >= starting; ii--) |
3010 { | 3010 { |
3011 object = Faref (sequence, make_int (ii)); | 3011 object = Faref (sequence, make_fixnum (ii)); |
3012 if (check_test (test, key, item, object) == test_not_unboundp) | 3012 if (check_test (test, key, item, object) == test_not_unboundp) |
3013 { | 3013 { |
3014 result = make_integer (ii); | 3014 result = make_integer (ii); |
3015 *object_out = object; | 3015 *object_out = object; |
3016 return result; | 3016 return result; |
3136 arguments: (ITEM SEQUENCE &key (TEST #'eql) (KEY #'identity) (START 0) (END (length SEQUENCE)) FROM-END COUNT TEST-NOT) | 3136 arguments: (ITEM SEQUENCE &key (TEST #'eql) (KEY #'identity) (START 0) (END (length SEQUENCE)) FROM-END COUNT TEST-NOT) |
3137 */ | 3137 */ |
3138 (int nargs, Lisp_Object *args)) | 3138 (int nargs, Lisp_Object *args)) |
3139 { | 3139 { |
3140 Lisp_Object item = args[0], sequence = args[1]; | 3140 Lisp_Object item = args[0], sequence = args[1]; |
3141 Elemcount starting = 0, ending = EMACS_INT_MAX, counting = EMACS_INT_MAX; | 3141 Elemcount starting = 0, ending = MOST_POSITIVE_FIXNUM, counting = MOST_POSITIVE_FIXNUM; |
3142 Elemcount len, ii = 0, encountered = 0, presenting = 0; | 3142 Elemcount len, ii = 0, encountered = 0, presenting = 0; |
3143 Boolint test_not_unboundp = 1; | 3143 Boolint test_not_unboundp = 1; |
3144 check_test_func_t check_test = NULL; | 3144 check_test_func_t check_test = NULL; |
3145 | 3145 |
3146 PARSE_KEYWORDS (FdeleteX, nargs, args, 9, | 3146 PARSE_KEYWORDS (FdeleteX, nargs, args, 9, |
3147 (test, if_not, if_, test_not, key, start, end, from_end, | 3147 (test, if_not, if_, test_not, key, start, end, from_end, |
3148 count), (start = Qzero, count = Qunbound)); | 3148 count), (start = Qzero, count = Qunbound)); |
3149 | 3149 |
3150 CHECK_SEQUENCE (sequence); | 3150 CHECK_SEQUENCE (sequence); |
3151 CHECK_NATNUM (start); | 3151 CHECK_NATNUM (start); |
3152 starting = BIGNUMP (start) ? 1 + EMACS_INT_MAX : XINT (start); | 3152 starting = BIGNUMP (start) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (start); |
3153 | 3153 |
3154 if (!NILP (end)) | 3154 if (!NILP (end)) |
3155 { | 3155 { |
3156 CHECK_NATNUM (end); | 3156 CHECK_NATNUM (end); |
3157 ending = BIGNUMP (end) ? 1 + EMACS_INT_MAX : XINT (end); | 3157 ending = BIGNUMP (end) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (end); |
3158 } | 3158 } |
3159 | 3159 |
3160 if (!UNBOUNDP (count)) | 3160 if (!UNBOUNDP (count)) |
3161 { | 3161 { |
3162 if (!NILP (count)) | 3162 if (!NILP (count)) |
3163 { | 3163 { |
3164 CHECK_INTEGER (count); | 3164 CHECK_INTEGER (count); |
3165 if (INTP (count)) | 3165 if (FIXNUMP (count)) |
3166 { | 3166 { |
3167 counting = XINT (count); | 3167 counting = XFIXNUM (count); |
3168 } | 3168 } |
3169 #ifdef HAVE_BIGNUM | 3169 #ifdef HAVE_BIGNUM |
3170 else | 3170 else |
3171 { | 3171 { |
3172 counting = bignum_sign (XBIGNUM_DATA (count)) > 0 ? | 3172 counting = bignum_sign (XBIGNUM_DATA (count)) > 0 ? |
3173 1 + EMACS_INT_MAX : EMACS_INT_MIN - 1; | 3173 1 + MOST_POSITIVE_FIXNUM : MOST_NEGATIVE_FIXNUM - 1; |
3174 } | 3174 } |
3175 #endif | 3175 #endif |
3176 | 3176 |
3177 if (counting < 1) | 3177 if (counting < 1) |
3178 { | 3178 { |
3218 if (ZEROP (present)) | 3218 if (ZEROP (present)) |
3219 { | 3219 { |
3220 return sequence; | 3220 return sequence; |
3221 } | 3221 } |
3222 | 3222 |
3223 presenting = XINT (present); | 3223 presenting = XFIXNUM (present); |
3224 | 3224 |
3225 /* If there are fewer items in the list than we have permission to | 3225 /* If there are fewer items in the list than we have permission to |
3226 delete, we don't need to differentiate between the :from-end | 3226 delete, we don't need to differentiate between the :from-end |
3227 nil and :from-end t cases. Otherwise, presenting is the number | 3227 nil and :from-end t cases. Otherwise, presenting is the number |
3228 of matching items we need to ignore before we start to | 3228 of matching items we need to ignore before we start to |
3272 | 3272 |
3273 if ((ii < starting || (ii < ending && !NILP (end))) && | 3273 if ((ii < starting || (ii < ending && !NILP (end))) && |
3274 !(presenting ? encountered == presenting : encountered == counting)) | 3274 !(presenting ? encountered == presenting : encountered == counting)) |
3275 { | 3275 { |
3276 check_sequence_range (args[1], start, end, | 3276 check_sequence_range (args[1], start, end, |
3277 make_int (deleted + XINT (Flength (args[1])))); | 3277 make_fixnum (deleted + XFIXNUM (Flength (args[1])))); |
3278 } | 3278 } |
3279 | 3279 |
3280 return sequence; | 3280 return sequence; |
3281 } | 3281 } |
3282 else if (STRINGP (sequence)) | 3282 else if (STRINGP (sequence)) |
3295 if (ZEROP (present)) | 3295 if (ZEROP (present)) |
3296 { | 3296 { |
3297 return sequence; | 3297 return sequence; |
3298 } | 3298 } |
3299 | 3299 |
3300 presenting = XINT (present); | 3300 presenting = XFIXNUM (present); |
3301 | 3301 |
3302 /* If there are fewer items in the list than we have permission to | 3302 /* If there are fewer items in the list than we have permission to |
3303 delete, we don't need to differentiate between the :from-end | 3303 delete, we don't need to differentiate between the :from-end |
3304 nil and :from-end t cases. Otherwise, presenting is the number | 3304 nil and :from-end t cases. Otherwise, presenting is the number |
3305 of matching items we need to ignore before we start to | 3305 of matching items we need to ignore before we start to |
3364 { | 3364 { |
3365 Lisp_Object position0 = Qnil, object = Qnil; | 3365 Lisp_Object position0 = Qnil, object = Qnil; |
3366 Lisp_Object *staging = NULL, *staging_cursor, *staging_limit; | 3366 Lisp_Object *staging = NULL, *staging_cursor, *staging_limit; |
3367 Elemcount positioning; | 3367 Elemcount positioning; |
3368 | 3368 |
3369 len = XINT (Flength (sequence)); | 3369 len = XFIXNUM (Flength (sequence)); |
3370 | 3370 |
3371 check_sequence_range (sequence, start, end, make_int (len)); | 3371 check_sequence_range (sequence, start, end, make_fixnum (len)); |
3372 | 3372 |
3373 position0 = position (&object, item, sequence, check_test, | 3373 position0 = position (&object, item, sequence, check_test, |
3374 test_not_unboundp, test, key, start, end, | 3374 test_not_unboundp, test, key, start, end, |
3375 from_end, Qnil, QdeleteX); | 3375 from_end, Qnil, QdeleteX); |
3376 if (NILP (position0)) | 3376 if (NILP (position0)) |
3377 { | 3377 { |
3378 return sequence; | 3378 return sequence; |
3379 } | 3379 } |
3380 | 3380 |
3381 ending = min (ending, len); | 3381 ending = min (ending, len); |
3382 positioning = XINT (position0); | 3382 positioning = XFIXNUM (position0); |
3383 encountered = 1; | 3383 encountered = 1; |
3384 | 3384 |
3385 if (NILP (from_end)) | 3385 if (NILP (from_end)) |
3386 { | 3386 { |
3387 staging = alloca_array (Lisp_Object, len - 1); | 3387 staging = alloca_array (Lisp_Object, len - 1); |
3388 staging_cursor = staging; | 3388 staging_cursor = staging; |
3389 | 3389 |
3390 ii = 0; | 3390 ii = 0; |
3391 while (ii < positioning) | 3391 while (ii < positioning) |
3392 { | 3392 { |
3393 *staging_cursor++ = Faref (sequence, make_int (ii)); | 3393 *staging_cursor++ = Faref (sequence, make_fixnum (ii)); |
3394 ii++; | 3394 ii++; |
3395 } | 3395 } |
3396 | 3396 |
3397 ii = positioning + 1; | 3397 ii = positioning + 1; |
3398 while (ii < ending) | 3398 while (ii < ending) |
3399 { | 3399 { |
3400 object = Faref (sequence, make_int (ii)); | 3400 object = Faref (sequence, make_fixnum (ii)); |
3401 if (encountered < counting | 3401 if (encountered < counting |
3402 && (check_test (test, key, item, object) | 3402 && (check_test (test, key, item, object) |
3403 == test_not_unboundp)) | 3403 == test_not_unboundp)) |
3404 { | 3404 { |
3405 encountered++; | 3405 encountered++; |
3411 ii++; | 3411 ii++; |
3412 } | 3412 } |
3413 | 3413 |
3414 while (ii < len) | 3414 while (ii < len) |
3415 { | 3415 { |
3416 *staging_cursor++ = Faref (sequence, make_int (ii)); | 3416 *staging_cursor++ = Faref (sequence, make_fixnum (ii)); |
3417 ii++; | 3417 ii++; |
3418 } | 3418 } |
3419 } | 3419 } |
3420 else | 3420 else |
3421 { | 3421 { |
3423 staging_cursor = staging_limit = staging + len - 1; | 3423 staging_cursor = staging_limit = staging + len - 1; |
3424 | 3424 |
3425 ii = len - 1; | 3425 ii = len - 1; |
3426 while (ii > positioning) | 3426 while (ii > positioning) |
3427 { | 3427 { |
3428 *--staging_cursor = Faref (sequence, make_int (ii)); | 3428 *--staging_cursor = Faref (sequence, make_fixnum (ii)); |
3429 ii--; | 3429 ii--; |
3430 } | 3430 } |
3431 | 3431 |
3432 ii = positioning - 1; | 3432 ii = positioning - 1; |
3433 while (ii >= starting) | 3433 while (ii >= starting) |
3434 { | 3434 { |
3435 object = Faref (sequence, make_int (ii)); | 3435 object = Faref (sequence, make_fixnum (ii)); |
3436 if (encountered < counting | 3436 if (encountered < counting |
3437 && (check_test (test, key, item, object) == | 3437 && (check_test (test, key, item, object) == |
3438 test_not_unboundp)) | 3438 test_not_unboundp)) |
3439 { | 3439 { |
3440 encountered++; | 3440 encountered++; |
3447 ii--; | 3447 ii--; |
3448 } | 3448 } |
3449 | 3449 |
3450 while (ii >= 0) | 3450 while (ii >= 0) |
3451 { | 3451 { |
3452 *--staging_cursor = Faref (sequence, make_int (ii)); | 3452 *--staging_cursor = Faref (sequence, make_fixnum (ii)); |
3453 ii--; | 3453 ii--; |
3454 } | 3454 } |
3455 | 3455 |
3456 staging = staging_cursor; | 3456 staging = staging_cursor; |
3457 staging_cursor = staging_limit; | 3457 staging_cursor = staging_limit; |
3500 */ | 3500 */ |
3501 (int nargs, Lisp_Object *args)) | 3501 (int nargs, Lisp_Object *args)) |
3502 { | 3502 { |
3503 Lisp_Object item = args[0], sequence = args[1], matched_count = Qnil, | 3503 Lisp_Object item = args[0], sequence = args[1], matched_count = Qnil, |
3504 tail = Qnil; | 3504 tail = Qnil; |
3505 Elemcount starting = 0, ending = EMACS_INT_MAX, counting = EMACS_INT_MAX; | 3505 Elemcount starting = 0, ending = MOST_POSITIVE_FIXNUM, counting = MOST_POSITIVE_FIXNUM; |
3506 Elemcount ii = 0, encountered = 0, presenting = 0; | 3506 Elemcount ii = 0, encountered = 0, presenting = 0; |
3507 Boolint test_not_unboundp = 1; | 3507 Boolint test_not_unboundp = 1; |
3508 check_test_func_t check_test = NULL; | 3508 check_test_func_t check_test = NULL; |
3509 | 3509 |
3510 PARSE_KEYWORDS (FremoveX, nargs, args, 9, | 3510 PARSE_KEYWORDS (FremoveX, nargs, args, 9, |
3515 { | 3515 { |
3516 return FdeleteX (nargs, args); | 3516 return FdeleteX (nargs, args); |
3517 } | 3517 } |
3518 | 3518 |
3519 CHECK_NATNUM (start); | 3519 CHECK_NATNUM (start); |
3520 starting = BIGNUMP (start) ? 1 + EMACS_INT_MAX : XINT (start); | 3520 starting = BIGNUMP (start) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (start); |
3521 | 3521 |
3522 if (!NILP (end)) | 3522 if (!NILP (end)) |
3523 { | 3523 { |
3524 CHECK_NATNUM (end); | 3524 CHECK_NATNUM (end); |
3525 ending = BIGNUMP (end) ? 1 + EMACS_INT_MAX : XINT (end); | 3525 ending = BIGNUMP (end) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (end); |
3526 } | 3526 } |
3527 | 3527 |
3528 if (!NILP (count)) | 3528 if (!NILP (count)) |
3529 { | 3529 { |
3530 CHECK_INTEGER (count); | 3530 CHECK_INTEGER (count); |
3531 if (INTP (count)) | 3531 if (FIXNUMP (count)) |
3532 { | 3532 { |
3533 counting = XINT (count); | 3533 counting = XFIXNUM (count); |
3534 } | 3534 } |
3535 #ifdef HAVE_BIGNUM | 3535 #ifdef HAVE_BIGNUM |
3536 else | 3536 else |
3537 { | 3537 { |
3538 counting = bignum_sign (XBIGNUM_DATA (count)) > 0 ? | 3538 counting = bignum_sign (XBIGNUM_DATA (count)) > 0 ? |
3539 1 + EMACS_INT_MAX : -1 + EMACS_INT_MIN; | 3539 1 + MOST_POSITIVE_FIXNUM : -1 + MOST_NEGATIVE_FIXNUM; |
3540 } | 3540 } |
3541 #endif | 3541 #endif |
3542 | 3542 |
3543 if (counting <= 0) | 3543 if (counting <= 0) |
3544 { | 3544 { |
3574 Lisp_Object result = Qnil, result_tail = Qnil; | 3574 Lisp_Object result = Qnil, result_tail = Qnil; |
3575 struct gcpro gcpro1, gcpro2; | 3575 struct gcpro gcpro1, gcpro2; |
3576 | 3576 |
3577 if (!NILP (count) && !NILP (from_end)) | 3577 if (!NILP (count) && !NILP (from_end)) |
3578 { | 3578 { |
3579 presenting = XINT (matched_count); | 3579 presenting = XFIXNUM (matched_count); |
3580 | 3580 |
3581 /* If there are fewer matching elements in the list than we have | 3581 /* If there are fewer matching elements in the list than we have |
3582 permission to delete, we don't need to differentiate between | 3582 permission to delete, we don't need to differentiate between |
3583 the :from-end nil and :from-end t cases. Otherwise, presenting | 3583 the :from-end nil and :from-end t cases. Otherwise, presenting |
3584 is the number of matching items we need to ignore before we | 3584 is the number of matching items we need to ignore before we |
3747 Lisp_Object start, | 3747 Lisp_Object start, |
3748 Lisp_Object end, Boolint copy) | 3748 Lisp_Object end, Boolint copy) |
3749 { | 3749 { |
3750 Lisp_Object checking = Qnil, result = list; | 3750 Lisp_Object checking = Qnil, result = list; |
3751 Lisp_Object keyed, positioned, position_cons = Qnil, result_tail; | 3751 Lisp_Object keyed, positioned, position_cons = Qnil, result_tail; |
3752 Elemcount len = XINT (Flength (list)), pos, starting = XINT (start); | 3752 Elemcount len = XFIXNUM (Flength (list)), pos, starting = XFIXNUM (start); |
3753 Elemcount ending = (NILP (end) ? len : XINT (end)), greatest_pos_seen = -1; | 3753 Elemcount ending = (NILP (end) ? len : XFIXNUM (end)), greatest_pos_seen = -1; |
3754 Elemcount ii = 0; | 3754 Elemcount ii = 0; |
3755 struct gcpro gcpro1; | 3755 struct gcpro gcpro1; |
3756 | 3756 |
3757 /* We can't delete (or remove) as we go, because that breaks START and | 3757 /* We can't delete (or remove) as we go, because that breaks START and |
3758 END. We could if END were nil, and that would change an ON(N + 2) | 3758 END. We could if END were nil, and that would change an ON(N + 2) |
3786 pos = ii + 1; | 3786 pos = ii + 1; |
3787 | 3787 |
3788 while (!NILP ((positioned = list_position_cons_before | 3788 while (!NILP ((positioned = list_position_cons_before |
3789 (&position_cons, keyed, checking, check_test, | 3789 (&position_cons, keyed, checking, check_test, |
3790 test_not_unboundp, test, key, 0, | 3790 test_not_unboundp, test, key, 0, |
3791 make_int (max (starting - pos, 0)), | 3791 make_fixnum (max (starting - pos, 0)), |
3792 make_int (ending - pos))))) | 3792 make_fixnum (ending - pos))))) |
3793 { | 3793 { |
3794 pos = XINT (positioned) + pos; | 3794 pos = XFIXNUM (positioned) + pos; |
3795 set_bit_vector_bit (deleting, pos, 1); | 3795 set_bit_vector_bit (deleting, pos, 1); |
3796 greatest_pos_seen = max (greatest_pos_seen, pos); | 3796 greatest_pos_seen = max (greatest_pos_seen, pos); |
3797 checking = NILP (position_cons) ? | 3797 checking = NILP (position_cons) ? |
3798 XCDR (checking) : XCDR (XCDR (position_cons)); | 3798 XCDR (checking) : XCDR (XCDR (position_cons)); |
3799 pos += 1; | 3799 pos += 1; |
3862 */ | 3862 */ |
3863 (int nargs, Lisp_Object *args)) | 3863 (int nargs, Lisp_Object *args)) |
3864 { | 3864 { |
3865 Lisp_Object sequence = args[0], keyed = Qnil; | 3865 Lisp_Object sequence = args[0], keyed = Qnil; |
3866 Lisp_Object positioned = Qnil, ignore = Qnil; | 3866 Lisp_Object positioned = Qnil, ignore = Qnil; |
3867 Elemcount starting = 0, ending = EMACS_INT_MAX, len, ii = 0, jj = 0; | 3867 Elemcount starting = 0, ending = MOST_POSITIVE_FIXNUM, len, ii = 0, jj = 0; |
3868 Boolint test_not_unboundp = 1; | 3868 Boolint test_not_unboundp = 1; |
3869 check_test_func_t check_test = NULL; | 3869 check_test_func_t check_test = NULL; |
3870 struct gcpro gcpro1, gcpro2; | 3870 struct gcpro gcpro1, gcpro2; |
3871 | 3871 |
3872 PARSE_KEYWORDS (Fdelete_duplicates, nargs, args, 6, | 3872 PARSE_KEYWORDS (Fdelete_duplicates, nargs, args, 6, |
3873 (test, key, test_not, start, end, from_end), | 3873 (test, key, test_not, start, end, from_end), |
3874 (start = Qzero)); | 3874 (start = Qzero)); |
3875 | 3875 |
3876 CHECK_SEQUENCE (sequence); | 3876 CHECK_SEQUENCE (sequence); |
3877 CHECK_NATNUM (start); | 3877 CHECK_NATNUM (start); |
3878 starting = BIGNUMP (start) ? 1 + EMACS_INT_MAX : XINT (start); | 3878 starting = BIGNUMP (start) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (start); |
3879 | 3879 |
3880 if (!NILP (end)) | 3880 if (!NILP (end)) |
3881 { | 3881 { |
3882 CHECK_NATNUM (end); | 3882 CHECK_NATNUM (end); |
3883 ending = BIGNUMP (end) ? 1 + EMACS_INT_MAX : XINT (end); | 3883 ending = BIGNUMP (end) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (end); |
3884 } | 3884 } |
3885 | 3885 |
3886 CHECK_KEY_ARGUMENT (key); | 3886 CHECK_KEY_ARGUMENT (key); |
3887 | 3887 |
3888 get_check_match_function (&test, test_not, Qnil, Qnil, key, | 3888 get_check_match_function (&test, test_not, Qnil, Qnil, key, |
3905 keyed = KEY (key, elt); | 3905 keyed = KEY (key, elt); |
3906 positioned | 3906 positioned |
3907 = list_position_cons_before (&ignore, keyed, | 3907 = list_position_cons_before (&ignore, keyed, |
3908 XCDR (tail), check_test, | 3908 XCDR (tail), check_test, |
3909 test_not_unboundp, test, key, | 3909 test_not_unboundp, test, key, |
3910 0, make_int (max (starting | 3910 0, make_fixnum (max (starting |
3911 - (ii + 1), | 3911 - (ii + 1), |
3912 0)), | 3912 0)), |
3913 make_int (ending | 3913 make_fixnum (ending |
3914 - (ii + 1))); | 3914 - (ii + 1))); |
3915 if (!NILP (positioned)) | 3915 if (!NILP (positioned)) |
3916 { | 3916 { |
3917 sequence = XCDR (tail); | 3917 sequence = XCDR (tail); |
3918 deleted++; | 3918 deleted++; |
3944 keyed = KEY (key, elt); | 3944 keyed = KEY (key, elt); |
3945 positioned | 3945 positioned |
3946 = list_position_cons_before (&ignore, keyed, XCDR (tail), | 3946 = list_position_cons_before (&ignore, keyed, XCDR (tail), |
3947 check_test, test_not_unboundp, | 3947 check_test, test_not_unboundp, |
3948 test, key, 0, | 3948 test, key, 0, |
3949 make_int (max (starting | 3949 make_fixnum (max (starting |
3950 - (ii + 1), 0)), | 3950 - (ii + 1), 0)), |
3951 make_int (ending - (ii + 1))); | 3951 make_fixnum (ending - (ii + 1))); |
3952 if (!NILP (positioned)) | 3952 if (!NILP (positioned)) |
3953 { | 3953 { |
3954 /* We know this isn't the first iteration of the loop, | 3954 /* We know this isn't the first iteration of the loop, |
3955 because we advanced above to the point where we have at | 3955 because we advanced above to the point where we have at |
3956 least one non-duplicate entry at the head of the | 3956 least one non-duplicate entry at the head of the |
3976 UNGCPRO; | 3976 UNGCPRO; |
3977 | 3977 |
3978 if ((ii < starting || (ii < ending && !NILP (end)))) | 3978 if ((ii < starting || (ii < ending && !NILP (end)))) |
3979 { | 3979 { |
3980 check_sequence_range (args[0], start, end, | 3980 check_sequence_range (args[0], start, end, |
3981 make_int (deleted | 3981 make_fixnum (deleted |
3982 + XINT (Flength (args[0])))); | 3982 + XFIXNUM (Flength (args[0])))); |
3983 } | 3983 } |
3984 } | 3984 } |
3985 else | 3985 else |
3986 { | 3986 { |
3987 sequence = list_delete_duplicates_from_end (sequence, check_test, | 3987 sequence = list_delete_duplicates_from_end (sequence, check_test, |
4280 | 4280 |
4281 if (NILP (from_end)) | 4281 if (NILP (from_end)) |
4282 { | 4282 { |
4283 for (ii = starting; ii < ending; ii++) | 4283 for (ii = starting; ii < ending; ii++) |
4284 { | 4284 { |
4285 elt = KEY (key, make_int (bit_vector_bit (bv, ii))); | 4285 elt = KEY (key, make_fixnum (bit_vector_bit (bv, ii))); |
4286 | 4286 |
4287 for (jj = ii + 1; jj < ending; jj++) | 4287 for (jj = ii + 1; jj < ending; jj++) |
4288 { | 4288 { |
4289 if (check_test (test, key, elt, | 4289 if (check_test (test, key, elt, |
4290 make_int (bit_vector_bit (bv, jj))) | 4290 make_fixnum (bit_vector_bit (bv, jj))) |
4291 == test_not_unboundp) | 4291 == test_not_unboundp) |
4292 { | 4292 { |
4293 set_bit_vector_bit (deleting, ii, 1); | 4293 set_bit_vector_bit (deleting, ii, 1); |
4294 deleted++; | 4294 deleted++; |
4295 break; | 4295 break; |
4299 } | 4299 } |
4300 else | 4300 else |
4301 { | 4301 { |
4302 for (ii = ending - 1; ii >= starting; ii--) | 4302 for (ii = ending - 1; ii >= starting; ii--) |
4303 { | 4303 { |
4304 elt = KEY (key, make_int (bit_vector_bit (bv, ii))); | 4304 elt = KEY (key, make_fixnum (bit_vector_bit (bv, ii))); |
4305 | 4305 |
4306 for (jj = ii - 1; jj >= starting; jj--) | 4306 for (jj = ii - 1; jj >= starting; jj--) |
4307 { | 4307 { |
4308 if (check_test (test, key, elt, | 4308 if (check_test (test, key, elt, |
4309 make_int (bit_vector_bit (bv, jj))) | 4309 make_fixnum (bit_vector_bit (bv, jj))) |
4310 == test_not_unboundp) | 4310 == test_not_unboundp) |
4311 { | 4311 { |
4312 set_bit_vector_bit (deleting, ii, 1); | 4312 set_bit_vector_bit (deleting, ii, 1); |
4313 deleted++; | 4313 deleted++; |
4314 break; | 4314 break; |
4353 (int nargs, Lisp_Object *args)) | 4353 (int nargs, Lisp_Object *args)) |
4354 { | 4354 { |
4355 Lisp_Object sequence = args[0], keyed, positioned = Qnil; | 4355 Lisp_Object sequence = args[0], keyed, positioned = Qnil; |
4356 Lisp_Object result = sequence, result_tail = result, cursor = Qnil; | 4356 Lisp_Object result = sequence, result_tail = result, cursor = Qnil; |
4357 Lisp_Object cons_with_shared_tail = Qnil; | 4357 Lisp_Object cons_with_shared_tail = Qnil; |
4358 Elemcount starting = 0, ending = EMACS_INT_MAX, ii = 0; | 4358 Elemcount starting = 0, ending = MOST_POSITIVE_FIXNUM, ii = 0; |
4359 Boolint test_not_unboundp = 1; | 4359 Boolint test_not_unboundp = 1; |
4360 check_test_func_t check_test = NULL; | 4360 check_test_func_t check_test = NULL; |
4361 struct gcpro gcpro1, gcpro2; | 4361 struct gcpro gcpro1, gcpro2; |
4362 | 4362 |
4363 PARSE_KEYWORDS (Fremove_duplicates, nargs, args, 6, | 4363 PARSE_KEYWORDS (Fremove_duplicates, nargs, args, 6, |
4370 { | 4370 { |
4371 return Fdelete_duplicates (nargs, args); | 4371 return Fdelete_duplicates (nargs, args); |
4372 } | 4372 } |
4373 | 4373 |
4374 CHECK_NATNUM (start); | 4374 CHECK_NATNUM (start); |
4375 starting = BIGNUMP (start) ? 1 + EMACS_INT_MAX : XINT (start); | 4375 starting = BIGNUMP (start) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (start); |
4376 | 4376 |
4377 if (!NILP (end)) | 4377 if (!NILP (end)) |
4378 { | 4378 { |
4379 CHECK_NATNUM (end); | 4379 CHECK_NATNUM (end); |
4380 ending = BIGNUMP (end) ? 1 + EMACS_INT_MAX : XINT (end); | 4380 ending = BIGNUMP (end) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (end); |
4381 } | 4381 } |
4382 | 4382 |
4383 if (NILP (key)) | 4383 if (NILP (key)) |
4384 { | 4384 { |
4385 key = Qidentity; | 4385 key = Qidentity; |
4402 keyed = KEY (key, elt); | 4402 keyed = KEY (key, elt); |
4403 positioned | 4403 positioned |
4404 = list_position_cons_before (&ignore, keyed, XCDR (tail), | 4404 = list_position_cons_before (&ignore, keyed, XCDR (tail), |
4405 check_test, test_not_unboundp, | 4405 check_test, test_not_unboundp, |
4406 test, key, 0, | 4406 test, key, 0, |
4407 make_int (max (starting | 4407 make_fixnum (max (starting |
4408 - (ii + 1), 0)), | 4408 - (ii + 1), 0)), |
4409 make_int (ending - (ii + 1))); | 4409 make_fixnum (ending - (ii + 1))); |
4410 if (!NILP (positioned)) | 4410 if (!NILP (positioned)) |
4411 { | 4411 { |
4412 sequence = result = result_tail = XCDR (tail); | 4412 sequence = result = result_tail = XCDR (tail); |
4413 } | 4413 } |
4414 else | 4414 else |
4443 keyed = KEY (key, elt); | 4443 keyed = KEY (key, elt); |
4444 positioned | 4444 positioned |
4445 = list_position_cons_before (&ignore, keyed, XCDR (tail), | 4445 = list_position_cons_before (&ignore, keyed, XCDR (tail), |
4446 check_test, test_not_unboundp, | 4446 check_test, test_not_unboundp, |
4447 test, key, 0, | 4447 test, key, 0, |
4448 make_int (max (starting - (ii + 1), | 4448 make_fixnum (max (starting - (ii + 1), |
4449 0)), | 4449 0)), |
4450 make_int (ending - (ii + 1))); | 4450 make_fixnum (ending - (ii + 1))); |
4451 if (!NILP (positioned)) | 4451 if (!NILP (positioned)) |
4452 { | 4452 { |
4453 if (EQ (result, sequence)) | 4453 if (EQ (result, sequence)) |
4454 { | 4454 { |
4455 result = cons_with_shared_tail | 4455 result = cons_with_shared_tail |
5042 | 5042 |
5043 #define BIT_VECTOR_TO_OBJECT_ARRAY(v, c_array, counter, len) do { \ | 5043 #define BIT_VECTOR_TO_OBJECT_ARRAY(v, c_array, counter, len) do { \ |
5044 c_array = alloca_array (Lisp_Object, len); \ | 5044 c_array = alloca_array (Lisp_Object, len); \ |
5045 for (counter = 0; counter < len; ++counter) \ | 5045 for (counter = 0; counter < len; ++counter) \ |
5046 { \ | 5046 { \ |
5047 c_array[counter] = make_int (bit_vector_bit (v, counter)); \ | 5047 c_array[counter] = make_fixnum (bit_vector_bit (v, counter)); \ |
5048 } \ | 5048 } \ |
5049 } while (0) | 5049 } while (0) |
5050 | 5050 |
5051 DEFUN ("merge", Fmerge, 4, MANY, 0, /* | 5051 DEFUN ("merge", Fmerge, 4, MANY, 0, /* |
5052 Destructively merge SEQUENCE-ONE and SEQUENCE-TWO, producing a new sequence. | 5052 Destructively merge SEQUENCE-ONE and SEQUENCE-TWO, producing a new sequence. |
5134 reverse_order); | 5134 reverse_order); |
5135 } | 5135 } |
5136 } | 5136 } |
5137 else | 5137 else |
5138 { | 5138 { |
5139 Elemcount sequence_one_len = XINT (Flength (sequence_one)), | 5139 Elemcount sequence_one_len = XFIXNUM (Flength (sequence_one)), |
5140 sequence_two_len = XINT (Flength (sequence_two)), i; | 5140 sequence_two_len = XFIXNUM (Flength (sequence_two)), i; |
5141 Elemcount output_len = 1 + sequence_one_len + sequence_two_len; | 5141 Elemcount output_len = 1 + sequence_one_len + sequence_two_len; |
5142 Lisp_Object *output = alloca_array (Lisp_Object, output_len), | 5142 Lisp_Object *output = alloca_array (Lisp_Object, output_len), |
5143 *sequence_one_storage = NULL, *sequence_two_storage = NULL; | 5143 *sequence_one_storage = NULL, *sequence_two_storage = NULL; |
5144 Boolint do_coerce = !(EQ (type, Qvector) || EQ (type, Qstring) | 5144 Boolint do_coerce = !(EQ (type, Qvector) || EQ (type, Qstring) |
5145 || EQ (type, Qbit_vector) || EQ (type, Qlist)); | 5145 || EQ (type, Qbit_vector) || EQ (type, Qlist)); |
5241 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 5241 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
5242 Lisp_Object back, tem; | 5242 Lisp_Object back, tem; |
5243 Lisp_Object front = list; | 5243 Lisp_Object front = list; |
5244 Lisp_Object len = Flength (list); | 5244 Lisp_Object len = Flength (list); |
5245 | 5245 |
5246 if (XINT (len) < 2) | 5246 if (XFIXNUM (len) < 2) |
5247 return list; | 5247 return list; |
5248 | 5248 |
5249 len = make_int (XINT (len) / 2 - 1); | 5249 len = make_fixnum (XFIXNUM (len) / 2 - 1); |
5250 tem = Fnthcdr (len, list); | 5250 tem = Fnthcdr (len, list); |
5251 back = Fcdr (tem); | 5251 back = Fcdr (tem); |
5252 Fsetcdr (tem, Qnil); | 5252 Fsetcdr (tem, Qnil); |
5253 | 5253 |
5254 GCPRO4 (front, back, predicate, key); | 5254 GCPRO4 (front, back, predicate, key); |
5350 /* No GCPRO necessary, bits are immediate. */ | 5350 /* No GCPRO necessary, bits are immediate. */ |
5351 array_sort (sequence_carray, sequence_len, check_merge, predicate, key); | 5351 array_sort (sequence_carray, sequence_len, check_merge, predicate, key); |
5352 | 5352 |
5353 for (i = 0; i < sequence_len; ++i) | 5353 for (i = 0; i < sequence_len; ++i) |
5354 { | 5354 { |
5355 set_bit_vector_bit (v, i, XINT (sequence_carray [i])); | 5355 set_bit_vector_bit (v, i, XFIXNUM (sequence_carray [i])); |
5356 } | 5356 } |
5357 } | 5357 } |
5358 | 5358 |
5359 return sequence; | 5359 return sequence; |
5360 } | 5360 } |
5385 return 0; | 5385 return 0; |
5386 | 5386 |
5387 Fcheck_valid_plist (a); | 5387 Fcheck_valid_plist (a); |
5388 Fcheck_valid_plist (b); | 5388 Fcheck_valid_plist (b); |
5389 | 5389 |
5390 la = XINT (Flength (a)); | 5390 la = XFIXNUM (Flength (a)); |
5391 lb = XINT (Flength (b)); | 5391 lb = XFIXNUM (Flength (b)); |
5392 m = (la > lb ? la : lb); | 5392 m = (la > lb ? la : lb); |
5393 fill = 0; | 5393 fill = 0; |
5394 keys = alloca_array (Lisp_Object, m); | 5394 keys = alloca_array (Lisp_Object, m); |
5395 vals = alloca_array (Lisp_Object, m); | 5395 vals = alloca_array (Lisp_Object, m); |
5396 flags = alloca_array (Boolbyte, m); | 5396 flags = alloca_array (Boolbyte, m); |
6215 | 6215 |
6216 static Lisp_Object | 6216 static Lisp_Object |
6217 tweaked_internal_equal (Lisp_Object obj1, Lisp_Object obj2, | 6217 tweaked_internal_equal (Lisp_Object obj1, Lisp_Object obj2, |
6218 Lisp_Object depth) | 6218 Lisp_Object depth) |
6219 { | 6219 { |
6220 return make_int (internal_equal (obj1, obj2, XINT (depth))); | 6220 return make_fixnum (internal_equal (obj1, obj2, XFIXNUM (depth))); |
6221 } | 6221 } |
6222 | 6222 |
6223 int | 6223 int |
6224 internal_equal_trapping_problems (Lisp_Object warning_class, | 6224 internal_equal_trapping_problems (Lisp_Object warning_class, |
6225 const Ascbyte *warning_string, | 6225 const Ascbyte *warning_string, |
6231 { | 6231 { |
6232 Lisp_Object glorp = | 6232 Lisp_Object glorp = |
6233 va_call_trapping_problems (warning_class, warning_string, | 6233 va_call_trapping_problems (warning_class, warning_string, |
6234 flags, p, | 6234 flags, p, |
6235 (lisp_fn_t) tweaked_internal_equal, | 6235 (lisp_fn_t) tweaked_internal_equal, |
6236 3, obj1, obj2, make_int (depth)); | 6236 3, obj1, obj2, make_fixnum (depth)); |
6237 if (UNBOUNDP (glorp)) | 6237 if (UNBOUNDP (glorp)) |
6238 return retval; | 6238 return retval; |
6239 else | 6239 else |
6240 return XINT (glorp); | 6240 return XFIXNUM (glorp); |
6241 } | 6241 } |
6242 | 6242 |
6243 int | 6243 int |
6244 internal_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | 6244 internal_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) |
6245 { | 6245 { |
6314 artype1 = array_type (obj1); | 6314 artype1 = array_type (obj1); |
6315 artype2 = array_type (obj2); | 6315 artype2 = array_type (obj2); |
6316 if (artype1 != artype2 && artype1 && artype2) | 6316 if (artype1 != artype2 && artype1 && artype2) |
6317 { | 6317 { |
6318 EMACS_INT i; | 6318 EMACS_INT i; |
6319 EMACS_INT l1 = XINT (Flength (obj1)); | 6319 EMACS_INT l1 = XFIXNUM (Flength (obj1)); |
6320 EMACS_INT l2 = XINT (Flength (obj2)); | 6320 EMACS_INT l2 = XFIXNUM (Flength (obj2)); |
6321 /* Both arrays, but of different lengths */ | 6321 /* Both arrays, but of different lengths */ |
6322 if (l1 != l2) | 6322 if (l1 != l2) |
6323 return 0; | 6323 return 0; |
6324 for (i = 0; i < l1; i++) | 6324 for (i = 0; i < l1; i++) |
6325 if (!internal_equalp (Faref (obj1, make_int (i)), | 6325 if (!internal_equalp (Faref (obj1, make_fixnum (i)), |
6326 Faref (obj2, make_int (i)), depth + 1)) | 6326 Faref (obj2, make_fixnum (i)), depth + 1)) |
6327 return 0; | 6327 return 0; |
6328 return 1; | 6328 return 1; |
6329 } | 6329 } |
6330 } | 6330 } |
6331 /* 5. Else, they must be the same type. If so, call the equal() method, | 6331 /* 5. Else, they must be the same type. If so, call the equal() method, |
6598 */ | 6598 */ |
6599 (int nargs, Lisp_Object *args)) | 6599 (int nargs, Lisp_Object *args)) |
6600 { | 6600 { |
6601 Lisp_Object sequence = args[0]; | 6601 Lisp_Object sequence = args[0]; |
6602 Lisp_Object item = args[1]; | 6602 Lisp_Object item = args[1]; |
6603 Elemcount starting, ending = EMACS_INT_MAX + 1, ii, len; | 6603 Elemcount starting, ending = MOST_POSITIVE_FIXNUM + 1, ii, len; |
6604 | 6604 |
6605 PARSE_KEYWORDS (Ffill, nargs, args, 2, (start, end), (start = Qzero)); | 6605 PARSE_KEYWORDS (Ffill, nargs, args, 2, (start, end), (start = Qzero)); |
6606 | 6606 |
6607 CHECK_NATNUM (start); | 6607 CHECK_NATNUM (start); |
6608 starting = BIGNUMP (start) ? EMACS_INT_MAX + 1 : XINT (start); | 6608 starting = BIGNUMP (start) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (start); |
6609 | 6609 |
6610 if (!NILP (end)) | 6610 if (!NILP (end)) |
6611 { | 6611 { |
6612 CHECK_NATNUM (end); | 6612 CHECK_NATNUM (end); |
6613 ending = BIGNUMP (end) ? EMACS_INT_MAX + 1 : XINT (end); | 6613 ending = BIGNUMP (end) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (end); |
6614 } | 6614 } |
6615 | 6615 |
6616 retry: | 6616 retry: |
6617 if (STRINGP (sequence)) | 6617 if (STRINGP (sequence)) |
6618 { | 6618 { |
6626 Lisp_Object *p = XVECTOR_DATA (sequence); | 6626 Lisp_Object *p = XVECTOR_DATA (sequence); |
6627 | 6627 |
6628 CHECK_LISP_WRITEABLE (sequence); | 6628 CHECK_LISP_WRITEABLE (sequence); |
6629 len = XVECTOR_LENGTH (sequence); | 6629 len = XVECTOR_LENGTH (sequence); |
6630 | 6630 |
6631 check_sequence_range (sequence, start, end, make_int (len)); | 6631 check_sequence_range (sequence, start, end, make_fixnum (len)); |
6632 ending = min (ending, len); | 6632 ending = min (ending, len); |
6633 | 6633 |
6634 for (ii = starting; ii < ending; ++ii) | 6634 for (ii = starting; ii < ending; ++ii) |
6635 { | 6635 { |
6636 p[ii] = item; | 6636 p[ii] = item; |
6640 { | 6640 { |
6641 Lisp_Bit_Vector *v = XBIT_VECTOR (sequence); | 6641 Lisp_Bit_Vector *v = XBIT_VECTOR (sequence); |
6642 int bit; | 6642 int bit; |
6643 | 6643 |
6644 CHECK_BIT (item); | 6644 CHECK_BIT (item); |
6645 bit = XINT (item); | 6645 bit = XFIXNUM (item); |
6646 CHECK_LISP_WRITEABLE (sequence); | 6646 CHECK_LISP_WRITEABLE (sequence); |
6647 len = bit_vector_length (v); | 6647 len = bit_vector_length (v); |
6648 | 6648 |
6649 check_sequence_range (sequence, start, end, make_int (len)); | 6649 check_sequence_range (sequence, start, end, make_fixnum (len)); |
6650 ending = min (ending, len); | 6650 ending = min (ending, len); |
6651 | 6651 |
6652 for (ii = starting; ii < ending; ++ii) | 6652 for (ii = starting; ii < ending; ++ii) |
6653 { | 6653 { |
6654 set_bit_vector_bit (v, ii, bit); | 6654 set_bit_vector_bit (v, ii, bit); |
6985 break; | 6985 break; |
6986 } | 6986 } |
6987 case lrecord_type_bit_vector: | 6987 case lrecord_type_bit_vector: |
6988 { | 6988 { |
6989 args[j + 1] | 6989 args[j + 1] |
6990 = make_int (bit_vector_bit (XBIT_VECTOR (sequences[j]), | 6990 = make_fixnum (bit_vector_bit (XBIT_VECTOR (sequences[j]), |
6991 i)); | 6991 i)); |
6992 break; | 6992 break; |
6993 } | 6993 } |
6994 default: | 6994 default: |
6995 ABORT(); | 6995 ABORT(); |
7047 case lrecord_type_vector: | 7047 case lrecord_type_vector: |
7048 { | 7048 { |
7049 i < XVECTOR_LENGTH (lisp_vals) ? | 7049 i < XVECTOR_LENGTH (lisp_vals) ? |
7050 (XVECTOR_DATA (lisp_vals)[i] = called) : | 7050 (XVECTOR_DATA (lisp_vals)[i] = called) : |
7051 /* Let #'aset error. */ | 7051 /* Let #'aset error. */ |
7052 Faset (lisp_vals, make_int (i), called); | 7052 Faset (lisp_vals, make_fixnum (i), called); |
7053 break; | 7053 break; |
7054 } | 7054 } |
7055 case lrecord_type_string: | 7055 case lrecord_type_string: |
7056 { | 7056 { |
7057 CHECK_CHAR_COERCE_INT (called); | 7057 CHECK_CHAR_COERCE_INT (called); |
7061 case lrecord_type_bit_vector: | 7061 case lrecord_type_bit_vector: |
7062 { | 7062 { |
7063 (BITP (called) && | 7063 (BITP (called) && |
7064 i < bit_vector_length (XBIT_VECTOR (lisp_vals))) ? | 7064 i < bit_vector_length (XBIT_VECTOR (lisp_vals))) ? |
7065 set_bit_vector_bit (XBIT_VECTOR (lisp_vals), i, | 7065 set_bit_vector_bit (XBIT_VECTOR (lisp_vals), i, |
7066 XINT (called)) : | 7066 XFIXNUM (called)) : |
7067 (void) Faset (lisp_vals, make_int (i), called); | 7067 (void) Faset (lisp_vals, make_fixnum (i), called); |
7068 break; | 7068 break; |
7069 } | 7069 } |
7070 default: | 7070 default: |
7071 { | 7071 { |
7072 ABORT(); | 7072 ABORT(); |
7077 } | 7077 } |
7078 | 7078 |
7079 if (lisp_vals_staging != NULL) | 7079 if (lisp_vals_staging != NULL) |
7080 { | 7080 { |
7081 CHECK_LISP_WRITEABLE (lisp_vals); | 7081 CHECK_LISP_WRITEABLE (lisp_vals); |
7082 replace_string_range (lisp_vals, Qzero, make_int (call_count), | 7082 replace_string_range (lisp_vals, Qzero, make_fixnum (call_count), |
7083 lisp_vals_staging, cursor); | 7083 lisp_vals_staging, cursor); |
7084 } | 7084 } |
7085 } | 7085 } |
7086 | 7086 |
7087 UNGCPRO; | 7087 UNGCPRO; |
7091 the length of the shortest sequence. Error if all are circular, or if any | 7091 the length of the shortest sequence. Error if all are circular, or if any |
7092 one of them is not a sequence. */ | 7092 one of them is not a sequence. */ |
7093 static Elemcount | 7093 static Elemcount |
7094 shortest_length_among_sequences (int nsequences, Lisp_Object *sequences) | 7094 shortest_length_among_sequences (int nsequences, Lisp_Object *sequences) |
7095 { | 7095 { |
7096 Elemcount len = 1 + EMACS_INT_MAX; | 7096 Elemcount len = 1 + MOST_POSITIVE_FIXNUM; |
7097 Lisp_Object length = Qnil; | 7097 Lisp_Object length = Qnil; |
7098 int i; | 7098 int i; |
7099 | 7099 |
7100 for (i = 0; i < nsequences; ++i) | 7100 for (i = 0; i < nsequences; ++i) |
7101 { | 7101 { |
7102 if (CONSP (sequences[i])) | 7102 if (CONSP (sequences[i])) |
7103 { | 7103 { |
7104 length = Flist_length (sequences[i]); | 7104 length = Flist_length (sequences[i]); |
7105 if (!NILP (length)) | 7105 if (!NILP (length)) |
7106 { | 7106 { |
7107 len = min (len, XINT (length)); | 7107 len = min (len, XFIXNUM (length)); |
7108 } | 7108 } |
7109 } | 7109 } |
7110 else | 7110 else |
7111 { | 7111 { |
7112 CHECK_SEQUENCE (sequences[i]); | 7112 CHECK_SEQUENCE (sequences[i]); |
7113 length = Flength (sequences[i]); | 7113 length = Flength (sequences[i]); |
7114 len = min (len, XINT (length)); | 7114 len = min (len, XFIXNUM (length)); |
7115 } | 7115 } |
7116 } | 7116 } |
7117 | 7117 |
7118 if (len == 1 + EMACS_INT_MAX) | 7118 if (len == 1 + MOST_POSITIVE_FIXNUM) |
7119 { | 7119 { |
7120 signal_circular_list_error (sequences[0]); | 7120 signal_circular_list_error (sequences[0]); |
7121 } | 7121 } |
7122 | 7122 |
7123 return len; | 7123 return len; |
7141 (int nargs, Lisp_Object *args)) | 7141 (int nargs, Lisp_Object *args)) |
7142 { | 7142 { |
7143 Lisp_Object function = args[0]; | 7143 Lisp_Object function = args[0]; |
7144 Lisp_Object sequence = args[1]; | 7144 Lisp_Object sequence = args[1]; |
7145 Lisp_Object separator = args[2]; | 7145 Lisp_Object separator = args[2]; |
7146 Elemcount len = EMACS_INT_MAX; | 7146 Elemcount len = MOST_POSITIVE_FIXNUM; |
7147 Lisp_Object *args0; | 7147 Lisp_Object *args0; |
7148 EMACS_INT i, nargs0; | 7148 EMACS_INT i, nargs0; |
7149 | 7149 |
7150 args[2] = sequence; | 7150 args[2] = sequence; |
7151 args[1] = separator; | 7151 args[1] = separator; |
7611 arguments: (FUNCTION SEQUENCE &key (START 0) (END (length SEQUENCE)) FROM-END INITIAL-VALUE (KEY #'identity)) | 7611 arguments: (FUNCTION SEQUENCE &key (START 0) (END (length SEQUENCE)) FROM-END INITIAL-VALUE (KEY #'identity)) |
7612 */ | 7612 */ |
7613 (int nargs, Lisp_Object *args)) | 7613 (int nargs, Lisp_Object *args)) |
7614 { | 7614 { |
7615 Lisp_Object function = args[0], sequence = args[1], accum = Qunbound; | 7615 Lisp_Object function = args[0], sequence = args[1], accum = Qunbound; |
7616 Elemcount starting, ending = EMACS_INT_MAX + 1, ii = 0; | 7616 Elemcount starting, ending = MOST_POSITIVE_FIXNUM + 1, ii = 0; |
7617 | 7617 |
7618 PARSE_KEYWORDS (Freduce, nargs, args, 5, | 7618 PARSE_KEYWORDS (Freduce, nargs, args, 5, |
7619 (start, end, from_end, initial_value, key), | 7619 (start, end, from_end, initial_value, key), |
7620 (start = Qzero, initial_value = Qunbound)); | 7620 (start = Qzero, initial_value = Qunbound)); |
7621 | 7621 |
7622 CHECK_SEQUENCE (sequence); | 7622 CHECK_SEQUENCE (sequence); |
7623 CHECK_NATNUM (start); | 7623 CHECK_NATNUM (start); |
7624 starting = BIGNUMP (start) ? EMACS_INT_MAX + 1 : XINT (start); | 7624 starting = BIGNUMP (start) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (start); |
7625 CHECK_KEY_ARGUMENT (key); | 7625 CHECK_KEY_ARGUMENT (key); |
7626 | 7626 |
7627 #define KEY(key, item) (EQ (Qidentity, key) ? item : \ | 7627 #define KEY(key, item) (EQ (Qidentity, key) ? item : \ |
7628 IGNORE_MULTIPLE_VALUES (call1 (key, item))) | 7628 IGNORE_MULTIPLE_VALUES (call1 (key, item))) |
7629 #define CALL2(function, accum, item) \ | 7629 #define CALL2(function, accum, item) \ |
7630 IGNORE_MULTIPLE_VALUES (call2 (function, accum, item)) | 7630 IGNORE_MULTIPLE_VALUES (call2 (function, accum, item)) |
7631 | 7631 |
7632 if (!NILP (end)) | 7632 if (!NILP (end)) |
7633 { | 7633 { |
7634 CHECK_NATNUM (end); | 7634 CHECK_NATNUM (end); |
7635 ending = BIGNUMP (end) ? EMACS_INT_MAX + 1 : XINT (end); | 7635 ending = BIGNUMP (end) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (end); |
7636 } | 7636 } |
7637 | 7637 |
7638 if (VECTORP (sequence)) | 7638 if (VECTORP (sequence)) |
7639 { | 7639 { |
7640 Lisp_Vector *vv = XVECTOR (sequence); | 7640 Lisp_Vector *vv = XVECTOR (sequence); |
7641 struct gcpro gcpro1; | 7641 struct gcpro gcpro1; |
7642 | 7642 |
7643 check_sequence_range (sequence, start, end, make_int (vv->size)); | 7643 check_sequence_range (sequence, start, end, make_fixnum (vv->size)); |
7644 | 7644 |
7645 ending = min (ending, vv->size); | 7645 ending = min (ending, vv->size); |
7646 | 7646 |
7647 GCPRO1 (accum); | 7647 GCPRO1 (accum); |
7648 | 7648 |
7684 else if (BIT_VECTORP (sequence)) | 7684 else if (BIT_VECTORP (sequence)) |
7685 { | 7685 { |
7686 Lisp_Bit_Vector *bv = XBIT_VECTOR (sequence); | 7686 Lisp_Bit_Vector *bv = XBIT_VECTOR (sequence); |
7687 struct gcpro gcpro1; | 7687 struct gcpro gcpro1; |
7688 | 7688 |
7689 check_sequence_range (sequence, start, end, make_int (bv->size)); | 7689 check_sequence_range (sequence, start, end, make_fixnum (bv->size)); |
7690 ending = min (ending, bv->size); | 7690 ending = min (ending, bv->size); |
7691 | 7691 |
7692 GCPRO1 (accum); | 7692 GCPRO1 (accum); |
7693 | 7693 |
7694 if (!UNBOUNDP (initial_value)) | 7694 if (!UNBOUNDP (initial_value)) |
7697 } | 7697 } |
7698 else if (ending - starting) | 7698 else if (ending - starting) |
7699 { | 7699 { |
7700 if (NILP (from_end)) | 7700 if (NILP (from_end)) |
7701 { | 7701 { |
7702 accum = KEY (key, make_int (bit_vector_bit (bv, starting))); | 7702 accum = KEY (key, make_fixnum (bit_vector_bit (bv, starting))); |
7703 starting++; | 7703 starting++; |
7704 } | 7704 } |
7705 else | 7705 else |
7706 { | 7706 { |
7707 accum = KEY (key, make_int (bit_vector_bit (bv, ending - 1))); | 7707 accum = KEY (key, make_fixnum (bit_vector_bit (bv, ending - 1))); |
7708 ending--; | 7708 ending--; |
7709 } | 7709 } |
7710 } | 7710 } |
7711 | 7711 |
7712 if (NILP (from_end)) | 7712 if (NILP (from_end)) |
7713 { | 7713 { |
7714 for (ii = starting; ii < ending; ++ii) | 7714 for (ii = starting; ii < ending; ++ii) |
7715 { | 7715 { |
7716 accum = CALL2 (function, accum, | 7716 accum = CALL2 (function, accum, |
7717 KEY (key, make_int (bit_vector_bit (bv, ii)))); | 7717 KEY (key, make_fixnum (bit_vector_bit (bv, ii)))); |
7718 } | 7718 } |
7719 } | 7719 } |
7720 else | 7720 else |
7721 { | 7721 { |
7722 for (ii = ending - 1; ii >= starting; --ii) | 7722 for (ii = ending - 1; ii >= starting; --ii) |
7723 { | 7723 { |
7724 accum = CALL2 (function, KEY (key, | 7724 accum = CALL2 (function, KEY (key, |
7725 make_int (bit_vector_bit (bv, | 7725 make_fixnum (bit_vector_bit (bv, |
7726 ii))), | 7726 ii))), |
7727 accum); | 7727 accum); |
7728 } | 7728 } |
7729 } | 7729 } |
7730 | 7730 |
7800 { | 7800 { |
7801 Elemcount len = string_char_length (sequence); | 7801 Elemcount len = string_char_length (sequence); |
7802 Bytecount cursor_offset, byte_len = XSTRING_LENGTH (sequence); | 7802 Bytecount cursor_offset, byte_len = XSTRING_LENGTH (sequence); |
7803 const Ibyte *cursor; | 7803 const Ibyte *cursor; |
7804 | 7804 |
7805 check_sequence_range (sequence, start, end, make_int (len)); | 7805 check_sequence_range (sequence, start, end, make_fixnum (len)); |
7806 ending = min (ending, len); | 7806 ending = min (ending, len); |
7807 starting = XINT (start); | 7807 starting = XFIXNUM (start); |
7808 | 7808 |
7809 cursor = string_char_addr (sequence, ending - 1); | 7809 cursor = string_char_addr (sequence, ending - 1); |
7810 cursor_offset = cursor - XSTRING_DATA (sequence); | 7810 cursor_offset = cursor - XSTRING_DATA (sequence); |
7811 | 7811 |
7812 if (!UNBOUNDP (initial_value)) | 7812 if (!UNBOUNDP (initial_value)) |
7915 Boolint need_accum = 0; | 7915 Boolint need_accum = 0; |
7916 Lisp_Object *subsequence = NULL; | 7916 Lisp_Object *subsequence = NULL; |
7917 Elemcount counting = 0, len = 0; | 7917 Elemcount counting = 0, len = 0; |
7918 struct gcpro gcpro1; | 7918 struct gcpro gcpro1; |
7919 | 7919 |
7920 len = XINT (Flength (sequence)); | 7920 len = XFIXNUM (Flength (sequence)); |
7921 check_sequence_range (sequence, start, end, make_int (len)); | 7921 check_sequence_range (sequence, start, end, make_fixnum (len)); |
7922 ending = min (ending, len); | 7922 ending = min (ending, len); |
7923 | 7923 |
7924 /* :from-end with a list; make an alloca copy of the relevant list | 7924 /* :from-end with a list; make an alloca copy of the relevant list |
7925 data, attempting to go backwards isn't worth the trouble. */ | 7925 data, attempting to go backwards isn't worth the trouble. */ |
7926 if (!UNBOUNDP (initial_value)) | 7926 if (!UNBOUNDP (initial_value)) |
8046 { | 8046 { |
8047 Ibyte *destp = XSTRING_DATA (dest), *p = destp, | 8047 Ibyte *destp = XSTRING_DATA (dest), *p = destp, |
8048 *pend = p + XSTRING_LENGTH (dest), *pcursor, item_buf[MAX_ICHAR_LEN]; | 8048 *pend = p + XSTRING_LENGTH (dest), *pcursor, item_buf[MAX_ICHAR_LEN]; |
8049 Bytecount prefix_bytecount, source_len = source_limit - source; | 8049 Bytecount prefix_bytecount, source_len = source_limit - source; |
8050 Charcount ii = 0, ending, len; | 8050 Charcount ii = 0, ending, len; |
8051 Charcount starting = BIGNUMP (start) ? EMACS_INT_MAX + 1 : XINT (start); | 8051 Charcount starting = BIGNUMP (start) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (start); |
8052 Elemcount delta; | 8052 Elemcount delta; |
8053 | 8053 |
8054 while (ii < starting && p < pend) | 8054 while (ii < starting && p < pend) |
8055 { | 8055 { |
8056 INC_IBYTEPTR (p); | 8056 INC_IBYTEPTR (p); |
8069 | 8069 |
8070 ending = len = ii; | 8070 ending = len = ii; |
8071 } | 8071 } |
8072 else | 8072 else |
8073 { | 8073 { |
8074 ending = BIGNUMP (end) ? EMACS_INT_MAX + 1 : XINT (end); | 8074 ending = BIGNUMP (end) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (end); |
8075 while (ii < ending && pcursor < pend) | 8075 while (ii < ending && pcursor < pend) |
8076 { | 8076 { |
8077 INC_IBYTEPTR (pcursor); | 8077 INC_IBYTEPTR (pcursor); |
8078 ii++; | 8078 ii++; |
8079 } | 8079 } |
8080 } | 8080 } |
8081 | 8081 |
8082 if (pcursor == pend) | 8082 if (pcursor == pend) |
8083 { | 8083 { |
8084 /* We have the length, check it for our callers. */ | 8084 /* We have the length, check it for our callers. */ |
8085 check_sequence_range (dest, start, end, make_int (ii)); | 8085 check_sequence_range (dest, start, end, make_fixnum (ii)); |
8086 } | 8086 } |
8087 | 8087 |
8088 if (!(p == pend || p == pcursor)) | 8088 if (!(p == pend || p == pcursor)) |
8089 { | 8089 { |
8090 prefix_bytecount = p - destp; | 8090 prefix_bytecount = p - destp; |
8149 */ | 8149 */ |
8150 (int nargs, Lisp_Object *args)) | 8150 (int nargs, Lisp_Object *args)) |
8151 { | 8151 { |
8152 Lisp_Object sequence1 = args[0], sequence2 = args[1], | 8152 Lisp_Object sequence1 = args[0], sequence2 = args[1], |
8153 result = sequence1; | 8153 result = sequence1; |
8154 Elemcount starting1, ending1 = EMACS_INT_MAX + 1, starting2; | 8154 Elemcount starting1, ending1 = MOST_POSITIVE_FIXNUM + 1, starting2; |
8155 Elemcount ending2 = EMACS_INT_MAX + 1, counting = 0, startcounting; | 8155 Elemcount ending2 = MOST_POSITIVE_FIXNUM + 1, counting = 0, startcounting; |
8156 Boolint sequence1_listp, sequence2_listp, | 8156 Boolint sequence1_listp, sequence2_listp, |
8157 overwriting = EQ (sequence1, sequence2); | 8157 overwriting = EQ (sequence1, sequence2); |
8158 | 8158 |
8159 PARSE_KEYWORDS (Freplace, nargs, args, 4, (start1, end1, start2, end2), | 8159 PARSE_KEYWORDS (Freplace, nargs, args, 4, (start1, end1, start2, end2), |
8160 (start1 = start2 = Qzero)); | 8160 (start1 = start2 = Qzero)); |
8163 CHECK_LISP_WRITEABLE (sequence1); | 8163 CHECK_LISP_WRITEABLE (sequence1); |
8164 | 8164 |
8165 CHECK_SEQUENCE (sequence2); | 8165 CHECK_SEQUENCE (sequence2); |
8166 | 8166 |
8167 CHECK_NATNUM (start1); | 8167 CHECK_NATNUM (start1); |
8168 starting1 = BIGNUMP (start1) ? EMACS_INT_MAX + 1 : XINT (start1); | 8168 starting1 = BIGNUMP (start1) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (start1); |
8169 CHECK_NATNUM (start2); | 8169 CHECK_NATNUM (start2); |
8170 starting2 = BIGNUMP (start2) ? EMACS_INT_MAX + 1 : XINT (start2); | 8170 starting2 = BIGNUMP (start2) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (start2); |
8171 | 8171 |
8172 if (!NILP (end1)) | 8172 if (!NILP (end1)) |
8173 { | 8173 { |
8174 CHECK_NATNUM (end1); | 8174 CHECK_NATNUM (end1); |
8175 ending1 = BIGNUMP (end1) ? EMACS_INT_MAX + 1 : XINT (end1); | 8175 ending1 = BIGNUMP (end1) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (end1); |
8176 } | 8176 } |
8177 | 8177 |
8178 if (!NILP (end2)) | 8178 if (!NILP (end2)) |
8179 { | 8179 { |
8180 CHECK_NATNUM (end2); | 8180 CHECK_NATNUM (end2); |
8181 ending2 = BIGNUMP (end2) ? EMACS_INT_MAX + 1 : XINT (end2); | 8181 ending2 = BIGNUMP (end2) ? MOST_POSITIVE_FIXNUM + 1 : XFIXNUM (end2); |
8182 } | 8182 } |
8183 | 8183 |
8184 sequence1_listp = LISTP (sequence1); | 8184 sequence1_listp = LISTP (sequence1); |
8185 sequence2_listp = LISTP (sequence2); | 8185 sequence2_listp = LISTP (sequence2); |
8186 | 8186 |
8225 | 8225 |
8226 /* Our ranges may overlap. Save the data that might be overwritten. */ | 8226 /* Our ranges may overlap. Save the data that might be overwritten. */ |
8227 | 8227 |
8228 if (CONSP (sequence2)) | 8228 if (CONSP (sequence2)) |
8229 { | 8229 { |
8230 Elemcount len = XINT (Flength (sequence2)); | 8230 Elemcount len = XFIXNUM (Flength (sequence2)); |
8231 Lisp_Object *subsequence | 8231 Lisp_Object *subsequence |
8232 = alloca_array (Lisp_Object, min (ending2, len)); | 8232 = alloca_array (Lisp_Object, min (ending2, len)); |
8233 Elemcount ii = 0; | 8233 Elemcount ii = 0; |
8234 | 8234 |
8235 LIST_LOOP_2 (elt, sequence2) | 8235 LIST_LOOP_2 (elt, sequence2) |
8242 subsequence[ii++] = elt; | 8242 subsequence[ii++] = elt; |
8243 counting++; | 8243 counting++; |
8244 } | 8244 } |
8245 | 8245 |
8246 check_sequence_range (sequence1, start1, end1, | 8246 check_sequence_range (sequence1, start1, end1, |
8247 /* The XINT (start2) is intentional here; we | 8247 /* The XFIXNUM (start2) is intentional here; we |
8248 called #'length after doing (nthcdr | 8248 called #'length after doing (nthcdr |
8249 start2 sequence2). */ | 8249 start2 sequence2). */ |
8250 make_int (XINT (start2) + len)); | 8250 make_fixnum (XFIXNUM (start2) + len)); |
8251 check_sequence_range (sequence2, start2, end2, | 8251 check_sequence_range (sequence2, start2, end2, |
8252 make_int (XINT (start2) + len)); | 8252 make_fixnum (XFIXNUM (start2) + len)); |
8253 | 8253 |
8254 while (starting1 < ending1 | 8254 while (starting1 < ending1 |
8255 && starting2 < ending2 && !NILP (sequence1)) | 8255 && starting2 < ending2 && !NILP (sequence1)) |
8256 { | 8256 { |
8257 XSETCAR (sequence1, subsequence[starting2]); | 8257 XSETCAR (sequence1, subsequence[starting2]); |
8282 ii++; | 8282 ii++; |
8283 } | 8283 } |
8284 | 8284 |
8285 if (pcursor == pend) | 8285 if (pcursor == pend) |
8286 { | 8286 { |
8287 check_sequence_range (sequence1, start1, end1, make_int (ii)); | 8287 check_sequence_range (sequence1, start1, end1, make_fixnum (ii)); |
8288 check_sequence_range (sequence2, start2, end2, make_int (ii)); | 8288 check_sequence_range (sequence2, start2, end2, make_fixnum (ii)); |
8289 } | 8289 } |
8290 else | 8290 else |
8291 { | 8291 { |
8292 assert ((pcursor - p) > 0); | 8292 assert ((pcursor - p) > 0); |
8293 staging = alloca_ibytes (pcursor - p); | 8293 staging = alloca_ibytes (pcursor - p); |
8294 memcpy (staging, p, pcursor - p); | 8294 memcpy (staging, p, pcursor - p); |
8295 replace_string_range (result, start1, | 8295 replace_string_range (result, start1, |
8296 make_int (starting1), | 8296 make_fixnum (starting1), |
8297 staging, staging + (pcursor - p)); | 8297 staging, staging + (pcursor - p)); |
8298 } | 8298 } |
8299 } | 8299 } |
8300 else | 8300 else |
8301 { | 8301 { |
8302 Elemcount seq_len = XINT (Flength (sequence2)), ii = 0, | 8302 Elemcount seq_len = XFIXNUM (Flength (sequence2)), ii = 0, |
8303 subseq_len = min (min (ending1 - starting1, seq_len - starting1), | 8303 subseq_len = min (min (ending1 - starting1, seq_len - starting1), |
8304 min (ending2 - starting2, seq_len - starting2)); | 8304 min (ending2 - starting2, seq_len - starting2)); |
8305 Lisp_Object *subsequence = alloca_array (Lisp_Object, subseq_len); | 8305 Lisp_Object *subsequence = alloca_array (Lisp_Object, subseq_len); |
8306 | 8306 |
8307 check_sequence_range (sequence1, start1, end1, make_int (seq_len)); | 8307 check_sequence_range (sequence1, start1, end1, make_fixnum (seq_len)); |
8308 check_sequence_range (sequence2, start2, end2, make_int (seq_len)); | 8308 check_sequence_range (sequence2, start2, end2, make_fixnum (seq_len)); |
8309 | 8309 |
8310 while (starting2 < ending2 && ii < seq_len) | 8310 while (starting2 < ending2 && ii < seq_len) |
8311 { | 8311 { |
8312 subsequence[ii] = Faref (sequence2, make_int (starting2)); | 8312 subsequence[ii] = Faref (sequence2, make_fixnum (starting2)); |
8313 ii++, starting2++; | 8313 ii++, starting2++; |
8314 } | 8314 } |
8315 | 8315 |
8316 ii = 0; | 8316 ii = 0; |
8317 | 8317 |
8318 while (starting1 < ending1 && ii < seq_len) | 8318 while (starting1 < ending1 && ii < seq_len) |
8319 { | 8319 { |
8320 Faset (sequence1, make_int (starting1), subsequence[ii]); | 8320 Faset (sequence1, make_fixnum (starting1), subsequence[ii]); |
8321 ii++, starting1++; | 8321 ii++, starting1++; |
8322 } | 8322 } |
8323 } | 8323 } |
8324 } | 8324 } |
8325 else if (sequence1_listp && sequence2_listp) | 8325 else if (sequence1_listp && sequence2_listp) |
8363 } | 8363 } |
8364 | 8364 |
8365 if (NILP (sequence1)) | 8365 if (NILP (sequence1)) |
8366 { | 8366 { |
8367 check_sequence_range (args[0], start1, end1, | 8367 check_sequence_range (args[0], start1, end1, |
8368 make_int (XINT (start1) + shortest_len)); | 8368 make_fixnum (XFIXNUM (start1) + shortest_len)); |
8369 } | 8369 } |
8370 else if (NILP (sequence2)) | 8370 else if (NILP (sequence2)) |
8371 { | 8371 { |
8372 check_sequence_range (args[1], start2, end2, | 8372 check_sequence_range (args[1], start2, end2, |
8373 make_int (XINT (start2) + shortest_len)); | 8373 make_fixnum (XFIXNUM (start2) + shortest_len)); |
8374 } | 8374 } |
8375 } | 8375 } |
8376 else if (sequence1_listp) | 8376 else if (sequence1_listp) |
8377 { | 8377 { |
8378 if (STRINGP (sequence2)) | 8378 if (STRINGP (sequence2)) |
8403 } | 8403 } |
8404 | 8404 |
8405 if (NILP (sequence1)) | 8405 if (NILP (sequence1)) |
8406 { | 8406 { |
8407 check_sequence_range (sequence1, start1, end1, | 8407 check_sequence_range (sequence1, start1, end1, |
8408 make_int (XINT (start1) + starting1)); | 8408 make_fixnum (XFIXNUM (start1) + starting1)); |
8409 } | 8409 } |
8410 | 8410 |
8411 if (s2_data == s2_end) | 8411 if (s2_data == s2_end) |
8412 { | 8412 { |
8413 check_sequence_range (sequence2, start2, end2, | 8413 check_sequence_range (sequence2, start2, end2, |
8414 make_int (char_count)); | 8414 make_fixnum (char_count)); |
8415 } | 8415 } |
8416 } | 8416 } |
8417 else | 8417 else |
8418 { | 8418 { |
8419 Elemcount len2 = XINT (Flength (sequence2)); | 8419 Elemcount len2 = XFIXNUM (Flength (sequence2)); |
8420 check_sequence_range (sequence2, start2, end2, make_int (len2)); | 8420 check_sequence_range (sequence2, start2, end2, make_fixnum (len2)); |
8421 | 8421 |
8422 ending2 = min (ending2, len2); | 8422 ending2 = min (ending2, len2); |
8423 while (starting2 < ending2 | 8423 while (starting2 < ending2 |
8424 && starting1 < ending1 && !NILP (sequence1)) | 8424 && starting1 < ending1 && !NILP (sequence1)) |
8425 { | 8425 { |
8426 CHECK_CONS (sequence1); | 8426 CHECK_CONS (sequence1); |
8427 XSETCAR (sequence1, Faref (sequence2, make_int (starting2))); | 8427 XSETCAR (sequence1, Faref (sequence2, make_fixnum (starting2))); |
8428 sequence1 = XCDR (sequence1); | 8428 sequence1 = XCDR (sequence1); |
8429 starting1++; | 8429 starting1++; |
8430 starting2++; | 8430 starting2++; |
8431 } | 8431 } |
8432 | 8432 |
8433 if (NILP (sequence1)) | 8433 if (NILP (sequence1)) |
8434 { | 8434 { |
8435 check_sequence_range (args[0], start1, end1, | 8435 check_sequence_range (args[0], start1, end1, |
8436 make_int (XINT (start1) + starting1)); | 8436 make_fixnum (XFIXNUM (start1) + starting1)); |
8437 } | 8437 } |
8438 } | 8438 } |
8439 } | 8439 } |
8440 else if (sequence2_listp) | 8440 else if (sequence2_listp) |
8441 { | 8441 { |
8443 { | 8443 { |
8444 Elemcount ii = 0, count, len = string_char_length (sequence1); | 8444 Elemcount ii = 0, count, len = string_char_length (sequence1); |
8445 Ibyte *staging, *cursor; | 8445 Ibyte *staging, *cursor; |
8446 Lisp_Object obj; | 8446 Lisp_Object obj; |
8447 | 8447 |
8448 check_sequence_range (sequence1, start1, end1, make_int (len)); | 8448 check_sequence_range (sequence1, start1, end1, make_fixnum (len)); |
8449 ending1 = min (ending1, len); | 8449 ending1 = min (ending1, len); |
8450 count = ending1 - starting1; | 8450 count = ending1 - starting1; |
8451 staging = cursor = alloca_ibytes (count * MAX_ICHAR_LEN); | 8451 staging = cursor = alloca_ibytes (count * MAX_ICHAR_LEN); |
8452 | 8452 |
8453 while (ii < count && !NILP (sequence2)) | 8453 while (ii < count && !NILP (sequence2)) |
8462 } | 8462 } |
8463 | 8463 |
8464 if (NILP (sequence2)) | 8464 if (NILP (sequence2)) |
8465 { | 8465 { |
8466 check_sequence_range (sequence2, start2, end2, | 8466 check_sequence_range (sequence2, start2, end2, |
8467 make_int (XINT (start2) + ii)); | 8467 make_fixnum (XFIXNUM (start2) + ii)); |
8468 } | 8468 } |
8469 | 8469 |
8470 replace_string_range (result, start1, make_int (XINT (start1) + ii), | 8470 replace_string_range (result, start1, make_fixnum (XFIXNUM (start1) + ii), |
8471 staging, cursor); | 8471 staging, cursor); |
8472 } | 8472 } |
8473 else | 8473 else |
8474 { | 8474 { |
8475 Elemcount len = XINT (Flength (sequence1)); | 8475 Elemcount len = XFIXNUM (Flength (sequence1)); |
8476 | 8476 |
8477 check_sequence_range (sequence1, start2, end1, make_int (len)); | 8477 check_sequence_range (sequence1, start2, end1, make_fixnum (len)); |
8478 ending1 = min (ending2, min (ending1, len)); | 8478 ending1 = min (ending2, min (ending1, len)); |
8479 | 8479 |
8480 while (starting1 < ending1 && !NILP (sequence2)) | 8480 while (starting1 < ending1 && !NILP (sequence2)) |
8481 { | 8481 { |
8482 Faset (sequence1, make_int (starting1), | 8482 Faset (sequence1, make_fixnum (starting1), |
8483 CONSP (sequence2) ? XCAR (sequence2) | 8483 CONSP (sequence2) ? XCAR (sequence2) |
8484 : Fcar (sequence2)); | 8484 : Fcar (sequence2)); |
8485 sequence2 = XCDR (sequence2); | 8485 sequence2 = XCDR (sequence2); |
8486 starting1++; | 8486 starting1++; |
8487 starting2++; | 8487 starting2++; |
8488 } | 8488 } |
8489 | 8489 |
8490 if (NILP (sequence2)) | 8490 if (NILP (sequence2)) |
8491 { | 8491 { |
8492 check_sequence_range (args[1], start2, end2, | 8492 check_sequence_range (args[1], start2, end2, |
8493 make_int (XINT (start2) + starting2)); | 8493 make_fixnum (XFIXNUM (start2) + starting2)); |
8494 } | 8494 } |
8495 } | 8495 } |
8496 } | 8496 } |
8497 else | 8497 else |
8498 { | 8498 { |
8500 { | 8500 { |
8501 Ibyte *p2 = XSTRING_DATA (sequence2), | 8501 Ibyte *p2 = XSTRING_DATA (sequence2), |
8502 *p2end = p2 + XSTRING_LENGTH (sequence2), *p2cursor; | 8502 *p2end = p2 + XSTRING_LENGTH (sequence2), *p2cursor; |
8503 Charcount ii = 0, len1 = string_char_length (sequence1); | 8503 Charcount ii = 0, len1 = string_char_length (sequence1); |
8504 | 8504 |
8505 check_sequence_range (sequence1, start1, end1, make_int (len1)); | 8505 check_sequence_range (sequence1, start1, end1, make_fixnum (len1)); |
8506 | 8506 |
8507 while (ii < starting2 && p2 < p2end) | 8507 while (ii < starting2 && p2 < p2end) |
8508 { | 8508 { |
8509 INC_IBYTEPTR (p2); | 8509 INC_IBYTEPTR (p2); |
8510 ii++; | 8510 ii++; |
8520 starting1++; | 8520 starting1++; |
8521 } | 8521 } |
8522 | 8522 |
8523 if (p2cursor == p2end) | 8523 if (p2cursor == p2end) |
8524 { | 8524 { |
8525 check_sequence_range (sequence2, start2, end2, make_int (ii)); | 8525 check_sequence_range (sequence2, start2, end2, make_fixnum (ii)); |
8526 } | 8526 } |
8527 | 8527 |
8528 /* This isn't great; any error message won't necessarily reflect | 8528 /* This isn't great; any error message won't necessarily reflect |
8529 the END1 that was supplied to #'replace. */ | 8529 the END1 that was supplied to #'replace. */ |
8530 replace_string_range (result, start1, make_int (starting1), | 8530 replace_string_range (result, start1, make_fixnum (starting1), |
8531 p2, p2cursor); | 8531 p2, p2cursor); |
8532 } | 8532 } |
8533 else if (STRINGP (sequence1)) | 8533 else if (STRINGP (sequence1)) |
8534 { | 8534 { |
8535 Ibyte *staging, *cursor; | 8535 Ibyte *staging, *cursor; |
8536 Elemcount count, len1 = string_char_length (sequence1); | 8536 Elemcount count, len1 = string_char_length (sequence1); |
8537 Elemcount len2 = XINT (Flength (sequence2)), ii = 0; | 8537 Elemcount len2 = XFIXNUM (Flength (sequence2)), ii = 0; |
8538 Lisp_Object obj; | 8538 Lisp_Object obj; |
8539 | 8539 |
8540 check_sequence_range (sequence1, start1, end1, make_int (len1)); | 8540 check_sequence_range (sequence1, start1, end1, make_fixnum (len1)); |
8541 check_sequence_range (sequence2, start2, end2, make_int (len2)); | 8541 check_sequence_range (sequence2, start2, end2, make_fixnum (len2)); |
8542 | 8542 |
8543 ending1 = min (ending1, len1); | 8543 ending1 = min (ending1, len1); |
8544 ending2 = min (ending2, len2); | 8544 ending2 = min (ending2, len2); |
8545 count = min (ending1 - starting1, ending2 - starting2); | 8545 count = min (ending1 - starting1, ending2 - starting2); |
8546 staging = cursor = alloca_ibytes (count * MAX_ICHAR_LEN); | 8546 staging = cursor = alloca_ibytes (count * MAX_ICHAR_LEN); |
8547 | 8547 |
8548 ii = 0; | 8548 ii = 0; |
8549 while (ii < count) | 8549 while (ii < count) |
8550 { | 8550 { |
8551 obj = Faref (sequence2, make_int (starting2)); | 8551 obj = Faref (sequence2, make_fixnum (starting2)); |
8552 | 8552 |
8553 CHECK_CHAR_COERCE_INT (obj); | 8553 CHECK_CHAR_COERCE_INT (obj); |
8554 cursor += set_itext_ichar (cursor, XCHAR (obj)); | 8554 cursor += set_itext_ichar (cursor, XCHAR (obj)); |
8555 starting2++, ii++; | 8555 starting2++, ii++; |
8556 } | 8556 } |
8557 | 8557 |
8558 replace_string_range (result, start1, | 8558 replace_string_range (result, start1, |
8559 make_int (XINT (start1) + count), | 8559 make_fixnum (XFIXNUM (start1) + count), |
8560 staging, cursor); | 8560 staging, cursor); |
8561 } | 8561 } |
8562 else if (STRINGP (sequence2)) | 8562 else if (STRINGP (sequence2)) |
8563 { | 8563 { |
8564 Ibyte *p2 = XSTRING_DATA (sequence2), | 8564 Ibyte *p2 = XSTRING_DATA (sequence2), |
8565 *p2end = p2 + XSTRING_LENGTH (sequence2); | 8565 *p2end = p2 + XSTRING_LENGTH (sequence2); |
8566 Elemcount len1 = XINT (Flength (sequence1)), ii = 0; | 8566 Elemcount len1 = XFIXNUM (Flength (sequence1)), ii = 0; |
8567 | 8567 |
8568 check_sequence_range (sequence1, start1, end1, make_int (len1)); | 8568 check_sequence_range (sequence1, start1, end1, make_fixnum (len1)); |
8569 ending1 = min (ending1, len1); | 8569 ending1 = min (ending1, len1); |
8570 | 8570 |
8571 while (ii < starting2 && p2 < p2end) | 8571 while (ii < starting2 && p2 < p2end) |
8572 { | 8572 { |
8573 INC_IBYTEPTR (p2); | 8573 INC_IBYTEPTR (p2); |
8574 ii++; | 8574 ii++; |
8575 } | 8575 } |
8576 | 8576 |
8577 while (p2 < p2end && starting1 < ending1 && starting2 < ending2) | 8577 while (p2 < p2end && starting1 < ending1 && starting2 < ending2) |
8578 { | 8578 { |
8579 Faset (sequence1, make_int (starting1), | 8579 Faset (sequence1, make_fixnum (starting1), |
8580 make_char (itext_ichar (p2))); | 8580 make_char (itext_ichar (p2))); |
8581 INC_IBYTEPTR (p2); | 8581 INC_IBYTEPTR (p2); |
8582 starting1++; | 8582 starting1++; |
8583 starting2++; | 8583 starting2++; |
8584 ii++; | 8584 ii++; |
8585 } | 8585 } |
8586 | 8586 |
8587 if (p2 == p2end) | 8587 if (p2 == p2end) |
8588 { | 8588 { |
8589 check_sequence_range (sequence2, start2, end2, make_int (ii)); | 8589 check_sequence_range (sequence2, start2, end2, make_fixnum (ii)); |
8590 } | 8590 } |
8591 } | 8591 } |
8592 else | 8592 else |
8593 { | 8593 { |
8594 Elemcount len1 = XINT (Flength (sequence1)), | 8594 Elemcount len1 = XFIXNUM (Flength (sequence1)), |
8595 len2 = XINT (Flength (sequence2)); | 8595 len2 = XFIXNUM (Flength (sequence2)); |
8596 | 8596 |
8597 check_sequence_range (sequence1, start1, end1, make_int (len1)); | 8597 check_sequence_range (sequence1, start1, end1, make_fixnum (len1)); |
8598 check_sequence_range (sequence2, start2, end2, make_int (len2)); | 8598 check_sequence_range (sequence2, start2, end2, make_fixnum (len2)); |
8599 | 8599 |
8600 ending1 = min (ending1, len1); | 8600 ending1 = min (ending1, len1); |
8601 ending2 = min (ending2, len2); | 8601 ending2 = min (ending2, len2); |
8602 | 8602 |
8603 while (starting1 < ending1 && starting2 < ending2) | 8603 while (starting1 < ending1 && starting2 < ending2) |
8604 { | 8604 { |
8605 Faset (sequence1, make_int (starting1), | 8605 Faset (sequence1, make_fixnum (starting1), |
8606 Faref (sequence2, make_int (starting2))); | 8606 Faref (sequence2, make_fixnum (starting2))); |
8607 starting1++; | 8607 starting1++; |
8608 starting2++; | 8608 starting2++; |
8609 } | 8609 } |
8610 } | 8610 } |
8611 } | 8611 } |
8623 */ | 8623 */ |
8624 (int nargs, Lisp_Object *args)) | 8624 (int nargs, Lisp_Object *args)) |
8625 { | 8625 { |
8626 Lisp_Object new_ = args[0], item = args[1], sequence = args[2]; | 8626 Lisp_Object new_ = args[0], item = args[1], sequence = args[2]; |
8627 Lisp_Object object_, position0; | 8627 Lisp_Object object_, position0; |
8628 Elemcount starting = 0, ending = EMACS_INT_MAX, encountered = 0; | 8628 Elemcount starting = 0, ending = MOST_POSITIVE_FIXNUM, encountered = 0; |
8629 Elemcount len, ii = 0, counting = EMACS_INT_MAX, presenting = 0; | 8629 Elemcount len, ii = 0, counting = MOST_POSITIVE_FIXNUM, presenting = 0; |
8630 Boolint test_not_unboundp = 1; | 8630 Boolint test_not_unboundp = 1; |
8631 check_test_func_t check_test = NULL; | 8631 check_test_func_t check_test = NULL; |
8632 | 8632 |
8633 PARSE_KEYWORDS (Fnsubstitute, nargs, args, 9, | 8633 PARSE_KEYWORDS (Fnsubstitute, nargs, args, 9, |
8634 (test, if_, if_not, test_not, key, start, end, count, | 8634 (test, if_, if_not, test_not, key, start, end, count, |
8635 from_end), (start = Qzero)); | 8635 from_end), (start = Qzero)); |
8636 | 8636 |
8637 CHECK_SEQUENCE (sequence); | 8637 CHECK_SEQUENCE (sequence); |
8638 CHECK_NATNUM (start); | 8638 CHECK_NATNUM (start); |
8639 starting = BIGNUMP (start) ? 1 + EMACS_INT_MAX : XINT (start); | 8639 starting = BIGNUMP (start) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (start); |
8640 | 8640 |
8641 if (!NILP (end)) | 8641 if (!NILP (end)) |
8642 { | 8642 { |
8643 CHECK_NATNUM (end); | 8643 CHECK_NATNUM (end); |
8644 ending = BIGNUMP (end) ? 1 + EMACS_INT_MAX : XINT (end); | 8644 ending = BIGNUMP (end) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (end); |
8645 } | 8645 } |
8646 | 8646 |
8647 if (!NILP (count)) | 8647 if (!NILP (count)) |
8648 { | 8648 { |
8649 CHECK_INTEGER (count); | 8649 CHECK_INTEGER (count); |
8650 if (INTP (count)) | 8650 if (FIXNUMP (count)) |
8651 { | 8651 { |
8652 counting = XINT (count); | 8652 counting = XFIXNUM (count); |
8653 } | 8653 } |
8654 #ifdef HAVE_BIGNUM | 8654 #ifdef HAVE_BIGNUM |
8655 else | 8655 else |
8656 { | 8656 { |
8657 counting = bignum_sign (XBIGNUM_DATA (count)) > 0 ? | 8657 counting = bignum_sign (XBIGNUM_DATA (count)) > 0 ? |
8658 1 + EMACS_INT_MAX : -1 + EMACS_INT_MIN; | 8658 1 + MOST_POSITIVE_FIXNUM : -1 + MOST_NEGATIVE_FIXNUM; |
8659 } | 8659 } |
8660 #endif | 8660 #endif |
8661 | 8661 |
8662 if (counting <= 0) | 8662 if (counting <= 0) |
8663 { | 8663 { |
8678 if (ZEROP (present)) | 8678 if (ZEROP (present)) |
8679 { | 8679 { |
8680 return sequence; | 8680 return sequence; |
8681 } | 8681 } |
8682 | 8682 |
8683 presenting = XINT (present); | 8683 presenting = XFIXNUM (present); |
8684 presenting = presenting <= counting ? 0 : presenting - counting; | 8684 presenting = presenting <= counting ? 0 : presenting - counting; |
8685 } | 8685 } |
8686 | 8686 |
8687 { | 8687 { |
8688 GC_EXTERNAL_LIST_LOOP_3 (elt, sequence, tail) | 8688 GC_EXTERNAL_LIST_LOOP_3 (elt, sequence, tail) |
8741 if (ZEROP (present)) | 8741 if (ZEROP (present)) |
8742 { | 8742 { |
8743 return sequence; | 8743 return sequence; |
8744 } | 8744 } |
8745 | 8745 |
8746 presenting = XINT (present); | 8746 presenting = XFIXNUM (present); |
8747 | 8747 |
8748 /* If there are fewer items in the string than we have | 8748 /* If there are fewer items in the string than we have |
8749 permission to change, we don't need to differentiate | 8749 permission to change, we don't need to differentiate |
8750 between the :from-end nil and :from-end t | 8750 between the :from-end nil and :from-end t |
8751 cases. Otherwise, presenting is the number of matching | 8751 cases. Otherwise, presenting is the number of matching |
8799 } | 8799 } |
8800 | 8800 |
8801 if (0 != encountered) | 8801 if (0 != encountered) |
8802 { | 8802 { |
8803 CHECK_LISP_WRITEABLE (sequence); | 8803 CHECK_LISP_WRITEABLE (sequence); |
8804 replace_string_range (sequence, Qzero, make_int (ii), | 8804 replace_string_range (sequence, Qzero, make_fixnum (ii), |
8805 staging, staging_cursor); | 8805 staging, staging_cursor); |
8806 } | 8806 } |
8807 } | 8807 } |
8808 else | 8808 else |
8809 { | 8809 { |
8810 Elemcount positioning; | 8810 Elemcount positioning; |
8811 Lisp_Object object = Qnil; | 8811 Lisp_Object object = Qnil; |
8812 | 8812 |
8813 len = XINT (Flength (sequence)); | 8813 len = XFIXNUM (Flength (sequence)); |
8814 check_sequence_range (sequence, start, end, make_int (len)); | 8814 check_sequence_range (sequence, start, end, make_fixnum (len)); |
8815 | 8815 |
8816 position0 = position (&object, item, sequence, check_test, | 8816 position0 = position (&object, item, sequence, check_test, |
8817 test_not_unboundp, test, key, start, end, from_end, | 8817 test_not_unboundp, test, key, start, end, from_end, |
8818 Qnil, Qnsubstitute); | 8818 Qnil, Qnsubstitute); |
8819 | 8819 |
8820 if (NILP (position0)) | 8820 if (NILP (position0)) |
8821 { | 8821 { |
8822 return sequence; | 8822 return sequence; |
8823 } | 8823 } |
8824 | 8824 |
8825 positioning = XINT (position0); | 8825 positioning = XFIXNUM (position0); |
8826 ending = min (len, ending); | 8826 ending = min (len, ending); |
8827 | 8827 |
8828 Faset (sequence, position0, new_); | 8828 Faset (sequence, position0, new_); |
8829 encountered = 1; | 8829 encountered = 1; |
8830 | 8830 |
8831 if (NILP (from_end)) | 8831 if (NILP (from_end)) |
8832 { | 8832 { |
8833 for (ii = positioning + 1; ii < ending; ii++) | 8833 for (ii = positioning + 1; ii < ending; ii++) |
8834 { | 8834 { |
8835 object_ = Faref (sequence, make_int (ii)); | 8835 object_ = Faref (sequence, make_fixnum (ii)); |
8836 | 8836 |
8837 if (check_test (test, key, item, object_) == test_not_unboundp | 8837 if (check_test (test, key, item, object_) == test_not_unboundp |
8838 && encountered++ < counting) | 8838 && encountered++ < counting) |
8839 { | 8839 { |
8840 Faset (sequence, make_int (ii), new_); | 8840 Faset (sequence, make_fixnum (ii), new_); |
8841 } | 8841 } |
8842 else if (encountered == counting) | 8842 else if (encountered == counting) |
8843 { | 8843 { |
8844 break; | 8844 break; |
8845 } | 8845 } |
8847 } | 8847 } |
8848 else | 8848 else |
8849 { | 8849 { |
8850 for (ii = positioning - 1; ii >= starting; ii--) | 8850 for (ii = positioning - 1; ii >= starting; ii--) |
8851 { | 8851 { |
8852 object_ = Faref (sequence, make_int (ii)); | 8852 object_ = Faref (sequence, make_fixnum (ii)); |
8853 | 8853 |
8854 if (check_test (test, key, item, object_) == test_not_unboundp | 8854 if (check_test (test, key, item, object_) == test_not_unboundp |
8855 && encountered++ < counting) | 8855 && encountered++ < counting) |
8856 { | 8856 { |
8857 Faset (sequence, make_int (ii), new_); | 8857 Faset (sequence, make_fixnum (ii), new_); |
8858 } | 8858 } |
8859 else if (encountered == counting) | 8859 else if (encountered == counting) |
8860 { | 8860 { |
8861 break; | 8861 break; |
8862 } | 8862 } |
8880 (int nargs, Lisp_Object *args)) | 8880 (int nargs, Lisp_Object *args)) |
8881 { | 8881 { |
8882 Lisp_Object new_ = args[0], item = args[1], sequence = args[2], tail = Qnil; | 8882 Lisp_Object new_ = args[0], item = args[1], sequence = args[2], tail = Qnil; |
8883 Lisp_Object result = Qnil, result_tail = Qnil; | 8883 Lisp_Object result = Qnil, result_tail = Qnil; |
8884 Lisp_Object object, position0, matched_count; | 8884 Lisp_Object object, position0, matched_count; |
8885 Elemcount starting = 0, ending = EMACS_INT_MAX, encountered = 0; | 8885 Elemcount starting = 0, ending = MOST_POSITIVE_FIXNUM, encountered = 0; |
8886 Elemcount ii = 0, counting = EMACS_INT_MAX, presenting = 0; | 8886 Elemcount ii = 0, counting = MOST_POSITIVE_FIXNUM, presenting = 0; |
8887 Boolint test_not_unboundp = 1; | 8887 Boolint test_not_unboundp = 1; |
8888 check_test_func_t check_test = NULL; | 8888 check_test_func_t check_test = NULL; |
8889 struct gcpro gcpro1; | 8889 struct gcpro gcpro1; |
8890 | 8890 |
8891 PARSE_KEYWORDS (Fsubstitute, nargs, args, 9, | 8891 PARSE_KEYWORDS (Fsubstitute, nargs, args, 9, |
8893 from_end), (start = Qzero, count = Qunbound)); | 8893 from_end), (start = Qzero, count = Qunbound)); |
8894 | 8894 |
8895 CHECK_SEQUENCE (sequence); | 8895 CHECK_SEQUENCE (sequence); |
8896 | 8896 |
8897 CHECK_NATNUM (start); | 8897 CHECK_NATNUM (start); |
8898 starting = BIGNUMP (start) ? 1 + EMACS_INT_MAX : XINT (start); | 8898 starting = BIGNUMP (start) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (start); |
8899 | 8899 |
8900 if (!NILP (end)) | 8900 if (!NILP (end)) |
8901 { | 8901 { |
8902 CHECK_NATNUM (end); | 8902 CHECK_NATNUM (end); |
8903 ending = BIGNUMP (end) ? 1 + EMACS_INT_MAX : XINT (end); | 8903 ending = BIGNUMP (end) ? 1 + MOST_POSITIVE_FIXNUM : XFIXNUM (end); |
8904 } | 8904 } |
8905 | 8905 |
8906 check_test = get_check_test_function (item, &test, test_not, if_, if_not, | 8906 check_test = get_check_test_function (item, &test, test_not, if_, if_not, |
8907 key, &test_not_unboundp); | 8907 key, &test_not_unboundp); |
8908 | 8908 |
8909 if (!UNBOUNDP (count)) | 8909 if (!UNBOUNDP (count)) |
8910 { | 8910 { |
8911 if (!NILP (count)) | 8911 if (!NILP (count)) |
8912 { | 8912 { |
8913 CHECK_INTEGER (count); | 8913 CHECK_INTEGER (count); |
8914 if (INTP (count)) | 8914 if (FIXNUMP (count)) |
8915 { | 8915 { |
8916 counting = XINT (count); | 8916 counting = XFIXNUM (count); |
8917 } | 8917 } |
8918 #ifdef HAVE_BIGNUM | 8918 #ifdef HAVE_BIGNUM |
8919 else | 8919 else |
8920 { | 8920 { |
8921 counting = bignum_sign (XBIGNUM_DATA (count)) > 0 ? | 8921 counting = bignum_sign (XBIGNUM_DATA (count)) > 0 ? |
8922 1 + EMACS_INT_MAX : -1 + EMACS_INT_MIN; | 8922 1 + MOST_POSITIVE_FIXNUM : -1 + MOST_NEGATIVE_FIXNUM; |
8923 } | 8923 } |
8924 #endif | 8924 #endif |
8925 | 8925 |
8926 if (counting <= 0) | 8926 if (counting <= 0) |
8927 { | 8927 { |
8954 return sequence; | 8954 return sequence; |
8955 } | 8955 } |
8956 | 8956 |
8957 if (!NILP (count) && !NILP (from_end)) | 8957 if (!NILP (count) && !NILP (from_end)) |
8958 { | 8958 { |
8959 presenting = XINT (matched_count); | 8959 presenting = XFIXNUM (matched_count); |
8960 presenting = presenting <= counting ? 0 : presenting - counting; | 8960 presenting = presenting <= counting ? 0 : presenting - counting; |
8961 } | 8961 } |
8962 | 8962 |
8963 GCPRO1 (result); | 8963 GCPRO1 (result); |
8964 { | 8964 { |
9425 Lisp_Object sequence2, Lisp_Object start2, Lisp_Object end2, | 9425 Lisp_Object sequence2, Lisp_Object start2, Lisp_Object end2, |
9426 check_test_func_t check_match, Boolint test_not_unboundp, | 9426 check_test_func_t check_match, Boolint test_not_unboundp, |
9427 Lisp_Object test, Lisp_Object key, | 9427 Lisp_Object test, Lisp_Object key, |
9428 Boolint UNUSED (return_sequence1_index)) | 9428 Boolint UNUSED (return_sequence1_index)) |
9429 { | 9429 { |
9430 Elemcount sequence1_len = XINT (Flength (sequence1)); | 9430 Elemcount sequence1_len = XFIXNUM (Flength (sequence1)); |
9431 Elemcount sequence2_len = XINT (Flength (sequence2)), ii = 0; | 9431 Elemcount sequence2_len = XFIXNUM (Flength (sequence2)), ii = 0; |
9432 Elemcount starting1, ending1, starting2, ending2; | 9432 Elemcount starting1, ending1, starting2, ending2; |
9433 Lisp_Object *sequence1_storage = NULL, *sequence2_storage = NULL; | 9433 Lisp_Object *sequence1_storage = NULL, *sequence2_storage = NULL; |
9434 struct gcpro gcpro1, gcpro2; | 9434 struct gcpro gcpro1, gcpro2; |
9435 | 9435 |
9436 check_sequence_range (sequence1, start1, end1, make_int (sequence1_len)); | 9436 check_sequence_range (sequence1, start1, end1, make_fixnum (sequence1_len)); |
9437 starting1 = XINT (start1); | 9437 starting1 = XFIXNUM (start1); |
9438 ending1 = INTP (end1) ? XINT (end1) : 1 + EMACS_INT_MAX; | 9438 ending1 = FIXNUMP (end1) ? XFIXNUM (end1) : 1 + MOST_POSITIVE_FIXNUM; |
9439 ending1 = min (ending1, sequence1_len); | 9439 ending1 = min (ending1, sequence1_len); |
9440 | 9440 |
9441 check_sequence_range (sequence2, start2, end2, make_int (sequence2_len)); | 9441 check_sequence_range (sequence2, start2, end2, make_fixnum (sequence2_len)); |
9442 starting2 = XINT (start2); | 9442 starting2 = XFIXNUM (start2); |
9443 ending2 = INTP (end2) ? XINT (end2) : 1 + EMACS_INT_MAX; | 9443 ending2 = FIXNUMP (end2) ? XFIXNUM (end2) : 1 + MOST_POSITIVE_FIXNUM; |
9444 ending2 = min (ending2, sequence2_len); | 9444 ending2 = min (ending2, sequence2_len); |
9445 | 9445 |
9446 if (LISTP (sequence1)) | 9446 if (LISTP (sequence1)) |
9447 { | 9447 { |
9448 Lisp_Object *saving; | 9448 Lisp_Object *saving; |
9478 Lisp_Bit_Vector *vv = XBIT_VECTOR (sequence1); | 9478 Lisp_Bit_Vector *vv = XBIT_VECTOR (sequence1); |
9479 sequence1_storage = alloca_array (Lisp_Object, ending1 - starting1); | 9479 sequence1_storage = alloca_array (Lisp_Object, ending1 - starting1); |
9480 for (ii = starting1; ii < ending1; ++ii) | 9480 for (ii = starting1; ii < ending1; ++ii) |
9481 { | 9481 { |
9482 sequence1_storage[ii - starting1] | 9482 sequence1_storage[ii - starting1] |
9483 = make_int (bit_vector_bit (vv, ii)); | 9483 = make_fixnum (bit_vector_bit (vv, ii)); |
9484 } | 9484 } |
9485 } | 9485 } |
9486 else | 9486 else |
9487 { | 9487 { |
9488 sequence1_storage = XVECTOR_DATA (sequence1) + starting1; | 9488 sequence1_storage = XVECTOR_DATA (sequence1) + starting1; |
9525 Lisp_Bit_Vector *vv = XBIT_VECTOR (sequence2); | 9525 Lisp_Bit_Vector *vv = XBIT_VECTOR (sequence2); |
9526 sequence2_storage = alloca_array (Lisp_Object, ending2 - starting2); | 9526 sequence2_storage = alloca_array (Lisp_Object, ending2 - starting2); |
9527 for (ii = starting2; ii < ending2; ++ii) | 9527 for (ii = starting2; ii < ending2; ++ii) |
9528 { | 9528 { |
9529 sequence2_storage[ii - starting2] | 9529 sequence2_storage[ii - starting2] |
9530 = make_int (bit_vector_bit (vv, ii)); | 9530 = make_fixnum (bit_vector_bit (vv, ii)); |
9531 } | 9531 } |
9532 } | 9532 } |
9533 else | 9533 else |
9534 { | 9534 { |
9535 sequence2_storage = XVECTOR_DATA (sequence2) + starting2; | 9535 sequence2_storage = XVECTOR_DATA (sequence2) + starting2; |
9570 Lisp_Object test, Lisp_Object key, | 9570 Lisp_Object test, Lisp_Object key, |
9571 Boolint UNUSED (return_list_index)) | 9571 Boolint UNUSED (return_list_index)) |
9572 { | 9572 { |
9573 Lisp_Object sequence1_tortoise = sequence1, sequence2_tortoise = sequence2; | 9573 Lisp_Object sequence1_tortoise = sequence1, sequence2_tortoise = sequence2; |
9574 Lisp_Object orig_sequence1 = sequence1, orig_sequence2 = sequence2; | 9574 Lisp_Object orig_sequence1 = sequence1, orig_sequence2 = sequence2; |
9575 Elemcount ending1 = EMACS_INT_MAX, ending2 = EMACS_INT_MAX; | 9575 Elemcount ending1 = MOST_POSITIVE_FIXNUM, ending2 = MOST_POSITIVE_FIXNUM; |
9576 Elemcount starting1, starting2, counting, startcounting; | 9576 Elemcount starting1, starting2, counting, startcounting; |
9577 Elemcount shortest_len = 0; | 9577 Elemcount shortest_len = 0; |
9578 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 9578 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
9579 | 9579 |
9580 starting1 = INTP (start1) ? XINT (start1) : 1 + EMACS_INT_MAX; | 9580 starting1 = FIXNUMP (start1) ? XFIXNUM (start1) : 1 + MOST_POSITIVE_FIXNUM; |
9581 starting2 = INTP (start2) ? XINT (start2) : 1 + EMACS_INT_MAX; | 9581 starting2 = FIXNUMP (start2) ? XFIXNUM (start2) : 1 + MOST_POSITIVE_FIXNUM; |
9582 | 9582 |
9583 if (!NILP (end1)) | 9583 if (!NILP (end1)) |
9584 { | 9584 { |
9585 ending1 = INTP (end1) ? XINT (end1) : 1 + EMACS_INT_MAX; | 9585 ending1 = FIXNUMP (end1) ? XFIXNUM (end1) : 1 + MOST_POSITIVE_FIXNUM; |
9586 } | 9586 } |
9587 | 9587 |
9588 if (!NILP (end2)) | 9588 if (!NILP (end2)) |
9589 { | 9589 { |
9590 ending2 = INTP (end2) ? XINT (end2) : 1 + EMACS_INT_MAX; | 9590 ending2 = FIXNUMP (end2) ? XFIXNUM (end2) : 1 + MOST_POSITIVE_FIXNUM; |
9591 } | 9591 } |
9592 | 9592 |
9593 if (!ZEROP (start1)) | 9593 if (!ZEROP (start1)) |
9594 { | 9594 { |
9595 sequence1 = Fnthcdr (start1, sequence1); | 9595 sequence1 = Fnthcdr (start1, sequence1); |
9634 : Fcar (sequence1), | 9634 : Fcar (sequence1), |
9635 CONSP (sequence2) ? XCAR (sequence2) | 9635 CONSP (sequence2) ? XCAR (sequence2) |
9636 : Fcar (sequence2) ) != test_not_unboundp) | 9636 : Fcar (sequence2) ) != test_not_unboundp) |
9637 { | 9637 { |
9638 UNGCPRO; | 9638 UNGCPRO; |
9639 return make_integer (XINT (start1) + shortest_len); | 9639 return make_integer (XFIXNUM (start1) + shortest_len); |
9640 } | 9640 } |
9641 | 9641 |
9642 sequence1 = CONSP (sequence1) ? XCDR (sequence1) : Fcdr (sequence1); | 9642 sequence1 = CONSP (sequence1) ? XCDR (sequence1) : Fcdr (sequence1); |
9643 sequence2 = CONSP (sequence2) ? XCDR (sequence2) : Fcdr (sequence2); | 9643 sequence2 = CONSP (sequence2) ? XCDR (sequence2) : Fcdr (sequence2); |
9644 | 9644 |
9666 | 9666 |
9667 UNGCPRO; | 9667 UNGCPRO; |
9668 | 9668 |
9669 if (NILP (sequence1)) | 9669 if (NILP (sequence1)) |
9670 { | 9670 { |
9671 Lisp_Object args[] = { start1, make_int (shortest_len) }; | 9671 Lisp_Object args[] = { start1, make_fixnum (shortest_len) }; |
9672 check_sequence_range (orig_sequence1, start1, end1, | 9672 check_sequence_range (orig_sequence1, start1, end1, |
9673 Fplus (countof (args), args)); | 9673 Fplus (countof (args), args)); |
9674 } | 9674 } |
9675 | 9675 |
9676 if (NILP (sequence2)) | 9676 if (NILP (sequence2)) |
9677 { | 9677 { |
9678 Lisp_Object args[] = { start2, make_int (shortest_len) }; | 9678 Lisp_Object args[] = { start2, make_fixnum (shortest_len) }; |
9679 check_sequence_range (orig_sequence2, start2, end2, | 9679 check_sequence_range (orig_sequence2, start2, end2, |
9680 Fplus (countof (args), args)); | 9680 Fplus (countof (args), args)); |
9681 } | 9681 } |
9682 | 9682 |
9683 if ((!NILP (end1) && shortest_len != ending1 - starting1) || | 9683 if ((!NILP (end1) && shortest_len != ending1 - starting1) || |
9684 (!NILP (end2) && shortest_len != ending2 - starting2)) | 9684 (!NILP (end2) && shortest_len != ending2 - starting2)) |
9685 { | 9685 { |
9686 return make_integer (XINT (start1) + shortest_len); | 9686 return make_integer (XFIXNUM (start1) + shortest_len); |
9687 } | 9687 } |
9688 | 9688 |
9689 if ((NILP (end1) && CONSP (sequence1)) || (NILP (end2) && CONSP (sequence2))) | 9689 if ((NILP (end1) && CONSP (sequence1)) || (NILP (end2) && CONSP (sequence2))) |
9690 { | 9690 { |
9691 return make_integer (XINT (start1) + shortest_len); | 9691 return make_integer (XFIXNUM (start1) + shortest_len); |
9692 } | 9692 } |
9693 | 9693 |
9694 return Qnil; | 9694 return Qnil; |
9695 } | 9695 } |
9696 | 9696 |
9709 Elemcount char_count = 0, list_starting, list_ending; | 9709 Elemcount char_count = 0, list_starting, list_ending; |
9710 Elemcount string_starting, string_ending; | 9710 Elemcount string_starting, string_ending; |
9711 Lisp_Object character, orig_list = list; | 9711 Lisp_Object character, orig_list = list; |
9712 struct gcpro gcpro1; | 9712 struct gcpro gcpro1; |
9713 | 9713 |
9714 list_ending = INTP (list_end) ? XINT (list_end) : 1 + EMACS_INT_MAX; | 9714 list_ending = FIXNUMP (list_end) ? XFIXNUM (list_end) : 1 + MOST_POSITIVE_FIXNUM; |
9715 list_starting = INTP (list_start) ? XINT (list_start) : 1 + EMACS_INT_MAX; | 9715 list_starting = FIXNUMP (list_start) ? XFIXNUM (list_start) : 1 + MOST_POSITIVE_FIXNUM; |
9716 | 9716 |
9717 string_ending = INTP (string_end) ? XINT (string_end) : 1 + EMACS_INT_MAX; | 9717 string_ending = FIXNUMP (string_end) ? XFIXNUM (string_end) : 1 + MOST_POSITIVE_FIXNUM; |
9718 string_starting | 9718 string_starting |
9719 = INTP (string_start) ? XINT (string_start) : 1 + EMACS_INT_MAX; | 9719 = FIXNUMP (string_start) ? XFIXNUM (string_start) : 1 + MOST_POSITIVE_FIXNUM; |
9720 | 9720 |
9721 while (char_count < string_starting && string_offset < string_len) | 9721 while (char_count < string_starting && string_offset < string_len) |
9722 { | 9722 { |
9723 INC_IBYTEPTR (string_data); | 9723 INC_IBYTEPTR (string_data); |
9724 string_offset = string_data - startp; | 9724 string_offset = string_data - startp; |
9751 if (check_match (test, key, CONSP (list) ? XCAR (list) : Fcar (list), | 9751 if (check_match (test, key, CONSP (list) ? XCAR (list) : Fcar (list), |
9752 character) | 9752 character) |
9753 != test_not_unboundp) | 9753 != test_not_unboundp) |
9754 { | 9754 { |
9755 UNGCPRO; | 9755 UNGCPRO; |
9756 return make_integer (XINT (list_start) + char_count); | 9756 return make_integer (XFIXNUM (list_start) + char_count); |
9757 } | 9757 } |
9758 } | 9758 } |
9759 else | 9759 else |
9760 { | 9760 { |
9761 if (check_match (test, key, character, | 9761 if (check_match (test, key, character, |
9786 | 9786 |
9787 UNGCPRO; | 9787 UNGCPRO; |
9788 | 9788 |
9789 if (NILP (list)) | 9789 if (NILP (list)) |
9790 { | 9790 { |
9791 Lisp_Object args[] = { list_start, make_int (char_count) }; | 9791 Lisp_Object args[] = { list_start, make_fixnum (char_count) }; |
9792 check_sequence_range (orig_list, list_start, list_end, | 9792 check_sequence_range (orig_list, list_start, list_end, |
9793 Fplus (countof (args), args)); | 9793 Fplus (countof (args), args)); |
9794 } | 9794 } |
9795 | 9795 |
9796 if (string_data == XSTRING_DATA (string) + XSTRING_LENGTH (string)) | 9796 if (string_data == XSTRING_DATA (string) + XSTRING_LENGTH (string)) |
9797 { | 9797 { |
9798 check_sequence_range (string, string_start, string_end, | 9798 check_sequence_range (string, string_start, string_end, |
9799 make_int (char_count)); | 9799 make_fixnum (char_count)); |
9800 } | 9800 } |
9801 | 9801 |
9802 if ((NILP (string_end) ? | 9802 if ((NILP (string_end) ? |
9803 string_offset < string_len : string_starting < string_ending) || | 9803 string_offset < string_len : string_starting < string_ending) || |
9804 (NILP (list_end) ? !NILP (list) : list_starting < list_ending)) | 9804 (NILP (list_end) ? !NILP (list) : list_starting < list_ending)) |
9805 { | 9805 { |
9806 return make_integer (return_list_index ? XINT (list_start) + char_count : | 9806 return make_integer (return_list_index ? XFIXNUM (list_start) + char_count : |
9807 char_count); | 9807 char_count); |
9808 } | 9808 } |
9809 | 9809 |
9810 return Qnil; | 9810 return Qnil; |
9811 } | 9811 } |
9823 Elemcount ii = 0, list_starting, list_ending; | 9823 Elemcount ii = 0, list_starting, list_ending; |
9824 Elemcount array_starting, array_ending, array_len; | 9824 Elemcount array_starting, array_ending, array_len; |
9825 Lisp_Object orig_list = list; | 9825 Lisp_Object orig_list = list; |
9826 struct gcpro gcpro1; | 9826 struct gcpro gcpro1; |
9827 | 9827 |
9828 list_ending = INTP (list_end) ? XINT (list_end) : 1 + EMACS_INT_MAX; | 9828 list_ending = FIXNUMP (list_end) ? XFIXNUM (list_end) : 1 + MOST_POSITIVE_FIXNUM; |
9829 list_starting = INTP (list_start) ? XINT (list_start) : 1 + EMACS_INT_MAX; | 9829 list_starting = FIXNUMP (list_start) ? XFIXNUM (list_start) : 1 + MOST_POSITIVE_FIXNUM; |
9830 | 9830 |
9831 array_ending = INTP (array_end) ? XINT (array_end) : 1 + EMACS_INT_MAX; | 9831 array_ending = FIXNUMP (array_end) ? XFIXNUM (array_end) : 1 + MOST_POSITIVE_FIXNUM; |
9832 array_starting = INTP (array_start) ? XINT (array_start) : 1 + EMACS_INT_MAX; | 9832 array_starting = FIXNUMP (array_start) ? XFIXNUM (array_start) : 1 + MOST_POSITIVE_FIXNUM; |
9833 array_len = XINT (Flength (array)); | 9833 array_len = XFIXNUM (Flength (array)); |
9834 | 9834 |
9835 array_ending = min (array_ending, array_len); | 9835 array_ending = min (array_ending, array_len); |
9836 | 9836 |
9837 check_sequence_range (array, array_start, array_end, make_int (array_len)); | 9837 check_sequence_range (array, array_start, array_end, make_fixnum (array_len)); |
9838 | 9838 |
9839 if (!ZEROP (list_start)) | 9839 if (!ZEROP (list_start)) |
9840 { | 9840 { |
9841 list = Fnthcdr (list_start, list); | 9841 list = Fnthcdr (list_start, list); |
9842 if (NILP (list)) | 9842 if (NILP (list)) |
9856 && !NILP (list)) | 9856 && !NILP (list)) |
9857 { | 9857 { |
9858 if (return_list_index) | 9858 if (return_list_index) |
9859 { | 9859 { |
9860 if (check_match (test, key, CONSP (list) ? XCAR (list) : Fcar (list), | 9860 if (check_match (test, key, CONSP (list) ? XCAR (list) : Fcar (list), |
9861 Faref (array, make_int (array_starting))) | 9861 Faref (array, make_fixnum (array_starting))) |
9862 != test_not_unboundp) | 9862 != test_not_unboundp) |
9863 { | 9863 { |
9864 UNGCPRO; | 9864 UNGCPRO; |
9865 return make_integer (XINT (list_start) + ii); | 9865 return make_integer (XFIXNUM (list_start) + ii); |
9866 } | 9866 } |
9867 } | 9867 } |
9868 else | 9868 else |
9869 { | 9869 { |
9870 if (check_match (test, key, Faref (array, make_int (array_starting)), | 9870 if (check_match (test, key, Faref (array, make_fixnum (array_starting)), |
9871 CONSP (list) ? XCAR (list) : Fcar (list)) | 9871 CONSP (list) ? XCAR (list) : Fcar (list)) |
9872 != test_not_unboundp) | 9872 != test_not_unboundp) |
9873 { | 9873 { |
9874 UNGCPRO; | 9874 UNGCPRO; |
9875 return make_integer (array_starting); | 9875 return make_integer (array_starting); |
9884 | 9884 |
9885 UNGCPRO; | 9885 UNGCPRO; |
9886 | 9886 |
9887 if (NILP (list)) | 9887 if (NILP (list)) |
9888 { | 9888 { |
9889 Lisp_Object args[] = { list_start, make_int (ii) }; | 9889 Lisp_Object args[] = { list_start, make_fixnum (ii) }; |
9890 check_sequence_range (orig_list, list_start, list_end, | 9890 check_sequence_range (orig_list, list_start, list_end, |
9891 Fplus (countof (args), args)); | 9891 Fplus (countof (args), args)); |
9892 } | 9892 } |
9893 | 9893 |
9894 if (array_starting < array_ending || | 9894 if (array_starting < array_ending || |
9895 (NILP (list_end) ? !NILP (list) : list_starting < list_ending)) | 9895 (NILP (list_end) ? !NILP (list) : list_starting < list_ending)) |
9896 { | 9896 { |
9897 return make_integer (return_list_index ? XINT (list_start) + ii : | 9897 return make_integer (return_list_index ? XFIXNUM (list_start) + ii : |
9898 array_starting); | 9898 array_starting); |
9899 } | 9899 } |
9900 | 9900 |
9901 return Qnil; | 9901 return Qnil; |
9902 } | 9902 } |
9914 Bytecount string_offset = 0, string_len = XSTRING_LENGTH (string); | 9914 Bytecount string_offset = 0, string_len = XSTRING_LENGTH (string); |
9915 Elemcount char_count = 0, array_starting, array_ending, array_length; | 9915 Elemcount char_count = 0, array_starting, array_ending, array_length; |
9916 Elemcount string_starting, string_ending; | 9916 Elemcount string_starting, string_ending; |
9917 Lisp_Object character; | 9917 Lisp_Object character; |
9918 | 9918 |
9919 array_starting = INTP (array_start) ? XINT (array_start) : 1 + EMACS_INT_MAX; | 9919 array_starting = FIXNUMP (array_start) ? XFIXNUM (array_start) : 1 + MOST_POSITIVE_FIXNUM; |
9920 array_ending = INTP (array_end) ? XINT (array_end) : 1 + EMACS_INT_MAX; | 9920 array_ending = FIXNUMP (array_end) ? XFIXNUM (array_end) : 1 + MOST_POSITIVE_FIXNUM; |
9921 array_length = XINT (Flength (array)); | 9921 array_length = XFIXNUM (Flength (array)); |
9922 check_sequence_range (array, array_start, array_end, make_int (array_length)); | 9922 check_sequence_range (array, array_start, array_end, make_fixnum (array_length)); |
9923 array_ending = min (array_ending, array_length); | 9923 array_ending = min (array_ending, array_length); |
9924 | 9924 |
9925 string_ending = INTP (string_end) ? XINT (string_end) : 1 + EMACS_INT_MAX; | 9925 string_ending = FIXNUMP (string_end) ? XFIXNUM (string_end) : 1 + MOST_POSITIVE_FIXNUM; |
9926 string_starting | 9926 string_starting |
9927 = INTP (string_start) ? XINT (string_start) : 1 + EMACS_INT_MAX; | 9927 = FIXNUMP (string_start) ? XFIXNUM (string_start) : 1 + MOST_POSITIVE_FIXNUM; |
9928 | 9928 |
9929 while (char_count < string_starting && string_offset < string_len) | 9929 while (char_count < string_starting && string_offset < string_len) |
9930 { | 9930 { |
9931 INC_IBYTEPTR (string_data); | 9931 INC_IBYTEPTR (string_data); |
9932 string_offset = string_data - startp; | 9932 string_offset = string_data - startp; |
9939 character = make_char (itext_ichar (string_data)); | 9939 character = make_char (itext_ichar (string_data)); |
9940 | 9940 |
9941 if (return_string_index) | 9941 if (return_string_index) |
9942 { | 9942 { |
9943 if (check_match (test, key, character, | 9943 if (check_match (test, key, character, |
9944 Faref (array, make_int (array_starting))) | 9944 Faref (array, make_fixnum (array_starting))) |
9945 != test_not_unboundp) | 9945 != test_not_unboundp) |
9946 { | 9946 { |
9947 return make_integer (char_count); | 9947 return make_integer (char_count); |
9948 } | 9948 } |
9949 } | 9949 } |
9950 else | 9950 else |
9951 { | 9951 { |
9952 if (check_match (test, key, | 9952 if (check_match (test, key, |
9953 Faref (array, make_int (array_starting)), | 9953 Faref (array, make_fixnum (array_starting)), |
9954 character) | 9954 character) |
9955 != test_not_unboundp) | 9955 != test_not_unboundp) |
9956 { | 9956 { |
9957 return make_integer (XINT (array_start) + char_count); | 9957 return make_integer (XFIXNUM (array_start) + char_count); |
9958 } | 9958 } |
9959 } | 9959 } |
9960 | 9960 |
9961 startp = XSTRING_DATA (string); | 9961 startp = XSTRING_DATA (string); |
9962 string_data = startp + string_offset; | 9962 string_data = startp + string_offset; |
9974 } | 9974 } |
9975 | 9975 |
9976 if (string_data == XSTRING_DATA (string) + XSTRING_LENGTH (string)) | 9976 if (string_data == XSTRING_DATA (string) + XSTRING_LENGTH (string)) |
9977 { | 9977 { |
9978 check_sequence_range (string, string_start, string_end, | 9978 check_sequence_range (string, string_start, string_end, |
9979 make_int (char_count)); | 9979 make_fixnum (char_count)); |
9980 } | 9980 } |
9981 | 9981 |
9982 if ((NILP (string_end) ? | 9982 if ((NILP (string_end) ? |
9983 string_offset < string_len : string_starting < string_ending) || | 9983 string_offset < string_len : string_starting < string_ending) || |
9984 (NILP (array_end) ? !NILP (array) : array_starting < array_ending)) | 9984 (NILP (array_end) ? !NILP (array) : array_starting < array_ending)) |
9985 { | 9985 { |
9986 return make_integer (return_string_index ? char_count : | 9986 return make_integer (return_string_index ? char_count : |
9987 XINT (array_start) + char_count); | 9987 XFIXNUM (array_start) + char_count); |
9988 } | 9988 } |
9989 | 9989 |
9990 return Qnil; | 9990 return Qnil; |
9991 } | 9991 } |
9992 | 9992 |
10006 Bytecount string2_offset = 0, string2_len = XSTRING_LENGTH (string2); | 10006 Bytecount string2_offset = 0, string2_len = XSTRING_LENGTH (string2); |
10007 Elemcount char_count1 = 0, string1_starting, string1_ending; | 10007 Elemcount char_count1 = 0, string1_starting, string1_ending; |
10008 Elemcount char_count2 = 0, string2_starting, string2_ending; | 10008 Elemcount char_count2 = 0, string2_starting, string2_ending; |
10009 Lisp_Object character1, character2; | 10009 Lisp_Object character1, character2; |
10010 | 10010 |
10011 string1_ending = INTP (string1_end) ? XINT (string1_end) : 1 + EMACS_INT_MAX; | 10011 string1_ending = FIXNUMP (string1_end) ? XFIXNUM (string1_end) : 1 + MOST_POSITIVE_FIXNUM; |
10012 string1_starting | 10012 string1_starting |
10013 = INTP (string1_start) ? XINT (string1_start) : 1 + EMACS_INT_MAX; | 10013 = FIXNUMP (string1_start) ? XFIXNUM (string1_start) : 1 + MOST_POSITIVE_FIXNUM; |
10014 | 10014 |
10015 string2_starting | 10015 string2_starting |
10016 = INTP (string2_start) ? XINT (string2_start) : 1 + EMACS_INT_MAX; | 10016 = FIXNUMP (string2_start) ? XFIXNUM (string2_start) : 1 + MOST_POSITIVE_FIXNUM; |
10017 string2_ending = INTP (string2_end) ? XINT (string2_end) : 1 + EMACS_INT_MAX; | 10017 string2_ending = FIXNUMP (string2_end) ? XFIXNUM (string2_end) : 1 + MOST_POSITIVE_FIXNUM; |
10018 | 10018 |
10019 while (char_count1 < string1_starting && string1_offset < string1_len) | 10019 while (char_count1 < string1_starting && string1_offset < string1_len) |
10020 { | 10020 { |
10021 INC_IBYTEPTR (string1_data); | 10021 INC_IBYTEPTR (string1_data); |
10022 string1_offset = string1_data - startp1; | 10022 string1_offset = string1_data - startp1; |
10069 } | 10069 } |
10070 | 10070 |
10071 if (string1_data == XSTRING_DATA (string1) + XSTRING_LENGTH (string1)) | 10071 if (string1_data == XSTRING_DATA (string1) + XSTRING_LENGTH (string1)) |
10072 { | 10072 { |
10073 check_sequence_range (string1, string1_start, string1_end, | 10073 check_sequence_range (string1, string1_start, string1_end, |
10074 make_int (char_count1)); | 10074 make_fixnum (char_count1)); |
10075 } | 10075 } |
10076 | 10076 |
10077 if (string2_data == XSTRING_DATA (string2) + XSTRING_LENGTH (string2)) | 10077 if (string2_data == XSTRING_DATA (string2) + XSTRING_LENGTH (string2)) |
10078 { | 10078 { |
10079 check_sequence_range (string2, string2_start, string2_end, | 10079 check_sequence_range (string2, string2_start, string2_end, |
10080 make_int (char_count2)); | 10080 make_fixnum (char_count2)); |
10081 } | 10081 } |
10082 | 10082 |
10083 if ((!NILP (string1_end) && string1_starting < string1_ending) || | 10083 if ((!NILP (string1_end) && string1_starting < string1_ending) || |
10084 (!NILP (string2_end) && string2_starting < string2_ending)) | 10084 (!NILP (string2_end) && string2_starting < string2_ending)) |
10085 { | 10085 { |
10102 Lisp_Object array2, Lisp_Object start2, Lisp_Object end2, | 10102 Lisp_Object array2, Lisp_Object start2, Lisp_Object end2, |
10103 check_test_func_t check_match, Boolint test_not_unboundp, | 10103 check_test_func_t check_match, Boolint test_not_unboundp, |
10104 Lisp_Object test, Lisp_Object key, | 10104 Lisp_Object test, Lisp_Object key, |
10105 Boolint UNUSED (return_array1_index)) | 10105 Boolint UNUSED (return_array1_index)) |
10106 { | 10106 { |
10107 Elemcount len1 = XINT (Flength (array1)), len2 = XINT (Flength (array2)); | 10107 Elemcount len1 = XFIXNUM (Flength (array1)), len2 = XFIXNUM (Flength (array2)); |
10108 Elemcount ending1 = EMACS_INT_MAX, ending2 = EMACS_INT_MAX; | 10108 Elemcount ending1 = MOST_POSITIVE_FIXNUM, ending2 = MOST_POSITIVE_FIXNUM; |
10109 Elemcount starting1, starting2; | 10109 Elemcount starting1, starting2; |
10110 | 10110 |
10111 check_sequence_range (array1, start1, end1, make_int (len1)); | 10111 check_sequence_range (array1, start1, end1, make_fixnum (len1)); |
10112 check_sequence_range (array2, start2, end2, make_int (len2)); | 10112 check_sequence_range (array2, start2, end2, make_fixnum (len2)); |
10113 | 10113 |
10114 starting1 = INTP (start1) ? XINT (start1) : 1 + EMACS_INT_MAX; | 10114 starting1 = FIXNUMP (start1) ? XFIXNUM (start1) : 1 + MOST_POSITIVE_FIXNUM; |
10115 starting2 = INTP (start2) ? XINT (start2) : 1 + EMACS_INT_MAX; | 10115 starting2 = FIXNUMP (start2) ? XFIXNUM (start2) : 1 + MOST_POSITIVE_FIXNUM; |
10116 | 10116 |
10117 if (!NILP (end1)) | 10117 if (!NILP (end1)) |
10118 { | 10118 { |
10119 ending1 = INTP (end1) ? XINT (end1) : 1 + EMACS_INT_MAX; | 10119 ending1 = FIXNUMP (end1) ? XFIXNUM (end1) : 1 + MOST_POSITIVE_FIXNUM; |
10120 } | 10120 } |
10121 | 10121 |
10122 if (!NILP (end2)) | 10122 if (!NILP (end2)) |
10123 { | 10123 { |
10124 ending2 = INTP (end2) ? XINT (end2) : 1 + EMACS_INT_MAX; | 10124 ending2 = FIXNUMP (end2) ? XFIXNUM (end2) : 1 + MOST_POSITIVE_FIXNUM; |
10125 } | 10125 } |
10126 | 10126 |
10127 ending1 = min (ending1, len1); | 10127 ending1 = min (ending1, len1); |
10128 ending2 = min (ending2, len2); | 10128 ending2 = min (ending2, len2); |
10129 | 10129 |
10130 while (starting1 < ending1 && starting2 < ending2) | 10130 while (starting1 < ending1 && starting2 < ending2) |
10131 { | 10131 { |
10132 if (check_match (test, key, Faref (array1, make_int (starting1)), | 10132 if (check_match (test, key, Faref (array1, make_fixnum (starting1)), |
10133 Faref (array2, make_int (starting2))) | 10133 Faref (array2, make_fixnum (starting2))) |
10134 != test_not_unboundp) | 10134 != test_not_unboundp) |
10135 { | 10135 { |
10136 return make_integer (starting1); | 10136 return make_integer (starting1); |
10137 } | 10137 } |
10138 starting1++; | 10138 starting1++; |
10294 { | 10294 { |
10295 Lisp_Object sequence1 = args[0], sequence2 = args[1], position0 = Qnil; | 10295 Lisp_Object sequence1 = args[0], sequence2 = args[1], position0 = Qnil; |
10296 Boolint test_not_unboundp = 1, return_first = 0; | 10296 Boolint test_not_unboundp = 1, return_first = 0; |
10297 check_test_func_t check_test = NULL, check_match = NULL; | 10297 check_test_func_t check_test = NULL, check_match = NULL; |
10298 mismatch_func_t mismatch = NULL; | 10298 mismatch_func_t mismatch = NULL; |
10299 Elemcount starting1 = 0, ending1 = 1 + EMACS_INT_MAX, starting2 = 0; | 10299 Elemcount starting1 = 0, ending1 = 1 + MOST_POSITIVE_FIXNUM, starting2 = 0; |
10300 Elemcount ending2 = 1 + EMACS_INT_MAX, ii = 0; | 10300 Elemcount ending2 = 1 + MOST_POSITIVE_FIXNUM, ii = 0; |
10301 Elemcount length1; | 10301 Elemcount length1; |
10302 Lisp_Object object = Qnil; | 10302 Lisp_Object object = Qnil; |
10303 struct gcpro gcpro1, gcpro2; | 10303 struct gcpro gcpro1, gcpro2; |
10304 | 10304 |
10305 PARSE_KEYWORDS (Fsearch, nargs, args, 8, | 10305 PARSE_KEYWORDS (Fsearch, nargs, args, 8, |
10309 CHECK_SEQUENCE (sequence1); | 10309 CHECK_SEQUENCE (sequence1); |
10310 CHECK_SEQUENCE (sequence2); | 10310 CHECK_SEQUENCE (sequence2); |
10311 CHECK_KEY_ARGUMENT (key); | 10311 CHECK_KEY_ARGUMENT (key); |
10312 | 10312 |
10313 CHECK_NATNUM (start1); | 10313 CHECK_NATNUM (start1); |
10314 starting1 = INTP (start1) ? XINT (start1) : 1 + EMACS_INT_MAX; | 10314 starting1 = FIXNUMP (start1) ? XFIXNUM (start1) : 1 + MOST_POSITIVE_FIXNUM; |
10315 CHECK_NATNUM (start2); | 10315 CHECK_NATNUM (start2); |
10316 starting2 = INTP (start2) ? XINT (start2) : 1 + EMACS_INT_MAX; | 10316 starting2 = FIXNUMP (start2) ? XFIXNUM (start2) : 1 + MOST_POSITIVE_FIXNUM; |
10317 | 10317 |
10318 if (!NILP (end1)) | 10318 if (!NILP (end1)) |
10319 { | 10319 { |
10320 Lisp_Object len1 = Flength (sequence1); | 10320 Lisp_Object len1 = Flength (sequence1); |
10321 | 10321 |
10322 CHECK_NATNUM (end1); | 10322 CHECK_NATNUM (end1); |
10323 check_sequence_range (sequence1, start1, end1, len1); | 10323 check_sequence_range (sequence1, start1, end1, len1); |
10324 ending1 = min (XINT (end1), XINT (len1)); | 10324 ending1 = min (XFIXNUM (end1), XFIXNUM (len1)); |
10325 } | 10325 } |
10326 else | 10326 else |
10327 { | 10327 { |
10328 end1 = Flength (sequence1); | 10328 end1 = Flength (sequence1); |
10329 check_sequence_range (sequence1, start1, end1, end1); | 10329 check_sequence_range (sequence1, start1, end1, end1); |
10330 ending1 = XINT (end1); | 10330 ending1 = XFIXNUM (end1); |
10331 } | 10331 } |
10332 | 10332 |
10333 length1 = ending1 - starting1; | 10333 length1 = ending1 - starting1; |
10334 | 10334 |
10335 if (!NILP (end2)) | 10335 if (!NILP (end2)) |
10336 { | 10336 { |
10337 Lisp_Object len2 = Flength (sequence2); | 10337 Lisp_Object len2 = Flength (sequence2); |
10338 | 10338 |
10339 CHECK_NATNUM (end2); | 10339 CHECK_NATNUM (end2); |
10340 check_sequence_range (sequence2, start2, end2, len2); | 10340 check_sequence_range (sequence2, start2, end2, len2); |
10341 ending2 = min (XINT (end2), XINT (len2)); | 10341 ending2 = min (XFIXNUM (end2), XFIXNUM (len2)); |
10342 } | 10342 } |
10343 else | 10343 else |
10344 { | 10344 { |
10345 end2 = Flength (sequence2); | 10345 end2 = Flength (sequence2); |
10346 check_sequence_range (sequence2, start2, end2, end2); | 10346 check_sequence_range (sequence2, start2, end2, end2); |
10347 ending2 = XINT (end2); | 10347 ending2 = XFIXNUM (end2); |
10348 } | 10348 } |
10349 | 10349 |
10350 check_match = get_check_match_function (&test, test_not, Qnil, Qnil, key, | 10350 check_match = get_check_match_function (&test, test_not, Qnil, Qnil, key, |
10351 &test_not_unboundp, &check_test); | 10351 &test_not_unboundp, &check_test); |
10352 mismatch = get_mismatch_func (sequence1, sequence2, from_end, &return_first); | 10352 mismatch = get_mismatch_func (sequence1, sequence2, from_end, &return_first); |
10374 | 10374 |
10375 ii = starting2; | 10375 ii = starting2; |
10376 while (ii < ending2) | 10376 while (ii < ending2) |
10377 { | 10377 { |
10378 position0 = position (&object, first, sequence2, check_test, | 10378 position0 = position (&object, first, sequence2, check_test, |
10379 test_not_unboundp, test, key, make_int (ii), | 10379 test_not_unboundp, test, key, make_fixnum (ii), |
10380 end2, Qnil, Qnil, Qsearch); | 10380 end2, Qnil, Qnil, Qsearch); |
10381 if (NILP (position0)) | 10381 if (NILP (position0)) |
10382 { | 10382 { |
10383 UNGCPRO; | 10383 UNGCPRO; |
10384 return Qnil; | 10384 return Qnil; |
10385 } | 10385 } |
10386 | 10386 |
10387 if (length1 + XINT (position0) <= ending2 && | 10387 if (length1 + XFIXNUM (position0) <= ending2 && |
10388 (return_first ? | 10388 (return_first ? |
10389 NILP (mismatch (sequence1, mismatch_start1, end1, | 10389 NILP (mismatch (sequence1, mismatch_start1, end1, |
10390 sequence2, | 10390 sequence2, |
10391 make_int (1 + XINT (position0)), | 10391 make_fixnum (1 + XFIXNUM (position0)), |
10392 make_int (length1 + XINT (position0)), | 10392 make_fixnum (length1 + XFIXNUM (position0)), |
10393 check_match, test_not_unboundp, test, key, 1)) : | 10393 check_match, test_not_unboundp, test, key, 1)) : |
10394 NILP (mismatch (sequence2, | 10394 NILP (mismatch (sequence2, |
10395 make_int (1 + XINT (position0)), | 10395 make_fixnum (1 + XFIXNUM (position0)), |
10396 make_int (length1 + XINT (position0)), | 10396 make_fixnum (length1 + XFIXNUM (position0)), |
10397 sequence1, mismatch_start1, end1, | 10397 sequence1, mismatch_start1, end1, |
10398 check_match, test_not_unboundp, test, key, 0)))) | 10398 check_match, test_not_unboundp, test, key, 0)))) |
10399 | 10399 |
10400 | 10400 |
10401 { | 10401 { |
10402 UNGCPRO; | 10402 UNGCPRO; |
10403 return position0; | 10403 return position0; |
10404 } | 10404 } |
10405 | 10405 |
10406 ii = XINT (position0) + 1; | 10406 ii = XFIXNUM (position0) + 1; |
10407 } | 10407 } |
10408 | 10408 |
10409 UNGCPRO; | 10409 UNGCPRO; |
10410 } | 10410 } |
10411 else | 10411 else |
10417 ii = ending2; | 10417 ii = ending2; |
10418 while (ii > starting2) | 10418 while (ii > starting2) |
10419 { | 10419 { |
10420 position0 = position (&object, last, sequence2, check_test, | 10420 position0 = position (&object, last, sequence2, check_test, |
10421 test_not_unboundp, test, key, start2, | 10421 test_not_unboundp, test, key, start2, |
10422 make_int (ii), Qt, Qnil, Qsearch); | 10422 make_fixnum (ii), Qt, Qnil, Qsearch); |
10423 | 10423 |
10424 if (NILP (position0)) | 10424 if (NILP (position0)) |
10425 { | 10425 { |
10426 UNGCPRO; | 10426 UNGCPRO; |
10427 return Qnil; | 10427 return Qnil; |
10428 } | 10428 } |
10429 | 10429 |
10430 if (XINT (position0) - length1 + 1 >= starting2 && | 10430 if (XFIXNUM (position0) - length1 + 1 >= starting2 && |
10431 (return_first ? | 10431 (return_first ? |
10432 NILP (mismatch (sequence1, start1, mismatch_end1, | 10432 NILP (mismatch (sequence1, start1, mismatch_end1, |
10433 sequence2, | 10433 sequence2, |
10434 make_int (XINT (position0) - length1 + 1), | 10434 make_fixnum (XFIXNUM (position0) - length1 + 1), |
10435 make_int (XINT (position0)), | 10435 make_fixnum (XFIXNUM (position0)), |
10436 check_match, test_not_unboundp, test, key, 1)) : | 10436 check_match, test_not_unboundp, test, key, 1)) : |
10437 NILP (mismatch (sequence2, | 10437 NILP (mismatch (sequence2, |
10438 make_int (XINT (position0) - length1 + 1), | 10438 make_fixnum (XFIXNUM (position0) - length1 + 1), |
10439 make_int (XINT (position0)), | 10439 make_fixnum (XFIXNUM (position0)), |
10440 sequence1, start1, mismatch_end1, | 10440 sequence1, start1, mismatch_end1, |
10441 check_match, test_not_unboundp, test, key, 0)))) | 10441 check_match, test_not_unboundp, test, key, 0)))) |
10442 { | 10442 { |
10443 UNGCPRO; | 10443 UNGCPRO; |
10444 return make_int (XINT (position0) - length1 + 1); | 10444 return make_fixnum (XFIXNUM (position0) - length1 + 1); |
10445 } | 10445 } |
10446 | 10446 |
10447 ii = XINT (position0); | 10447 ii = XFIXNUM (position0); |
10448 } | 10448 } |
10449 | 10449 |
10450 UNGCPRO; | 10450 UNGCPRO; |
10451 } | 10451 } |
10452 | 10452 |
11097 invalid_operation ("Could not get load-average", lisp_strerror (errno)); | 11097 invalid_operation ("Could not get load-average", lisp_strerror (errno)); |
11098 | 11098 |
11099 while (loads-- > 0) | 11099 while (loads-- > 0) |
11100 { | 11100 { |
11101 Lisp_Object load = (NILP (use_floats) ? | 11101 Lisp_Object load = (NILP (use_floats) ? |
11102 make_int ((int) (100.0 * load_ave[loads])) | 11102 make_fixnum ((int) (100.0 * load_ave[loads])) |
11103 : make_float (load_ave[loads])); | 11103 : make_float (load_ave[loads])); |
11104 ret = Fcons (load, ret); | 11104 ret = Fcons (load, ret); |
11105 } | 11105 } |
11106 return ret; | 11106 return ret; |
11107 } | 11107 } |
11159 if (SYMBOLP (fexp)) | 11159 if (SYMBOLP (fexp)) |
11160 { | 11160 { |
11161 /* Original definition */ | 11161 /* Original definition */ |
11162 return NILP (Fmemq (fexp, Vfeatures)) ? Qnil : Qt; | 11162 return NILP (Fmemq (fexp, Vfeatures)) ? Qnil : Qt; |
11163 } | 11163 } |
11164 else if (INTP (fexp) || FLOATP (fexp)) | 11164 else if (FIXNUMP (fexp) || FLOATP (fexp)) |
11165 { | 11165 { |
11166 double d = extract_float (fexp); | 11166 double d = extract_float (fexp); |
11167 | 11167 |
11168 if (featurep_emacs_version == 0.0) | 11168 if (featurep_emacs_version == 0.0) |
11169 { | 11169 { |
11170 featurep_emacs_version = XINT (Vemacs_major_version) + | 11170 featurep_emacs_version = XFIXNUM (Vemacs_major_version) + |
11171 (XINT (Vemacs_minor_version) / 100.0); | 11171 (XFIXNUM (Vemacs_minor_version) / 100.0); |
11172 } | 11172 } |
11173 return featurep_emacs_version >= d ? Qt : Qnil; | 11173 return featurep_emacs_version >= d ? Qt : Qnil; |
11174 } | 11174 } |
11175 else if (CONSP (fexp)) | 11175 else if (CONSP (fexp)) |
11176 { | 11176 { |
11457 ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos); | 11457 ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos); |
11458 if (ec < 0) | 11458 if (ec < 0) |
11459 break; | 11459 break; |
11460 if (ec == '=') | 11460 if (ec == '=') |
11461 base64_conversion_error ("Illegal `=' character while decoding base64", | 11461 base64_conversion_error ("Illegal `=' character while decoding base64", |
11462 make_int (streampos)); | 11462 make_fixnum (streampos)); |
11463 value = base64_char_to_value[ec] << 18; | 11463 value = base64_char_to_value[ec] << 18; |
11464 | 11464 |
11465 /* Process second byte of a quadruplet. */ | 11465 /* Process second byte of a quadruplet. */ |
11466 ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos); | 11466 ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos); |
11467 if (ec < 0) | 11467 if (ec < 0) |
11468 base64_conversion_error ("Premature EOF while decoding base64", | 11468 base64_conversion_error ("Premature EOF while decoding base64", |
11469 Qunbound); | 11469 Qunbound); |
11470 if (ec == '=') | 11470 if (ec == '=') |
11471 base64_conversion_error ("Illegal `=' character while decoding base64", | 11471 base64_conversion_error ("Illegal `=' character while decoding base64", |
11472 make_int (streampos)); | 11472 make_fixnum (streampos)); |
11473 value |= base64_char_to_value[ec] << 12; | 11473 value |= base64_char_to_value[ec] << 12; |
11474 STORE_BYTE (e, value >> 16, ccnt); | 11474 STORE_BYTE (e, value >> 16, ccnt); |
11475 | 11475 |
11476 /* Process third byte of a quadruplet. */ | 11476 /* Process third byte of a quadruplet. */ |
11477 ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos); | 11477 ADVANCE_INPUT_IGNORE_NONBASE64 (ec, istream, streampos); |
11486 base64_conversion_error ("Premature EOF while decoding base64", | 11486 base64_conversion_error ("Premature EOF while decoding base64", |
11487 Qunbound); | 11487 Qunbound); |
11488 if (ec != '=') | 11488 if (ec != '=') |
11489 base64_conversion_error | 11489 base64_conversion_error |
11490 ("Padding `=' expected but not found while decoding base64", | 11490 ("Padding `=' expected but not found while decoding base64", |
11491 make_int (streampos)); | 11491 make_fixnum (streampos)); |
11492 continue; | 11492 continue; |
11493 } | 11493 } |
11494 | 11494 |
11495 value |= base64_char_to_value[ec] << 6; | 11495 value |= base64_char_to_value[ec] << 6; |
11496 STORE_BYTE (e, 0xff & value >> 8, ccnt); | 11496 STORE_BYTE (e, 0xff & value >> 8, ccnt); |
11559 in the region, place it at the beginning. */ | 11559 in the region, place it at the beginning. */ |
11560 if (old_pt >= begv && old_pt < zv) | 11560 if (old_pt >= begv && old_pt < zv) |
11561 BUF_SET_PT (buf, begv); | 11561 BUF_SET_PT (buf, begv); |
11562 | 11562 |
11563 /* We return the length of the encoded text. */ | 11563 /* We return the length of the encoded text. */ |
11564 return make_int (encoded_length); | 11564 return make_fixnum (encoded_length); |
11565 } | 11565 } |
11566 | 11566 |
11567 DEFUN ("base64-encode-string", Fbase64_encode_string, 1, 2, 0, /* | 11567 DEFUN ("base64-encode-string", Fbase64_encode_string, 1, 2, 0, /* |
11568 Base64 encode STRING and return the result. | 11568 Base64 encode STRING and return the result. |
11569 Optional argument NO-LINE-BREAK means do not break long lines | 11569 Optional argument NO-LINE-BREAK means do not break long lines |
11633 /* Simulate FSF Emacs implementation of this function: if point was | 11633 /* Simulate FSF Emacs implementation of this function: if point was |
11634 in the region, place it at the beginning. */ | 11634 in the region, place it at the beginning. */ |
11635 if (old_pt >= begv && old_pt < zv) | 11635 if (old_pt >= begv && old_pt < zv) |
11636 BUF_SET_PT (buf, begv); | 11636 BUF_SET_PT (buf, begv); |
11637 | 11637 |
11638 return make_int (cc_decoded_length); | 11638 return make_fixnum (cc_decoded_length); |
11639 } | 11639 } |
11640 | 11640 |
11641 DEFUN ("base64-decode-string", Fbase64_decode_string, 1, 1, 0, /* | 11641 DEFUN ("base64-decode-string", Fbase64_decode_string, 1, 1, 0, /* |
11642 Base64-decode STRING and return the result. | 11642 Base64-decode STRING and return the result. |
11643 Characters out of the base64 alphabet are ignored. | 11643 Characters out of the base64 alphabet are ignored. |