aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1996-01-24 23:44:22 +0000
committerKarl Heuer1996-01-24 23:44:22 +0000
commitb7acde90f39d5e2d895c5be79b1b33a1fddd864d (patch)
treeea4ba48c3e9055d0a9da7b80ad68b3f1288146f2
parent31e3a04632f788917de17e67f03c1fdc1f368c02 (diff)
downloademacs-b7acde90f39d5e2d895c5be79b1b33a1fddd864d.tar.gz
emacs-b7acde90f39d5e2d895c5be79b1b33a1fddd864d.zip
(XCAR, XCDR, CAR, CDR): New macros.
(make_number): New macro definition.
-rw-r--r--src/lisp.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 61ead0907d3..9fe189f36f5 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -307,6 +307,11 @@ extern int pure_size;
307 ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK)) 307 ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK))
308#endif 308#endif
309 309
310/* Convert a C integer into a Lisp_Object integer. */
311
312#define make_number(N) \
313 ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
314
310/* During garbage collection, XGCTYPE must be used for extracting types 315/* During garbage collection, XGCTYPE must be used for extracting types
311 so that the mark bit is ignored. XMARKBIT accesses the markbit. 316 so that the mark bit is ignored. XMARKBIT accesses the markbit.
312 Markbits are used only in particular slots of particular structure types. 317 Markbits are used only in particular slots of particular structure types.
@@ -510,6 +515,21 @@ struct Lisp_Cons
510 Lisp_Object car, cdr; 515 Lisp_Object car, cdr;
511 }; 516 };
512 517
518/* Take the car or cdr of something known to be a cons cell. */
519#define XCAR(c) (XCONS ((c))->car)
520#define XCDR(c) (XCONS ((c))->cdr)
521
522/* Take the car or cdr of something whose type is not known. */
523#define CAR(c) \
524 (CONSP ((c)) ? XCAR ((c)) \
525 : NILP ((c)) ? Qnil \
526 : wrong_type_argument (Qlistp, (c)))
527
528#define CDR(c) \
529 (CONSP ((c)) ? XCDR ((c)) \
530 : NILP ((c)) ? Qnil \
531 : wrong_type_argument (Qlistp, (c)))
532
513/* Like a cons, but records info on where the text lives that it was read from */ 533/* Like a cons, but records info on where the text lives that it was read from */
514/* This is not really in use now */ 534/* This is not really in use now */
515 535
@@ -1400,7 +1420,6 @@ extern Lisp_Object Flsh (), Fash ();
1400 1420
1401extern Lisp_Object Fadd1 (), Fsub1 (); 1421extern Lisp_Object Fadd1 (), Fsub1 ();
1402 1422
1403extern Lisp_Object make_number ();
1404extern Lisp_Object long_to_cons (); 1423extern Lisp_Object long_to_cons ();
1405extern unsigned long cons_to_long (); 1424extern unsigned long cons_to_long ();
1406extern void args_out_of_range (); 1425extern void args_out_of_range ();