comparison src/print.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 febc025c4e0c
comparison
equal deleted inserted replaced
5580:a0e81357194e 5581:56144c8593a8
511 Charbpos spoint = marker_position (function); 511 Charbpos spoint = marker_position (function);
512 512
513 buffer_insert_string_1 (XMARKER (function)->buffer, 513 buffer_insert_string_1 (XMARKER (function)->buffer,
514 spoint, nonreloc, reloc, offset, len, 514 spoint, nonreloc, reloc, offset, len,
515 0); 515 0);
516 Fset_marker (function, make_int (spoint + cclen), 516 Fset_marker (function, make_fixnum (spoint + cclen),
517 Fmarker_buffer (function)); 517 Fmarker_buffer (function));
518 } 518 }
519 else if (FRAMEP (function)) 519 else if (FRAMEP (function))
520 { 520 {
521 /* This gets used by functions not invoking print_prepare(), 521 /* This gets used by functions not invoking print_prepare(),
1408 int len = XVECTOR_LENGTH (obj); 1408 int len = XVECTOR_LENGTH (obj);
1409 int last = len; 1409 int last = len;
1410 struct gcpro gcpro1, gcpro2; 1410 struct gcpro gcpro1, gcpro2;
1411 GCPRO2 (obj, printcharfun); 1411 GCPRO2 (obj, printcharfun);
1412 1412
1413 if (INTP (Vprint_length)) 1413 if (FIXNUMP (Vprint_length))
1414 { 1414 {
1415 int max = XINT (Vprint_length); 1415 int max = XFIXNUM (Vprint_length);
1416 if (max < len) last = max; 1416 if (max < len) last = max;
1417 } 1417 }
1418 1418
1419 write_cistring (printcharfun, start); 1419 write_cistring (printcharfun, start);
1420 for (i = 0; i < last; i++) 1420 for (i = 0; i < last; i++)
1456 GCPRO2 (obj, printcharfun); 1456 GCPRO2 (obj, printcharfun);
1457 write_ascstring (printcharfun, "("); 1457 write_ascstring (printcharfun, "(");
1458 1458
1459 { 1459 {
1460 int len; 1460 int len;
1461 int max = INTP (Vprint_length) ? XINT (Vprint_length) : INT_MAX; 1461 int max = FIXNUMP (Vprint_length) ? XFIXNUM (Vprint_length) : INT_MAX;
1462 Lisp_Object tortoise; 1462 Lisp_Object tortoise;
1463 /* Use tortoise/hare to make sure circular lists don't infloop */ 1463 /* Use tortoise/hare to make sure circular lists don't infloop */
1464 1464
1465 for (tortoise = obj, len = 0; 1465 for (tortoise = obj, len = 0;
1466 CONSP (obj); 1466 CONSP (obj);
1474 circularity checking itself, because a cons that is the cdr 1474 circularity checking itself, because a cons that is the cdr
1475 of OBJ is not handed to print_internal in the ordinary course 1475 of OBJ is not handed to print_internal in the ordinary course
1476 of events. All the other possibly-repeated structures always 1476 of events. All the other possibly-repeated structures always
1477 hand sub-objects to print_internal(). */ 1477 hand sub-objects to print_internal(). */
1478 if (print_circle && 1478 if (print_circle &&
1479 INTP (Fgethash (obj, Vprint_number_table, Qnil))) 1479 FIXNUMP (Fgethash (obj, Vprint_number_table, Qnil)))
1480 { 1480 {
1481 write_ascstring (printcharfun, ". "); 1481 write_ascstring (printcharfun, ". ");
1482 print_internal (obj, printcharfun, escapeflag); 1482 print_internal (obj, printcharfun, escapeflag);
1483 /* We have printed the list's tail, print_cons() is done. */ 1483 /* We have printed the list's tail, print_cons() is done. */
1484 break; 1484 break;
1538 Charcount max = size; 1538 Charcount max = size;
1539 Bytecount bcmax = XSTRING_LENGTH (obj); 1539 Bytecount bcmax = XSTRING_LENGTH (obj);
1540 struct gcpro gcpro1, gcpro2; 1540 struct gcpro gcpro1, gcpro2;
1541 GCPRO2 (obj, printcharfun); 1541 GCPRO2 (obj, printcharfun);
1542 1542
1543 if (INTP (Vprint_string_length) && 1543 if (FIXNUMP (Vprint_string_length) &&
1544 XINT (Vprint_string_length) < max) 1544 XFIXNUM (Vprint_string_length) < max)
1545 { 1545 {
1546 max = XINT (Vprint_string_length); 1546 max = XFIXNUM (Vprint_string_length);
1547 bcmax = string_index_char_to_byte (obj, max); 1547 bcmax = string_index_char_to_byte (obj, max);
1548 } 1548 }
1549 if (max < 0) 1549 if (max < 0)
1550 { 1550 {
1551 max = 0; 1551 max = 0;
1731 if (hte == NULL) 1731 if (hte == NULL)
1732 { 1732 {
1733 hte = find_htentry (obj, XHASH_TABLE (table)); 1733 hte = find_htentry (obj, XHASH_TABLE (table));
1734 } 1734 }
1735 1735
1736 extracted = XINT (hte->value); 1736 extracted = XFIXNUM (hte->value);
1737 if (1 == extracted) 1737 if (1 == extracted)
1738 { 1738 {
1739 *seen_object_count += 1; 1739 *seen_object_count += 1;
1740 hte->value 1740 hte->value
1741 = make_int (1 | (*seen_object_count << PRINT_NUMBER_ORDINAL_SHIFT)); 1741 = make_fixnum (1 | (*seen_object_count << PRINT_NUMBER_ORDINAL_SHIFT));
1742 } 1742 }
1743 else if ((extracted & PRINT_NUMBER_SEEN_MASK) == PRINT_NUMBER_SEEN_MASK) 1743 else if ((extracted & PRINT_NUMBER_SEEN_MASK) == PRINT_NUMBER_SEEN_MASK)
1744 { 1744 {
1745 /* Avoid the number overflowing the bit field. */ 1745 /* Avoid the number overflowing the bit field. */
1746 extracted = (extracted & ~PRINT_NUMBER_SEEN_MASK) | 2; 1746 extracted = (extracted & ~PRINT_NUMBER_SEEN_MASK) | 2;
1747 hte->value = make_int (extracted); 1747 hte->value = make_fixnum (extracted);
1748 } 1748 }
1749 1749
1750 return extracted & PRINT_NUMBER_SEEN_MASK; 1750 return extracted & PRINT_NUMBER_SEEN_MASK;
1751 } 1751 }
1752 1752
1789 1789
1790 static int 1790 static int
1791 print_seen_once (Lisp_Object UNUSED (key), Lisp_Object value, 1791 print_seen_once (Lisp_Object UNUSED (key), Lisp_Object value,
1792 void * UNUSED (extra_arg)) 1792 void * UNUSED (extra_arg))
1793 { 1793 {
1794 return 1 == ((XINT (value) & PRINT_NUMBER_SEEN_MASK)); 1794 return 1 == ((XFIXNUM (value) & PRINT_NUMBER_SEEN_MASK));
1795 } 1795 }
1796 1796
1797 static int 1797 static int
1798 print_nonsymbol_seen_once (Lisp_Object key, Lisp_Object value, 1798 print_nonsymbol_seen_once (Lisp_Object key, Lisp_Object value,
1799 void * UNUSED (extra_arg)) 1799 void * UNUSED (extra_arg))
1800 { 1800 {
1801 /* print_continuous_numbering is used for symbols, so we don't delete them 1801 /* print_continuous_numbering is used for symbols, so we don't delete them
1802 from the print info hash table. It's less useful for other objects at 1802 from the print info hash table. It's less useful for other objects at
1803 the moment, though. */ 1803 the moment, though. */
1804 return !SYMBOLP (key) && (1 == ((XINT (value) & PRINT_NUMBER_SEEN_MASK))); 1804 return !SYMBOLP (key) && (1 == ((XFIXNUM (value) & PRINT_NUMBER_SEEN_MASK)));
1805 } 1805 }
1806 1806
1807 static int 1807 static int
1808 print_sort_get_numbers (Lisp_Object key, Lisp_Object value, void *extra_arg) 1808 print_sort_get_numbers (Lisp_Object key, Lisp_Object value, void *extra_arg)
1809 { 1809 {
1810 preprocess_sort_t **preprocess_sort_ptr = (preprocess_sort_t **) extra_arg; 1810 preprocess_sort_t **preprocess_sort_ptr = (preprocess_sort_t **) extra_arg;
1811 preprocess_sort_t *preprocess_sort = *preprocess_sort_ptr; 1811 preprocess_sort_t *preprocess_sort = *preprocess_sort_ptr;
1812 1812
1813 *preprocess_sort_ptr += 1; 1813 *preprocess_sort_ptr += 1;
1814 preprocess_sort->key = key; 1814 preprocess_sort->key = key;
1815 preprocess_sort->count = XINT (value); 1815 preprocess_sort->count = XFIXNUM (value);
1816 1816
1817 return 0; 1817 return 0;
1818 } 1818 }
1819 1819
1820 static int 1820 static int
1875 elisp_map_remhash (print_continuous_numbering ? 1875 elisp_map_remhash (print_continuous_numbering ?
1876 print_nonsymbol_seen_once : print_seen_once, 1876 print_nonsymbol_seen_once : print_seen_once,
1877 Vprint_number_table, NULL); 1877 Vprint_number_table, NULL);
1878 1878
1879 new_print_number_index 1879 new_print_number_index
1880 = XINT (Fhash_table_count (Vprint_number_table)); 1880 = XFIXNUM (Fhash_table_count (Vprint_number_table));
1881 1881
1882 if (new_print_number_index != print_number_index 1882 if (new_print_number_index != print_number_index
1883 && new_print_number_index != old_print_number_index) 1883 && new_print_number_index != old_print_number_index)
1884 { 1884 {
1885 preprocess_sort_t *preprocess_sort 1885 preprocess_sort_t *preprocess_sort
1899 for (ii = old_print_number_index; 1899 for (ii = old_print_number_index;
1900 ii < new_print_number_index; 1900 ii < new_print_number_index;
1901 ii++) 1901 ii++)
1902 { 1902 {
1903 Fputhash (preprocess_sort[ii].key, 1903 Fputhash (preprocess_sort[ii].key,
1904 make_int ((preprocess_sort[ii].count 1904 make_fixnum ((preprocess_sort[ii].count
1905 & ~PRINT_NUMBER_ORDINAL_MASK) 1905 & ~PRINT_NUMBER_ORDINAL_MASK)
1906 | ((ii + 1) 1906 | ((ii + 1)
1907 << PRINT_NUMBER_ORDINAL_SHIFT)), 1907 << PRINT_NUMBER_ORDINAL_SHIFT)),
1908 Vprint_number_table); 1908 Vprint_number_table);
1909 } 1909 }
1912 print_number_index = new_print_number_index; 1912 print_number_index = new_print_number_index;
1913 1913
1914 /* The new objects may include OBJ; update SEEN to reflect 1914 /* The new objects may include OBJ; update SEEN to reflect
1915 this. */ 1915 this. */
1916 seen = Fgethash (obj, Vprint_number_table, Qnil); 1916 seen = Fgethash (obj, Vprint_number_table, Qnil);
1917 if (INTP (seen)) 1917 if (FIXNUMP (seen))
1918 { 1918 {
1919 goto prefix_this; 1919 goto prefix_this;
1920 } 1920 }
1921 } 1921 }
1922 } 1922 }
1923 else 1923 else
1924 { 1924 {
1925 prefix_this: 1925 prefix_this:
1926 if ((XINT (seen) & PRINT_NUMBER_SEEN_MASK) == 1 1926 if ((XFIXNUM (seen) & PRINT_NUMBER_SEEN_MASK) == 1
1927 && !(print_continuous_numbering && SYMBOLP (obj))) 1927 && !(print_continuous_numbering && SYMBOLP (obj)))
1928 { 1928 {
1929 return PRINT_GENSYM_PRINT_AND_CLEANUP_TABLE; 1929 return PRINT_GENSYM_PRINT_AND_CLEANUP_TABLE;
1930 } 1930 }
1931 else if (XINT (seen) & PRINT_NUMBER_PRINTED_MASK) 1931 else if (XFIXNUM (seen) & PRINT_NUMBER_PRINTED_MASK)
1932 { 1932 {
1933 write_fmt_string (printcharfun, "#%d#", 1933 write_fmt_string (printcharfun, "#%d#",
1934 (XINT (seen) & PRINT_NUMBER_ORDINAL_MASK) 1934 (XFIXNUM (seen) & PRINT_NUMBER_ORDINAL_MASK)
1935 >> PRINT_NUMBER_ORDINAL_SHIFT); 1935 >> PRINT_NUMBER_ORDINAL_SHIFT);
1936 1936
1937 /* We're finished printing this object. */ 1937 /* We're finished printing this object. */
1938 return PRINT_GENSYM_DONE; 1938 return PRINT_GENSYM_DONE;
1939 } 1939 }
1940 else 1940 else
1941 { 1941 {
1942 write_fmt_string (printcharfun, "#%d=", 1942 write_fmt_string (printcharfun, "#%d=",
1943 (XINT (seen) & PRINT_NUMBER_ORDINAL_MASK) 1943 (XFIXNUM (seen) & PRINT_NUMBER_ORDINAL_MASK)
1944 >> PRINT_NUMBER_ORDINAL_SHIFT); 1944 >> PRINT_NUMBER_ORDINAL_SHIFT);
1945 1945
1946 /* We set PRINT_NUMBER_PRINTED_MASK immediately here, so the 1946 /* We set PRINT_NUMBER_PRINTED_MASK immediately here, so the
1947 object itself is written as #%d# when printing its contents. */ 1947 object itself is written as #%d# when printing its contents. */
1948 Fputhash (obj, make_int (XINT (seen) | PRINT_NUMBER_PRINTED_MASK), 1948 Fputhash (obj, make_fixnum (XFIXNUM (seen) | PRINT_NUMBER_PRINTED_MASK),
1949 Vprint_number_table); 1949 Vprint_number_table);
1950 1950
1951 /* This is the first time the object has been seen while 1951 /* This is the first time the object has been seen while
1952 printing the recursive object; we still have to go ahead 1952 printing the recursive object; we still have to go ahead
1953 and do the actual print. */ 1953 and do the actual print. */
1969 return tree; 1969 return tree;
1970 } 1970 }
1971 1971
1972 seen = Fgethash (tree, number_table, Qnil); 1972 seen = Fgethash (tree, number_table, Qnil);
1973 1973
1974 if (INTP (seen)) 1974 if (FIXNUMP (seen))
1975 { 1975 {
1976 if (XINT (seen) & PRINT_NUMBER_PRINTED_MASK) 1976 if (XFIXNUM (seen) & PRINT_NUMBER_PRINTED_MASK)
1977 { 1977 {
1978 return tree; 1978 return tree;
1979 } 1979 }
1980 1980
1981 Fputhash (tree, make_int (XINT (seen) | PRINT_NUMBER_PRINTED_MASK), 1981 Fputhash (tree, make_fixnum (XFIXNUM (seen) | PRINT_NUMBER_PRINTED_MASK),
1982 number_table); 1982 number_table);
1983 } 1983 }
1984 1984
1985 OBJECT_METH (tree, nsubst_structures_descend, 1985 OBJECT_METH (tree, nsubst_structures_descend,
1986 (new_, old, tree, number_table, test_not_unboundp)); 1986 (new_, old, tree, number_table, test_not_unboundp));
2079 } 2079 }
2080 } 2080 }
2081 2081
2082 switch (XTYPE (obj)) 2082 switch (XTYPE (obj))
2083 { 2083 {
2084 case Lisp_Type_Int_Even: 2084 case Lisp_Type_Fixnum_Even:
2085 case Lisp_Type_Int_Odd: 2085 case Lisp_Type_Fixnum_Odd:
2086 { 2086 {
2087 Ascbyte buf[DECIMAL_PRINT_SIZE (EMACS_INT)]; 2087 Ascbyte buf[DECIMAL_PRINT_SIZE (EMACS_INT)];
2088 long_to_string (buf, XINT (obj)); 2088 long_to_string (buf, XFIXNUM (obj));
2089 write_ascstring (printcharfun, buf); 2089 write_ascstring (printcharfun, buf);
2090 break; 2090 break;
2091 } 2091 }
2092 2092
2093 case Lisp_Type_Char: 2093 case Lisp_Type_Char:
2313 } 2313 }
2314 2314
2315 if (CONSP (obj) || VECTORP (obj)) 2315 if (CONSP (obj) || VECTORP (obj))
2316 { 2316 {
2317 /* If deeper than spec'd depth, print placeholder. */ 2317 /* If deeper than spec'd depth, print placeholder. */
2318 if (INTP (Vprint_level) 2318 if (FIXNUMP (Vprint_level)
2319 && print_depth > XINT (Vprint_level)) 2319 && print_depth > XFIXNUM (Vprint_level))
2320 { 2320 {
2321 write_ascstring (printcharfun, "..."); 2321 write_ascstring (printcharfun, "...");
2322 break; 2322 break;
2323 } 2323 }
2324 } 2324 }
2634 } 2634 }
2635 2635
2636 static Lisp_Object 2636 static Lisp_Object
2637 restore_inhibit_non_essential_conversion_operations (Lisp_Object obj) 2637 restore_inhibit_non_essential_conversion_operations (Lisp_Object obj)
2638 { 2638 {
2639 inhibit_non_essential_conversion_operations = XINT (obj); 2639 inhibit_non_essential_conversion_operations = XFIXNUM (obj);
2640 return Qnil; 2640 return Qnil;
2641 } 2641 }
2642 2642
2643 /* Bind the value of inhibit_non_essential_conversion_operations to 1 2643 /* Bind the value of inhibit_non_essential_conversion_operations to 1
2644 in a way that involves no consing. */ 2644 in a way that involves no consing. */
2646 begin_inhibit_non_essential_conversion_operations (void) 2646 begin_inhibit_non_essential_conversion_operations (void)
2647 { 2647 {
2648 int depth = 2648 int depth =
2649 record_unwind_protect 2649 record_unwind_protect
2650 (restore_inhibit_non_essential_conversion_operations, 2650 (restore_inhibit_non_essential_conversion_operations,
2651 make_int (inhibit_non_essential_conversion_operations)); 2651 make_fixnum (inhibit_non_essential_conversion_operations));
2652 inhibit_non_essential_conversion_operations = 1; 2652 inhibit_non_essential_conversion_operations = 1;
2653 return depth; 2653 return depth;
2654 } 2654 }
2655 2655
2656 static int debug_print_length = 50; 2656 static int debug_print_length = 50;
2709 print_readably = debug_print_readably != -1 ? debug_print_readably : 0; 2709 print_readably = debug_print_readably != -1 ? debug_print_readably : 0;
2710 print_unbuffered++; 2710 print_unbuffered++;
2711 in_debug_print = 1; 2711 in_debug_print = 1;
2712 gc_currently_forbidden = 1; 2712 gc_currently_forbidden = 1;
2713 if (debug_print_length > 0) 2713 if (debug_print_length > 0)
2714 Vprint_length = make_int (debug_print_length); 2714 Vprint_length = make_fixnum (debug_print_length);
2715 if (debug_print_level > 0) 2715 if (debug_print_level > 0)
2716 Vprint_level = make_int (debug_print_level); 2716 Vprint_level = make_fixnum (debug_print_level);
2717 Vinhibit_quit = Qt; 2717 Vinhibit_quit = Qt;
2718 2718
2719 return specdepth; 2719 return specdepth;
2720 } 2720 }
2721 2721
2788 if (!STRINGP (name)) 2788 if (!STRINGP (name))
2789 debug_out ("<<bad symbol>>"); 2789 debug_out ("<<bad symbol>>");
2790 else 2790 else
2791 debug_out ("%s", XSTRING_DATA (name)); 2791 debug_out ("%s", XSTRING_DATA (name));
2792 } 2792 }
2793 else if (INTP (obj)) 2793 else if (FIXNUMP (obj))
2794 { 2794 {
2795 debug_out ("%ld", XINT (obj)); 2795 debug_out ("%ld", XFIXNUM (obj));
2796 } 2796 }
2797 else if (FLOATP (obj)) 2797 else if (FLOATP (obj))
2798 { 2798 {
2799 debug_out ("%g", XFLOAT_DATA (obj)); 2799 debug_out ("%g", XFLOAT_DATA (obj));
2800 } 2800 }