comparison 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
comparison
equal deleted inserted replaced
30172:5a375a2cdd3a 30173:420acffb79c2
458 #define XSTRING(a) (eassert (GC_STRINGP(a)),(struct Lisp_String *) XPNTR(a)) 458 #define XSTRING(a) (eassert (GC_STRINGP(a)),(struct Lisp_String *) XPNTR(a))
459 #define XSYMBOL(a) (eassert (GC_SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a)) 459 #define XSYMBOL(a) (eassert (GC_SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a))
460 #define XFLOAT(a) (eassert (GC_FLOATP(a)),(struct Lisp_Float *) XPNTR(a)) 460 #define XFLOAT(a) (eassert (GC_FLOATP(a)),(struct Lisp_Float *) XPNTR(a))
461 461
462 /* Misc types. */ 462 /* Misc types. */
463
463 #define XMISC(a) ((union Lisp_Misc *) XPNTR(a)) 464 #define XMISC(a) ((union Lisp_Misc *) XPNTR(a))
464 #define XMISCTYPE(a) (XMARKER (a)->type) 465 #define XMISCTYPE(a) (XMARKER (a)->type)
465 #define XMARKER(a) (&(XMISC(a)->u_marker)) 466 #define XMARKER(a) (&(XMISC(a)->u_marker))
466 #define XINTFWD(a) (&(XMISC(a)->u_intfwd)) 467 #define XINTFWD(a) (&(XMISC(a)->u_intfwd))
467 #define XBOOLFWD(a) (&(XMISC(a)->u_boolfwd)) 468 #define XBOOLFWD(a) (&(XMISC(a)->u_boolfwd))
470 #define XBUFFER_LOCAL_VALUE(a) (&(XMISC(a)->u_buffer_local_value)) 471 #define XBUFFER_LOCAL_VALUE(a) (&(XMISC(a)->u_buffer_local_value))
471 #define XOVERLAY(a) (&(XMISC(a)->u_overlay)) 472 #define XOVERLAY(a) (&(XMISC(a)->u_overlay))
472 #define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd)) 473 #define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd))
473 474
474 /* Pseudovector types. */ 475 /* Pseudovector types. */
476
475 #define XPROCESS(a) (eassert (GC_PROCESSP(a)),(struct Lisp_Process *) XPNTR(a)) 477 #define XPROCESS(a) (eassert (GC_PROCESSP(a)),(struct Lisp_Process *) XPNTR(a))
476 #define XWINDOW(a) (eassert (GC_WINDOWP(a)),(struct window *) XPNTR(a)) 478 #define XWINDOW(a) (eassert (GC_WINDOWP(a)),(struct window *) XPNTR(a))
477 #define XSUBR(a) (eassert (GC_SUBRP(a)),(struct Lisp_Subr *) XPNTR(a)) 479 #define XSUBR(a) (eassert (GC_SUBRP(a)),(struct Lisp_Subr *) XPNTR(a))
478 #define XBUFFER(a) (eassert (GC_BUFFERP(a)),(struct buffer *) XPNTR(a)) 480 #define XBUFFER(a) (eassert (GC_BUFFERP(a)),(struct buffer *) XPNTR(a))
479 #define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a)) 481 #define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a))
480 #define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a)) 482 #define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a))
481 483
482
483 /* Construct a Lisp_Object from a value or address. */ 484 /* Construct a Lisp_Object from a value or address. */
484 485
485 #define XSETINT(a, b) XSET (a, Lisp_Int, b) 486 #define XSETINT(a, b) XSET (a, Lisp_Int, b)
486 #define XSETCONS(a, b) XSET (a, Lisp_Cons, b) 487 #define XSETCONS(a, b) XSET (a, Lisp_Cons, b)
487 #define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b) 488 #define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b)
488 #define XSETSTRING(a, b) XSET (a, Lisp_String, b) 489 #define XSETSTRING(a, b) XSET (a, Lisp_String, b)
489 #define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b) 490 #define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b)
490 #define XSETFLOAT(a, b) XSET (a, Lisp_Float, b) 491 #define XSETFLOAT(a, b) XSET (a, Lisp_Float, b)
491 492
492 /* Misc types. */ 493 /* Misc types. */
494
493 #define XSETMISC(a, b) XSET (a, Lisp_Misc, b) 495 #define XSETMISC(a, b) XSET (a, Lisp_Misc, b)
494 #define XSETMARKER(a, b) (XSETMISC (a, b), XMISCTYPE (a) = Lisp_Misc_Marker) 496 #define XSETMARKER(a, b) (XSETMISC (a, b), XMISCTYPE (a) = Lisp_Misc_Marker)
495 497
496 /* Pseudovector types. */ 498 /* Pseudovector types. */
499
497 #define XSETPSEUDOVECTOR(a, b, code) \ 500 #define XSETPSEUDOVECTOR(a, b, code) \
498 (XSETVECTOR (a, b), XVECTOR (a)->size |= PSEUDOVECTOR_FLAG | (code)) 501 (XSETVECTOR (a, b), XVECTOR (a)->size |= PSEUDOVECTOR_FLAG | (code))
499 #define XSETWINDOW_CONFIGURATION(a, b) \ 502 #define XSETWINDOW_CONFIGURATION(a, b) \
500 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION)) 503 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
501 #define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS)) 504 #define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))
503 #define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR)) 506 #define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
504 #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED)) 507 #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
505 #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER)) 508 #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
506 #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE)) 509 #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
507 #define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR)) 510 #define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR))
511
512 /* Convenience macros for dealing with Lisp arrays. */
513
514 #define AREF(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX]
515 #define ASET(ARRAY, IDX, VAL) (AREF ((ARRAY), (IDX)) = (VAL))
516 #define ASIZE(ARRAY) XVECTOR ((ARRAY))->size
517
508 518
509 /* Basic data type for use of intervals. See the macros in intervals.h. */ 519 /* Basic data type for use of intervals. See the macros in intervals.h. */
510 520
511 struct interval 521 struct interval
512 { 522 {