Mercurial > hg > xemacs-beta
comparison src/specifier.h @ 440:8de8e3f6228a r21-2-28
Import from CVS: tag r21-2-28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:33:38 +0200 |
parents | 84b14dcb0985 |
children | abe6d1db359e |
comparison
equal
deleted
inserted
replaced
439:357dd071b03c | 440:8de8e3f6228a |
---|---|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 Boston, MA 02111-1307, USA. */ | 20 Boston, MA 02111-1307, USA. */ |
21 | 21 |
22 /* Synched up with: Not in FSF. */ | 22 /* Synched up with: Not in FSF. */ |
23 | 23 |
24 #ifndef _XEMACS_SPECIFIER_H_ | 24 #ifndef INCLUDED_specifier_h_ |
25 #define _XEMACS_SPECIFIER_H_ | 25 #define INCLUDED_specifier_h_ |
26 | 26 |
27 /* | 27 /* |
28 MAGIC SPECIFIERS | 28 MAGIC SPECIFIERS |
29 ================ | 29 ================ |
30 | 30 |
235 Lisp_Object fallback; | 235 Lisp_Object fallback; |
236 | 236 |
237 /* type-specific extra data attached to a specifier */ | 237 /* type-specific extra data attached to a specifier */ |
238 char data[1]; | 238 char data[1]; |
239 }; | 239 }; |
240 | 240 typedef struct Lisp_Specifier Lisp_Specifier; |
241 DECLARE_LRECORD (specifier, struct Lisp_Specifier); | 241 |
242 #define XSPECIFIER(x) XRECORD (x, specifier, struct Lisp_Specifier) | 242 DECLARE_LRECORD (specifier, Lisp_Specifier); |
243 #define XSPECIFIER(x) XRECORD (x, specifier, Lisp_Specifier) | |
243 #define XSETSPECIFIER(x, p) XSETRECORD (x, p, specifier) | 244 #define XSETSPECIFIER(x, p) XSETRECORD (x, p, specifier) |
244 #define SPECIFIERP(x) RECORDP (x, specifier) | 245 #define SPECIFIERP(x) RECORDP (x, specifier) |
245 #define CHECK_SPECIFIER(x) CHECK_RECORD (x, specifier) | 246 #define CHECK_SPECIFIER(x) CHECK_RECORD (x, specifier) |
246 #define CONCHECK_SPECIFIER(x) CONCHECK_RECORD (x, specifier) | 247 #define CONCHECK_SPECIFIER(x) CONCHECK_RECORD (x, specifier) |
247 | 248 |
250 #define RAW_SPECMETH(sp, m) ((sp)->methods->m##_method) | 251 #define RAW_SPECMETH(sp, m) ((sp)->methods->m##_method) |
251 #define HAS_SPECMETH_P(sp, m) (!!RAW_SPECMETH (sp, m)) | 252 #define HAS_SPECMETH_P(sp, m) (!!RAW_SPECMETH (sp, m)) |
252 #define SPECMETH(sp, m, args) (((sp)->methods->m##_method) args) | 253 #define SPECMETH(sp, m, args) (((sp)->methods->m##_method) args) |
253 | 254 |
254 /* Call a void-returning specifier method, if it exists. */ | 255 /* Call a void-returning specifier method, if it exists. */ |
255 #define MAYBE_SPECMETH(sp, m, args) do { \ | 256 #define MAYBE_SPECMETH(sp, m, args) do { \ |
256 struct Lisp_Specifier *maybe_specmeth_sp = (sp); \ | 257 Lisp_Specifier *maybe_specmeth_sp = (sp); \ |
257 if (HAS_SPECMETH_P (maybe_specmeth_sp, m)) \ | 258 if (HAS_SPECMETH_P (maybe_specmeth_sp, m)) \ |
258 SPECMETH (maybe_specmeth_sp, m, args); \ | 259 SPECMETH (maybe_specmeth_sp, m, args); \ |
259 } while (0) | 260 } while (0) |
260 | 261 |
261 /***** Defining new specifier types *****/ | 262 /***** Defining new specifier types *****/ |
262 | 263 |
263 #define specifier_data_offset (offsetof(struct Lisp_Specifier, data)) | 264 #define specifier_data_offset (offsetof (Lisp_Specifier, data)) |
264 extern const struct lrecord_description specifier_empty_extra_description[]; | 265 extern const struct lrecord_description specifier_empty_extra_description[]; |
265 | 266 |
266 #ifdef ERROR_CHECK_TYPECHECK | 267 #ifdef ERROR_CHECK_TYPECHECK |
267 #define DECLARE_SPECIFIER_TYPE(type) \ | 268 #define DECLARE_SPECIFIER_TYPE(type) \ |
268 extern struct specifier_methods * type##_specifier_methods; \ | 269 extern struct specifier_methods * type##_specifier_methods; \ |
269 INLINE struct type##_specifier * \ | 270 INLINE struct type##_specifier * \ |
270 error_check_##type##_specifier_data (struct Lisp_Specifier *sp); \ | 271 error_check_##type##_specifier_data (Lisp_Specifier *sp); \ |
271 INLINE struct type##_specifier * \ | 272 INLINE struct type##_specifier * \ |
272 error_check_##type##_specifier_data (struct Lisp_Specifier *sp) \ | 273 error_check_##type##_specifier_data (Lisp_Specifier *sp) \ |
273 { \ | 274 { \ |
274 if (SPECIFIERP (sp->magic_parent)) \ | 275 if (SPECIFIERP (sp->magic_parent)) \ |
275 { \ | 276 { \ |
276 assert (SPECIFIER_TYPE_P (sp, type)); \ | 277 assert (SPECIFIER_TYPE_P (sp, type)); \ |
277 sp = XSPECIFIER (sp->magic_parent); \ | 278 sp = XSPECIFIER (sp->magic_parent); \ |
279 else \ | 280 else \ |
280 assert (NILP (sp->magic_parent) || EQ (sp->magic_parent, Qt)); \ | 281 assert (NILP (sp->magic_parent) || EQ (sp->magic_parent, Qt)); \ |
281 assert (SPECIFIER_TYPE_P (sp, type)); \ | 282 assert (SPECIFIER_TYPE_P (sp, type)); \ |
282 return (struct type##_specifier *) sp->data; \ | 283 return (struct type##_specifier *) sp->data; \ |
283 } \ | 284 } \ |
284 INLINE struct Lisp_Specifier * \ | 285 INLINE Lisp_Specifier * \ |
285 error_check_##type##_specifier_type (Lisp_Object obj); \ | 286 error_check_##type##_specifier_type (Lisp_Object obj); \ |
286 INLINE struct Lisp_Specifier * \ | 287 INLINE Lisp_Specifier * \ |
287 error_check_##type##_specifier_type (Lisp_Object obj) \ | 288 error_check_##type##_specifier_type (Lisp_Object obj) \ |
288 { \ | 289 { \ |
289 struct Lisp_Specifier *sp = XSPECIFIER (obj); \ | 290 Lisp_Specifier *sp = XSPECIFIER (obj); \ |
290 assert (SPECIFIER_TYPE_P (sp, type)); \ | 291 assert (SPECIFIER_TYPE_P (sp, type)); \ |
291 return sp; \ | 292 return sp; \ |
292 } \ | 293 } \ |
293 DECLARE_NOTHING | 294 DECLARE_NOTHING |
294 #else | 295 #else |
490 #define XSETDISPLAYTABLE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, display_table) | 491 #define XSETDISPLAYTABLE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, display_table) |
491 #define DISPLAYTABLE_SPECIFIERP(x) SPECIFIER_TYPEP (x, display_table) | 492 #define DISPLAYTABLE_SPECIFIERP(x) SPECIFIER_TYPEP (x, display_table) |
492 #define CHECK_DISPLAYTABLE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, display_table) | 493 #define CHECK_DISPLAYTABLE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, display_table) |
493 #define CONCHECK_DISPLAYTABLE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, display_table) | 494 #define CONCHECK_DISPLAYTABLE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, display_table) |
494 | 495 |
495 #endif /* _XEMACS_SPECIFIER_H_ */ | 496 #endif /* INCLUDED_specifier_h_ */ |