changeset 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 3cc44eaf9ebf
children 8f846c3889c8
files src/lisp.h
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lisp.h	Wed Jan 24 23:43:22 1996 +0000
+++ b/src/lisp.h	Wed Jan 24 23:44:22 1996 +0000
@@ -307,6 +307,11 @@
    ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK))
 #endif
 
+/* Convert a C integer into a Lisp_Object integer.  */
+
+#define make_number(N)		\
+  ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
+
 /* During garbage collection, XGCTYPE must be used for extracting types
  so that the mark bit is ignored.  XMARKBIT accesses the markbit.
  Markbits are used only in particular slots of particular structure types.
@@ -510,6 +515,21 @@
     Lisp_Object car, cdr;
   };
 
+/* Take the car or cdr of something known to be a cons cell.  */
+#define XCAR(c) (XCONS ((c))->car)
+#define XCDR(c) (XCONS ((c))->cdr)
+
+/* Take the car or cdr of something whose type is not known.  */
+#define CAR(c)					\
+ (CONSP ((c)) ? XCAR ((c))			\
+  : NILP ((c)) ? Qnil				\
+  : wrong_type_argument (Qlistp, (c)))
+
+#define CDR(c)					\
+ (CONSP ((c)) ? XCDR ((c))			\
+  : NILP ((c)) ? Qnil				\
+  : wrong_type_argument (Qlistp, (c)))
+
 /* Like a cons, but records info on where the text lives that it was read from */
 /* This is not really in use now */
 
@@ -1400,7 +1420,6 @@
 
 extern Lisp_Object Fadd1 (), Fsub1 ();
 
-extern Lisp_Object make_number ();
 extern Lisp_Object   long_to_cons ();
 extern unsigned long cons_to_long ();
 extern void args_out_of_range ();