diff src/lisp.h @ 30173:420acffb79c2

(AREF, ASET, ASIZE): New macros.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 13 Jul 2000 14:06:39 +0000
parents 60dfd5c7304c
children 7438876dc5c9
line wrap: on
line diff
--- a/src/lisp.h	Thu Jul 13 14:06:27 2000 +0000
+++ b/src/lisp.h	Thu Jul 13 14:06:39 2000 +0000
@@ -460,6 +460,7 @@
 #define XFLOAT(a) (eassert (GC_FLOATP(a)),(struct Lisp_Float *) XPNTR(a))
 
 /* Misc types.  */
+
 #define XMISC(a)   ((union Lisp_Misc *) XPNTR(a))
 #define XMISCTYPE(a)   (XMARKER (a)->type)
 #define XMARKER(a) (&(XMISC(a)->u_marker))
@@ -472,6 +473,7 @@
 #define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd))
 
 /* Pseudovector types.  */
+
 #define XPROCESS(a) (eassert (GC_PROCESSP(a)),(struct Lisp_Process *) XPNTR(a))
 #define XWINDOW(a) (eassert (GC_WINDOWP(a)),(struct window *) XPNTR(a))
 #define XSUBR(a) (eassert (GC_SUBRP(a)),(struct Lisp_Subr *) XPNTR(a))
@@ -479,7 +481,6 @@
 #define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a))
 #define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a))
 
-
 /* Construct a Lisp_Object from a value or address.  */
 
 #define XSETINT(a, b) XSET (a, Lisp_Int, b)
@@ -490,10 +491,12 @@
 #define XSETFLOAT(a, b) XSET (a, Lisp_Float, b)
 
 /* Misc types.  */
+
 #define XSETMISC(a, b) XSET (a, Lisp_Misc, b)
 #define XSETMARKER(a, b) (XSETMISC (a, b), XMISCTYPE (a) = Lisp_Misc_Marker)
 
 /* Pseudovector types.  */
+
 #define XSETPSEUDOVECTOR(a, b, code) \
   (XSETVECTOR (a, b), XVECTOR (a)->size |= PSEUDOVECTOR_FLAG | (code))
 #define XSETWINDOW_CONFIGURATION(a, b) \
@@ -505,6 +508,13 @@
 #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
 #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
 #define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR))
+
+/* Convenience macros for dealing with Lisp arrays.  */
+
+#define AREF(ARRAY, IDX)	XVECTOR ((ARRAY))->contents[IDX]
+#define ASET(ARRAY, IDX, VAL)	(AREF ((ARRAY), (IDX)) = (VAL))
+#define ASIZE(ARRAY)		XVECTOR ((ARRAY))->size
+
 
 /* Basic data type for use of intervals.  See the macros in intervals.h.  */