comparison src/lisp.h @ 14306:b30429f0b599

(XCAR, XCDR, CAR, CDR): New macros. (make_number): New macro definition.
author Karl Heuer <kwzh@gnu.org>
date Wed, 24 Jan 1996 23:44:22 +0000
parents ee40177f6c68
children 7c93a4ce40b0
comparison
equal deleted inserted replaced
14305:3cc44eaf9ebf 14306:b30429f0b599
305 #ifndef XSET 305 #ifndef XSET
306 #define XSET(var, type, ptr) \ 306 #define XSET(var, type, ptr) \
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.
313 Other markbits are always zero. 318 Other markbits are always zero.
314 Outside of garbage collection, all mark bits are always zero. */ 319 Outside of garbage collection, all mark bits are always zero. */
507 512
508 struct Lisp_Cons 513 struct Lisp_Cons
509 { 514 {
510 Lisp_Object car, cdr; 515 Lisp_Object car, cdr;
511 }; 516 };
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)))
512 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
516 struct Lisp_Buffer_Cons 536 struct Lisp_Buffer_Cons
1398 extern Lisp_Object Flogand (), Flogior (), Flogxor (), Flognot (); 1418 extern Lisp_Object Flogand (), Flogior (), Flogxor (), Flognot ();
1399 extern Lisp_Object Flsh (), Fash (); 1419 extern Lisp_Object Flsh (), Fash ();
1400 1420
1401 extern Lisp_Object Fadd1 (), Fsub1 (); 1421 extern Lisp_Object Fadd1 (), Fsub1 ();
1402 1422
1403 extern Lisp_Object make_number ();
1404 extern Lisp_Object long_to_cons (); 1423 extern Lisp_Object long_to_cons ();
1405 extern unsigned long cons_to_long (); 1424 extern unsigned long cons_to_long ();
1406 extern void args_out_of_range (); 1425 extern void args_out_of_range ();
1407 extern void args_out_of_range_3 (); 1426 extern void args_out_of_range_3 ();
1408 extern Lisp_Object wrong_type_argument (); 1427 extern Lisp_Object wrong_type_argument ();