Commit 717b8bcd authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* src/lisp.h (save_type, XSAVE_POINTER, set_save_pointer, XSAVE_INTEGER)

(set_save_integer, XSAVE_OBJECT, XSAVE_VALUE): Move to avoid
forward references.
parent e74aeda8
2013-03-28 Stefan Monnier <monnier@iro.umontreal.ca>
* lisp.h (save_type, XSAVE_POINTER, set_save_pointer, XSAVE_INTEGER)
(set_save_integer, XSAVE_OBJECT, XSAVE_VALUE): Move to avoid
forward references.
2013-03-28 Dmitry Antipov <dmantipov@yandex.ru>
* window.h (struct window): Replace hchild, vchild and buffer slots
......
......@@ -552,11 +552,6 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
}
/* Forward declarations. */
LISP_INLINE bool SAVE_VALUEP (Lisp_Object);
LISP_INLINE struct Lisp_Save_Value *XSAVE_VALUE (Lisp_Object);
/* Extract a value or address from a Lisp_Object. */
#define XCONS(a) (eassert (CONSP (a)), \
......@@ -1487,53 +1482,6 @@ struct Lisp_Save_Value
} data[SAVE_VALUE_SLOTS];
};
/* Return the type of V's Nth saved value. */
LISP_INLINE int
save_type (struct Lisp_Save_Value *v, int n)
{
eassert (0 <= n && n < SAVE_VALUE_SLOTS);
return (v->save_type >> (SAVE_SLOT_BITS * n) & ((1 << SAVE_SLOT_BITS) - 1));
}
/* Get and set the Nth saved pointer. */
LISP_INLINE void *
XSAVE_POINTER (Lisp_Object obj, int n)
{
eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER);
return XSAVE_VALUE (obj)->data[n].pointer;;
}
LISP_INLINE void
set_save_pointer (Lisp_Object obj, int n, void *val)
{
eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER);
XSAVE_VALUE (obj)->data[n].pointer = val;
}
/* Likewise for the saved integer. */
LISP_INLINE ptrdiff_t
XSAVE_INTEGER (Lisp_Object obj, int n)
{
eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER);
return XSAVE_VALUE (obj)->data[n].integer;
}
LISP_INLINE void
set_save_integer (Lisp_Object obj, int n, ptrdiff_t val)
{
eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER);
XSAVE_VALUE (obj)->data[n].integer = val;
}
/* Extract Nth saved object. */
LISP_INLINE Lisp_Object
XSAVE_OBJECT (Lisp_Object obj, int n)
{
eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_OBJECT);
return XSAVE_VALUE (obj)->data[n].object;
}
/* A miscellaneous object, when it's on the free list. */
struct Lisp_Free
{
......@@ -1555,13 +1503,6 @@ union Lisp_Misc
struct Lisp_Save_Value u_save_value;
};
LISP_INLINE struct Lisp_Save_Value *
XSAVE_VALUE (Lisp_Object a)
{
eassert (SAVE_VALUEP (a));
return & XMISC (a)->u_save_value;
}
/* Forwarding pointer to an int variable.
This is allowed only in the value cell of a symbol,
and it means that the symbol's value really lives in the
......@@ -1854,6 +1795,60 @@ SAVE_VALUEP (Lisp_Object x)
return MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value;
}
LISP_INLINE struct Lisp_Save_Value *
XSAVE_VALUE (Lisp_Object a)
{
eassert (SAVE_VALUEP (a));
return & XMISC (a)->u_save_value;
}
/* Return the type of V's Nth saved value. */
LISP_INLINE int
save_type (struct Lisp_Save_Value *v, int n)
{
eassert (0 <= n && n < SAVE_VALUE_SLOTS);
return (v->save_type >> (SAVE_SLOT_BITS * n) & ((1 << SAVE_SLOT_BITS) - 1));
}
/* Get and set the Nth saved pointer. */
LISP_INLINE void *
XSAVE_POINTER (Lisp_Object obj, int n)
{
eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER);
return XSAVE_VALUE (obj)->data[n].pointer;;
}
LISP_INLINE void
set_save_pointer (Lisp_Object obj, int n, void *val)
{
eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER);
XSAVE_VALUE (obj)->data[n].pointer = val;
}
/* Likewise for the saved integer. */
LISP_INLINE ptrdiff_t
XSAVE_INTEGER (Lisp_Object obj, int n)
{
eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER);
return XSAVE_VALUE (obj)->data[n].integer;
}
LISP_INLINE void
set_save_integer (Lisp_Object obj, int n, ptrdiff_t val)
{
eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER);
XSAVE_VALUE (obj)->data[n].integer = val;
}
/* Extract Nth saved object. */
LISP_INLINE Lisp_Object
XSAVE_OBJECT (Lisp_Object obj, int n)
{
eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_OBJECT);
return XSAVE_VALUE (obj)->data[n].object;
}
#define AUTOLOADP(x) (CONSP (x) && EQ (Qautoload, XCAR (x)))
#define INTFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Int)
......
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