X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/564784766297a6f2e06434e2baa7a1d851672a36..8628a48fec7fcd8bdbbf6ce5808fc574631d1541:/src/lisp.h diff --git a/src/lisp.h b/src/lisp.h index 51556fcc91..f1e6945f43 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -608,6 +608,7 @@ INLINE bool SUBRP (Lisp_Object); INLINE bool (SYMBOLP) (Lisp_Object); INLINE bool (VECTORLIKEP) (Lisp_Object); INLINE bool WINDOWP (Lisp_Object); +INLINE bool TERMINALP (Lisp_Object); INLINE struct Lisp_Save_Value *XSAVE_VALUE (Lisp_Object); INLINE struct Lisp_Symbol *(XSYMBOL) (Lisp_Object); INLINE void *(XUNTAG) (Lisp_Object, int); @@ -731,14 +732,18 @@ struct Lisp_Symbol TAG_PTR (Lisp_Symbol, \ ((uintptr_t) (offset) >> (USE_LSB_TAG ? 0 : GCTYPEBITS))) +/* XLI_BUILTIN_LISPSYM (iQwhatever) is equivalent to + XLI (builtin_lisp_symbol (Qwhatever)), + except the former expands to an integer constant expression. */ +#define XLI_BUILTIN_LISPSYM(iname) TAG_SYMOFFSET ((iname) * sizeof *lispsym) + /* Declare extern constants for Lisp symbols. These can be helpful when using a debugger like GDB, on older platforms where the debug format does not represent C macros. */ #define DEFINE_LISP_SYMBOL_BEGIN(name) \ - DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) + DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) #define DEFINE_LISP_SYMBOL_END(name) \ - DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (TAG_SYMOFFSET (i##name \ - * sizeof *lispsym))) + DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (XLI_BUILTIN_LISPSYM (i##name))) #include "globals.h" @@ -776,6 +781,11 @@ enum pvec_type PVEC_WINDOW_CONFIGURATION, PVEC_SUBR, PVEC_OTHER, +#ifdef HAVE_XWIDGETS + PVEC_XWIDGET, + PVEC_XWIDGET_VIEW, +#endif + /* These should be last, check internal_equal to see why. */ PVEC_COMPILED, PVEC_CHAR_TABLE, @@ -998,6 +1008,7 @@ XWINDOW (Lisp_Object a) INLINE struct terminal * XTERMINAL (Lisp_Object a) { + eassert (TERMINALP (a)); return XUNTAG (a, Lisp_Vectorlike); } @@ -1060,12 +1071,6 @@ builtin_lisp_symbol (int index) return make_lisp_symbol (lispsym + index); } -INLINE Lisp_Object -make_lisp_proc (struct Lisp_Process *p) -{ - return make_lisp_ptr (p, Lisp_Vectorlike); -} - #define XSETINT(a, b) ((a) = make_number (b)) #define XSETFASTINT(a, b) ((a) = make_natnum (b)) #define XSETCONS(a, b) ((a) = make_lisp_ptr (b, Lisp_Cons)) @@ -1503,6 +1508,20 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) XVECTOR (array)->contents[idx] = val; } +/* True, since Qnil's representation is zero. Every place in the code + that assumes Qnil is zero should verify (NIL_IS_ZERO), to make it easy + to find such assumptions later if we change Qnil to be nonzero. */ +enum { NIL_IS_ZERO = XLI_BUILTIN_LISPSYM (iQnil) == 0 }; + +/* Set a Lisp_Object array V's N entries to nil. */ +INLINE void +memsetnil (Lisp_Object *v, ptrdiff_t n) +{ + eassert (0 <= n); + verify (NIL_IS_ZERO); + memset (v, 0, n * sizeof *v); +} + /* If a struct is made to look like a vector, this macro returns the length of the shortest vector that would hold that struct. */ @@ -3780,16 +3799,25 @@ make_uninit_sub_char_table (int depth, int min_char) return v; } -extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type); -#define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ - ((typ*) \ - allocate_pseudovector \ - (VECSIZE (typ), PSEUDOVECSIZE (typ, field), tag)) -extern struct Lisp_Hash_Table *allocate_hash_table (void); -extern struct window *allocate_window (void); -extern struct frame *allocate_frame (void); -extern struct Lisp_Process *allocate_process (void); -extern struct terminal *allocate_terminal (void); +extern struct Lisp_Vector *allocate_pseudovector (int, int, int, + enum pvec_type); + +/* Allocate partially initialized pseudovector where all Lisp_Object + slots are set to Qnil but the rest (if any) is left uninitialized. */ + +#define ALLOCATE_PSEUDOVECTOR(type, field, tag) \ + ((type *) allocate_pseudovector (VECSIZE (type), \ + PSEUDOVECSIZE (type, field), \ + PSEUDOVECSIZE (type, field), tag)) + +/* Allocate fully initialized pseudovector where all Lisp_Object + slots are set to Qnil and the rest (if any) is zeroed. */ + +#define ALLOCATE_ZEROED_PSEUDOVECTOR(type, field, tag) \ + ((type *) allocate_pseudovector (VECSIZE (type), \ + PSEUDOVECSIZE (type, field), \ + VECSIZE (type), tag)) + extern bool gc_in_progress; extern bool abort_on_gc; extern Lisp_Object make_float (double);