comparison src/lisp.h @ 5495:1f0b15040456

Merge.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 01 May 2011 18:44:03 +0100
parents 248176c74e6b
children b0d87f92e60b
comparison
equal deleted inserted replaced
5494:861f2601a38b 5495:1f0b15040456
3 Copyright (C) 1993-1996 Richard Mlynarik. 3 Copyright (C) 1993-1996 Richard Mlynarik.
4 Copyright (C) 1995, 1996, 2000-2005, 2009, 2010 Ben Wing. 4 Copyright (C) 1995, 1996, 2000-2005, 2009, 2010 Ben Wing.
5 5
6 This file is part of XEmacs. 6 This file is part of XEmacs.
7 7
8 XEmacs is free software; you can redistribute it and/or modify it 8 XEmacs is free software: you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the 9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any 10 Free Software Foundation, either version 3 of the License, or (at your
11 later version. 11 option) any later version.
12 12
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT 13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details. 16 for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with XEmacs; see the file COPYING. If not, write to 19 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22 20
23 /* Synched up with: FSF 19.30. */ 21 /* Synched up with: FSF 19.30. */
24 22
25 #ifndef INCLUDED_lisp_h_ 23 #ifndef INCLUDED_lisp_h_
26 #define INCLUDED_lisp_h_ 24 #define INCLUDED_lisp_h_
83 is composed of 2-byte units and might be a possible format to consider 81 is composed of 2-byte units and might be a possible format to consider
84 for Ibyte * text). 82 for Ibyte * text).
85 83
86 %%#### marks places that need work for KKCC (the new garbage collector). 84 %%#### marks places that need work for KKCC (the new garbage collector).
87 85
86 @@#### marks places that need work to get Unicode-internal working,
87 i.e. using UTF-8 as the internal text format.
88
89 #### BILL! marks places that need work for GTK.
90
91 #### GEOM! marks places needing work to fix various bugs in the handling
92 of window and frame sizing and positioning. Often the root of the
93 problems is that the code was originally written before there was a
94 gutter and then not completely fixed up to accommodate the gutter.
95
88 */ 96 */
89 97
90 /************************************************************************/ 98 /************************************************************************/
91 /* include files */ 99 /* include files */
92 /************************************************************************/ 100 /************************************************************************/
107 #include <ctype.h> 115 #include <ctype.h>
108 #include <stdarg.h> 116 #include <stdarg.h>
109 #include <stddef.h> /* offsetof */ 117 #include <stddef.h> /* offsetof */
110 #include <sys/types.h> 118 #include <sys/types.h>
111 #include <limits.h> 119 #include <limits.h>
120 #include <math.h>
112 #ifdef __cplusplus 121 #ifdef __cplusplus
113 #include <limits> /* necessary for max()/min() under G++ 4 */ 122 #include <limits> /* necessary for max()/min() under G++ 4 */
114 #endif 123 #endif
115 124
116 125
315 these become needed, they can always be defined. */ 324 these become needed, they can always be defined. */
316 325
317 #ifdef ERROR_CHECK_STRUCTURES 326 #ifdef ERROR_CHECK_STRUCTURES
318 /* Check for problems with the catch list and specbind stack */ 327 /* Check for problems with the catch list and specbind stack */
319 #define ERROR_CHECK_CATCH 328 #define ERROR_CHECK_CATCH
320 /* Check for incoherent Dynarr structures, attempts to access Dynarr 329 /* Check for incoherent dynarr structures, attempts to access Dynarr
321 positions out of range, reentrant use of Dynarrs through Dynarr locking, 330 positions out of range, reentrant use of dynarrs through dynarr locking,
322 etc. */ 331 etc. */
323 #define ERROR_CHECK_DYNARR 332 #define ERROR_CHECK_DYNARR
324 /* Check for insufficient use of call_trapping_problems(), particularly 333 /* Check for insufficient use of call_trapping_problems(), particularly
325 due to glyph-related changes causing eval or QUIT within redisplay */ 334 due to glyph-related changes causing eval or QUIT within redisplay */
326 #define ERROR_CHECK_TRAPPING_PROBLEMS 335 #define ERROR_CHECK_TRAPPING_PROBLEMS
1227 and line of the inline function, which is not very useful. */ 1236 and line of the inline function, which is not very useful. */
1228 1237
1229 /* Highly dubious kludge */ 1238 /* Highly dubious kludge */
1230 /* (thanks, Jamie, I feel better now -- ben) */ 1239 /* (thanks, Jamie, I feel better now -- ben) */
1231 MODULE_API void assert_failed (const Ascbyte *, int, const Ascbyte *); 1240 MODULE_API void assert_failed (const Ascbyte *, int, const Ascbyte *);
1241 void assert_equal_failed (const Ascbyte *file, int line, EMACS_INT x,
1242 EMACS_INT y, const Ascbyte *exprx,
1243 const Ascbyte *expry);
1232 #define ABORT() assert_failed (__FILE__, __LINE__, "ABORT()") 1244 #define ABORT() assert_failed (__FILE__, __LINE__, "ABORT()")
1233 #define abort_with_message(msg) assert_failed (__FILE__, __LINE__, msg) 1245 #define abort_with_message(msg) assert_failed (__FILE__, __LINE__, msg)
1234 1246
1235 /* This used to be ((void) (0)) but that triggers lots of unused variable 1247 /* This used to be ((void) (0)) but that triggers lots of unused variable
1236 warnings. It's pointless to force all that code to be rewritten, with 1248 warnings -- furthermore, if `x' has any side effects, e.g.
1237 added ifdefs. Any reasonable compiler will eliminate an expression with 1249 assert (++depth <= 20);, we DEFINITELY want to execute the code inside of
1250 `x'. Any reasonable compiler will eliminate an expression with
1238 no effects. We keep this abstracted out like this in case we want to 1251 no effects. We keep this abstracted out like this in case we want to
1239 change it in the future. */ 1252 change it in the future. */
1240 #define disabled_assert(x) ((void) (x)) 1253 #define disabled_assert(x) ((void) (x))
1241 #define disabled_assert_with_message(x, msg) ((void) msg, disabled_assert (x)) 1254 #define disabled_assert_with_message(x, msg) ((void) msg, disabled_assert (x))
1242 #define disabled_assert_at_line(x, file, line) \ 1255 #define disabled_assert_at_line(x, file, line) \
1246 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x)) 1259 # define assert(x) ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, #x))
1247 # define assert_with_message(x, msg) \ 1260 # define assert_with_message(x, msg) \
1248 ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, msg)) 1261 ((x) ? (void) 0 : assert_failed (__FILE__, __LINE__, msg))
1249 # define assert_at_line(x, file, line) \ 1262 # define assert_at_line(x, file, line) \
1250 ((x) ? (void) 0 : assert_failed (file, line, #x)) 1263 ((x) ? (void) 0 : assert_failed (file, line, #x))
1264 # define assert_equal(x, y) \
1265 ((x) == (y) ? (void) 0 : \
1266 assert_equal_failed (__FILE__, __LINE__, (EMACS_INT) x, (EMACS_INT) y, \
1267 #x, #y))
1251 #else 1268 #else
1252 /* This used to be ((void) (0)) but that triggers lots of unused variable 1269 /* This used to be ((void) (0)) but that triggers lots of unused variable
1253 warnings. It's pointless to force all that code to be rewritten, with 1270 warnings. It's pointless to force all that code to be rewritten, with
1254 added ifdefs. Any reasonable compiler will eliminate an expression with 1271 added ifdefs. Any reasonable compiler will eliminate an expression with
1255 no effects. */ 1272 no effects. */
1256 # define assert(x) disabled_assert (x) 1273 # define assert(x) disabled_assert (x)
1257 # define assert_with_message(x, msg) disabled_assert_with_message (x, msg) 1274 # define assert_with_message(x, msg) disabled_assert_with_message (x, msg)
1258 # define assert_at_line(x, file, line) disabled_assert_at_line (x, file, line) 1275 # define assert_at_line(x, file, line) disabled_assert_at_line (x, file, line)
1276 # define assert_equal(x, y) disabled_assert ((x) == (y))
1259 #endif 1277 #endif
1260 1278
1261 /************************************************************************/ 1279 /************************************************************************/
1262 /** Memory allocation **/ 1280 /** Memory allocation **/
1263 /************************************************************************/ 1281 /************************************************************************/
1418 Ibyte **_bsta_ = (Ibyte **) &(lval); \ 1436 Ibyte **_bsta_ = (Ibyte **) &(lval); \
1419 const Ibyte *_bsta_2 = (p); \ 1437 const Ibyte *_bsta_2 = (p); \
1420 Bytecount _bsta_3 = qxestrlen (_bsta_2); \ 1438 Bytecount _bsta_3 = qxestrlen (_bsta_2); \
1421 *_bsta_ = alloca_ibytes (1 + _bsta_3); \ 1439 *_bsta_ = alloca_ibytes (1 + _bsta_3); \
1422 memcpy (*_bsta_, _bsta_2, 1 + _bsta_3); \ 1440 memcpy (*_bsta_, _bsta_2, 1 + _bsta_3); \
1441 } while (0)
1442
1443 /* Make an alloca'd copy of a Extbyte * */
1444 #define EXTBYTE_STRING_TO_ALLOCA(p, lval) \
1445 do { \
1446 Extbyte **_esta_ = (Extbyte **) &(lval); \
1447 const Extbyte *_esta_2 = (p); \
1448 Bytecount _esta_3 = strlen (_esta_2); \
1449 *_esta_ = alloca_extbytes (1 + _esta_3); \
1450 memcpy (*_esta_, _esta_2, 1 + _esta_3); \
1423 } while (0) 1451 } while (0)
1424 1452
1425 /* ----------------- convenience functions for reallocation --------------- */ 1453 /* ----------------- convenience functions for reallocation --------------- */
1426 1454
1427 #define XREALLOC_ARRAY(ptr, type, len) \ 1455 #define XREALLOC_ARRAY(ptr, type, len) \
1453 1481
1454 /* Note that the simplest typedefs are near the top of this file. */ 1482 /* Note that the simplest typedefs are near the top of this file. */
1455 1483
1456 /* We put typedefs here so that prototype declarations don't choke. 1484 /* We put typedefs here so that prototype declarations don't choke.
1457 Note that we don't actually declare the structures here (except 1485 Note that we don't actually declare the structures here (except
1458 maybe for simple structures like Dynarrs); that keeps them private 1486 maybe for simple structures like dynarrs); that keeps them private
1459 to the routines that actually use them. */ 1487 to the routines that actually use them. */
1460 1488
1461 /* ------------------------------- */ 1489 /* ------------------------------- */
1462 /* Error_Behavior typedefs */ 1490 /* Error_Behavior typedefs */
1463 /* ------------------------------- */ 1491 /* ------------------------------- */
1525 typedef struct lstream Lstream; /* lstream.h */ 1553 typedef struct lstream Lstream; /* lstream.h */
1526 typedef struct extent *EXTENT; /* extents-impl.h */ 1554 typedef struct extent *EXTENT; /* extents-impl.h */
1527 typedef struct Lisp_Event Lisp_Event; /* "events.h" */ 1555 typedef struct Lisp_Event Lisp_Event; /* "events.h" */
1528 typedef struct Lisp_Face Lisp_Face; /* "faces-impl.h" */ 1556 typedef struct Lisp_Face Lisp_Face; /* "faces-impl.h" */
1529 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */ 1557 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */
1530 typedef struct Lisp_Color_Instance Lisp_Color_Instance; /* objects-impl.h */ 1558 typedef struct Lisp_Color_Instance Lisp_Color_Instance; /* fontcolor-impl.h */
1531 typedef struct Lisp_Font_Instance Lisp_Font_Instance; /* objects-impl.h */ 1559 typedef struct Lisp_Font_Instance Lisp_Font_Instance; /* fontcolor-impl.h */
1532 typedef struct Lisp_Image_Instance Lisp_Image_Instance; /* glyphs.h */ 1560 typedef struct Lisp_Image_Instance Lisp_Image_Instance; /* glyphs.h */
1533 typedef struct Lisp_Gui_Item Lisp_Gui_Item; 1561 typedef struct Lisp_Gui_Item Lisp_Gui_Item;
1534 1562
1535 /* ------------------------------- */ 1563 /* ------------------------------- */
1536 /* enum typedefs */ 1564 /* enum typedefs */
1540 { 1568 {
1541 RUN_HOOKS_TO_COMPLETION, 1569 RUN_HOOKS_TO_COMPLETION,
1542 RUN_HOOKS_UNTIL_SUCCESS, 1570 RUN_HOOKS_UNTIL_SUCCESS,
1543 RUN_HOOKS_UNTIL_FAILURE 1571 RUN_HOOKS_UNTIL_FAILURE
1544 }; 1572 };
1545
1546 #ifdef HAVE_TOOLBARS
1547 enum toolbar_pos
1548 {
1549 TOP_TOOLBAR,
1550 BOTTOM_TOOLBAR,
1551 LEFT_TOOLBAR,
1552 RIGHT_TOOLBAR
1553 };
1554 #endif
1555 1573
1556 enum edge_style 1574 enum edge_style
1557 { 1575 {
1558 EDGE_ETCHED_IN, 1576 EDGE_ETCHED_IN,
1559 EDGE_ETCHED_OUT, 1577 EDGE_ETCHED_OUT,
1580 }; 1598 };
1581 1599
1582 /* ------------------------------- */ 1600 /* ------------------------------- */
1583 /* misc */ 1601 /* misc */
1584 /* ------------------------------- */ 1602 /* ------------------------------- */
1585
1586 #ifdef MEMORY_USAGE_STATS
1587 1603
1588 /* This structure is used to keep statistics on the amount of memory 1604 /* This structure is used to keep statistics on the amount of memory
1589 in use. 1605 in use.
1590 1606
1591 WAS_REQUESTED stores the actual amount of memory that was requested 1607 WAS_REQUESTED stores the actual amount of memory that was requested
1602 1618
1603 Functions that accept a structure of this sort do not initialize 1619 Functions that accept a structure of this sort do not initialize
1604 the fields to 0, and add any existing values to whatever was there 1620 the fields to 0, and add any existing values to whatever was there
1605 before; this way, you can get a cumulative effect. */ 1621 before; this way, you can get a cumulative effect. */
1606 1622
1607 struct overhead_stats 1623 struct usage_stats
1608 { 1624 {
1609 int was_requested; 1625 Bytecount was_requested;
1610 int malloc_overhead; 1626 Bytecount malloc_overhead;
1611 int dynarr_overhead; 1627 Bytecount dynarr_overhead;
1612 int gap_overhead; 1628 Bytecount gap_overhead;
1613 }; 1629 };
1614 1630
1615 #endif /* MEMORY_USAGE_STATS */ 1631 /* Generic version of usage stats structure including extra non-Lisp and
1632 Lisp storage associated with the object, but not including the memory
1633 used to hold the object itself. Up to 32 statistics are allowed,
1634 in addition to the statistics in `U', which store another slice onto the
1635 ancillary non-Lisp storage.
1636
1637 Normally, each object creates its own version of this structure, e.g.
1638 `struct window_stats', which parallels the structure in beginning with
1639 a `struct usage_stats' and followed by Bytecount fields, so that a
1640 pointer to that structure can be cast to a pointer of this structure
1641 and sensible results gotten. */
1642
1643 struct generic_usage_stats
1644 {
1645 struct usage_stats u;
1646 Bytecount othervals[32];
1647 };
1616 1648
1617 1649
1618 /************************************************************************/ 1650 /************************************************************************/
1619 /* Definition of Lisp_Object data type */ 1651 /* Definition of Lisp_Object data type */
1620 /************************************************************************/ 1652 /************************************************************************/
1643 #define GCBITS 2 1675 #define GCBITS 2
1644 #define INT_GCBITS 1 1676 #define INT_GCBITS 1
1645 1677
1646 #define INT_VALBITS (BITS_PER_EMACS_INT - INT_GCBITS) 1678 #define INT_VALBITS (BITS_PER_EMACS_INT - INT_GCBITS)
1647 #define VALBITS (BITS_PER_EMACS_INT - GCBITS) 1679 #define VALBITS (BITS_PER_EMACS_INT - GCBITS)
1680 /* This is badly named; it's not the maximum value that an EMACS_INT can
1681 have, it's the maximum value that a Lisp-visible fixnum can have (half
1682 the maximum value an EMACS_INT can have) and as such would be better
1683 called MOST_POSITIVE_FIXNUM. Similarly for MOST_NEGATIVE_FIXNUM. */
1648 #define EMACS_INT_MAX ((EMACS_INT) ((1UL << (INT_VALBITS - 1)) -1UL)) 1684 #define EMACS_INT_MAX ((EMACS_INT) ((1UL << (INT_VALBITS - 1)) -1UL))
1649 #define EMACS_INT_MIN (-(EMACS_INT_MAX) - 1) 1685 #define EMACS_INT_MIN (-(EMACS_INT_MAX) - 1)
1650 /* WARNING: evaluates its arg twice. */ 1686 /* WARNING: evaluates its arg twice. */
1651 #define NUMBER_FITS_IN_AN_EMACS_INT(num) \ 1687 #define NUMBER_FITS_IN_AN_EMACS_INT(num) \
1652 ((num) <= EMACS_INT_MAX && (num) >= EMACS_INT_MIN) 1688 ((num) <= EMACS_INT_MAX && (num) >= EMACS_INT_MIN)
1719 EMACS_UINT p = XUINT (obj); 1755 EMACS_UINT p = XUINT (obj);
1720 return (void *) (p << 1); 1756 return (void *) (p << 1);
1721 } 1757 }
1722 1758
1723 /************************************************************************/ 1759 /************************************************************************/
1724 /** Definitions of dynamic arrays (Dynarrs) and other allocators **/ 1760 /** Definitions of dynarrs and other allocators **/
1725 /************************************************************************/ 1761 /************************************************************************/
1726 1762
1727 BEGIN_C_DECLS 1763 #include "array.h"
1728
1729 /************* Dynarr declaration *************/
1730
1731 #ifdef NEW_GC
1732 #define DECLARE_DYNARR_LISP_IMP() \
1733 const struct lrecord_implementation *lisp_imp;
1734 #else
1735 #define DECLARE_DYNARR_LISP_IMP()
1736 #endif
1737
1738 #ifdef ERROR_CHECK_DYNARR
1739 #define DECLARE_DYNARR_LOCKED() \
1740 int locked;
1741 #else
1742 #define DECLARE_DYNARR_LOCKED()
1743 #endif
1744
1745 #define Dynarr_declare(type) \
1746 struct lrecord_header header; \
1747 type *base; \
1748 DECLARE_DYNARR_LISP_IMP () \
1749 DECLARE_DYNARR_LOCKED () \
1750 int elsize; \
1751 int len_; \
1752 int largest_; \
1753 int max_
1754
1755 typedef struct dynarr
1756 {
1757 Dynarr_declare (void);
1758 } Dynarr;
1759
1760 #define XD_DYNARR_DESC(base_type, sub_desc) \
1761 { XD_BLOCK_PTR, offsetof (base_type, base), \
1762 XD_INDIRECT(1, 0), {sub_desc} }, \
1763 { XD_INT, offsetof (base_type, len_) }, \
1764 { XD_INT_RESET, offsetof (base_type, largest_), XD_INDIRECT(1, 0) }, \
1765 { XD_INT_RESET, offsetof (base_type, max_), XD_INDIRECT(1, 0) }
1766
1767 #ifdef NEW_GC
1768 #define XD_LISP_DYNARR_DESC(base_type, sub_desc) \
1769 { XD_LISP_OBJECT_BLOCK_PTR, offsetof (base_type, base), \
1770 XD_INDIRECT(1, 0), {sub_desc} }, \
1771 { XD_INT, offsetof (base_type, len_) }, \
1772 { XD_INT_RESET, offsetof (base_type, largest_), XD_INDIRECT(1, 0) }, \
1773 { XD_INT_RESET, offsetof (base_type, max_), XD_INDIRECT(1, 0) }
1774 #endif /* NEW_GC */
1775
1776 /************* Dynarr verification *************/
1777
1778 #ifdef ERROR_CHECK_DYNARR
1779 DECLARE_INLINE_HEADER (
1780 int
1781 Dynarr_verify_pos_at (void *d, int pos, const Ascbyte *file, int line)
1782 )
1783 {
1784 Dynarr *dy = (Dynarr *) d;
1785 /* We use `largest', not `len', because the redisplay code often
1786 accesses stuff between len and largest. */
1787 assert_at_line (pos >= 0 && pos < dy->largest_, file, line);
1788 return pos;
1789 }
1790
1791 DECLARE_INLINE_HEADER (
1792 int
1793 Dynarr_verify_pos_atp (void *d, int pos, const Ascbyte *file, int line)
1794 )
1795 {
1796 Dynarr *dy = (Dynarr *) d;
1797 /* We use `largest', not `len', because the redisplay code often
1798 accesses stuff between len and largest. */
1799 /* [[ Code will often do something like ...
1800
1801 val = make_bit_vector_from_byte_vector (Dynarr_atp (dyn, 0),
1802 Dynarr_length (dyn));
1803
1804 which works fine when the Dynarr_length is non-zero, but when zero,
1805 the result of Dynarr_atp() not only points past the end of the
1806 allocated array, but the array may not have ever been allocated and
1807 hence the return value is NULL. But the length of 0 causes the
1808 pointer to never get checked. These can occur throughout the code
1809 so we put in a special check. --ben ]]
1810
1811 Update: The common idiom `Dynarr_atp (dyn, 0)' has been changed to
1812 `Dynarr_begin (dyn)'. Possibly this special check at POS 0 can be
1813 done only for Dynarr_begin() not for general Dynarr_atp(). --ben */
1814 if (pos == 0 && dy->len_ == 0)
1815 return pos;
1816 /* #### It's vaguely possible that some code could legitimately want to
1817 retrieve a pointer to the position just past the end of dynarr memory.
1818 This could happen with Dynarr_atp() but not Dynarr_at(). If so, it
1819 will trigger this assert(). In such cases, it should be obvious that
1820 the code wants to do this; rather than relaxing the assert, we should
1821 probably create a new macro Dynarr_atp_allow_end() which is like
1822 Dynarr_atp() but which allows for pointing at invalid addresses -- we
1823 really want to check for cases of accessing just past the end of
1824 memory, which is a likely off-by-one problem to occur and will usually
1825 not trigger a protection fault (instead, you'll just get random
1826 behavior, possibly overwriting other memory, which is bad). --ben */
1827 assert_at_line (pos >= 0 && pos < dy->largest_, file, line);
1828 return pos;
1829 }
1830
1831 DECLARE_INLINE_HEADER (
1832 int
1833 Dynarr_verify_pos_atp_allow_end (void *d, int pos, const Ascbyte *file,
1834 int line)
1835 )
1836 {
1837 Dynarr *dy = (Dynarr *) d;
1838 /* We use `largest', not `len', because the redisplay code often
1839 accesses stuff between len and largest.
1840 We also allow referencing the very end, past the end of allocated
1841 legitimately space. See comments in Dynarr_verify_pos_atp.()*/
1842 assert_at_line (pos >= 0 && pos <= dy->largest_, file, line);
1843 return pos;
1844 }
1845
1846 #else
1847 #define Dynarr_verify_pos_at(d, pos, file, line) (pos)
1848 #define Dynarr_verify_pos_atp(d, pos, file, line) (pos)
1849 #define Dynarr_verify_pos_atp_allow_end(d, pos, file, line) (pos)
1850 #endif /* ERROR_CHECK_DYNARR */
1851
1852 #ifdef ERROR_CHECK_DYNARR
1853 DECLARE_INLINE_HEADER (
1854 Dynarr *
1855 Dynarr_verify_1 (void *d, const Ascbyte *file, int line)
1856 )
1857 {
1858 Dynarr *dy = (Dynarr *) d;
1859 assert_at_line (dy->len_ >= 0 && dy->len_ <= dy->largest_ &&
1860 dy->largest_ <= dy->max_, file, line);
1861 return dy;
1862 }
1863
1864 DECLARE_INLINE_HEADER (
1865 Dynarr *
1866 Dynarr_verify_mod_1 (void *d, const Ascbyte *file, int line)
1867 )
1868 {
1869 Dynarr *dy = (Dynarr *) d;
1870 assert_at_line (!dy->locked, file, line);
1871 return Dynarr_verify_1 (d, file, line);
1872 }
1873
1874 #define Dynarr_verify(d) Dynarr_verify_1 (d, __FILE__, __LINE__)
1875 #define Dynarr_verify_mod(d) Dynarr_verify_mod_1 (d, __FILE__, __LINE__)
1876 #define Dynarr_lock(d) \
1877 do { \
1878 Dynarr *dy = Dynarr_verify_mod (d); \
1879 dy->locked = 1; \
1880 } while (0)
1881 #define Dynarr_unlock(d) \
1882 do { \
1883 Dynarr *dy = Dynarr_verify (d); \
1884 dy->locked = 0; \
1885 } while (0)
1886 #else
1887 #define Dynarr_verify(d) ((Dynarr *) d)
1888 #define Dynarr_verify_mod(d) ((Dynarr *) d)
1889 #define Dynarr_lock(d) DO_NOTHING
1890 #define Dynarr_unlock(d) DO_NOTHING
1891 #endif /* ERROR_CHECK_DYNARR */
1892
1893 /************* Dynarr creation *************/
1894
1895 MODULE_API void *Dynarr_newf (int elsize);
1896 MODULE_API void Dynarr_free (void *d);
1897
1898 #ifdef NEW_GC
1899 MODULE_API void *Dynarr_lisp_newf (int elsize,
1900 const struct lrecord_implementation
1901 *dynarr_imp,
1902 const struct lrecord_implementation *imp);
1903
1904 #define Dynarr_lisp_new(type, dynarr_imp, imp) \
1905 ((type##_dynarr *) Dynarr_lisp_newf (sizeof (type), dynarr_imp, imp))
1906 #define Dynarr_lisp_new2(dynarr_type, type, dynarr_imp, imp) \
1907 ((dynarr_type *) Dynarr_lisp_newf (sizeof (type)), dynarr_imp, imp)
1908 #endif /* NEW_GC */
1909 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type)))
1910 #define Dynarr_new2(dynarr_type, type) \
1911 ((dynarr_type *) Dynarr_newf (sizeof (type)))
1912
1913 /************* Dynarr access *************/
1914
1915 #ifdef ERROR_CHECK_DYNARR
1916 #define Dynarr_at(d, pos) \
1917 ((d)->base[Dynarr_verify_pos_at (d, pos, __FILE__, __LINE__)])
1918 #define Dynarr_atp_allow_end(d, pos) \
1919 (&((d)->base[Dynarr_verify_pos_atp_allow_end (d, pos, __FILE__, __LINE__)]))
1920 #define Dynarr_atp(d, pos) \
1921 (&((d)->base[Dynarr_verify_pos_atp (d, pos, __FILE__, __LINE__)]))
1922 #else
1923 #define Dynarr_at(d, pos) ((d)->base[pos])
1924 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos))
1925 #define Dynarr_atp_allow_end(d, pos) Dynarr_atp (d, pos)
1926 #endif
1927
1928 /* Old #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) */
1929 #define Dynarr_begin(d) Dynarr_atp (d, 0)
1930 #define Dynarr_lastp(d) Dynarr_atp (d, Dynarr_length (d) - 1)
1931 #define Dynarr_past_lastp(d) Dynarr_atp_allow_end (d, Dynarr_length (d))
1932
1933
1934 /************* Dynarr length/size retrieval and setting *************/
1935
1936 /* Retrieve the length of a Dynarr. The `+ 0' is to ensure that this cannot
1937 be used as an lvalue. */
1938 #define Dynarr_length(d) (Dynarr_verify (d)->len_ + 0)
1939 /* Retrieve the largest ever length seen of a Dynarr. The `+ 0' is to
1940 ensure that this cannot be used as an lvalue. */
1941 #define Dynarr_largest(d) (Dynarr_verify (d)->largest_ + 0)
1942 /* Retrieve the number of elements that fit in the currently allocated
1943 space. The `+ 0' is to ensure that this cannot be used as an lvalue. */
1944 #define Dynarr_max(d) (Dynarr_verify (d)->max_ + 0)
1945 /* Retrieve the advertised memory usage of a Dynarr, i.e. the number of
1946 bytes occupied by the elements in the Dynarr, not counting any overhead. */
1947 #define Dynarr_sizeof(d) (Dynarr_length (d) * (d)->elsize)
1948 /* Actually set the length of a Dynarr. This is a low-level routine that
1949 should not be directly used; use Dynarr_set_length() instead if you need
1950 to, but be very careful when doing so! */
1951 #define Dynarr_set_length_1(d, n) \
1952 do { \
1953 Elemcount _dsl1_n = (n); \
1954 dynarr_checking_assert (_dsl1_n >= 0 && _dsl1_n <= Dynarr_max (d)); \
1955 (void) Dynarr_verify_mod (d); \
1956 (d)->len_ = _dsl1_n; \
1957 /* Use the raw field references here otherwise we get a crash because \
1958 we've set the length but not yet fixed up the largest value. */ \
1959 if ((d)->len_ > (d)->largest_) \
1960 (d)->largest_ = (d)->len_; \
1961 (void) Dynarr_verify_mod (d); \
1962 } while (0)
1963
1964 /* The following two defines will get you into real trouble if you aren't
1965 careful. But they can save a lot of execution time when used wisely. */
1966 #define Dynarr_set_length(d, n) \
1967 do { \
1968 Elemcount _dsl_n = (n); \
1969 dynarr_checking_assert (_dsl_n >= 0 && _dsl_n <= Dynarr_largest (d)); \
1970 Dynarr_set_length_1 (d, _dsl_n); \
1971 } while (0)
1972 #define Dynarr_increment(d) \
1973 Dynarr_set_length (d, Dynarr_length (d) + 1)
1974
1975 /* Reset the Dynarr's length to 0. */
1976 #define Dynarr_reset(d) Dynarr_set_length (d, 0)
1977
1978 MODULE_API void Dynarr_resize (void *dy, Elemcount size);
1979
1980 #define Dynarr_resize_if(d, numels) \
1981 do { \
1982 Elemcount _dri_numels = (numels); \
1983 if (Dynarr_length (d) + _dri_numels > Dynarr_max (d)) \
1984 Dynarr_resize (d, Dynarr_length (d) + _dri_numels); \
1985 } while (0)
1986
1987 #ifdef MEMORY_USAGE_STATS
1988 struct overhead_stats;
1989 Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats);
1990 #endif
1991
1992 /************* Adding/deleting elements to/from a Dynarr *************/
1993
1994 #ifdef NEW_GC
1995 #define Dynarr_add(d, el) \
1996 do { \
1997 const struct lrecord_implementation *imp = (d)->lisp_imp; \
1998 (void) Dynarr_verify_mod (d); \
1999 Dynarr_resize_if (d, 1); \
2000 ((d)->base)[Dynarr_length (d)] = (el); \
2001 if (imp) \
2002 set_lheader_implementation \
2003 ((struct lrecord_header *)&(((d)->base)[Dynarr_length (d)]), imp); \
2004 Dynarr_set_length_1 (d, Dynarr_length (d) + 1); \
2005 (void) Dynarr_verify_mod (d); \
2006 } while (0)
2007 #else /* not NEW_GC */
2008 #define Dynarr_add(d, el) \
2009 do { \
2010 (void) Dynarr_verify_mod (d); \
2011 Dynarr_resize_if (d, 1); \
2012 ((d)->base)[Dynarr_length (d)] = (el); \
2013 Dynarr_set_length_1 (d, Dynarr_length (d) + 1); \
2014 (void) Dynarr_verify_mod (d); \
2015 } while (0)
2016 #endif /* not NEW_GC */
2017
2018
2019 MODULE_API void Dynarr_insert_many (void *d, const void *el, int len,
2020 int start);
2021 MODULE_API void Dynarr_delete_many (void *d, int start, int len);
2022
2023 #define Dynarr_insert_many_at_start(d, el, len) \
2024 Dynarr_insert_many (d, el, len, 0)
2025 #define Dynarr_add_literal_string(d, s) Dynarr_add_many (d, s, sizeof (s) - 1)
2026 #define Dynarr_add_lisp_string(d, s, codesys) \
2027 do { \
2028 Lisp_Object dyna_ls_s = (s); \
2029 Lisp_Object dyna_ls_cs = (codesys); \
2030 Extbyte *dyna_ls_eb; \
2031 Bytecount dyna_ls_bc; \
2032 \
2033 LISP_STRING_TO_SIZED_EXTERNAL (dyna_ls_s, dyna_ls_eb, \
2034 dyna_ls_bc, dyna_ls_cs); \
2035 Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \
2036 } while (0)
2037
2038 /* Add LEN contiguous elements to a Dynarr */
2039
2040 DECLARE_INLINE_HEADER (
2041 void
2042 Dynarr_add_many (void *d, const void *el, int len)
2043 )
2044 {
2045 /* This duplicates Dynarr_insert_many to some extent; but since it is
2046 called so often, it seemed useful to remove the unnecessary stuff
2047 from that function and to make it inline */
2048 Dynarr *dy = Dynarr_verify_mod (d);
2049 Dynarr_resize_if (dy, len);
2050 /* Some functions call us with a value of 0 to mean "reserve space but
2051 don't write into it" */
2052 if (el)
2053 memcpy ((char *) dy->base + Dynarr_sizeof (dy), el, len*dy->elsize);
2054 Dynarr_set_length_1 (dy, Dynarr_length (dy) + len);
2055 (void) Dynarr_verify_mod (dy);
2056 }
2057
2058 #define Dynarr_pop(d) \
2059 (dynarr_checking_assert (Dynarr_length (d) > 0), \
2060 Dynarr_verify_mod (d)->len_--, \
2061 Dynarr_at (d, Dynarr_length (d)))
2062 #define Dynarr_delete(d, i) Dynarr_delete_many (d, i, 1)
2063 #define Dynarr_delete_by_pointer(d, p) \
2064 Dynarr_delete_many (d, (p) - ((d)->base), 1)
2065
2066 #define Dynarr_delete_object(d, el) \
2067 do \
2068 { \
2069 REGISTER int i; \
2070 for (i = Dynarr_length (d) - 1; i >= 0; i--) \
2071 { \
2072 if (el == Dynarr_at (d, i)) \
2073 Dynarr_delete_many (d, i, 1); \
2074 } \
2075 } while (0)
2076 1764
2077 /************* Dynarr typedefs *************/ 1765 /************* Dynarr typedefs *************/
2078 1766
2079 /* Dynarr typedefs -- basic types first */ 1767 /* Dynarr typedefs -- basic types first */
2080 1768
2155 { 1843 {
2156 Dynarr_declare (struct face_cachel); 1844 Dynarr_declare (struct face_cachel);
2157 } face_cachel_dynarr; 1845 } face_cachel_dynarr;
2158 1846
2159 #ifdef NEW_GC 1847 #ifdef NEW_GC
2160 DECLARE_LRECORD (face_cachel_dynarr, face_cachel_dynarr); 1848 DECLARE_LISP_OBJECT (face_cachel_dynarr, face_cachel_dynarr);
2161 #define XFACE_CACHEL_DYNARR(x) \ 1849 #define XFACE_CACHEL_DYNARR(x) \
2162 XRECORD (x, face_cachel_dynarr, face_cachel_dynarr) 1850 XRECORD (x, face_cachel_dynarr, face_cachel_dynarr)
2163 #define wrap_face_cachel_dynarr(p) wrap_record (p, face_cachel_dynarr) 1851 #define wrap_face_cachel_dynarr(p) wrap_record (p, face_cachel_dynarr)
2164 #define FACE_CACHEL_DYNARRP(x) RECORDP (x, face_cachel_dynarr) 1852 #define FACE_CACHEL_DYNARRP(x) RECORDP (x, face_cachel_dynarr)
2165 #define CHECK_FACE_CACHEL_DYNARR(x) CHECK_RECORD (x, face_cachel_dynarr) 1853 #define CHECK_FACE_CACHEL_DYNARR(x) CHECK_RECORD (x, face_cachel_dynarr)
2170 { 1858 {
2171 Dynarr_declare (struct glyph_cachel); 1859 Dynarr_declare (struct glyph_cachel);
2172 } glyph_cachel_dynarr; 1860 } glyph_cachel_dynarr;
2173 1861
2174 #ifdef NEW_GC 1862 #ifdef NEW_GC
2175 DECLARE_LRECORD (glyph_cachel_dynarr, glyph_cachel_dynarr); 1863 DECLARE_LISP_OBJECT (glyph_cachel_dynarr, glyph_cachel_dynarr);
2176 #define XGLYPH_CACHEL_DYNARR(x) \ 1864 #define XGLYPH_CACHEL_DYNARR(x) \
2177 XRECORD (x, glyph_cachel_dynarr, glyph_cachel_dynarr) 1865 XRECORD (x, glyph_cachel_dynarr, glyph_cachel_dynarr)
2178 #define wrap_glyph_cachel_dynarr(p) wrap_record (p, glyph_cachel_dynarr) 1866 #define wrap_glyph_cachel_dynarr(p) wrap_record (p, glyph_cachel_dynarr)
2179 #define GLYPH_CACHEL_DYNARRP(x) RECORDP (x, glyph_cachel_dynarr) 1867 #define GLYPH_CACHEL_DYNARRP(x) RECORDP (x, glyph_cachel_dynarr)
2180 #define CHECK_GLYPH_CACHEL_DYNARR(x) CHECK_RECORD (x, glyph_cachel_dynarr) 1868 #define CHECK_GLYPH_CACHEL_DYNARR(x) CHECK_RECORD (x, glyph_cachel_dynarr)
2198 { 1886 {
2199 Dynarr_declare (Lisp_Object *); 1887 Dynarr_declare (Lisp_Object *);
2200 } Lisp_Object_ptr_dynarr; 1888 } Lisp_Object_ptr_dynarr;
2201 1889
2202 1890
2203 /************* Stack-like malloc/free: Another allocator *************/
2204
2205 void *stack_like_malloc (Bytecount size);
2206 void stack_like_free (void *val);
2207
2208
2209 /************************************************************************/ 1891 /************************************************************************/
2210 /** Definitions of other basic Lisp objects **/ 1892 /** Definitions of other basic Lisp objects **/
2211 /************************************************************************/ 1893 /************************************************************************/
2212 1894
2213 /*------------------------------ unbound -------------------------------*/ 1895 /*------------------------------ unbound -------------------------------*/
2231 1913
2232 /* In a cons, the markbit of the car is the gc mark bit */ 1914 /* In a cons, the markbit of the car is the gc mark bit */
2233 1915
2234 struct Lisp_Cons 1916 struct Lisp_Cons
2235 { 1917 {
2236 struct lrecord_header lheader; 1918 FROB_BLOCK_LISP_OBJECT_HEADER lheader;
2237 Lisp_Object car_, cdr_; 1919 Lisp_Object car_, cdr_;
2238 }; 1920 };
2239 typedef struct Lisp_Cons Lisp_Cons; 1921 typedef struct Lisp_Cons Lisp_Cons;
2240 1922
2241 #if 0 /* FSFmacs */ 1923 #if 0 /* FSFmacs */
2248 struct buffer *buffer; 1930 struct buffer *buffer;
2249 int charbpos; 1931 int charbpos;
2250 }; 1932 };
2251 #endif 1933 #endif
2252 1934
2253 DECLARE_MODULE_API_LRECORD (cons, Lisp_Cons); 1935 DECLARE_MODULE_API_LISP_OBJECT (cons, Lisp_Cons);
2254 #define XCONS(x) XRECORD (x, cons, Lisp_Cons) 1936 #define XCONS(x) XRECORD (x, cons, Lisp_Cons)
2255 #define wrap_cons(p) wrap_record (p, cons) 1937 #define wrap_cons(p) wrap_record (p, cons)
2256 #define CONSP(x) RECORDP (x, cons) 1938 #define CONSP(x) RECORDP (x, cons)
2257 #define CHECK_CONS(x) CHECK_RECORD (x, cons) 1939 #define CHECK_CONS(x) CHECK_RECORD (x, cons)
2258 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons) 1940 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons)
2437 Lisp_Object elt, tail, tortoise_##elt; \ 2119 Lisp_Object elt, tail, tortoise_##elt; \
2438 EMACS_INT len_##elt; \ 2120 EMACS_INT len_##elt; \
2439 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, tail, \ 2121 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, tail, \
2440 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH) 2122 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
2441 2123
2124 #define GC_EXTERNAL_LIST_LOOP_3(elt, list, tail) \
2125 do { \
2126 XGCDECL3 (elt); \
2127 Lisp_Object elt, tail, tortoise_##elt; \
2128 EMACS_INT len_##elt; \
2129 XGCPRO3 (elt, elt, tail, tortoise_##elt); \
2130 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, tail, \
2131 tortoise_##elt, \
2132 CIRCULAR_LIST_SUSPICION_LENGTH)
2133
2442 #define EXTERNAL_LIST_LOOP_4_NO_DECLARE(elt, list, tail, len) \ 2134 #define EXTERNAL_LIST_LOOP_4_NO_DECLARE(elt, list, tail, len) \
2443 Lisp_Object tortoise_##elt; \ 2135 Lisp_Object tortoise_##elt; \
2444 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \ 2136 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
2445 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH) 2137 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
2446 2138
2448 Lisp_Object elt, tail, tortoise_##elt; \ 2140 Lisp_Object elt, tail, tortoise_##elt; \
2449 EMACS_INT len; \ 2141 EMACS_INT len; \
2450 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \ 2142 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
2451 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH) 2143 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
2452 2144
2453 2145 #define GC_EXTERNAL_LIST_LOOP_4(elt, list, tail, len) \
2454 #define PRIVATE_EXTERNAL_LIST_LOOP_6(elt, list, len, hare, \ 2146 do { \
2455 tortoise, suspicion_length) \ 2147 XGCDECL3 (elt); \
2148 Lisp_Object elt, tail, tortoise_##elt; \
2149 XGCPRO3 (elt, elt, tail, tortoise_##elt); \
2150 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail, \
2151 tortoise_##elt, \
2152 CIRCULAR_LIST_SUSPICION_LENGTH)
2153
2154 #define PRIVATE_UNVERIFIED_LIST_LOOP_7(elt, list, len, hare, \
2155 tortoise, suspicion_length, \
2156 signalp) \
2456 for (tortoise = hare = list, len = 0; \ 2157 for (tortoise = hare = list, len = 0; \
2457 \ 2158 \
2458 (CONSP (hare) ? ((elt = XCAR (hare)), 1) : \ 2159 (CONSP (hare) ? ((elt = XCAR (hare)), 1) : \
2459 (NILP (hare) ? 0 : \ 2160 (NILP (hare) ? 0 : \
2460 (signal_malformed_list_error (list), 0))); \ 2161 ((signalp ? signal_malformed_list_error (list) : (void) 0), 0)));\
2461 \ 2162 \
2462 hare = XCDR (hare), \ 2163 hare = XCDR (hare), \
2463 (void) \ 2164 (void) \
2464 ((++len > suspicion_length) \ 2165 ((++len > suspicion_length) \
2465 && \ 2166 && \
2466 ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \ 2167 ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \
2467 (EQ (hare, tortoise) && (signal_circular_list_error (list), 0))))) 2168 (EQ (hare, tortoise) && \
2169 ((signalp ? signal_circular_list_error (list) : (void) 0), 0)))))
2170
2171 #define PRIVATE_EXTERNAL_LIST_LOOP_6(elt, list, len, hare, \
2172 tortoise, suspicion_length) \
2173 PRIVATE_UNVERIFIED_LIST_LOOP_7 (elt, list, len, hare, tortoise, \
2174 suspicion_length, 1)
2175
2176 #define PRIVATE_SAFE_LIST_LOOP_6(elt, list, len, hare, \
2177 tortoise, suspicion_length) \
2178 PRIVATE_UNVERIFIED_LIST_LOOP_7 (elt, list, len, hare, tortoise, \
2179 suspicion_length, 0)
2180
2181 /* Similar to EXTERNAL_LIST_LOOP_2() but don't signal when an error
2182 is detected, just stop. */
2183 #define SAFE_LIST_LOOP_2(elt, list) \
2184 Lisp_Object elt, hare_##elt, tortoise_##elt; \
2185 EMACS_INT len_##elt; \
2186 PRIVATE_SAFE_LIST_LOOP_6 (elt, list, len_##elt, hare_##elt, \
2187 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
2188
2189 #define SAFE_LIST_LOOP_3(elt, list, tail) \
2190 Lisp_Object elt, tail, tortoise_##elt; \
2191 EMACS_INT len_##elt; \
2192 PRIVATE_SAFE_LIST_LOOP_6 (elt, list, len_##elt, tail, \
2193 tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
2468 2194
2469 /* GET_LIST_LENGTH and GET_EXTERNAL_LIST_LENGTH: 2195 /* GET_LIST_LENGTH and GET_EXTERNAL_LIST_LENGTH:
2470 2196
2471 These two macros return the length of LIST (either an internal or external 2197 These two macros return the length of LIST (either an internal or external
2472 list, according to which macro is used), stored into LEN (which must 2198 list, according to which macro is used), stored into LEN (which must
2786 /*------------------------------ string --------------------------------*/ 2512 /*------------------------------ string --------------------------------*/
2787 2513
2788 #ifdef NEW_GC 2514 #ifdef NEW_GC
2789 struct Lisp_String_Direct_Data 2515 struct Lisp_String_Direct_Data
2790 { 2516 {
2791 struct lrecord_header header; 2517 NORMAL_LISP_OBJECT_HEADER header;
2792 Bytecount size; 2518 Bytecount size;
2793 Ibyte data[1]; 2519 Ibyte data[1];
2794 }; 2520 };
2795 typedef struct Lisp_String_Direct_Data Lisp_String_Direct_Data; 2521 typedef struct Lisp_String_Direct_Data Lisp_String_Direct_Data;
2796 2522
2797 DECLARE_MODULE_API_LRECORD (string_direct_data, Lisp_String_Direct_Data); 2523 DECLARE_MODULE_API_LISP_OBJECT (string_direct_data, Lisp_String_Direct_Data);
2798 #define XSTRING_DIRECT_DATA(x) \ 2524 #define XSTRING_DIRECT_DATA(x) \
2799 XRECORD (x, string_direct_data, Lisp_String_Direct_Data) 2525 XRECORD (x, string_direct_data, Lisp_String_Direct_Data)
2800 #define wrap_string_direct_data(p) wrap_record (p, string_direct_data) 2526 #define wrap_string_direct_data(p) wrap_record (p, string_direct_data)
2801 #define STRING_DIRECT_DATAP(x) RECORDP (x, string_direct_data) 2527 #define STRING_DIRECT_DATAP(x) RECORDP (x, string_direct_data)
2802 #define CHECK_STRING_DIRECT_DATA(x) CHECK_RECORD (x, string_direct_data) 2528 #define CHECK_STRING_DIRECT_DATA(x) CHECK_RECORD (x, string_direct_data)
2806 #define XSTRING_DIRECT_DATA_DATA(x) XSTRING_DIRECT_DATA (x)->data 2532 #define XSTRING_DIRECT_DATA_DATA(x) XSTRING_DIRECT_DATA (x)->data
2807 2533
2808 2534
2809 struct Lisp_String_Indirect_Data 2535 struct Lisp_String_Indirect_Data
2810 { 2536 {
2811 struct lrecord_header header; 2537 NORMAL_LISP_OBJECT_HEADER header;
2812 Bytecount size; 2538 Bytecount size;
2813 Ibyte *data; 2539 Ibyte *data;
2814 }; 2540 };
2815 typedef struct Lisp_String_Indirect_Data Lisp_String_Indirect_Data; 2541 typedef struct Lisp_String_Indirect_Data Lisp_String_Indirect_Data;
2816 2542
2817 DECLARE_MODULE_API_LRECORD (string_indirect_data, Lisp_String_Indirect_Data); 2543 DECLARE_MODULE_API_LISP_OBJECT (string_indirect_data, Lisp_String_Indirect_Data);
2818 #define XSTRING_INDIRECT_DATA(x) \ 2544 #define XSTRING_INDIRECT_DATA(x) \
2819 XRECORD (x, string_indirect_data, Lisp_String_Indirect_Data) 2545 XRECORD (x, string_indirect_data, Lisp_String_Indirect_Data)
2820 #define wrap_string_indirect_data(p) wrap_record (p, string_indirect_data) 2546 #define wrap_string_indirect_data(p) wrap_record (p, string_indirect_data)
2821 #define STRING_INDIRECT_DATAP(x) RECORDP (x, string_indirect_data) 2547 #define STRING_INDIRECT_DATAP(x) RECORDP (x, string_indirect_data)
2822 #define CHECK_STRING_INDIRECT_DATA(x) CHECK_RECORD (x, string_indirect_data) 2548 #define CHECK_STRING_INDIRECT_DATA(x) CHECK_RECORD (x, string_indirect_data)
2852 { 2578 {
2853 struct lrecord_header lheader; 2579 struct lrecord_header lheader;
2854 struct 2580 struct
2855 { 2581 {
2856 /* WARNING: Everything before ascii_begin must agree exactly with 2582 /* WARNING: Everything before ascii_begin must agree exactly with
2857 struct lrecord_header */ 2583 struct lrecord_header. (Actually, the `free' field in old-GC
2584 overlaps with ascii_begin there; we can get away with this
2585 because in old-GC the `free' field is used only for lcrecords. */
2858 unsigned int type :8; 2586 unsigned int type :8;
2859 #ifdef NEW_GC 2587 #ifdef NEW_GC
2860 unsigned int lisp_readonly :1; 2588 unsigned int lisp_readonly :1;
2861 unsigned int free :1; 2589 unsigned int free :1;
2862 /* Number of chars at beginning of string that are one byte in length 2590 /* Number of chars at beginning of string that are one byte in length
2887 #define MAX_STRING_ASCII_BEGIN ((1 << 22) - 1) 2615 #define MAX_STRING_ASCII_BEGIN ((1 << 22) - 1)
2888 #else /* not NEW_GC */ 2616 #else /* not NEW_GC */
2889 #define MAX_STRING_ASCII_BEGIN ((1 << 21) - 1) 2617 #define MAX_STRING_ASCII_BEGIN ((1 << 21) - 1)
2890 #endif /* not NEW_GC */ 2618 #endif /* not NEW_GC */
2891 2619
2892 DECLARE_MODULE_API_LRECORD (string, Lisp_String); 2620 DECLARE_MODULE_API_LISP_OBJECT (string, Lisp_String);
2893 #define XSTRING(x) XRECORD (x, string, Lisp_String) 2621 #define XSTRING(x) XRECORD (x, string, Lisp_String)
2894 #define wrap_string(p) wrap_record (p, string) 2622 #define wrap_string(p) wrap_record (p, string)
2895 #define STRINGP(x) RECORDP (x, string) 2623 #define STRINGP(x) RECORDP (x, string)
2896 #define CHECK_STRING(x) CHECK_RECORD (x, string) 2624 #define CHECK_STRING(x) CHECK_RECORD (x, string)
2897 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string) 2625 #define CONCHECK_STRING(x) CONCHECK_RECORD (x, string)
2960 2688
2961 /*------------------------------ vector --------------------------------*/ 2689 /*------------------------------ vector --------------------------------*/
2962 2690
2963 struct Lisp_Vector 2691 struct Lisp_Vector
2964 { 2692 {
2965 struct LCRECORD_HEADER header; 2693 NORMAL_LISP_OBJECT_HEADER header;
2966 long size; 2694 long size;
2967 Lisp_Object contents[1]; 2695 Lisp_Object contents[1];
2968 }; 2696 };
2969 typedef struct Lisp_Vector Lisp_Vector; 2697 typedef struct Lisp_Vector Lisp_Vector;
2970 2698
2971 DECLARE_LRECORD (vector, Lisp_Vector); 2699 DECLARE_LISP_OBJECT (vector, Lisp_Vector);
2972 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector) 2700 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector)
2973 #define wrap_vector(p) wrap_record (p, vector) 2701 #define wrap_vector(p) wrap_record (p, vector)
2974 #define VECTORP(x) RECORDP (x, vector) 2702 #define VECTORP(x) RECORDP (x, vector)
2975 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector) 2703 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector)
2976 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector) 2704 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector)
2997 #error You really have 128-bit integers?! 2725 #error You really have 128-bit integers?!
2998 #endif 2726 #endif
2999 2727
3000 struct Lisp_Bit_Vector 2728 struct Lisp_Bit_Vector
3001 { 2729 {
3002 struct LCRECORD_HEADER lheader; 2730 NORMAL_LISP_OBJECT_HEADER lheader;
3003 Elemcount size; 2731 Elemcount size;
3004 unsigned long bits[1]; 2732 unsigned long bits[1];
3005 }; 2733 };
3006 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector; 2734 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector;
3007 2735
3008 DECLARE_LRECORD (bit_vector, Lisp_Bit_Vector); 2736 DECLARE_LISP_OBJECT (bit_vector, Lisp_Bit_Vector);
3009 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector) 2737 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector)
3010 #define wrap_bit_vector(p) wrap_record (p, bit_vector) 2738 #define wrap_bit_vector(p) wrap_record (p, bit_vector)
3011 #define BIT_VECTORP(x) RECORDP (x, bit_vector) 2739 #define BIT_VECTORP(x) RECORDP (x, bit_vector)
3012 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector) 2740 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector)
3013 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector) 2741 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector)
3051 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2) 2779 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2)
3052 2780
3053 /* For when we want to include a bit vector in another structure, and we 2781 /* For when we want to include a bit vector in another structure, and we
3054 know it's of a fixed size. */ 2782 know it's of a fixed size. */
3055 #define DECLARE_INLINE_LISP_BIT_VECTOR(numbits) struct { \ 2783 #define DECLARE_INLINE_LISP_BIT_VECTOR(numbits) struct { \
3056 struct LCRECORD_HEADER lheader; \ 2784 NORMAL_LISP_OBJECT_HEADER lheader; \
3057 Elemcount size; \ 2785 Elemcount size; \
3058 unsigned long bits[BIT_VECTOR_LONG_STORAGE(numbits)]; \ 2786 unsigned long bits[BIT_VECTOR_LONG_STORAGE(numbits)]; \
3059 } 2787 }
3060 /*---------------------- array, sequence -----------------------------*/ 2788 /*---------------------- array, sequence -----------------------------*/
3061 2789
3086 /*------------------------------ symbol --------------------------------*/ 2814 /*------------------------------ symbol --------------------------------*/
3087 2815
3088 typedef struct Lisp_Symbol Lisp_Symbol; 2816 typedef struct Lisp_Symbol Lisp_Symbol;
3089 struct Lisp_Symbol 2817 struct Lisp_Symbol
3090 { 2818 {
3091 struct lrecord_header lheader; 2819 FROB_BLOCK_LISP_OBJECT_HEADER lheader;
3092 /* next symbol in this obarray bucket */ 2820 /* next symbol in this obarray bucket */
3093 Lisp_Symbol *next; 2821 Lisp_Symbol *next;
3094 Lisp_Object name; 2822 Lisp_Object name;
3095 Lisp_Object value; 2823 Lisp_Object value;
3096 Lisp_Object function; 2824 Lisp_Object function;
3102 && EQ (sym, oblookup (Vobarray, \ 2830 && EQ (sym, oblookup (Vobarray, \
3103 XSTRING_DATA (symbol_name (XSYMBOL (sym))), \ 2831 XSTRING_DATA (symbol_name (XSYMBOL (sym))), \
3104 XSTRING_LENGTH (symbol_name (XSYMBOL (sym)))))) 2832 XSTRING_LENGTH (symbol_name (XSYMBOL (sym))))))
3105 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj)) 2833 #define KEYWORDP(obj) (SYMBOLP (obj) && SYMBOL_IS_KEYWORD (obj))
3106 2834
3107 DECLARE_MODULE_API_LRECORD (symbol, Lisp_Symbol); 2835 DECLARE_MODULE_API_LISP_OBJECT (symbol, Lisp_Symbol);
3108 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol) 2836 #define XSYMBOL(x) XRECORD (x, symbol, Lisp_Symbol)
3109 #define wrap_symbol(p) wrap_record (p, symbol) 2837 #define wrap_symbol(p) wrap_record (p, symbol)
3110 #define SYMBOLP(x) RECORDP (x, symbol) 2838 #define SYMBOLP(x) RECORDP (x, symbol)
3111 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol) 2839 #define CHECK_SYMBOL(x) CHECK_RECORD (x, symbol)
3112 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol) 2840 #define CONCHECK_SYMBOL(x) CONCHECK_RECORD (x, symbol)
3130 We could define such types for n arguments, if needed. */ 2858 We could define such types for n arguments, if needed. */
3131 typedef Lisp_Object (*lisp_fn_t) (void); 2859 typedef Lisp_Object (*lisp_fn_t) (void);
3132 2860
3133 struct Lisp_Subr 2861 struct Lisp_Subr
3134 { 2862 {
3135 struct lrecord_header lheader; 2863 FROB_BLOCK_LISP_OBJECT_HEADER lheader;
3136 short min_args; 2864 short min_args;
3137 short max_args; 2865 short max_args;
3138 /* #### We should make these const Ascbyte * or const Ibyte *, not const 2866 /* #### We should make these const Ascbyte * or const Ibyte *, not const
3139 char *. */ 2867 char *. */
3140 const char *prompt; 2868 const char *prompt;
3142 const char *name; 2870 const char *name;
3143 lisp_fn_t subr_fn; 2871 lisp_fn_t subr_fn;
3144 }; 2872 };
3145 typedef struct Lisp_Subr Lisp_Subr; 2873 typedef struct Lisp_Subr Lisp_Subr;
3146 2874
3147 DECLARE_LRECORD (subr, Lisp_Subr); 2875 DECLARE_LISP_OBJECT (subr, Lisp_Subr);
3148 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr) 2876 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr)
3149 #define wrap_subr(p) wrap_record (p, subr) 2877 #define wrap_subr(p) wrap_record (p, subr)
3150 #define SUBRP(x) RECORDP (x, subr) 2878 #define SUBRP(x) RECORDP (x, subr)
3151 #define CHECK_SUBR(x) CHECK_RECORD (x, subr) 2879 #define CHECK_SUBR(x) CHECK_RECORD (x, subr)
3152 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr) 2880 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr)
3160 2888
3161 2889
3162 typedef struct Lisp_Marker Lisp_Marker; 2890 typedef struct Lisp_Marker Lisp_Marker;
3163 struct Lisp_Marker 2891 struct Lisp_Marker
3164 { 2892 {
3165 struct lrecord_header lheader; 2893 FROB_BLOCK_LISP_OBJECT_HEADER lheader;
3166 Lisp_Marker *next; 2894 Lisp_Marker *next;
3167 Lisp_Marker *prev; 2895 Lisp_Marker *prev;
3168 struct buffer *buffer; 2896 struct buffer *buffer;
3169 Membpos membpos; 2897 Membpos membpos;
3170 char insertion_type; 2898 char insertion_type;
3171 }; 2899 };
3172 2900
3173 DECLARE_MODULE_API_LRECORD (marker, Lisp_Marker); 2901 DECLARE_MODULE_API_LISP_OBJECT (marker, Lisp_Marker);
3174 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker) 2902 #define XMARKER(x) XRECORD (x, marker, Lisp_Marker)
3175 #define wrap_marker(p) wrap_record (p, marker) 2903 #define wrap_marker(p) wrap_record (p, marker)
3176 #define MARKERP(x) RECORDP (x, marker) 2904 #define MARKERP(x) RECORDP (x, marker)
3177 #define CHECK_MARKER(x) CHECK_RECORD (x, marker) 2905 #define CHECK_MARKER(x) CHECK_RECORD (x, marker)
3178 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker) 2906 #define CONCHECK_MARKER(x) CONCHECK_RECORD (x, marker)
3179 2907
3180 /* The second check was looking for GCed markers still in use */ 2908 /* The second check was looking for GCed markers still in use */
3181 /* if (INTP (XMARKER (x)->lheader.next.v)) ABORT (); */ 2909 /* assert (!INTP (XMARKER (x)->lheader.next.v)); */
3182 2910
3183 #define marker_next(m) ((m)->next) 2911 #define marker_next(m) ((m)->next)
3184 #define marker_prev(m) ((m)->prev) 2912 #define marker_prev(m) ((m)->prev)
3185 2913
3186 /*-------------------basic int (no connection to char)------------------*/ 2914 /*-------------------basic int (no connection to char)------------------*/
3198 { 2926 {
3199 assert_at_line (INTP (obj), file, line); 2927 assert_at_line (INTP (obj), file, line);
3200 return XREALINT (obj); 2928 return XREALINT (obj);
3201 } 2929 }
3202 2930
3203 #else /* no error checking */ 2931 #else /* not ERROR_CHECK_TYPES */
3204 2932
3205 #define XINT(obj) XREALINT (obj) 2933 #define XINT(obj) XREALINT (obj)
3206 2934
3207 #endif /* no error checking */ 2935 #endif /* (not) ERROR_CHECK_TYPES */
3208 2936
3209 #define CHECK_INT(x) do { \ 2937 #define CHECK_INT(x) do { \
3210 if (!INTP (x)) \ 2938 if (!INTP (x)) \
3211 dead_wrong_type_argument (Qintegerp, x); \ 2939 dead_wrong_type_argument (Qfixnump, x); \
3212 } while (0) 2940 } while (0)
3213 2941
3214 #define CONCHECK_INT(x) do { \ 2942 #define CONCHECK_INT(x) do { \
3215 if (!INTP (x)) \ 2943 if (!INTP (x)) \
3216 x = wrong_type_argument (Qintegerp, x); \ 2944 x = wrong_type_argument (Qfixnump, x); \
3217 } while (0) 2945 } while (0)
3218 2946
3219 #define NATNUMP(x) (INTP (x) && XINT (x) >= 0) 2947 END_C_DECLS
3220 2948
3221 #define CHECK_NATNUM(x) do { \ 2949 /* -------------- properties of internally-formatted text ------------- */
3222 if (!NATNUMP (x)) \ 2950
3223 dead_wrong_type_argument (Qnatnump, x); \ 2951 #include "text.h"
3224 } while (0)
3225
3226 #define CONCHECK_NATNUM(x) do { \
3227 if (!NATNUMP (x)) \
3228 x = wrong_type_argument (Qnatnump, x); \
3229 } while (0)
3230 2952
3231 /*------------------------------- char ---------------------------------*/ 2953 /*------------------------------- char ---------------------------------*/
2954
2955 BEGIN_C_DECLS
2956
2957 #ifdef ERROR_CHECK_TYPES
3232 2958
3233 /* NOTE: There are basic functions for converting between a character and 2959 /* NOTE: There are basic functions for converting between a character and
3234 the string representation of a character in text.h, as well as lots of 2960 the string representation of a character in text.h, as well as lots of
3235 other character-related stuff. There are other functions/macros for 2961 other character-related stuff. There are other functions/macros for
3236 working with Ichars in charset.h, for retrieving the charset of an 2962 working with Ichars in charset.h, for retrieving the charset of an
3237 Ichar, the length of an Ichar when converted to text, etc. 2963 Ichar, the length of an Ichar when converted to text, etc.
3238 */ 2964 */
3239
3240 #ifdef MULE
3241
3242 MODULE_API int non_ascii_valid_ichar_p (Ichar ch);
3243
3244 /* Return whether the given Ichar is valid.
3245 */
3246
3247 DECLARE_INLINE_HEADER (
3248 int
3249 valid_ichar_p (Ichar ch)
3250 )
3251 {
3252 return (! (ch & ~0xFF)) || non_ascii_valid_ichar_p (ch);
3253 }
3254
3255 #else /* not MULE */
3256
3257 /* This works when CH is negative, and correctly returns non-zero only when CH
3258 is in the range [0, 255], inclusive. */
3259 #define valid_ichar_p(ch) (! (ch & ~0xFF))
3260
3261 #endif /* not MULE */
3262
3263 #ifdef ERROR_CHECK_TYPES
3264 2965
3265 DECLARE_INLINE_HEADER ( 2966 DECLARE_INLINE_HEADER (
3266 int 2967 int
3267 CHARP_1 (Lisp_Object obj, const Ascbyte *file, int line) 2968 CHARP_1 (Lisp_Object obj, const Ascbyte *file, int line)
3268 ) 2969 )
3414 free list. This makes a difference in the unlikely case of 3115 free list. This makes a difference in the unlikely case of
3415 sizeof(double) being smaller than sizeof(void *). */ 3116 sizeof(double) being smaller than sizeof(void *). */
3416 3117
3417 struct Lisp_Float 3118 struct Lisp_Float
3418 { 3119 {
3419 struct lrecord_header lheader; 3120 FROB_BLOCK_LISP_OBJECT_HEADER lheader;
3420 union { double d; struct Lisp_Float *unused_next_; } data; 3121 union { double d; struct Lisp_Float *unused_next_; } data;
3421 }; 3122 };
3422 typedef struct Lisp_Float Lisp_Float; 3123 typedef struct Lisp_Float Lisp_Float;
3423 3124
3424 DECLARE_LRECORD (float, Lisp_Float); 3125 DECLARE_LISP_OBJECT (float, Lisp_Float);
3425 #define XFLOAT(x) XRECORD (x, float, Lisp_Float) 3126 #define XFLOAT(x) XRECORD (x, float, Lisp_Float)
3426 #define wrap_float(p) wrap_record (p, float) 3127 #define wrap_float(p) wrap_record (p, float)
3427 #define FLOATP(x) RECORDP (x, float) 3128 #define FLOATP(x) RECORDP (x, float)
3428 #define CHECK_FLOAT(x) CHECK_RECORD (x, float) 3129 #define CHECK_FLOAT(x) CHECK_RECORD (x, float)
3429 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float) 3130 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float)
3442 if (!INT_OR_FLOATP (x)) \ 3143 if (!INT_OR_FLOATP (x)) \
3443 x = wrong_type_argument (Qnumberp, x); \ 3144 x = wrong_type_argument (Qnumberp, x); \
3444 } while (0) 3145 } while (0)
3445 3146
3446 # define INT_OR_FLOATP(x) (INTP (x) || FLOATP (x)) 3147 # define INT_OR_FLOATP(x) (INTP (x) || FLOATP (x))
3148
3149 /* #### change for 64-bit machines */
3150 #define FLOAT_HASHCODE_FROM_DOUBLE(dbl) \
3151 (unsigned long)(fmod (dbl, 4e9))
3447 3152
3448 /*--------------------------- readonly objects -------------------------*/ 3153 /*--------------------------- readonly objects -------------------------*/
3449 3154
3450 #ifndef NEW_GC 3155 #ifndef NEW_GC
3451 #define CHECK_C_WRITEABLE(obj) \ 3156 #define CHECK_C_WRITEABLE(obj) \
3502 3207
3503 /*---------------------------- weak boxes ------------------------------*/ 3208 /*---------------------------- weak boxes ------------------------------*/
3504 3209
3505 struct weak_box 3210 struct weak_box
3506 { 3211 {
3507 struct LCRECORD_HEADER header; 3212 NORMAL_LISP_OBJECT_HEADER header;
3508 Lisp_Object value; 3213 Lisp_Object value;
3509 3214
3510 Lisp_Object next_weak_box; /* don't mark through this! */ 3215 Lisp_Object next_weak_box; /* don't mark through this! */
3511 }; 3216 };
3512 3217
3513 void prune_weak_boxes (void); 3218 void prune_weak_boxes (void);
3514 Lisp_Object make_weak_box (Lisp_Object value); 3219 Lisp_Object make_weak_box (Lisp_Object value);
3515 Lisp_Object weak_box_ref (Lisp_Object value); 3220 Lisp_Object weak_box_ref (Lisp_Object value);
3516 3221
3517 DECLARE_LRECORD (weak_box, struct weak_box); 3222 DECLARE_LISP_OBJECT (weak_box, struct weak_box);
3518 #define XWEAK_BOX(x) XRECORD (x, weak_box, struct weak_box) 3223 #define XWEAK_BOX(x) XRECORD (x, weak_box, struct weak_box)
3519 #define XSET_WEAK_BOX(x, v) (XWEAK_BOX (x)->value = (v)) 3224 #define XSET_WEAK_BOX(x, v) (XWEAK_BOX (x)->value = (v))
3520 #define wrap_weak_box(p) wrap_record (p, weak_box) 3225 #define wrap_weak_box(p) wrap_record (p, weak_box)
3521 #define WEAK_BOXP(x) RECORDP (x, weak_box) 3226 #define WEAK_BOXP(x) RECORDP (x, weak_box)
3522 #define CHECK_WEAK_BOX(x) CHECK_RECORD (x, weak_box) 3227 #define CHECK_WEAK_BOX(x) CHECK_RECORD (x, weak_box)
3524 3229
3525 /*--------------------------- ephemerons ----------------------------*/ 3230 /*--------------------------- ephemerons ----------------------------*/
3526 3231
3527 struct ephemeron 3232 struct ephemeron
3528 { 3233 {
3529 struct LCRECORD_HEADER header; 3234 NORMAL_LISP_OBJECT_HEADER header;
3530 3235
3531 Lisp_Object key; 3236 Lisp_Object key;
3532 3237
3533 /* This field holds a pair. The cdr of this cons points to the next 3238 /* This field holds a pair. The cdr of this cons points to the next
3534 ephemeron in Vall_ephemerons. The car points to another pair 3239 ephemeron in Vall_ephemerons. The car points to another pair
3549 int continue_marking_ephemerons(void); 3254 int continue_marking_ephemerons(void);
3550 int finish_marking_ephemerons(void); 3255 int finish_marking_ephemerons(void);
3551 Lisp_Object zap_finalize_list(void); 3256 Lisp_Object zap_finalize_list(void);
3552 Lisp_Object make_ephemeron(Lisp_Object key, Lisp_Object value, Lisp_Object finalizer); 3257 Lisp_Object make_ephemeron(Lisp_Object key, Lisp_Object value, Lisp_Object finalizer);
3553 3258
3554 DECLARE_LRECORD(ephemeron, struct ephemeron); 3259 DECLARE_LISP_OBJECT(ephemeron, struct ephemeron);
3555 #define XEPHEMERON(x) XRECORD (x, ephemeron, struct ephemeron) 3260 #define XEPHEMERON(x) XRECORD (x, ephemeron, struct ephemeron)
3556 #define XEPHEMERON_REF(x) (XEPHEMERON (x)->value) 3261 #define XEPHEMERON_REF(x) (XEPHEMERON (x)->value)
3557 #define XEPHEMERON_NEXT(x) (XCDR (XEPHEMERON(x)->cons_chain)) 3262 #define XEPHEMERON_NEXT(x) (XCDR (XEPHEMERON(x)->cons_chain))
3558 #define XEPHEMERON_FINALIZER(x) (XCDR (XCAR (XEPHEMERON (x)->cons_chain))) 3263 #define XEPHEMERON_FINALIZER(x) (XCDR (XCAR (XEPHEMERON (x)->cons_chain)))
3559 #define XSET_EPHEMERON_NEXT(x, n) (XSETCDR (XEPHEMERON(x)->cons_chain, n)) 3264 #define XSET_EPHEMERON_NEXT(x, n) (XSETCDR (XEPHEMERON(x)->cons_chain, n))
3583 WEAK_LIST_FULL_ASSOC 3288 WEAK_LIST_FULL_ASSOC
3584 }; 3289 };
3585 3290
3586 struct weak_list 3291 struct weak_list
3587 { 3292 {
3588 struct LCRECORD_HEADER header; 3293 NORMAL_LISP_OBJECT_HEADER header;
3589 Lisp_Object list; /* don't mark through this! */ 3294 Lisp_Object list; /* don't mark through this! */
3590 enum weak_list_type type; 3295 enum weak_list_type type;
3591 Lisp_Object next_weak; /* don't mark through this! */ 3296 Lisp_Object next_weak; /* don't mark through this! */
3592 }; 3297 };
3593 3298
3594 DECLARE_LRECORD (weak_list, struct weak_list); 3299 DECLARE_LISP_OBJECT (weak_list, struct weak_list);
3595 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list) 3300 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list)
3596 #define wrap_weak_list(p) wrap_record (p, weak_list) 3301 #define wrap_weak_list(p) wrap_record (p, weak_list)
3597 #define WEAK_LISTP(x) RECORDP (x, weak_list) 3302 #define WEAK_LISTP(x) RECORDP (x, weak_list)
3598 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list) 3303 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list)
3599 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list) 3304 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list)
3605 /* The following two are only called by the garbage collector */ 3310 /* The following two are only called by the garbage collector */
3606 int finish_marking_weak_lists (void); 3311 int finish_marking_weak_lists (void);
3607 void prune_weak_lists (void); 3312 void prune_weak_lists (void);
3608 3313
3609 END_C_DECLS 3314 END_C_DECLS
3610
3611 /************************************************************************/
3612 /* Definitions related to the format of text and of characters */
3613 /************************************************************************/
3614
3615 /* Note:
3616
3617 "internally formatted text" and the term "internal format" in
3618 general are likely to refer to the format of text in buffers and
3619 strings; "externally formatted text" and the term "external format"
3620 refer to any text format used in the O.S. or elsewhere outside of
3621 XEmacs. The format of text and of a character are related and
3622 there must be a one-to-one relationship (hopefully through a
3623 relatively simple algorithmic means of conversion) between a string
3624 of text and an equivalent array of characters, but the conversion
3625 between the two is NOT necessarily trivial.
3626
3627 In a non-Mule XEmacs, allowed characters are numbered 0 through
3628 255, where no fixed meaning is assigned to them, but (when
3629 representing text, rather than bytes in a binary file) in practice
3630 the lower half represents ASCII and the upper half some other 8-bit
3631 character set (chosen by setting the font, case tables, syntax
3632 tables, etc. appropriately for the character set through ad-hoc
3633 means such as the `iso-8859-1' file and the
3634 `standard-display-european' function).
3635
3636 #### Finish this.
3637
3638 */
3639 #include "text.h"
3640
3641 3315
3642 /************************************************************************/ 3316 /************************************************************************/
3643 /* Definitions of primitive Lisp functions and variables */ 3317 /* Definitions of primitive Lisp functions and variables */
3644 /************************************************************************/ 3318 /************************************************************************/
3645 3319
3733 (lisp_fn_t) Fname \ 3407 (lisp_fn_t) Fname \
3734 }; \ 3408 }; \
3735 static struct Lisp_Subr *S##Fname; \ 3409 static struct Lisp_Subr *S##Fname; \
3736 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist) 3410 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist)
3737 #define GET_DEFUN_LISP_OBJECT(Fname) \ 3411 #define GET_DEFUN_LISP_OBJECT(Fname) \
3738 wrap_subr (S##Fname); 3412 wrap_subr (&MC_ALLOC_S##Fname)
3739 #else /* not NEW_GC */ 3413 #else /* not NEW_GC */
3740 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \ 3414 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \
3741 Lisp_Object Fname (EXFUN_##max_args); \ 3415 Lisp_Object Fname (EXFUN_##max_args); \
3742 static struct Lisp_Subr S##Fname = \ 3416 static struct Lisp_Subr S##Fname = \
3743 { \ 3417 { \
3744 { /* struct lrecord_header */ \ 3418 { /* struct lrecord_header */ \
3745 lrecord_type_subr, /* lrecord_type_index */ \ 3419 lrecord_type_subr, /* lrecord_type_index */ \
3746 1, /* mark bit */ \ 3420 1, /* mark bit */ \
3747 1, /* c_readonly bit */ \ 3421 1, /* c_readonly bit */ \
3748 1, /* lisp_readonly bit */ \ 3422 1, /* lisp_readonly bit */ \
3749 0 /* unused */ \
3750 }, \ 3423 }, \
3751 min_args, \ 3424 min_args, \
3752 max_args, \ 3425 max_args, \
3753 prompt, \ 3426 prompt, \
3754 0, /* doc string */ \ 3427 0, /* doc string */ \
3764 { /* struct lrecord_header */ \ 3437 { /* struct lrecord_header */ \
3765 lrecord_type_subr, /* lrecord_type_index */ \ 3438 lrecord_type_subr, /* lrecord_type_index */ \
3766 1, /* mark bit */ \ 3439 1, /* mark bit */ \
3767 1, /* c_readonly bit */ \ 3440 1, /* c_readonly bit */ \
3768 1, /* lisp_readonly bit */ \ 3441 1, /* lisp_readonly bit */ \
3769 0 /* unused */ \
3770 }, \ 3442 }, \
3771 min_args, \ 3443 min_args, \
3772 max_args, \ 3444 max_args, \
3773 prompt, \ 3445 prompt, \
3774 0, /* doc string */ \ 3446 0, /* doc string */ \
3775 lname, \ 3447 lname, \
3776 (lisp_fn_t) Fname \ 3448 (lisp_fn_t) Fname \
3777 }; \ 3449 }; \
3778 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist) 3450 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist)
3779 #define GET_DEFUN_LISP_OBJECT(Fname) \ 3451 #define GET_DEFUN_LISP_OBJECT(Fname) \
3780 wrap_subr (&S##Fname); 3452 wrap_subr (&S##Fname)
3781 #endif /* not NEW_GC */ 3453 #endif /* not NEW_GC */
3782 3454
3783 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a 3455 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a
3784 prototype that matches max_args, and add the obligatory 3456 prototype that matches max_args, and add the obligatory
3785 `Lisp_Object' type declaration to the formal C arguments. */ 3457 `Lisp_Object' type declaration to the formal C arguments. */
3819 3491
3820 #define CHECK_FUNCTION(fun) do { \ 3492 #define CHECK_FUNCTION(fun) do { \
3821 while (NILP (Ffunctionp (fun))) \ 3493 while (NILP (Ffunctionp (fun))) \
3822 signal_invalid_function_error (fun); \ 3494 signal_invalid_function_error (fun); \
3823 } while (0) 3495 } while (0)
3496
3497 /************************************************************************/
3498 /* Parsing keyword arguments */
3499 /************************************************************************/
3500
3501 /* The C subr must have been declared with MANY as its max args, and this
3502 PARSE_KEYWORDS call must come before any statements. Equivalently, it
3503 can appear within braces.
3504
3505 FUNCTION is the C name of the current DEFUN. If there is no current
3506 DEFUN, use the PARSE_KEYWORDS_8 macro, not PARSE_KEYWORDS. If the
3507 current DEFUN has optional arguments that are not keywords, you also need
3508 to use the PARSE_KEYWORDS_8 macro. This is also the case if there are
3509 optional arguments that come before the keywords, as Common Lisp
3510 specifies for #'parse-integer.
3511
3512 NARGS is the count of arguments supplied to FUNCTION.
3513
3514 ARGS is a pointer to the argument vector (not a Lisp vector) supplied to
3515 FUNCTION.
3516
3517 KEYWORD_COUNT is the number of keywords FUNCTION is normally prepared to
3518 handle.
3519
3520 KEYWORDS is a parenthesised list of those keywords, without the initial
3521 Q_.
3522
3523 KEYWORD_DEFAULTS allows you to set non-nil defaults. Put (keywordname =
3524 initial_value) in this parameter, a collection of C statements surrounded
3525 by parentheses and separated by the comma operator. If you don't need
3526 this, supply NULL as KEYWORD_DEFAULTS.
3527
3528 For keywords which appear multiple times in the called argument list, the
3529 leftmost one overrides, as specified in section 7.1.1 of the CLHS.
3530
3531 If you want to check whether a given keyword argument was set (as in the
3532 SVAR argument to defun*), supply Qunbound as its default in
3533 KEYWORD_DEFAULTS, and examine it once PARSE_KEYWORDS is done. Lisp code
3534 cannot supply Qunbound as an argument, so if it is still Qunbound, it was
3535 not set.
3536
3537 There is no elegant way with this macro to have one name for the keyword
3538 and an unrelated name for the local variable, as is possible with the
3539 ((:keyword unrelated-var)) syntax in defun* and in Common Lisp. That
3540 shouldn't matter in practice. */
3541 #if defined (DEBUG_XEMACS) && defined (__STDC_VERSION__) && \
3542 __STDC_VERSION__ >= 199901L
3543
3544 /* This version has the advantage that DEFUN without DEFSUBR still provokes
3545 a defined but not used warning, and it provokes an assertion failure at
3546 runtime if someone has copied and pasted the PARSE_KEYWORDS macro from
3547 another function without changing FUNCTION; that would lead to an
3548 incorrect determination of KEYWORDS_OFFSET. */
3549
3550 #define PARSE_KEYWORDS(function, nargs, args, keyword_count, keywords, \
3551 keyword_defaults) \
3552 PARSE_KEYWORDS_8 (intern_massaging_name (1 + #function), nargs, args, \
3553 keyword_count, keywords, keyword_defaults, \
3554 /* Can't XSUBR (Fsymbol_function (...))->min_args, \
3555 the function may be advised. */ \
3556 XINT (Ffunction_min_args \
3557 (intern_massaging_name (1 + #function))), \
3558 0); \
3559 assert (0 == strcmp (__func__, #function))
3560 #else /* defined (DEBUG_XEMACS) && ... */
3561 #define PARSE_KEYWORDS(function, nargs, args, keyword_count, keywords, \
3562 keyword_defaults) \
3563 PARSE_KEYWORDS_8 (intern (subr_name (XSUBR \
3564 (GET_DEFUN_LISP_OBJECT (function)))), \
3565 nargs, args, keyword_count, keywords, \
3566 keyword_defaults, \
3567 XSUBR (GET_DEFUN_LISP_OBJECT (function))->min_args, \
3568 0)
3569 #endif /* defined (DEBUG_XEMACS) && defined (__STDC_VERSION__) ... */
3570
3571 /* PARSE_KEYWORDS_8 is a more fine-grained version of PARSE_KEYWORDS. The
3572 differences are as follows:
3573
3574 FUNC_SYM is a symbol reflecting the name of the function for which
3575 keywords are being parsed. In PARSE_KEYWORDS, it is the Lisp-visible
3576 name of C_FUNC, interned as a symbol in obarray.
3577
3578 KEYWORDS_OFFSET is the offset into ARGS where the keyword arguments
3579 start. In PARSE_KEYWORDS, this is the index of the first optional
3580 argument, determined from the information known about C_FUNC.
3581
3582 ALLOW_OTHER_KEYS corresponds to the &allow-other-keys argument list entry
3583 in defun*; it is 1 if other keys are normally allowed, 0 otherwise. This
3584 may be overridden in the caller by specifying :allow-other-keys t in the
3585 argument list. In PARSE_KEYWORDS, ALLOW_OTHER_KEYS is always 0. */
3586
3587 #define PARSE_KEYWORDS_8(func_sym, nargs, args, \
3588 keyword_count, keywords, keyword_defaults, \
3589 keywords_offset, allow_other_keys) \
3590 DECLARE_N_KEYWORDS_##keyword_count keywords; \
3591 \
3592 do \
3593 { \
3594 Lisp_Object pk_key, pk_value; \
3595 Elemcount pk_i = nargs - 1, pk_offset = keywords_offset; \
3596 Boolint pk_allow_other_keys = allow_other_keys; \
3597 \
3598 if ((nargs - pk_offset) & 1) \
3599 { \
3600 if (!allow_other_keys \
3601 && !(pk_allow_other_keys \
3602 = non_nil_allow_other_keys_p (pk_offset, \
3603 nargs, args))) \
3604 { \
3605 signal_wrong_number_of_arguments_error (func_sym, nargs); \
3606 } \
3607 else \
3608 { \
3609 /* Ignore the trailing arg; so below always sees an even \
3610 number of arguments. */ \
3611 pk_i -= 1; \
3612 } \
3613 } \
3614 \
3615 (void)(keyword_defaults); \
3616 \
3617 /* Start from the end, because the leftmost element overrides. */ \
3618 while (pk_i > pk_offset) \
3619 { \
3620 pk_value = args[pk_i--]; \
3621 pk_key = args[pk_i--]; \
3622 \
3623 if (0) {} \
3624 CHECK_N_KEYWORDS_##keyword_count keywords \
3625 else if (allow_other_keys || pk_allow_other_keys) \
3626 { \
3627 continue; \
3628 } \
3629 else if ((pk_allow_other_keys \
3630 = non_nil_allow_other_keys_p (pk_offset, \
3631 nargs, args))) \
3632 { \
3633 continue; \
3634 } \
3635 else if (EQ (pk_key, Q_allow_other_keys) && \
3636 NILP (pk_value)) \
3637 { \
3638 continue; \
3639 } \
3640 else \
3641 { \
3642 invalid_keyword_argument (func_sym, pk_key); \
3643 } \
3644 } \
3645 } while (0)
3646
3647 #define DECLARE_N_KEYWORDS_1(a) \
3648 Lisp_Object a = Qnil
3649 #define DECLARE_N_KEYWORDS_2(a,b) \
3650 DECLARE_N_KEYWORDS_1(a), b = Qnil
3651 #define DECLARE_N_KEYWORDS_3(a,b,c) \
3652 DECLARE_N_KEYWORDS_2(a,b), c = Qnil
3653 #define DECLARE_N_KEYWORDS_4(a,b,c,d) \
3654 DECLARE_N_KEYWORDS_3(a,b,c), d = Qnil
3655 #define DECLARE_N_KEYWORDS_5(a,b,c,d,e) \
3656 DECLARE_N_KEYWORDS_4(a,b,c,d), e = Qnil
3657 #define DECLARE_N_KEYWORDS_6(a,b,c,d,e,f) \
3658 DECLARE_N_KEYWORDS_5(a,b,c,d,e), f = Qnil
3659 #define DECLARE_N_KEYWORDS_7(a,b,c,d,e,f,g) \
3660 DECLARE_N_KEYWORDS_6(a,b,c,d,e,f), g = Qnil
3661 #define DECLARE_N_KEYWORDS_8(a,b,c,d,e,f,g,h) \
3662 DECLARE_N_KEYWORDS_7(a,b,c,d,e,f,g), h = Qnil
3663 #define DECLARE_N_KEYWORDS_9(a,b,c,d,e,f,g,h,i) \
3664 DECLARE_N_KEYWORDS_8(a,b,c,d,e,f,g,h), i = Qnil
3665
3666 #define CHECK_N_KEYWORDS_1(a) \
3667 else if (EQ (pk_key, Q_##a)) { a = pk_value; }
3668 #define CHECK_N_KEYWORDS_2(a,b) CHECK_N_KEYWORDS_1(a) \
3669 else if (EQ (pk_key, Q_##b)) { b = pk_value; }
3670 #define CHECK_N_KEYWORDS_3(a,b,c) CHECK_N_KEYWORDS_2(a,b) \
3671 else if (EQ (pk_key, Q_##c)) { c = pk_value; }
3672 #define CHECK_N_KEYWORDS_4(a,b,c,d) CHECK_N_KEYWORDS_3(a,b,c) \
3673 else if (EQ (pk_key, Q_##d)) { d = pk_value; }
3674 #define CHECK_N_KEYWORDS_5(a,b,c,d,e) CHECK_N_KEYWORDS_4(a,b,c,d) \
3675 else if (EQ (pk_key, Q_##e)) { e = pk_value; }
3676 #define CHECK_N_KEYWORDS_6(a,b,c,d,e,f) CHECK_N_KEYWORDS_5(a,b,c,d,e) \
3677 else if (EQ (pk_key, Q_##f)) { f = pk_value; }
3678 #define CHECK_N_KEYWORDS_7(a,b,c,d,e,f,g) CHECK_N_KEYWORDS_6(a,b,c,d,e,f) \
3679 else if (EQ (pk_key, Q_##g)) { g = pk_value; }
3680 #define CHECK_N_KEYWORDS_8(a,b,c,d,e,f,g,h) \
3681 CHECK_N_KEYWORDS_7(a,b,c,d,e,f,g) \
3682 else if (EQ (pk_key, Q_##h)) { h = pk_value; }
3683 #define CHECK_N_KEYWORDS_9(a,b,c,d,e,f,g,h,i) \
3684 CHECK_N_KEYWORDS_8(a,b,c,d,e,f,g,h) \
3685 else if (EQ (pk_key, Q_##i)) { i = pk_value; }
3686
3687 Boolint non_nil_allow_other_keys_p (Elemcount offset, int nargs,
3688 Lisp_Object *args);
3824 3689
3825 3690
3826 /************************************************************************/ 3691 /************************************************************************/
3827 /* Checking for QUIT */ 3692 /* Checking for QUIT */
3828 /************************************************************************/ 3693 /************************************************************************/
3921 #define HASH8(a,b,c,d,e,f,g,h) (GOOD_HASH * HASH7 (a,b,c,d,e,f,g) + (h)) 3786 #define HASH8(a,b,c,d,e,f,g,h) (GOOD_HASH * HASH7 (a,b,c,d,e,f,g) + (h))
3922 #define HASH9(a,b,c,d,e,f,g,h,i) (GOOD_HASH * HASH8 (a,b,c,d,e,f,g,h) + (i)) 3787 #define HASH9(a,b,c,d,e,f,g,h,i) (GOOD_HASH * HASH8 (a,b,c,d,e,f,g,h) + (i))
3923 3788
3924 #define LISP_HASH(obj) ((unsigned long) STORE_LISP_IN_VOID (obj)) 3789 #define LISP_HASH(obj) ((unsigned long) STORE_LISP_IN_VOID (obj))
3925 Hashcode memory_hash (const void *xv, Bytecount size); 3790 Hashcode memory_hash (const void *xv, Bytecount size);
3926 Hashcode internal_hash (Lisp_Object obj, int depth); 3791 Hashcode internal_hash (Lisp_Object obj, int depth, Boolint equalp);
3927 Hashcode internal_array_hash (Lisp_Object *arr, int size, int depth); 3792 Hashcode internal_array_hash (Lisp_Object *arr, int size, int depth,
3793 Boolint equalp);
3928 3794
3929 3795
3930 /************************************************************************/ 3796 /************************************************************************/
3931 /* String translation */ 3797 /* String translation */
3932 /************************************************************************/ 3798 /************************************************************************/
4413 and we want to minimize the number of "dependencies" of one file on 4279 and we want to minimize the number of "dependencies" of one file on
4414 the specifics of such objects. Putting prototypes here minimizes the 4280 the specifics of such objects. Putting prototypes here minimizes the
4415 number of header files that need to be included -- good for a number 4281 number of header files that need to be included -- good for a number
4416 of reasons. --ben */ 4282 of reasons. --ben */
4417 4283
4418 /*--------------- prototypes for various public c functions ------------*/
4419
4420 /* Prototypes for all init/syms_of/vars_of initialization functions. */ 4284 /* Prototypes for all init/syms_of/vars_of initialization functions. */
4421 #include "symsinit.h" 4285 #include "symsinit.h"
4422 4286
4423 BEGIN_C_DECLS 4287 BEGIN_C_DECLS
4424 4288
4426 MODULE_API EXFUN (Fexpand_abbrev, 0); 4290 MODULE_API EXFUN (Fexpand_abbrev, 0);
4427 4291
4428 /* Defined in alloc.c */ 4292 /* Defined in alloc.c */
4429 MODULE_API EXFUN (Fcons, 2); 4293 MODULE_API EXFUN (Fcons, 2);
4430 MODULE_API EXFUN (Flist, MANY); 4294 MODULE_API EXFUN (Flist, MANY);
4295 MODULE_API EXFUN (Facons, 3);
4431 EXFUN (Fbit_vector, MANY); 4296 EXFUN (Fbit_vector, MANY);
4432 EXFUN (Fmake_byte_code, MANY); 4297 EXFUN (Fmake_byte_code, MANY);
4433 MODULE_API EXFUN (Fmake_list, 2); 4298 MODULE_API EXFUN (Fmake_list, 2);
4434 MODULE_API EXFUN (Fmake_string, 2); 4299 MODULE_API EXFUN (Fmake_string, 2);
4435 EXFUN (Fstring, MANY); 4300 EXFUN (Fstring, MANY);
4436 MODULE_API EXFUN (Fmake_symbol, 1); 4301 MODULE_API EXFUN (Fmake_symbol, 1);
4437 MODULE_API EXFUN (Fmake_vector, 2); 4302 MODULE_API EXFUN (Fmake_vector, 2);
4438 MODULE_API EXFUN (Fvector, MANY); 4303 MODULE_API EXFUN (Fvector, MANY);
4439 4304
4305 void deadbeef_memory (void *ptr, Bytecount size);
4440 #ifndef NEW_GC 4306 #ifndef NEW_GC
4441 void release_breathing_space (void); 4307 void release_breathing_space (void);
4442 #endif /* not NEW_GC */ 4308 #endif /* not NEW_GC */
4443 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object); 4309 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object);
4444 MODULE_API Lisp_Object make_vector (Elemcount, Lisp_Object); 4310 MODULE_API Lisp_Object make_vector (Elemcount, Lisp_Object);
4449 Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, Elemcount); 4315 Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, Elemcount);
4450 Lisp_Object noseeum_make_marker (void); 4316 Lisp_Object noseeum_make_marker (void);
4451 #ifndef NEW_GC 4317 #ifndef NEW_GC
4452 void garbage_collect_1 (void); 4318 void garbage_collect_1 (void);
4453 #endif /* not NEW_GC */ 4319 #endif /* not NEW_GC */
4454 MODULE_API Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object);
4455 MODULE_API Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object); 4320 MODULE_API Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object);
4456 MODULE_API Lisp_Object list1 (Lisp_Object); 4321 MODULE_API Lisp_Object list1 (Lisp_Object);
4457 MODULE_API Lisp_Object list2 (Lisp_Object, Lisp_Object); 4322 MODULE_API Lisp_Object list2 (Lisp_Object, Lisp_Object);
4458 MODULE_API Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object); 4323 MODULE_API Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
4459 MODULE_API Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, 4324 MODULE_API Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object,
4460 Lisp_Object); 4325 Lisp_Object);
4461 MODULE_API Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, 4326 MODULE_API Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object,
4462 Lisp_Object);
4463 MODULE_API Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
4464 Lisp_Object, Lisp_Object); 4327 Lisp_Object, Lisp_Object);
4328 MODULE_API Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object,
4329 Lisp_Object, Lisp_Object, Lisp_Object);
4330 MODULE_API Lisp_Object listn (int numargs, ...);
4331 MODULE_API Lisp_Object listu (Lisp_Object, ...);
4465 DECLARE_DOESNT_RETURN (memory_full (void)); 4332 DECLARE_DOESNT_RETURN (memory_full (void));
4466 void disksave_object_finalization (void); 4333 void disksave_object_finalization (void);
4334 void finish_object_memory_usage_stats (void);
4467 extern int purify_flag; 4335 extern int purify_flag;
4336 #define ARRAY_DIMENSION_LIMIT EMACS_INT_MAX
4337 extern Fixnum Varray_dimension_limit;
4468 #ifndef NEW_GC 4338 #ifndef NEW_GC
4469 extern EMACS_INT gc_generation_number[1]; 4339 extern EMACS_INT gc_generation_number[1];
4470 #endif /* not NEW_GC */ 4340 #endif /* not NEW_GC */
4471 int c_readonly (Lisp_Object); 4341 int c_readonly (Lisp_Object);
4472 int lisp_readonly (Lisp_Object); 4342 int lisp_readonly (Lisp_Object);
4473 MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src);
4474 MODULE_API Lisp_Object build_istring (const Ibyte *); 4343 MODULE_API Lisp_Object build_istring (const Ibyte *);
4475 MODULE_API Lisp_Object build_cistring (const CIbyte *); 4344 MODULE_API Lisp_Object build_cistring (const CIbyte *);
4476 MODULE_API Lisp_Object build_ascstring (const Ascbyte *); 4345 MODULE_API Lisp_Object build_ascstring (const Ascbyte *);
4477 MODULE_API Lisp_Object build_extstring (const Extbyte *, Lisp_Object); 4346 MODULE_API Lisp_Object build_extstring (const Extbyte *, Lisp_Object);
4478 MODULE_API Lisp_Object make_string (const Ibyte *, Bytecount); 4347 MODULE_API Lisp_Object make_string (const Ibyte *, Bytecount);
4485 void free_list (Lisp_Object); 4354 void free_list (Lisp_Object);
4486 void free_alist (Lisp_Object); 4355 void free_alist (Lisp_Object);
4487 void free_marker (Lisp_Object); 4356 void free_marker (Lisp_Object);
4488 int object_dead_p (Lisp_Object); 4357 int object_dead_p (Lisp_Object);
4489 void mark_object (Lisp_Object obj); 4358 void mark_object (Lisp_Object obj);
4490 #ifndef NEW_GC
4491 #ifdef USE_KKCC
4492 #ifdef DEBUG_XEMACS
4493 void kkcc_gc_stack_push_lisp_object_1 (Lisp_Object obj, int level, int pos);
4494 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \
4495 kkcc_gc_stack_push_lisp_object_1 (obj, level, pos)
4496 void kkcc_backtrace (void);
4497 #else
4498 void kkcc_gc_stack_push_lisp_object_1 (Lisp_Object obj);
4499 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \
4500 kkcc_gc_stack_push_lisp_object_1 (obj)
4501 #define kkcc_backtrace()
4502 #endif
4503 #endif /* USE_KKCC */
4504 #endif /* not NEW_GC */
4505 int marked_p (Lisp_Object obj); 4359 int marked_p (Lisp_Object obj);
4506 extern int funcall_allocation_flag; 4360 extern int funcall_allocation_flag;
4507 extern int need_to_garbage_collect; 4361 extern int need_to_garbage_collect;
4508 extern MODULE_API int need_to_check_c_alloca; 4362 extern MODULE_API int need_to_check_c_alloca;
4509 extern int need_to_signal_post_gc; 4363 extern int need_to_signal_post_gc;
4510 extern Lisp_Object Qpost_gc_hook, Qgarbage_collecting; 4364 extern Lisp_Object Qpost_gc_hook, Qgarbage_collecting;
4511 void recompute_funcall_allocation_flag (void); 4365 void recompute_funcall_allocation_flag (void);
4512 4366
4513 #ifdef MEMORY_USAGE_STATS 4367 Bytecount malloced_storage_size (void *, Bytecount, struct usage_stats *);
4514 Bytecount malloced_storage_size (void *, Bytecount, struct overhead_stats *);
4515 Bytecount fixed_type_block_overhead (Bytecount);
4516 #endif
4517 4368
4518 #ifdef EVENT_DATA_AS_OBJECTS 4369 #ifdef EVENT_DATA_AS_OBJECTS
4519 Lisp_Object make_key_data (void); 4370 Lisp_Object make_key_data (void);
4520 Lisp_Object make_button_data (void); 4371 Lisp_Object make_button_data (void);
4521 Lisp_Object make_motion_data (void); 4372 Lisp_Object make_motion_data (void);
4574 4425
4575 extern Lisp_Object QSscratch, Qafter_change_function, Qafter_change_functions; 4426 extern Lisp_Object QSscratch, Qafter_change_function, Qafter_change_functions;
4576 extern Lisp_Object Qbefore_change_function, Qbefore_change_functions; 4427 extern Lisp_Object Qbefore_change_function, Qbefore_change_functions;
4577 extern Lisp_Object Qbuffer_or_string_p, Qdefault_directory, Qfirst_change_hook; 4428 extern Lisp_Object Qbuffer_or_string_p, Qdefault_directory, Qfirst_change_hook;
4578 extern Lisp_Object Qpermanent_local, Vafter_change_function; 4429 extern Lisp_Object Qpermanent_local, Vafter_change_function;
4430 extern Lisp_Object Qbuffer_live_p;
4579 extern Lisp_Object Vafter_change_functions, Vbefore_change_function; 4431 extern Lisp_Object Vafter_change_functions, Vbefore_change_function;
4580 extern Lisp_Object Vbefore_change_functions, Vbuffer_alist, Vbuffer_defaults; 4432 extern Lisp_Object Vbefore_change_functions, Vbuffer_alist, Vbuffer_defaults;
4581 extern Lisp_Object Vinhibit_read_only, Vtransient_mark_mode; 4433 extern Lisp_Object Vinhibit_read_only, Vtransient_mark_mode;
4582 4434
4583 /* Defined in bytecode.c */ 4435 /* Defined in bytecode.c */
4589 extern Lisp_Object Qbyte_code, Qinvalid_byte_code; 4441 extern Lisp_Object Qbyte_code, Qinvalid_byte_code;
4590 4442
4591 /* Defined in callint.c */ 4443 /* Defined in callint.c */
4592 EXFUN (Fcall_interactively, 3); 4444 EXFUN (Fcall_interactively, 3);
4593 EXFUN (Fprefix_numeric_value, 1); 4445 EXFUN (Fprefix_numeric_value, 1);
4446 extern Lisp_Object Qcall_interactively;
4447 extern Lisp_Object Qmouse_leave_buffer_hook;
4448 extern Lisp_Object Qread_from_minibuffer;
4449 extern Lisp_Object Vcommand_history;
4450 extern Lisp_Object Vcurrent_prefix_arg;
4451 extern Lisp_Object Vmark_even_if_inactive;
4594 4452
4595 /* Defined in casefiddle.c */ 4453 /* Defined in casefiddle.c */
4596 EXFUN (Fdowncase, 2); 4454 EXFUN (Fdowncase, 2);
4597 EXFUN (Fcanoncase, 2); 4455 EXFUN (Fcanoncase, 2);
4598 EXFUN (Fupcase, 2); 4456 EXFUN (Fupcase, 2);
4603 /* Defined in casetab.c */ 4461 /* Defined in casetab.c */
4604 EXFUN (Fset_standard_case_table, 1); 4462 EXFUN (Fset_standard_case_table, 1);
4605 4463
4606 /* Defined in chartab.c */ 4464 /* Defined in chartab.c */
4607 EXFUN (Freset_char_table, 1); 4465 EXFUN (Freset_char_table, 1);
4466 extern Lisp_Object Qcategory_designator_p;
4467 extern Lisp_Object Qcategory_table_value_p;
4468
4469 /* Defined in cmdloop.c */
4470 extern Lisp_Object Qdisabled_command_hook;
4471 extern Lisp_Object Qreally_early_error_handler;
4472 extern Lisp_Object Qtop_level;
4473 extern Lisp_Object Vdisabled_command_hook;
4608 4474
4609 /* Defined in cmds.c */ 4475 /* Defined in cmds.c */
4610 EXFUN (Fbeginning_of_line, 2); 4476 EXFUN (Fbeginning_of_line, 2);
4611 EXFUN (Fend_of_line, 2); 4477 EXFUN (Fend_of_line, 2);
4612 EXFUN (Fforward_char, 2); 4478 EXFUN (Fforward_char, 2);
4613 EXFUN (Fforward_line, 2); 4479 EXFUN (Fforward_line, 2);
4480 extern Lisp_Object Qself_insert_command;
4481
4482 /* Defined in console.c */
4483 extern Lisp_Object Qconsole_live_p;
4484 extern Lisp_Object Vconsole_list;
4485
4486 /* Defined in console-stream.c */
4487 extern Lisp_Object Vstdio_str;
4614 4488
4615 /* Defined in data.c */ 4489 /* Defined in data.c */
4616 EXFUN (Fadd1, 1); 4490 EXFUN (Fadd1, 1);
4617 EXFUN (Faref, 2); 4491 EXFUN (Faref, 2);
4618 EXFUN (Faset, 3); 4492 EXFUN (Faset, 3);
4646 DECLARE_DOESNT_RETURN (args_out_of_range_3 (Lisp_Object, Lisp_Object, 4520 DECLARE_DOESNT_RETURN (args_out_of_range_3 (Lisp_Object, Lisp_Object,
4647 Lisp_Object)); 4521 Lisp_Object));
4648 MODULE_API Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); 4522 MODULE_API Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
4649 MODULE_API 4523 MODULE_API
4650 DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object)); 4524 DECLARE_DOESNT_RETURN (dead_wrong_type_argument (Lisp_Object, Lisp_Object));
4651 void check_int_range (EMACS_INT, EMACS_INT, EMACS_INT); 4525 void check_integer_range (Lisp_Object, Lisp_Object, Lisp_Object);
4652 4526
4653 EXFUN (Fint_to_char, 1); 4527 EXFUN (Fint_to_char, 1);
4654 EXFUN (Fchar_to_int, 1); 4528 EXFUN (Fchar_to_int, 1);
4655 4529
4656 enum arith_comparison { 4530 enum arith_comparison {
4672 Qerror_conditions, Qerror_message, Qinteger_char_or_marker_p, 4546 Qerror_conditions, Qerror_message, Qinteger_char_or_marker_p,
4673 Qinteger_or_char_p, Qinteger_or_marker_p, Qlambda, Qlistp, Qnatnump, 4547 Qinteger_or_char_p, Qinteger_or_marker_p, Qlambda, Qlistp, Qnatnump,
4674 Qnonnegativep, Qnumber_char_or_marker_p, Qnumberp, Qquote, Qtrue_list_p; 4548 Qnonnegativep, Qnumber_char_or_marker_p, Qnumberp, Qquote, Qtrue_list_p;
4675 extern MODULE_API Lisp_Object Qintegerp; 4549 extern MODULE_API Lisp_Object Qintegerp;
4676 4550
4677 extern Lisp_Object Qarith_error, Qbeginning_of_buffer, Qbuffer_read_only, 4551 extern Lisp_Object Qargs_out_of_range, Qarith_error, Qbeginning_of_buffer,
4678 Qcircular_list, Qcircular_property_list, Qconversion_error, 4552 Qbuffer_read_only, Qextent_read_only,
4679 Qcyclic_variable_indirection, Qdomain_error, Qediting_error, 4553 Qcircular_list, Qcircular_property_list,
4680 Qend_of_buffer, Qend_of_file, Qerror, Qfile_error, Qinternal_error, 4554 Qconversion_error, Qcyclic_variable_indirection, Qdomain_error,
4681 Qinvalid_change, Qinvalid_constant, Qinvalid_function, Qinvalid_operation, 4555 Qediting_error, Qend_of_buffer, Qend_of_file, Qerror, Qfile_error,
4556 Qinternal_error, Qinvalid_change, Qinvalid_constant, Qinvalid_function,
4557 Qinvalid_keyword_argument, Qinvalid_operation,
4682 Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlist_formation_error, 4558 Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlist_formation_error,
4683 Qmalformed_list, Qmalformed_property_list, Qno_catch, Qout_of_memory, 4559 Qmalformed_list, Qmalformed_property_list, Qno_catch, Qout_of_memory,
4684 Qoverflow_error, Qprinting_unreadable_object, Qquit, Qrange_error, 4560 Qoverflow_error, Qprinting_unreadable_object, Qquit, Qrange_error,
4685 Qsetting_constant, Qsingularity_error, Qstack_overflow, 4561 Qsetting_constant, Qsingularity_error, Qstack_overflow,
4686 Qstructure_formation_error, Qtext_conversion_error, Qunderflow_error, 4562 Qstructure_formation_error, Qtext_conversion_error, Qunderflow_error,
4687 Qvoid_function, Qvoid_variable, Qwrong_number_of_arguments, 4563 Qvoid_function, Qvoid_variable, Qwrong_number_of_arguments,
4688 Qwrong_type_argument; 4564 Qwrong_type_argument;
4565
4566 extern Lisp_Object Qcdr;
4567 extern Lisp_Object Qerror_lacks_explanatory_string;
4568 extern Lisp_Object Qfile_error;
4569 extern Lisp_Object Qsequencep;
4689 extern MODULE_API Lisp_Object Qinvalid_argument, Qsyntax_error; 4570 extern MODULE_API Lisp_Object Qinvalid_argument, Qsyntax_error;
4690 4571
4572 /* Defined in device.c */
4573 extern Lisp_Object Qdevice_live_p;
4574
4575 /* Defined in device-x.c */
4576 extern Lisp_Object Vx_initial_argv_list;
4577
4691 /* Defined in dired.c */ 4578 /* Defined in dired.c */
4692 Lisp_Object make_directory_hash_table (const Ibyte *); 4579 Lisp_Object make_directory_hash_table (Lisp_Object);
4693 Lisp_Object wasteful_word_to_lisp (unsigned int);
4694 4580
4695 /* Defined in doc.c */ 4581 /* Defined in doc.c */
4696 EXFUN (Fsubstitute_command_keys, 1); 4582 EXFUN (Fsubstitute_command_keys, 1);
4697 4583
4698 Lisp_Object unparesseuxify_doc_string (int fd, EMACS_INT position, 4584 Lisp_Object unparesseuxify_doc_string (int fd, EMACS_INT position,
4699 Ibyte *name_nonreloc, 4585 Ibyte *name_nonreloc,
4700 Lisp_Object name_reloc, 4586 Lisp_Object name_reloc,
4701 int standard_doc_file); 4587 int standard_doc_file);
4702 Lisp_Object read_doc_string (Lisp_Object); 4588 Lisp_Object read_doc_string (Lisp_Object);
4589 extern Lisp_Object Vinternal_doc_file_name;
4703 4590
4704 /* Defined in doprnt.c */ 4591 /* Defined in doprnt.c */
4705 Bytecount emacs_doprnt_va (Lisp_Object stream, const Ibyte *format_nonreloc, 4592 Bytecount emacs_doprnt_va (Lisp_Object stream, const Ibyte *format_nonreloc,
4706 Bytecount format_length, Lisp_Object format_reloc, 4593 Bytecount format_length, Lisp_Object format_reloc,
4707 va_list vargs); 4594 va_list vargs);
4737 EXFUN (Fbobp, 1); 4624 EXFUN (Fbobp, 1);
4738 EXFUN (Fbolp, 1); 4625 EXFUN (Fbolp, 1);
4739 EXFUN (Fbuffer_substring, 3); 4626 EXFUN (Fbuffer_substring, 3);
4740 EXFUN (Fchar_after, 2); 4627 EXFUN (Fchar_after, 2);
4741 EXFUN (Fchar_to_string, 1); 4628 EXFUN (Fchar_to_string, 1);
4629 EXFUN (Fcurrent_time, 0);
4742 EXFUN (Fdelete_region, 3); 4630 EXFUN (Fdelete_region, 3);
4743 EXFUN (Feobp, 1); 4631 EXFUN (Feobp, 1);
4744 EXFUN (Feolp, 1); 4632 EXFUN (Feolp, 1);
4745 EXFUN (Ffollowing_char, 1); 4633 EXFUN (Ffollowing_char, 1);
4746 EXFUN (Fformat, MANY); 4634 EXFUN (Fformat, MANY);
4770 Lisp_Object save_restriction_save (struct buffer *buf); 4658 Lisp_Object save_restriction_save (struct buffer *buf);
4771 Lisp_Object save_excursion_restore (Lisp_Object); 4659 Lisp_Object save_excursion_restore (Lisp_Object);
4772 Lisp_Object save_restriction_restore (Lisp_Object); 4660 Lisp_Object save_restriction_restore (Lisp_Object);
4773 void widen_buffer (struct buffer *b, int no_clip); 4661 void widen_buffer (struct buffer *b, int no_clip);
4774 int beginning_of_line_p (struct buffer *b, Charbpos pt); 4662 int beginning_of_line_p (struct buffer *b, Charbpos pt);
4775
4776 /* Defined in emacsfns.c */
4777 Lisp_Object save_current_buffer_restore (Lisp_Object); 4663 Lisp_Object save_current_buffer_restore (Lisp_Object);
4664
4665 extern Lisp_Object Qformat;
4666 extern Lisp_Object Qmark;
4667 extern Lisp_Object Qpoint;
4668 extern Lisp_Object Qregion_beginning;
4669 extern Lisp_Object Qregion_end;
4670 extern Lisp_Object Quser_files_and_directories;
4671 extern Lisp_Object Vsystem_name;
4778 4672
4779 /* Defined in emacs.c */ 4673 /* Defined in emacs.c */
4780 EXFUN_NORETURN (Fkill_emacs, 1); 4674 EXFUN_NORETURN (Fkill_emacs, 1);
4781 EXFUN (Frunning_temacs_p, 0); 4675 EXFUN (Frunning_temacs_p, 0);
4782 EXFUN (Fforce_debugging_signal, 1); 4676 EXFUN (Fforce_debugging_signal, 1);
4797 void debug_break (void); 4691 void debug_break (void);
4798 int debug_can_access_memory (const void *ptr, Bytecount len); 4692 int debug_can_access_memory (const void *ptr, Bytecount len);
4799 DECLARE_DOESNT_RETURN (really_abort (void)); 4693 DECLARE_DOESNT_RETURN (really_abort (void));
4800 void zero_out_command_line_status_vars (void); 4694 void zero_out_command_line_status_vars (void);
4801 4695
4696 extern Lisp_Object Qsave_buffers_kill_emacs;
4697 extern Lisp_Object Vcommand_line_args;
4698 extern Lisp_Object Vconfigure_info_directory;
4699 extern Lisp_Object Vconfigure_site_directory;
4700 extern Lisp_Object Vconfigure_site_module_directory;
4701 extern Lisp_Object Vdata_directory;
4702 extern Lisp_Object Vdoc_directory;
4703 extern Lisp_Object Vemacs_major_version;
4704 extern Lisp_Object Vemacs_minor_version;
4705 extern Lisp_Object Vexec_directory;
4706 extern Lisp_Object Vexec_path;
4707 extern Lisp_Object Vinvocation_directory;
4708 extern Lisp_Object Vinvocation_name;
4709 extern Lisp_Object Vmodule_directory;
4710 extern Lisp_Object Vsite_directory;
4711 extern Lisp_Object Vsite_module_directory;
4712
4802 /* Defined in emodules.c */ 4713 /* Defined in emodules.c */
4803 #ifdef HAVE_SHLIB 4714 #ifdef HAVE_SHLIB
4804 EXFUN (Flist_modules, 0); 4715 EXFUN (Flist_modules, 0);
4805 EXFUN (Fload_module, 3); 4716 EXFUN (Fload_module, 3);
4806 extern int unloading_module; 4717 extern int unloading_module;
4807 #endif 4718 #endif
4719 extern Lisp_Object Qdll_error;
4720 extern Lisp_Object Qmodule;
4808 4721
4809 /* Defined in eval.c */ 4722 /* Defined in eval.c */
4810 MODULE_API EXFUN (Fapply, MANY); 4723 MODULE_API EXFUN (Fapply, MANY);
4811 EXFUN (Fbacktrace, 2); 4724 EXFUN (Fbacktrace, 2);
4812 EXFUN (Fcommand_execute, 3); 4725 EXFUN (Fcommand_execute, 3);
4824 EXFUN (Ffunction_min_args, 1); 4737 EXFUN (Ffunction_min_args, 1);
4825 4738
4826 MODULE_API DECLARE_DOESNT_RETURN (throw_or_bomb_out (Lisp_Object, 4739 MODULE_API DECLARE_DOESNT_RETURN (throw_or_bomb_out (Lisp_Object,
4827 Lisp_Object, int, 4740 Lisp_Object, int,
4828 Lisp_Object, Lisp_Object)); 4741 Lisp_Object, Lisp_Object));
4742
4743 MODULE_API DECLARE_DOESNT_RETURN (throw_or_bomb_out_unsafe (Lisp_Object,
4744 Lisp_Object, int,
4745 Lisp_Object, Lisp_Object));
4829 4746
4830 MODULE_API DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object)); 4747 MODULE_API DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object));
4831 void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object, 4748 void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object,
4832 Error_Behavior); 4749 Error_Behavior);
4833 Lisp_Object maybe_signal_continuable_error_1 (Lisp_Object, Lisp_Object, 4750 Lisp_Object maybe_signal_continuable_error_1 (Lisp_Object, Lisp_Object,
4904 MODULE_API DECLARE_DOESNT_RETURN (invalid_argument_2 (const Ascbyte *reason, 4821 MODULE_API DECLARE_DOESNT_RETURN (invalid_argument_2 (const Ascbyte *reason,
4905 Lisp_Object frob1, 4822 Lisp_Object frob1,
4906 Lisp_Object frob2)); 4823 Lisp_Object frob2));
4907 void maybe_invalid_argument (const Ascbyte *, Lisp_Object, Lisp_Object, 4824 void maybe_invalid_argument (const Ascbyte *, Lisp_Object, Lisp_Object,
4908 Error_Behavior); 4825 Error_Behavior);
4826 MODULE_API DECLARE_DOESNT_RETURN (invalid_keyword_argument (Lisp_Object fun,
4827 Lisp_Object kw));
4909 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation (const Ascbyte *reason, 4828 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation (const Ascbyte *reason,
4910 Lisp_Object frob)); 4829 Lisp_Object frob));
4911 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation_2 (const Ascbyte *reason, 4830 MODULE_API DECLARE_DOESNT_RETURN (invalid_operation_2 (const Ascbyte *reason,
4912 Lisp_Object frob1, 4831 Lisp_Object frob1,
4913 Lisp_Object frob2)); 4832 Lisp_Object frob2));
5112 Lisp_Object un_autoload (Lisp_Object); 5031 Lisp_Object un_autoload (Lisp_Object);
5113 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object); 5032 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);
5114 MODULE_API void warn_when_safe (Lisp_Object, Lisp_Object, const Ascbyte *, 5033 MODULE_API void warn_when_safe (Lisp_Object, Lisp_Object, const Ascbyte *,
5115 ...) PRINTF_ARGS (3, 4); 5034 ...) PRINTF_ARGS (3, 4);
5116 extern int backtrace_with_internal_sections; 5035 extern int backtrace_with_internal_sections;
5117 5036 extern Fixnum Vmultiple_values_limit;
5037
5038 extern Lisp_Object Qand_optional;
5039 extern Lisp_Object Qand_rest;
5040 extern Lisp_Object Qautoload;
5041 extern Lisp_Object Qcommandp;
5042 extern Lisp_Object Qdefun;
5043 extern Lisp_Object Qexit;
5044 extern Lisp_Object Qinhibit_quit;
5045 extern Lisp_Object Qinteractive;
5046 extern Lisp_Object Qmacro;
5047 extern Lisp_Object Qprogn;
5048 extern Lisp_Object Qrun_hooks;
5049 extern Lisp_Object Qvalues;
5118 extern Lisp_Object Vdebug_on_error; 5050 extern Lisp_Object Vdebug_on_error;
5119 extern Lisp_Object Vstack_trace_on_error; 5051 extern Lisp_Object Vstack_trace_on_error;
5052 extern Lisp_Object Vautoload_queue;
5053
5054 extern MODULE_API Lisp_Object Vinhibit_quit, Vquit_flag;
5120 5055
5121 /* Defined in event-stream.c */ 5056 /* Defined in event-stream.c */
5122 EXFUN (Faccept_process_output, 3); 5057 EXFUN (Faccept_process_output, 3);
5123 EXFUN (Fadd_timeout, 4); 5058 EXFUN (Fadd_timeout, 4);
5124 EXFUN (Fdisable_timeout, 1); 5059 EXFUN (Fdisable_timeout, 1);
5136 Lisp_Object enqueue_misc_user_event (Lisp_Object, Lisp_Object, Lisp_Object); 5071 Lisp_Object enqueue_misc_user_event (Lisp_Object, Lisp_Object, Lisp_Object);
5137 Lisp_Object enqueue_misc_user_event_pos (Lisp_Object, Lisp_Object, 5072 Lisp_Object enqueue_misc_user_event_pos (Lisp_Object, Lisp_Object,
5138 Lisp_Object, int, int, int, int); 5073 Lisp_Object, int, int, int, int);
5139 extern int modifier_keys_are_sticky; 5074 extern int modifier_keys_are_sticky;
5140 5075
5076 extern Lisp_Object Qdisabled;
5077 extern Lisp_Object Qsans_modifiers;
5078 extern Lisp_Object Qself_insert_defer_undo;
5079 extern Lisp_Object Vcontrolling_terminal;
5080 extern Lisp_Object Vcurrent_mouse_event;
5081 extern Lisp_Object Vlast_command;
5082 extern Lisp_Object Vlast_command_char;
5083 extern Lisp_Object Vlast_command_event;
5084 extern Lisp_Object Vlast_input_event;
5085 extern Lisp_Object Vrecent_keys_ring;
5086 extern Lisp_Object Vthis_command_keys;
5087 extern Lisp_Object Vunread_command_event;
5088
5141 /* Defined in event-Xt.c */ 5089 /* Defined in event-Xt.c */
5142 void signal_special_Xt_user_event (Lisp_Object, Lisp_Object, Lisp_Object); 5090 void signal_special_Xt_user_event (Lisp_Object, Lisp_Object, Lisp_Object);
5143 5091
5144 5092
5145 /* Defined in events.c */ 5093 /* Defined in events.c */
5150 Lisp_Object allocate_event (void); 5098 Lisp_Object allocate_event (void);
5151 5099
5152 EXFUN (Fevent_x_pixel, 1); 5100 EXFUN (Fevent_x_pixel, 1);
5153 EXFUN (Fevent_y_pixel, 1); 5101 EXFUN (Fevent_y_pixel, 1);
5154 5102
5103 extern Lisp_Object Qevent_live_p;
5104
5105
5106 /* Defined in extents.c */
5107 extern Lisp_Object Qend_open;
5108 extern Lisp_Object Qextent_live_p;
5109 extern Lisp_Object Qstart_open;
5110
5111 /* Defined in faces.c */
5112 extern Lisp_Object Qbackground;
5113 extern Lisp_Object Qbackground_pixmap;
5114 extern Lisp_Object Qblinking;
5115 extern Lisp_Object Qdim;
5116 extern Lisp_Object Qdisplay_table;
5117 extern Lisp_Object Qforeground;
5118 extern Lisp_Object Qunderline;
5155 5119
5156 /* Defined in file-coding.c */ 5120 /* Defined in file-coding.c */
5157 EXFUN (Fcoding_category_list, 0); 5121 EXFUN (Fcoding_category_list, 0);
5158 EXFUN (Fcoding_category_system, 1); 5122 EXFUN (Fcoding_category_system, 1);
5159 EXFUN (Fcoding_priority_list, 0); 5123 EXFUN (Fcoding_priority_list, 0);
5237 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object); 5201 Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
5238 int internal_delete_file (Lisp_Object); 5202 int internal_delete_file (Lisp_Object);
5239 Ibyte *find_end_of_directory_component (const Ibyte *path, 5203 Ibyte *find_end_of_directory_component (const Ibyte *path,
5240 Bytecount len); 5204 Bytecount len);
5241 5205
5206 extern Lisp_Object Qfile_name_sans_extension;
5207 extern Lisp_Object Vdirectory_sep_char;
5208
5242 /* Defined in filelock.c */ 5209 /* Defined in filelock.c */
5243 EXFUN (Funlock_buffer, 0); 5210 EXFUN (Funlock_buffer, 0);
5244 5211
5245 void lock_file (Lisp_Object); 5212 void lock_file (Lisp_Object);
5246 void unlock_file (Lisp_Object); 5213 void unlock_file (Lisp_Object);
5262 EXFUN (Fconcat, MANY); 5229 EXFUN (Fconcat, MANY);
5263 EXFUN (Fcopy_alist, 1); 5230 EXFUN (Fcopy_alist, 1);
5264 EXFUN (Fcopy_list, 1); 5231 EXFUN (Fcopy_list, 1);
5265 EXFUN (Fcopy_sequence, 1); 5232 EXFUN (Fcopy_sequence, 1);
5266 EXFUN (Fcopy_tree, 2); 5233 EXFUN (Fcopy_tree, 2);
5267 EXFUN (Fdelete, 2);
5268 EXFUN (Fdelq, 2);
5269 EXFUN (Fdestructive_alist_to_plist, 1); 5234 EXFUN (Fdestructive_alist_to_plist, 1);
5270 EXFUN (Felt, 2); 5235 EXFUN (Felt, 2);
5271 MODULE_API EXFUN (Fequal, 2); 5236 MODULE_API EXFUN (Fequal, 2);
5272 MODULE_API EXFUN (Fget, 3); 5237 MODULE_API EXFUN (Fget, 3);
5273 MODULE_API EXFUN (Feqlsign, MANY); 5238 MODULE_API EXFUN (Feqlsign, MANY);
5294 EXFUN (Frassq, 2); 5259 EXFUN (Frassq, 2);
5295 EXFUN (Fremassq, 2); 5260 EXFUN (Fremassq, 2);
5296 EXFUN (Freplace_list, 2); 5261 EXFUN (Freplace_list, 2);
5297 MODULE_API EXFUN (Freverse, 1); 5262 MODULE_API EXFUN (Freverse, 1);
5298 EXFUN (Fsafe_length, 1); 5263 EXFUN (Fsafe_length, 1);
5299 EXFUN (Fsort, 2);
5300 EXFUN (Fstring_equal, 2); 5264 EXFUN (Fstring_equal, 2);
5301 EXFUN (Fstring_lessp, 2); 5265 EXFUN (Fstring_lessp, 2);
5302 EXFUN (Fsubstring, 3); 5266 EXFUN (Fsubseq, 3);
5303 EXFUN (Fvalid_plist_p, 1); 5267 EXFUN (Fvalid_plist_p, 1);
5304 5268
5305 Lisp_Object list_sort (Lisp_Object, Lisp_Object, 5269 extern Boolint check_lss_key_car (Lisp_Object, Lisp_Object, Lisp_Object,
5306 int (*) (Lisp_Object, Lisp_Object, Lisp_Object)); 5270 Lisp_Object);
5307 Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object); 5271 extern Boolint check_string_lessp_nokey (Lisp_Object, Lisp_Object,
5272 Lisp_Object, Lisp_Object);
5273
5274 typedef Boolint (*check_test_func_t) (Lisp_Object test, Lisp_Object key,
5275 Lisp_Object item, Lisp_Object elt);
5276
5277 Lisp_Object list_merge (Lisp_Object org_l1, Lisp_Object org_l2,
5278 check_test_func_t check_merge,
5279 Lisp_Object predicate, Lisp_Object key_func);
5280 Lisp_Object list_sort (Lisp_Object list,
5281 check_test_func_t check_merge,
5282 Lisp_Object predicate, Lisp_Object key_func);
5308 5283
5309 void bump_string_modiff (Lisp_Object); 5284 void bump_string_modiff (Lisp_Object);
5310 Lisp_Object memq_no_quit (Lisp_Object, Lisp_Object); 5285 Lisp_Object memq_no_quit (Lisp_Object, Lisp_Object);
5311 Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object); 5286 Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object);
5312 Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object); 5287 Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object);
5348 Lisp_Object add_suffix_to_symbol (Lisp_Object symbol, 5323 Lisp_Object add_suffix_to_symbol (Lisp_Object symbol,
5349 const Ascbyte *ascii_string); 5324 const Ascbyte *ascii_string);
5350 Lisp_Object add_prefix_to_symbol (const Ascbyte *ascii_string, 5325 Lisp_Object add_prefix_to_symbol (const Ascbyte *ascii_string,
5351 Lisp_Object symbol); 5326 Lisp_Object symbol);
5352 5327
5328 extern Lisp_Object Qidentity;
5329 extern Lisp_Object Qstring_lessp;
5330 extern Lisp_Object Qyes_or_no_p;
5331 extern Lisp_Object Vfeatures;
5332
5333 /* Defined in frame.c */
5334 extern Lisp_Object Qframe_live_p;
5335
5353 /* Defined in free-hook.c */ 5336 /* Defined in free-hook.c */
5354 EXFUN (Freally_free, 1); 5337 EXFUN (Freally_free, 1);
5355 5338
5339 /* Defined in general.c */
5340 #define SYMBOL(fou) extern Lisp_Object fou
5341 #define SYMBOL_MODULE_API(fou) extern MODULE_API Lisp_Object fou
5342 #define SYMBOL_KEYWORD(la_cle_est_folle) extern Lisp_Object la_cle_est_folle
5343 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
5344 extern Lisp_Object tout_le_monde
5345 #define SYMBOL_KEYWORD_GENERAL(y_compris_ben, mais_que_peut_on_faire) \
5346 extern Lisp_Object y_compris_ben
5347
5348 #include "general-slots.h"
5349
5350 #undef SYMBOL
5351 #undef SYMBOL_MODULE_API
5352 #undef SYMBOL_KEYWORD
5353 #undef SYMBOL_GENERAL
5354 #undef SYMBOL_KEYWORD_GENERAL
5355
5356 extern Lisp_Object Qeq;
5357 extern Lisp_Object Qeql;
5358 extern Lisp_Object Qequal;
5359 extern Lisp_Object Qequalp;
5360
5356 /* Defined in glyphs.c */ 5361 /* Defined in glyphs.c */
5357 EXFUN (Fmake_glyph_internal, 1); 5362 EXFUN (Fmake_glyph_internal, 1);
5358 5363
5359 Error_Behavior decode_error_behavior_flag (Lisp_Object); 5364 Error_Behavior decode_error_behavior_flag (Lisp_Object);
5360 Lisp_Object encode_error_behavior_flag (Error_Behavior); 5365 Lisp_Object encode_error_behavior_flag (Error_Behavior);
5366
5367 extern Lisp_Object Qbuffer_glyph_p;
5368 extern Lisp_Object Qcolor_pixmap_image_instance_p;
5369 extern Lisp_Object Qicon_glyph_p;
5370 extern Lisp_Object Qmono_pixmap_image_instance_p;
5371 extern Lisp_Object Qnothing_image_instance_p;
5372 extern Lisp_Object Qpointer_glyph_p;
5373 extern Lisp_Object Qpointer_image_instance_p;
5374 extern Lisp_Object Qsubwindow;
5375 extern Lisp_Object Qsubwindow_image_instance_p;
5376 extern Lisp_Object Qtext_image_instance_p;
5361 5377
5362 /* Defined in glyphs-shared.c */ 5378 /* Defined in glyphs-shared.c */
5363 void shared_resource_validate (Lisp_Object instantiator); 5379 void shared_resource_validate (Lisp_Object instantiator);
5364 Lisp_Object shared_resource_normalize (Lisp_Object inst, 5380 Lisp_Object shared_resource_normalize (Lisp_Object inst,
5365 Lisp_Object console_type, 5381 Lisp_Object console_type,
5366 Lisp_Object dest_mask, 5382 Lisp_Object dest_mask,
5367 Lisp_Object tag); 5383 Lisp_Object tag);
5368 extern Lisp_Object Q_resource_type, Q_resource_id; 5384 extern Lisp_Object Q_resource_type, Q_resource_id;
5369 5385
5386 /* Defined in glyphs-widget.c */
5387 extern Lisp_Object Qlayout;
5388 extern Lisp_Object Qnative_layout;
5389
5370 /* Defined in gui.c */ 5390 /* Defined in gui.c */
5371 DECLARE_DOESNT_RETURN (gui_error (const Ascbyte *reason, 5391 DECLARE_DOESNT_RETURN (gui_error (const Ascbyte *reason,
5372 Lisp_Object frob)); 5392 Lisp_Object frob));
5373 DECLARE_DOESNT_RETURN (gui_error_2 (const Ascbyte *reason, 5393 DECLARE_DOESNT_RETURN (gui_error_2 (const Ascbyte *reason,
5374 Lisp_Object frob0, Lisp_Object frob1)); 5394 Lisp_Object frob0, Lisp_Object frob1));
5395 extern Lisp_Object Qgui_error;
5396
5375 /* Defined in indent.c */ 5397 /* Defined in indent.c */
5376 EXFUN (Findent_to, 3); 5398 EXFUN (Findent_to, 3);
5377 EXFUN (Fvertical_motion, 3); 5399 EXFUN (Fvertical_motion, 3);
5378 5400
5379 int byte_spaces_at_point (struct buffer *, Bytebpos); 5401 int byte_spaces_at_point (struct buffer *, Bytebpos);
5404 void ebolify_bytecode_constants (Lisp_Object); 5426 void ebolify_bytecode_constants (Lisp_Object);
5405 void close_load_descs (void); 5427 void close_load_descs (void);
5406 int locate_file (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int); 5428 int locate_file (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object *, int);
5407 EXFUN (Flocate_file_clear_hashing, 1); 5429 EXFUN (Flocate_file_clear_hashing, 1);
5408 int isfloat_string (const char *); 5430 int isfloat_string (const char *);
5409 #ifdef HAVE_RATIO
5410 int isratio_string (const char *); 5431 int isratio_string (const char *);
5411 #endif
5412 5432
5413 /* Well, I've decided to enable this. -- ben */ 5433 /* Well, I've decided to enable this. -- ben */
5414 /* And I've decided to make it work right. -- sb */ 5434 /* And I've decided to make it work right. -- sb */
5415 #define LOADHIST 5435 #define LOADHIST
5416 /* Define the following symbol to enable load history of dumped files */ 5436 /* Define the following symbol to enable load history of dumped files */
5424 while (0) 5444 while (0)
5425 #else /*! LOADHIST */ 5445 #else /*! LOADHIST */
5426 # define LOADHIST_ATTACH(x) 5446 # define LOADHIST_ATTACH(x)
5427 #endif /*! LOADHIST */ 5447 #endif /*! LOADHIST */
5428 5448
5449 extern Lisp_Object Qfeaturep;
5450 extern Lisp_Object Qload;
5451 extern Lisp_Object Qread_char;
5452 extern Lisp_Object Qstandard_input;
5453 extern Lisp_Object Vcurrent_load_list;
5454 extern Lisp_Object Vfile_domain;
5455 extern Lisp_Object Vload_file_name_internal;
5456 extern Lisp_Object Vload_history;
5457 extern Lisp_Object Vload_path;
5458 extern Lisp_Object Vstandard_input;
5459
5429 /* Defined in macros.c */ 5460 /* Defined in macros.c */
5430 EXFUN (Fexecute_kbd_macro, 2); 5461 EXFUN (Fexecute_kbd_macro, 2);
5462
5463 extern Lisp_Object Vexecuting_macro;
5431 5464
5432 /* Defined in marker.c */ 5465 /* Defined in marker.c */
5433 EXFUN (Fcopy_marker, 2); 5466 EXFUN (Fcopy_marker, 2);
5434 EXFUN (Fmake_marker, 0); 5467 EXFUN (Fmake_marker, 0);
5435 EXFUN (Fmarker_buffer, 1); 5468 EXFUN (Fmarker_buffer, 1);
5443 void set_marker_position (Lisp_Object, Charbpos); 5476 void set_marker_position (Lisp_Object, Charbpos);
5444 void unchain_marker (Lisp_Object); 5477 void unchain_marker (Lisp_Object);
5445 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object); 5478 Lisp_Object noseeum_copy_marker (Lisp_Object, Lisp_Object);
5446 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); 5479 Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
5447 #ifdef MEMORY_USAGE_STATS 5480 #ifdef MEMORY_USAGE_STATS
5448 int compute_buffer_marker_usage (struct buffer *, struct overhead_stats *); 5481 Bytecount compute_buffer_marker_usage (struct buffer *b);
5449 #endif 5482 #endif
5450 void init_buffer_markers (struct buffer *b); 5483 void init_buffer_markers (struct buffer *b);
5451 void uninit_buffer_markers (struct buffer *b); 5484 void uninit_buffer_markers (struct buffer *b);
5485
5486 /* Defined in menubar.c */
5487 extern Lisp_Object Qactivate_menubar_hook;
5488 extern Lisp_Object Qcurrent_menubar;
5489 extern Lisp_Object Vactivate_menubar_hook;
5490 extern Lisp_Object Vblank_menubar;
5491 extern Lisp_Object Vmenubar_configuration;
5452 5492
5453 /* Defined in minibuf.c */ 5493 /* Defined in minibuf.c */
5454 extern int minibuf_level; 5494 extern int minibuf_level;
5455 Charcount scmp_1 (const Ibyte *, const Ibyte *, Charcount, int); 5495 Charcount scmp_1 (const Ibyte *, const Ibyte *, Charcount, int);
5456 #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case) 5496 #define scmp(s1, s2, len) scmp_1 (s1, s2, len, completion_ignore_case)
5472 MODULE_API void message (const char *, ...) PRINTF_ARGS (1, 2); 5512 MODULE_API void message (const char *, ...) PRINTF_ARGS (1, 2);
5473 void message_append (const char *, ...) PRINTF_ARGS (1, 2); 5513 void message_append (const char *, ...) PRINTF_ARGS (1, 2);
5474 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2); 5514 void message_no_translate (const char *, ...) PRINTF_ARGS (1, 2);
5475 void clear_message (void); 5515 void clear_message (void);
5476 5516
5517 extern Lisp_Object Qcompletion_ignore_case;
5518 extern Lisp_Object Vecho_area_buffer;
5519 extern Lisp_Object Vminibuf_preprompt;
5520 extern Lisp_Object Vminibuf_prompt;
5521 extern Lisp_Object Vminibuffer_zero;
5522
5477 /* Defined in mule-charset.c */ 5523 /* Defined in mule-charset.c */
5478 EXFUN (Fmake_charset, 3); 5524 EXFUN (Fmake_charset, 3);
5479 5525
5480 extern Lisp_Object Ql2r, Qr2l; 5526 extern Lisp_Object Ql2r, Qr2l;
5527 extern Lisp_Object Qdirection;
5528 extern Lisp_Object Qfinal;
5529 extern Lisp_Object Qgraphic;
5530 extern Lisp_Object Qlong_name;
5531 extern Lisp_Object Qregistries;
5532 extern Lisp_Object Qreverse_direction_charset;
5533 extern Lisp_Object Qshort_name;
5534
5535 /* Defined in nt.c */
5536 extern Lisp_Object Vmswindows_get_true_file_attributes;
5481 5537
5482 /* Defined in print.c */ 5538 /* Defined in print.c */
5483 EXFUN (Fdisplay_error, 2); 5539 EXFUN (Fdisplay_error, 2);
5484 EXFUN (Ferror_message_string, 1); 5540 EXFUN (Ferror_message_string, 1);
5485 EXFUN (Fprin1, 2); 5541 EXFUN (Fprin1, 2);
5516 void stderr_out (const CIbyte *, ...) PRINTF_ARGS (1, 2); 5572 void stderr_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
5517 void stderr_out_lisp (const CIbyte *, int nargs, ...); 5573 void stderr_out_lisp (const CIbyte *, int nargs, ...);
5518 void stdout_out (const CIbyte *, ...) PRINTF_ARGS (1, 2); 5574 void stdout_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
5519 void external_out (int dest, const CIbyte *fmt, ...) PRINTF_ARGS (2, 3); 5575 void external_out (int dest, const CIbyte *fmt, ...) PRINTF_ARGS (2, 3);
5520 void debug_out (const CIbyte *, ...) PRINTF_ARGS (1, 2); 5576 void debug_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
5577 void debug_out_lisp (const CIbyte *, int nargs, ...);
5521 DECLARE_DOESNT_RETURN (fatal (const CIbyte *, ...)) PRINTF_ARGS(1, 2); 5578 DECLARE_DOESNT_RETURN (fatal (const CIbyte *, ...)) PRINTF_ARGS(1, 2);
5522 5579
5523 /* Internal functions: */ 5580 /* Internal functions: */
5524 Lisp_Object canonicalize_printcharfun (Lisp_Object printcharfun); 5581 Lisp_Object canonicalize_printcharfun (Lisp_Object printcharfun);
5525 void temp_output_buffer_setup (Lisp_Object); 5582 void temp_output_buffer_setup (Lisp_Object);
5546 extern int in_debug_print; 5603 extern int in_debug_print;
5547 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object, 5604 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object,
5548 Lisp_Object (*) (Lisp_Object), 5605 Lisp_Object (*) (Lisp_Object),
5549 Lisp_Object, Lisp_Object); 5606 Lisp_Object, Lisp_Object);
5550 void float_to_string (char *, double); 5607 void float_to_string (char *, double);
5551 void internal_object_printer (Lisp_Object, Lisp_Object, int); 5608 void internal_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
5552 MODULE_API DECLARE_DOESNT_RETURN (printing_unreadable_object (const CIbyte *, 5609 int UNUSED (escapeflag));
5610 void external_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
5611 int UNUSED (escapeflag));
5612 MODULE_API DECLARE_DOESNT_RETURN (printing_unreadable_object_fmt (const CIbyte *,
5553 ...)) 5613 ...))
5554 PRINTF_ARGS (1, 2); 5614 PRINTF_ARGS (1, 2);
5555 DECLARE_DOESNT_RETURN (printing_unreadable_lcrecord (Lisp_Object obj, 5615 DECLARE_DOESNT_RETURN (printing_unreadable_lisp_object (Lisp_Object obj,
5556 const Ibyte *name)); 5616 const Ibyte *name));
5617
5618 extern Lisp_Object Qexternal_debugging_output;
5619 extern Lisp_Object Qprint_length;
5620 extern Lisp_Object Qprint_string_length;
5621 extern Lisp_Object Qstandard_output;
5622 extern Lisp_Object Vprint_length;
5623 extern Lisp_Object Vprint_level;
5624 extern Lisp_Object Vstandard_output;
5625
5626 /* Defined in process.c */
5627 extern Lisp_Object Qnetwork_error;
5628 extern MODULE_API Lisp_Object Qprocess_error;
5629 extern Lisp_Object Vprocess_environment;
5630 extern Lisp_Object Vshell_file_name;
5557 5631
5558 /* Defined in rangetab.c */ 5632 /* Defined in rangetab.c */
5559 EXFUN (Fclear_range_table, 1); 5633 EXFUN (Fclear_range_table, 1);
5560 EXFUN (Fget_range_table, 3); 5634 EXFUN (Fget_range_table, 3);
5561 EXFUN (Fmake_range_table, 1); 5635 EXFUN (Fmake_range_table, 1);
5614 EXFUN (Fding, 3); 5688 EXFUN (Fding, 3);
5615 5689
5616 void init_device_sound (struct device *); 5690 void init_device_sound (struct device *);
5617 DECLARE_DOESNT_RETURN (report_sound_error (const Ascbyte *, Lisp_Object)); 5691 DECLARE_DOESNT_RETURN (report_sound_error (const Ascbyte *, Lisp_Object));
5618 5692
5693 extern Lisp_Object Qsound_error;
5694 extern Lisp_Object Vsynchronous_sounds;
5695
5619 /* Defined in specifier.c */ 5696 /* Defined in specifier.c */
5620 EXFUN (Fadd_spec_to_specifier, 5); 5697 EXFUN (Fadd_spec_to_specifier, 5);
5621 EXFUN (Fspecifier_spec_list, 4); 5698 EXFUN (Fspecifier_spec_list, 4);
5622 5699
5623 Lisp_Object specifier_instance (Lisp_Object, Lisp_Object, Lisp_Object, 5700 Lisp_Object specifier_instance (Lisp_Object, Lisp_Object, Lisp_Object,
5643 EXFUN (Fsymbol_value, 1); 5720 EXFUN (Fsymbol_value, 1);
5644 5721
5645 unsigned int hash_string (const Ibyte *, Bytecount); 5722 unsigned int hash_string (const Ibyte *, Bytecount);
5646 Lisp_Object intern_istring (const Ibyte *str); 5723 Lisp_Object intern_istring (const Ibyte *str);
5647 MODULE_API Lisp_Object intern (const CIbyte *str); 5724 MODULE_API Lisp_Object intern (const CIbyte *str);
5648 Lisp_Object intern_converting_underscores_to_dashes (const CIbyte *str); 5725 Lisp_Object intern_massaging_name (const CIbyte *str);
5649 Lisp_Object oblookup (Lisp_Object, const Ibyte *, Bytecount); 5726 Lisp_Object oblookup (Lisp_Object, const Ibyte *, Bytecount);
5650 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *); 5727 void map_obarray (Lisp_Object, int (*) (Lisp_Object, void *), void *);
5651 Lisp_Object indirect_function (Lisp_Object, int); 5728 Lisp_Object indirect_function (Lisp_Object, int);
5652 Lisp_Object symbol_value_in_buffer (Lisp_Object, Lisp_Object); 5729 Lisp_Object symbol_value_in_buffer (Lisp_Object, Lisp_Object);
5653 void kill_buffer_local_variables (struct buffer *); 5730 void kill_buffer_local_variables (struct buffer *);
5656 Lisp_Object find_symbol_value_quickly (Lisp_Object, int); 5733 Lisp_Object find_symbol_value_quickly (Lisp_Object, int);
5657 Lisp_Object top_level_value (Lisp_Object); 5734 Lisp_Object top_level_value (Lisp_Object);
5658 void reject_constant_symbols (Lisp_Object sym, Lisp_Object newval, 5735 void reject_constant_symbols (Lisp_Object sym, Lisp_Object newval,
5659 int function_p, 5736 int function_p,
5660 Lisp_Object follow_past_lisp_magic); 5737 Lisp_Object follow_past_lisp_magic);
5738
5739 extern Lisp_Object Qconst_specifier;
5740 extern Lisp_Object Qmakunbound;
5741 extern Lisp_Object Qset;
5742 extern Lisp_Object Qvariable_documentation;
5743 extern Lisp_Object Qvariable_domain;
5744 extern MODULE_API Lisp_Object Qt, Qunbound;
5745 extern Lisp_Object Vobarray;
5661 5746
5662 /* Defined in syntax.c */ 5747 /* Defined in syntax.c */
5663 Charbpos scan_words (struct buffer *, Charbpos, int); 5748 Charbpos scan_words (struct buffer *, Charbpos, int);
5664 EXFUN (Fchar_syntax, 2); 5749 EXFUN (Fchar_syntax, 2);
5665 EXFUN (Fforward_word, 2); 5750 EXFUN (Fforward_word, 2);
6054 extern alloca_convert_vals_dynarr *active_alloca_convert; 6139 extern alloca_convert_vals_dynarr *active_alloca_convert;
6055 6140
6056 MODULE_API int find_pos_of_existing_active_alloca_convert (const char * 6141 MODULE_API int find_pos_of_existing_active_alloca_convert (const char *
6057 srctext); 6142 srctext);
6058 6143
6144 /* Defined in undo.c */
6145 extern Lisp_Object Qinhibit_read_only;
6146
6059 /* Defined in unicode.c */ 6147 /* Defined in unicode.c */
6060 extern const struct sized_memory_description to_unicode_description; 6148 extern const struct sized_memory_description to_unicode_description;
6061 extern const struct sized_memory_description from_unicode_description; 6149 extern const struct sized_memory_description from_unicode_description;
6062 void init_charset_unicode_tables (Lisp_Object charset); 6150 void init_charset_unicode_tables (Lisp_Object charset);
6063 void free_charset_unicode_tables (Lisp_Object charset); 6151 void free_charset_unicode_tables (Lisp_Object charset);
6064 void recalculate_unicode_precedence (void); 6152 void recalculate_unicode_precedence (void);
6065 extern Lisp_Object Qunicode; 6153 extern Lisp_Object Qunicode;
6066 extern Lisp_Object Qutf_16, Qutf_8, Qucs_4, Qutf_7, Qutf_32; 6154 extern Lisp_Object Qutf_16, Qutf_8, Qucs_4, Qutf_7, Qutf_32;
6067 #ifdef MEMORY_USAGE_STATS 6155 #ifdef MEMORY_USAGE_STATS
6068 Bytecount compute_from_unicode_table_size (Lisp_Object charset, 6156 Bytecount compute_from_unicode_table_size (Lisp_Object charset,
6069 struct overhead_stats *stats); 6157 struct usage_stats *stats);
6070 Bytecount compute_to_unicode_table_size (Lisp_Object charset, 6158 Bytecount compute_to_unicode_table_size (Lisp_Object charset,
6071 struct overhead_stats *stats); 6159 struct usage_stats *stats);
6072 #endif /* MEMORY_USAGE_STATS */ 6160 #endif /* MEMORY_USAGE_STATS */
6073 6161
6074 /* Defined in undo.c */ 6162 /* Defined in undo.c */
6075 EXFUN (Fundo_boundary, 0); 6163 EXFUN (Fundo_boundary, 0);
6076 6164
6091 #endif 6179 #endif
6092 6180
6093 /* Defined in vm-limit.c */ 6181 /* Defined in vm-limit.c */
6094 void memory_warnings (void *, void (*) (const char *)); 6182 void memory_warnings (void *, void (*) (const char *));
6095 6183
6096 /*--------------- prototypes for constant symbols ------------*/ 6184 /* Defined in win32.c */
6097 6185 extern Lisp_Object Vmswindows_downcase_file_names;
6098 /* #### We should get rid of this and put the prototypes back up there in 6186
6099 #### the per-file stuff, where they belong. */ 6187 /* Defined in window.c */
6100 6188 extern Lisp_Object Qwindow_live_p;
6101 /* Use the following when you have to add a bunch of symbols. */
6102
6103 /*
6104
6105 (defun redo-symbols (beg end)
6106 "Snarf any symbols out of the region and print them into a temporary buffer,
6107 which is displayed when the function finishes. The symbols are laid out with
6108 `extern Lisp_Object ' before each one, with as many as can fit on one line
6109 \(the maximum line width is controlled by the constant `max-line-length' in the
6110 code)."
6111 (interactive "r")
6112 (save-excursion
6113 (goto-char beg)
6114 (let (syms)
6115 (while (re-search-forward "\\s-\\(Q[A-Za-z_0-9]+\\)" end t)
6116 (push (match-string 1) syms))
6117 (setq syms (sort syms #'string-lessp))
6118 (with-output-to-temp-buffer "*Symbols*"
6119 (let* ((col 0)
6120 (start "extern Lisp_Object ")
6121 (startlen (length start))
6122 ;; with a default-width frame of 80 chars, you can only fit
6123 ;; 79 before wrapping. you can see this to a lower value if
6124 ;; you don't want it right up against the right margin.
6125 (max-line-length 79))
6126 (dolist (sym syms)
6127 (cond (;; if something already on line (this will always be the
6128 ;; case except the very first iteration), see what
6129 ;; space we've got. (need to take into account 2
6130 ;; for the comma+space, 1 for the semicolon at the
6131 ;; end.) if enough space, do it.
6132 (and (> col 0) (< (+ col (length sym) 2)
6133 (1- max-line-length)))
6134 (princ ", ")
6135 (princ sym)
6136 (incf col 2)
6137 (incf col (length sym)))
6138 (t
6139 ;; either we're first iteration or we ran out of space.
6140 ;; if the latter, terminate the previous line. this
6141 ;; loop is written on purpose so that it always prints
6142 ;; at least one item, even if that would go over.
6143 (when (> col 0)
6144 (princ ";\n")
6145 (setq col 0))
6146 (princ start)
6147 (incf col startlen)
6148 (princ sym)
6149 (incf col (length sym)))))
6150 ;; finally terminate the last line.
6151 (princ ";\n"))))))
6152
6153 */
6154
6155 extern Lisp_Object Qactivate_menubar_hook, Qand_optional, Qand_rest, Qautoload,
6156 Qbackground, Qbackground_pixmap, Qblinking, Qbuffer_glyph_p, Qbuffer_live_p,
6157 Qcall_interactively, Qcategory_designator_p,
6158 Qcategory_table_value_p, Qcdr, Qcolor_pixmap_image_instance_p, Qcommandp,
6159 Qcompletion_ignore_case, Qconsole_live_p, Qconst_specifier, Qcurrent_menubar,
6160 Qdefun, Qdevice_live_p, Qdim, Qdirection, Qdisabled, Qdisabled_command_hook,
6161 Qdisplay_table, Qdll_error, Qend_open, Qerror_lacks_explanatory_string,
6162 Qevent_live_p, Qexit, Qextent_live_p, Qexternal_debugging_output, Qfeaturep,
6163 Qfile_error, Qfile_name_sans_extension, Qfinal, Qforeground, Qformat,
6164 Qframe_live_p, Qgraphic, Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit,
6165 Qinhibit_read_only, Qinteractive, Qlayout, Qload, Qlong_name, Qmacro,
6166 Qmakunbound, Qmark, Qmodule, Qmono_pixmap_image_instance_p,
6167 Qmouse_leave_buffer_hook, Qnative_layout, Qnetwork_error,
6168 Qnothing_image_instance_p, Qpoint, Qpointer_glyph_p,
6169 Qpointer_image_instance_p, Qprint_length, Qprint_string_length, Qprogn,
6170 Qread_char, Qread_from_minibuffer, Qreally_early_error_handler,
6171 Qregion_beginning, Qregion_end, Qregistries, Qreverse_direction_charset,
6172 Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs, Qself_insert_command,
6173 Qself_insert_defer_undo, Qsequencep, Qset, Qshort_name, Qsound_error,
6174 Qstandard_input, Qstandard_output, Qstart_open, Qstring_lessp, Qsubwindow,
6175 Qsubwindow_image_instance_p, Qtext_image_instance_p, Qtop_level, Qunderline,
6176 Quser_files_and_directories, Qvalues, Qvariable_documentation,
6177 Qvariable_domain, Qwindow_live_p, Qyes_or_no_p;
6178
6179 extern MODULE_API Lisp_Object Qprocess_error, Qt, Qunbound;
6180
6181 #define SYMBOL(fou) extern Lisp_Object fou
6182 #define SYMBOL_MODULE_API(fou) extern MODULE_API Lisp_Object fou
6183 #define SYMBOL_KEYWORD(la_cle_est_fou) extern Lisp_Object la_cle_est_fou
6184 #define SYMBOL_GENERAL(tout_le_monde, est_fou) \
6185 extern Lisp_Object tout_le_monde
6186
6187 #include "general-slots.h"
6188
6189 #undef SYMBOL
6190 #undef SYMBOL_MODULE_API
6191 #undef SYMBOL_KEYWORD
6192 #undef SYMBOL_GENERAL
6193
6194 /*--------------- prototypes for variables of type Lisp_Object ------------*/
6195
6196 /* #### We should get rid of this and put the prototypes back up there in
6197 #### the per-file stuff, where they belong. */
6198
6199 extern Lisp_Object Vactivate_menubar_hook;
6200 extern Lisp_Object Vautoload_queue, Vblank_menubar;
6201 extern Lisp_Object Vcommand_history;
6202 extern Lisp_Object Vcommand_line_args, Vconfigure_info_directory;
6203 extern Lisp_Object Vconfigure_site_directory, Vconfigure_site_module_directory;
6204 extern Lisp_Object Vconsole_list, Vcontrolling_terminal;
6205 extern Lisp_Object Vcurrent_load_list;
6206 extern Lisp_Object Vcurrent_mouse_event, Vcurrent_prefix_arg, Vdata_directory;
6207 extern Lisp_Object Vdirectory_sep_char, Vdisabled_command_hook;
6208 extern Lisp_Object Vdoc_directory, Vinternal_doc_file_name;
6209 extern Lisp_Object Vecho_area_buffer, Vemacs_major_version;
6210 extern Lisp_Object Vemacs_minor_version, Vexec_directory, Vexec_path;
6211 extern Lisp_Object Vexecuting_macro, Vfeatures, Vfile_domain;
6212 extern Lisp_Object Vinvocation_directory, Vinvocation_name;
6213 extern Lisp_Object Vlast_command, Vlast_command_char;
6214 extern Lisp_Object Vlast_command_event, Vlast_input_event;
6215 extern Lisp_Object Vload_file_name_internal, Vload_history;
6216 extern Lisp_Object Vload_path, Vmark_even_if_inactive, Vmenubar_configuration;
6217 extern Lisp_Object Vminibuf_preprompt, Vminibuf_prompt, Vminibuffer_zero;
6218 extern Lisp_Object Vmodule_directory, Vmswindows_downcase_file_names;
6219 extern Lisp_Object Vmswindows_get_true_file_attributes, Vobarray;
6220 extern Lisp_Object Vprint_length, Vprint_level, Vprocess_environment;
6221 extern Lisp_Object Vrecent_keys_ring, Vshell_file_name, Vsite_directory;
6222 extern Lisp_Object Vsite_module_directory;
6223 extern Lisp_Object Vstandard_input, Vstandard_output, Vstdio_str;
6224 extern Lisp_Object Vsynchronous_sounds, Vsystem_name;
6225 extern Lisp_Object Vthis_command_keys, Vunread_command_event;
6226 extern Lisp_Object Vx_initial_argv_list;
6227
6228 extern MODULE_API Lisp_Object Vinhibit_quit, Vquit_flag;
6229 6189
6230 END_C_DECLS 6190 END_C_DECLS
6231 6191
6232 #endif /* INCLUDED_lisp_h_ */ 6192 #endif /* INCLUDED_lisp_h_ */