Mercurial > hg > xemacs-beta
comparison src/buffer.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 | df691b681244 |
comparison
equal
deleted
inserted
replaced
5580:a0e81357194e | 5581:56144c8593a8 |
---|---|
634 note_object_created (buf); | 634 note_object_created (buf); |
635 | 635 |
636 init_buffer_markers (b); | 636 init_buffer_markers (b); |
637 init_buffer_syntax_cache (b); | 637 init_buffer_syntax_cache (b); |
638 | 638 |
639 b->generated_modeline_string = Fmake_string (make_int (84), make_int (' ')); | 639 b->generated_modeline_string = Fmake_string (make_fixnum (84), make_fixnum (' ')); |
640 b->modeline_extent_table = make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, | 640 b->modeline_extent_table = make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, |
641 Qeq); | 641 Qeq); |
642 | 642 |
643 | 643 |
644 return buf; | 644 return buf; |
737 | 737 |
738 b->local_var_flags = 0; | 738 b->local_var_flags = 0; |
739 /* For each slot that has a default value, | 739 /* For each slot that has a default value, |
740 copy that into the slot. */ | 740 copy that into the slot. */ |
741 #define MARKED_SLOT(slot) \ | 741 #define MARKED_SLOT(slot) \ |
742 { int mask = XINT (buffer_local_flags.slot); \ | 742 { int mask = XFIXNUM (buffer_local_flags.slot); \ |
743 if ((mask > 0 || mask == -1 || mask == -3) \ | 743 if ((mask > 0 || mask == -1 || mask == -3) \ |
744 && (first_time \ | 744 && (first_time \ |
745 || NILP (Fget (XBUFFER (Vbuffer_local_symbols)->slot, \ | 745 || NILP (Fget (XBUFFER (Vbuffer_local_symbols)->slot, \ |
746 Qpermanent_local, Qnil)))) \ | 746 Qpermanent_local, Qnil)))) \ |
747 b->slot = def->slot; \ | 747 b->slot = def->slot; \ |
887 | 887 |
888 /* Add on all the variables stored in special slots. */ | 888 /* Add on all the variables stored in special slots. */ |
889 { | 889 { |
890 struct buffer *syms = XBUFFER (Vbuffer_local_symbols); | 890 struct buffer *syms = XBUFFER (Vbuffer_local_symbols); |
891 #define MARKED_SLOT(slot) \ | 891 #define MARKED_SLOT(slot) \ |
892 { int mask = XINT (buffer_local_flags.slot); \ | 892 { int mask = XFIXNUM (buffer_local_flags.slot); \ |
893 if (mask == 0 || mask == -1 \ | 893 if (mask == 0 || mask == -1 \ |
894 || ((mask > 0) && (buf->local_var_flags & mask))) \ | 894 || ((mask > 0) && (buf->local_var_flags & mask))) \ |
895 result = Fcons (Fcons (syms->slot, buf->slot), result); \ | 895 result = Fcons (Fcons (syms->slot, buf->slot), result); \ |
896 } | 896 } |
897 #include "bufslots.h" | 897 #include "bufslots.h" |
967 */ | 967 */ |
968 (buffer)) | 968 (buffer)) |
969 { | 969 { |
970 struct buffer *buf = decode_buffer (buffer, 0); | 970 struct buffer *buf = decode_buffer (buffer, 0); |
971 | 971 |
972 return make_int (BUF_MODIFF (buf)); | 972 return make_fixnum (BUF_MODIFF (buf)); |
973 } | 973 } |
974 | 974 |
975 DEFUN ("rename-buffer", Frename_buffer, 1, 2, | 975 DEFUN ("rename-buffer", Frename_buffer, 1, 2, |
976 "sRename buffer (to new name): \nP", /* | 976 "sRename buffer (to new name): \nP", /* |
977 Change current buffer's name to NEWNAME (a string). | 977 Change current buffer's name to NEWNAME (a string). |
1511 { | 1511 { |
1512 /* synchronize window point */ | 1512 /* synchronize window point */ |
1513 Lisp_Object current_window = Fselected_window (Qnil); | 1513 Lisp_Object current_window = Fselected_window (Qnil); |
1514 if (!NILP (current_window) | 1514 if (!NILP (current_window) |
1515 && EQ(Fwindow_buffer (current_window), wrap_buffer (old_buf))) | 1515 && EQ(Fwindow_buffer (current_window), wrap_buffer (old_buf))) |
1516 Fset_window_point (current_window, make_int (BUF_PT (old_buf))); | 1516 Fset_window_point (current_window, make_fixnum (BUF_PT (old_buf))); |
1517 | 1517 |
1518 /* Put the undo list back in the base buffer, so that it appears | 1518 /* Put the undo list back in the base buffer, so that it appears |
1519 that an indirect buffer shares the undo list of its base. */ | 1519 that an indirect buffer shares the undo list of its base. */ |
1520 if (old_buf->base_buffer) | 1520 if (old_buf->base_buffer) |
1521 old_buf->base_buffer->undo_list = old_buf->undo_list; | 1521 old_buf->base_buffer->undo_list = old_buf->undo_list; |
1814 | 1814 |
1815 CHECK_BUFFER (buffer); /* dead buffers should be allowed, no? */ | 1815 CHECK_BUFFER (buffer); /* dead buffers should be allowed, no? */ |
1816 b = XBUFFER (buffer); | 1816 b = XBUFFER (buffer); |
1817 | 1817 |
1818 #define ADD_INT(field) \ | 1818 #define ADD_INT(field) \ |
1819 plist = cons3 (make_int (b->text->field), \ | 1819 plist = cons3 (make_fixnum (b->text->field), \ |
1820 intern_massaging_name (#field), plist) | 1820 intern_massaging_name (#field), plist) |
1821 #define ADD_BOOL(field) \ | 1821 #define ADD_BOOL(field) \ |
1822 plist = cons3 (b->text->field ? Qt : Qnil, \ | 1822 plist = cons3 (b->text->field ? Qt : Qnil, \ |
1823 intern_massaging_name (#field), plist) | 1823 intern_massaging_name (#field), plist) |
1824 ADD_INT (bufz); | 1824 ADD_INT (bufz); |
1841 | 1841 |
1842 { | 1842 { |
1843 Lisp_Object pos[NUM_CACHED_POSITIONS]; | 1843 Lisp_Object pos[NUM_CACHED_POSITIONS]; |
1844 int i; | 1844 int i; |
1845 for (i = 0; i < b->text->next_cache_pos; i++) | 1845 for (i = 0; i < b->text->next_cache_pos; i++) |
1846 pos[i] = make_int (b->text->mule_charbpos_cache[i]); | 1846 pos[i] = make_fixnum (b->text->mule_charbpos_cache[i]); |
1847 plist = cons3 (Flist (b->text->next_cache_pos, pos), | 1847 plist = cons3 (Flist (b->text->next_cache_pos, pos), |
1848 intern ("mule-charbpos-cache"), plist); | 1848 intern ("mule-charbpos-cache"), plist); |
1849 for (i = 0; i < b->text->next_cache_pos; i++) | 1849 for (i = 0; i < b->text->next_cache_pos; i++) |
1850 pos[i] = make_int (b->text->mule_bytebpos_cache[i]); | 1850 pos[i] = make_fixnum (b->text->mule_bytebpos_cache[i]); |
1851 plist = cons3 (Flist (b->text->next_cache_pos, pos), | 1851 plist = cons3 (Flist (b->text->next_cache_pos, pos), |
1852 intern ("mule-bytebpos-cache"), plist); | 1852 intern ("mule-bytebpos-cache"), plist); |
1853 } | 1853 } |
1854 #undef ADD_INT | 1854 #undef ADD_INT |
1855 #undef ADD_BOOL | 1855 #undef ADD_BOOL |
1864 (string)) | 1864 (string)) |
1865 { | 1865 { |
1866 Lisp_Object plist = Qnil; | 1866 Lisp_Object plist = Qnil; |
1867 CHECK_STRING (string); | 1867 CHECK_STRING (string); |
1868 | 1868 |
1869 plist = cons3 (make_int (XSTRING_LENGTH (string)), | 1869 plist = cons3 (make_fixnum (XSTRING_LENGTH (string)), |
1870 intern ("byte-length"), plist); | 1870 intern ("byte-length"), plist); |
1871 plist = cons3 (make_int (XSTRING_ASCII_BEGIN (string)), | 1871 plist = cons3 (make_fixnum (XSTRING_ASCII_BEGIN (string)), |
1872 intern ("ascii-begin"), plist); | 1872 intern ("ascii-begin"), plist); |
1873 | 1873 |
1874 return Fnreverse (plist); | 1874 return Fnreverse (plist); |
1875 } | 1875 } |
1876 | 1876 |
2241 defs->mirror_syntax_table = | 2241 defs->mirror_syntax_table = |
2242 XCHAR_TABLE (Vstandard_syntax_table)->mirror_table; | 2242 XCHAR_TABLE (Vstandard_syntax_table)->mirror_table; |
2243 defs->modeline_format = build_ascstring ("%-"); /* reset in loaddefs.el */ | 2243 defs->modeline_format = build_ascstring ("%-"); /* reset in loaddefs.el */ |
2244 defs->case_fold_search = Qt; | 2244 defs->case_fold_search = Qt; |
2245 defs->selective_display_ellipses = Qt; | 2245 defs->selective_display_ellipses = Qt; |
2246 defs->tab_width = make_int (8); | 2246 defs->tab_width = make_fixnum (8); |
2247 defs->ctl_arrow = Qt; | 2247 defs->ctl_arrow = Qt; |
2248 defs->fill_column = make_int (70); | 2248 defs->fill_column = make_fixnum (70); |
2249 defs->left_margin = Qzero; | 2249 defs->left_margin = Qzero; |
2250 defs->saved_size = Qzero; /* lisp code wants int-or-nil */ | 2250 defs->saved_size = Qzero; /* lisp code wants int-or-nil */ |
2251 defs->modtime = 0; | 2251 defs->modtime = 0; |
2252 defs->auto_save_modified = 0; | 2252 defs->auto_save_modified = 0; |
2253 defs->auto_save_failure_time = -1; | 2253 defs->auto_save_failure_time = -1; |
2265 * and the default is only used at creation. | 2265 * and the default is only used at creation. |
2266 * -3 means no Lisp variable. Default used only at reset and creation. | 2266 * -3 means no Lisp variable. Default used only at reset and creation. |
2267 * >0 is mask. Var is local if ((buffer->local_var_flags & mask) != 0) | 2267 * >0 is mask. Var is local if ((buffer->local_var_flags & mask) != 0) |
2268 * Otherwise default is used. | 2268 * Otherwise default is used. |
2269 */ | 2269 */ |
2270 Lisp_Object always_local_no_default = make_int (0); | 2270 Lisp_Object always_local_no_default = make_fixnum (0); |
2271 Lisp_Object always_local_resettable = make_int (-1); | 2271 Lisp_Object always_local_resettable = make_fixnum (-1); |
2272 Lisp_Object resettable = make_int (-3); | 2272 Lisp_Object resettable = make_fixnum (-3); |
2273 | 2273 |
2274 /* Assign the local-flags to the slots that have default values. | 2274 /* Assign the local-flags to the slots that have default values. |
2275 The local flag is a bit that is used in the buffer | 2275 The local flag is a bit that is used in the buffer |
2276 to say that it has its own local value for the slot. | 2276 to say that it has its own local value for the slot. |
2277 The local flag bits are in the local_var_flags slot of the | 2277 The local flag bits are in the local_var_flags slot of the |
2278 buffer. */ | 2278 buffer. */ |
2279 | 2279 |
2280 set_lheader_implementation ((struct lrecord_header *) | 2280 set_lheader_implementation ((struct lrecord_header *) |
2281 &buffer_local_flags, &lrecord_buffer); | 2281 &buffer_local_flags, &lrecord_buffer); |
2282 nuke_all_buffer_slots (&buffer_local_flags, make_int (-2)); | 2282 nuke_all_buffer_slots (&buffer_local_flags, make_fixnum (-2)); |
2283 buffer_local_flags.filename = always_local_no_default; | 2283 buffer_local_flags.filename = always_local_no_default; |
2284 buffer_local_flags.directory = always_local_no_default; | 2284 buffer_local_flags.directory = always_local_no_default; |
2285 buffer_local_flags.backed_up = always_local_no_default; | 2285 buffer_local_flags.backed_up = always_local_no_default; |
2286 buffer_local_flags.saved_size = always_local_no_default; | 2286 buffer_local_flags.saved_size = always_local_no_default; |
2287 buffer_local_flags.auto_save_file_name = always_local_no_default; | 2287 buffer_local_flags.auto_save_file_name = always_local_no_default; |
2304 buffer_local_flags.syntax_table = resettable; | 2304 buffer_local_flags.syntax_table = resettable; |
2305 #ifdef MULE | 2305 #ifdef MULE |
2306 buffer_local_flags.category_table = resettable; | 2306 buffer_local_flags.category_table = resettable; |
2307 #endif | 2307 #endif |
2308 buffer_local_flags.display_time = always_local_no_default; | 2308 buffer_local_flags.display_time = always_local_no_default; |
2309 buffer_local_flags.display_count = make_int (0); | 2309 buffer_local_flags.display_count = make_fixnum (0); |
2310 | 2310 |
2311 buffer_local_flags.modeline_format = make_int (1<<0); | 2311 buffer_local_flags.modeline_format = make_fixnum (1<<0); |
2312 buffer_local_flags.abbrev_mode = make_int (1<<1); | 2312 buffer_local_flags.abbrev_mode = make_fixnum (1<<1); |
2313 buffer_local_flags.overwrite_mode = make_int (1<<2); | 2313 buffer_local_flags.overwrite_mode = make_fixnum (1<<2); |
2314 buffer_local_flags.case_fold_search = make_int (1<<3); | 2314 buffer_local_flags.case_fold_search = make_fixnum (1<<3); |
2315 buffer_local_flags.auto_fill_function = make_int (1<<4); | 2315 buffer_local_flags.auto_fill_function = make_fixnum (1<<4); |
2316 buffer_local_flags.selective_display = make_int (1<<5); | 2316 buffer_local_flags.selective_display = make_fixnum (1<<5); |
2317 buffer_local_flags.selective_display_ellipses = make_int (1<<6); | 2317 buffer_local_flags.selective_display_ellipses = make_fixnum (1<<6); |
2318 buffer_local_flags.tab_width = make_int (1<<7); | 2318 buffer_local_flags.tab_width = make_fixnum (1<<7); |
2319 buffer_local_flags.truncate_lines = make_int (1<<8); | 2319 buffer_local_flags.truncate_lines = make_fixnum (1<<8); |
2320 buffer_local_flags.ctl_arrow = make_int (1<<9); | 2320 buffer_local_flags.ctl_arrow = make_fixnum (1<<9); |
2321 buffer_local_flags.fill_column = make_int (1<<10); | 2321 buffer_local_flags.fill_column = make_fixnum (1<<10); |
2322 buffer_local_flags.left_margin = make_int (1<<11); | 2322 buffer_local_flags.left_margin = make_fixnum (1<<11); |
2323 buffer_local_flags.abbrev_table = make_int (1<<12); | 2323 buffer_local_flags.abbrev_table = make_fixnum (1<<12); |
2324 #ifdef REGION_CACHE_NEEDS_WORK | 2324 #ifdef REGION_CACHE_NEEDS_WORK |
2325 buffer_local_flags.cache_long_line_scans = make_int (1<<13); | 2325 buffer_local_flags.cache_long_line_scans = make_fixnum (1<<13); |
2326 #endif | 2326 #endif |
2327 buffer_local_flags.buffer_file_coding_system = make_int (1<<14); | 2327 buffer_local_flags.buffer_file_coding_system = make_fixnum (1<<14); |
2328 | 2328 |
2329 /* #### Warning: 1<<31 is the largest number currently allowable | 2329 /* #### Warning: 1<<31 is the largest number currently allowable |
2330 due to the XINT() handling of this value. With some | 2330 due to the XFIXNUM() handling of this value. With some |
2331 rearrangement you can get 3 more bits. | 2331 rearrangement you can get 3 more bits. |
2332 | 2332 |
2333 #### 3 more? 34 bits???? -ben */ | 2333 #### 3 more? 34 bits???? -ben */ |
2334 } | 2334 } |
2335 } | 2335 } |
2865 | 2865 |
2866 /* Check for DEFVAR_BUFFER_LOCAL without initializing the corresponding | 2866 /* Check for DEFVAR_BUFFER_LOCAL without initializing the corresponding |
2867 slot of buffer_local_flags and vice-versa. Must be done after all | 2867 slot of buffer_local_flags and vice-versa. Must be done after all |
2868 DEFVAR_BUFFER_LOCAL() calls. */ | 2868 DEFVAR_BUFFER_LOCAL() calls. */ |
2869 #define MARKED_SLOT(slot) \ | 2869 #define MARKED_SLOT(slot) \ |
2870 assert ((XINT (buffer_local_flags.slot) != -2 && \ | 2870 assert ((XFIXNUM (buffer_local_flags.slot) != -2 && \ |
2871 XINT (buffer_local_flags.slot) != -3) \ | 2871 XFIXNUM (buffer_local_flags.slot) != -3) \ |
2872 == !(NILP (XBUFFER (Vbuffer_local_symbols)->slot))); | 2872 == !(NILP (XBUFFER (Vbuffer_local_symbols)->slot))); |
2873 #include "bufslots.h" | 2873 #include "bufslots.h" |
2874 | 2874 |
2875 { | 2875 { |
2876 Lisp_Object scratch = Fget_buffer_create (QSscratch); | 2876 Lisp_Object scratch = Fget_buffer_create (QSscratch); |