aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorJoakim Verona2013-01-15 00:03:45 +0100
committerJoakim Verona2013-01-15 00:03:45 +0100
commitbc4f7ac4ec3ee942171b9fef6eec6b1a61cc5b8b (patch)
tree481f44117938f166336393293fa73eaeff179406 /src/lisp.h
parent132fdce3d2530db5a6edeaf4242257ff01ea4760 (diff)
parent982c5d68ff9a798d777d25ccfda7ca6616fab1e2 (diff)
downloademacs-bc4f7ac4ec3ee942171b9fef6eec6b1a61cc5b8b.tar.gz
emacs-bc4f7ac4ec3ee942171b9fef6eec6b1a61cc5b8b.zip
auto upstream
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h48
1 files changed, 39 insertions, 9 deletions
diff --git a/src/lisp.h b/src/lisp.h
index d4d34ac19ba..3ac2bda94c5 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1383,20 +1383,48 @@ struct Lisp_Overlay
1383 Lisp_Object plist; 1383 Lisp_Object plist;
1384 }; 1384 };
1385 1385
1386/* Hold a C pointer for later use. 1386/* Types of data which may be saved in a Lisp_Save_Value. */
1387 This type of object is used in the arg to record_unwind_protect. */ 1387
1388enum
1389 {
1390 SAVE_UNUSED,
1391 SAVE_INTEGER,
1392 SAVE_POINTER,
1393 SAVE_OBJECT
1394 };
1395
1396/* Special object used to hold a different values for later use. */
1397
1388struct Lisp_Save_Value 1398struct Lisp_Save_Value
1389 { 1399 {
1390 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */ 1400 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */
1391 unsigned gcmarkbit : 1; 1401 unsigned gcmarkbit : 1;
1392 int spacer : 14; 1402 int spacer : 6;
1393 /* If DOGC is set, POINTER is the address of a memory 1403 /* If `area' is nonzero, `data[0].pointer' is the address of a memory area
1394 area containing INTEGER potential Lisp_Objects. */ 1404 containing `data[1].integer' potential Lisp_Objects. The rest of `data'
1395 unsigned int dogc : 1; 1405 fields are unused. */
1396 void *pointer; 1406 unsigned area : 1;
1397 ptrdiff_t integer; 1407 /* If `area' is zero, `data[N]' may hold different objects which type is
1408 encoded in `typeN' fields as described by the anonymous enum above.
1409 E.g. if `type0' is SAVE_INTEGER, `data[0].integer' is in use. */
1410 unsigned type0 : 2;
1411 unsigned type1 : 2;
1412 unsigned type2 : 2;
1413 unsigned type3 : 2;
1414 union {
1415 void *pointer;
1416 ptrdiff_t integer;
1417 Lisp_Object object;
1418 } data[4];
1398 }; 1419 };
1399 1420
1421/* Compatibility macro to set and extract saved pointer. */
1422
1423#define XSAVE_POINTER(obj) XSAVE_VALUE (obj)->data[0].pointer
1424
1425/* Likewise for the saved integer. */
1426
1427#define XSAVE_INTEGER(obj) XSAVE_VALUE (obj)->data[1].integer
1400 1428
1401/* A miscellaneous object, when it's on the free list. */ 1429/* A miscellaneous object, when it's on the free list. */
1402struct Lisp_Free 1430struct Lisp_Free
@@ -2898,6 +2926,8 @@ extern void memory_warnings (void *, void (*warnfun) (const char *));
2898 2926
2899/* Defined in alloc.c. */ 2927/* Defined in alloc.c. */
2900extern void check_pure_size (void); 2928extern void check_pure_size (void);
2929extern Lisp_Object allocate_misc (enum Lisp_Misc_Type);
2930extern void free_misc (Lisp_Object);
2901extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT); 2931extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT);
2902extern void malloc_warning (const char *); 2932extern void malloc_warning (const char *);
2903extern _Noreturn void memory_full (size_t); 2933extern _Noreturn void memory_full (size_t);
@@ -3700,7 +3730,7 @@ extern void *record_xmalloc (size_t);
3700 Lisp_Object arg_; \ 3730 Lisp_Object arg_; \
3701 buf = xmalloc ((nelt) * word_size); \ 3731 buf = xmalloc ((nelt) * word_size); \
3702 arg_ = make_save_value (buf, nelt); \ 3732 arg_ = make_save_value (buf, nelt); \
3703 XSAVE_VALUE (arg_)->dogc = 1; \ 3733 XSAVE_VALUE (arg_)->area = 1; \
3704 sa_must_free = 1; \ 3734 sa_must_free = 1; \
3705 record_unwind_protect (safe_alloca_unwind, arg_); \ 3735 record_unwind_protect (safe_alloca_unwind, arg_); \
3706 } \ 3736 } \