comparison src/text.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 4dee0387b9de
children 7a538e1a4676
comparison
equal deleted inserted replaced
5580:a0e81357194e 5581:56144c8593a8
3647 { 3647 {
3648 /* Does not GC */ 3648 /* Does not GC */
3649 Charbpos ind; 3649 Charbpos ind;
3650 Charbpos min_allowed, max_allowed; 3650 Charbpos min_allowed, max_allowed;
3651 3651
3652 CHECK_INT_COERCE_MARKER (pos); 3652 CHECK_FIXNUM_COERCE_MARKER (pos);
3653 ind = XINT (pos); 3653 ind = XFIXNUM (pos);
3654 min_allowed = flags & GB_ALLOW_PAST_ACCESSIBLE ? BUF_BEG (b) : BUF_BEGV (b); 3654 min_allowed = flags & GB_ALLOW_PAST_ACCESSIBLE ? BUF_BEG (b) : BUF_BEGV (b);
3655 max_allowed = flags & GB_ALLOW_PAST_ACCESSIBLE ? BUF_Z (b) : BUF_ZV (b); 3655 max_allowed = flags & GB_ALLOW_PAST_ACCESSIBLE ? BUF_Z (b) : BUF_ZV (b);
3656 3656
3657 if (ind < min_allowed || ind > max_allowed) 3657 if (ind < min_allowed || ind > max_allowed)
3658 { 3658 {
3760 Charcount min_allowed = 0; 3760 Charcount min_allowed = 0;
3761 Charcount max_allowed = known_length; 3761 Charcount max_allowed = known_length;
3762 3762
3763 /* Computation of KNOWN_LENGTH is potentially expensive so we pass 3763 /* Computation of KNOWN_LENGTH is potentially expensive so we pass
3764 it in. */ 3764 it in. */
3765 CHECK_INT (pos); 3765 CHECK_FIXNUM (pos);
3766 ccpos = XINT (pos); 3766 ccpos = XFIXNUM (pos);
3767 if (ccpos < 0 && flags & GB_NEGATIVE_FROM_END) 3767 if (ccpos < 0 && flags & GB_NEGATIVE_FROM_END)
3768 ccpos += max_allowed; 3768 ccpos += max_allowed;
3769 3769
3770 if (ccpos < min_allowed || ccpos > max_allowed) 3770 if (ccpos < min_allowed || ccpos > max_allowed)
3771 { 3771 {
4743 return 0; 4743 return 0;
4744 4744
4745 #ifdef ENABLE_COMPOSITE_CHARS 4745 #ifdef ENABLE_COMPOSITE_CHARS
4746 if (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE == LEADING_BYTE_COMPOSITE) 4746 if (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE == LEADING_BYTE_COMPOSITE)
4747 { 4747 {
4748 if (UNBOUNDP (Fgethash (make_int (ch), 4748 if (UNBOUNDP (Fgethash (make_fixnum (ch),
4749 Vcomposite_char_char2string_hash_table, 4749 Vcomposite_char_char2string_hash_table,
4750 Qunbound))) 4750 Qunbound)))
4751 return 0; 4751 return 0;
4752 return 1; 4752 return 1;
4753 } 4753 }
4916 charset = Fget_charset (charset); 4916 charset = Fget_charset (charset);
4917 cs = XCHARSET (charset); 4917 cs = XCHARSET (charset);
4918 4918
4919 get_charset_limits (charset, &lowlim, &highlim); 4919 get_charset_limits (charset, &lowlim, &highlim);
4920 4920
4921 CHECK_INT (arg1); 4921 CHECK_FIXNUM (arg1);
4922 /* It is useful (and safe, according to Olivier Galibert) to strip 4922 /* It is useful (and safe, according to Olivier Galibert) to strip
4923 the 8th bit off ARG1 and ARG2 because it allows programmers to 4923 the 8th bit off ARG1 and ARG2 because it allows programmers to
4924 write (make-char 'latin-iso8859-2 CODE) where code is the actual 4924 write (make-char 'latin-iso8859-2 CODE) where code is the actual
4925 Latin 2 code of the character. */ 4925 Latin 2 code of the character. */
4926 a1 = XINT (arg1) & 0x7f; 4926 a1 = XFIXNUM (arg1) & 0x7f;
4927 if (a1 < lowlim || a1 > highlim) 4927 if (a1 < lowlim || a1 > highlim)
4928 args_out_of_range_3 (arg1, make_int (lowlim), make_int (highlim)); 4928 args_out_of_range_3 (arg1, make_fixnum (lowlim), make_fixnum (highlim));
4929 4929
4930 if (CHARSET_DIMENSION (cs) == 1) 4930 if (CHARSET_DIMENSION (cs) == 1)
4931 { 4931 {
4932 if (!NILP (arg2)) 4932 if (!NILP (arg2))
4933 invalid_argument 4933 invalid_argument
4934 ("Charset is of dimension one; second octet must be nil", arg2); 4934 ("Charset is of dimension one; second octet must be nil", arg2);
4935 return make_char (make_ichar (charset, a1, 0)); 4935 return make_char (make_ichar (charset, a1, 0));
4936 } 4936 }
4937 4937
4938 CHECK_INT (arg2); 4938 CHECK_FIXNUM (arg2);
4939 a2 = XINT (arg2) & 0x7f; 4939 a2 = XFIXNUM (arg2) & 0x7f;
4940 if (a2 < lowlim || a2 > highlim) 4940 if (a2 < lowlim || a2 > highlim)
4941 args_out_of_range_3 (arg2, make_int (lowlim), make_int (highlim)); 4941 args_out_of_range_3 (arg2, make_fixnum (lowlim), make_fixnum (highlim));
4942 4942
4943 return make_char (make_ichar (charset, a1, a2)); 4943 return make_char (make_ichar (charset, a1, a2));
4944 #else 4944 #else
4945 int a1; 4945 int a1;
4946 int lowlim, highlim; 4946 int lowlim, highlim;
4947 4947
4948 if (EQ (charset, Qascii)) lowlim = 0, highlim = 127; 4948 if (EQ (charset, Qascii)) lowlim = 0, highlim = 127;
4949 else if (EQ (charset, Qcontrol_1)) lowlim = 0, highlim = 31; 4949 else if (EQ (charset, Qcontrol_1)) lowlim = 0, highlim = 31;
4950 else lowlim = 0, highlim = 127; 4950 else lowlim = 0, highlim = 127;
4951 4951
4952 CHECK_INT (arg1); 4952 CHECK_FIXNUM (arg1);
4953 /* It is useful (and safe, according to Olivier Galibert) to strip 4953 /* It is useful (and safe, according to Olivier Galibert) to strip
4954 the 8th bit off ARG1 and ARG2 because it allows programmers to 4954 the 8th bit off ARG1 and ARG2 because it allows programmers to
4955 write (make-char 'latin-iso8859-2 CODE) where code is the actual 4955 write (make-char 'latin-iso8859-2 CODE) where code is the actual
4956 Latin 2 code of the character. */ 4956 Latin 2 code of the character. */
4957 a1 = XINT (arg1) & 0x7f; 4957 a1 = XFIXNUM (arg1) & 0x7f;
4958 if (a1 < lowlim || a1 > highlim) 4958 if (a1 < lowlim || a1 > highlim)
4959 args_out_of_range_3 (arg1, make_int (lowlim), make_int (highlim)); 4959 args_out_of_range_3 (arg1, make_fixnum (lowlim), make_fixnum (highlim));
4960 4960
4961 if (EQ (charset, Qascii)) 4961 if (EQ (charset, Qascii))
4962 return make_char (a1); 4962 return make_char (a1);
4963 return make_char (a1 + 128); 4963 return make_char (a1 + 128);
4964 #endif /* MULE */ 4964 #endif /* MULE */
4989 CHECK_CHAR_COERCE_INT (ch); 4989 CHECK_CHAR_COERCE_INT (ch);
4990 4990
4991 BREAKUP_ICHAR (XCHAR (ch), charset, octet0, octet1); 4991 BREAKUP_ICHAR (XCHAR (ch), charset, octet0, octet1);
4992 4992
4993 if (NILP (n) || EQ (n, Qzero)) 4993 if (NILP (n) || EQ (n, Qzero))
4994 return make_int (octet0); 4994 return make_fixnum (octet0);
4995 else if (EQ (n, make_int (1))) 4995 else if (EQ (n, make_fixnum (1)))
4996 return make_int (octet1); 4996 return make_fixnum (octet1);
4997 else 4997 else
4998 invalid_constant ("Octet number must be 0 or 1", n); 4998 invalid_constant ("Octet number must be 0 or 1", n);
4999 } 4999 }
5000 5000
5001 #endif /* MULE */ 5001 #endif /* MULE */
5016 5016
5017 BREAKUP_ICHAR (XCHAR (character), charset, c1, c2); 5017 BREAKUP_ICHAR (XCHAR (character), charset, c1, c2);
5018 5018
5019 if (XCHARSET_DIMENSION (charset) == 2) 5019 if (XCHARSET_DIMENSION (charset) == 2)
5020 { 5020 {
5021 rc = list3 (XCHARSET_NAME (charset), make_int (c1), make_int (c2)); 5021 rc = list3 (XCHARSET_NAME (charset), make_fixnum (c1), make_fixnum (c2));
5022 } 5022 }
5023 else 5023 else
5024 { 5024 {
5025 rc = list2 (XCHARSET_NAME (charset), make_int (c1)); 5025 rc = list2 (XCHARSET_NAME (charset), make_fixnum (c1));
5026 } 5026 }
5027 UNGCPRO; 5027 UNGCPRO;
5028 5028
5029 return rc; 5029 return rc;
5030 } 5030 }