comparison src/lisp.h @ 5178:97eb4942aec8

merge
author Ben Wing <ben@xemacs.org>
date Mon, 29 Mar 2010 21:28:13 -0500
parents 8b2f75cecb89 5ddbab03b0e6
children 4cd28c29a7a1
comparison
equal deleted inserted replaced
5177:b785049378e3 5178:97eb4942aec8
82 assumption that Ibyte * text is composed of 1-byte units (e.g. UTF-16 82 assumption that Ibyte * text is composed of 1-byte units (e.g. UTF-16
83 is composed of 2-byte units and might be a possible format to consider 83 is composed of 2-byte units and might be a possible format to consider
84 for Ibyte * text). 84 for Ibyte * text).
85 85
86 %%#### marks places that need work for KKCC (the new garbage collector). 86 %%#### marks places that need work for KKCC (the new garbage collector).
87
88 @@#### marks places that need work to get Unicode-internal working,
89 i.e. using UTF-8 as the internal text format.
90
91 #### BILL! marks places that need work for GTK.
92
93 #### GEOM! marks places needing work to fix various bugs in the handling
94 of window and frame sizing and positioning. Often the root of the
95 problems is that the code was originally written before there was a
96 gutter and then not completely fixed up to accommodate the gutter.
87 97
88 */ 98 */
89 99
90 /************************************************************************/ 100 /************************************************************************/
91 /* include files */ 101 /* include files */
1227 and line of the inline function, which is not very useful. */ 1237 and line of the inline function, which is not very useful. */
1228 1238
1229 /* Highly dubious kludge */ 1239 /* Highly dubious kludge */
1230 /* (thanks, Jamie, I feel better now -- ben) */ 1240 /* (thanks, Jamie, I feel better now -- ben) */
1231 MODULE_API void assert_failed (const Ascbyte *, int, const Ascbyte *); 1241 MODULE_API void assert_failed (const Ascbyte *, int, const Ascbyte *);
1242 void assert_equal_failed (const Ascbyte *file, int line, EMACS_INT x,
1243 EMACS_INT y, const Ascbyte *exprx,
1244 const Ascbyte *expry);
1232 #define ABORT() assert_failed (__FILE__, __LINE__, "ABORT()") 1245 #define ABORT() assert_failed (__FILE__, __LINE__, "ABORT()")
1233 #define abort_with_message(msg) assert_failed (__FILE__, __LINE__, msg) 1246 #define abort_with_message(msg) assert_failed (__FILE__, __LINE__, msg)
1234 1247
1235 /* This used to be ((void) (0)) but that triggers lots of unused variable 1248 /* This used to be ((void) (0)) but that triggers lots of unused variable
1236 warnings -- furthermore, if `x' has any side effects, e.g. 1249 warnings -- furthermore, if `x' has any side effects, e.g.
1247 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x)) 1260 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
1248 # define assert_with_message(x, msg) \ 1261 # define assert_with_message(x, msg) \
1249 ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, msg)) 1262 ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, msg))
1250 # define assert_at_line(x, file, line) \ 1263 # define assert_at_line(x, file, line) \
1251 ((x) ? (void) 0 : assert_failed (file, line, #x)) 1264 ((x) ? (void) 0 : assert_failed (file, line, #x))
1265 # define assert_equal(x, y) \
1266 ((x) == (y) ? (void) 0 : \
1267 assert_equal_failed (__FILE__, __LINE__, (EMACS_INT) x, (EMACS_INT) y, \
1268 #x, #y))
1252 #else 1269 #else
1253 /* This used to be ((void) (0)) but that triggers lots of unused variable 1270 /* This used to be ((void) (0)) but that triggers lots of unused variable
1254 warnings. It's pointless to force all that code to be rewritten, with 1271 warnings. It's pointless to force all that code to be rewritten, with
1255 added ifdefs. Any reasonable compiler will eliminate an expression with 1272 added ifdefs. Any reasonable compiler will eliminate an expression with
1256 no effects. */ 1273 no effects. */
1257 # define assert(x) disabled_assert (x) 1274 # define assert(x) disabled_assert (x)
1258 # define assert_with_message(x, msg) disabled_assert_with_message (x, msg) 1275 # define assert_with_message(x, msg) disabled_assert_with_message (x, msg)
1259 # define assert_at_line(x, file, line) disabled_assert_at_line (x, file, line) 1276 # define assert_at_line(x, file, line) disabled_assert_at_line (x, file, line)
1277 # define assert_equal(x, y) disabled_assert ((x) == (y))
1260 #endif 1278 #endif
1261 1279
1262 /************************************************************************/ 1280 /************************************************************************/
1263 /** Memory allocation **/ 1281 /** Memory allocation **/
1264 /************************************************************************/ 1282 /************************************************************************/
1542 RUN_HOOKS_TO_COMPLETION, 1560 RUN_HOOKS_TO_COMPLETION,
1543 RUN_HOOKS_UNTIL_SUCCESS, 1561 RUN_HOOKS_UNTIL_SUCCESS,
1544 RUN_HOOKS_UNTIL_FAILURE 1562 RUN_HOOKS_UNTIL_FAILURE
1545 }; 1563 };
1546 1564
1547 #ifdef HAVE_TOOLBARS
1548 enum toolbar_pos
1549 {
1550 TOP_TOOLBAR,
1551 BOTTOM_TOOLBAR,
1552 LEFT_TOOLBAR,
1553 RIGHT_TOOLBAR
1554 };
1555 #endif
1556
1557 enum edge_style 1565 enum edge_style
1558 { 1566 {
1559 EDGE_ETCHED_IN, 1567 EDGE_ETCHED_IN,
1560 EDGE_ETCHED_OUT, 1568 EDGE_ETCHED_OUT,
1561 EDGE_BEVEL_IN, 1569 EDGE_BEVEL_IN,
1581 }; 1589 };
1582 1590
1583 /* ------------------------------- */ 1591 /* ------------------------------- */
1584 /* misc */ 1592 /* misc */
1585 /* ------------------------------- */ 1593 /* ------------------------------- */
1586
1587 #ifdef MEMORY_USAGE_STATS
1588 1594
1589 /* This structure is used to keep statistics on the amount of memory 1595 /* This structure is used to keep statistics on the amount of memory
1590 in use. 1596 in use.
1591 1597
1592 WAS_REQUESTED stores the actual amount of memory that was requested 1598 WAS_REQUESTED stores the actual amount of memory that was requested
1603 1609
1604 Functions that accept a structure of this sort do not initialize 1610 Functions that accept a structure of this sort do not initialize
1605 the fields to 0, and add any existing values to whatever was there 1611 the fields to 0, and add any existing values to whatever was there
1606 before; this way, you can get a cumulative effect. */ 1612 before; this way, you can get a cumulative effect. */
1607 1613
1608 struct overhead_stats 1614 struct usage_stats
1609 { 1615 {
1610 int was_requested; 1616 Bytecount was_requested;
1611 int malloc_overhead; 1617 Bytecount malloc_overhead;
1612 int dynarr_overhead; 1618 Bytecount dynarr_overhead;
1613 int gap_overhead; 1619 Bytecount gap_overhead;
1614 }; 1620 };
1615 1621
1616 #endif /* MEMORY_USAGE_STATS */ 1622 /* Generic version of usage stats structure including extra non-Lisp and
1623 Lisp storage associated with the object, but not including the memory
1624 used to hold the object itself. Up to 32 statistics are allowed,
1625 in addition to the statistics in `U', which store another slice onto the
1626 ancillary non-Lisp storage.
1627
1628 Normally, each object creates its own version of this structure, e.g.
1629 `struct window_stats', which parallels the structure in beginning with
1630 a `struct usage_stats' and followed by Bytecount fields, so that a
1631 pointer to that structure can be cast to a pointer of this structure
1632 and sensible results gotten. */
1633
1634 struct generic_usage_stats
1635 {
1636 struct usage_stats u;
1637 Bytecount othervals[32];
1638 };
1617 1639
1618 1640
1619 /************************************************************************/ 1641 /************************************************************************/
1620 /* Definition of Lisp_Object data type */ 1642 /* Definition of Lisp_Object data type */
1621 /************************************************************************/ 1643 /************************************************************************/
1720 EMACS_UINT p = XUINT (obj); 1742 EMACS_UINT p = XUINT (obj);
1721 return (void *) (p << 1); 1743 return (void *) (p << 1);
1722 } 1744 }
1723 1745
1724 /************************************************************************/ 1746 /************************************************************************/
1725 /** Definitions of dynamic arrays (dynarrs) and other allocators **/ 1747 /** Definitions of dynarrs and other allocators **/
1726 /************************************************************************/ 1748 /************************************************************************/
1727 1749
1728 BEGIN_C_DECLS 1750 #include "array.h"
1729
1730 /************* Dynarr declaration *************/
1731
1732 #ifdef NEW_GC
1733 #define DECLARE_DYNARR_LISP_IMP() \
1734 const struct lrecord_implementation *lisp_imp;
1735 #else
1736 #define DECLARE_DYNARR_LISP_IMP()
1737 #endif
1738
1739 #ifdef ERROR_CHECK_DYNARR
1740 #define DECLARE_DYNARR_LOCKED() \
1741 int locked;
1742 #else
1743 #define DECLARE_DYNARR_LOCKED()
1744 #endif
1745
1746 #define Dynarr_declare(type) \
1747 struct lrecord_header header; \
1748 type *base; \
1749 DECLARE_DYNARR_LISP_IMP () \
1750 DECLARE_DYNARR_LOCKED () \
1751 int elsize_; \
1752 int len_; \
1753 int largest_; \
1754 int max_
1755
1756 typedef struct dynarr
1757 {
1758 Dynarr_declare (void);
1759 } Dynarr;
1760
1761 #define XD_DYNARR_DESC(base_type, sub_desc) \
1762 { XD_BLOCK_PTR, offsetof (base_type, base), \
1763 XD_INDIRECT(1, 0), {sub_desc} }, \
1764 { XD_INT, offsetof (base_type, len_) }, \
1765 { XD_INT_RESET, offsetof (base_type, largest_), XD_INDIRECT(1, 0) }, \
1766 { XD_INT_RESET, offsetof (base_type, max_), XD_INDIRECT(1, 0) }
1767
1768 #ifdef NEW_GC
1769 #define XD_LISP_DYNARR_DESC(base_type, sub_desc) \
1770 { XD_LISP_OBJECT_BLOCK_PTR, offsetof (base_type, base), \
1771 XD_INDIRECT(1, 0), {sub_desc} }, \
1772 { XD_INT, offsetof (base_type, len_) }, \
1773 { XD_INT_RESET, offsetof (base_type, largest_), XD_INDIRECT(1, 0) }, \
1774 { XD_INT_RESET, offsetof (base_type, max_), XD_INDIRECT(1, 0) }
1775 #endif /* NEW_GC */
1776
1777 /************* Dynarr verification *************/
1778
1779 /* Dynarr locking and verification.
1780
1781 [I] VERIFICATION
1782
1783 Verification routines simply return their basic argument, possibly
1784 casted, but in the process perform some verification on it, aborting if
1785 the verification fails. The verification routines take FILE and LINE
1786 parameters, and use them to output the file and line of the caller
1787 when an abort occurs, rather than the file and line of the inline
1788 function, which is less than useful.
1789
1790 There are three basic types of verification routines:
1791
1792 (1) Verify the dynarr itself. This verifies the basic invariant
1793 involving the length/size values:
1794
1795 0 <= Dynarr_length(d) <= Dynarr_largest(d) <= Dynarr_max(d)
1796
1797 (2) Verify the dynarr itself prior to modifying it. This performs
1798 the same verification as previously, but also checks that the
1799 dynarr is not locked (see below).
1800
1801 (3) Verify a dynarr position. Unfortunately we have to have
1802 different verification routines depending on which kind of operation
1803 is being performed:
1804
1805 (a) For Dynarr_at(), we check that the POS is bounded by Dynarr_largest(),
1806 i.e. 0 <= POS < Dynarr_largest().
1807 (b) For Dynarr_atp_allow_end(), we also have to allow
1808 POS == Dynarr_largest().
1809 (c) For Dynarr_atp(), we behave largely like Dynarr_at() but make a
1810 special exception when POS == 0 and Dynarr_largest() == 0 -- see
1811 comment below.
1812 (d) Some other routines contain the POS verification within their code,
1813 and make the check 0 <= POS < Dynarr_length() or
1814 0 <= POS <= Dynarr_length().
1815
1816 #### It is not well worked-out whether and in what circumstances it's
1817 allowed to use a position that is between Dynarr_length() and
1818 Dynarr_largest(). The ideal solution is to never allow this, and require
1819 instead that code first change the length before accessing higher
1820 positions. That would require looking through all the code that accesses
1821 dynarrs and fixing it appropriately (especially redisplay code, and
1822 especially redisplay code in the vicinity of a reference to
1823 Dynarr_largest(), since such code usually checks explicitly to see whether
1824 there is extra stuff between Dynarr_length() and Dynarr_largest().)
1825
1826 [II] LOCKING
1827
1828 The idea behind dynarr locking is simple: Locking a dynarr prevents
1829 any modification from occurring, or rather, leads to an abort upon
1830 any attempt to modify a dynarr.
1831
1832 Dynarr locking was originally added to catch some sporadic and hard-to-
1833 debug crashes in the redisplay code where dynarrs appeared to be getting
1834 corrupted in an unexpected fashion. The solution was to lock the
1835 dynarrs that were getting corrupted (in this case, the display-line
1836 dynarrs) around calls to routines that weren't supposed to be changing
1837 these dynarrs but might somehow be calling code that modified them.
1838 This eventually revealed that there was a reentrancy problem with
1839 redisplay that involved the QUIT mechanism and the processing done in
1840 order to determine whether C-g had been pressed -- this processing
1841 involves retrieving, processing and queueing pending events to see
1842 whether any of them result in a C-g keypress. However, at least under
1843 MS Windows this can result in redisplay being called reentrantly.
1844 For more info:--
1845
1846 (Info-goto-node "(internals)Critical Redisplay Sections")
1847
1848 */
1849
1850 #ifdef ERROR_CHECK_DYNARR
1851 DECLARE_INLINE_HEADER (
1852 int
1853 Dynarr_verify_pos_at (void *d, Elemcount pos, const Ascbyte *file, int line)
1854 )
1855 {
1856 Dynarr *dy = (Dynarr *) d;
1857 /* We use `largest', not `len', because the redisplay code often
1858 accesses stuff between len and largest. */
1859 assert_at_line (pos >= 0 && pos < dy->largest_, file, line);
1860 return pos;
1861 }
1862
1863 DECLARE_INLINE_HEADER (
1864 int
1865 Dynarr_verify_pos_atp (void *d, Elemcount pos, const Ascbyte *file, int line)
1866 )
1867 {
1868 Dynarr *dy = (Dynarr *) d;
1869 /* We use `largest', not `len', because the redisplay code often
1870 accesses stuff between len and largest. */
1871 /* [[ Code will often do something like ...
1872
1873 val = make_bit_vector_from_byte_vector (Dynarr_atp (dyn, 0),
1874 Dynarr_length (dyn));
1875
1876 which works fine when the Dynarr_length is non-zero, but when zero,
1877 the result of Dynarr_atp() not only points past the end of the
1878 allocated array, but the array may not have ever been allocated and
1879 hence the return value is NULL. But the length of 0 causes the
1880 pointer to never get checked. These can occur throughout the code
1881 so we put in a special check. --ben ]]
1882
1883 Update: The common idiom `Dynarr_atp (dyn, 0)' has been changed to
1884 `Dynarr_begin (dyn)'. Possibly this special check at POS 0 can be
1885 done only for Dynarr_begin() not for general Dynarr_atp(). --ben */
1886 if (pos == 0 && dy->len_ == 0)
1887 return pos;
1888 /* #### It's vaguely possible that some code could legitimately want to
1889 retrieve a pointer to the position just past the end of dynarr memory.
1890 This could happen with Dynarr_atp() but not Dynarr_at(). If so, it
1891 will trigger this assert(). In such cases, it should be obvious that
1892 the code wants to do this; rather than relaxing the assert, we should
1893 probably create a new macro Dynarr_atp_allow_end() which is like
1894 Dynarr_atp() but which allows for pointing at invalid addresses -- we
1895 really want to check for cases of accessing just past the end of
1896 memory, which is a likely off-by-one problem to occur and will usually
1897 not trigger a protection fault (instead, you'll just get random
1898 behavior, possibly overwriting other memory, which is bad). --ben */
1899 assert_at_line (pos >= 0 && pos < dy->largest_, file, line);
1900 return pos;
1901 }
1902
1903 DECLARE_INLINE_HEADER (
1904 int
1905 Dynarr_verify_pos_atp_allow_end (void *d, Elemcount pos, const Ascbyte *file,
1906 int line)
1907 )
1908 {
1909 Dynarr *dy = (Dynarr *) d;
1910 /* We use `largest', not `len', because the redisplay code often
1911 accesses stuff between len and largest.
1912 We also allow referencing the very end, past the end of allocated
1913 legitimately space. See comments in Dynarr_verify_pos_atp.()*/
1914 assert_at_line (pos >= 0 && pos <= dy->largest_, file, line);
1915 return pos;
1916 }
1917
1918 #else
1919 #define Dynarr_verify_pos_at(d, pos, file, line) (pos)
1920 #define Dynarr_verify_pos_atp(d, pos, file, line) (pos)
1921 #define Dynarr_verify_pos_atp_allow_end(d, pos, file, line) (pos)
1922 #endif /* ERROR_CHECK_DYNARR */
1923
1924 #ifdef ERROR_CHECK_DYNARR
1925 DECLARE_INLINE_HEADER (
1926 Dynarr *
1927 Dynarr_verify_1 (void *d, const Ascbyte *file, int line)
1928 )
1929 {
1930 Dynarr *dy = (Dynarr *) d;
1931 assert_at_line (dy->len_ >= 0 && dy->len_ <= dy->largest_ &&
1932 dy->largest_ <= dy->max_, file, line);
1933 return dy;
1934 }
1935
1936 DECLARE_INLINE_HEADER (
1937 Dynarr *
1938 Dynarr_verify_mod_1 (void *d, const Ascbyte *file, int line)
1939 )
1940 {
1941 Dynarr *dy = (Dynarr *) d;
1942 assert_at_line (!dy->locked, file, line);
1943 return Dynarr_verify_1 (d, file, line);
1944 }
1945
1946 #define Dynarr_verify(d) Dynarr_verify_1 (d, __FILE__, __LINE__)
1947 #define Dynarr_verify_mod(d) Dynarr_verify_mod_1 (d, __FILE__, __LINE__)
1948
1949 DECLARE_INLINE_HEADER (
1950 void
1951 Dynarr_lock (void *d)
1952 )
1953 {
1954 Dynarr *dy = Dynarr_verify_mod (d);
1955 dy->locked = 1;
1956 }
1957
1958 DECLARE_INLINE_HEADER (
1959 void
1960 Dynarr_unlock (void *d)
1961 )
1962 {
1963 Dynarr *dy = Dynarr_verify (d);
1964 assert (dy->locked);
1965 dy->locked = 0;
1966 }
1967
1968 #else /* not ERROR_CHECK_DYNARR */
1969
1970 #define Dynarr_verify(d) ((Dynarr *) d)
1971 #define Dynarr_verify_mod(d) ((Dynarr *) d)
1972 #define Dynarr_lock(d) DO_NOTHING
1973 #define Dynarr_unlock(d) DO_NOTHING
1974
1975 #endif /* ERROR_CHECK_DYNARR */
1976
1977 /************* Dynarr creation *************/
1978
1979 MODULE_API void *Dynarr_newf (Bytecount elsize);
1980 MODULE_API void Dynarr_free (void *d);
1981
1982 #ifdef NEW_GC
1983 MODULE_API void *Dynarr_lisp_newf (Bytecount elsize,
1984 const struct lrecord_implementation
1985 *dynarr_imp,
1986 const struct lrecord_implementation *imp);
1987
1988 #define Dynarr_lisp_new(type, dynarr_imp, imp) \
1989 ((type##_dynarr *) Dynarr_lisp_newf (sizeof (type), dynarr_imp, imp))
1990 #define Dynarr_lisp_new2(dynarr_type, type, dynarr_imp, imp) \
1991 ((dynarr_type *) Dynarr_lisp_newf (sizeof (type)), dynarr_imp, imp)
1992 #endif /* NEW_GC */
1993 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type)))
1994 #define Dynarr_new2(dynarr_type, type) \
1995 ((dynarr_type *) Dynarr_newf (sizeof (type)))
1996
1997 /************* Dynarr access *************/
1998
1999 #ifdef ERROR_CHECK_DYNARR
2000 #define Dynarr_at(d, pos) \
2001 ((d)->base[Dynarr_verify_pos_at (d, pos, __FILE__, __LINE__)])
2002 #define Dynarr_atp_allow_end(d, pos) \
2003 (&((d)->base[Dynarr_verify_pos_atp_allow_end (d, pos, __FILE__, __LINE__)]))
2004 #define Dynarr_atp(d, pos) \
2005 (&((d)->base[Dynarr_verify_pos_atp (d, pos, __FILE__, __LINE__)]))
2006 #else
2007 #define Dynarr_at(d, pos) ((d)->base[pos])
2008 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos))
2009 #define Dynarr_atp_allow_end(d, pos) Dynarr_atp (d, pos)
2010 #endif
2011
2012 /* Old #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) */
2013 #define Dynarr_begin(d) Dynarr_atp (d, 0)
2014 #define Dynarr_lastp(d) Dynarr_atp (d, Dynarr_length (d) - 1)
2015 #define Dynarr_past_lastp(d) Dynarr_atp_allow_end (d, Dynarr_length (d))
2016
2017
2018 /************* Dynarr length/size retrieval and setting *************/
2019
2020 /* Retrieve the length of a dynarr. The `+ 0' is to ensure that this cannot
2021 be used as an lvalue. */
2022 #define Dynarr_length(d) (Dynarr_verify (d)->len_ + 0)
2023 /* Retrieve the largest ever length seen of a dynarr. The `+ 0' is to
2024 ensure that this cannot be used as an lvalue. */
2025 #define Dynarr_largest(d) (Dynarr_verify (d)->largest_ + 0)
2026 /* Retrieve the number of elements that fit in the currently allocated
2027 space. The `+ 0' is to ensure that this cannot be used as an lvalue. */
2028 #define Dynarr_max(d) (Dynarr_verify (d)->max_ + 0)
2029 /* Return the size in bytes of an element in a dynarr. */
2030 #define Dynarr_elsize(d) (Dynarr_verify (d)->elsize_ + 0)
2031 /* Retrieve the advertised memory usage of a dynarr, i.e. the number of
2032 bytes occupied by the elements in the dynarr, not counting any overhead. */
2033 #define Dynarr_sizeof(d) (Dynarr_length (d) * Dynarr_elsize (d))
2034
2035 /* Actually set the length of a dynarr. This is a low-level routine that
2036 should not be directly used; use Dynarr_set_length() or
2037 Dynarr_set_lengthr() instead. */
2038 DECLARE_INLINE_HEADER (
2039 void
2040 Dynarr_set_length_1 (void *d, Elemcount len)
2041 )
2042 {
2043 Dynarr *dy = Dynarr_verify_mod (d);
2044 dynarr_checking_assert (len >= 0 && len <= Dynarr_max (dy));
2045 /* Use the raw field references here otherwise we get a crash because
2046 we've set the length but not yet fixed up the largest value. */
2047 dy->len_ = len;
2048 if (dy->len_ > dy->largest_)
2049 dy->largest_ = dy->len_;
2050 (void) Dynarr_verify_mod (d);
2051 }
2052
2053 /* "Restricted set-length": Set the length of dynarr D to LEN,
2054 which must be in the range [0, Dynarr_largest(d)]. */
2055
2056 DECLARE_INLINE_HEADER (
2057 void
2058 Dynarr_set_lengthr (void *d, Elemcount len)
2059 )
2060 {
2061 Dynarr *dy = Dynarr_verify_mod (d);
2062 dynarr_checking_assert (len >= 0 && len <= Dynarr_largest (dy));
2063 Dynarr_set_length_1 (dy, len);
2064 }
2065
2066 /* "Restricted increment": Increment the length of dynarr D by 1; the resulting
2067 length must be in the range [0, Dynarr_largest(d)]. */
2068
2069 #define Dynarr_incrementr(d) Dynarr_set_lengthr (d, Dynarr_length (d) + 1)
2070
2071
2072 MODULE_API void Dynarr_resize (void *d, Elemcount size);
2073
2074 DECLARE_INLINE_HEADER (
2075 void
2076 Dynarr_resize_to_fit (void *d, Elemcount size)
2077 )
2078 {
2079 Dynarr *dy = Dynarr_verify_mod (d);
2080 if (size > Dynarr_max (dy))
2081 Dynarr_resize (dy, size);
2082 }
2083
2084 #define Dynarr_resize_to_add(d, numels) \
2085 Dynarr_resize_to_fit (d, Dynarr_length (d) + numels)
2086
2087 /* This is an optimization. This is like Dynarr_set_length() but the length
2088 is guaranteed to be at least as big as the existing length. */
2089
2090 DECLARE_INLINE_HEADER (
2091 void
2092 Dynarr_increase_length (void *d, Elemcount len)
2093 )
2094 {
2095 Dynarr *dy = Dynarr_verify_mod (d);
2096 dynarr_checking_assert (len >= Dynarr_length (dy));
2097 Dynarr_resize_to_fit (dy, len);
2098 Dynarr_set_length_1 (dy, len);
2099 }
2100
2101 /* Set the length of dynarr D to LEN. If the length increases, resize as
2102 necessary to fit. (NOTE: This will leave uninitialized memory. If you
2103 aren't planning on immediately overwriting the memory, use
2104 Dynarr_set_length_and_zero() to zero out all the memory that would
2105 otherwise be uninitialized.) */
2106
2107 DECLARE_INLINE_HEADER (
2108 void
2109 Dynarr_set_length (void *d, Elemcount len)
2110 )
2111 {
2112 Dynarr *dy = Dynarr_verify_mod (d);
2113 Elemcount old_len = Dynarr_length (dy);
2114 if (old_len >= len)
2115 Dynarr_set_lengthr (dy, len);
2116 else
2117 Dynarr_increase_length (d, len);
2118 }
2119
2120 #define Dynarr_increment(d) Dynarr_increase_length (d, Dynarr_length (d) + 1)
2121
2122 /* Zero LEN contiguous elements starting at POS. */
2123
2124 DECLARE_INLINE_HEADER (
2125 void
2126 Dynarr_zero_many (void *d, Elemcount pos, Elemcount len)
2127 )
2128 {
2129 Dynarr *dy = Dynarr_verify_mod (d);
2130 memset ((Rawbyte *) dy->base + pos*Dynarr_elsize (dy), 0,
2131 len*Dynarr_elsize (dy));
2132 }
2133
2134 /* This is an optimization. This is like Dynarr_set_length_and_zero() but
2135 the length is guaranteed to be at least as big as the existing
2136 length. */
2137
2138 DECLARE_INLINE_HEADER (
2139 void
2140 Dynarr_increase_length_and_zero (void *d, Elemcount len)
2141 )
2142 {
2143 Dynarr *dy = Dynarr_verify_mod (d);
2144 Elemcount old_len = Dynarr_length (dy);
2145 Dynarr_increase_length (dy, len);
2146 Dynarr_zero_many (dy, old_len, len - old_len);
2147 }
2148
2149 /* Set the length of dynarr D to LEN. If the length increases, resize as
2150 necessary to fit and zero out all the elements between the old and new
2151 lengths. */
2152
2153 DECLARE_INLINE_HEADER (
2154 void
2155 Dynarr_set_length_and_zero (void *d, Elemcount len)
2156 )
2157 {
2158 Dynarr *dy = Dynarr_verify_mod (d);
2159 Elemcount old_len = Dynarr_length (dy);
2160 if (old_len >= len)
2161 Dynarr_set_lengthr (dy, len);
2162 else
2163 Dynarr_increase_length_and_zero (d, len);
2164 }
2165
2166 /* Reset the dynarr's length to 0. */
2167 #define Dynarr_reset(d) Dynarr_set_lengthr (d, 0)
2168
2169 #ifdef MEMORY_USAGE_STATS
2170 struct overhead_stats;
2171 Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats);
2172 #endif
2173
2174 /************* Adding/deleting elements to/from a dynarr *************/
2175
2176 /* Set the Lisp implementation of the element at POS in dynarr D. Only
2177 does this if the dynarr holds Lisp objects of a particular type (the
2178 objects themselves, not pointers to them), and only under NEW_GC. */
2179
2180 #ifdef NEW_GC
2181 #define DYNARR_SET_LISP_IMP(d, pos) \
2182 do { \
2183 if ((d)->lisp_imp) \
2184 set_lheader_implementation \
2185 ((struct lrecord_header *)&(((d)->base)[pos]), (d)->lisp_imp); \
2186 } while (0)
2187 #else
2188 #define DYNARR_SET_LISP_IMP(d, pos) DO_NOTHING
2189 #endif /* (not) NEW_GC */
2190
2191 /* Add Element EL to the end of dynarr D. */
2192
2193 #define Dynarr_add(d, el) \
2194 do { \
2195 Elemcount _da_pos = Dynarr_length (d); \
2196 (void) Dynarr_verify_mod (d); \
2197 Dynarr_increment (d); \
2198 ((d)->base)[_da_pos] = (el); \
2199 DYNARR_SET_LISP_IMP (d, _da_pos); \
2200 } while (0)
2201
2202 /* Set EL as the element at position POS in dynarr D.
2203 Expand the dynarr as necessary so that its length is enough to include
2204 position POS within it, and zero out any new elements created as a
2205 result of expansion, other than the one at POS. */
2206
2207 #define Dynarr_set(d, pos, el) \
2208 do { \
2209 Elemcount _ds_pos = (pos); \
2210 (void) Dynarr_verify_mod (d); \
2211 if (Dynarr_length (d) < _ds_pos + 1) \
2212 Dynarr_increase_length_and_zero (d, _ds_pos + 1); \
2213 ((d)->base)[_ds_pos] = (el); \
2214 DYNARR_SET_LISP_IMP (d, _ds_pos); \
2215 } while (0)
2216
2217 /* Add LEN contiguous elements, stored at BASE, to dynarr D. If BASE is
2218 NULL, reserve space but don't store anything. */
2219
2220 DECLARE_INLINE_HEADER (
2221 void
2222 Dynarr_add_many (void *d, const void *base, Elemcount len)
2223 )
2224 {
2225 /* This duplicates Dynarr_insert_many to some extent; but since it is
2226 called so often, it seemed useful to remove the unnecessary stuff
2227 from that function and to make it inline */
2228 Dynarr *dy = Dynarr_verify_mod (d);
2229 Elemcount pos = Dynarr_length (dy);
2230 Dynarr_increase_length (dy, Dynarr_length (dy) + len);
2231 if (base)
2232 memcpy ((Rawbyte *) dy->base + pos*Dynarr_elsize (dy), base,
2233 len*Dynarr_elsize (dy));
2234 }
2235
2236 /* Insert LEN elements, currently pointed to by BASE, into dynarr D
2237 starting at position POS. */
2238
2239 MODULE_API void Dynarr_insert_many (void *d, const void *base, Elemcount len,
2240 Elemcount pos);
2241
2242 /* Prepend LEN elements, currently pointed to by BASE, to the beginning. */
2243
2244 #define Dynarr_prepend_many(d, base, len) Dynarr_insert_many (d, base, len, 0)
2245
2246 /* Add literal string S to dynarr D, which should hold chars or unsigned
2247 chars. The final zero byte is not stored. */
2248
2249 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1)
2250
2251 /* Convert Lisp string S to an external encoding according to CODESYS and
2252 add to dynarr D, which should hold chars or unsigned chars. No final
2253 zero byte is appended. */
2254
2255 /* #### This should be an inline function but LISP_STRING_TO_SIZED_EXTERNAL
2256 isn't declared yet. */
2257
2258 #define Dynarr_add_ext_lisp_string(d, s, codesys) \
2259 do { \
2260 Lisp_Object dyna_ls_s = (s); \
2261 Lisp_Object dyna_ls_cs = (codesys); \
2262 Extbyte *dyna_ls_eb; \
2263 Bytecount dyna_ls_bc; \
2264 \
2265 LISP_STRING_TO_SIZED_EXTERNAL (dyna_ls_s, dyna_ls_eb, \
2266 dyna_ls_bc, dyna_ls_cs); \
2267 Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \
2268 } while (0)
2269
2270 /* Delete LEN elements starting at position POS. */
2271
2272 MODULE_API void Dynarr_delete_many (void *d, Elemcount pos, Elemcount len);
2273
2274 /* Pop off (i.e. delete) the last element from the dynarr and return it */
2275
2276 #define Dynarr_pop(d) \
2277 (dynarr_checking_assert (Dynarr_length (d) > 0), \
2278 Dynarr_verify_mod (d)->len_--, \
2279 Dynarr_at (d, Dynarr_length (d)))
2280
2281 /* Delete the item at POS */
2282
2283 #define Dynarr_delete(d, pos) Dynarr_delete_many (d, pos, 1)
2284
2285 /* Delete the item located at memory address P, which must be a `type *'
2286 pointer, where `type' is the type of the elements of the dynarr. */
2287 #define Dynarr_delete_by_pointer(d, p) \
2288 Dynarr_delete_many (d, (p) - ((d)->base), 1)
2289
2290 /* Delete all elements that are numerically equal to EL. */
2291
2292 #define Dynarr_delete_object(d, el) \
2293 do \
2294 { \
2295 REGISTER int i; \
2296 for (i = Dynarr_length (d) - 1; i >= 0; i--) \
2297 { \
2298 if (el == Dynarr_at (d, i)) \
2299 Dynarr_delete_many (d, i, 1); \
2300 } \
2301 } while (0)
2302 1751
2303 /************* Dynarr typedefs *************/ 1752 /************* Dynarr typedefs *************/
2304 1753
2305 /* Dynarr typedefs -- basic types first */ 1754 /* Dynarr typedefs -- basic types first */
2306 1755
2381 { 1830 {
2382 Dynarr_declare (struct face_cachel); 1831 Dynarr_declare (struct face_cachel);
2383 } face_cachel_dynarr; 1832 } face_cachel_dynarr;
2384 1833
2385 #ifdef NEW_GC 1834 #ifdef NEW_GC
2386 DECLARE_LRECORD (face_cachel_dynarr, face_cachel_dynarr); 1835 DECLARE_LISP_OBJECT (face_cachel_dynarr, face_cachel_dynarr);
2387 #define XFACE_CACHEL_DYNARR(x) \ 1836 #define XFACE_CACHEL_DYNARR(x) \
2388 XRECORD (x, face_cachel_dynarr, face_cachel_dynarr) 1837 XRECORD (x, face_cachel_dynarr, face_cachel_dynarr)
2389 #define wrap_face_cachel_dynarr(p) wrap_record (p, face_cachel_dynarr) 1838 #define wrap_face_cachel_dynarr(p) wrap_record (p, face_cachel_dynarr)
2390 #define FACE_CACHEL_DYNARRP(x) RECORDP (x, face_cachel_dynarr) 1839 #define FACE_CACHEL_DYNARRP(x) RECORDP (x, face_cachel_dynarr)
2391 #define CHECK_FACE_CACHEL_DYNARR(x) CHECK_RECORD (x, face_cachel_dynarr) 1840 #define CHECK_FACE_CACHEL_DYNARR(x) CHECK_RECORD (x, face_cachel_dynarr)
2396 { 1845 {
2397 Dynarr_declare (struct glyph_cachel); 1846 Dynarr_declare (struct glyph_cachel);
2398 } glyph_cachel_dynarr; 1847 } glyph_cachel_dynarr;
2399 1848
2400 #ifdef NEW_GC 1849 #ifdef NEW_GC
2401 DECLARE_LRECORD (glyph_cachel_dynarr, glyph_cachel_dynarr); 1850 DECLARE_LISP_OBJECT (glyph_cachel_dynarr, glyph_cachel_dynarr);
2402 #define XGLYPH_CACHEL_DYNARR(x) \ 1851 #define XGLYPH_CACHEL_DYNARR(x) \
2403 XRECORD (x, glyph_cachel_dynarr, glyph_cachel_dynarr) 1852 XRECORD (x, glyph_cachel_dynarr, glyph_cachel_dynarr)
2404 #define wrap_glyph_cachel_dynarr(p) wrap_record (p, glyph_cachel_dynarr) 1853 #define wrap_glyph_cachel_dynarr(p) wrap_record (p, glyph_cachel_dynarr)
2405 #define GLYPH_CACHEL_DYNARRP(x) RECORDP (x, glyph_cachel_dynarr) 1854 #define GLYPH_CACHEL_DYNARRP(x) RECORDP (x, glyph_cachel_dynarr)
2406 #define CHECK_GLYPH_CACHEL_DYNARR(x) CHECK_RECORD (x, glyph_cachel_dynarr) 1855 #define CHECK_GLYPH_CACHEL_DYNARR(x) CHECK_RECORD (x, glyph_cachel_dynarr)
2424 { 1873 {
2425 Dynarr_declare (Lisp_Object *); 1874 Dynarr_declare (Lisp_Object *);
2426 } Lisp_Object_ptr_dynarr; 1875 } Lisp_Object_ptr_dynarr;
2427 1876
2428 1877
2429 /************* Stack-like malloc/free: Another allocator *************/
2430
2431 void *stack_like_malloc (Bytecount size);
2432 void stack_like_free (void *val);
2433
2434
2435 /************************************************************************/ 1878 /************************************************************************/
2436 /** Definitions of other basic Lisp objects **/ 1879 /** Definitions of other basic Lisp objects **/
2437 /************************************************************************/ 1880 /************************************************************************/
2438 1881
2439 /*------------------------------ unbound -------------------------------*/ 1882 /*------------------------------ unbound -------------------------------*/
2457 1900
2458 /* In a cons, the markbit of the car is the gc mark bit */ 1901 /* In a cons, the markbit of the car is the gc mark bit */
2459 1902
2460 struct Lisp_Cons 1903 struct Lisp_Cons
2461 { 1904 {
2462 struct lrecord_header lheader; 1905 FROB_BLOCK_LISP_OBJECT_HEADER lheader;
2463 Lisp_Object car_, cdr_; 1906 Lisp_Object car_, cdr_;
2464 }; 1907 };
2465 typedef struct Lisp_Cons Lisp_Cons; 1908 typedef struct Lisp_Cons Lisp_Cons;
2466 1909
2467 #if 0 /* FSFmacs */ 1910 #if 0 /* FSFmacs */
2474 struct buffer *buffer; 1917 struct buffer *buffer;
2475 int charbpos; 1918 int charbpos;
2476 }; 1919 };
2477 #endif 1920 #endif
2478 1921
2479 DECLARE_MODULE_API_LRECORD (cons, Lisp_Cons); 1922 DECLARE_MODULE_API_LISP_OBJECT (cons, Lisp_Cons);
2480 #define XCONS(x) XRECORD (x, cons, Lisp_Cons) 1923 #define XCONS(x) XRECORD (x, cons, Lisp_Cons)
2481 #define wrap_cons(p) wrap_record (p, cons) 1924 #define wrap_cons(p) wrap_record (p, cons)
2482 #define CONSP(x) RECORDP (x, cons) 1925 #define CONSP(x) RECORDP (x, cons)
2483 #define CHECK_CONS(x) CHECK_RECORD (x, cons) 1926 #define CHECK_CONS(x) CHECK_RECORD (x, cons)
2484 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons) 1927 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons)
3012 /*------------------------------ string --------------------------------*/ 2455 /*------------------------------ string --------------------------------*/
3013 2456
3014 #ifdef NEW_GC 2457 #ifdef NEW_GC
3015 struct Lisp_String_Direct_Data 2458 struct Lisp_String_Direct_Data
3016 { 2459 {
3017 struct lrecord_header header; 2460 NORMAL_LISP_OBJECT_HEADER header;
3018 Bytecount size; 2461 Bytecount size;
3019 Ibyte data[1]; 2462 Ibyte data[1];
3020 }; 2463 };
3021 typedef struct Lisp_String_Direct_Data Lisp_String_Direct_Data; 2464 typedef struct Lisp_String_Direct_Data Lisp_String_Direct_Data;
3022 2465
3023 DECLARE_MODULE_API_LRECORD (string_direct_data, Lisp_String_Direct_Data); 2466 DECLARE_MODULE_API_LISP_OBJECT (string_direct_data, Lisp_String_Direct_Data);
3024 #define XSTRING_DIRECT_DATA(x) \ 2467 #define XSTRING_DIRECT_DATA(x) \
3025 XRECORD (x, string_direct_data, Lisp_String_Direct_Data) 2468 XRECORD (x, string_direct_data, Lisp_String_Direct_Data)
3026 #define wrap_string_direct_data(p) wrap_record (p, string_direct_data) 2469 #define wrap_string_direct_data(p) wrap_record (p, string_direct_data)
3027 #define STRING_DIRECT_DATAP(x) RECORDP (x, string_direct_data) 2470 #define STRING_DIRECT_DATAP(x) RECORDP (x, string_direct_data)
3028 #define CHECK_STRING_DIRECT_DATA(x) CHECK_RECORD (x, string_direct_data) 2471 #define CHECK_STRING_DIRECT_DATA(x) CHECK_RECORD (x, string_direct_data)
3032 #define XSTRING_DIRECT_DATA_DATA(x) XSTRING_DIRECT_DATA (x)->data 2475 #define XSTRING_DIRECT_DATA_DATA(x) XSTRING_DIRECT_DATA (x)->data
3033 2476
3034 2477
3035 struct Lisp_String_Indirect_Data 2478 struct Lisp_String_Indirect_Data
3036 { 2479 {
3037 struct lrecord_header header; 2480 NORMAL_LISP_OBJECT_HEADER header;
3038 Bytecount size; 2481 Bytecount size;
3039 Ibyte *data; 2482 Ibyte *data;
3040 }; 2483 };
3041 typedef struct Lisp_String_Indirect_Data Lisp_String_Indirect_Data; 2484 typedef struct Lisp_String_Indirect_Data Lisp_String_Indirect_Data;
3042 2485
3043 DECLARE_MODULE_API_LRECORD (string_indirect_data, Lisp_String_Indirect_Data); 2486 DECLARE_MODULE_API_LISP_OBJECT (string_indirect_data, Lisp_String_Indirect_Data);
3044 #define XSTRING_INDIRECT_DATA(x) \ 2487 #define XSTRING_INDIRECT_DATA(x) \
3045 XRECORD (x, string_indirect_data, Lisp_String_Indirect_Data) 2488 XRECORD (x, string_indirect_data, Lisp_String_Indirect_Data)
3046 #define wrap_string_indirect_data(p) wrap_record (p, string_indirect_data) 2489 #define wrap_string_indirect_data(p) wrap_record (p, string_indirect_data)
3047 #define STRING_INDIRECT_DATAP(x) RECORDP (x, string_indirect_data) 2490 #define STRING_INDIRECT_DATAP(x) RECORDP (x, string_indirect_data)
3048 #define CHECK_STRING_INDIRECT_DATA(x) CHECK_RECORD (x, string_indirect_data) 2491 #define CHECK_STRING_INDIRECT_DATA(x) CHECK_RECORD (x, string_indirect_data)
3078 { 2521 {
3079 struct lrecord_header lheader; 2522 struct lrecord_header lheader;
3080 struct 2523 struct
3081 { 2524 {
3082 /* WARNING: Everything before ascii_begin must agree exactly with 2525 /* WARNING: Everything before ascii_begin must agree exactly with
3083 struct lrecord_header */ 2526 struct lrecord_header. (Actually, the `free' field in old-GC
2527 overlaps with ascii_begin there; we can get away with this
2528 because in old-GC the `free' field is used only for lcrecords. */
3084 unsigned int type :8; 2529 unsigned int type :8;
3085 #ifdef NEW_GC 2530 #ifdef NEW_GC
3086 unsigned int lisp_readonly :1; 2531 unsigned int lisp_readonly :1;
3087 unsigned int free :1; 2532 unsigned int free :1;
3088 /* Number of chars at beginning of string that are one byte in length 2533 /* Number of chars at beginning of string that are one byte in length
3113 #define MAX_STRING_ASCII_BEGIN ((1 << 22) - 1) 2558 #define MAX_STRING_ASCII_BEGIN ((1 << 22) - 1)
3114 #else /* not NEW_GC */ 2559 #else /* not NEW_GC */
3115 #define MAX_STRING_ASCII_BEGIN ((1 << 21) - 1) 2560 #define MAX_STRING_ASCII_BEGIN ((1 << 21) - 1)
3116 #endif /* not NEW_GC */ 2561 #endif /* not NEW_GC */
3117 2562
3118 DECLARE_MODULE_API_LRECORD (string, Lisp_String); 2563 DECLARE_MODULE_API_LISP_OBJECT (string, Lisp_String);
3119 #define XSTRING(x) XRECORD (x, string, Lisp_String) 2564 #define XSTRING(x) XRECORD (x, string, Lisp_String)
3120 #define wrap_string(p) wrap_record (p, string) 2565 #define wrap_string(p) wrap_record (p, string)
3121 #define STRINGP(x) RECORDP (x, string) 2566 #define STRINGP(x) RECORDP (x, string)
3122 #define CHECK_STRING(x) CHECK_RECORD (x, string) 2567 #define CHECK_STRING(x) CHECK_RECORD (x, string)
3123 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string) 2568 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string)
3186 2631
3187 /*------------------------------ vector --------------------------------*/ 2632 /*------------------------------ vector --------------------------------*/
3188 2633
3189 struct Lisp_Vector 2634 struct Lisp_Vector
3190 { 2635 {
3191 struct LCRECORD_HEADER header; 2636 NORMAL_LISP_OBJECT_HEADER header;
3192 long size; 2637 long size;
3193 Lisp_Object contents[1]; 2638 Lisp_Object contents[1];
3194 }; 2639 };
3195 typedef struct Lisp_Vector Lisp_Vector; 2640 typedef struct Lisp_Vector Lisp_Vector;
3196 2641
3197 DECLARE_LRECORD (vector, Lisp_Vector); 2642 DECLARE_LISP_OBJECT (vector, Lisp_Vector);
3198 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector) 2643 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector)
3199 #define wrap_vector(p) wrap_record (p, vector) 2644 #define wrap_vector(p) wrap_record (p, vector)
3200 #define VECTORP(x) RECORDP (x, vector) 2645 #define VECTORP(x) RECORDP (x, vector)
3201 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector) 2646 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector)
3202 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector) 2647 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector)
3223 #error You really have 128-bit integers?! 2668 #error You really have 128-bit integers?!
3224 #endif 2669 #endif
3225 2670
3226 struct Lisp_Bit_Vector 2671 struct Lisp_Bit_Vector
3227 { 2672 {
3228 struct LCRECORD_HEADER lheader; 2673 NORMAL_LISP_OBJECT_HEADER lheader;
3229 Elemcount size; 2674 Elemcount size;
3230 unsigned long bits[1]; 2675 unsigned long bits[1];
3231 }; 2676 };
3232 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector; 2677 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector;
3233 2678
3234 DECLARE_LRECORD (bit_vector, Lisp_Bit_Vector); 2679 DECLARE_LISP_OBJECT (bit_vector, Lisp_Bit_Vector);
3235 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector) 2680 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector)
3236 #define wrap_bit_vector(p) wrap_record (p, bit_vector) 2681 #define wrap_bit_vector(p) wrap_record (p, bit_vector)
3237 #define BIT_VECTORP(x) RECORDP (x, bit_vector) 2682 #define BIT_VECTORP(x) RECORDP (x, bit_vector)
3238 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector) 2683 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector)
3239 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector) 2684 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector)
3277 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2) 2722 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2)
3278 2723
3279 /* For when we want to include a bit vector in another structure, and we 2724 /* For when we want to include a bit vector in another structure, and we
3280 know it's of a fixed size. */ 2725 know it's of a fixed size. */
3281 #define DECLARE_INLINE_LISP_BIT_VECTOR(numbits) struct { \ 2726 #define DECLARE_INLINE_LISP_BIT_VECTOR(numbits) struct { \
3282 struct LCRECORD_HEADER lheader; \ 2727 NORMAL_LISP_OBJECT_HEADER lheader; \
3283 Elemcount size; \ 2728 Elemcount size; \
3284 unsigned long bits[BIT_VECTOR_LONG_STORAGE(numbits)]; \ 2729 unsigned long bits[BIT_VECTOR_LONG_STORAGE(numbits)]; \
3285 } 2730 }
3286 /*---------------------- array, sequence -----------------------------*/ 2731 /*---------------------- array, sequence -----------------------------*/
3287 2732
3312 /*------------------------------ symbol --------------------------------*/ 2757 /*------------------------------ symbol --------------------------------*/
3313 2758
3314 typedef struct Lisp_Symbol Lisp_Symbol; 2759 typedef struct Lisp_Symbol Lisp_Symbol;
3315 struct Lisp_Symbol 2760 struct Lisp_Symbol
3316 { 2761 {
3317 struct lrecord_header lheader; 2762 FROB_BLOCK_LISP_OBJECT_HEADER lheader;
3318 /* next symbol in this obarray bucket */ 2763 /* next symbol in this obarray bucket */
3319 Lisp_Symbol *next; 2764 Lisp_Symbol *next;
3320 Lisp_Object name; 2765 Lisp_Object name;
3321 Lisp_Object value; 2766 Lisp_Object value;
3322 Lisp_Object function; 2767 Lisp_Object function;
3328 && EQ (sym, oblookup (Vobarray, \ 2773 && EQ (sym, oblookup (Vobarray, \
3329 XSTRING_DATA (symbol_name (XSYMBOL (sym))), \ 2774 XSTRING_DATA (symbol_name (XSYMBOL (sym))), \
3330 XSTRING_LENGTH (symbol_name (XSYMBOL (sym)))))) 2775 XSTRING_LENGTH (symbol_name (XSYMBOL (sym))))))
3331 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj)) 2776 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj))
3332 2777
3333 DECLARE_MODULE_API_LRECORD (symbol, Lisp_Symbol); 2778 DECLARE_MODULE_API_LISP_OBJECT (symbol, Lisp_Symbol);
3334 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol) 2779 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol)
3335 #define wrap_symbol(p) wrap_record (p, symbol) 2780 #define wrap_symbol(p) wrap_record (p, symbol)
3336 #define SYMBOLP(x) RECORDP (x, symbol) 2781 #define SYMBOLP(x) RECORDP (x, symbol)
3337 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol) 2782 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol)
3338 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol) 2783 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol)
3356 We could define such types for n arguments, if needed. */ 2801 We could define such types for n arguments, if needed. */
3357 typedef Lisp_Object (*lisp_fn_t) (void); 2802 typedef Lisp_Object (*lisp_fn_t) (void);
3358 2803
3359 struct Lisp_Subr 2804 struct Lisp_Subr
3360 { 2805 {
3361 struct lrecord_header lheader; 2806 FROB_BLOCK_LISP_OBJECT_HEADER lheader;
3362 short min_args; 2807 short min_args;
3363 short max_args; 2808 short max_args;
3364 /* #### We should make these const Ascbyte * or const Ibyte *, not const 2809 /* #### We should make these const Ascbyte * or const Ibyte *, not const
3365 char *. */ 2810 char *. */
3366 const char *prompt; 2811 const char *prompt;
3368 const char *name; 2813 const char *name;
3369 lisp_fn_t subr_fn; 2814 lisp_fn_t subr_fn;
3370 }; 2815 };
3371 typedef struct Lisp_Subr Lisp_Subr; 2816 typedef struct Lisp_Subr Lisp_Subr;
3372 2817
3373 DECLARE_LRECORD (subr, Lisp_Subr); 2818 DECLARE_LISP_OBJECT (subr, Lisp_Subr);
3374 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr) 2819 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr)
3375 #define wrap_subr(p) wrap_record (p, subr) 2820 #define wrap_subr(p) wrap_record (p, subr)
3376 #define SUBRP(x) RECORDP (x, subr) 2821 #define SUBRP(x) RECORDP (x, subr)
3377 #define CHECK_SUBR(x) CHECK_RECORD (x, subr) 2822 #define CHECK_SUBR(x) CHECK_RECORD (x, subr)
3378 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr) 2823 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr)
3386 2831
3387 2832
3388 typedef struct Lisp_Marker Lisp_Marker; 2833 typedef struct Lisp_Marker Lisp_Marker;
3389 struct Lisp_Marker 2834 struct Lisp_Marker
3390 { 2835 {
3391 struct lrecord_header lheader; 2836 FROB_BLOCK_LISP_OBJECT_HEADER lheader;
3392 Lisp_Marker *next; 2837 Lisp_Marker *next;
3393 Lisp_Marker *prev; 2838 Lisp_Marker *prev;
3394 struct buffer *buffer; 2839 struct buffer *buffer;
3395 Membpos membpos; 2840 Membpos membpos;
3396 char insertion_type; 2841 char insertion_type;
3397 }; 2842 };
3398 2843
3399 DECLARE_MODULE_API_LRECORD (marker, Lisp_Marker); 2844 DECLARE_MODULE_API_LISP_OBJECT (marker, Lisp_Marker);
3400 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker) 2845 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker)
3401 #define wrap_marker(p) wrap_record (p, marker) 2846 #define wrap_marker(p) wrap_record (p, marker)
3402 #define MARKERP(x) RECORDP (x, marker) 2847 #define MARKERP(x) RECORDP (x, marker)
3403 #define CHECK_MARKER(x) CHECK_RECORD (x, marker) 2848 #define CHECK_MARKER(x) CHECK_RECORD (x, marker)
3404 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker) 2849 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker)
3456 #define CONCHECK_NATNUM(x) do { \ 2901 #define CONCHECK_NATNUM(x) do { \
3457 if (!NATNUMP (x)) \ 2902 if (!NATNUMP (x)) \
3458 x = wrong_type_argument (Qnatnump, x); \ 2903 x = wrong_type_argument (Qnatnump, x); \
3459 } while (0) 2904 } while (0)
3460 2905
2906 END_C_DECLS
2907
2908 /* -------------- properties of internally-formatted text ------------- */
2909
2910 #include "text.h"
2911
3461 /*------------------------------- char ---------------------------------*/ 2912 /*------------------------------- char ---------------------------------*/
2913
2914 BEGIN_C_DECLS
2915
2916 #ifdef ERROR_CHECK_TYPES
3462 2917
3463 /* NOTE: There are basic functions for converting between a character and 2918 /* NOTE: There are basic functions for converting between a character and
3464 the string representation of a character in text.h, as well as lots of 2919 the string representation of a character in text.h, as well as lots of
3465 other character-related stuff. There are other functions/macros for 2920 other character-related stuff. There are other functions/macros for
3466 working with Ichars in charset.h, for retrieving the charset of an 2921 working with Ichars in charset.h, for retrieving the charset of an
3467 Ichar, the length of an Ichar when converted to text, etc. 2922 Ichar, the length of an Ichar when converted to text, etc.
3468 */ 2923 */
3469
3470 #ifdef MULE
3471
3472 MODULE_API int non_ascii_valid_ichar_p (Ichar ch);
3473
3474 /* Return whether the given Ichar is valid.
3475 */
3476
3477 DECLARE_INLINE_HEADER (
3478 int
3479 valid_ichar_p (Ichar ch)
3480 )
3481 {
3482 return (! (ch & ~0xFF)) || non_ascii_valid_ichar_p (ch);
3483 }
3484
3485 #else /* not MULE */
3486
3487 /* This works when CH is negative, and correctly returns non-zero only when CH
3488 is in the range [0, 255], inclusive. */
3489 #define valid_ichar_p(ch) (! (ch & ~0xFF))
3490
3491 #endif /* not MULE */
3492
3493 #ifdef ERROR_CHECK_TYPES
3494 2924
3495 DECLARE_INLINE_HEADER ( 2925 DECLARE_INLINE_HEADER (
3496 int 2926 int
3497 CHARP_1 (Lisp_Object obj, const Ascbyte *file, int line) 2927 CHARP_1 (Lisp_Object obj, const Ascbyte *file, int line)
3498 ) 2928 )
3644 free list. This makes a difference in the unlikely case of 3074 free list. This makes a difference in the unlikely case of
3645 sizeof(double) being smaller than sizeof(void *). */ 3075 sizeof(double) being smaller than sizeof(void *). */
3646 3076
3647 struct Lisp_Float 3077 struct Lisp_Float
3648 { 3078 {
3649 struct lrecord_header lheader; 3079 FROB_BLOCK_LISP_OBJECT_HEADER lheader;
3650 union { double d; struct Lisp_Float *unused_next_; } data; 3080 union { double d; struct Lisp_Float *unused_next_; } data;
3651 }; 3081 };
3652 typedef struct Lisp_Float Lisp_Float; 3082 typedef struct Lisp_Float Lisp_Float;
3653 3083
3654 DECLARE_LRECORD (float, Lisp_Float); 3084 DECLARE_LISP_OBJECT (float, Lisp_Float);
3655 #define XFLOAT(x) XRECORD (x, float, Lisp_Float) 3085 #define XFLOAT(x) XRECORD (x, float, Lisp_Float)
3656 #define wrap_float(p) wrap_record (p, float) 3086 #define wrap_float(p) wrap_record (p, float)
3657 #define FLOATP(x) RECORDP (x, float) 3087 #define FLOATP(x) RECORDP (x, float)
3658 #define CHECK_FLOAT(x) CHECK_RECORD (x, float) 3088 #define CHECK_FLOAT(x) CHECK_RECORD (x, float)
3659 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float) 3089 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float)
3732 3162
3733 /*---------------------------- weak boxes ------------------------------*/ 3163 /*---------------------------- weak boxes ------------------------------*/
3734 3164
3735 struct weak_box 3165 struct weak_box
3736 { 3166 {
3737 struct LCRECORD_HEADER header; 3167 NORMAL_LISP_OBJECT_HEADER header;
3738 Lisp_Object value; 3168 Lisp_Object value;
3739 3169
3740 Lisp_Object next_weak_box; /* don't mark through this! */ 3170 Lisp_Object next_weak_box; /* don't mark through this! */
3741 }; 3171 };
3742 3172
3743 void prune_weak_boxes (void); 3173 void prune_weak_boxes (void);
3744 Lisp_Object make_weak_box (Lisp_Object value); 3174 Lisp_Object make_weak_box (Lisp_Object value);
3745 Lisp_Object weak_box_ref (Lisp_Object value); 3175 Lisp_Object weak_box_ref (Lisp_Object value);
3746 3176
3747 DECLARE_LRECORD (weak_box, struct weak_box); 3177 DECLARE_LISP_OBJECT (weak_box, struct weak_box);
3748 #define XWEAK_BOX(x) XRECORD (x, weak_box, struct weak_box) 3178 #define XWEAK_BOX(x) XRECORD (x, weak_box, struct weak_box)
3749 #define XSET_WEAK_BOX(x, v) (XWEAK_BOX (x)->value = (v)) 3179 #define XSET_WEAK_BOX(x, v) (XWEAK_BOX (x)->value = (v))
3750 #define wrap_weak_box(p) wrap_record (p, weak_box) 3180 #define wrap_weak_box(p) wrap_record (p, weak_box)
3751 #define WEAK_BOXP(x) RECORDP (x, weak_box) 3181 #define WEAK_BOXP(x) RECORDP (x, weak_box)
3752 #define CHECK_WEAK_BOX(x) CHECK_RECORD (x, weak_box) 3182 #define CHECK_WEAK_BOX(x) CHECK_RECORD (x, weak_box)
3754 3184
3755 /*--------------------------- ephemerons ----------------------------*/ 3185 /*--------------------------- ephemerons ----------------------------*/
3756 3186
3757 struct ephemeron 3187 struct ephemeron
3758 { 3188 {
3759 struct LCRECORD_HEADER header; 3189 NORMAL_LISP_OBJECT_HEADER header;
3760 3190
3761 Lisp_Object key; 3191 Lisp_Object key;
3762 3192
3763 /* This field holds a pair. The cdr of this cons points to the next 3193 /* This field holds a pair. The cdr of this cons points to the next
3764 ephemeron in Vall_ephemerons. The car points to another pair 3194 ephemeron in Vall_ephemerons. The car points to another pair
3779 int continue_marking_ephemerons(void); 3209 int continue_marking_ephemerons(void);
3780 int finish_marking_ephemerons(void); 3210 int finish_marking_ephemerons(void);
3781 Lisp_Object zap_finalize_list(void); 3211 Lisp_Object zap_finalize_list(void);
3782 Lisp_Object make_ephemeron(Lisp_Object key, Lisp_Object value, Lisp_Object finalizer); 3212 Lisp_Object make_ephemeron(Lisp_Object key, Lisp_Object value, Lisp_Object finalizer);
3783 3213
3784 DECLARE_LRECORD(ephemeron, struct ephemeron); 3214 DECLARE_LISP_OBJECT(ephemeron, struct ephemeron);
3785 #define XEPHEMERON(x) XRECORD (x, ephemeron, struct ephemeron) 3215 #define XEPHEMERON(x) XRECORD (x, ephemeron, struct ephemeron)
3786 #define XEPHEMERON_REF(x) (XEPHEMERON (x)->value) 3216 #define XEPHEMERON_REF(x) (XEPHEMERON (x)->value)
3787 #define XEPHEMERON_NEXT(x) (XCDR (XEPHEMERON(x)->cons_chain)) 3217 #define XEPHEMERON_NEXT(x) (XCDR (XEPHEMERON(x)->cons_chain))
3788 #define XEPHEMERON_FINALIZER(x) (XCDR (XCAR (XEPHEMERON (x)->cons_chain))) 3218 #define XEPHEMERON_FINALIZER(x) (XCDR (XCAR (XEPHEMERON (x)->cons_chain)))
3789 #define XSET_EPHEMERON_NEXT(x, n) (XSETCDR (XEPHEMERON(x)->cons_chain, n)) 3219 #define XSET_EPHEMERON_NEXT(x, n) (XSETCDR (XEPHEMERON(x)->cons_chain, n))
3813 WEAK_LIST_FULL_ASSOC 3243 WEAK_LIST_FULL_ASSOC
3814 }; 3244 };
3815 3245
3816 struct weak_list 3246 struct weak_list
3817 { 3247 {
3818 struct LCRECORD_HEADER header; 3248 NORMAL_LISP_OBJECT_HEADER header;
3819 Lisp_Object list; /* don't mark through this! */ 3249 Lisp_Object list; /* don't mark through this! */
3820 enum weak_list_type type; 3250 enum weak_list_type type;
3821 Lisp_Object next_weak; /* don't mark through this! */ 3251 Lisp_Object next_weak; /* don't mark through this! */
3822 }; 3252 };
3823 3253
3824 DECLARE_LRECORD (weak_list, struct weak_list); 3254 DECLARE_LISP_OBJECT (weak_list, struct weak_list);
3825 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list) 3255 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list)
3826 #define wrap_weak_list(p) wrap_record (p, weak_list) 3256 #define wrap_weak_list(p) wrap_record (p, weak_list)
3827 #define WEAK_LISTP(x) RECORDP (x, weak_list) 3257 #define WEAK_LISTP(x) RECORDP (x, weak_list)
3828 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list) 3258 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list)
3829 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list) 3259 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list)
3835 /* The following two are only called by the garbage collector */ 3265 /* The following two are only called by the garbage collector */
3836 int finish_marking_weak_lists (void); 3266 int finish_marking_weak_lists (void);
3837 void prune_weak_lists (void); 3267 void prune_weak_lists (void);
3838 3268
3839 END_C_DECLS 3269 END_C_DECLS
3840
3841 /************************************************************************/
3842 /* Definitions related to the format of text and of characters */
3843 /************************************************************************/
3844
3845 /* Note:
3846
3847 "internally formatted text" and the term "internal format" in
3848 general are likely to refer to the format of text in buffers and
3849 strings; "externally formatted text" and the term "external format"
3850 refer to any text format used in the O.S. or elsewhere outside of
3851 XEmacs. The format of text and of a character are related and
3852 there must be a one-to-one relationship (hopefully through a
3853 relatively simple algorithmic means of conversion) between a string
3854 of text and an equivalent array of characters, but the conversion
3855 between the two is NOT necessarily trivial.
3856
3857 In a non-Mule XEmacs, allowed characters are numbered 0 through
3858 255, where no fixed meaning is assigned to them, but (when
3859 representing text, rather than bytes in a binary file) in practice
3860 the lower half represents ASCII and the upper half some other 8-bit
3861 character set (chosen by setting the font, case tables, syntax
3862 tables, etc. appropriately for the character set through ad-hoc
3863 means such as the `iso-8859-1' file and the
3864 `standard-display-european' function).
3865
3866 #### Finish this.
3867
3868 */
3869 #include "text.h"
3870
3871 3270
3872 /************************************************************************/ 3271 /************************************************************************/
3873 /* Definitions of primitive Lisp functions and variables */ 3272 /* Definitions of primitive Lisp functions and variables */
3874 /************************************************************************/ 3273 /************************************************************************/
3875 3274
3974 { /* struct lrecord_header */ \ 3373 { /* struct lrecord_header */ \
3975 lrecord_type_subr, /* lrecord_type_index */ \ 3374 lrecord_type_subr, /* lrecord_type_index */ \
3976 1, /* mark bit */ \ 3375 1, /* mark bit */ \
3977 1, /* c_readonly bit */ \ 3376 1, /* c_readonly bit */ \
3978 1, /* lisp_readonly bit */ \ 3377 1, /* lisp_readonly bit */ \
3979 0 /* unused */ \
3980 }, \ 3378 }, \
3981 min_args, \ 3379 min_args, \
3982 max_args, \ 3380 max_args, \
3983 prompt, \ 3381 prompt, \
3984 0, /* doc string */ \ 3382 0, /* doc string */ \
3994 { /* struct lrecord_header */ \ 3392 { /* struct lrecord_header */ \
3995 lrecord_type_subr, /* lrecord_type_index */ \ 3393 lrecord_type_subr, /* lrecord_type_index */ \
3996 1, /* mark bit */ \ 3394 1, /* mark bit */ \
3997 1, /* c_readonly bit */ \ 3395 1, /* c_readonly bit */ \
3998 1, /* lisp_readonly bit */ \ 3396 1, /* lisp_readonly bit */ \
3999 0 /* unused */ \
4000 }, \ 3397 }, \
4001 min_args, \ 3398 min_args, \
4002 max_args, \ 3399 max_args, \
4003 prompt, \ 3400 prompt, \
4004 0, /* doc string */ \ 3401 0, /* doc string */ \
4049 3446
4050 #define CHECK_FUNCTION(fun) do { \ 3447 #define CHECK_FUNCTION(fun) do { \
4051 while (NILP (Ffunctionp (fun))) \ 3448 while (NILP (Ffunctionp (fun))) \
4052 signal_invalid_function_error (fun); \ 3449 signal_invalid_function_error (fun); \
4053 } while (0) 3450 } while (0)
3451
3452 /************************************************************************/
3453 /* Parsing keyword arguments */
3454 /************************************************************************/
3455
3456 /* The C subr must have been declared with MANY as its max args, and this
3457 PARSE_KEYWORDS call must come before any statements.
3458
3459 FUNCTION is the name of the current function, as a symbol.
3460
3461 NARGS is the count of arguments supplied to FUNCTION.
3462
3463 ARGS is a pointer to the argument vector (not a Lisp vector) supplied to
3464 FUNCTION.
3465
3466 KEYWORDS_OFFSET is the offset into ARGS where the keyword arguments start.
3467
3468 KEYWORD_COUNT is the number of keywords FUNCTION is normally prepared to
3469 handle.
3470
3471 KEYWORDS is a parenthesised list of those keywords, without the initial
3472 Q_.
3473
3474 KEYWORD_DEFAULTS allows you to set non-nil defaults. Put (keywordname =
3475 initial_value) in this parameter, a collection of C statements surrounded
3476 by parentheses and separated by the comma operator. If you don't need
3477 this, supply NULL as KEYWORD_DEFAULTS.
3478
3479 ALLOW_OTHER_KEYS corresponds to the &allow-other-keys argument list
3480 entry in defun*; it is 1 if other keys are normally allowed, 0
3481 otherwise. This may be overridden in the caller by specifying
3482 :allow-other-keys t in the argument list.
3483
3484 For keywords which appear multiple times in the called argument list, the
3485 leftmost one overrides, as specified in section 7.1.1 of the CLHS.
3486
3487 If you want to check whether a given keyword argument was set (as in the
3488 SVAR argument to defun*), supply Qunbound as its default in
3489 KEYWORD_DEFAULTS, and examine it once PARSE_KEYWORDS is done. Lisp code
3490 cannot supply Qunbound as an argument, so if it is still Qunbound, it was
3491 not set.
3492
3493 There is no elegant way with this macro to have one name for the keyword
3494 and an unrelated name for the local variable, as is possible with the
3495 ((:keyword unrelated-var)) syntax in defun* and in Common Lisp. That
3496 shouldn't matter in practice. */
3497
3498 #define PARSE_KEYWORDS(function, nargs, args, keywords_offset, \
3499 keyword_count, keywords, keyword_defaults, \
3500 allow_other_keys) \
3501 DECLARE_N_KEYWORDS_##keyword_count keywords; \
3502 \
3503 do \
3504 { \
3505 Lisp_Object pk_key, pk_value; \
3506 Elemcount pk_i = nargs - 1; \
3507 Boolint pk_allow_other_keys = allow_other_keys; \
3508 \
3509 if ((nargs - keywords_offset) & 1) \
3510 { \
3511 if (!allow_other_keys \
3512 && !(pk_allow_other_keys \
3513 = non_nil_allow_other_keys_p (keywords_offset, \
3514 nargs, args))) \
3515 { \
3516 signal_wrong_number_of_arguments_error (function, nargs); \
3517 } \
3518 else \
3519 { \
3520 /* Ignore the trailing arg; so below always sees an even \
3521 number of arguments. */ \
3522 pk_i -= 1; \
3523 } \
3524 } \
3525 \
3526 (void)(keyword_defaults); \
3527 \
3528 /* Start from the end, because the leftmost element overrides. */ \
3529 while (pk_i > keywords_offset) \
3530 { \
3531 pk_value = args[pk_i--]; \
3532 pk_key = args[pk_i--]; \
3533 \
3534 if (0) {} \
3535 CHECK_N_KEYWORDS_##keyword_count keywords \
3536 else if (allow_other_keys || pk_allow_other_keys) \
3537 { \
3538 continue; \
3539 } \
3540 else if (!(pk_allow_other_keys \
3541 = non_nil_allow_other_keys_p (keywords_offset, \
3542 nargs, args))) \
3543 { \
3544 invalid_keyword_argument (function, pk_key); \
3545 } \
3546 } \
3547 } while (0)
3548
3549 #define DECLARE_N_KEYWORDS_1(a) \
3550 Lisp_Object a = Qnil
3551 #define DECLARE_N_KEYWORDS_2(a,b) \
3552 DECLARE_N_KEYWORDS_1(a), b = Qnil
3553 #define DECLARE_N_KEYWORDS_3(a,b,c) \
3554 DECLARE_N_KEYWORDS_2(a,b), c = Qnil
3555 #define DECLARE_N_KEYWORDS_4(a,b,c,d) \
3556 DECLARE_N_KEYWORDS_3(a,b,c), d = Qnil
3557 #define DECLARE_N_KEYWORDS_5(a,b,c,d,e) \
3558 DECLARE_N_KEYWORDS_4(a,b,c,d), e = Qnil
3559 #define DECLARE_N_KEYWORDS_6(a,b,c,d,e,f) \
3560 DECLARE_N_KEYWORDS_5(a,b,c,d,e), f = Qnil
3561 #define DECLARE_N_KEYWORDS_7(a,b,c,d,e,f,g) \
3562 DECLARE_N_KEYWORDS_6(a,b,c,d,e,f), g = Qnil
3563
3564 #define CHECK_N_KEYWORDS_1(a) \
3565 else if (EQ (pk_key, Q_##a)) { a = pk_value; }
3566 #define CHECK_N_KEYWORDS_2(a,b) CHECK_N_KEYWORDS_1(a) \
3567 else if (EQ (pk_key, Q_##b)) { b = pk_value; }
3568 #define CHECK_N_KEYWORDS_3(a,b,c) CHECK_N_KEYWORDS_2(a,b) \
3569 else if (EQ (pk_key, Q_##c)) { c = pk_value; }
3570 #define CHECK_N_KEYWORDS_4(a,b,c,d) CHECK_N_KEYWORDS_3(a,b,c) \
3571 else if (EQ (pk_key, Q_##d)) { d = pk_value; }
3572 #define CHECK_N_KEYWORDS_5(a,b,c,d,e) CHECK_N_KEYWORDS_4(a,b,c,d) \
3573 else if (EQ (pk_key, Q_##e)) { e = pk_value; }
3574 #define CHECK_N_KEYWORDS_6(a,b,c,d,e,f) CHECK_N_KEYWORDS_5(a,b,c,d,e) \
3575 else if (EQ (pk_key, Q_##f)) { f = pk_value; }
3576 #define CHECK_N_KEYWORDS_7(a,b,c,d,e,f,g) CHECK_N_KEYWORDS_6(a,b,c,d,e,f) \
3577 else if (EQ (pk_key, Q_##g)) { g = pk_value; }
3578
3579 Boolint non_nil_allow_other_keys_p (Elemcount offset, int nargs,
3580 Lisp_Object *args);
4054 3581
4055 3582
4056 /************************************************************************/ 3583 /************************************************************************/
4057 /* Checking for QUIT */ 3584 /* Checking for QUIT */
4058 /************************************************************************/ 3585 /************************************************************************/
4643 and we want to minimize the number of "dependencies" of one file on 4170 and we want to minimize the number of "dependencies" of one file on
4644 the specifics of such objects. Putting prototypes here minimizes the 4171 the specifics of such objects. Putting prototypes here minimizes the
4645 number of header files that need to be included -- good for a number 4172 number of header files that need to be included -- good for a number
4646 of reasons. --ben */ 4173 of reasons. --ben */
4647 4174
4648 /*--------------- prototypes for various public c functions ------------*/
4649
4650 /* Prototypes for all init/syms_of/vars_of initialization functions. */ 4175 /* Prototypes for all init/syms_of/vars_of initialization functions. */
4651 #include "symsinit.h" 4176 #include "symsinit.h"
4652 4177
4653 BEGIN_C_DECLS 4178 BEGIN_C_DECLS
4654 4179
4665 EXFUN (Fstring, MANY); 4190 EXFUN (Fstring, MANY);
4666 MODULE_API EXFUN (Fmake_symbol, 1); 4191 MODULE_API EXFUN (Fmake_symbol, 1);
4667 MODULE_API EXFUN (Fmake_vector, 2); 4192 MODULE_API EXFUN (Fmake_vector, 2);
4668 MODULE_API EXFUN (Fvector, MANY); 4193 MODULE_API EXFUN (Fvector, MANY);
4669 4194
4195 void deadbeef_memory (void *ptr, Bytecount size);
4670 #ifndef NEW_GC 4196 #ifndef NEW_GC
4671 void release_breathing_space (void); 4197 void release_breathing_space (void);
4672 #endif /* not NEW_GC */ 4198 #endif /* not NEW_GC */
4673 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object); 4199 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object);
4674 MODULE_API Lisp_Object make_vector (Elemcount, Lisp_Object); 4200 MODULE_API Lisp_Object make_vector (Elemcount, Lisp_Object);
4686 MODULE_API Lisp_Object list1 (Lisp_Object); 4212 MODULE_API Lisp_Object list1 (Lisp_Object);
4687 MODULE_API Lisp_Object list2 (Lisp_Object, Lisp_Object); 4213 MODULE_API Lisp_Object list2 (Lisp_Object, Lisp_Object);
4688 MODULE_API Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object); 4214 MODULE_API Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
4689 MODULE_API Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, 4215 MODULE_API Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object,
4690 Lisp_Object); 4216 Lisp_Object);
4691 MODULE_API Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, 4217 MODULE_API Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object,
4692 Lisp_Object);
4693 MODULE_API Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
4694 Lisp_Object, Lisp_Object); 4218 Lisp_Object, Lisp_Object);
4219 MODULE_API Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object,
4220 Lisp_Object, Lisp_Object, Lisp_Object);
4221 MODULE_API Lisp_Object listn (int numargs, ...);
4222 MODULE_API Lisp_Object listu (Lisp_Object, ...);
4695 DECLARE_DOESNT_RETURN (memory_full (void)); 4223 DECLARE_DOESNT_RETURN (memory_full (void));
4696 void disksave_object_finalization (void); 4224 void disksave_object_finalization (void);
4225 void finish_object_memory_usage_stats (void);
4697 extern int purify_flag; 4226 extern int purify_flag;
4698 #ifndef NEW_GC 4227 #ifndef NEW_GC
4699 extern EMACS_INT gc_generation_number[1]; 4228 extern EMACS_INT gc_generation_number[1];
4700 #endif /* not NEW_GC */ 4229 #endif /* not NEW_GC */
4701 int c_readonly (Lisp_Object); 4230 int c_readonly (Lisp_Object);
4702 int lisp_readonly (Lisp_Object); 4231 int lisp_readonly (Lisp_Object);
4703 MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src);
4704 MODULE_API Lisp_Object build_istring (const Ibyte *); 4232 MODULE_API Lisp_Object build_istring (const Ibyte *);
4705 MODULE_API Lisp_Object build_cistring (const CIbyte *); 4233 MODULE_API Lisp_Object build_cistring (const CIbyte *);
4706 MODULE_API Lisp_Object build_ascstring (const Ascbyte *); 4234 MODULE_API Lisp_Object build_ascstring (const Ascbyte *);
4707 MODULE_API Lisp_Object build_extstring (const Extbyte *, Lisp_Object); 4235 MODULE_API Lisp_Object build_extstring (const Extbyte *, Lisp_Object);
4708 MODULE_API Lisp_Object make_string (const Ibyte *, Bytecount); 4236 MODULE_API Lisp_Object make_string (const Ibyte *, Bytecount);
4715 void free_list (Lisp_Object); 4243 void free_list (Lisp_Object);
4716 void free_alist (Lisp_Object); 4244 void free_alist (Lisp_Object);
4717 void free_marker (Lisp_Object); 4245 void free_marker (Lisp_Object);
4718 int object_dead_p (Lisp_Object); 4246 int object_dead_p (Lisp_Object);
4719 void mark_object (Lisp_Object obj); 4247 void mark_object (Lisp_Object obj);
4720 #ifndef NEW_GC
4721 #ifdef USE_KKCC
4722 #ifdef DEBUG_XEMACS
4723 void kkcc_gc_stack_push_lisp_object_1 (Lisp_Object obj, int level, int pos);
4724 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \
4725 kkcc_gc_stack_push_lisp_object_1 (obj, level, pos)
4726 void kkcc_backtrace (void);
4727 #else
4728 void kkcc_gc_stack_push_lisp_object_1 (Lisp_Object obj);
4729 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \
4730 kkcc_gc_stack_push_lisp_object_1 (obj)
4731 #define kkcc_backtrace()
4732 #endif
4733 #endif /* USE_KKCC */
4734 #endif /* not NEW_GC */
4735 int marked_p (Lisp_Object obj); 4248 int marked_p (Lisp_Object obj);
4736 extern int funcall_allocation_flag; 4249 extern int funcall_allocation_flag;
4737 extern int need_to_garbage_collect; 4250 extern int need_to_garbage_collect;
4738 extern MODULE_API int need_to_check_c_alloca; 4251 extern MODULE_API int need_to_check_c_alloca;
4739 extern int need_to_signal_post_gc; 4252 extern int need_to_signal_post_gc;
4740 extern Lisp_Object Qpost_gc_hook, Qgarbage_collecting; 4253 extern Lisp_Object Qpost_gc_hook, Qgarbage_collecting;
4741 void recompute_funcall_allocation_flag (void); 4254 void recompute_funcall_allocation_flag (void);
4742 4255
4743 #ifdef MEMORY_USAGE_STATS 4256 Bytecount malloced_storage_size (void *, Bytecount, struct usage_stats *);
4744 Bytecount malloced_storage_size (void *, Bytecount, struct overhead_stats *);
4745 Bytecount fixed_type_block_overhead (Bytecount);
4746 #endif
4747 4257
4748 #ifdef EVENT_DATA_AS_OBJECTS 4258 #ifdef EVENT_DATA_AS_OBJECTS
4749 Lisp_Object make_key_data (void); 4259 Lisp_Object make_key_data (void);
4750 Lisp_Object make_button_data (void); 4260 Lisp_Object make_button_data (void);
4751 Lisp_Object make_motion_data (void); 4261 Lisp_Object make_motion_data (void);
4804 4314
4805 extern Lisp_Object QSscratch, Qafter_change_function, Qafter_change_functions; 4315 extern Lisp_Object QSscratch, Qafter_change_function, Qafter_change_functions;
4806 extern Lisp_Object Qbefore_change_function, Qbefore_change_functions; 4316 extern Lisp_Object Qbefore_change_function, Qbefore_change_functions;
4807 extern Lisp_Object Qbuffer_or_string_p, Qdefault_directory, Qfirst_change_hook; 4317 extern Lisp_Object Qbuffer_or_string_p, Qdefault_directory, Qfirst_change_hook;
4808 extern Lisp_Object Qpermanent_local, Vafter_change_function; 4318 extern Lisp_Object Qpermanent_local, Vafter_change_function;
4319 extern Lisp_Object Qbuffer_live_p;
4809 extern Lisp_Object Vafter_change_functions, Vbefore_change_function; 4320 extern Lisp_Object Vafter_change_functions, Vbefore_change_function;
4810 extern Lisp_Object Vbefore_change_functions, Vbuffer_alist, Vbuffer_defaults; 4321 extern Lisp_Object Vbefore_change_functions, Vbuffer_alist, Vbuffer_defaults;
4811 extern Lisp_Object Vinhibit_read_only, Vtransient_mark_mode; 4322 extern Lisp_Object Vinhibit_read_only, Vtransient_mark_mode;
4812 4323
4813 /* Defined in bytecode.c */ 4324 /* Defined in bytecode.c */
4819 extern Lisp_Object Qbyte_code, Qinvalid_byte_code; 4330 extern Lisp_Object Qbyte_code, Qinvalid_byte_code;
4820 4331
4821 /* Defined in callint.c */ 4332 /* Defined in callint.c */
4822 EXFUN (Fcall_interactively, 3); 4333 EXFUN (Fcall_interactively, 3);
4823 EXFUN (Fprefix_numeric_value, 1); 4334 EXFUN (Fprefix_numeric_value, 1);
4335 extern Lisp_Object Qcall_interactively;
4336 extern Lisp_Object Qmouse_leave_buffer_hook;
4337 extern Lisp_Object Qread_from_minibuffer;
4338 extern Lisp_Object Vcommand_history;
4339 extern Lisp_Object Vcurrent_prefix_arg;
4340 extern Lisp_Object Vmark_even_if_inactive;
4824 4341
4825 /* Defined in casefiddle.c */ 4342 /* Defined in casefiddle.c */
4826 EXFUN (Fdowncase, 2); 4343 EXFUN (Fdowncase, 2);
4827 EXFUN (Fcanoncase, 2); 4344 EXFUN (Fcanoncase, 2);
4828 EXFUN (Fupcase, 2); 4345 EXFUN (Fupcase, 2);
4833 /* Defined in casetab.c */ 4350 /* Defined in casetab.c */
4834 EXFUN (Fset_standard_case_table, 1); 4351 EXFUN (Fset_standard_case_table, 1);
4835 4352
4836 /* Defined in chartab.c */ 4353 /* Defined in chartab.c */
4837 EXFUN (Freset_char_table, 1); 4354 EXFUN (Freset_char_table, 1);
4355 extern Lisp_Object Qcategory_designator_p;
4356 extern Lisp_Object Qcategory_table_value_p;
4357
4358 /* Defined in cmdloop.c */
4359 extern Lisp_Object Qdisabled_command_hook;
4360 extern Lisp_Object Qreally_early_error_handler;
4361 extern Lisp_Object Qtop_level;
4362 extern Lisp_Object Vdisabled_command_hook;
4838 4363
4839 /* Defined in cmds.c */ 4364 /* Defined in cmds.c */
4840 EXFUN (Fbeginning_of_line, 2); 4365 EXFUN (Fbeginning_of_line, 2);
4841 EXFUN (Fend_of_line, 2); 4366 EXFUN (Fend_of_line, 2);
4842 EXFUN (Fforward_char, 2); 4367 EXFUN (Fforward_char, 2);
4843 EXFUN (Fforward_line, 2); 4368 EXFUN (Fforward_line, 2);
4369 extern Lisp_Object Qself_insert_command;
4370
4371 /* Defined in console.c */
4372 extern Lisp_Object Qconsole_live_p;
4373 extern Lisp_Object Vconsole_list;
4374
4375 /* Defined in console-stream.c */
4376 extern Lisp_Object Vstdio_str;
4844 4377
4845 /* Defined in data.c */ 4378 /* Defined in data.c */
4846 EXFUN (Fadd1, 1); 4379 EXFUN (Fadd1, 1);
4847 EXFUN (Faref, 2); 4380 EXFUN (Faref, 2);
4848 EXFUN (Faset, 3); 4381 EXFUN (Faset, 3);
4906 4439
4907 extern Lisp_Object Qarith_error, Qbeginning_of_buffer, Qbuffer_read_only, 4440 extern Lisp_Object Qarith_error, Qbeginning_of_buffer, Qbuffer_read_only,
4908 Qcircular_list, Qcircular_property_list, Qconversion_error, 4441 Qcircular_list, Qcircular_property_list, Qconversion_error,
4909 Qcyclic_variable_indirection, Qdomain_error, Qediting_error, 4442 Qcyclic_variable_indirection, Qdomain_error, Qediting_error,
4910 Qend_of_buffer, Qend_of_file, Qerror, Qfile_error, Qinternal_error, 4443 Qend_of_buffer, Qend_of_file, Qerror, Qfile_error, Qinternal_error,
4911 Qinvalid_change, Qinvalid_constant, Qinvalid_function, Qinvalid_operation, 4444 Qinvalid_change, Qinvalid_constant, Qinvalid_function,
4445 Qinvalid_keyword_argument, Qinvalid_operation,
4912 Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlist_formation_error, 4446 Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlist_formation_error,
4913 Qmalformed_list, Qmalformed_property_list, Qno_catch, Qout_of_memory, 4447 Qmalformed_list, Qmalformed_property_list, Qno_catch, Qout_of_memory,
4914 Qoverflow_error, Qprinting_unreadable_object, Qquit, Qrange_error, 4448 Qoverflow_error, Qprinting_unreadable_object, Qquit, Qrange_error,
4915 Qsetting_constant, Qsingularity_error, Qstack_overflow, 4449 Qsetting_constant, Qsingularity_error, Qstack_overflow,
4916 Qstructure_formation_error, Qtext_conversion_error, Qunderflow_error, 4450 Qstructure_formation_error, Qtext_conversion_error, Qunderflow_error,
4917 Qvoid_function, Qvoid_variable, Qwrong_number_of_arguments, 4451 Qvoid_function, Qvoid_variable, Qwrong_number_of_arguments,
4918 Qwrong_type_argument; 4452 Qwrong_type_argument;
4453 extern Lisp_Object Qcdr;
4454 extern Lisp_Object Qerror_lacks_explanatory_string;
4455 extern Lisp_Object Qfile_error;
4456 extern Lisp_Object Qsequencep;
4919 extern MODULE_API Lisp_Object Qinvalid_argument, Qsyntax_error; 4457 extern MODULE_API Lisp_Object Qinvalid_argument, Qsyntax_error;
4458
4459 /* Defined in device.c */
4460 extern Lisp_Object Qdevice_live_p;
4461
4462 /* Defined in device-x.c */
4463 extern Lisp_Object Vx_initial_argv_list;
4920 4464
4921 /* Defined in dired.c */ 4465 /* Defined in dired.c */
4922 Lisp_Object make_directory_hash_table (const Ibyte *); 4466 Lisp_Object make_directory_hash_table (const Ibyte *);
4923 Lisp_Object wasteful_word_to_lisp (unsigned int); 4467 Lisp_Object wasteful_word_to_lisp (unsigned int);
4924 4468
4928 Lisp_Object unparesseuxify_doc_string (int fd, EMACS_INT position, 4472 Lisp_Object unparesseuxify_doc_string (int fd, EMACS_INT position,
4929 Ibyte *name_nonreloc, 4473 Ibyte *name_nonreloc,
4930 Lisp_Object name_reloc, 4474 Lisp_Object name_reloc,
4931 int standard_doc_file); 4475 int standard_doc_file);
4932 Lisp_Object read_doc_string (Lisp_Object); 4476 Lisp_Object read_doc_string (Lisp_Object);
4477 extern Lisp_Object Vinternal_doc_file_name;
4933 4478
4934 /* Defined in doprnt.c */ 4479 /* Defined in doprnt.c */
4935 Bytecount emacs_doprnt_va (Lisp_Object stream, const Ibyte *format_nonreloc, 4480 Bytecount emacs_doprnt_va (Lisp_Object stream, const Ibyte *format_nonreloc,
4936 Bytecount format_length, Lisp_Object format_reloc, 4481 Bytecount format_length, Lisp_Object format_reloc,
4937 va_list vargs); 4482 va_list vargs);
5000 Lisp_Object save_restriction_save (struct buffer *buf); 4545 Lisp_Object save_restriction_save (struct buffer *buf);
5001 Lisp_Object save_excursion_restore (Lisp_Object); 4546 Lisp_Object save_excursion_restore (Lisp_Object);
5002 Lisp_Object save_restriction_restore (Lisp_Object); 4547 Lisp_Object save_restriction_restore (Lisp_Object);
5003 void widen_buffer (struct buffer *b, int no_clip); 4548 void widen_buffer (struct buffer *b, int no_clip);
5004 int beginning_of_line_p (struct buffer *b, Charbpos pt); 4549 int beginning_of_line_p (struct buffer *b, Charbpos pt);
5005
5006 /* Defined in emacsfns.c */
5007 Lisp_Object save_current_buffer_restore (Lisp_Object); 4550 Lisp_Object save_current_buffer_restore (Lisp_Object);
4551
4552 extern Lisp_Object Qformat;
4553 extern Lisp_Object Qmark;
4554 extern Lisp_Object Qpoint;
4555 extern Lisp_Object Qregion_beginning;
4556 extern Lisp_Object Qregion_end;
4557 extern Lisp_Object Quser_files_and_directories;
4558 extern Lisp_Object Vsystem_name;
5008 4559
5009 /* Defined in emacs.c */ 4560 /* Defined in emacs.c */
5010 EXFUN_NORETURN (Fkill_emacs, 1); 4561 EXFUN_NORETURN (Fkill_emacs, 1);
5011 EXFUN (Frunning_temacs_p, 0); 4562 EXFUN (Frunning_temacs_p, 0);
5012 EXFUN (Fforce_debugging_signal, 1); 4563 EXFUN (Fforce_debugging_signal, 1);
5027 void debug_break (void); 4578 void debug_break (void);
5028 int debug_can_access_memory (const void *ptr, Bytecount len); 4579 int debug_can_access_memory (const void *ptr, Bytecount len);
5029 DECLARE_DOESNT_RETURN (really_abort (void)); 4580 DECLARE_DOESNT_RETURN (really_abort (void));
5030 void zero_out_command_line_status_vars (void); 4581 void zero_out_command_line_status_vars (void);
5031 4582
4583 extern Lisp_Object Qsave_buffers_kill_emacs;
4584 extern Lisp_Object Vcommand_line_args;
4585 extern Lisp_Object Vconfigure_info_directory;
4586 extern Lisp_Object Vconfigure_site_directory;
4587 extern Lisp_Object Vconfigure_site_module_directory;
4588 extern Lisp_Object Vdata_directory;
4589 extern Lisp_Object Vdoc_directory;
4590 extern Lisp_Object Vemacs_major_version;
4591 extern Lisp_Object Vemacs_minor_version;
4592 extern Lisp_Object Vexec_directory;
4593 extern Lisp_Object Vexec_path;
4594 extern Lisp_Object Vinvocation_directory;
4595 extern Lisp_Object Vinvocation_name;
4596 extern Lisp_Object Vmodule_directory;
4597 extern Lisp_Object Vsite_directory;
4598 extern Lisp_Object Vsite_module_directory;
4599
5032 /* Defined in emodules.c */ 4600 /* Defined in emodules.c */
5033 #ifdef HAVE_SHLIB 4601 #ifdef HAVE_SHLIB
5034 EXFUN (Flist_modules, 0); 4602 EXFUN (Flist_modules, 0);
5035 EXFUN (Fload_module, 3); 4603 EXFUN (Fload_module, 3);
5036 extern int unloading_module; 4604 extern int unloading_module;
5037 #endif 4605 #endif
4606 extern Lisp_Object Qdll_error;
4607 extern Lisp_Object Qmodule;
5038 4608
5039 /* Defined in eval.c */ 4609 /* Defined in eval.c */
5040 MODULE_API EXFUN (Fapply, MANY); 4610 MODULE_API EXFUN (Fapply, MANY);
5041 EXFUN (Fbacktrace, 2); 4611 EXFUN (Fbacktrace, 2);
5042 EXFUN (Fcommand_execute, 3); 4612 EXFUN (Fcommand_execute, 3);
5134 MODULE_API DECLARE_DOESNT_RETURN (invalid_argument_2 (const Ascbyte *reason, 4704 MODULE_API DECLARE_DOESNT_RETURN (invalid_argument_2 (const Ascbyte *reason,
5135 Lisp_Object frob1, 4705 Lisp_Object frob1,
5136 Lisp_Object frob2)); 4706 Lisp_Object frob2));
5137 void maybe_invalid_argument (const Ascbyte *, Lisp_Object, Lisp_Object, 4707 void maybe_invalid_argument (const Ascbyte *, Lisp_Object, Lisp_Object,
5138 Error_Behavior); 4708 Error_Behavior);
4709 MODULE_API DECLARE_DOESNT_RETURN (invalid_keyword_argument (Lisp_Object fun,
4710 Lisp_Object kw));
5139 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation (const Ascbyte *reason, 4711 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation (const Ascbyte *reason,
5140 Lisp_Object frob)); 4712 Lisp_Object frob));
5141 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation_2 (const Ascbyte *reason, 4713 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation_2 (const Ascbyte *reason,
5142 Lisp_Object frob1, 4714 Lisp_Object frob1,
5143 Lisp_Object frob2)); 4715 Lisp_Object frob2));
5343 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object); 4915 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);
5344 MODULE_API void warn_when_safe (Lisp_Object, Lisp_Object, const Ascbyte *, 4916 MODULE_API void warn_when_safe (Lisp_Object, Lisp_Object, const Ascbyte *,
5345 ...) PRINTF_ARGS (3, 4); 4917 ...) PRINTF_ARGS (3, 4);
5346 extern int backtrace_with_internal_sections; 4918 extern int backtrace_with_internal_sections;
5347 4919
4920 extern Lisp_Object Qand_optional;
4921 extern Lisp_Object Qand_rest;
4922 extern Lisp_Object Qautoload;
4923 extern Lisp_Object Qcommandp;
4924 extern Lisp_Object Qdefun;
4925 extern Lisp_Object Qexit;
4926 extern Lisp_Object Qinhibit_quit;
4927 extern Lisp_Object Qinteractive;
4928 extern Lisp_Object Qmacro;
4929 extern Lisp_Object Qprogn;
4930 extern Lisp_Object Qrun_hooks;
4931 extern Lisp_Object Qvalues;
5348 extern Lisp_Object Vdebug_on_error; 4932 extern Lisp_Object Vdebug_on_error;
5349 extern Lisp_Object Vstack_trace_on_error; 4933 extern Lisp_Object Vstack_trace_on_error;
4934 extern Lisp_Object Vautoload_queue;
4935
4936 extern MODULE_API Lisp_Object Vinhibit_quit, Vquit_flag;
5350 4937
5351 /* Defined in event-stream.c */ 4938 /* Defined in event-stream.c */
5352 EXFUN (Faccept_process_output, 3); 4939 EXFUN (Faccept_process_output, 3);
5353 EXFUN (Fadd_timeout, 4); 4940 EXFUN (Fadd_timeout, 4);
5354 EXFUN (Fdisable_timeout, 1); 4941 EXFUN (Fdisable_timeout, 1);
5366 Lisp_Object enqueue_misc_user_event (Lisp_Object, Lisp_Object, Lisp_Object); 4953 Lisp_Object enqueue_misc_user_event (Lisp_Object, Lisp_Object, Lisp_Object);
5367 Lisp_Object enqueue_misc_user_event_pos (Lisp_Object, Lisp_Object, 4954 Lisp_Object enqueue_misc_user_event_pos (Lisp_Object, Lisp_Object,
5368 Lisp_Object, int, int, int, int); 4955 Lisp_Object, int, int, int, int);
5369 extern int modifier_keys_are_sticky; 4956 extern int modifier_keys_are_sticky;
5370 4957
4958 extern Lisp_Object Qdisabled;
4959 extern Lisp_Object Qsans_modifiers;
4960 extern Lisp_Object Qself_insert_defer_undo;
4961 extern Lisp_Object Vcontrolling_terminal;
4962 extern Lisp_Object Vcurrent_mouse_event;
4963 extern Lisp_Object Vlast_command;
4964 extern Lisp_Object Vlast_command_char;
4965 extern Lisp_Object Vlast_command_event;
4966 extern Lisp_Object Vlast_input_event;
4967 extern Lisp_Object Vrecent_keys_ring;
4968 extern Lisp_Object Vthis_command_keys;
4969 extern Lisp_Object Vunread_command_event;
4970
5371 /* Defined in event-Xt.c */ 4971 /* Defined in event-Xt.c */
5372 void signal_special_Xt_user_event (Lisp_Object, Lisp_Object, Lisp_Object); 4972 void signal_special_Xt_user_event (Lisp_Object, Lisp_Object, Lisp_Object);
5373 4973
5374 4974
5375 /* Defined in events.c */ 4975 /* Defined in events.c */
5380 Lisp_Object allocate_event (void); 4980 Lisp_Object allocate_event (void);
5381 4981
5382 EXFUN (Fevent_x_pixel, 1); 4982 EXFUN (Fevent_x_pixel, 1);
5383 EXFUN (Fevent_y_pixel, 1); 4983 EXFUN (Fevent_y_pixel, 1);
5384 4984
4985 extern Lisp_Object Qevent_live_p;
4986
4987
4988 /* Defined in extents.c */
4989 extern Lisp_Object Qend_open;
4990 extern Lisp_Object Qextent_live_p;
4991 extern Lisp_Object Qstart_open;
4992
4993 /* Defined in faces.c */
4994 extern Lisp_Object Qbackground;
4995 extern Lisp_Object Qbackground_pixmap;
4996 extern Lisp_Object Qblinking;
4997 extern Lisp_Object Qdim;
4998 extern Lisp_Object Qdisplay_table;
4999 extern Lisp_Object Qforeground;
5000 extern Lisp_Object Qunderline;
5385 5001
5386 /* Defined in file-coding.c */ 5002 /* Defined in file-coding.c */
5387 EXFUN (Fcoding_category_list, 0); 5003 EXFUN (Fcoding_category_list, 0);
5388 EXFUN (Fcoding_category_system, 1); 5004 EXFUN (Fcoding_category_system, 1);
5389 EXFUN (Fcoding_priority_list, 0); 5005 EXFUN (Fcoding_priority_list, 0);
5466 Lisp_Object lisp_strerror (int); 5082 Lisp_Object lisp_strerror (int);
5467 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object); 5083 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
5468 int internal_delete_file (Lisp_Object); 5084 int internal_delete_file (Lisp_Object);
5469 Ibyte *find_end_of_directory_component (const Ibyte *path, 5085 Ibyte *find_end_of_directory_component (const Ibyte *path,
5470 Bytecount len); 5086 Bytecount len);
5087
5088 extern Lisp_Object Qfile_name_sans_extension;
5089 extern Lisp_Object Vdirectory_sep_char;
5471 5090
5472 /* Defined in filelock.c */ 5091 /* Defined in filelock.c */
5473 EXFUN (Funlock_buffer, 0); 5092 EXFUN (Funlock_buffer, 0);
5474 5093
5475 void lock_file (Lisp_Object); 5094 void lock_file (Lisp_Object);
5527 MODULE_API EXFUN (Freverse, 1); 5146 MODULE_API EXFUN (Freverse, 1);
5528 EXFUN (Fsafe_length, 1); 5147 EXFUN (Fsafe_length, 1);
5529 EXFUN (Fsort, 2); 5148 EXFUN (Fsort, 2);
5530 EXFUN (Fstring_equal, 2); 5149 EXFUN (Fstring_equal, 2);
5531 EXFUN (Fstring_lessp, 2); 5150 EXFUN (Fstring_lessp, 2);
5532 EXFUN (Fsubstring, 3); 5151 EXFUN (Fsubseq, 3);
5533 EXFUN (Fvalid_plist_p, 1); 5152 EXFUN (Fvalid_plist_p, 1);
5534 5153
5535 Lisp_Object list_sort (Lisp_Object, Lisp_Object, 5154 Lisp_Object list_sort (Lisp_Object, Lisp_Object,
5536 int (*) (Lisp_Object, Lisp_Object, Lisp_Object)); 5155 int (*) (Lisp_Object, Lisp_Object, Lisp_Object));
5537 Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object); 5156 Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object);
5578 Lisp_Object add_suffix_to_symbol (Lisp_Object symbol, 5197 Lisp_Object add_suffix_to_symbol (Lisp_Object symbol,
5579 const Ascbyte *ascii_string); 5198 const Ascbyte *ascii_string);
5580 Lisp_Object add_prefix_to_symbol (const Ascbyte *ascii_string, 5199 Lisp_Object add_prefix_to_symbol (const Ascbyte *ascii_string,
5581 Lisp_Object symbol); 5200 Lisp_Object symbol);
5582 5201
5202 extern Lisp_Object Qidentity;
5203 extern Lisp_Object Qstring_lessp;
5204 extern Lisp_Object Qyes_or_no_p;
5205 extern Lisp_Object Vfeatures;
5206
5207 /* Defined in frame.c */
5208 extern Lisp_Object Qframe_live_p;
5209
5583 /* Defined in free-hook.c */ 5210 /* Defined in free-hook.c */
5584 EXFUN (Freally_free, 1); 5211 EXFUN (Freally_free, 1);
5585 5212
5213 /* Defined in general.c */
5214 #define SYMBOL(fou) extern Lisp_Object fou
5215 #define SYMBOL_MODULE_API(fou) extern MODULE_API Lisp_Object fou
5216 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
5217 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
5218 extern Lisp_Object tout_le_monde
5219
5220 #include "general-slots.h"
5221
5222 #undef SYMBOL
5223 #undef SYMBOL_MODULE_API
5224 #undef SYMBOL_KEYWORD
5225 #undef SYMBOL_GENERAL
5226
5586 /* Defined in glyphs.c */ 5227 /* Defined in glyphs.c */
5587 EXFUN (Fmake_glyph_internal, 1); 5228 EXFUN (Fmake_glyph_internal, 1);
5588 5229
5589 Error_Behavior decode_error_behavior_flag (Lisp_Object); 5230 Error_Behavior decode_error_behavior_flag (Lisp_Object);
5590 Lisp_Object encode_error_behavior_flag (Error_Behavior); 5231 Lisp_Object encode_error_behavior_flag (Error_Behavior);
5232
5233 extern Lisp_Object Qbuffer_glyph_p;
5234 extern Lisp_Object Qcolor_pixmap_image_instance_p;
5235 extern Lisp_Object Qicon_glyph_p;
5236 extern Lisp_Object Qmono_pixmap_image_instance_p;
5237 extern Lisp_Object Qnothing_image_instance_p;
5238 extern Lisp_Object Qpointer_glyph_p;
5239 extern Lisp_Object Qpointer_image_instance_p;
5240 extern Lisp_Object Qsubwindow;
5241 extern Lisp_Object Qsubwindow_image_instance_p;
5242 extern Lisp_Object Qtext_image_instance_p;
5591 5243
5592 /* Defined in glyphs-shared.c */ 5244 /* Defined in glyphs-shared.c */
5593 void shared_resource_validate (Lisp_Object instantiator); 5245 void shared_resource_validate (Lisp_Object instantiator);
5594 Lisp_Object shared_resource_normalize (Lisp_Object inst, 5246 Lisp_Object shared_resource_normalize (Lisp_Object inst,
5595 Lisp_Object console_type, 5247 Lisp_Object console_type,
5596 Lisp_Object dest_mask, 5248 Lisp_Object dest_mask,
5597 Lisp_Object tag); 5249 Lisp_Object tag);
5598 extern Lisp_Object Q_resource_type, Q_resource_id; 5250 extern Lisp_Object Q_resource_type, Q_resource_id;
5599 5251
5252 /* Defined in glyphs-widget.c */
5253 extern Lisp_Object Qlayout;
5254 extern Lisp_Object Qnative_layout;
5255
5600 /* Defined in gui.c */ 5256 /* Defined in gui.c */
5601 DECLARE_DOESNT_RETURN (gui_error (const Ascbyte *reason, 5257 DECLARE_DOESNT_RETURN (gui_error (const Ascbyte *reason,
5602 Lisp_Object frob)); 5258 Lisp_Object frob));
5603 DECLARE_DOESNT_RETURN (gui_error_2 (const Ascbyte *reason, 5259 DECLARE_DOESNT_RETURN (gui_error_2 (const Ascbyte *reason,
5604 Lisp_Object frob0, Lisp_Object frob1)); 5260 Lisp_Object frob0, Lisp_Object frob1));
5261 extern Lisp_Object Qgui_error;
5262
5605 /* Defined in indent.c */ 5263 /* Defined in indent.c */
5606 EXFUN (Findent_to, 3); 5264 EXFUN (Findent_to, 3);
5607 EXFUN (Fvertical_motion, 3); 5265 EXFUN (Fvertical_motion, 3);
5608 5266
5609 int byte_spaces_at_point (struct buffer *, Bytebpos); 5267 int byte_spaces_at_point (struct buffer *, Bytebpos);
5654 while (0) 5312 while (0)
5655 #else /*! LOADHIST */ 5313 #else /*! LOADHIST */
5656 # define LOADHIST_ATTACH(x) 5314 # define LOADHIST_ATTACH(x)
5657 #endif /*! LOADHIST */ 5315 #endif /*! LOADHIST */
5658 5316
5317 extern Lisp_Object Qfeaturep;
5318 extern Lisp_Object Qload;
5319 extern Lisp_Object Qread_char;
5320 extern Lisp_Object Qstandard_input;
5321 extern Lisp_Object Vcurrent_load_list;
5322 extern Lisp_Object Vfile_domain;
5323 extern Lisp_Object Vload_file_name_internal;
5324 extern Lisp_Object Vload_history;
5325 extern Lisp_Object Vload_path;
5326 extern Lisp_Object Vstandard_input;
5327
5659 /* Defined in macros.c */ 5328 /* Defined in macros.c */
5660 EXFUN (Fexecute_kbd_macro, 2); 5329 EXFUN (Fexecute_kbd_macro, 2);
5330
5331 extern Lisp_Object Vexecuting_macro;
5661 5332
5662 /* Defined in marker.c */ 5333 /* Defined in marker.c */
5663 EXFUN (Fcopy_marker, 2); 5334 EXFUN (Fcopy_marker, 2);
5664 EXFUN (Fmake_marker, 0); 5335 EXFUN (Fmake_marker, 0);
5665 EXFUN (Fmarker_buffer, 1); 5336 EXFUN (Fmarker_buffer, 1);
5673 void set_marker_position (Lisp_Object, Charbpos); 5344 void set_marker_position (Lisp_Object, Charbpos);
5674 void unchain_marker (Lisp_Object); 5345 void unchain_marker (Lisp_Object);
5675 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object); 5346 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object);
5676 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); 5347 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
5677 #ifdef MEMORY_USAGE_STATS 5348 #ifdef MEMORY_USAGE_STATS
5678 int compute_buffer_marker_usage (struct buffer *, struct overhead_stats *); 5349 Bytecount compute_buffer_marker_usage (struct buffer *b);
5679 #endif 5350 #endif
5680 void init_buffer_markers (struct buffer *b); 5351 void init_buffer_markers (struct buffer *b);
5681 void uninit_buffer_markers (struct buffer *b); 5352 void uninit_buffer_markers (struct buffer *b);
5353
5354 /* Defined in menubar.c */
5355 extern Lisp_Object Qactivate_menubar_hook;
5356 extern Lisp_Object Qcurrent_menubar;
5357 extern Lisp_Object Vactivate_menubar_hook;
5358 extern Lisp_Object Vblank_menubar;
5359 extern Lisp_Object Vmenubar_configuration;
5682 5360
5683 /* Defined in minibuf.c */ 5361 /* Defined in minibuf.c */
5684 extern int minibuf_level; 5362 extern int minibuf_level;
5685 Charcount scmp_1 (const Ibyte *, const Ibyte *, Charcount, int); 5363 Charcount scmp_1 (const Ibyte *, const Ibyte *, Charcount, int);
5686 #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case) 5364 #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case)
5702 MODULE_API void message (const char *, ...) PRINTF_ARGS (1, 2); 5380 MODULE_API void message (const char *, ...) PRINTF_ARGS (1, 2);
5703 void message_append (const char *, ...) PRINTF_ARGS (1, 2); 5381 void message_append (const char *, ...) PRINTF_ARGS (1, 2);
5704 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2); 5382 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2);
5705 void clear_message (void); 5383 void clear_message (void);
5706 5384
5385 extern Lisp_Object Qcompletion_ignore_case;
5386 extern Lisp_Object Vecho_area_buffer;
5387 extern Lisp_Object Vminibuf_preprompt;
5388 extern Lisp_Object Vminibuf_prompt;
5389 extern Lisp_Object Vminibuffer_zero;
5390
5707 /* Defined in mule-charset.c */ 5391 /* Defined in mule-charset.c */
5708 EXFUN (Fmake_charset, 3); 5392 EXFUN (Fmake_charset, 3);
5709 5393
5710 extern Lisp_Object Ql2r, Qr2l; 5394 extern Lisp_Object Ql2r, Qr2l;
5395 extern Lisp_Object Qdirection;
5396 extern Lisp_Object Qfinal;
5397 extern Lisp_Object Qgraphic;
5398 extern Lisp_Object Qlong_name;
5399 extern Lisp_Object Qregistries;
5400 extern Lisp_Object Qreverse_direction_charset;
5401 extern Lisp_Object Qshort_name;
5402
5403 /* Defined in nt.c */
5404 extern Lisp_Object Vmswindows_get_true_file_attributes;
5711 5405
5712 /* Defined in print.c */ 5406 /* Defined in print.c */
5713 EXFUN (Fdisplay_error, 2); 5407 EXFUN (Fdisplay_error, 2);
5714 EXFUN (Ferror_message_string, 1); 5408 EXFUN (Ferror_message_string, 1);
5715 EXFUN (Fprin1, 2); 5409 EXFUN (Fprin1, 2);
5776 extern int in_debug_print; 5470 extern int in_debug_print;
5777 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object, 5471 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object,
5778 Lisp_Object (*) (Lisp_Object), 5472 Lisp_Object (*) (Lisp_Object),
5779 Lisp_Object, Lisp_Object); 5473 Lisp_Object, Lisp_Object);
5780 void float_to_string (char *, double); 5474 void float_to_string (char *, double);
5781 void internal_object_printer (Lisp_Object, Lisp_Object, int); 5475 void internal_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
5782 MODULE_API DECLARE_DOESNT_RETURN (printing_unreadable_object (const CIbyte *, 5476 int UNUSED (escapeflag));
5477 void external_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
5478 int UNUSED (escapeflag));
5479 MODULE_API DECLARE_DOESNT_RETURN (printing_unreadable_object_fmt (const CIbyte *,
5783 ...)) 5480 ...))
5784 PRINTF_ARGS (1, 2); 5481 PRINTF_ARGS (1, 2);
5785 DECLARE_DOESNT_RETURN (printing_unreadable_lcrecord (Lisp_Object obj, 5482 DECLARE_DOESNT_RETURN (printing_unreadable_lisp_object (Lisp_Object obj,
5786 const Ibyte *name)); 5483 const Ibyte *name));
5484
5485 extern Lisp_Object Qexternal_debugging_output;
5486 extern Lisp_Object Qprint_length;
5487 extern Lisp_Object Qprint_string_length;
5488 extern Lisp_Object Qstandard_output;
5489 extern Lisp_Object Vprint_length;
5490 extern Lisp_Object Vprint_level;
5491 extern Lisp_Object Vstandard_output;
5492
5493 /* Defined in process.c */
5494 extern Lisp_Object Qnetwork_error;
5495 extern MODULE_API Lisp_Object Qprocess_error;
5496 extern Lisp_Object Vprocess_environment;
5497 extern Lisp_Object Vshell_file_name;
5787 5498
5788 /* Defined in rangetab.c */ 5499 /* Defined in rangetab.c */
5789 EXFUN (Fclear_range_table, 1); 5500 EXFUN (Fclear_range_table, 1);
5790 EXFUN (Fget_range_table, 3); 5501 EXFUN (Fget_range_table, 3);
5791 EXFUN (Fmake_range_table, 1); 5502 EXFUN (Fmake_range_table, 1);
5844 EXFUN (Fding, 3); 5555 EXFUN (Fding, 3);
5845 5556
5846 void init_device_sound (struct device *); 5557 void init_device_sound (struct device *);
5847 DECLARE_DOESNT_RETURN (report_sound_error (const Ascbyte *, Lisp_Object)); 5558 DECLARE_DOESNT_RETURN (report_sound_error (const Ascbyte *, Lisp_Object));
5848 5559
5560 extern Lisp_Object Qsound_error;
5561 extern Lisp_Object Vsynchronous_sounds;
5562
5849 /* Defined in specifier.c */ 5563 /* Defined in specifier.c */
5850 EXFUN (Fadd_spec_to_specifier, 5); 5564 EXFUN (Fadd_spec_to_specifier, 5);
5851 EXFUN (Fspecifier_spec_list, 4); 5565 EXFUN (Fspecifier_spec_list, 4);
5852 5566
5853 Lisp_Object specifier_instance (Lisp_Object, Lisp_Object, Lisp_Object, 5567 Lisp_Object specifier_instance (Lisp_Object, Lisp_Object, Lisp_Object,
5886 Lisp_Object find_symbol_value_quickly (Lisp_Object, int); 5600 Lisp_Object find_symbol_value_quickly (Lisp_Object, int);
5887 Lisp_Object top_level_value (Lisp_Object); 5601 Lisp_Object top_level_value (Lisp_Object);
5888 void reject_constant_symbols (Lisp_Object sym, Lisp_Object newval, 5602 void reject_constant_symbols (Lisp_Object sym, Lisp_Object newval,
5889 int function_p, 5603 int function_p,
5890 Lisp_Object follow_past_lisp_magic); 5604 Lisp_Object follow_past_lisp_magic);
5605
5606 extern Lisp_Object Qconst_specifier;
5607 extern Lisp_Object Qmakunbound;
5608 extern Lisp_Object Qset;
5609 extern Lisp_Object Qvariable_documentation;
5610 extern Lisp_Object Qvariable_domain;
5611 extern MODULE_API Lisp_Object Qt, Qunbound;
5612 extern Lisp_Object Vobarray;
5891 5613
5892 /* Defined in syntax.c */ 5614 /* Defined in syntax.c */
5893 Charbpos scan_words (struct buffer *, Charbpos, int); 5615 Charbpos scan_words (struct buffer *, Charbpos, int);
5894 EXFUN (Fchar_syntax, 2); 5616 EXFUN (Fchar_syntax, 2);
5895 EXFUN (Fforward_word, 2); 5617 EXFUN (Fforward_word, 2);
6284 extern alloca_convert_vals_dynarr *active_alloca_convert; 6006 extern alloca_convert_vals_dynarr *active_alloca_convert;
6285 6007
6286 MODULE_API int find_pos_of_existing_active_alloca_convert (const char * 6008 MODULE_API int find_pos_of_existing_active_alloca_convert (const char *
6287 srctext); 6009 srctext);
6288 6010
6011 /* Defined in undo.c */
6012 extern Lisp_Object Qinhibit_read_only;
6013
6289 /* Defined in unicode.c */ 6014 /* Defined in unicode.c */
6290 extern const struct sized_memory_description to_unicode_description; 6015 extern const struct sized_memory_description to_unicode_description;
6291 extern const struct sized_memory_description from_unicode_description; 6016 extern const struct sized_memory_description from_unicode_description;
6292 void init_charset_unicode_tables (Lisp_Object charset); 6017 void init_charset_unicode_tables (Lisp_Object charset);
6293 void free_charset_unicode_tables (Lisp_Object charset); 6018 void free_charset_unicode_tables (Lisp_Object charset);
6294 void recalculate_unicode_precedence (void); 6019 void recalculate_unicode_precedence (void);
6295 extern Lisp_Object Qunicode; 6020 extern Lisp_Object Qunicode;
6296 extern Lisp_Object Qutf_16, Qutf_8, Qucs_4, Qutf_7, Qutf_32; 6021 extern Lisp_Object Qutf_16, Qutf_8, Qucs_4, Qutf_7, Qutf_32;
6297 #ifdef MEMORY_USAGE_STATS 6022 #ifdef MEMORY_USAGE_STATS
6298 Bytecount compute_from_unicode_table_size (Lisp_Object charset, 6023 Bytecount compute_from_unicode_table_size (Lisp_Object charset,
6299 struct overhead_stats *stats); 6024 struct usage_stats *stats);
6300 Bytecount compute_to_unicode_table_size (Lisp_Object charset, 6025 Bytecount compute_to_unicode_table_size (Lisp_Object charset,
6301 struct overhead_stats *stats); 6026 struct usage_stats *stats);
6302 #endif /* MEMORY_USAGE_STATS */ 6027 #endif /* MEMORY_USAGE_STATS */
6303 6028
6304 /* Defined in undo.c */ 6029 /* Defined in undo.c */
6305 EXFUN (Fundo_boundary, 0); 6030 EXFUN (Fundo_boundary, 0);
6306 6031
6321 #endif 6046 #endif
6322 6047
6323 /* Defined in vm-limit.c */ 6048 /* Defined in vm-limit.c */
6324 void memory_warnings (void *, void (*) (const char *)); 6049 void memory_warnings (void *, void (*) (const char *));
6325 6050
6326 /*--------------- prototypes for constant symbols ------------*/ 6051 /* Defined in win32.c */
6327 6052 extern Lisp_Object Vmswindows_downcase_file_names;
6328 /* #### We should get rid of this and put the prototypes back up there in 6053
6329 #### the per-file stuff, where they belong. */ 6054 /* Defined in window.c */
6330 6055 extern Lisp_Object Qwindow_live_p;
6331 /* Use the following when you have to add a bunch of symbols. */
6332
6333 /*
6334
6335 (defun redo-symbols (beg end)
6336 "Snarf any symbols out of the region and print them into a temporary buffer,
6337 which is displayed when the function finishes. The symbols are laid out with
6338 `extern Lisp_Object ' before each one, with as many as can fit on one line
6339 \(the maximum line width is controlled by the constant `max-line-length' in the
6340 code)."
6341 (interactive "r")
6342 (save-excursion
6343 (goto-char beg)
6344 (let (syms)
6345 (while (re-search-forward "\\s-\\(Q[A-Za-z_0-9]+\\)" end t)
6346 (push (match-string 1) syms))
6347 (setq syms (sort syms #'string-lessp))
6348 (with-output-to-temp-buffer "*Symbols*"
6349 (let* ((col 0)
6350 (start "extern Lisp_Object ")
6351 (startlen (length start))
6352 ;; with a default-width frame of 80 chars, you can only fit
6353 ;; 79 before wrapping. you can see this to a lower value if
6354 ;; you don't want it right up against the right margin.
6355 (max-line-length 79))
6356 (dolist (sym syms)
6357 (cond (;; if something already on line (this will always be the
6358 ;; case except the very first iteration), see what
6359 ;; space we've got. (need to take into account 2
6360 ;; for the comma+space, 1 for the semicolon at the
6361 ;; end.) if enough space, do it.
6362 (and (> col 0) (< (+ col (length sym) 2)
6363 (1- max-line-length)))
6364 (princ ", ")
6365 (princ sym)
6366 (incf col 2)
6367 (incf col (length sym)))
6368 (t
6369 ;; either we're first iteration or we ran out of space.
6370 ;; if the latter, terminate the previous line. this
6371 ;; loop is written on purpose so that it always prints
6372 ;; at least one item, even if that would go over.
6373 (when (> col 0)
6374 (princ ";\n")
6375 (setq col 0))
6376 (princ start)
6377 (incf col startlen)
6378 (princ sym)
6379 (incf col (length sym)))))
6380 ;; finally terminate the last line.
6381 (princ ";\n"))))))
6382
6383 */
6384
6385 extern Lisp_Object Qactivate_menubar_hook, Qand_optional, Qand_rest, Qautoload,
6386 Qbackground, Qbackground_pixmap, Qblinking, Qbuffer_glyph_p, Qbuffer_live_p,
6387 Qcall_interactively, Qcategory_designator_p,
6388 Qcategory_table_value_p, Qcdr, Qcolor_pixmap_image_instance_p, Qcommandp,
6389 Qcompletion_ignore_case, Qconsole_live_p, Qconst_specifier, Qcurrent_menubar,
6390 Qdefun, Qdevice_live_p, Qdim, Qdirection, Qdisabled, Qdisabled_command_hook,
6391 Qdisplay_table, Qdll_error, Qend_open, Qerror_lacks_explanatory_string,
6392 Qevent_live_p, Qexit, Qextent_live_p, Qexternal_debugging_output, Qfeaturep,
6393 Qfile_error, Qfile_name_sans_extension, Qfinal, Qforeground, Qformat,
6394 Qframe_live_p, Qgraphic, Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit,
6395 Qinhibit_read_only, Qinteractive, Qlayout, Qload, Qlong_name, Qmacro,
6396 Qmakunbound, Qmark, Qmodule, Qmono_pixmap_image_instance_p,
6397 Qmouse_leave_buffer_hook, Qnative_layout, Qnetwork_error,
6398 Qnothing_image_instance_p, Qpoint, Qpointer_glyph_p,
6399 Qpointer_image_instance_p, Qprint_length, Qprint_string_length, Qprogn,
6400 Qread_char, Qread_from_minibuffer, Qreally_early_error_handler,
6401 Qregion_beginning, Qregion_end, Qregistries, Qreverse_direction_charset,
6402 Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs, Qself_insert_command,
6403 Qself_insert_defer_undo, Qsequencep, Qset, Qshort_name, Qsound_error,
6404 Qstandard_input, Qstandard_output, Qstart_open, Qstring_lessp, Qsubwindow,
6405 Qsubwindow_image_instance_p, Qtext_image_instance_p, Qtop_level, Qunderline,
6406 Quser_files_and_directories, Qvalues, Qvariable_documentation,
6407 Qvariable_domain, Qwindow_live_p, Qyes_or_no_p;
6408
6409 extern MODULE_API Lisp_Object Qprocess_error, Qt, Qunbound;
6410
6411 #define SYMBOL(fou) extern Lisp_Object fou
6412 #define SYMBOL_MODULE_API(fou) extern MODULE_API Lisp_Object fou
6413 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
6414 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
6415 extern Lisp_Object tout_le_monde
6416
6417 #include "general-slots.h"
6418
6419 #undef SYMBOL
6420 #undef SYMBOL_MODULE_API
6421 #undef SYMBOL_KEYWORD
6422 #undef SYMBOL_GENERAL
6423
6424 /*--------------- prototypes for variables of type Lisp_Object ------------*/
6425
6426 /* #### We should get rid of this and put the prototypes back up there in
6427 #### the per-file stuff, where they belong. */
6428
6429 extern Lisp_Object Vactivate_menubar_hook;
6430 extern Lisp_Object Vautoload_queue, Vblank_menubar;
6431 extern Lisp_Object Vcommand_history;
6432 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory;
6433 extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory;
6434 extern Lisp_Object Vconsole_list, Vcontrolling_terminal;
6435 extern Lisp_Object Vcurrent_load_list;
6436 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory;
6437 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook;
6438 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name;
6439 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version;
6440 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path;
6441 extern Lisp_Object Vexecuting_macro, Vfeatures, Vfile_domain;
6442 extern Lisp_Object Vinvocation_directory, Vinvocation_name;
6443 extern Lisp_Object Vlast_command, Vlast_command_char;
6444 extern Lisp_Object Vlast_command_event, Vlast_input_event;
6445 extern Lisp_Object Vload_file_name_internal, Vload_history;
6446 extern Lisp_Object Vload_path, Vmark_even_if_inactive, Vmenubar_configuration;
6447 extern Lisp_Object Vminibuf_preprompt, Vminibuf_prompt, Vminibuffer_zero;
6448 extern Lisp_Object Vmodule_directory, Vmswindows_downcase_file_names;
6449 extern Lisp_Object Vmswindows_get_true_file_attributes, Vobarray;
6450 extern Lisp_Object Vprint_length, Vprint_level, Vprocess_environment;
6451 extern Lisp_Object Vrecent_keys_ring, Vshell_file_name, Vsite_directory;
6452 extern Lisp_Object Vsite_module_directory;
6453 extern Lisp_Object Vstandard_input, Vstandard_output, Vstdio_str;
6454 extern Lisp_Object Vsynchronous_sounds, Vsystem_name;
6455 extern Lisp_Object Vthis_command_keys, Vunread_command_event;
6456 extern Lisp_Object Vx_initial_argv_list;
6457
6458 extern MODULE_API Lisp_Object Vinhibit_quit, Vquit_flag;
6459 6056
6460 END_C_DECLS 6057 END_C_DECLS
6461 6058
6462 #endif /* INCLUDED_lisp_h_ */ 6059 #endif /* INCLUDED_lisp_h_ */