comparison src/lisp-union.h @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents b8cc9ab3f761
children 11054d720c21
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
28 28
29 typedef 29 typedef
30 union Lisp_Object 30 union Lisp_Object
31 { 31 {
32 /* if non-valbits are at lower addresses */ 32 /* if non-valbits are at lower addresses */
33 #ifdef WORDS_BIGENDIAN 33 #if defined(WORDS_BIGENDIAN)
34 struct 34 struct
35 { 35 {
36 EMACS_UINT val : VALBITS; 36 EMACS_UINT val : VALBITS;
37 enum_field (Lisp_Type) type : GCTYPEBITS; 37 enum_field (Lisp_Type) type : GCTYPEBITS;
38 } gu; 38 } gu;
74 74
75 /* This was formerly declared 'void *v' etc. but that causes 75 /* This was formerly declared 'void *v' etc. but that causes
76 GCC to accept any (yes, any) pointer as the argument of 76 GCC to accept any (yes, any) pointer as the argument of
77 a function declared to accept a Lisp_Object. */ 77 a function declared to accept a Lisp_Object. */
78 struct nosuchstruct *v; 78 struct nosuchstruct *v;
79 const struct nosuchstruct *cv; 79 CONST struct nosuchstruct *cv;
80 } 80 }
81 Lisp_Object; 81 Lisp_Object;
82 82
83 #define XCHARVAL(x) ((x).gu.val) 83 #define XCHARVAL(x) ((x).gu.val)
84 84
98 EMACS_UINT xset_value = (EMACS_UINT) (value); \ 98 EMACS_UINT xset_value = (EMACS_UINT) (value); \
99 (var).ui = xset_value; \ 99 (var).ui = xset_value; \
100 } while (0) 100 } while (0)
101 # define XPNTRVAL(x) ((x).ui) 101 # define XPNTRVAL(x) ((x).ui)
102 102
103 INLINE_HEADER Lisp_Object make_int (EMACS_INT val); 103 INLINE Lisp_Object make_int (EMACS_INT val);
104 INLINE_HEADER Lisp_Object 104 INLINE Lisp_Object
105 make_int (EMACS_INT val) 105 make_int (EMACS_INT val)
106 { 106 {
107 Lisp_Object obj; 107 Lisp_Object obj;
108 XSETINT(obj, val); 108 XSETINT(obj, val);
109 return obj; 109 return obj;
110 } 110 }
111 111
112 INLINE_HEADER Lisp_Object make_char (Emchar val); 112 INLINE Lisp_Object make_char (Emchar val);
113 INLINE_HEADER Lisp_Object 113 INLINE Lisp_Object
114 make_char (Emchar val) 114 make_char (Emchar val)
115 { 115 {
116 Lisp_Object obj; 116 Lisp_Object obj;
117 XSETCHAR(obj, val); 117 XSETCHAR(obj, val);
118 return obj; 118 return obj;
121 extern Lisp_Object Qnull_pointer, Qzero; 121 extern Lisp_Object Qnull_pointer, Qzero;
122 122
123 #define XREALINT(x) ((x).s.val) 123 #define XREALINT(x) ((x).s.val)
124 #define XUINT(x) ((x).u.val) 124 #define XUINT(x) ((x).u.val)
125 #define XTYPE(x) ((x).gu.type) 125 #define XTYPE(x) ((x).gu.type)
126 #define XGCTYPE(x) XTYPE (x)
126 #define EQ(x,y) ((x).v == (y).v) 127 #define EQ(x,y) ((x).v == (y).v)
127 128
128 #define INTP(x) ((x).s.bits) 129 #define INTP(x) ((x).s.bits)
129 #define INT_PLUS(x,y) make_int (XINT (x) + XINT (y)) 130 #define GC_EQ(x,y) EQ (x, y)
130 #define INT_MINUS(x,y) make_int (XINT (x) - XINT (y))
131 #define INT_PLUS1(x) make_int (XINT (x) + 1)
132 #define INT_MINUS1(x) make_int (XINT (x) - 1)
133 131
134 /* Convert between a (void *) and a Lisp_Object, as when the 132 /* Convert between a (void *) and a Lisp_Object, as when the
135 Lisp_Object is passed to a toolkit callback function */ 133 Lisp_Object is passed to a toolkit callback function */
136 #define VOID_TO_LISP(larg,varg) \ 134 #define VOID_TO_LISP(larg,varg) \
137 ((void) ((larg).v = (struct nosuchstruct *) (varg))) 135 ((void) ((larg).v = (struct nosuchstruct *) (varg)))
138 #define CVOID_TO_LISP(larg,varg) \ 136 #define CVOID_TO_LISP(larg,varg) \
139 ((void) ((larg).cv = (const struct nosuchstruct *) (varg))) 137 ((void) ((larg).cv = (CONST struct nosuchstruct *) (varg)))
140 #define LISP_TO_VOID(larg) ((void *) ((larg).v)) 138 #define LISP_TO_VOID(larg) ((void *) ((larg).v))
141 #define LISP_TO_CVOID(larg) ((const void *) ((larg).cv)) 139 #define LISP_TO_CVOID(larg) ((CONST void *) ((larg).cv))
142 140
143 /* Convert a Lisp_Object into something that can't be used as an 141 /* Convert a Lisp_Object into something that can't be used as an
144 lvalue. Useful for type-checking. */ 142 lvalue. Useful for type-checking. */
145 #if (__GNUC__ > 1) 143 #if (__GNUC__ > 1)
146 #define NON_LVALUE(larg) ({ (larg); }) 144 #define NON_LVALUE(larg) ({ (larg); })