comparison src/lisp.h @ 5118:e0db3c197671 ben-lisp-object

merge up to latest default branch, doesn't compile yet
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 21:18:49 -0600
parents 3742ea8250b5 17f7e9191c0b
children d1247f3cc363
comparison
equal deleted inserted replaced
5117:3742ea8250b5 5118:e0db3c197671
208 #define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##UL 208 #define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##UL
209 #elif SIZEOF_LONG_LONG == 8 209 #elif SIZEOF_LONG_LONG == 8
210 #define INT_64_BIT long long 210 #define INT_64_BIT long long
211 #define UINT_64_BIT unsigned long long 211 #define UINT_64_BIT unsigned long long
212 #define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##ULL 212 #define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##ULL
213 #elif defined(WIN32_ANY)
214 #define INT_64_BIT __int64
215 #define UINT_64_BIT unsigned __int64
216 #define MAKE_64_BIT_UNSIGNED_CONSTANT(num) num##UI64
213 /* No error otherwise; just leave undefined */ 217 /* No error otherwise; just leave undefined */
214 #endif 218 #endif
215 219
216 #if SIZEOF_LONG_LONG == 16 220 #if SIZEOF_LONG_LONG == 16
217 #define INT_128_BIT long long 221 #define INT_128_BIT long long
248 /* Just pray. May break, may not. */ 252 /* Just pray. May break, may not. */
249 typedef long intptr_t; 253 typedef long intptr_t;
250 typedef unsigned long uintptr_t; 254 typedef unsigned long uintptr_t;
251 #endif 255 #endif
252 256
257 #if SIZEOF_VOID_P == 8
258 #define DEADBEEF_CONSTANT 0xCAFEBABEDEADBEEF
259 #elif SIZEOF_VOID_P == 4
260 #define DEADBEEF_CONSTANT 0xDEADBEEF
261 #else
262 #error "What size are your pointers, really?"
263 #endif /* SIZEOF_VOID_P == 8 */
264
253 /* ---------------------- definition of EMACS_INT --------------------- */ 265 /* ---------------------- definition of EMACS_INT --------------------- */
254 266
255 /* EMACS_INT is the underlying integral type into which a Lisp_Object must fit. 267 /* EMACS_INT is the underlying integral type into which a Lisp_Object must fit.
256 In particular, it must be large enough to contain a pointer. 268 In particular, it must be large enough to contain a pointer.
257 config.h can override this, e.g. to use `long long' for bigger lisp ints. 269 config.h can override this, e.g. to use `long long' for bigger lisp ints.
397 409
398 /* ------------------------ other text-related typedefs ------------------- */ 410 /* ------------------------ other text-related typedefs ------------------- */
399 411
400 /* To the user, a buffer is made up of characters. In the non-Mule world, 412 /* To the user, a buffer is made up of characters. In the non-Mule world,
401 characters and Ibytes are equivalent, restricted to the range 0 - 255. 413 characters and Ibytes are equivalent, restricted to the range 0 - 255.
402 In the Mule world, many more characters are possible (19 bits worth, 414 In the Mule world, many more characters are possible (21 bits worth,
403 more or less), and a character requires (typically) 1 to 4 Ibytes for 415 more or less), and a character requires (typically) 1 to 4 Ibytes for
404 its representation in a buffer or string. Note that the representation 416 its representation in a buffer or string. Note that the representation
405 of a character by itself, in a variable, is very different from its 417 of a character by itself, in a variable, is very different from its
406 representation in a string of text (in a buffer or Lisp string). 418 representation in a string of text (in a buffer or Lisp string).
407 419
1082 evaluation and obviated the need for the TYPE argument. But that triggered 1094 evaluation and obviated the need for the TYPE argument. But that triggered
1083 complaints under strict aliasing. #### There should be a better way. */ 1095 complaints under strict aliasing. #### There should be a better way. */
1084 #define xfree(lvalue, type) do \ 1096 #define xfree(lvalue, type) do \
1085 { \ 1097 { \
1086 xfree_1 (lvalue); \ 1098 xfree_1 (lvalue); \
1087 VOIDP_CAST (lvalue) = (void *) 0xDEADBEEF; \ 1099 VOIDP_CAST (lvalue) = (void *) DEADBEEF_CONSTANT; \
1088 } while (0) 1100 } while (0)
1089 #else 1101 #else
1090 #define xfree(lvalue,type) xfree_1 (lvalue) 1102 #define xfree(lvalue,type) xfree_1 (lvalue)
1091 #endif /* ERROR_CHECK_MALLOC */ 1103 #endif /* ERROR_CHECK_MALLOC */
1092 1104
1249 (sizevar) *= 2; \ 1261 (sizevar) *= 2; \
1250 XREALLOC_ARRAY (basevar, type, (sizevar)); \ 1262 XREALLOC_ARRAY (basevar, type, (sizevar)); \
1251 } \ 1263 } \
1252 } while (0) 1264 } while (0)
1253 1265
1266 /************************************************************************/
1267 /** Definitions of more complex types **/
1268 /************************************************************************/
1269
1270 /* Note that the simplest typedefs are near the top of this file. */
1271
1272 /* We put typedefs here so that prototype declarations don't choke.
1273 Note that we don't actually declare the structures here (except
1274 maybe for simple structures like Dynarrs); that keeps them private
1275 to the routines that actually use them. */
1276
1277 /* ------------------------------- */
1278 /* Error_Behavior typedefs */
1279 /* ------------------------------- */
1280
1281 #ifndef ERROR_CHECK_TYPES
1282
1283 typedef enum error_behavior
1284 {
1285 ERROR_ME,
1286 ERROR_ME_NOT,
1287 ERROR_ME_WARN,
1288 ERROR_ME_DEBUG_WARN
1289 } Error_Behavior;
1290
1291 #define ERRB_EQ(a, b) ((a) == (b))
1292
1293 #else
1294
1295 /* By defining it like this, we provide strict type-checking
1296 for code that lazily uses ints. */
1297
1298 typedef struct _error_behavior_struct_
1299 {
1300 int really_unlikely_name_to_have_accidentally_in_a_non_errb_structure;
1301 } Error_Behavior;
1302
1303 extern Error_Behavior ERROR_ME;
1304 extern Error_Behavior ERROR_ME_NOT;
1305 extern Error_Behavior ERROR_ME_WARN;
1306 extern Error_Behavior ERROR_ME_DEBUG_WARN;
1307
1308 #define ERRB_EQ(a, b) \
1309 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \
1310 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure)
1311
1312 #endif
1313
1314 /* ------------------------------- */
1315 /* Empty structures and typedefs */
1316 /* ------------------------------- */
1317
1318 struct buffer; /* "buffer.h" */
1319 struct console; /* "console.h" */
1320 struct device; /* "device.h" */
1321 struct extent_fragment;
1322 struct extent;
1323 struct frame; /* "frame.h" */
1324 struct window; /* "window.h" */
1325 struct utimbuf; /* "systime.h" or <utime.h> */
1326 struct display_line;
1327 struct display_glyph_area;
1328 struct display_box;
1329 struct redisplay_info;
1330 struct window_mirror;
1331 struct scrollbar_instance;
1332 struct font_metric_info;
1333 struct face_cachel;
1334 struct console_type_entry;
1335
1336 /* This is shared by process.h, events.h and others in future.
1337 See events.h for description */
1338 typedef unsigned EMACS_INT USID;
1339 typedef int face_index;
1340 typedef int glyph_index;
1341 typedef struct lstream Lstream; /* lstream.h */
1342 typedef struct extent *EXTENT; /* extents-impl.h */
1343 typedef struct Lisp_Event Lisp_Event; /* "events.h" */
1344 typedef struct Lisp_Face Lisp_Face; /* "faces-impl.h" */
1345 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */
1346 typedef struct Lisp_Color_Instance Lisp_Color_Instance; /* objects-impl.h */
1347 typedef struct Lisp_Font_Instance Lisp_Font_Instance; /* objects-impl.h */
1348 typedef struct Lisp_Image_Instance Lisp_Image_Instance; /* glyphs.h */
1349 typedef struct Lisp_Gui_Item Lisp_Gui_Item;
1350
1351 /* ------------------------------- */
1352 /* enum typedefs */
1353 /* ------------------------------- */
1354
1355 enum run_hooks_condition
1356 {
1357 RUN_HOOKS_TO_COMPLETION,
1358 RUN_HOOKS_UNTIL_SUCCESS,
1359 RUN_HOOKS_UNTIL_FAILURE
1360 };
1361
1362 #ifdef HAVE_TOOLBARS
1363 enum toolbar_pos
1364 {
1365 TOP_TOOLBAR,
1366 BOTTOM_TOOLBAR,
1367 LEFT_TOOLBAR,
1368 RIGHT_TOOLBAR
1369 };
1370 #endif
1371
1372 enum edge_style
1373 {
1374 EDGE_ETCHED_IN,
1375 EDGE_ETCHED_OUT,
1376 EDGE_BEVEL_IN,
1377 EDGE_BEVEL_OUT
1378 };
1379
1380 enum munge_me_out_the_door
1381 {
1382 MUNGE_ME_FUNCTION_KEY,
1383 MUNGE_ME_KEY_TRANSLATION
1384 };
1385
1386 /* ------------------------------- */
1387 /* misc */
1388 /* ------------------------------- */
1389
1390 #ifdef MEMORY_USAGE_STATS
1391
1392 /* This structure is used to keep statistics on the amount of memory
1393 in use.
1394
1395 WAS_REQUESTED stores the actual amount of memory that was requested
1396 of the allocation function. The *_OVERHEAD fields store the
1397 additional amount of memory that was grabbed by the functions to
1398 facilitate allocation, reallocation, etc. MALLOC_OVERHEAD is for
1399 memory allocated with malloc(); DYNARR_OVERHEAD is for dynamic
1400 arrays; GAP_OVERHEAD is for gap arrays. Note that for (e.g.)
1401 dynamic arrays, there is both MALLOC_OVERHEAD and DYNARR_OVERHEAD
1402 memory: The dynamic array allocates memory above and beyond what
1403 was asked of it, and when it in turns allocates memory using
1404 malloc(), malloc() allocates memory beyond what it was asked
1405 to allocate.
1406
1407 Functions that accept a structure of this sort do not initialize
1408 the fields to 0, and add any existing values to whatever was there
1409 before; this way, you can get a cumulative effect. */
1410
1411 struct overhead_stats
1412 {
1413 int was_requested;
1414 int malloc_overhead;
1415 int dynarr_overhead;
1416 int gap_overhead;
1417 };
1418
1419 #endif /* MEMORY_USAGE_STATS */
1420
1421
1422 /************************************************************************/
1423 /* Definition of Lisp_Object data type */
1424 /************************************************************************/
1425
1426 /* Define the fundamental Lisp data structures */
1427
1428 /* This is the set of Lisp data types */
1429
1430 enum Lisp_Type
1431 {
1432 Lisp_Type_Record,
1433 Lisp_Type_Int_Even,
1434 Lisp_Type_Char,
1435 Lisp_Type_Int_Odd
1436 };
1437
1438 #define POINTER_TYPE_P(type) ((type) == Lisp_Type_Record)
1439
1440 /* Overridden by m/next.h */
1441 #ifndef ASSERT_VALID_POINTER
1442 # define ASSERT_VALID_POINTER(pnt) (assert ((((EMACS_UINT) pnt) & 3) == 0))
1443 #endif
1444
1445 #define GCMARKBITS 0
1446 #define GCTYPEBITS 2
1447 #define GCBITS 2
1448 #define INT_GCBITS 1
1449
1450 #define INT_VALBITS (BITS_PER_EMACS_INT - INT_GCBITS)
1451 #define VALBITS (BITS_PER_EMACS_INT - GCBITS)
1452 #define EMACS_INT_MAX ((EMACS_INT) ((1UL << (INT_VALBITS - 1)) -1UL))
1453 #define EMACS_INT_MIN (-(EMACS_INT_MAX) - 1)
1454 /* WARNING: evaluates its arg twice. */
1455 #define NUMBER_FITS_IN_AN_EMACS_INT(num) \
1456 ((num) <= EMACS_INT_MAX && (num) >= EMACS_INT_MIN)
1457
1458 #ifdef USE_UNION_TYPE
1459 # include "lisp-union.h"
1460 #else /* !USE_UNION_TYPE */
1461 # include "lisp-disunion.h"
1462 #endif /* !USE_UNION_TYPE */
1463
1464 #define XPNTR(x) ((void *) XPNTRVAL(x))
1465
1466 /* Close your eyes now lest you vomit or spontaneously combust ... */
1467
1468 #define HACKEQ_UNSAFE(obj1, obj2) \
1469 (EQ (obj1, obj2) || (!POINTER_TYPE_P (XTYPE (obj1)) \
1470 && !POINTER_TYPE_P (XTYPE (obj2)) \
1471 && XCHAR_OR_INT (obj1) == XCHAR_OR_INT (obj2)))
1472
1473 #ifdef DEBUG_XEMACS
1474 extern MODULE_API int debug_issue_ebola_notices;
1475 MODULE_API int eq_with_ebola_notice (Lisp_Object, Lisp_Object);
1476 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) \
1477 (debug_issue_ebola_notices ? eq_with_ebola_notice (obj1, obj2) \
1478 : EQ (obj1, obj2))
1479 #else
1480 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) EQ (obj1, obj2)
1481 #endif
1482
1483 /* OK, you can open them again */
1484
1485 END_C_DECLS
1486
1487 /************************************************************************/
1488 /** Definitions of basic Lisp objects **/
1489 /************************************************************************/
1490
1491 #include "lrecord.h"
1492
1493 BEGIN_C_DECLS
1494
1254 /* ------------------------ dynamic arrays ------------------- */ 1495 /* ------------------------ dynamic arrays ------------------- */
1255 1496
1497 #ifdef NEW_GC
1256 #ifdef ERROR_CHECK_STRUCTURES 1498 #ifdef ERROR_CHECK_STRUCTURES
1257 #define Dynarr_declare(type) \ 1499 #define Dynarr_declare(type) \
1258 type *base; \ 1500 struct lrecord_header header; \
1259 int locked; \ 1501 type *base; \
1260 int elsize; \ 1502 const struct lrecord_implementation *lisp_imp; \
1261 int cur; \ 1503 int locked; \
1262 int largest; \ 1504 int elsize; \
1505 int cur; \
1506 int largest; \
1263 int max 1507 int max
1264 #else 1508 #else
1265 #define Dynarr_declare(type) \ 1509 #define Dynarr_declare(type) \
1266 type *base; \ 1510 struct lrecord_header header; \
1267 int elsize; \ 1511 type *base; \
1268 int cur; \ 1512 const struct lrecord_implementation *lisp_imp; \
1269 int largest; \ 1513 int elsize; \
1514 int cur; \
1515 int largest; \
1270 int max 1516 int max
1271 #endif /* ERROR_CHECK_STRUCTURES */ 1517 #endif /* ERROR_CHECK_STRUCTURES */
1518 #else /* not NEW_GC */
1519 #ifdef ERROR_CHECK_STRUCTURES
1520 #define Dynarr_declare(type) \
1521 struct lrecord_header header; \
1522 type *base; \
1523 int locked; \
1524 int elsize; \
1525 int cur; \
1526 int largest; \
1527 int max
1528 #else
1529 #define Dynarr_declare(type) \
1530 struct lrecord_header header; \
1531 type *base; \
1532 int elsize; \
1533 int cur; \
1534 int largest; \
1535 int max
1536 #endif /* ERROR_CHECK_STRUCTURES */
1537 #endif /* not NEW_GC */
1272 1538
1273 typedef struct dynarr 1539 typedef struct dynarr
1274 { 1540 {
1275 Dynarr_declare (void); 1541 Dynarr_declare (void);
1276 } Dynarr; 1542 } Dynarr;
1277 1543
1278 MODULE_API void *Dynarr_newf (int elsize); 1544 MODULE_API void *Dynarr_newf (Bytecount elsize);
1279 MODULE_API void Dynarr_resize (void *dy, Elemcount size); 1545 MODULE_API void Dynarr_resize (void *dy, Elemcount size);
1280 MODULE_API void Dynarr_insert_many (void *d, const void *el, int len, int start); 1546 MODULE_API void Dynarr_insert_many (void *d, const void *el, int len, int start);
1281 MODULE_API void Dynarr_delete_many (void *d, int start, int len); 1547 MODULE_API void Dynarr_delete_many (void *d, int start, int len);
1282 MODULE_API void Dynarr_free (void *d); 1548 MODULE_API void Dynarr_free (void *d);
1283 1549
1550 #ifdef NEW_GC
1551 MODULE_API void *Dynarr_lisp_newf (Bytecount elsize,
1552 const struct lrecord_implementation
1553 *dynarr_imp,
1554 const struct lrecord_implementation *imp);
1555
1556 #define Dynarr_lisp_new(type, dynarr_imp, imp) \
1557 ((type##_dynarr *) Dynarr_lisp_newf (sizeof (type), dynarr_imp, imp))
1558 #define Dynarr_lisp_new2(dynarr_type, type, dynarr_imp, imp) \
1559 ((dynarr_type *) Dynarr_lisp_newf (sizeof (type)), dynarr_imp, imp)
1560 #endif /* NEW_GC */
1284 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type))) 1561 #define Dynarr_new(type) ((type##_dynarr *) Dynarr_newf (sizeof (type)))
1285 #define Dynarr_new2(dynarr_type, type) \ 1562 #define Dynarr_new2(dynarr_type, type) \
1286 ((dynarr_type *) Dynarr_newf (sizeof (type))) 1563 ((dynarr_type *) Dynarr_newf (sizeof (type)))
1287 #define Dynarr_at(d, pos) ((d)->base[pos]) 1564 #define Dynarr_at(d, pos) ((d)->base[pos])
1288 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) 1565 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos))
1342 LISP_STRING_TO_SIZED_EXTERNAL (dyna_ls_s, dyna_ls_eb, \ 1619 LISP_STRING_TO_SIZED_EXTERNAL (dyna_ls_s, dyna_ls_eb, \
1343 dyna_ls_bc, dyna_ls_cs); \ 1620 dyna_ls_bc, dyna_ls_cs); \
1344 Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \ 1621 Dynarr_add_many (d, dyna_ls_eb, dyna_ls_bc); \
1345 } while (0) 1622 } while (0)
1346 1623
1624 #ifdef NEW_GC
1625 #define Dynarr_add(d, el) \
1626 do { \
1627 const struct lrecord_implementation *imp = (d)->lisp_imp; \
1628 if (Dynarr_verify_mod (d)->cur >= (d)->max) \
1629 Dynarr_resize ((d), (d)->cur+1); \
1630 ((d)->base)[(d)->cur] = (el); \
1631 \
1632 if (imp) \
1633 set_lheader_implementation \
1634 ((struct lrecord_header *)&(((d)->base)[(d)->cur]), imp); \
1635 \
1636 (d)->cur++; \
1637 if ((d)->cur > (d)->largest) \
1638 (d)->largest = (d)->cur; \
1639 } while (0)
1640 #else /* not NEW_GC */
1347 #define Dynarr_add(d, el) ( \ 1641 #define Dynarr_add(d, el) ( \
1348 Dynarr_verify_mod (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : \ 1642 Dynarr_verify_mod (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : \
1349 (void) 0, \ 1643 (void) 0, \
1350 ((d)->base)[(d)->cur++] = (el), \ 1644 ((d)->base)[(d)->cur++] = (el), \
1351 (d)->cur > (d)->largest ? (d)->largest = (d)->cur : (int) 0) 1645 (d)->cur > (d)->largest ? (d)->largest = (d)->cur : (int) 0)
1646 #endif /* not NEW_GC */
1647
1352 1648
1353 /* The following defines will get you into real trouble if you aren't 1649 /* The following defines will get you into real trouble if you aren't
1354 careful. But they can save a lot of execution time when used wisely. */ 1650 careful. But they can save a lot of execution time when used wisely. */
1355 #define Dynarr_increment(d) (Dynarr_verify_mod (d)->cur++) 1651 #define Dynarr_increment(d) (Dynarr_verify_mod (d)->cur++)
1356 #define Dynarr_set_size(d, n) (Dynarr_verify_mod (d)->cur = n) 1652 #define Dynarr_set_size(d, n) (Dynarr_verify_mod (d)->cur = n)
1379 #endif 1675 #endif
1380 1676
1381 void *stack_like_malloc (Bytecount size); 1677 void *stack_like_malloc (Bytecount size);
1382 void stack_like_free (void *val); 1678 void stack_like_free (void *val);
1383 1679
1384 /************************************************************************/
1385 /** Definitions of more complex types **/
1386 /************************************************************************/
1387
1388 /* Note that the simplest typedefs are near the top of this file. */
1389
1390 /* We put typedefs here so that prototype declarations don't choke.
1391 Note that we don't actually declare the structures here (except
1392 maybe for simple structures like Dynarrs); that keeps them private
1393 to the routines that actually use them. */
1394
1395 /* ------------------------------- */
1396 /* Error_Behavior typedefs */
1397 /* ------------------------------- */
1398
1399 #ifndef ERROR_CHECK_TYPES
1400
1401 typedef enum error_behavior
1402 {
1403 ERROR_ME,
1404 ERROR_ME_NOT,
1405 ERROR_ME_WARN,
1406 ERROR_ME_DEBUG_WARN
1407 } Error_Behavior;
1408
1409 #define ERRB_EQ(a, b) ((a) == (b))
1410
1411 #else
1412
1413 /* By defining it like this, we provide strict type-checking
1414 for code that lazily uses ints. */
1415
1416 typedef struct _error_behavior_struct_
1417 {
1418 int really_unlikely_name_to_have_accidentally_in_a_non_errb_structure;
1419 } Error_Behavior;
1420
1421 extern Error_Behavior ERROR_ME;
1422 extern Error_Behavior ERROR_ME_NOT;
1423 extern Error_Behavior ERROR_ME_WARN;
1424 extern Error_Behavior ERROR_ME_DEBUG_WARN;
1425
1426 #define ERRB_EQ(a, b) \
1427 ((a).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure == \
1428 (b).really_unlikely_name_to_have_accidentally_in_a_non_errb_structure)
1429
1430 #endif
1431
1432 /* ------------------------------- */
1433 /* Empty structures and typedefs */
1434 /* ------------------------------- */
1435
1436 struct buffer; /* "buffer.h" */
1437 struct console; /* "console.h" */
1438 struct device; /* "device.h" */
1439 struct extent_fragment;
1440 struct extent;
1441 struct frame; /* "frame.h" */
1442 struct window; /* "window.h" */
1443 struct utimbuf; /* "systime.h" or <utime.h> */
1444 struct display_line;
1445 struct display_glyph_area;
1446 struct display_box;
1447 struct redisplay_info;
1448 struct window_mirror;
1449 struct scrollbar_instance;
1450 struct font_metric_info;
1451 struct face_cachel;
1452 struct console_type_entry;
1453
1454 /* This is shared by process.h, events.h and others in future.
1455 See events.h for description */
1456 typedef unsigned int USID;
1457 typedef int face_index;
1458 typedef int glyph_index;
1459 typedef struct lstream Lstream; /* lstream.h */
1460 typedef struct extent *EXTENT; /* extents-impl.h */
1461 typedef struct Lisp_Event Lisp_Event; /* "events.h" */
1462 typedef struct Lisp_Face Lisp_Face; /* "faces-impl.h" */
1463 typedef struct Lisp_Process Lisp_Process; /* "procimpl.h" */
1464 typedef struct Lisp_Color_Instance Lisp_Color_Instance; /* objects-impl.h */
1465 typedef struct Lisp_Font_Instance Lisp_Font_Instance; /* objects-impl.h */
1466 typedef struct Lisp_Image_Instance Lisp_Image_Instance; /* glyphs.h */
1467 typedef struct Lisp_Gui_Item Lisp_Gui_Item;
1468
1469 /* ------------------------------- */ 1680 /* ------------------------------- */
1470 /* Dynarr typedefs */ 1681 /* Dynarr typedefs */
1471 /* ------------------------------- */ 1682 /* ------------------------------- */
1472 1683
1473 /* Dynarr typedefs -- basic types first */ 1684 /* Dynarr typedefs -- basic types first */
1539 typedef struct 1750 typedef struct
1540 { 1751 {
1541 Dynarr_declare (struct face_cachel); 1752 Dynarr_declare (struct face_cachel);
1542 } face_cachel_dynarr; 1753 } face_cachel_dynarr;
1543 1754
1755 #ifdef NEW_GC
1756 DECLARE_LISP_OBJECT (face_cachel_dynarr, face_cachel_dynarr);
1757 #define XFACE_CACHEL_DYNARR(x) \
1758 XRECORD (x, face_cachel_dynarr, face_cachel_dynarr)
1759 #define wrap_face_cachel_dynarr(p) wrap_record (p, face_cachel_dynarr)
1760 #define FACE_CACHEL_DYNARRP(x) RECORDP (x, face_cachel_dynarr)
1761 #define CHECK_FACE_CACHEL_DYNARR(x) CHECK_RECORD (x, face_cachel_dynarr)
1762 #define CONCHECK_FACE_CACHEL_DYNARR(x) CONCHECK_RECORD (x, face_cachel_dynarr)
1763 #endif /* NEW_GC */
1764
1544 typedef struct 1765 typedef struct
1545 { 1766 {
1546 Dynarr_declare (struct glyph_cachel); 1767 Dynarr_declare (struct glyph_cachel);
1547 } glyph_cachel_dynarr; 1768 } glyph_cachel_dynarr;
1548 1769
1770 #ifdef NEW_GC
1771 DECLARE_LISP_OBJECT (glyph_cachel_dynarr, glyph_cachel_dynarr);
1772 #define XGLYPH_CACHEL_DYNARR(x) \
1773 XRECORD (x, glyph_cachel_dynarr, glyph_cachel_dynarr)
1774 #define wrap_glyph_cachel_dynarr(p) wrap_record (p, glyph_cachel_dynarr)
1775 #define GLYPH_CACHEL_DYNARRP(x) RECORDP (x, glyph_cachel_dynarr)
1776 #define CHECK_GLYPH_CACHEL_DYNARR(x) CHECK_RECORD (x, glyph_cachel_dynarr)
1777 #define CONCHECK_GLYPH_CACHEL_DYNARR(x) \
1778 CONCHECK_RECORD (x, glyph_cachel_dynarr)
1779 #endif /* NEW_GC */
1780
1549 typedef struct 1781 typedef struct
1550 { 1782 {
1551 Dynarr_declare (struct console_type_entry); 1783 Dynarr_declare (struct console_type_entry);
1552 } console_type_entry_dynarr; 1784 } console_type_entry_dynarr;
1553
1554 /* ------------------------------- */
1555 /* enum typedefs */
1556 /* ------------------------------- */
1557
1558 enum run_hooks_condition
1559 {
1560 RUN_HOOKS_TO_COMPLETION,
1561 RUN_HOOKS_UNTIL_SUCCESS,
1562 RUN_HOOKS_UNTIL_FAILURE
1563 };
1564
1565 #ifdef HAVE_TOOLBARS
1566 enum toolbar_pos
1567 {
1568 TOP_TOOLBAR,
1569 BOTTOM_TOOLBAR,
1570 LEFT_TOOLBAR,
1571 RIGHT_TOOLBAR
1572 };
1573 #endif
1574
1575 enum edge_style
1576 {
1577 EDGE_ETCHED_IN,
1578 EDGE_ETCHED_OUT,
1579 EDGE_BEVEL_IN,
1580 EDGE_BEVEL_OUT
1581 };
1582
1583 enum munge_me_out_the_door
1584 {
1585 MUNGE_ME_FUNCTION_KEY,
1586 MUNGE_ME_KEY_TRANSLATION
1587 };
1588
1589 /* ------------------------------- */
1590 /* misc */
1591 /* ------------------------------- */
1592
1593 #ifdef MEMORY_USAGE_STATS
1594
1595 /* This structure is used to keep statistics on the amount of memory
1596 in use.
1597
1598 WAS_REQUESTED stores the actual amount of memory that was requested
1599 of the allocation function. The *_OVERHEAD fields store the
1600 additional amount of memory that was grabbed by the functions to
1601 facilitate allocation, reallocation, etc. MALLOC_OVERHEAD is for
1602 memory allocated with malloc(); DYNARR_OVERHEAD is for dynamic
1603 arrays; GAP_OVERHEAD is for gap arrays. Note that for (e.g.)
1604 dynamic arrays, there is both MALLOC_OVERHEAD and DYNARR_OVERHEAD
1605 memory: The dynamic array allocates memory above and beyond what
1606 was asked of it, and when it in turns allocates memory using
1607 malloc(), malloc() allocates memory beyond what it was asked
1608 to allocate.
1609
1610 Functions that accept a structure of this sort do not initialize
1611 the fields to 0, and add any existing values to whatever was there
1612 before; this way, you can get a cumulative effect. */
1613
1614 struct overhead_stats
1615 {
1616 int was_requested;
1617 int malloc_overhead;
1618 int dynarr_overhead;
1619 int gap_overhead;
1620 };
1621
1622 #endif /* MEMORY_USAGE_STATS */
1623
1624
1625 /************************************************************************/
1626 /* Definition of Lisp_Object data type */
1627 /************************************************************************/
1628
1629 /* Define the fundamental Lisp data structures */
1630
1631 /* This is the set of Lisp data types */
1632
1633 enum Lisp_Type
1634 {
1635 Lisp_Type_Record,
1636 Lisp_Type_Int_Even,
1637 Lisp_Type_Char,
1638 Lisp_Type_Int_Odd
1639 };
1640
1641 #define POINTER_TYPE_P(type) ((type) == Lisp_Type_Record)
1642
1643 /* Overridden by m/next.h */
1644 #ifndef ASSERT_VALID_POINTER
1645 # define ASSERT_VALID_POINTER(pnt) (assert ((((EMACS_UINT) pnt) & 3) == 0))
1646 #endif
1647
1648 #define GCMARKBITS 0
1649 #define GCTYPEBITS 2
1650 #define GCBITS 2
1651 #define INT_GCBITS 1
1652
1653 #define INT_VALBITS (BITS_PER_EMACS_INT - INT_GCBITS)
1654 #define VALBITS (BITS_PER_EMACS_INT - GCBITS)
1655 #define EMACS_INT_MAX ((EMACS_INT) ((1UL << (INT_VALBITS - 1)) -1UL))
1656 #define EMACS_INT_MIN (-(EMACS_INT_MAX) - 1)
1657 /* WARNING: evaluates its arg twice. */
1658 #define NUMBER_FITS_IN_AN_EMACS_INT(num) \
1659 ((num) <= EMACS_INT_MAX && (num) >= EMACS_INT_MIN)
1660
1661 #ifdef USE_UNION_TYPE
1662 # include "lisp-union.h"
1663 #else /* !USE_UNION_TYPE */
1664 # include "lisp-disunion.h"
1665 #endif /* !USE_UNION_TYPE */
1666
1667 #define XPNTR(x) ((void *) XPNTRVAL(x))
1668 1785
1669 /* WARNING WARNING WARNING. You must ensure on your own that proper 1786 /* WARNING WARNING WARNING. You must ensure on your own that proper
1670 GC protection is provided for the elements in this array. */ 1787 GC protection is provided for the elements in this array. */
1671 typedef struct 1788 typedef struct
1672 { 1789 {
1675 1792
1676 typedef struct 1793 typedef struct
1677 { 1794 {
1678 Dynarr_declare (Lisp_Object *); 1795 Dynarr_declare (Lisp_Object *);
1679 } Lisp_Object_ptr_dynarr; 1796 } Lisp_Object_ptr_dynarr;
1680
1681 /* Close your eyes now lest you vomit or spontaneously combust ... */
1682
1683 #define HACKEQ_UNSAFE(obj1, obj2) \
1684 (EQ (obj1, obj2) || (!POINTER_TYPE_P (XTYPE (obj1)) \
1685 && !POINTER_TYPE_P (XTYPE (obj2)) \
1686 && XCHAR_OR_INT (obj1) == XCHAR_OR_INT (obj2)))
1687
1688 #ifdef DEBUG_XEMACS
1689 extern MODULE_API int debug_issue_ebola_notices;
1690 MODULE_API int eq_with_ebola_notice (Lisp_Object, Lisp_Object);
1691 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) \
1692 (debug_issue_ebola_notices ? eq_with_ebola_notice (obj1, obj2) \
1693 : EQ (obj1, obj2))
1694 #else
1695 #define EQ_WITH_EBOLA_NOTICE(obj1, obj2) EQ (obj1, obj2)
1696 #endif
1697
1698 /* OK, you can open them again */
1699
1700 END_C_DECLS
1701
1702 /************************************************************************/
1703 /** Definitions of basic Lisp objects **/
1704 /************************************************************************/
1705
1706 #include "lrecord.h"
1707
1708 BEGIN_C_DECLS
1709 1797
1710 /*------------------------------ unbound -------------------------------*/ 1798 /*------------------------------ unbound -------------------------------*/
1711 1799
1712 /* Qunbound is a special Lisp_Object (actually of type 1800 /* Qunbound is a special Lisp_Object (actually of type
1713 symbol-value-forward), that can never be visible to 1801 symbol-value-forward), that can never be visible to
1752 #define wrap_cons(p) wrap_record (p, cons) 1840 #define wrap_cons(p) wrap_record (p, cons)
1753 #define CONSP(x) RECORDP (x, cons) 1841 #define CONSP(x) RECORDP (x, cons)
1754 #define CHECK_CONS(x) CHECK_RECORD (x, cons) 1842 #define CHECK_CONS(x) CHECK_RECORD (x, cons)
1755 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons) 1843 #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons)
1756 1844
1757 #ifdef MC_ALLOC 1845 #ifdef NEW_GC
1758 #define CONS_MARKED_P(c) MARKED_P (&((c)->lheader)) 1846 #define CONS_MARKED_P(c) MARKED_P (&((c)->lheader))
1759 #define MARK_CONS(c) MARK (&((c)->lheader)) 1847 #define MARK_CONS(c) MARK (&((c)->lheader))
1760 #else /* not MC_ALLOC */ 1848 #else /* not NEW_GC */
1761 #define CONS_MARKED_P(c) MARKED_RECORD_HEADER_P(&((c)->lheader)) 1849 #define CONS_MARKED_P(c) MARKED_RECORD_HEADER_P(&((c)->lheader))
1762 #define MARK_CONS(c) MARK_RECORD_HEADER (&((c)->lheader)) 1850 #define MARK_CONS(c) MARK_RECORD_HEADER (&((c)->lheader))
1763 #endif /* not MC_ALLOC */ 1851 #endif /* not NEW_GC */
1764 1852
1765 extern MODULE_API Lisp_Object Qnil; 1853 extern MODULE_API Lisp_Object Qnil;
1766 1854
1767 #define NILP(x) EQ (x, Qnil) 1855 #define NILP(x) EQ (x, Qnil)
1768 #define cons_car(a) ((a)->car_) 1856 #define cons_car(a) ((a)->car_)
2280 signal_malformed_list_error (CTL_list); \ 2368 signal_malformed_list_error (CTL_list); \
2281 } while (0) 2369 } while (0)
2282 2370
2283 /*------------------------------ string --------------------------------*/ 2371 /*------------------------------ string --------------------------------*/
2284 2372
2373 #ifdef NEW_GC
2374 struct Lisp_String_Direct_Data
2375 {
2376 struct lrecord_header header;
2377 Bytecount size;
2378 Ibyte data[1];
2379 };
2380 typedef struct Lisp_String_Direct_Data Lisp_String_Direct_Data;
2381
2382 DECLARE_MODULE_API_LRECORD (string_direct_data, Lisp_String_Direct_Data);
2383 #define XSTRING_DIRECT_DATA(x) \
2384 XRECORD (x, string_direct_data, Lisp_String_Direct_Data)
2385 #define wrap_string_direct_data(p) wrap_record (p, string_direct_data)
2386 #define STRING_DIRECT_DATAP(x) RECORDP (x, string_direct_data)
2387 #define CHECK_STRING_DIRECT_DATA(x) CHECK_RECORD (x, string_direct_data)
2388 #define CONCHECK_STRING_DIRECT_DATA(x) CONCHECK_RECORD (x, string_direct_data)
2389
2390 #define XSTRING_DIRECT_DATA_SIZE(x) XSTRING_DIRECT_DATA (x)->size
2391 #define XSTRING_DIRECT_DATA_DATA(x) XSTRING_DIRECT_DATA (x)->data
2392
2393
2394 struct Lisp_String_Indirect_Data
2395 {
2396 struct lrecord_header header;
2397 Bytecount size;
2398 Ibyte *data;
2399 };
2400 typedef struct Lisp_String_Indirect_Data Lisp_String_Indirect_Data;
2401
2402 DECLARE_MODULE_API_LRECORD (string_indirect_data, Lisp_String_Indirect_Data);
2403 #define XSTRING_INDIRECT_DATA(x) \
2404 XRECORD (x, string_indirect_data, Lisp_String_Indirect_Data)
2405 #define wrap_string_indirect_data(p) wrap_record (p, string_indirect_data)
2406 #define STRING_INDIRECT_DATAP(x) RECORDP (x, string_indirect_data)
2407 #define CHECK_STRING_INDIRECT_DATA(x) CHECK_RECORD (x, string_indirect_data)
2408 #define CONCHECK_STRING_INDIRECT_DATA(x) \
2409 CONCHECK_RECORD (x, string_indirect_data)
2410
2411 #define XSTRING_INDIRECT_DATA_SIZE(x) XSTRING_INDIRECT_DATA (x)->size
2412 #define XSTRING_INDIRECT_DATA_DATA(x) XSTRING_INDIRECT_DATA (x)->data
2413
2414
2415 #define XSTRING_DATA_SIZE(s) ((s)->indirect)? \
2416 XSTRING_INDIRECT_DATA_SIZE ((s)->data_object): \
2417 XSTRING_DIRECT_DATA_SIZE ((s)->data_object)
2418 #define XSTRING_DATA_DATA(s) ((s)->indirect)? \
2419 XSTRING_INDIRECT_DATA_DATA ((s)->data_object): \
2420 XSTRING_DIRECT_DATA_DATA ((s)->data_object)
2421
2422 #define XSET_STRING_DATA_SIZE(s, len) \
2423 if ((s)->indirect) \
2424 XSTRING_INDIRECT_DATA_SIZE ((s)->data_object) = len; \
2425 else \
2426 XSTRING_DIRECT_DATA_SIZE ((s)->data_object) = len
2427 #define XSET_STRING_DATA_DATA(s, ptr) \
2428 if ((s)->indirect) \
2429 XSTRING_INDIRECT_DATA_DATA ((s)->data_object) = ptr; \
2430 else \
2431 XSTRING_DIRECT_DATA_DATA ((s)->data_object) = ptr
2432 #endif /* NEW_GC */
2433
2285 struct Lisp_String 2434 struct Lisp_String
2286 { 2435 {
2287 union 2436 union
2288 { 2437 {
2289 struct lrecord_header lheader; 2438 struct lrecord_header lheader;
2290 struct 2439 struct
2291 { 2440 {
2292 /* WARNING: Everything before ascii_begin must agree exactly with 2441 /* WARNING: Everything before ascii_begin must agree exactly with
2293 struct lrecord_header */ 2442 struct lrecord_header */
2294 unsigned int type :8; 2443 unsigned int type :8;
2295 #ifdef MC_ALLOC 2444 #ifdef NEW_GC
2296 unsigned int lisp_readonly :1; 2445 unsigned int lisp_readonly :1;
2297 unsigned int free :1; 2446 unsigned int free :1;
2298 /* Number of chars at beginning of string that are one byte in length 2447 /* Number of chars at beginning of string that are one byte in length
2299 (byte_ascii_p) */ 2448 (byte_ascii_p) */
2300 unsigned int ascii_begin :22; 2449 unsigned int ascii_begin :22;
2301 #else /* not MC_ALLOC */ 2450 #else /* not NEW_GC */
2302 unsigned int mark :1; 2451 unsigned int mark :1;
2303 unsigned int c_readonly :1; 2452 unsigned int c_readonly :1;
2304 unsigned int lisp_readonly :1; 2453 unsigned int lisp_readonly :1;
2305 /* Number of chars at beginning of string that are one byte in length 2454 /* Number of chars at beginning of string that are one byte in length
2306 (byte_ascii_p) */ 2455 (byte_ascii_p) */
2307 unsigned int ascii_begin :21; 2456 unsigned int ascii_begin :21;
2308 #endif /* not MC_ALLOC */ 2457 #endif /* not NEW_GC */
2309 } v; 2458 } v;
2310 } u; 2459 } u;
2460 #ifdef NEW_GC
2461 int indirect;
2462 Lisp_Object data_object;
2463 #else /* not NEW_GC */
2311 Bytecount size_; 2464 Bytecount size_;
2312 Ibyte *data_; 2465 Ibyte *data_;
2466 #endif /* not NEW_GC */
2313 Lisp_Object plist; 2467 Lisp_Object plist;
2314 }; 2468 };
2315 typedef struct Lisp_String Lisp_String; 2469 typedef struct Lisp_String Lisp_String;
2316 2470
2317 #ifdef MC_ALLOC 2471 #ifdef NEW_GC
2318 #define MAX_STRING_ASCII_BEGIN ((1 << 22) - 1) 2472 #define MAX_STRING_ASCII_BEGIN ((1 << 22) - 1)
2319 #else 2473 #else /* not NEW_GC */
2320 #define MAX_STRING_ASCII_BEGIN ((1 << 21) - 1) 2474 #define MAX_STRING_ASCII_BEGIN ((1 << 21) - 1)
2321 #endif 2475 #endif /* not NEW_GC */
2322 2476
2323 DECLARE_MODULE_API_LRECORD (string, Lisp_String); 2477 DECLARE_MODULE_API_LRECORD (string, Lisp_String);
2324 #define XSTRING(x) XRECORD (x, string, Lisp_String) 2478 #define XSTRING(x) XRECORD (x, string, Lisp_String)
2325 #define wrap_string(p) wrap_record (p, string) 2479 #define wrap_string(p) wrap_record (p, string)
2326 #define STRINGP(x) RECORDP (x, string) 2480 #define STRINGP(x) RECORDP (x, string)
2330 /* Most basic macros for strings -- basically just accessing or setting 2484 /* Most basic macros for strings -- basically just accessing or setting
2331 fields -- are here. Everything else is in text.h, since they depend on 2485 fields -- are here. Everything else is in text.h, since they depend on
2332 stuff there. */ 2486 stuff there. */
2333 2487
2334 /* Operations on Lisp_String *'s; only ones left */ 2488 /* Operations on Lisp_String *'s; only ones left */
2489 #ifdef NEW_GC
2490 #define set_lispstringp_direct(s) ((s)->indirect = 0)
2491 #define set_lispstringp_indirect(s) ((s)->indirect = 1)
2492 #define set_lispstringp_length(s, len) XSET_STRING_DATA_SIZE (s, len)
2493 #define set_lispstringp_data(s, ptr) XSET_STRING_DATA_DATA (s, ptr)
2494 #else /* not NEW_GC */
2335 #define set_lispstringp_length(s, len) ((void) ((s)->size_ = (len))) 2495 #define set_lispstringp_length(s, len) ((void) ((s)->size_ = (len)))
2336 #define set_lispstringp_data(s, ptr) ((void) ((s)->data_ = (ptr))) 2496 #define set_lispstringp_data(s, ptr) ((void) ((s)->data_ = (ptr)))
2497 #endif /* not NEW_GC */
2337 2498
2338 /* Operations on strings as Lisp_Objects. Don't manipulate Lisp_String *'s 2499 /* Operations on strings as Lisp_Objects. Don't manipulate Lisp_String *'s
2339 in any new code. */ 2500 in any new code. */
2501 #ifdef NEW_GC
2502 #define STRING_DATA_OBJECT(s) ((s)->data_object)
2503 #define XSTRING_DATA_OBJECT(s) (STRING_DATA_OBJECT (XSTRING (s)))
2504 #define XSTRING_LENGTH(s) (XSTRING_DATA_SIZE (XSTRING (s)))
2505 #else /* not NEW_GC */
2340 #define XSTRING_LENGTH(s) (XSTRING (s)->size_) 2506 #define XSTRING_LENGTH(s) (XSTRING (s)->size_)
2507 #endif /* not NEW_GC */
2341 #define XSTRING_PLIST(s) (XSTRING (s)->plist) 2508 #define XSTRING_PLIST(s) (XSTRING (s)->plist)
2509 #ifdef NEW_GC
2510 #define XSTRING_DATA(s) (XSTRING_DATA_DATA (XSTRING (s)))
2511 #else /* not NEW_GC */
2342 #define XSTRING_DATA(s) (XSTRING (s)->data_ + 0) 2512 #define XSTRING_DATA(s) (XSTRING (s)->data_ + 0)
2513 #endif /* not NEW_GC */
2343 #define XSTRING_ASCII_BEGIN(s) (XSTRING (s)->u.v.ascii_begin + 0) 2514 #define XSTRING_ASCII_BEGIN(s) (XSTRING (s)->u.v.ascii_begin + 0)
2344 #define XSET_STRING_LENGTH(s, ptr) set_lispstringp_length (XSTRING (s), ptr) 2515 #define XSET_STRING_LENGTH(s, ptr) set_lispstringp_length (XSTRING (s), ptr)
2345 #define XSET_STRING_DATA(s, ptr) set_lispstringp_data (XSTRING (s), ptr) 2516 #define XSET_STRING_DATA(s, ptr) set_lispstringp_data (XSTRING (s), ptr)
2346 /* WARNING: If you modify an existing string, you must call 2517 /* WARNING: If you modify an existing string, you must call
2347 bump_string_modiff() afterwards. */ 2518 bump_string_modiff() afterwards. */
2380 long size; 2551 long size;
2381 Lisp_Object contents[1]; 2552 Lisp_Object contents[1];
2382 }; 2553 };
2383 typedef struct Lisp_Vector Lisp_Vector; 2554 typedef struct Lisp_Vector Lisp_Vector;
2384 2555
2385 DECLARE_LRECORD (vector, Lisp_Vector); 2556 DECLARE_LISP_OBJECT (vector, Lisp_Vector);
2386 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector) 2557 #define XVECTOR(x) XRECORD (x, vector, Lisp_Vector)
2387 #define wrap_vector(p) wrap_record (p, vector) 2558 #define wrap_vector(p) wrap_record (p, vector)
2388 #define VECTORP(x) RECORDP (x, vector) 2559 #define VECTORP(x) RECORDP (x, vector)
2389 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector) 2560 #define CHECK_VECTOR(x) CHECK_RECORD (x, vector)
2390 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector) 2561 #define CONCHECK_VECTOR(x) CONCHECK_RECORD (x, vector)
2417 Elemcount size; 2588 Elemcount size;
2418 unsigned long bits[1]; 2589 unsigned long bits[1];
2419 }; 2590 };
2420 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector; 2591 typedef struct Lisp_Bit_Vector Lisp_Bit_Vector;
2421 2592
2422 DECLARE_LRECORD (bit_vector, Lisp_Bit_Vector); 2593 DECLARE_LISP_OBJECT (bit_vector, Lisp_Bit_Vector);
2423 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector) 2594 #define XBIT_VECTOR(x) XRECORD (x, bit_vector, Lisp_Bit_Vector)
2424 #define wrap_bit_vector(p) wrap_record (p, bit_vector) 2595 #define wrap_bit_vector(p) wrap_record (p, bit_vector)
2425 #define BIT_VECTORP(x) RECORDP (x, bit_vector) 2596 #define BIT_VECTORP(x) RECORDP (x, bit_vector)
2426 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector) 2597 #define CHECK_BIT_VECTOR(x) CHECK_RECORD (x, bit_vector)
2427 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector) 2598 #define CONCHECK_BIT_VECTOR(x) CONCHECK_RECORD (x, bit_vector)
2462 2633
2463 /* Number of longs required to hold LEN bits */ 2634 /* Number of longs required to hold LEN bits */
2464 #define BIT_VECTOR_LONG_STORAGE(len) \ 2635 #define BIT_VECTOR_LONG_STORAGE(len) \
2465 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2) 2636 (((len) + LONGBITS_POWER_OF_2 - 1) >> LONGBITS_LOG2)
2466 2637
2638 /* For when we want to include a bit vector in another structure, and we
2639 know it's of a fixed size. */
2640 #define DECLARE_INLINE_LISP_BIT_VECTOR(numbits) struct { \
2641 struct LCRECORD_HEADER lheader; \
2642 Elemcount size; \
2643 unsigned long bits[BIT_VECTOR_LONG_STORAGE(numbits)]; \
2644 }
2467 2645
2468 /*------------------------------ symbol --------------------------------*/ 2646 /*------------------------------ symbol --------------------------------*/
2469 2647
2470 typedef struct Lisp_Symbol Lisp_Symbol; 2648 typedef struct Lisp_Symbol Lisp_Symbol;
2471 struct Lisp_Symbol 2649 struct Lisp_Symbol
2515 struct Lisp_Subr 2693 struct Lisp_Subr
2516 { 2694 {
2517 struct lrecord_header lheader; 2695 struct lrecord_header lheader;
2518 short min_args; 2696 short min_args;
2519 short max_args; 2697 short max_args;
2698 /* #### We should make these const Ascbyte * or const Ibyte *, not const
2699 char *. */
2520 const char *prompt; 2700 const char *prompt;
2521 const char *doc; 2701 const char *doc;
2522 const char *name; 2702 const char *name;
2523 lisp_fn_t subr_fn; 2703 lisp_fn_t subr_fn;
2524 }; 2704 };
2525 typedef struct Lisp_Subr Lisp_Subr; 2705 typedef struct Lisp_Subr Lisp_Subr;
2526 2706
2527 DECLARE_LRECORD (subr, Lisp_Subr); 2707 DECLARE_LISP_OBJECT (subr, Lisp_Subr);
2528 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr) 2708 #define XSUBR(x) XRECORD (x, subr, Lisp_Subr)
2529 #define wrap_subr(p) wrap_record (p, subr) 2709 #define wrap_subr(p) wrap_record (p, subr)
2530 #define SUBRP(x) RECORDP (x, subr) 2710 #define SUBRP(x) RECORDP (x, subr)
2531 #define CHECK_SUBR(x) CHECK_RECORD (x, subr) 2711 #define CHECK_SUBR(x) CHECK_RECORD (x, subr)
2532 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr) 2712 #define CONCHECK_SUBR(x) CONCHECK_RECORD (x, subr)
2712 return CHARP (obj) ? XCHAR (obj) : XINT (obj); 2892 return CHARP (obj) ? XCHAR (obj) : XINT (obj);
2713 } 2893 }
2714 2894
2715 #else /* no error checking */ 2895 #else /* no error checking */
2716 2896
2717 #define XCHAR_OR_INT(obj) (CHARP (obj) ? XCHAR (obj) : XINT (obj)) 2897 /* obj is multiply eval'ed and not an lvalue; use an inline function instead
2898 of a macro. */
2899 DECLARE_INLINE_HEADER (
2900 EMACS_INT
2901 XCHAR_OR_INT (Lisp_Object obj)
2902 )
2903 {
2904 return CHARP (obj) ? XCHAR (obj) : XINT (obj);
2905 }
2718 2906
2719 #endif /* no error checking */ 2907 #endif /* no error checking */
2720 2908
2721 /* True of X is an integer whose value is the valid integral equivalent of a 2909 /* True of X is an integer whose value is the valid integral equivalent of a
2722 character. */ 2910 character. */
2791 struct lrecord_header lheader; 2979 struct lrecord_header lheader;
2792 union { double d; struct Lisp_Float *unused_next_; } data; 2980 union { double d; struct Lisp_Float *unused_next_; } data;
2793 }; 2981 };
2794 typedef struct Lisp_Float Lisp_Float; 2982 typedef struct Lisp_Float Lisp_Float;
2795 2983
2796 DECLARE_LRECORD (float, Lisp_Float); 2984 DECLARE_LISP_OBJECT (float, Lisp_Float);
2797 #define XFLOAT(x) XRECORD (x, float, Lisp_Float) 2985 #define XFLOAT(x) XRECORD (x, float, Lisp_Float)
2798 #define wrap_float(p) wrap_record (p, float) 2986 #define wrap_float(p) wrap_record (p, float)
2799 #define FLOATP(x) RECORDP (x, float) 2987 #define FLOATP(x) RECORDP (x, float)
2800 #define CHECK_FLOAT(x) CHECK_RECORD (x, float) 2988 #define CHECK_FLOAT(x) CHECK_RECORD (x, float)
2801 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float) 2989 #define CONCHECK_FLOAT(x) CONCHECK_RECORD (x, float)
2817 3005
2818 # define INT_OR_FLOATP(x) (INTP (x) || FLOATP (x)) 3006 # define INT_OR_FLOATP(x) (INTP (x) || FLOATP (x))
2819 3007
2820 /*--------------------------- readonly objects -------------------------*/ 3008 /*--------------------------- readonly objects -------------------------*/
2821 3009
2822 #ifndef MC_ALLOC 3010 #ifndef NEW_GC
2823 #define CHECK_C_WRITEABLE(obj) \ 3011 #define CHECK_C_WRITEABLE(obj) \
2824 do { if (c_readonly (obj)) c_write_error (obj); } while (0) 3012 do { if (c_readonly (obj)) c_write_error (obj); } while (0)
2825 3013
2826 #define C_READONLY(obj) (C_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj))) 3014 #define C_READONLY(obj) (C_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
2827 #endif /* not MC_ALLOC */ 3015 #endif /* not NEW_GC */
2828 3016
2829 #define CHECK_LISP_WRITEABLE(obj) \ 3017 #define CHECK_LISP_WRITEABLE(obj) \
2830 do { if (lisp_readonly (obj)) lisp_write_error (obj); } while (0) 3018 do { if (lisp_readonly (obj)) lisp_write_error (obj); } while (0)
2831 3019
2832 #define LISP_READONLY(obj) (LISP_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj))) 3020 #define LISP_READONLY(obj) (LISP_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj)))
2884 3072
2885 void prune_weak_boxes (void); 3073 void prune_weak_boxes (void);
2886 Lisp_Object make_weak_box (Lisp_Object value); 3074 Lisp_Object make_weak_box (Lisp_Object value);
2887 Lisp_Object weak_box_ref (Lisp_Object value); 3075 Lisp_Object weak_box_ref (Lisp_Object value);
2888 3076
2889 DECLARE_LRECORD (weak_box, struct weak_box); 3077 DECLARE_LISP_OBJECT (weak_box, struct weak_box);
2890 #define XWEAK_BOX(x) XRECORD (x, weak_box, struct weak_box) 3078 #define XWEAK_BOX(x) XRECORD (x, weak_box, struct weak_box)
2891 #define XSET_WEAK_BOX(x, v) (XWEAK_BOX (x)->value = (v)) 3079 #define XSET_WEAK_BOX(x, v) (XWEAK_BOX (x)->value = (v))
2892 #define wrap_weak_box(p) wrap_record (p, weak_box) 3080 #define wrap_weak_box(p) wrap_record (p, weak_box)
2893 #define WEAK_BOXP(x) RECORDP (x, weak_box) 3081 #define WEAK_BOXP(x) RECORDP (x, weak_box)
2894 #define CHECK_WEAK_BOX(x) CHECK_RECORD (x, weak_box) 3082 #define CHECK_WEAK_BOX(x) CHECK_RECORD (x, weak_box)
2921 int continue_marking_ephemerons(void); 3109 int continue_marking_ephemerons(void);
2922 int finish_marking_ephemerons(void); 3110 int finish_marking_ephemerons(void);
2923 Lisp_Object zap_finalize_list(void); 3111 Lisp_Object zap_finalize_list(void);
2924 Lisp_Object make_ephemeron(Lisp_Object key, Lisp_Object value, Lisp_Object finalizer); 3112 Lisp_Object make_ephemeron(Lisp_Object key, Lisp_Object value, Lisp_Object finalizer);
2925 3113
2926 DECLARE_LRECORD(ephemeron, struct ephemeron); 3114 DECLARE_LISP_OBJECT(ephemeron, struct ephemeron);
2927 #define XEPHEMERON(x) XRECORD (x, ephemeron, struct ephemeron) 3115 #define XEPHEMERON(x) XRECORD (x, ephemeron, struct ephemeron)
2928 #define XEPHEMERON_REF(x) (XEPHEMERON (x)->value) 3116 #define XEPHEMERON_REF(x) (XEPHEMERON (x)->value)
2929 #define XEPHEMERON_NEXT(x) (XCDR (XEPHEMERON(x)->cons_chain)) 3117 #define XEPHEMERON_NEXT(x) (XCDR (XEPHEMERON(x)->cons_chain))
2930 #define XEPHEMERON_FINALIZER(x) (XCDR (XCAR (XEPHEMERON (x)->cons_chain))) 3118 #define XEPHEMERON_FINALIZER(x) (XCDR (XCAR (XEPHEMERON (x)->cons_chain)))
2931 #define XSET_EPHEMERON_NEXT(x, n) (XSETCDR (XEPHEMERON(x)->cons_chain, n)) 3119 #define XSET_EPHEMERON_NEXT(x, n) (XSETCDR (XEPHEMERON(x)->cons_chain, n))
2961 Lisp_Object list; /* don't mark through this! */ 3149 Lisp_Object list; /* don't mark through this! */
2962 enum weak_list_type type; 3150 enum weak_list_type type;
2963 Lisp_Object next_weak; /* don't mark through this! */ 3151 Lisp_Object next_weak; /* don't mark through this! */
2964 }; 3152 };
2965 3153
2966 DECLARE_LRECORD (weak_list, struct weak_list); 3154 DECLARE_LISP_OBJECT (weak_list, struct weak_list);
2967 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list) 3155 #define XWEAK_LIST(x) XRECORD (x, weak_list, struct weak_list)
2968 #define wrap_weak_list(p) wrap_record (p, weak_list) 3156 #define wrap_weak_list(p) wrap_record (p, weak_list)
2969 #define WEAK_LISTP(x) RECORDP (x, weak_list) 3157 #define WEAK_LISTP(x) RECORDP (x, weak_list)
2970 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list) 3158 #define CHECK_WEAK_LIST(x) CHECK_RECORD (x, weak_list)
2971 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list) 3159 #define CONCHECK_WEAK_LIST(x) CONCHECK_RECORD (x, weak_list)
3064 #define UNEVALLED -1 3252 #define UNEVALLED -1
3065 3253
3066 /* Can't be const, because then subr->doc is read-only and 3254 /* Can't be const, because then subr->doc is read-only and
3067 Snarf_documentation chokes */ 3255 Snarf_documentation chokes */
3068 3256
3069 #ifdef MC_ALLOC 3257 #ifdef NEW_GC
3070 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \ 3258 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \
3071 Lisp_Object Fname (EXFUN_##max_args); \ 3259 Lisp_Object Fname (EXFUN_##max_args); \
3072 static struct Lisp_Subr MC_ALLOC_S##Fname = \ 3260 static struct Lisp_Subr MC_ALLOC_S##Fname = \
3073 { \ 3261 { \
3074 { /* struct lrecord_header */ \ 3262 { /* struct lrecord_header */ \
3106 }; \ 3294 }; \
3107 static struct Lisp_Subr *S##Fname; \ 3295 static struct Lisp_Subr *S##Fname; \
3108 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist) 3296 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist)
3109 #define GET_DEFUN_LISP_OBJECT(Fname) \ 3297 #define GET_DEFUN_LISP_OBJECT(Fname) \
3110 wrap_subr (S##Fname); 3298 wrap_subr (S##Fname);
3111 #else /* not MC_ALLOC */ 3299 #else /* not NEW_GC */
3112 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \ 3300 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \
3113 Lisp_Object Fname (EXFUN_##max_args); \ 3301 Lisp_Object Fname (EXFUN_##max_args); \
3114 static struct Lisp_Subr S##Fname = \ 3302 static struct Lisp_Subr S##Fname = \
3115 { \ 3303 { \
3116 { /* struct lrecord_header */ \ 3304 { /* struct lrecord_header */ \
3148 (lisp_fn_t) Fname \ 3336 (lisp_fn_t) Fname \
3149 }; \ 3337 }; \
3150 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist) 3338 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist)
3151 #define GET_DEFUN_LISP_OBJECT(Fname) \ 3339 #define GET_DEFUN_LISP_OBJECT(Fname) \
3152 wrap_subr (&S##Fname); 3340 wrap_subr (&S##Fname);
3153 #endif /* not MC_ALLOC */ 3341 #endif /* not NEW_GC */
3154 3342
3155 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a 3343 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a
3156 prototype that matches max_args, and add the obligatory 3344 prototype that matches max_args, and add the obligatory
3157 `Lisp_Object' type declaration to the formal C arguments. */ 3345 `Lisp_Object' type declaration to the formal C arguments. */
3158 3346
3622 UNGCPRO; \ 3810 UNGCPRO; \
3623 RETURN_SANS_WARNINGS ret_ungc_val; \ 3811 RETURN_SANS_WARNINGS ret_ungc_val; \
3624 } while (0) 3812 } while (0)
3625 3813
3626 extern Lisp_Object_ptr_dynarr *staticpros; 3814 extern Lisp_Object_ptr_dynarr *staticpros;
3627 3815 extern Lisp_Object_ptr_dynarr *staticpros_nodump;
3628 #ifdef DEBUG_XEMACS 3816 #ifdef DEBUG_XEMACS
3629 3817
3630 /* Help debug crashes gc-marking a staticpro'ed object. */ 3818 /* Help debug crashes gc-marking a staticpro'ed object. */
3631 3819
3632 MODULE_API void staticpro_1 (Lisp_Object *, Ascbyte *); 3820 MODULE_API void staticpro_1 (Lisp_Object *, Ascbyte *);
3633 MODULE_API void staticpro_nodump_1 (Lisp_Object *, Ascbyte *); 3821 MODULE_API void staticpro_nodump_1 (Lisp_Object *, Ascbyte *);
3634 #define staticpro(ptr) staticpro_1 (ptr, #ptr) 3822 /* g++ 4.3 complains about the conversion of const char to char.
3635 #define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, #ptr) 3823 These end up in a dynarray, so we would need to define a whole new class
3824 of dynarray just to handle the const char stuff.
3825 ####Check to see how hard this might be. */
3826 #define staticpro(ptr) staticpro_1 (ptr, (Ascbyte *) #ptr)
3827 #define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, (Ascbyte *) #ptr)
3636 3828
3637 #ifdef HAVE_SHLIB 3829 #ifdef HAVE_SHLIB
3638 MODULE_API void unstaticpro_nodump_1 (Lisp_Object *, Ascbyte *); 3830 MODULE_API void unstaticpro_nodump_1 (Lisp_Object *, Ascbyte *);
3639 #define unstaticpro_nodump(ptr) unstaticpro_nodump_1 (ptr, #ptr) 3831 #define unstaticpro_nodump(ptr) unstaticpro_nodump_1 (ptr, (Ascbyte *) #ptr)
3640 #endif 3832 #endif
3641 3833
3642 #else 3834 #else
3643 3835
3644 /* Call staticpro (&var) to protect static variable `var'. */ 3836 /* Call staticpro (&var) to protect static variable `var'. */
3653 MODULE_API void unstaticpro_nodump (Lisp_Object *); 3845 MODULE_API void unstaticpro_nodump (Lisp_Object *);
3654 #endif 3846 #endif
3655 3847
3656 #endif 3848 #endif
3657 3849
3658 #ifdef MC_ALLOC 3850 #ifdef NEW_GC
3659 extern Lisp_Object_dynarr *mcpros; 3851 extern Lisp_Object_dynarr *mcpros;
3660 #ifdef DEBUG_XEMACS 3852 #ifdef DEBUG_XEMACS
3661 /* Help debug crashes gc-marking a mcpro'ed object. */ 3853 /* Help debug crashes gc-marking a mcpro'ed object. */
3662 MODULE_API void mcpro_1 (Lisp_Object, char *); 3854 MODULE_API void mcpro_1 (Lisp_Object, char *);
3663 #define mcpro(ptr) mcpro_1 (ptr, #ptr) 3855 #define mcpro(ptr) mcpro_1 (ptr, #ptr)
3664 #else /* not DEBUG_XEMACS */ 3856 #else /* not DEBUG_XEMACS */
3665 /* Call mcpro (&var) to protect mc variable `var'. */ 3857 /* Call mcpro (&var) to protect mc variable `var'. */
3666 MODULE_API void mcpro (Lisp_Object); 3858 MODULE_API void mcpro (Lisp_Object);
3667 #endif /* not DEBUG_XEMACS */ 3859 #endif /* not DEBUG_XEMACS */
3668 #endif /* MC_ALLOC */ 3860 #endif /* NEW_GC */
3669 3861
3670 void register_post_gc_action (void (*fun) (void *), void *arg); 3862 void register_post_gc_action (void (*fun) (void *), void *arg);
3671 int begin_gc_forbidden (void); 3863 int begin_gc_forbidden (void);
3672 void end_gc_forbidden (int count); 3864 void end_gc_forbidden (int count);
3673 extern int gc_currently_forbidden; 3865 extern int gc_currently_forbidden;
3721 MODULE_API EXFUN (Fmake_string, 2); 3913 MODULE_API EXFUN (Fmake_string, 2);
3722 MODULE_API EXFUN (Fmake_symbol, 1); 3914 MODULE_API EXFUN (Fmake_symbol, 1);
3723 MODULE_API EXFUN (Fmake_vector, 2); 3915 MODULE_API EXFUN (Fmake_vector, 2);
3724 MODULE_API EXFUN (Fvector, MANY); 3916 MODULE_API EXFUN (Fvector, MANY);
3725 3917
3726 #ifndef MC_ALLOC 3918 #ifndef NEW_GC
3727 void release_breathing_space (void); 3919 void release_breathing_space (void);
3728 #endif /* not MC_ALLOC */ 3920 #endif /* not NEW_GC */
3729 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object); 3921 Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object);
3730 MODULE_API Lisp_Object make_vector (Elemcount, Lisp_Object); 3922 MODULE_API Lisp_Object make_vector (Elemcount, Lisp_Object);
3731 MODULE_API Lisp_Object vector1 (Lisp_Object); 3923 MODULE_API Lisp_Object vector1 (Lisp_Object);
3732 MODULE_API Lisp_Object vector2 (Lisp_Object, Lisp_Object); 3924 MODULE_API Lisp_Object vector2 (Lisp_Object, Lisp_Object);
3733 MODULE_API Lisp_Object vector3 (Lisp_Object, Lisp_Object, Lisp_Object); 3925 MODULE_API Lisp_Object vector3 (Lisp_Object, Lisp_Object, Lisp_Object);
3734 Lisp_Object make_bit_vector (Elemcount, Lisp_Object); 3926 Lisp_Object make_bit_vector (Elemcount, Lisp_Object);
3735 Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, Elemcount); 3927 Lisp_Object make_bit_vector_from_byte_vector (unsigned char *, Elemcount);
3736 Lisp_Object noseeum_make_marker (void); 3928 Lisp_Object noseeum_make_marker (void);
3929 #ifndef NEW_GC
3737 void garbage_collect_1 (void); 3930 void garbage_collect_1 (void);
3931 #endif /* not NEW_GC */
3738 MODULE_API Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object); 3932 MODULE_API Lisp_Object acons (Lisp_Object, Lisp_Object, Lisp_Object);
3739 MODULE_API Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object); 3933 MODULE_API Lisp_Object cons3 (Lisp_Object, Lisp_Object, Lisp_Object);
3740 MODULE_API Lisp_Object list1 (Lisp_Object); 3934 MODULE_API Lisp_Object list1 (Lisp_Object);
3741 MODULE_API Lisp_Object list2 (Lisp_Object, Lisp_Object); 3935 MODULE_API Lisp_Object list2 (Lisp_Object, Lisp_Object);
3742 MODULE_API Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object); 3936 MODULE_API Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
3747 MODULE_API Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, 3941 MODULE_API Lisp_Object list6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
3748 Lisp_Object, Lisp_Object); 3942 Lisp_Object, Lisp_Object);
3749 DECLARE_DOESNT_RETURN (memory_full (void)); 3943 DECLARE_DOESNT_RETURN (memory_full (void));
3750 void disksave_object_finalization (void); 3944 void disksave_object_finalization (void);
3751 extern int purify_flag; 3945 extern int purify_flag;
3946 #ifndef NEW_GC
3752 extern EMACS_INT gc_generation_number[1]; 3947 extern EMACS_INT gc_generation_number[1];
3948 #endif /* not NEW_GC */
3753 int c_readonly (Lisp_Object); 3949 int c_readonly (Lisp_Object);
3754 int lisp_readonly (Lisp_Object); 3950 int lisp_readonly (Lisp_Object);
3755 MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src); 3951 MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src);
3756 MODULE_API Lisp_Object build_intstring (const Ibyte *); 3952 MODULE_API Lisp_Object build_intstring (const Ibyte *);
3757 MODULE_API Lisp_Object build_string (const CIbyte *); 3953 MODULE_API Lisp_Object build_string (const CIbyte *);
3768 void free_list (Lisp_Object); 3964 void free_list (Lisp_Object);
3769 void free_alist (Lisp_Object); 3965 void free_alist (Lisp_Object);
3770 void free_marker (Lisp_Object); 3966 void free_marker (Lisp_Object);
3771 int object_dead_p (Lisp_Object); 3967 int object_dead_p (Lisp_Object);
3772 void mark_object (Lisp_Object obj); 3968 void mark_object (Lisp_Object obj);
3969 #ifndef NEW_GC
3773 #ifdef USE_KKCC 3970 #ifdef USE_KKCC
3774 #ifdef DEBUG_XEMACS 3971 #ifdef DEBUG_XEMACS
3775 void kkcc_gc_stack_push_lisp_object_1 (Lisp_Object obj, int level, int pos); 3972 void kkcc_gc_stack_push_lisp_object_1 (Lisp_Object obj, int level, int pos);
3776 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \ 3973 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \
3777 kkcc_gc_stack_push_lisp_object_1 (obj, level, pos) 3974 kkcc_gc_stack_push_lisp_object_1 (obj, level, pos)
3781 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \ 3978 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \
3782 kkcc_gc_stack_push_lisp_object_1 (obj) 3979 kkcc_gc_stack_push_lisp_object_1 (obj)
3783 #define kkcc_backtrace() 3980 #define kkcc_backtrace()
3784 #endif 3981 #endif
3785 #endif /* USE_KKCC */ 3982 #endif /* USE_KKCC */
3983 #endif /* not NEW_GC */
3786 int marked_p (Lisp_Object obj); 3984 int marked_p (Lisp_Object obj);
3787 extern int funcall_allocation_flag; 3985 extern int funcall_allocation_flag;
3788 extern int need_to_garbage_collect; 3986 extern int need_to_garbage_collect;
3789 extern MODULE_API int need_to_check_c_alloca; 3987 extern MODULE_API int need_to_check_c_alloca;
3790 extern int need_to_signal_post_gc; 3988 extern int need_to_signal_post_gc;
4067 /* Defined in eval.c */ 4265 /* Defined in eval.c */
4068 MODULE_API EXFUN (Fapply, MANY); 4266 MODULE_API EXFUN (Fapply, MANY);
4069 EXFUN (Fbacktrace, 2); 4267 EXFUN (Fbacktrace, 2);
4070 EXFUN (Fcommand_execute, 3); 4268 EXFUN (Fcommand_execute, 3);
4071 EXFUN (Fcommandp, 1); 4269 EXFUN (Fcommandp, 1);
4270 EXFUN (Fquote_maybe, 1);
4072 MODULE_API EXFUN (Feval, 1); 4271 MODULE_API EXFUN (Feval, 1);
4073 MODULE_API EXFUN (Ffuncall, MANY); 4272 MODULE_API EXFUN (Ffuncall, MANY);
4074 EXFUN (Ffunctionp, 1); 4273 EXFUN (Ffunctionp, 1);
4075 EXFUN (Finteractive_p, 0); 4274 EXFUN (Finteractive_p, 0);
4076 EXFUN (Fprogn, UNEVALLED); 4275 EXFUN (Fprogn, UNEVALLED);
4077 MODULE_API EXFUN (Fsignal, 2); 4276 MODULE_API EXFUN (Fsignal, 2);
4078 MODULE_API EXFUN_NORETURN (Fthrow, 2); 4277 MODULE_API EXFUN_NORETURN (Fthrow, UNEVALLED);
4079 MODULE_API EXFUN (Fcall_with_condition_handler, MANY); 4278 MODULE_API EXFUN (Fcall_with_condition_handler, MANY);
4080 EXFUN (Ffunction_max_args, 1); 4279 EXFUN (Ffunction_max_args, 1);
4081 EXFUN (Ffunction_min_args, 1); 4280 EXFUN (Ffunction_min_args, 1);
4281
4282 MODULE_API DECLARE_DOESNT_RETURN (throw_or_bomb_out (Lisp_Object,
4283 Lisp_Object, int,
4284 Lisp_Object, Lisp_Object));
4082 4285
4083 MODULE_API DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object)); 4286 MODULE_API DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object));
4084 void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object, 4287 void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object,
4085 Error_Behavior); 4288 Error_Behavior);
4086 Lisp_Object maybe_signal_continuable_error_1 (Lisp_Object, Lisp_Object, 4289 Lisp_Object maybe_signal_continuable_error_1 (Lisp_Object, Lisp_Object,
4429 EXFUN (Fencode_big5_char, 1); 4632 EXFUN (Fencode_big5_char, 1);
4430 EXFUN (Fencode_coding_region, 4); 4633 EXFUN (Fencode_coding_region, 4);
4431 EXFUN (Fencode_shift_jis_char, 1); 4634 EXFUN (Fencode_shift_jis_char, 1);
4432 EXFUN (Ffind_coding_system, 1); 4635 EXFUN (Ffind_coding_system, 1);
4433 EXFUN (Fget_coding_system, 1); 4636 EXFUN (Fget_coding_system, 1);
4434 EXFUN (Fmake_coding_system, 4); 4637 EXFUN (Fmake_coding_system_internal, 4);
4435 EXFUN (Fset_coding_category_system, 2); 4638 EXFUN (Fset_coding_category_system, 2);
4436 EXFUN (Fset_coding_priority_list, 1); 4639 EXFUN (Fset_coding_priority_list, 1);
4437 EXFUN (Fsubsidiary_coding_system, 2); 4640 EXFUN (Fsubsidiary_coding_system, 2);
4438 4641
4439 extern Lisp_Object Qshift_jis, Qiso2022, Qbig5, Qccl; 4642 extern Lisp_Object Qshift_jis, Qiso2022, Qbig5, Qccl;
4505 void unlock_file (Lisp_Object); 4708 void unlock_file (Lisp_Object);
4506 void unlock_all_files (void); 4709 void unlock_all_files (void);
4507 void unlock_buffer (struct buffer *); 4710 void unlock_buffer (struct buffer *);
4508 4711
4509 /* Defined in floatfns.c */ 4712 /* Defined in floatfns.c */
4510 EXFUN (Ftruncate, 1); 4713 EXFUN (Ftruncate, 2);
4511 4714
4512 double extract_float (Lisp_Object); 4715 double extract_float (Lisp_Object);
4513 4716
4514 /* Defined in fns.c */ 4717 /* Defined in fns.c */
4515 MODULE_API EXFUN (Fappend, MANY); 4718 MODULE_API EXFUN (Fappend, MANY);
4740 EXFUN (Fprin1, 2); 4943 EXFUN (Fprin1, 2);
4741 EXFUN (Fprin1_to_string, 2); 4944 EXFUN (Fprin1_to_string, 2);
4742 EXFUN (Fprinc, 2); 4945 EXFUN (Fprinc, 2);
4743 EXFUN (Fprint, 2); 4946 EXFUN (Fprint, 2);
4744 4947
4948 Lisp_Object prin1_to_string (Lisp_Object, int);
4745 4949
4746 /* Lower-level ways to output data: */ 4950 /* Lower-level ways to output data: */
4951 void default_object_printer (Lisp_Object, Lisp_Object, int);
4747 void print_internal (Lisp_Object, Lisp_Object, int); 4952 void print_internal (Lisp_Object, Lisp_Object, int);
4748 void debug_print (Lisp_Object); 4953 void debug_print (Lisp_Object);
4749 void debug_p4 (Lisp_Object obj); 4954 void debug_p4 (Lisp_Object obj);
4750 void debug_p3 (Lisp_Object obj); 4955 void debug_p3 (Lisp_Object obj);
4751 void debug_short_backtrace (int); 4956 void debug_short_backtrace (int);
4789 floating point computations to define a compile-time integral 4994 floating point computations to define a compile-time integral
4790 constant. */ 4995 constant. */
4791 #define DECIMAL_PRINT_SIZE(integral_type) \ 4996 #define DECIMAL_PRINT_SIZE(integral_type) \
4792 (((2410824 * sizeof (integral_type)) / 1000000) + 3) 4997 (((2410824 * sizeof (integral_type)) / 1000000) + 3)
4793 void long_to_string (char *, long); 4998 void long_to_string (char *, long);
4999 void ulong_to_bit_string (char *, unsigned long);
4794 extern int print_escape_newlines; 5000 extern int print_escape_newlines;
4795 extern MODULE_API int print_readably; 5001 extern MODULE_API int print_readably;
4796 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object, 5002 Lisp_Object internal_with_output_to_temp_buffer (Lisp_Object,
4797 Lisp_Object (*) (Lisp_Object), 5003 Lisp_Object (*) (Lisp_Object),
4798 Lisp_Object, Lisp_Object); 5004 Lisp_Object, Lisp_Object);
4799 void float_to_string (char *, double); 5005 void float_to_string (char *, double);
5006 void internal_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
5007 int UNUSED (escapeflag));
4800 void external_object_printer (Lisp_Object obj, Lisp_Object printcharfun, 5008 void external_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
4801 int UNUSED (escapeflag)); 5009 int UNUSED (escapeflag));
4802 5010
4803 /* Defined in rangetab.c */ 5011 /* Defined in rangetab.c */
4804 EXFUN (Fclear_range_table, 1); 5012 EXFUN (Fclear_range_table, 1);
4805 EXFUN (Fget_range_table, 3); 5013 EXFUN (Fget_range_table, 3);
4806 EXFUN (Fmake_range_table, 1); 5014 EXFUN (Fmake_range_table, 1);
4807 EXFUN (Fput_range_table, 4); 5015 EXFUN (Fput_range_table, 4);
5016 EXFUN (Fcopy_range_table, 1);
4808 5017
4809 extern Lisp_Object Qstart_closed_end_open; 5018 extern Lisp_Object Qstart_closed_end_open;
4810 extern Lisp_Object Qstart_open_end_open; 5019 extern Lisp_Object Qstart_open_end_open;
4811 extern Lisp_Object Qstart_closed_end_closed; 5020 extern Lisp_Object Qstart_closed_end_closed;
4812 extern Lisp_Object Qstart_open_end_closed; 5021 extern Lisp_Object Qstart_open_end_closed;
4874 EXFUN (Fdefault_boundp, 1); 5083 EXFUN (Fdefault_boundp, 1);
4875 EXFUN (Fdefault_value, 1); 5084 EXFUN (Fdefault_value, 1);
4876 EXFUN (Ffboundp, 1); 5085 EXFUN (Ffboundp, 1);
4877 EXFUN (Ffset, 2); 5086 EXFUN (Ffset, 2);
4878 EXFUN (Fintern, 2); 5087 EXFUN (Fintern, 2);
4879 EXFUN (Fintern_soft, 2); 5088 EXFUN (Fintern_soft, 3);
4880 EXFUN (Fkill_local_variable, 1); 5089 EXFUN (Fkill_local_variable, 1);
4881 EXFUN (Fset, 2); 5090 EXFUN (Fset, 2);
4882 EXFUN (Fset_default, 2); 5091 EXFUN (Fset_default, 2);
4883 EXFUN (Fsymbol_function, 1); 5092 EXFUN (Fsymbol_function, 1);
4884 EXFUN (Fsymbol_name, 1); 5093 EXFUN (Fsymbol_name, 1);
4905 /* Defined in syntax.c */ 5114 /* Defined in syntax.c */
4906 Charbpos scan_words (struct buffer *, Charbpos, int); 5115 Charbpos scan_words (struct buffer *, Charbpos, int);
4907 EXFUN (Fchar_syntax, 2); 5116 EXFUN (Fchar_syntax, 2);
4908 EXFUN (Fforward_word, 2); 5117 EXFUN (Fforward_word, 2);
4909 extern Lisp_Object Vstandard_syntax_table; 5118 extern Lisp_Object Vstandard_syntax_table;
4910 void signal_syntax_table_extent_changed (EXTENT extent); 5119 void signal_syntax_cache_extent_changed (EXTENT extent);
4911 void signal_syntax_table_extent_adjust (struct buffer *buf); 5120 void signal_syntax_cache_extent_adjust (struct buffer *buf);
4912 void init_buffer_syntax_cache (struct buffer *buf); 5121 void init_buffer_syntax_cache (struct buffer *buf);
4913 void mark_buffer_syntax_cache (struct buffer *buf); 5122 void mark_buffer_syntax_cache (struct buffer *buf);
4914 void uninit_buffer_syntax_cache (struct buffer *buf); 5123 void uninit_buffer_syntax_cache (struct buffer *buf);
4915 extern Lisp_Object Qsyntax_table; 5124 extern Lisp_Object Qsyntax_table;
4916 5125
5035 extern Lisp_Object Vcharset_latin_iso8859_2; 5244 extern Lisp_Object Vcharset_latin_iso8859_2;
5036 extern Lisp_Object Vcharset_latin_iso8859_3; 5245 extern Lisp_Object Vcharset_latin_iso8859_3;
5037 extern Lisp_Object Vcharset_latin_iso8859_4; 5246 extern Lisp_Object Vcharset_latin_iso8859_4;
5038 extern Lisp_Object Vcharset_thai_tis620; 5247 extern Lisp_Object Vcharset_thai_tis620;
5039 extern Lisp_Object Vcharset_greek_iso8859_7; 5248 extern Lisp_Object Vcharset_greek_iso8859_7;
5040 extern Lisp_Object Vcharset_arabic_iso8859_6;
5041 extern Lisp_Object Vcharset_hebrew_iso8859_8; 5249 extern Lisp_Object Vcharset_hebrew_iso8859_8;
5042 extern Lisp_Object Vcharset_katakana_jisx0201; 5250 extern Lisp_Object Vcharset_katakana_jisx0201;
5043 extern Lisp_Object Vcharset_latin_jisx0201; 5251 extern Lisp_Object Vcharset_latin_jisx0201;
5044 extern Lisp_Object Vcharset_cyrillic_iso8859_5; 5252 extern Lisp_Object Vcharset_cyrillic_iso8859_5;
5045 extern Lisp_Object Vcharset_latin_iso8859_9; 5253 extern Lisp_Object Vcharset_latin_iso8859_9;
5254 extern Lisp_Object Vcharset_latin_iso8859_15;
5046 extern Lisp_Object Vcharset_japanese_jisx0208_1978; 5255 extern Lisp_Object Vcharset_japanese_jisx0208_1978;
5047 extern Lisp_Object Vcharset_chinese_gb2312; 5256 extern Lisp_Object Vcharset_chinese_gb2312;
5048 extern Lisp_Object Vcharset_japanese_jisx0208; 5257 extern Lisp_Object Vcharset_japanese_jisx0208;
5049 extern Lisp_Object Vcharset_korean_ksc5601; 5258 extern Lisp_Object Vcharset_korean_ksc5601;
5050 extern Lisp_Object Vcharset_japanese_jisx0212; 5259 extern Lisp_Object Vcharset_japanese_jisx0212;
5303 extern const struct sized_memory_description from_unicode_description; 5512 extern const struct sized_memory_description from_unicode_description;
5304 void init_charset_unicode_tables (Lisp_Object charset); 5513 void init_charset_unicode_tables (Lisp_Object charset);
5305 void free_charset_unicode_tables (Lisp_Object charset); 5514 void free_charset_unicode_tables (Lisp_Object charset);
5306 void recalculate_unicode_precedence (void); 5515 void recalculate_unicode_precedence (void);
5307 extern Lisp_Object Qunicode; 5516 extern Lisp_Object Qunicode;
5308 extern Lisp_Object Qutf_16, Qutf_8, Qucs_4, Qutf_7; 5517 extern Lisp_Object Qutf_16, Qutf_8, Qucs_4, Qutf_7, Qutf_32;
5309 #ifdef MEMORY_USAGE_STATS 5518 #ifdef MEMORY_USAGE_STATS
5310 Bytecount compute_from_unicode_table_size (Lisp_Object charset, 5519 Bytecount compute_from_unicode_table_size (Lisp_Object charset,
5311 struct overhead_stats *stats); 5520 struct overhead_stats *stats);
5312 Bytecount compute_to_unicode_table_size (Lisp_Object charset, 5521 Bytecount compute_to_unicode_table_size (Lisp_Object charset,
5313 struct overhead_stats *stats); 5522 struct overhead_stats *stats);
5431 extern Lisp_Object Qpointer_image_instance_p, Qprint_length; 5640 extern Lisp_Object Qpointer_image_instance_p, Qprint_length;
5432 extern Lisp_Object Qprint_string_length, Qprinting_unreadable_object; 5641 extern Lisp_Object Qprint_string_length, Qprinting_unreadable_object;
5433 extern Lisp_Object Qprogn, Qquit, Qquote, Qrange_error; 5642 extern Lisp_Object Qprogn, Qquit, Qquote, Qrange_error;
5434 extern Lisp_Object Qread_char, Qread_from_minibuffer; 5643 extern Lisp_Object Qread_char, Qread_from_minibuffer;
5435 extern Lisp_Object Qreally_early_error_handler, Qregion_beginning; 5644 extern Lisp_Object Qreally_early_error_handler, Qregion_beginning;
5436 extern Lisp_Object Qregion_end, Qregistry, Qreverse_direction_charset; 5645 extern Lisp_Object Qregion_end, Qregistries, Qreverse_direction_charset;
5437 extern Lisp_Object Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs; 5646 extern Lisp_Object Qrun_hooks, Qsans_modifiers, Qsave_buffers_kill_emacs;
5438 extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo, Qsequencep; 5647 extern Lisp_Object Qself_insert_command, Qself_insert_defer_undo, Qsequencep;
5439 extern Lisp_Object Qset, Qsetting_constant, Qshort_name, Qsingularity_error; 5648 extern Lisp_Object Qset, Qsetting_constant, Qshort_name, Qsingularity_error;
5440 extern Lisp_Object Qsound_error, Qstack_overflow, Qstandard_input; 5649 extern Lisp_Object Qsound_error, Qstack_overflow, Qstandard_input;
5441 extern Lisp_Object Qstandard_output, Qstart_open, Qstring_lessp; 5650 extern Lisp_Object Qstandard_output, Qstart_open, Qstring_lessp;