comparison src/specifier.h @ 404:2f8bb876ab1d r21-2-32

Import from CVS: tag r21-2-32
author cvs
date Mon, 13 Aug 2007 11:16:07 +0200
parents 74fd4e045ea6
children 501cfd01ee6d
comparison
equal deleted inserted replaced
403:9f011ab08d48 404:2f8bb876ab1d
265 extern const struct lrecord_description specifier_empty_extra_description[]; 265 extern const struct lrecord_description specifier_empty_extra_description[];
266 266
267 #ifdef ERROR_CHECK_TYPECHECK 267 #ifdef ERROR_CHECK_TYPECHECK
268 #define DECLARE_SPECIFIER_TYPE(type) \ 268 #define DECLARE_SPECIFIER_TYPE(type) \
269 extern struct specifier_methods * type##_specifier_methods; \ 269 extern struct specifier_methods * type##_specifier_methods; \
270 INLINE struct type##_specifier * \ 270 INLINE_HEADER struct type##_specifier * \
271 error_check_##type##_specifier_data (Lisp_Specifier *sp); \ 271 error_check_##type##_specifier_data (Lisp_Specifier *sp); \
272 INLINE struct type##_specifier * \ 272 INLINE_HEADER struct type##_specifier * \
273 error_check_##type##_specifier_data (Lisp_Specifier *sp) \ 273 error_check_##type##_specifier_data (Lisp_Specifier *sp) \
274 { \ 274 { \
275 if (SPECIFIERP (sp->magic_parent)) \ 275 if (SPECIFIERP (sp->magic_parent)) \
276 { \ 276 { \
277 assert (SPECIFIER_TYPE_P (sp, type)); \ 277 assert (SPECIFIER_TYPE_P (sp, type)); \
280 else \ 280 else \
281 assert (NILP (sp->magic_parent) || EQ (sp->magic_parent, Qt)); \ 281 assert (NILP (sp->magic_parent) || EQ (sp->magic_parent, Qt)); \
282 assert (SPECIFIER_TYPE_P (sp, type)); \ 282 assert (SPECIFIER_TYPE_P (sp, type)); \
283 return (struct type##_specifier *) sp->data; \ 283 return (struct type##_specifier *) sp->data; \
284 } \ 284 } \
285 INLINE Lisp_Specifier * \ 285 INLINE_HEADER Lisp_Specifier * \
286 error_check_##type##_specifier_type (Lisp_Object obj); \ 286 error_check_##type##_specifier_type (Lisp_Object obj); \
287 INLINE Lisp_Specifier * \ 287 INLINE_HEADER Lisp_Specifier * \
288 error_check_##type##_specifier_type (Lisp_Object obj) \ 288 error_check_##type##_specifier_type (Lisp_Object obj) \
289 { \ 289 { \
290 Lisp_Specifier *sp = XSPECIFIER (obj); \ 290 Lisp_Specifier *sp = XSPECIFIER (obj); \
291 assert (SPECIFIER_TYPE_P (sp, type)); \ 291 assert (SPECIFIER_TYPE_P (sp, type)); \
292 return sp; \ 292 return sp; \
293 } \ 293 } \
294 DECLARE_NOTHING 294 DECLARE_NOTHING
295 #else 295 #else
296 #define DECLARE_SPECIFIER_TYPE(type) \ 296 #define DECLARE_SPECIFIER_TYPE(type) \
297 extern struct specifier_methods * type##_specifier_methods 297 extern struct specifier_methods * type##_specifier_methods
298 #endif /* ERROR_CHECK_TYPECHECK */ 298 #endif /* ERROR_CHECK_TYPECHECK */
299 299
300 #define DEFINE_SPECIFIER_TYPE(type) \ 300 #define DEFINE_SPECIFIER_TYPE(type) \
301 struct specifier_methods * type##_specifier_methods 301 struct specifier_methods * type##_specifier_methods
302 302
303 #define INITIALIZE_SPECIFIER_TYPE(type, obj_name, pred_sym) do { \ 303 #define INITIALIZE_SPECIFIER_TYPE(type, obj_name, pred_sym) do { \
304 type##_specifier_methods = xnew_and_zero (struct specifier_methods); \ 304 type##_specifier_methods = xnew_and_zero (struct specifier_methods); \
305 type##_specifier_methods->name = obj_name; \ 305 type##_specifier_methods->name = obj_name; \
306 type##_specifier_methods->extra_description = \ 306 type##_specifier_methods->extra_description = \
307 specifier_empty_extra_description; \ 307 specifier_empty_extra_description; \
308 defsymbol_nodump (&type##_specifier_methods->predicate_symbol, pred_sym); \ 308 defsymbol_nodump (&type##_specifier_methods->predicate_symbol, pred_sym); \
309 add_entry_to_specifier_type_list (Q##type, type##_specifier_methods); \ 309 add_entry_to_specifier_type_list (Q##type, type##_specifier_methods); \
310 dumpstruct (&type##_specifier_methods, &specifier_methods_description); \ 310 dumpstruct (&type##_specifier_methods, &specifier_methods_description); \
311 } while (0) 311 } while (0)
312 312
313 #define REINITIALIZE_SPECIFIER_TYPE(type) do { \ 313 #define REINITIALIZE_SPECIFIER_TYPE(type) do { \
314 staticpro_nodump (&type##_specifier_methods->predicate_symbol); \ 314 staticpro_nodump (&type##_specifier_methods->predicate_symbol); \
315 } while (0) 315 } while (0)
316 316
317 #define INITIALIZE_SPECIFIER_TYPE_WITH_DATA(type, obj_name, pred_sym) \ 317 #define INITIALIZE_SPECIFIER_TYPE_WITH_DATA(type, obj_name, pred_sym) \
318 do { \ 318 do { \
364 #else 364 #else
365 # define XSPECIFIER_TYPE(x, type) XSPECIFIER (x) 365 # define XSPECIFIER_TYPE(x, type) XSPECIFIER (x)
366 # define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p) 366 # define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p)
367 #endif /* ERROR_CHECK_TYPE_CHECK */ 367 #endif /* ERROR_CHECK_TYPE_CHECK */
368 368
369 #define SPECIFIER_TYPEP(x, type) \ 369 #define SPECIFIER_TYPEP(x, type) \
370 (SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), type)) 370 (SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), type))
371 #define CHECK_SPECIFIER_TYPE(x, type) do { \ 371 #define CHECK_SPECIFIER_TYPE(x, type) do { \
372 CHECK_SPECIFIER (x); \ 372 CHECK_SPECIFIER (x); \
373 if (!SPECIFIER_TYPE_P (XSPECIFIER (x), type)) \ 373 if (!SPECIFIER_TYPE_P (XSPECIFIER (x), type)) \
374 dead_wrong_type_argument \ 374 dead_wrong_type_argument \