comparison src/symbols.c @ 400:a86b2b5e0111 r21-2-30

Import from CVS: tag r21-2-30
author cvs
date Mon, 13 Aug 2007 11:14:34 +0200
parents 74fd4e045ea6
children 697ef44129c6
comparison
equal deleted inserted replaced
399:376370fb5946 400:a86b2b5e0111
1006 { XD_END } 1006 { XD_END }
1007 }; 1007 };
1008 1008
1009 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-forward", 1009 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-forward",
1010 symbol_value_forward, 1010 symbol_value_forward,
1011 this_one_is_unmarkable, 1011 0,
1012 print_symbol_value_magic, 0, 0, 0, 1012 print_symbol_value_magic, 0, 0, 0,
1013 symbol_value_forward_description, 1013 symbol_value_forward_description,
1014 struct symbol_value_forward); 1014 struct symbol_value_forward);
1015 1015
1016 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-buffer-local", 1016 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-buffer-local",
3131 #ifndef Qnull_pointer 3131 #ifndef Qnull_pointer
3132 Lisp_Object Qnull_pointer; 3132 Lisp_Object Qnull_pointer;
3133 #endif 3133 #endif
3134 3134
3135 /* some losing systems can't have static vars at function scope... */ 3135 /* some losing systems can't have static vars at function scope... */
3136 static struct symbol_value_magic guts_of_unbound_marker = 3136 static const struct symbol_value_magic guts_of_unbound_marker =
3137 { /* struct symbol_value_magic */ 3137 { /* struct symbol_value_magic */
3138 { /* struct lcrecord_header */ 3138 { /* struct lcrecord_header */
3139 { /* struct lrecord_header */ 3139 { /* struct lrecord_header */
3140 1, /* type - index into lrecord_implementations_table */ 3140 lrecord_type_symbol_value_forward, /* lrecord_type_index */
3141 0, /* mark */ 3141 1, /* mark bit */
3142 0, /* c_readonly */ 3142 1, /* c_readonly bit */
3143 0, /* lisp_readonly */ 3143 1, /* lisp_readonly bit */
3144 }, 3144 },
3145 0, /* next */ 3145 0, /* next */
3146 0, /* uid */ 3146 0, /* uid */
3147 0, /* free */ 3147 0, /* free */
3148 }, 3148 },
3151 }; 3151 };
3152 3152
3153 void 3153 void
3154 init_symbols_once_early (void) 3154 init_symbols_once_early (void)
3155 { 3155 {
3156 INIT_LRECORD_IMPLEMENTATION (symbol);
3157 INIT_LRECORD_IMPLEMENTATION (symbol_value_forward);
3158 INIT_LRECORD_IMPLEMENTATION (symbol_value_buffer_local);
3159 INIT_LRECORD_IMPLEMENTATION (symbol_value_lisp_magic);
3160 INIT_LRECORD_IMPLEMENTATION (symbol_value_varalias);
3161
3156 reinit_symbols_once_early (); 3162 reinit_symbols_once_early ();
3157 3163
3158 /* Bootstrapping problem: Qnil isn't set when make_string_nocopy is 3164 /* Bootstrapping problem: Qnil isn't set when make_string_nocopy is
3159 called the first time. */ 3165 called the first time. */
3160 Qnil = Fmake_symbol (make_string_nocopy ((const Bufbyte *) "nil", 3)); 3166 Qnil = Fmake_symbol (make_string_nocopy ((const Bufbyte *) "nil", 3));
3172 } 3178 }
3173 3179
3174 { 3180 {
3175 /* Required to get around a GCC syntax error on certain 3181 /* Required to get around a GCC syntax error on certain
3176 architectures */ 3182 architectures */
3177 struct symbol_value_magic *tem = &guts_of_unbound_marker; 3183 const struct symbol_value_magic *tem = &guts_of_unbound_marker;
3178 3184
3179 XSETSYMBOL_VALUE_MAGIC (Qunbound, tem); 3185 XSETSYMBOL_VALUE_MAGIC (Qunbound, tem);
3180 } 3186 }
3181 if ((const void *) XPNTR (Qunbound) !=
3182 (const void *)&guts_of_unbound_marker)
3183 {
3184 /* This might happen on DATA_SEG_BITS machines. */
3185 /* abort (); */
3186 /* Can't represent a pointer to constant C data using a Lisp_Object.
3187 So heap-allocate it. */
3188 struct symbol_value_magic *urk = xnew (struct symbol_value_magic);
3189 memcpy (urk, &guts_of_unbound_marker, sizeof (*urk));
3190 XSETSYMBOL_VALUE_MAGIC (Qunbound, urk);
3191 }
3192 3187
3193 XSYMBOL (Qnil)->function = Qunbound; 3188 XSYMBOL (Qnil)->function = Qunbound;
3194 3189
3195 defsymbol (&Qt, "t"); 3190 defsymbol (&Qt, "t");
3196 XSYMBOL (Qt)->value = Qt; /* Veritas aetera */ 3191 XSYMBOL (Qt)->value = Qt; /* Veritas aetera */
3426 3421
3427 /* Create and initialize a Lisp variable whose value is forwarded to C data */ 3422 /* Create and initialize a Lisp variable whose value is forwarded to C data */
3428 void 3423 void
3429 defvar_magic (const char *symbol_name, const struct symbol_value_forward *magic) 3424 defvar_magic (const char *symbol_name, const struct symbol_value_forward *magic)
3430 { 3425 {
3431 Lisp_Object sym, kludge; 3426 Lisp_Object sym;
3432
3433 /* Check that `magic' points somewhere we can represent as a Lisp pointer */
3434 XSETOBJ (kludge, Lisp_Type_Record, magic);
3435 if ((void *)magic != (void*) XPNTR (kludge))
3436 {
3437 /* This might happen on DATA_SEG_BITS machines. */
3438 /* abort (); */
3439 /* Copy it to somewhere which is representable. */
3440 struct symbol_value_forward *p = xnew (struct symbol_value_forward);
3441 memcpy (p, magic, sizeof *magic);
3442 magic = p;
3443 }
3444 3427
3445 #if defined(HAVE_SHLIB) 3428 #if defined(HAVE_SHLIB)
3446 /* 3429 /*
3447 * As with defsubr(), this will only be called in a dumped Emacs when 3430 * As with defsubr(), this will only be called in a dumped Emacs when
3448 * we are adding variables from a dynamically loaded module. That means 3431 * we are adding variables from a dynamically loaded module. That means