Mercurial > hg > xemacs-beta
comparison src/cmds.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 | 8d29f1c4bb98 |
children | ad35a0cd95f5 |
comparison
equal
deleted
inserted
replaced
5580:a0e81357194e | 5581:56144c8593a8 |
---|---|
63 | 63 |
64 if (NILP (count)) | 64 if (NILP (count)) |
65 n = 1; | 65 n = 1; |
66 else | 66 else |
67 { | 67 { |
68 CHECK_INT (count); | 68 CHECK_FIXNUM (count); |
69 n = XINT (count); | 69 n = XFIXNUM (count); |
70 } | 70 } |
71 | 71 |
72 /* This used to just set point to point + XINT (count), and then check | 72 /* This used to just set point to point + XFIXNUM (count), and then check |
73 to see if it was within boundaries. But now that SET_PT can | 73 to see if it was within boundaries. But now that SET_PT can |
74 potentially do a lot of stuff (calling entering and exiting | 74 potentially do a lot of stuff (calling entering and exiting |
75 hooks, etcetera), that's not a good approach. So we validate the | 75 hooks, etcetera), that's not a good approach. So we validate the |
76 proposed position, then set point. */ | 76 proposed position, then set point. */ |
77 { | 77 { |
107 the documentation for this variable for more details. | 107 the documentation for this variable for more details. |
108 */ | 108 */ |
109 (count, buffer)) | 109 (count, buffer)) |
110 { | 110 { |
111 if (NILP (count)) | 111 if (NILP (count)) |
112 count = make_int (-1); | 112 count = make_fixnum (-1); |
113 else | 113 else |
114 { | 114 { |
115 CHECK_INT (count); | 115 CHECK_FIXNUM (count); |
116 count = make_int (- XINT (count)); | 116 count = make_fixnum (- XFIXNUM (count)); |
117 } | 117 } |
118 return Fforward_char (count, buffer); | 118 return Fforward_char (count, buffer); |
119 } | 119 } |
120 | 120 |
121 DEFUN ("forward-line", Fforward_line, 0, 2, "_p", /* | 121 DEFUN ("forward-line", Fforward_line, 0, 2, "_p", /* |
143 | 143 |
144 if (NILP (count)) | 144 if (NILP (count)) |
145 n = 1; | 145 n = 1; |
146 else | 146 else |
147 { | 147 { |
148 CHECK_INT (count); | 148 CHECK_FIXNUM (count); |
149 n = XINT (count); | 149 n = XFIXNUM (count); |
150 } | 150 } |
151 | 151 |
152 negp = n <= 0; | 152 negp = n <= 0; |
153 pos = scan_buffer (buf, '\n', pos2, 0, n - negp, &shortage, 1); | 153 pos = scan_buffer (buf, '\n', pos2, 0, n - negp, &shortage, 1); |
154 if (shortage > 0 | 154 if (shortage > 0 |
156 || (BUF_ZV (buf) > BUF_BEGV (buf) | 156 || (BUF_ZV (buf) > BUF_BEGV (buf) |
157 && pos != pos2 | 157 && pos != pos2 |
158 && BUF_FETCH_CHAR (buf, pos - 1) != '\n'))) | 158 && BUF_FETCH_CHAR (buf, pos - 1) != '\n'))) |
159 shortage--; | 159 shortage--; |
160 BUF_SET_PT (buf, pos); | 160 BUF_SET_PT (buf, pos); |
161 return make_int (negp ? - shortage : shortage); | 161 return make_fixnum (negp ? - shortage : shortage); |
162 } | 162 } |
163 | 163 |
164 DEFUN ("point-at-bol", Fpoint_at_bol, 0, 2, 0, /* | 164 DEFUN ("point-at-bol", Fpoint_at_bol, 0, 2, 0, /* |
165 Return the character position of the first character on the current line. | 165 Return the character position of the first character on the current line. |
166 With argument COUNT not nil or 1, move forward COUNT - 1 lines first. | 166 With argument COUNT not nil or 1, move forward COUNT - 1 lines first. |
172 struct buffer *b = decode_buffer (buffer, 1); | 172 struct buffer *b = decode_buffer (buffer, 1); |
173 REGISTER int orig, end; | 173 REGISTER int orig, end; |
174 | 174 |
175 buffer = wrap_buffer (b); | 175 buffer = wrap_buffer (b); |
176 if (NILP (count)) | 176 if (NILP (count)) |
177 count = make_int (0); | 177 count = make_fixnum (0); |
178 else | 178 else |
179 { | 179 { |
180 CHECK_INT (count); | 180 CHECK_FIXNUM (count); |
181 count = make_int (XINT (count) - 1); | 181 count = make_fixnum (XFIXNUM (count) - 1); |
182 } | 182 } |
183 | 183 |
184 orig = BUF_PT (b); | 184 orig = BUF_PT (b); |
185 Fforward_line (count, buffer); | 185 Fforward_line (count, buffer); |
186 end = BUF_PT (b); | 186 end = BUF_PT (b); |
187 BUF_SET_PT (b, orig); | 187 BUF_SET_PT (b, orig); |
188 | 188 |
189 return make_int (end); | 189 return make_fixnum (end); |
190 } | 190 } |
191 | 191 |
192 DEFUN ("beginning-of-line", Fbeginning_of_line, 0, 2, "_p", /* | 192 DEFUN ("beginning-of-line", Fbeginning_of_line, 0, 2, "_p", /* |
193 Move point to beginning of current line. | 193 Move point to beginning of current line. |
194 With argument COUNT not nil or 1, move forward COUNT - 1 lines first. | 194 With argument COUNT not nil or 1, move forward COUNT - 1 lines first. |
202 */ | 202 */ |
203 (count, buffer)) | 203 (count, buffer)) |
204 { | 204 { |
205 struct buffer *b = decode_buffer (buffer, 1); | 205 struct buffer *b = decode_buffer (buffer, 1); |
206 | 206 |
207 BUF_SET_PT (b, XINT (Fpoint_at_bol (count, buffer))); | 207 BUF_SET_PT (b, XFIXNUM (Fpoint_at_bol (count, buffer))); |
208 return Qnil; | 208 return Qnil; |
209 } | 209 } |
210 | 210 |
211 DEFUN ("point-at-eol", Fpoint_at_eol, 0, 2, 0, /* | 211 DEFUN ("point-at-eol", Fpoint_at_eol, 0, 2, 0, /* |
212 Return the character position of the last character on the current line. | 212 Return the character position of the last character on the current line. |
221 | 221 |
222 if (NILP (count)) | 222 if (NILP (count)) |
223 n = 1; | 223 n = 1; |
224 else | 224 else |
225 { | 225 { |
226 CHECK_INT (count); | 226 CHECK_FIXNUM (count); |
227 n = XINT (count); | 227 n = XFIXNUM (count); |
228 } | 228 } |
229 | 229 |
230 return make_int (find_before_next_newline (buf, BUF_PT (buf), 0, | 230 return make_fixnum (find_before_next_newline (buf, BUF_PT (buf), 0, |
231 n - (n <= 0))); | 231 n - (n <= 0))); |
232 } | 232 } |
233 | 233 |
234 DEFUN ("end-of-line", Fend_of_line, 0, 2, "_p", /* | 234 DEFUN ("end-of-line", Fend_of_line, 0, 2, "_p", /* |
235 Move point to end of current line. | 235 Move point to end of current line. |
244 */ | 244 */ |
245 (count, buffer)) | 245 (count, buffer)) |
246 { | 246 { |
247 struct buffer *b = decode_buffer (buffer, 1); | 247 struct buffer *b = decode_buffer (buffer, 1); |
248 | 248 |
249 BUF_SET_PT (b, XINT (Fpoint_at_eol (count, buffer))); | 249 BUF_SET_PT (b, XFIXNUM (Fpoint_at_eol (count, buffer))); |
250 return Qnil; | 250 return Qnil; |
251 } | 251 } |
252 | 252 |
253 DEFUN ("delete-char", Fdelete_char, 0, 2, "*p\nP", /* | 253 DEFUN ("delete-char", Fdelete_char, 0, 2, "*p\nP", /* |
254 Delete the following COUNT characters (previous, with negative COUNT). | 254 Delete the following COUNT characters (previous, with negative COUNT). |
265 | 265 |
266 if (NILP (count)) | 266 if (NILP (count)) |
267 n = 1; | 267 n = 1; |
268 else | 268 else |
269 { | 269 { |
270 CHECK_INT (count); | 270 CHECK_FIXNUM (count); |
271 n = XINT (count); | 271 n = XFIXNUM (count); |
272 } | 272 } |
273 | 273 |
274 pos = BUF_PT (buf) + n; | 274 pos = BUF_PT (buf) + n; |
275 if (NILP (killp)) | 275 if (NILP (killp)) |
276 { | 276 { |
309 | 309 |
310 if (NILP (count)) | 310 if (NILP (count)) |
311 n = 1; | 311 n = 1; |
312 else | 312 else |
313 { | 313 { |
314 CHECK_INT (count); | 314 CHECK_FIXNUM (count); |
315 n = XINT (count); | 315 n = XFIXNUM (count); |
316 } | 316 } |
317 | 317 |
318 return Fdelete_char (make_int (- n), killp); | 318 return Fdelete_char (make_fixnum (- n), killp); |
319 } | 319 } |
320 | 320 |
321 static void internal_self_insert (Ichar ch, int noautofill); | 321 static void internal_self_insert (Ichar ch, int noautofill); |
322 | 322 |
323 DEFUN ("self-insert-command", Fself_insert_command, 1, 1, "*p", /* | 323 DEFUN ("self-insert-command", Fself_insert_command, 1, 1, "*p", /* |
332 Lisp_Object c; | 332 Lisp_Object c; |
333 EMACS_INT n; | 333 EMACS_INT n; |
334 | 334 |
335 /* Can't insert more than most-positive-fixnum characters, the buffer | 335 /* Can't insert more than most-positive-fixnum characters, the buffer |
336 won't hold that many. */ | 336 won't hold that many. */ |
337 check_integer_range (count, Qzero, make_int (EMACS_INT_MAX)); | 337 check_integer_range (count, Qzero, make_fixnum (MOST_POSITIVE_FIXNUM)); |
338 n = XINT (count); | 338 n = XFIXNUM (count); |
339 | 339 |
340 if (CHAR_OR_CHAR_INTP (Vlast_command_char)) | 340 if (CHAR_OR_CHAR_INTP (Vlast_command_char)) |
341 c = Vlast_command_char; | 341 c = Vlast_command_char; |
342 else | 342 else |
343 c = Fevent_to_character (Vlast_command_event, Qnil, Qnil, Qnil); | 343 c = Fevent_to_character (Vlast_command_event, Qnil, Qnil, Qnil); |
394 && BUF_PT (buf) < BUF_ZV (buf) | 394 && BUF_PT (buf) < BUF_ZV (buf) |
395 && (EQ (overwrite, Qoverwrite_mode_binary) | 395 && (EQ (overwrite, Qoverwrite_mode_binary) |
396 || (c1 != '\n' && BUF_FETCH_CHAR (buf, BUF_PT (buf)) != '\n')) | 396 || (c1 != '\n' && BUF_FETCH_CHAR (buf, BUF_PT (buf)) != '\n')) |
397 && (EQ (overwrite, Qoverwrite_mode_binary) | 397 && (EQ (overwrite, Qoverwrite_mode_binary) |
398 || BUF_FETCH_CHAR (buf, BUF_PT (buf)) != '\t' | 398 || BUF_FETCH_CHAR (buf, BUF_PT (buf)) != '\t' |
399 || ((tab_width = XINT (buf->tab_width), tab_width <= 0) | 399 || ((tab_width = XFIXNUM (buf->tab_width), tab_width <= 0) |
400 || tab_width > 20 | 400 || tab_width > 20 |
401 || !((current_column (buf) + 1) % tab_width)))) | 401 || !((current_column (buf) + 1) % tab_width)))) |
402 { | 402 { |
403 buffer_delete_range (buf, BUF_PT (buf), BUF_PT (buf) + 1, 0); | 403 buffer_delete_range (buf, BUF_PT (buf), BUF_PT (buf) + 1, 0); |
404 /* hairy = 2; */ | 404 /* hairy = 2; */ |
465 | 465 |
466 /* If previous command specified a face to use, use it. */ | 466 /* If previous command specified a face to use, use it. */ |
467 if (!NILP (Vself_insert_face) | 467 if (!NILP (Vself_insert_face) |
468 && EQ (Vlast_command, Vself_insert_face_command)) | 468 && EQ (Vlast_command, Vself_insert_face_command)) |
469 { | 469 { |
470 Lisp_Object before = make_int (BUF_PT (buf) - 1); | 470 Lisp_Object before = make_fixnum (BUF_PT (buf) - 1); |
471 Lisp_Object after = make_int (BUF_PT (buf)); | 471 Lisp_Object after = make_fixnum (BUF_PT (buf)); |
472 Fput_text_property (before, after, Qface, Vself_insert_face, Qnil); | 472 Fput_text_property (before, after, Qface, Vself_insert_face, Qnil); |
473 Fput_text_property (before, after, Qstart_open, Qt, Qnil); | 473 Fput_text_property (before, after, Qstart_open, Qt, Qnil); |
474 Fput_text_property (before, after, Qend_open, Qnil, Qnil); | 474 Fput_text_property (before, after, Qend_open, Qnil, Qnil); |
475 /* #### FSFmacs properties are normally closed ("sticky") on the | 475 /* #### FSFmacs properties are normally closed ("sticky") on the |
476 end but not the beginning. It's the opposite for us. */ | 476 end but not the beginning. It's the opposite for us. */ |