comparison src/indent.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 3192994c49ca
comparison
equal deleted inserted replaced
5580:a0e81357194e 5581:56144c8593a8
65 { 65 {
66 Lisp_Object buffer; 66 Lisp_Object buffer;
67 Lisp_Object value; 67 Lisp_Object value;
68 68
69 buffer = wrap_buffer (buf); 69 buffer = wrap_buffer (buf);
70 value = Fprevious_single_char_property_change (make_int (pos), Qinvisible, 70 value = Fprevious_single_char_property_change (make_fixnum (pos), Qinvisible,
71 buffer, Qnil); 71 buffer, Qnil);
72 if (NILP (value)) 72 if (NILP (value))
73 return 0; /* no visible position found */ 73 return 0; /* no visible position found */
74 else 74 else
75 /* #### bug bug bug!!! This will return the position of the beginning 75 /* #### bug bug bug!!! This will return the position of the beginning
76 of an invisible extent; this extent is very likely to be start-closed, 76 of an invisible extent; this extent is very likely to be start-closed,
77 and thus the spaces inserted in `indent-to' will go inside the 77 and thus the spaces inserted in `indent-to' will go inside the
78 invisible extent. 78 invisible extent.
79 79
80 Not sure what the correct solution is here. Rethink indent-to? */ 80 Not sure what the correct solution is here. Rethink indent-to? */
81 return XINT (value); 81 return XFIXNUM (value);
82 } 82 }
83 83
84 #ifdef REGION_CACHE_NEEDS_WORK 84 #ifdef REGION_CACHE_NEEDS_WORK
85 85
86 /* Allocate or free the width run cache, as requested by the current 86 /* Allocate or free the width run cache, as requested by the current
123 int 123 int
124 column_at_point (struct buffer *buf, Charbpos init_pos, int cur_col) 124 column_at_point (struct buffer *buf, Charbpos init_pos, int cur_col)
125 { 125 {
126 int col; 126 int col;
127 int tab_seen; 127 int tab_seen;
128 int tab_width = XINT (buf->tab_width); 128 int tab_width = XFIXNUM (buf->tab_width);
129 int post_tab; 129 int post_tab;
130 Charbpos pos = init_pos; 130 Charbpos pos = init_pos;
131 Ichar c; 131 Ichar c;
132 132
133 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 133 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
261 however, ^M is treated as end of line when `selective-display' is t. 261 however, ^M is treated as end of line when `selective-display' is t.
262 If BUFFER is nil, the current buffer is assumed. 262 If BUFFER is nil, the current buffer is assumed.
263 */ 263 */
264 (buffer)) 264 (buffer))
265 { 265 {
266 return make_int (current_column (decode_buffer (buffer, 0))); 266 return make_fixnum (current_column (decode_buffer (buffer, 0)));
267 } 267 }
268 268
269 269
270 DEFUN ("indent-to", Findent_to, 1, 3, "NIndent to column: ", /* 270 DEFUN ("indent-to", Findent_to, 1, 3, "NIndent to column: ", /*
271 Indent from point with tabs and spaces until COLUMN is reached. 271 Indent from point with tabs and spaces until COLUMN is reached.
277 { 277 {
278 /* This function can GC */ 278 /* This function can GC */
279 int mincol; 279 int mincol;
280 int fromcol; 280 int fromcol;
281 struct buffer *buf = decode_buffer (buffer, 0); 281 struct buffer *buf = decode_buffer (buffer, 0);
282 int tab_width = XINT (buf->tab_width); 282 int tab_width = XFIXNUM (buf->tab_width);
283 Charbpos opoint = 0; 283 Charbpos opoint = 0;
284 284
285 CHECK_INT (column); 285 CHECK_FIXNUM (column);
286 if (NILP (minimum)) 286 if (NILP (minimum))
287 minimum = Qzero; 287 minimum = Qzero;
288 else 288 else
289 CHECK_INT (minimum); 289 CHECK_FIXNUM (minimum);
290 290
291 buffer = wrap_buffer (buf); 291 buffer = wrap_buffer (buf);
292 292
293 fromcol = current_column (buf); 293 fromcol = current_column (buf);
294 mincol = fromcol + XINT (minimum); 294 mincol = fromcol + XFIXNUM (minimum);
295 if (mincol < XINT (column)) mincol = XINT (column); 295 if (mincol < XFIXNUM (column)) mincol = XFIXNUM (column);
296 296
297 if (fromcol == mincol) 297 if (fromcol == mincol)
298 return make_int (mincol); 298 return make_fixnum (mincol);
299 299
300 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 300 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
301 301
302 if (!NILP (Fextent_at (make_int (BUF_PT (buf)), buffer, Qinvisible, 302 if (!NILP (Fextent_at (make_fixnum (BUF_PT (buf)), buffer, Qinvisible,
303 Qnil, Qnil))) 303 Qnil, Qnil)))
304 { 304 {
305 Charbpos last_visible = last_visible_position (BUF_PT (buf), buf); 305 Charbpos last_visible = last_visible_position (BUF_PT (buf), buf);
306 306
307 opoint = BUF_PT (buf); 307 opoint = BUF_PT (buf);
314 if (indent_tabs_mode) 314 if (indent_tabs_mode)
315 { 315 {
316 int n = mincol / tab_width - fromcol / tab_width; 316 int n = mincol / tab_width - fromcol / tab_width;
317 if (n != 0) 317 if (n != 0)
318 { 318 {
319 Finsert_char (make_char ('\t'), make_int (n), Qnil, buffer); 319 Finsert_char (make_char ('\t'), make_fixnum (n), Qnil, buffer);
320 320
321 fromcol = (mincol / tab_width) * tab_width; 321 fromcol = (mincol / tab_width) * tab_width;
322 } 322 }
323 } 323 }
324 324
325 Finsert_char (make_char (' '), make_int (mincol - fromcol), Qnil, buffer); 325 Finsert_char (make_char (' '), make_fixnum (mincol - fromcol), Qnil, buffer);
326 326
327 last_known_column_buffer = buf; 327 last_known_column_buffer = buf;
328 last_known_column = mincol; 328 last_known_column = mincol;
329 last_known_column_point = BUF_PT (buf); 329 last_known_column_point = BUF_PT (buf);
330 last_known_column_modified = BUF_MODIFF (buf); 330 last_known_column_modified = BUF_MODIFF (buf);
331 331
332 /* Not in FSF: */ 332 /* Not in FSF: */
333 if (opoint > 0) 333 if (opoint > 0)
334 BUF_SET_PT (buf, opoint); 334 BUF_SET_PT (buf, opoint);
335 335
336 return make_int (mincol); 336 return make_fixnum (mincol);
337 } 337 }
338 338
339 int 339 int
340 byte_spaces_at_point (struct buffer *b, Bytebpos byte_pos) 340 byte_spaces_at_point (struct buffer *b, Bytebpos byte_pos)
341 { 341 {
342 Bytebpos byte_end = BYTE_BUF_ZV (b); 342 Bytebpos byte_end = BYTE_BUF_ZV (b);
343 int col = 0; 343 int col = 0;
344 Ichar c; 344 Ichar c;
345 int tab_width = XINT (b->tab_width); 345 int tab_width = XFIXNUM (b->tab_width);
346 346
347 if (tab_width <= 0 || tab_width > 1000) 347 if (tab_width <= 0 || tab_width > 1000)
348 tab_width = 8; 348 tab_width = 8;
349 349
350 while (byte_pos < byte_end && 350 while (byte_pos < byte_end &&
368 struct buffer *buf = decode_buffer (buffer, 0); 368 struct buffer *buf = decode_buffer (buffer, 0);
369 Charbpos pos = find_next_newline (buf, BUF_PT (buf), -1); 369 Charbpos pos = find_next_newline (buf, BUF_PT (buf), -1);
370 370
371 buffer = wrap_buffer (buf); 371 buffer = wrap_buffer (buf);
372 372
373 if (!NILP (Fextent_at (make_int (pos), buffer, Qinvisible, Qnil, Qnil))) 373 if (!NILP (Fextent_at (make_fixnum (pos), buffer, Qinvisible, Qnil, Qnil)))
374 return Qzero; 374 return Qzero;
375 375
376 return make_int (byte_spaces_at_point (buf, charbpos_to_bytebpos (buf, pos))); 376 return make_fixnum (byte_spaces_at_point (buf, charbpos_to_bytebpos (buf, pos)));
377 } 377 }
378 378
379 379
380 DEFUN ("move-to-column", Fmove_to_column, 1, 3, 0, /* 380 DEFUN ("move-to-column", Fmove_to_column, 1, 3, 0, /*
381 Move point to column COLUMN in the current line. 381 Move point to column COLUMN in the current line.
401 Charbpos pos; 401 Charbpos pos;
402 struct buffer *buf = decode_buffer (buffer, 0); 402 struct buffer *buf = decode_buffer (buffer, 0);
403 int col = current_column (buf); 403 int col = current_column (buf);
404 int goal; 404 int goal;
405 Charbpos end; 405 Charbpos end;
406 int tab_width = XINT (buf->tab_width); 406 int tab_width = XFIXNUM (buf->tab_width);
407 407
408 int prev_col = 0; 408 int prev_col = 0;
409 Ichar c = 0; 409 Ichar c = 0;
410 410
411 buffer = wrap_buffer (buf); 411 buffer = wrap_buffer (buf);
412 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 412 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
413 413
414 check_integer_range (column, Qzero, make_integer (EMACS_INT_MAX)); 414 check_integer_range (column, Qzero, make_integer (MOST_POSITIVE_FIXNUM));
415 goal = XINT (column); 415 goal = XFIXNUM (column);
416 416
417 retry: 417 retry:
418 pos = BUF_PT (buf); 418 pos = BUF_PT (buf);
419 end = BUF_ZV (buf); 419 end = BUF_ZV (buf);
420 420
469 /* If a tab char made us overshoot, change it to spaces 469 /* If a tab char made us overshoot, change it to spaces
470 and scan through it again. */ 470 and scan through it again. */
471 if (!NILP (force) && col > goal && c == '\t' && prev_col < goal) 471 if (!NILP (force) && col > goal && c == '\t' && prev_col < goal)
472 { 472 {
473 buffer_delete_range (buf, BUF_PT (buf) - 1, BUF_PT (buf), 0); 473 buffer_delete_range (buf, BUF_PT (buf) - 1, BUF_PT (buf), 0);
474 Findent_to (make_int (col - 1), Qzero, buffer); 474 Findent_to (make_fixnum (col - 1), Qzero, buffer);
475 buffer_insert_emacs_char (buf, ' '); 475 buffer_insert_emacs_char (buf, ' ');
476 goto retry; 476 goto retry;
477 } 477 }
478 478
479 /* If line ends prematurely, add space to the end. */ 479 /* If line ends prematurely, add space to the end. */
480 if (col < goal && !NILP (force) && !EQ (force, Qcoerce)) 480 if (col < goal && !NILP (force) && !EQ (force, Qcoerce))
481 { 481 {
482 col = goal; 482 col = goal;
483 Findent_to (make_int (col), Qzero, buffer); 483 Findent_to (make_fixnum (col), Qzero, buffer);
484 } 484 }
485 485
486 last_known_column_buffer = buf; 486 last_known_column_buffer = buf;
487 last_known_column = col; 487 last_known_column = col;
488 last_known_column_point = BUF_PT (buf); 488 last_known_column_point = BUF_PT (buf);
489 last_known_column_modified = BUF_MODIFF (buf); 489 last_known_column_modified = BUF_MODIFF (buf);
490 490
491 return make_int (col); 491 return make_fixnum (col);
492 } 492 }
493 493
494 #if 0 /* #### OK boys, this function needs to be present, I think. 494 #if 0 /* #### OK boys, this function needs to be present, I think.
495 It was there before the 19.12 redisplay rewrite. */ 495 It was there before the 19.12 redisplay rewrite. */
496 496
539 Lisp_Object charbpos, hpos, vpos, prevhpos, contin; 539 Lisp_Object charbpos, hpos, vpos, prevhpos, contin;
540 struct position *pos; 540 struct position *pos;
541 int hscroll, tab_offset; 541 int hscroll, tab_offset;
542 struct window *w = decode_window (window); 542 struct window *w = decode_window (window);
543 543
544 CHECK_INT_COERCE_MARKER (from); 544 CHECK_FIXNUM_COERCE_MARKER (from);
545 CHECK_CONS (frompos); 545 CHECK_CONS (frompos);
546 CHECK_INT (XCAR (frompos)); 546 CHECK_FIXNUM (XCAR (frompos));
547 CHECK_INT (XCDR (frompos)); 547 CHECK_FIXNUM (XCDR (frompos));
548 CHECK_INT_COERCE_MARKER (to); 548 CHECK_FIXNUM_COERCE_MARKER (to);
549 CHECK_CONS (topos); 549 CHECK_CONS (topos);
550 CHECK_INT (XCAR (topos)); 550 CHECK_FIXNUM (XCAR (topos));
551 CHECK_INT (XCDR (topos)); 551 CHECK_FIXNUM (XCDR (topos));
552 CHECK_INT (width); 552 CHECK_FIXNUM (width);
553 if (!NILP (offsets)) 553 if (!NILP (offsets))
554 { 554 {
555 CHECK_CONS (offsets); 555 CHECK_CONS (offsets);
556 CHECK_INT (XCAR (offsets)); 556 CHECK_FIXNUM (XCAR (offsets));
557 CHECK_INT (XCDR (offsets)); 557 CHECK_FIXNUM (XCDR (offsets));
558 hscroll = XINT (XCAR (offsets)); 558 hscroll = XFIXNUM (XCAR (offsets));
559 tab_offset = XINT (XCDR (offsets)); 559 tab_offset = XFIXNUM (XCDR (offsets));
560 } 560 }
561 else 561 else
562 hscroll = tab_offset = 0; 562 hscroll = tab_offset = 0;
563 563
564 pos = compute_motion (XINT (from), XINT (XCDR (frompos)), 564 pos = compute_motion (XFIXNUM (from), XFIXNUM (XCDR (frompos)),
565 XINT (XCAR (frompos)), 565 XFIXNUM (XCAR (frompos)),
566 XINT (to), XINT (XCDR (topos)), 566 XFIXNUM (to), XFIXNUM (XCDR (topos)),
567 XINT (XCAR (topos)), 567 XFIXNUM (XCAR (topos)),
568 XINT (width), hscroll, tab_offset, w); 568 XFIXNUM (width), hscroll, tab_offset, w);
569 569
570 charbpos = make_int (pos->charbpos); 570 charbpos = make_fixnum (pos->charbpos);
571 hpos = make_int (pos->hpos); 571 hpos = make_fixnum (pos->hpos);
572 vpos = make_int (pos->vpos); 572 vpos = make_fixnum (pos->vpos);
573 prevhpos = make_int (pos->prevhpos); 573 prevhpos = make_fixnum (pos->prevhpos);
574 574
575 return list5 (charbpos, hpos, vpos, prevhpos, 575 return list5 (charbpos, hpos, vpos, prevhpos,
576 pos->contin ? Qt : Qnil); 576 pos->contin ? Qt : Qnil);
577 } 577 }
578 578
713 713
714 if (NILP (window)) 714 if (NILP (window))
715 window = Fselected_window (Qnil); 715 window = Fselected_window (Qnil);
716 716
717 CHECK_LIVE_WINDOW (window); 717 CHECK_LIVE_WINDOW (window);
718 CHECK_INT (lines); 718 CHECK_FIXNUM (lines);
719 719
720 selected = (EQ (window, Fselected_window (Qnil))); 720 selected = (EQ (window, Fselected_window (Qnil)));
721 721
722 w = XWINDOW (window); 722 w = XWINDOW (window);
723 723
725 : marker_position (w->pointm[CURRENT_DISP]); 725 : marker_position (w->pointm[CURRENT_DISP]);
726 726
727 vpos = pixels ? NULL : &value; 727 vpos = pixels ? NULL : &value;
728 vpix = pixels ? &value : NULL; 728 vpix = pixels ? &value : NULL;
729 729
730 charbpos = vmotion_1 (w, orig, XINT (lines), vpos, vpix); 730 charbpos = vmotion_1 (w, orig, XFIXNUM (lines), vpos, vpix);
731 731
732 /* Note that the buffer's point is set, not the window's point. */ 732 /* Note that the buffer's point is set, not the window's point. */
733 if (selected) 733 if (selected)
734 BUF_SET_PT (XBUFFER (w->buffer), charbpos); 734 BUF_SET_PT (XBUFFER (w->buffer), charbpos);
735 else 735 else
736 set_marker_restricted (w->pointm[CURRENT_DISP], 736 set_marker_restricted (w->pointm[CURRENT_DISP],
737 make_int(charbpos), 737 make_fixnum(charbpos),
738 w->buffer); 738 w->buffer);
739 739
740 return make_int (value); 740 return make_fixnum (value);
741 } 741 }
742 742
743 DEFUN ("vertical-motion", Fvertical_motion, 1, 3, 0, /* 743 DEFUN ("vertical-motion", Fvertical_motion, 1, 3, 0, /*
744 Move to start of frame line LINES lines down. 744 Move to start of frame line LINES lines down.
745 If LINES is negative, this is moving up. 745 If LINES is negative, this is moving up.
896 896
897 if (NILP (window)) 897 if (NILP (window))
898 window = Fselected_window (Qnil); 898 window = Fselected_window (Qnil);
899 899
900 CHECK_LIVE_WINDOW (window); 900 CHECK_LIVE_WINDOW (window);
901 CHECK_INT (pixels); 901 CHECK_FIXNUM (pixels);
902 902
903 selected = (EQ (window, Fselected_window (Qnil))); 903 selected = (EQ (window, Fselected_window (Qnil)));
904 904
905 w = XWINDOW (window); 905 w = XWINDOW (window);
906 906
907 orig = selected ? BUF_PT (XBUFFER (w->buffer)) 907 orig = selected ? BUF_PT (XBUFFER (w->buffer))
908 : marker_position (w->pointm[CURRENT_DISP]); 908 : marker_position (w->pointm[CURRENT_DISP]);
909 909
910 howto = INTP (how) ? XINT (how) : 0; 910 howto = FIXNUMP (how) ? XFIXNUM (how) : 0;
911 911
912 charbpos = vmotion_pixels (window, orig, XINT (pixels), howto, &motion); 912 charbpos = vmotion_pixels (window, orig, XFIXNUM (pixels), howto, &motion);
913 913
914 if (selected) 914 if (selected)
915 BUF_SET_PT (XBUFFER (w->buffer), charbpos); 915 BUF_SET_PT (XBUFFER (w->buffer), charbpos);
916 else 916 else
917 set_marker_restricted (w->pointm[CURRENT_DISP], 917 set_marker_restricted (w->pointm[CURRENT_DISP],
918 make_int(charbpos), 918 make_fixnum(charbpos),
919 w->buffer); 919 w->buffer);
920 920
921 return make_int (motion); 921 return make_fixnum (motion);
922 } 922 }
923 923
924 924
925 void 925 void
926 syms_of_indent (void) 926 syms_of_indent (void)