Mercurial > hg > xemacs-beta
comparison src/symbols.c @ 343:8bec6624d99b r21-1-1
Import from CVS: tag r21-1-1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:52:53 +0200 |
parents | 558f606b08ae |
children | 972bbb6d6ca2 |
comparison
equal
deleted
inserted
replaced
342:b036ce23deaa | 343:8bec6624d99b |
---|---|
96 struct Lisp_Symbol *sym = XSYMBOL (obj); | 96 struct Lisp_Symbol *sym = XSYMBOL (obj); |
97 Lisp_Object pname; | 97 Lisp_Object pname; |
98 | 98 |
99 ((markobj) (sym->value)); | 99 ((markobj) (sym->value)); |
100 ((markobj) (sym->function)); | 100 ((markobj) (sym->function)); |
101 /* No need to mark through ->obarray, because it only holds nil or t. */ | |
102 /*((markobj) (sym->obarray));*/ | |
103 XSETSTRING (pname, sym->name); | 101 XSETSTRING (pname, sym->name); |
104 ((markobj) (pname)); | 102 ((markobj) (pname)); |
105 if (!symbol_next (sym)) | 103 if (!symbol_next (sym)) |
106 return sym->plist; | 104 return sym->plist; |
107 else | 105 else |
190 ptr = &XVECTOR_DATA (obarray)[XINT (sym)]; | 188 ptr = &XVECTOR_DATA (obarray)[XINT (sym)]; |
191 | 189 |
192 if (purify_flag && ! purified (str)) | 190 if (purify_flag && ! purified (str)) |
193 str = make_pure_pname (XSTRING_DATA (str), len, 0); | 191 str = make_pure_pname (XSTRING_DATA (str), len, 0); |
194 sym = Fmake_symbol (str); | 192 sym = Fmake_symbol (str); |
195 /* FSFmacs places OBARRAY here, but it is pointless because we do | 193 /* FSFmacs places OBARRAY here, but it we know better. See lisp.h |
196 not mark through this slot, so it is not usable later (because | 194 for a little explanation. */ |
197 the obarray might have been collected). Marking through the | 195 XSYMBOL_OBARRAY_FLAGS (sym) = 1 | (2 * EQ (Vobarray, obarray)); |
198 ->obarray slot is an even worse idea, because it would keep | |
199 obarrays from being collected because of symbols pointed to them. | |
200 | |
201 NOTE: We place Qt here only if OBARRAY is actually Vobarray. It | |
202 is safer to do it this way, to avoid hosing with symbols within | |
203 pure objects. */ | |
204 if (EQ (obarray, Vobarray)) | |
205 XSYMBOL (sym)->obarray = Qt; | |
206 | 196 |
207 if (SYMBOLP (*ptr)) | 197 if (SYMBOLP (*ptr)) |
208 symbol_next (XSYMBOL (sym)) = XSYMBOL (*ptr); | 198 symbol_next (XSYMBOL (sym)) = XSYMBOL (*ptr); |
209 else | 199 else |
210 symbol_next (XSYMBOL (sym)) = 0; | 200 symbol_next (XSYMBOL (sym)) = 0; |
285 XSYMBOL (tail)->next = XSYMBOL (following)->next; | 275 XSYMBOL (tail)->next = XSYMBOL (following)->next; |
286 break; | 276 break; |
287 } | 277 } |
288 } | 278 } |
289 } | 279 } |
290 XSYMBOL (tem)->obarray = Qnil; | 280 if (XSYMBOL_OBARRAY_FLAGS (tem) & 4) |
281 { | |
282 /* Symbol was stored somewhere in a pure structure, so it needs | |
283 at least one existing reference. Make one. */ | |
284 Fputhash (tem, Qnil, Vpure_uninterned_symbol_table); | |
285 } | |
286 XSYMBOL_OBARRAY_FLAGS (tem) &= ~3; | |
291 return Qt; | 287 return Qt; |
292 } | 288 } |
293 | 289 |
294 /* Return the symbol in OBARRAY whose names matches the string | 290 /* Return the symbol in OBARRAY whose names matches the string |
295 of SIZE characters at PTR. If there is no such symbol in OBARRAY, | 291 of SIZE characters at PTR. If there is no such symbol in OBARRAY, |
559 signal_simple_error ("Use `set-specifier' to change a specifier's value", | 555 signal_simple_error ("Use `set-specifier' to change a specifier's value", |
560 sym); | 556 sym); |
561 | 557 |
562 if (symbol_is_constant (sym, val) | 558 if (symbol_is_constant (sym, val) |
563 || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym) | 559 || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym) |
564 && !NILP (XSYMBOL (sym)->obarray))) | 560 && (XSYMBOL_OBARRAY_FLAGS (sym) & 2))) |
565 signal_error (Qsetting_constant, | 561 signal_error (Qsetting_constant, |
566 UNBOUNDP (newval) ? list1 (sym) : list2 (sym, newval)); | 562 UNBOUNDP (newval) ? list1 (sym) : list2 (sym, newval)); |
567 } | 563 } |
568 | 564 |
569 /* Verify that it's ok to make SYM buffer-local. This rejects | 565 /* Verify that it's ok to make SYM buffer-local. This rejects |
3160 /* Bootstrapping problem: Qnil isn't set when make_pure_pname is | 3156 /* Bootstrapping problem: Qnil isn't set when make_pure_pname is |
3161 called the first time. */ | 3157 called the first time. */ |
3162 XSYMBOL (Qnil)->name->plist = Qnil; | 3158 XSYMBOL (Qnil)->name->plist = Qnil; |
3163 XSYMBOL (Qnil)->value = Qnil; /* Nihil ex nihil */ | 3159 XSYMBOL (Qnil)->value = Qnil; /* Nihil ex nihil */ |
3164 XSYMBOL (Qnil)->plist = Qnil; | 3160 XSYMBOL (Qnil)->plist = Qnil; |
3161 XSYMBOL_OBARRAY_FLAGS (Qnil) = 1 | 2; | |
3165 | 3162 |
3166 Vobarray = make_vector (OBARRAY_SIZE, Qzero); | 3163 Vobarray = make_vector (OBARRAY_SIZE, Qzero); |
3167 initial_obarray = Vobarray; | 3164 initial_obarray = Vobarray; |
3168 staticpro (&initial_obarray); | 3165 staticpro (&initial_obarray); |
3169 /* Intern nil in the obarray */ | 3166 /* Intern nil in the obarray */ |
3170 { | 3167 { |
3171 int hash = hash_string (string_data (XSYMBOL (Qnil)->name), 3); | 3168 int hash = hash_string (string_data (XSYMBOL (Qnil)->name), 3); |
3172 XVECTOR_DATA (Vobarray)[hash % OBARRAY_SIZE] = Qnil; | 3169 XVECTOR_DATA (Vobarray)[hash % OBARRAY_SIZE] = Qnil; |
3173 XSYMBOL (Qnil)->obarray = Qt; | |
3174 } | 3170 } |
3175 | 3171 |
3176 { | 3172 { |
3177 /* Required to get around a GCC syntax error on certain | 3173 /* Required to get around a GCC syntax error on certain |
3178 architectures */ | 3174 architectures */ |