Mercurial > emacs
comparison src/lread.c @ 39580:ee9c4218a600
(Fintern, Funintern): Set symbol's interned and constant
bit-fields.
(init_obarray): Likewise for t and nil.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 05 Oct 2001 09:49:16 +0000 |
parents | 93dbf78d7b7a |
children | 98efaf9813f4 |
comparison
equal
deleted
inserted
replaced
39579:e307d3530117 | 39580:ee9c4218a600 |
---|---|
2898 return tem; | 2898 return tem; |
2899 | 2899 |
2900 if (!NILP (Vpurify_flag)) | 2900 if (!NILP (Vpurify_flag)) |
2901 string = Fpurecopy (string); | 2901 string = Fpurecopy (string); |
2902 sym = Fmake_symbol (string); | 2902 sym = Fmake_symbol (string); |
2903 XSYMBOL (sym)->obarray = obarray; | 2903 |
2904 if (EQ (obarray, initial_obarray)) | |
2905 XSYMBOL (sym)->interned = SYMBOL_INTERNED_IN_INITIAL_OBARRAY; | |
2906 else | |
2907 XSYMBOL (sym)->interned = SYMBOL_INTERNED; | |
2904 | 2908 |
2905 if ((XSTRING (string)->data[0] == ':') | 2909 if ((XSTRING (string)->data[0] == ':') |
2906 && EQ (obarray, initial_obarray)) | 2910 && EQ (obarray, initial_obarray)) |
2907 XSYMBOL (sym)->value = sym; | 2911 { |
2912 XSYMBOL (sym)->constant = 1; | |
2913 XSYMBOL (sym)->value = sym; | |
2914 } | |
2908 | 2915 |
2909 ptr = &XVECTOR (obarray)->contents[XINT (tem)]; | 2916 ptr = &XVECTOR (obarray)->contents[XINT (tem)]; |
2910 if (SYMBOLP (*ptr)) | 2917 if (SYMBOLP (*ptr)) |
2911 XSYMBOL (sym)->next = XSYMBOL (*ptr); | 2918 XSYMBOL (sym)->next = XSYMBOL (*ptr); |
2912 else | 2919 else |
2975 return Qnil; | 2982 return Qnil; |
2976 /* If arg was a symbol, don't delete anything but that symbol itself. */ | 2983 /* If arg was a symbol, don't delete anything but that symbol itself. */ |
2977 if (SYMBOLP (name) && !EQ (name, tem)) | 2984 if (SYMBOLP (name) && !EQ (name, tem)) |
2978 return Qnil; | 2985 return Qnil; |
2979 | 2986 |
2980 XSYMBOL (tem)->obarray = Qnil; | 2987 XSYMBOL (tem)->interned = SYMBOL_UNINTERNED; |
2988 XSYMBOL (tem)->constant = 0; | |
2989 XSYMBOL (tem)->indirect_variable = 0; | |
2981 | 2990 |
2982 hash = oblookup_last_bucket_number; | 2991 hash = oblookup_last_bucket_number; |
2983 | 2992 |
2984 if (EQ (XVECTOR (obarray)->contents[hash], tem)) | 2993 if (EQ (XVECTOR (obarray)->contents[hash], tem)) |
2985 { | 2994 { |
3132 Qnil = Fmake_symbol (make_pure_string ("nil", 3, 3, 0)); | 3141 Qnil = Fmake_symbol (make_pure_string ("nil", 3, 3, 0)); |
3133 Vobarray = Fmake_vector (oblength, make_number (0)); | 3142 Vobarray = Fmake_vector (oblength, make_number (0)); |
3134 initial_obarray = Vobarray; | 3143 initial_obarray = Vobarray; |
3135 staticpro (&initial_obarray); | 3144 staticpro (&initial_obarray); |
3136 /* Intern nil in the obarray */ | 3145 /* Intern nil in the obarray */ |
3137 XSYMBOL (Qnil)->obarray = Vobarray; | 3146 XSYMBOL (Qnil)->interned = SYMBOL_INTERNED_IN_INITIAL_OBARRAY; |
3147 XSYMBOL (Qnil)->constant = 1; | |
3148 | |
3138 /* These locals are to kludge around a pyramid compiler bug. */ | 3149 /* These locals are to kludge around a pyramid compiler bug. */ |
3139 hash = hash_string ("nil", 3); | 3150 hash = hash_string ("nil", 3); |
3140 /* Separate statement here to avoid VAXC bug. */ | 3151 /* Separate statement here to avoid VAXC bug. */ |
3141 hash %= OBARRAY_SIZE; | 3152 hash %= OBARRAY_SIZE; |
3142 tem = &XVECTOR (Vobarray)->contents[hash]; | 3153 tem = &XVECTOR (Vobarray)->contents[hash]; |
3149 | 3160 |
3150 Qt = intern ("t"); | 3161 Qt = intern ("t"); |
3151 XSYMBOL (Qnil)->value = Qnil; | 3162 XSYMBOL (Qnil)->value = Qnil; |
3152 XSYMBOL (Qnil)->plist = Qnil; | 3163 XSYMBOL (Qnil)->plist = Qnil; |
3153 XSYMBOL (Qt)->value = Qt; | 3164 XSYMBOL (Qt)->value = Qt; |
3165 XSYMBOL (Qt)->constant = 1; | |
3154 | 3166 |
3155 /* Qt is correct even if CANNOT_DUMP. loadup.el will set to nil at end. */ | 3167 /* Qt is correct even if CANNOT_DUMP. loadup.el will set to nil at end. */ |
3156 Vpurify_flag = Qt; | 3168 Vpurify_flag = Qt; |
3157 | 3169 |
3158 Qvariable_documentation = intern ("variable-documentation"); | 3170 Qvariable_documentation = intern ("variable-documentation"); |
3194 Lisp_Object sym, val; | 3206 Lisp_Object sym, val; |
3195 sym = intern (namestring); | 3207 sym = intern (namestring); |
3196 val = allocate_misc (); | 3208 val = allocate_misc (); |
3197 XMISCTYPE (val) = Lisp_Misc_Intfwd; | 3209 XMISCTYPE (val) = Lisp_Misc_Intfwd; |
3198 XINTFWD (val)->intvar = address; | 3210 XINTFWD (val)->intvar = address; |
3199 XSYMBOL (sym)->value = val; | 3211 SET_SYMBOL_VALUE (sym, val); |
3200 } | 3212 } |
3201 | 3213 |
3202 /* Similar but define a variable whose value is T if address contains 1, | 3214 /* Similar but define a variable whose value is T if address contains 1, |
3203 NIL if address contains 0 */ | 3215 NIL if address contains 0 */ |
3204 void | 3216 void |
3209 Lisp_Object sym, val; | 3221 Lisp_Object sym, val; |
3210 sym = intern (namestring); | 3222 sym = intern (namestring); |
3211 val = allocate_misc (); | 3223 val = allocate_misc (); |
3212 XMISCTYPE (val) = Lisp_Misc_Boolfwd; | 3224 XMISCTYPE (val) = Lisp_Misc_Boolfwd; |
3213 XBOOLFWD (val)->boolvar = address; | 3225 XBOOLFWD (val)->boolvar = address; |
3214 XSYMBOL (sym)->value = val; | 3226 SET_SYMBOL_VALUE (sym, val); |
3215 Vbyte_boolean_vars = Fcons (sym, Vbyte_boolean_vars); | 3227 Vbyte_boolean_vars = Fcons (sym, Vbyte_boolean_vars); |
3216 } | 3228 } |
3217 | 3229 |
3218 /* Similar but define a variable whose value is the Lisp Object stored | 3230 /* Similar but define a variable whose value is the Lisp Object stored |
3219 at address. Two versions: with and without gc-marking of the C | 3231 at address. Two versions: with and without gc-marking of the C |
3228 Lisp_Object sym, val; | 3240 Lisp_Object sym, val; |
3229 sym = intern (namestring); | 3241 sym = intern (namestring); |
3230 val = allocate_misc (); | 3242 val = allocate_misc (); |
3231 XMISCTYPE (val) = Lisp_Misc_Objfwd; | 3243 XMISCTYPE (val) = Lisp_Misc_Objfwd; |
3232 XOBJFWD (val)->objvar = address; | 3244 XOBJFWD (val)->objvar = address; |
3233 XSYMBOL (sym)->value = val; | 3245 SET_SYMBOL_VALUE (sym, val); |
3234 } | 3246 } |
3235 | 3247 |
3236 void | 3248 void |
3237 defvar_lisp (namestring, address) | 3249 defvar_lisp (namestring, address) |
3238 char *namestring; | 3250 char *namestring; |
3261 val = allocate_misc (); | 3273 val = allocate_misc (); |
3262 offset = (char *)address - (char *)current_buffer; | 3274 offset = (char *)address - (char *)current_buffer; |
3263 | 3275 |
3264 XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd; | 3276 XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd; |
3265 XBUFFER_OBJFWD (val)->offset = offset; | 3277 XBUFFER_OBJFWD (val)->offset = offset; |
3266 XSYMBOL (sym)->value = val; | 3278 SET_SYMBOL_VALUE (sym, val); |
3267 PER_BUFFER_SYMBOL (offset) = sym; | 3279 PER_BUFFER_SYMBOL (offset) = sym; |
3268 PER_BUFFER_TYPE (offset) = type; | 3280 PER_BUFFER_TYPE (offset) = type; |
3269 | 3281 |
3270 if (PER_BUFFER_IDX (offset) == 0) | 3282 if (PER_BUFFER_IDX (offset) == 0) |
3271 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding | 3283 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding |
3285 Lisp_Object sym, val; | 3297 Lisp_Object sym, val; |
3286 sym = intern (namestring); | 3298 sym = intern (namestring); |
3287 val = allocate_misc (); | 3299 val = allocate_misc (); |
3288 XMISCTYPE (val) = Lisp_Misc_Kboard_Objfwd; | 3300 XMISCTYPE (val) = Lisp_Misc_Kboard_Objfwd; |
3289 XKBOARD_OBJFWD (val)->offset = offset; | 3301 XKBOARD_OBJFWD (val)->offset = offset; |
3290 XSYMBOL (sym)->value = val; | 3302 SET_SYMBOL_VALUE (sym, val); |
3291 } | 3303 } |
3292 | 3304 |
3293 /* Record the value of load-path used at the start of dumping | 3305 /* Record the value of load-path used at the start of dumping |
3294 so we can see if the site changed it later during dumping. */ | 3306 so we can see if the site changed it later during dumping. */ |
3295 static Lisp_Object dump_path; | 3307 static Lisp_Object dump_path; |