Mercurial > hg > xemacs-beta
comparison src/lrecord.h @ 647:b39c14581166
[xemacs-hg @ 2001-08-13 04:45:47 by ben]
removal of unsigned, size_t, etc.
author | ben |
---|---|
date | Mon, 13 Aug 2001 04:46:48 +0000 |
parents | af57a77cbc92 |
children | fdefd0186b75 |
comparison
equal
deleted
inserted
replaced
646:00c54252fe4f | 647:b39c14581166 |
---|---|
197 lrecord_type_free, /* only used for "free" lrecords */ | 197 lrecord_type_free, /* only used for "free" lrecords */ |
198 lrecord_type_undefined, /* only used for debugging */ | 198 lrecord_type_undefined, /* only used for debugging */ |
199 lrecord_type_last_built_in_type /* must be last */ | 199 lrecord_type_last_built_in_type /* must be last */ |
200 }; | 200 }; |
201 | 201 |
202 extern unsigned int lrecord_type_count; | 202 extern int lrecord_type_count; |
203 | 203 |
204 struct lrecord_implementation | 204 struct lrecord_implementation |
205 { | 205 { |
206 const char *name; | 206 const char *name; |
207 | 207 |
254 int (*remprop) (Lisp_Object obj, Lisp_Object prop); | 254 int (*remprop) (Lisp_Object obj, Lisp_Object prop); |
255 Lisp_Object (*plist) (Lisp_Object obj); | 255 Lisp_Object (*plist) (Lisp_Object obj); |
256 | 256 |
257 /* Only one of `static_size' and `size_in_bytes_method' is non-0. | 257 /* Only one of `static_size' and `size_in_bytes_method' is non-0. |
258 If both are 0, this type is not instantiable by alloc_lcrecord(). */ | 258 If both are 0, this type is not instantiable by alloc_lcrecord(). */ |
259 size_t static_size; | 259 Memory_Count static_size; |
260 size_t (*size_in_bytes_method) (const void *header); | 260 Memory_Count (*size_in_bytes_method) (const void *header); |
261 | 261 |
262 /* The (constant) index into lrecord_implementations_table */ | 262 /* The (constant) index into lrecord_implementations_table */ |
263 enum lrecord_type lrecord_type_index; | 263 enum lrecord_type lrecord_type_index; |
264 | 264 |
265 /* A "basic" lrecord is any lrecord that's not an lcrecord, i.e. | 265 /* A "basic" lrecord is any lrecord that's not an lcrecord, i.e. |
273 /* All the built-in lisp object types are enumerated in `enum lrecord_type'. | 273 /* All the built-in lisp object types are enumerated in `enum lrecord_type'. |
274 Additional ones may be defined by a module (none yet). We leave some | 274 Additional ones may be defined by a module (none yet). We leave some |
275 room in `lrecord_implementations_table' for such new lisp object types. */ | 275 room in `lrecord_implementations_table' for such new lisp object types. */ |
276 #define MODULE_DEFINABLE_TYPE_COUNT 32 | 276 #define MODULE_DEFINABLE_TYPE_COUNT 32 |
277 | 277 |
278 extern const struct lrecord_implementation *lrecord_implementations_table[(unsigned int)lrecord_type_last_built_in_type + MODULE_DEFINABLE_TYPE_COUNT]; | 278 extern const struct lrecord_implementation *lrecord_implementations_table[lrecord_type_last_built_in_type + MODULE_DEFINABLE_TYPE_COUNT]; |
279 | 279 |
280 #define XRECORD_LHEADER_IMPLEMENTATION(obj) \ | 280 #define XRECORD_LHEADER_IMPLEMENTATION(obj) \ |
281 LHEADER_IMPLEMENTATION (XRECORD_LHEADER (obj)) | 281 LHEADER_IMPLEMENTATION (XRECORD_LHEADER (obj)) |
282 #define LHEADER_IMPLEMENTATION(lh) lrecord_implementations_table[(lh)->type] | 282 #define LHEADER_IMPLEMENTATION(lh) lrecord_implementations_table[(lh)->type] |
283 | 283 |
358 | 358 |
359 XD_INT_RESET | 359 XD_INT_RESET |
360 An integer which will be reset to a given value in the dump file. | 360 An integer which will be reset to a given value in the dump file. |
361 | 361 |
362 | 362 |
363 XD_SIZE_T | 363 XD_ELEMENT_COUNT |
364 size_t value. Used for counts. | 364 Element_Count value. Used for counts. |
365 | |
366 XD_MEMORY_COUNT | |
367 Memory_Count value. Used for counts. | |
368 | |
369 XD_HASH_CODE | |
370 Hash_Code value. Used for the results of hashing functions. | |
365 | 371 |
366 XD_INT | 372 XD_INT |
367 int value. Used for counts. | 373 int value. Used for counts. |
368 | 374 |
369 XD_LONG | 375 XD_LONG |
385 Usable where a "count" or "size" is requested. Gives the value of | 391 Usable where a "count" or "size" is requested. Gives the value of |
386 the element which is at line number 'line' in the description (count | 392 the element which is at line number 'line' in the description (count |
387 starts at zero) and adds delta to it. | 393 starts at zero) and adds delta to it. |
388 */ | 394 */ |
389 | 395 |
390 enum lrecord_description_type { | 396 enum lrecord_description_type |
397 { | |
391 XD_LISP_OBJECT_ARRAY, | 398 XD_LISP_OBJECT_ARRAY, |
392 XD_LISP_OBJECT, | 399 XD_LISP_OBJECT, |
393 XD_LO_LINK, | 400 XD_LO_LINK, |
394 XD_OPAQUE_PTR, | 401 XD_OPAQUE_PTR, |
395 XD_STRUCT_PTR, | 402 XD_STRUCT_PTR, |
396 XD_OPAQUE_DATA_PTR, | 403 XD_OPAQUE_DATA_PTR, |
397 XD_C_STRING, | 404 XD_C_STRING, |
398 XD_DOC_STRING, | 405 XD_DOC_STRING, |
399 XD_INT_RESET, | 406 XD_INT_RESET, |
400 XD_SIZE_T, | 407 XD_MEMORY_COUNT, |
408 XD_ELEMENT_COUNT, | |
409 XD_HASH_CODE, | |
401 XD_INT, | 410 XD_INT, |
402 XD_LONG, | 411 XD_LONG, |
403 XD_BYTECOUNT, | 412 XD_BYTECOUNT, |
404 XD_END, | 413 XD_END, |
405 XD_SPECIFIER_END | 414 XD_SPECIFIER_END |
406 }; | 415 }; |
407 | 416 |
408 struct lrecord_description { | 417 struct lrecord_description |
418 { | |
409 enum lrecord_description_type type; | 419 enum lrecord_description_type type; |
410 int offset; | 420 int offset; |
411 EMACS_INT data1; | 421 EMACS_INT data1; |
412 const struct struct_description *data2; | 422 const struct struct_description *data2; |
413 }; | 423 }; |
414 | 424 |
415 struct struct_description { | 425 struct struct_description |
416 size_t size; | 426 { |
427 Memory_Count size; | |
417 const struct lrecord_description *description; | 428 const struct lrecord_description *description; |
418 }; | 429 }; |
419 | 430 |
420 #define XD_INDIRECT(val, delta) (-1-((val)|(delta<<8))) | 431 #define XD_INDIRECT(val, delta) (-1-((val)|(delta<<8))) |
421 | 432 |
478 #define DEFINE_EXTERNAL_LRECORD_SEQUENCE_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,sizer,structtype) \ | 489 #define DEFINE_EXTERNAL_LRECORD_SEQUENCE_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,sizer,structtype) \ |
479 MAKE_EXTERNAL_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,0,sizer,0,structtype) | 490 MAKE_EXTERNAL_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,0,sizer,0,structtype) |
480 | 491 |
481 #define MAKE_EXTERNAL_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,size,sizer,basic_p,structtype) \ | 492 #define MAKE_EXTERNAL_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,size,sizer,basic_p,structtype) \ |
482 DECLARE_ERROR_CHECK_TYPECHECK(c_name, structtype) \ | 493 DECLARE_ERROR_CHECK_TYPECHECK(c_name, structtype) \ |
483 unsigned int lrecord_type_##c_name; \ | 494 int lrecord_type_##c_name; \ |
484 struct lrecord_implementation lrecord_##c_name = \ | 495 struct lrecord_implementation lrecord_##c_name = \ |
485 { name, marker, printer, nuker, equal, hash, desc, \ | 496 { name, marker, printer, nuker, equal, hash, desc, \ |
486 getprop, putprop, remprop, plist, size, sizer, \ | 497 getprop, putprop, remprop, plist, size, sizer, \ |
487 lrecord_type_last_built_in_type, basic_p } | 498 lrecord_type_last_built_in_type, basic_p } |
488 | 499 |
503 | 514 |
504 #define LRECORDP(a) (XTYPE (a) == Lisp_Type_Record) | 515 #define LRECORDP(a) (XTYPE (a) == Lisp_Type_Record) |
505 #define XRECORD_LHEADER(a) ((struct lrecord_header *) XPNTR (a)) | 516 #define XRECORD_LHEADER(a) ((struct lrecord_header *) XPNTR (a)) |
506 | 517 |
507 #define RECORD_TYPEP(x, ty) \ | 518 #define RECORD_TYPEP(x, ty) \ |
508 (LRECORDP (x) && (((unsigned int)(XRECORD_LHEADER (x)->type)) == ((unsigned int)(ty)))) | 519 (LRECORDP (x) && (XRECORD_LHEADER (x)->type == (unsigned int) (ty))) |
509 | 520 |
510 /* Steps to create a new object: | 521 /* Steps to create a new object: |
511 | 522 |
512 1. Declare the struct for your object in a header file somewhere. | 523 1. Declare the struct for your object in a header file somewhere. |
513 Remember that it must begin with | 524 Remember that it must begin with |
658 return (structtype *) XPNTR (obj); \ | 669 return (structtype *) XPNTR (obj); \ |
659 } \ | 670 } \ |
660 extern Lisp_Object Q##c_name##p | 671 extern Lisp_Object Q##c_name##p |
661 | 672 |
662 # define DECLARE_EXTERNAL_LRECORD(c_name, structtype) \ | 673 # define DECLARE_EXTERNAL_LRECORD(c_name, structtype) \ |
663 extern unsigned int lrecord_type_##c_name; \ | 674 extern int lrecord_type_##c_name; \ |
664 extern struct lrecord_implementation lrecord_##c_name; \ | 675 extern struct lrecord_implementation lrecord_##c_name; \ |
665 INLINE_HEADER structtype * \ | 676 INLINE_HEADER structtype * \ |
666 error_check_##c_name (Lisp_Object obj); \ | 677 error_check_##c_name (Lisp_Object obj); \ |
667 INLINE_HEADER structtype * \ | 678 INLINE_HEADER structtype * \ |
668 error_check_##c_name (Lisp_Object obj) \ | 679 error_check_##c_name (Lisp_Object obj) \ |
709 # define DECLARE_LRECORD(c_name, structtype) \ | 720 # define DECLARE_LRECORD(c_name, structtype) \ |
710 extern Lisp_Object Q##c_name##p; \ | 721 extern Lisp_Object Q##c_name##p; \ |
711 extern const struct lrecord_implementation lrecord_##c_name | 722 extern const struct lrecord_implementation lrecord_##c_name |
712 # define DECLARE_EXTERNAL_LRECORD(c_name, structtype) \ | 723 # define DECLARE_EXTERNAL_LRECORD(c_name, structtype) \ |
713 extern Lisp_Object Q##c_name##p; \ | 724 extern Lisp_Object Q##c_name##p; \ |
714 extern unsigned int lrecord_type_##c_name; \ | 725 extern int lrecord_type_##c_name; \ |
715 extern struct lrecord_implementation lrecord_##c_name | 726 extern struct lrecord_implementation lrecord_##c_name |
716 # define DECLARE_NONRECORD(c_name, type_enum, structtype) \ | 727 # define DECLARE_NONRECORD(c_name, type_enum, structtype) \ |
717 extern Lisp_Object Q##c_name##p | 728 extern Lisp_Object Q##c_name##p |
718 # define XRECORD(x, c_name, structtype) ((structtype *) XPNTR (x)) | 729 # define XRECORD(x, c_name, structtype) ((structtype *) XPNTR (x)) |
719 # define XNONRECORD(x, c_name, type_enum, structtype) \ | 730 # define XNONRECORD(x, c_name, type_enum, structtype) \ |
765 #define CHECK_NONRECORD(x, lisp_enum, predicate) do { \ | 776 #define CHECK_NONRECORD(x, lisp_enum, predicate) do { \ |
766 if (XTYPE (x) != lisp_enum) \ | 777 if (XTYPE (x) != lisp_enum) \ |
767 dead_wrong_type_argument (predicate, x); \ | 778 dead_wrong_type_argument (predicate, x); \ |
768 } while (0) | 779 } while (0) |
769 | 780 |
770 void *alloc_lcrecord (size_t size, const struct lrecord_implementation *); | 781 void *alloc_lcrecord (Memory_Count size, |
782 const struct lrecord_implementation *); | |
771 | 783 |
772 #define alloc_lcrecord_type(type, lrecord_implementation) \ | 784 #define alloc_lcrecord_type(type, lrecord_implementation) \ |
773 ((type *) alloc_lcrecord (sizeof (type), lrecord_implementation)) | 785 ((type *) alloc_lcrecord (sizeof (type), lrecord_implementation)) |
774 | 786 |
775 /* Copy the data from one lcrecord structure into another, but don't | 787 /* Copy the data from one lcrecord structure into another, but don't |