Commit 46b2ac21 authored by Karl Heuer's avatar Karl Heuer
Browse files

(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,

default_value, Fset_default, Fkill_local_variable): Use the new substructure.
(store_symval_forwarding): Change args to buffer_slot_type_mismatch.
parent 54dfdeb0
...@@ -626,27 +626,24 @@ do_symval_forwarding (valcontents) ...@@ -626,27 +626,24 @@ do_symval_forwarding (valcontents)
register Lisp_Object valcontents; register Lisp_Object valcontents;
{ {
register Lisp_Object val; register Lisp_Object val;
#ifdef SWITCH_ENUM_BUG int offset;
switch ((int) XTYPE (valcontents)) if (MISCP (valcontents))
#else switch (XMISC (valcontents)->type)
switch (XTYPE (valcontents)) {
#endif case Lisp_Misc_Intfwd:
{ XSETINT (val, *XINTFWD (valcontents)->intvar);
case Lisp_Intfwd: return val;
XSETINT (val, *XINTPTR (valcontents));
return val;
case Lisp_Boolfwd: case Lisp_Misc_Boolfwd:
if (*XINTPTR (valcontents)) return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil);
return Qt;
return Qnil;
case Lisp_Objfwd: case Lisp_Misc_Objfwd:
return *XOBJFWD (valcontents); return *XOBJFWD (valcontents)->objvar;
case Lisp_Buffer_Objfwd: case Lisp_Misc_Buffer_Objfwd:
return *(Lisp_Object *)(XUINT (valcontents) + (char *)current_buffer); offset = XBUFFER_OBJFWD (valcontents)->offset;
} return *(Lisp_Object *)(offset + (char *)current_buffer);
}
return valcontents; return valcontents;
} }
...@@ -666,35 +663,42 @@ store_symval_forwarding (sym, valcontents, newval) ...@@ -666,35 +663,42 @@ store_symval_forwarding (sym, valcontents, newval)
switch (XTYPE (valcontents)) switch (XTYPE (valcontents))
#endif #endif
{ {
case Lisp_Intfwd: case Lisp_Misc:
CHECK_NUMBER (newval, 1); switch (XMISC (valcontents)->type)
*XINTPTR (valcontents) = XINT (newval); {
break; case Lisp_Misc_Intfwd:
CHECK_NUMBER (newval, 1);
*XINTFWD (valcontents)->intvar = XINT (newval);
break;
case Lisp_Boolfwd: case Lisp_Misc_Boolfwd:
*XINTPTR (valcontents) = NILP(newval) ? 0 : 1; *XBOOLFWD (valcontents)->boolvar = NILP (newval) ? 0 : 1;
break; break;
case Lisp_Objfwd: case Lisp_Misc_Objfwd:
*XOBJFWD (valcontents) = newval; *XOBJFWD (valcontents)->objvar = newval;
break; break;
case Lisp_Buffer_Objfwd: case Lisp_Misc_Buffer_Objfwd:
{ {
unsigned int offset = XUINT (valcontents); int offset = XBUFFER_OBJFWD (valcontents)->offset;
Lisp_Object type; Lisp_Object type;
type = *(Lisp_Object *)(offset + (char *)&buffer_local_types); type = *(Lisp_Object *)(offset + (char *)&buffer_local_types);
if (! NILP (type) && ! NILP (newval) if (! NILP (type) && ! NILP (newval)
&& XTYPE (newval) != XINT (type)) && XTYPE (newval) != XINT (type))
buffer_slot_type_mismatch (valcontents, newval); buffer_slot_type_mismatch (offset);
*(Lisp_Object *)(XUINT (valcontents) + (char *)current_buffer) *(Lisp_Object *)(offset + (char *)current_buffer) = newval;
= newval; break;
break; }
} default:
goto def;
}
break;
default: default:
def:
valcontents = XSYMBOL (sym)->value; valcontents = XSYMBOL (sym)->value;
if (BUFFER_LOCAL_VALUEP (valcontents) if (BUFFER_LOCAL_VALUEP (valcontents)
|| SOME_BUFFER_LOCAL_VALUEP (valcontents)) || SOME_BUFFER_LOCAL_VALUEP (valcontents))
...@@ -773,20 +777,23 @@ find_symbol_value (sym) ...@@ -773,20 +777,23 @@ find_symbol_value (sym)
valcontents = swap_in_symval_forwarding (sym, valcontents); valcontents = swap_in_symval_forwarding (sym, valcontents);
goto retry; goto retry;
case Lisp_Intfwd: case Lisp_Misc:
XSETINT (val, *XINTPTR (valcontents)); switch (XMISC (valcontents)->type)
return val; {
case Lisp_Misc_Intfwd:
XSETINT (val, *XINTFWD (valcontents)->intvar);
return val;
case Lisp_Boolfwd: case Lisp_Misc_Boolfwd:
if (*XINTPTR (valcontents)) return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil);
return Qt;
return Qnil;
case Lisp_Objfwd: case Lisp_Misc_Objfwd:
return *XOBJFWD (valcontents); return *XOBJFWD (valcontents)->objvar;
case Lisp_Buffer_Objfwd: case Lisp_Misc_Buffer_Objfwd:
return *(Lisp_Object *)(XUINT (valcontents) + (char *)current_buffer); return *(Lisp_Object *)(XBUFFER_OBJFWD (valcontents)->offset
+ (char *)current_buffer);
}
} }
return valcontents; return valcontents;
...@@ -822,7 +829,7 @@ DEFUN ("set", Fset, Sset, 2, 2, 0, ...@@ -822,7 +829,7 @@ DEFUN ("set", Fset, Sset, 2, 2, 0,
if (BUFFER_OBJFWDP (valcontents)) if (BUFFER_OBJFWDP (valcontents))
{ {
register int idx = XUINT (valcontents); register int idx = XBUFFER_OBJFWD (valcontents)->offset;
register int mask = XINT (*((Lisp_Object *) register int mask = XINT (*((Lisp_Object *)
(idx + (char *)&buffer_local_flags))); (idx + (char *)&buffer_local_flags)));
if (mask > 0) if (mask > 0)
...@@ -938,7 +945,7 @@ default_value (sym) ...@@ -938,7 +945,7 @@ default_value (sym)
rather than letting do_symval_forwarding get the current value. */ rather than letting do_symval_forwarding get the current value. */
if (BUFFER_OBJFWDP (valcontents)) if (BUFFER_OBJFWDP (valcontents))
{ {
register int idx = XUINT (valcontents); register int idx = XBUFFER_OBJFWD (valcontents)->offset;
if (XINT (*(Lisp_Object *) (idx + (char *) &buffer_local_flags)) != 0) if (XINT (*(Lisp_Object *) (idx + (char *) &buffer_local_flags)) != 0)
return *(Lisp_Object *)(idx + (char *) &buffer_defaults); return *(Lisp_Object *)(idx + (char *) &buffer_defaults);
...@@ -1011,7 +1018,7 @@ for this variable.") ...@@ -1011,7 +1018,7 @@ for this variable.")
variables. */ variables. */
if (BUFFER_OBJFWDP (valcontents)) if (BUFFER_OBJFWDP (valcontents))
{ {
register int idx = XUINT (valcontents); register int idx = XBUFFER_OBJFWD (valcontents)->offset;
register struct buffer *b; register struct buffer *b;
register int mask = XINT (*((Lisp_Object *) register int mask = XINT (*((Lisp_Object *)
(idx + (char *)&buffer_local_flags))); (idx + (char *)&buffer_local_flags)));
...@@ -1205,7 +1212,7 @@ From now on the default value will apply in this buffer.") ...@@ -1205,7 +1212,7 @@ From now on the default value will apply in this buffer.")
if (BUFFER_OBJFWDP (valcontents)) if (BUFFER_OBJFWDP (valcontents))
{ {
register int idx = XUINT (valcontents); register int idx = XBUFFER_OBJFWD (valcontents)->offset;
register int mask = XINT (*((Lisp_Object*) register int mask = XINT (*((Lisp_Object*)
(idx + (char *)&buffer_local_flags))); (idx + (char *)&buffer_local_flags)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment