Mercurial > hg > xemacs-beta
comparison src/lisp-union.h @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 3ecd8885ac67 |
children | af57a77cbc92 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
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 #if defined(WORDS_BIGENDIAN) | 33 #ifdef 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 |
92 Emchar xset_value = (value); \ | 92 Emchar xset_value = (value); \ |
93 Lisp_Object *xset_var = &(var); \ | 93 Lisp_Object *xset_var = &(var); \ |
94 xset_var->gu.type = Lisp_Type_Char; \ | 94 xset_var->gu.type = Lisp_Type_Char; \ |
95 xset_var->gu.val = xset_value; \ | 95 xset_var->gu.val = xset_value; \ |
96 } while (0) | 96 } while (0) |
97 # define XSETOBJ(var, vartype, value) do { \ | 97 # define XSETOBJ(var, value) do { \ |
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 Lisp_Object make_int (EMACS_INT val); | 103 INLINE_HEADER Lisp_Object make_int (EMACS_INT val); |
104 INLINE Lisp_Object | 104 INLINE_HEADER 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 Lisp_Object make_char (Emchar val); | 112 INLINE_HEADER Lisp_Object make_char (Emchar val); |
113 INLINE Lisp_Object | 113 INLINE_HEADER 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; | |
119 } | |
120 | |
121 INLINE_HEADER Lisp_Object wrap_object (void *ptr); | |
122 INLINE_HEADER Lisp_Object | |
123 wrap_object (void *ptr) | |
124 { | |
125 Lisp_Object obj; | |
126 XSETOBJ (obj, ptr); | |
118 return obj; | 127 return obj; |
119 } | 128 } |
120 | 129 |
121 extern Lisp_Object Qnull_pointer, Qzero; | 130 extern Lisp_Object Qnull_pointer, Qzero; |
122 | 131 |
134 /* Convert between a (void *) and a Lisp_Object, as when the | 143 /* Convert between a (void *) and a Lisp_Object, as when the |
135 Lisp_Object is passed to a toolkit callback function */ | 144 Lisp_Object is passed to a toolkit callback function */ |
136 #define VOID_TO_LISP(larg,varg) \ | 145 #define VOID_TO_LISP(larg,varg) \ |
137 ((void) ((larg).v = (struct nosuchstruct *) (varg))) | 146 ((void) ((larg).v = (struct nosuchstruct *) (varg))) |
138 #define CVOID_TO_LISP(larg,varg) \ | 147 #define CVOID_TO_LISP(larg,varg) \ |
139 ((void) ((larg).cv = (CONST struct nosuchstruct *) (varg))) | 148 ((void) ((larg).cv = (const struct nosuchstruct *) (varg))) |
140 #define LISP_TO_VOID(larg) ((void *) ((larg).v)) | 149 #define LISP_TO_VOID(larg) ((void *) ((larg).v)) |
141 #define LISP_TO_CVOID(larg) ((CONST void *) ((larg).cv)) | 150 #define LISP_TO_CVOID(larg) ((const void *) ((larg).cv)) |
142 | 151 |
143 /* Convert a Lisp_Object into something that can't be used as an | 152 /* Convert a Lisp_Object into something that can't be used as an |
144 lvalue. Useful for type-checking. */ | 153 lvalue. Useful for type-checking. */ |
145 #if (__GNUC__ > 1) | 154 #if (__GNUC__ > 1) |
146 #define NON_LVALUE(larg) ({ (larg); }) | 155 #define NON_LVALUE(larg) ({ (larg); }) |