Mercurial > hg > xemacs-beta
comparison src/lrecord.h @ 3063:d30cd499e445
[xemacs-hg @ 2005-11-13 10:48:01 by ben]
further error-checking, etc.
alloc.c, lrecord.h: Move around the handling of setting of lheader->uid so it's in
set_lheader_implementation() -- that way, even non-MC-ALLOC builds
get useful uid's in their bare lrecords. Redo related code for
strings so the non-ascii count that is stored in the uid isn't hosed.
events.c: Save and restore the uid around event zeroing/deadbeefing.
lisp.h: Set the correct value of MAX_STRING_ASCII_BEGIN under MC_ALLOC.
lisp.h: rearrange the basic code handling ints and chars. basic int stuff goes
first, followed by basic char stuff, followed in turn by stuff that
mixes ints and chars. this is required since some basic defn's have
become inline functions.
XCHAR and CHARP have additional error-checking in that they check to make
sure that the value in question is not just a character but a valid
character (i.e. its numeric value is valid).
print.c: debug_p4 now has a useful UID in all cases and uses it; but it also prints
the raw header address (previously, you just got one of them).
text.h: some basic char defn's that belonged in lisp.h have been moved there.
valid_ichar_p() is moved too since the inline functions need it.
author | ben |
---|---|
date | Sun, 13 Nov 2005 10:48:04 +0000 |
parents | 986cd22006a9 |
children | 141c2920ea48 3742ea8250b5 |
comparison
equal
deleted
inserted
replaced
3062:21d92abaac3a | 3063:d30cd499e445 |
---|---|
118 /* The `free' field is a flag that indicates whether this lrecord | 118 /* The `free' field is a flag that indicates whether this lrecord |
119 is currently free or not. This is used for error checking and | 119 is currently free or not. This is used for error checking and |
120 debugging. */ | 120 debugging. */ |
121 unsigned int free :1; | 121 unsigned int free :1; |
122 | 122 |
123 /* The `uid' field is just for debugging/printing convenience. | 123 /* The `uid' field is just for debugging/printing convenience. Having |
124 Having this slot doesn't hurt us much spacewise, since the | 124 this slot doesn't hurt us spacewise, since the bits are unused |
125 bits are unused anyway. */ | 125 anyway. (The bits are used for strings, though.) */ |
126 unsigned int uid :22; | 126 unsigned int uid :22; |
127 | 127 |
128 #else /* not MC_ALLOC */ | 128 #else /* not MC_ALLOC */ |
129 /* If `mark' is 0 after the GC mark phase, the object will be freed | 129 /* If `mark' is 0 after the GC mark phase, the object will be freed |
130 during the GC sweep phase. There are 2 ways that `mark' can be 1: | 130 during the GC sweep phase. There are 2 ways that `mark' can be 1: |
138 unsigned int c_readonly :1; | 138 unsigned int c_readonly :1; |
139 | 139 |
140 /* 1 if the object is readonly from lisp */ | 140 /* 1 if the object is readonly from lisp */ |
141 unsigned int lisp_readonly :1; | 141 unsigned int lisp_readonly :1; |
142 | 142 |
143 unsigned int unused :21; | 143 /* The `uid' field is just for debugging/printing convenience. Having |
144 this slot doesn't hurt us spacewise, since the bits are unused | |
145 anyway. (The bits are used for strings, though.) */ | |
146 unsigned int uid :21; | |
144 | 147 |
145 #endif /* not MC_ALLOC */ | 148 #endif /* not MC_ALLOC */ |
146 }; | 149 }; |
147 | 150 |
148 struct lrecord_implementation; | 151 struct lrecord_implementation; |
149 int lrecord_type_index (const struct lrecord_implementation *implementation); | 152 int lrecord_type_index (const struct lrecord_implementation *implementation); |
153 extern int lrecord_uid_counter; | |
150 | 154 |
151 #ifdef MC_ALLOC | 155 #ifdef MC_ALLOC |
152 #define set_lheader_implementation(header,imp) do { \ | 156 #define set_lheader_implementation(header,imp) do { \ |
153 struct lrecord_header* SLI_header = (header); \ | 157 struct lrecord_header* SLI_header = (header); \ |
154 SLI_header->type = (imp)->lrecord_type_index; \ | 158 SLI_header->type = (imp)->lrecord_type_index; \ |
155 SLI_header->lisp_readonly = 0; \ | 159 SLI_header->lisp_readonly = 0; \ |
156 SLI_header->free = 0; \ | 160 SLI_header->free = 0; \ |
161 SLI_header->uid = lrecord_uid_counter++; \ | |
157 } while (0) | 162 } while (0) |
158 #else /* not MC_ALLOC */ | 163 #else /* not MC_ALLOC */ |
159 #define set_lheader_implementation(header,imp) do { \ | 164 #define set_lheader_implementation(header,imp) do { \ |
160 struct lrecord_header* SLI_header = (header); \ | 165 struct lrecord_header* SLI_header = (header); \ |
161 SLI_header->type = (imp)->lrecord_type_index; \ | 166 SLI_header->type = (imp)->lrecord_type_index; \ |
162 SLI_header->mark = 0; \ | 167 SLI_header->mark = 0; \ |
163 SLI_header->c_readonly = 0; \ | 168 SLI_header->c_readonly = 0; \ |
164 SLI_header->lisp_readonly = 0; \ | 169 SLI_header->lisp_readonly = 0; \ |
170 SLI_header->uid = lrecord_uid_counter++; \ | |
165 } while (0) | 171 } while (0) |
166 #endif /* not MC_ALLOC */ | 172 #endif /* not MC_ALLOC */ |
167 | 173 |
168 #ifndef MC_ALLOC | 174 #ifndef MC_ALLOC |
169 struct old_lcrecord_header | 175 struct old_lcrecord_header |