#define lisp_h_MISCP(x) (SMOB_TYPEP (x, lisp_misc_tag))
#define lisp_h_NILP(x) (scm_is_lisp_false (x))
#define lisp_h_SET_SYMBOL_VAL(sym, v) \
- (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value = (v))
-#define lisp_h_SYMBOL_CONSTANT_P(sym) (XSYMBOL (sym)->constant)
+ (eassert (SYMBOL_REDIRECT (sym) == SYMBOL_PLAINVAL), \
+ scm_c_vector_set_x (sym, 4, v))
+#define lisp_h_SYMBOL_CONSTANT_P(sym) (SYMBOL_CONSTANT (XSYMBOL (sym)))
#define lisp_h_SYMBOL_VAL(sym) \
- (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value)
+ (eassert (SYMBOL_REDIRECT (sym) == SYMBOL_PLAINVAL), \
+ scm_c_vector_ref (sym, 4))
#define lisp_h_SYMBOLP(x) \
(x && (scm_is_symbol (x) || EQ (x, Qnil) || EQ (x, Qt)))
#define lisp_h_VECTORLIKEP(x) (SMOB_TYPEP (x, lisp_vectorlike_tag))
extern Lisp_Object plist_module;
extern Lisp_Object Qt, Qnil, Qt_, Qnil_;
-INLINE struct Lisp_Symbol *
-XSYMBOL (Lisp_Object a)
-{
- Lisp_Object tem;
- if (EQ (a, Qt)) a = Qt_;
- if (EQ (a, Qnil)) a = Qnil_;
- eassert (SYMBOLP (a));
- tem = scm_variable_ref (scm_module_lookup (symbol_module, a));
- return scm_to_pointer (tem);
-}
+typedef Lisp_Object sym_t;
+
+INLINE sym_t XSYMBOL (Lisp_Object a);
/* Pseudovector types. */
return SMOB_PTR (a);
}
-INLINE Lisp_Object
-make_lisp_proc (struct Lisp_Process *p)
-{
- return scm_new_smob (lisp_vectorlike_tag, (scm_t_bits) p);
-}
-
#define XSETINT(a, b) ((a) = make_number (b))
#define XSETFASTINT(a, b) ((a) = make_natnum (b))
#define XSETVECTOR(a, b) ((a) = (b)->header.self)
#define XSETSTRING(a, b) ((a) = (b)->self)
-#define XSETSYMBOL(a, b) ((a) = (b)->self)
+#define XSETSYMBOL(a, b) ((a) = scm_c_vector_ref (b, 0))
#define XSETMISC(a, b) (a) = ((union Lisp_Misc *) (b))->u_any.self
+#define make_lisp_proc(p) ((p)->header.self)
/* Pseudovector types. */
typedef struct interval *INTERVAL;
+struct Lisp_String
+ {
+ ptrdiff_t size;
+ ptrdiff_t size_byte;
+ INTERVAL intervals; /* Text properties in this string. */
+ unsigned char *data;
+ };
+
LISP_MACRO_DEFUN (XCAR, Lisp_Object, (Lisp_Object c), (c))
LISP_MACRO_DEFUN (XCDR, Lisp_Object, (Lisp_Object c), (c))
/* In a string or vector, the sign bit of the `size' is the gc mark bit. */
-struct Lisp_String
- {
- Lisp_Object self;
- ptrdiff_t size;
- ptrdiff_t size_byte;
- INTERVAL intervals; /* Text properties in this string. */
- unsigned char *data;
- };
-
/* True if STR is a multibyte string. */
INLINE bool
STRING_MULTIBYTE (Lisp_Object str)
struct Lisp_Symbol
{
- Lisp_Object self;
+ Lisp_Object self_;
/* Indicates where the value can be found:
0 : it's a plain var, the value is in the `value' field.
1 : it's a varalias, the value is really in the `alias' symbol.
2 : it's a localized var, the value is in the `blv' object.
3 : it's a forwarding variable, the value is in `forward'. */
- ENUM_BF (symbol_redirect) redirect : 3;
+ ENUM_BF (symbol_redirect) redirect_ : 3;
/* Non-zero means symbol is constant, i.e. changing its value
should signal an error. If the value is 3, then the var
can be changed, but only by `defconst'. */
- unsigned constant : 2;
+ unsigned constant_ : 2;
/* True means that this variable has been explicitly declared
special (with `defvar' etc), and shouldn't be lexically bound. */
- bool_bf declared_special : 1;
-
- /* True if pointed to from purespace and hence can't be GC'd. */
- bool_bf pinned : 1;
+ bool_bf declared_special_ : 1;
/* Value of the symbol or Qunbound if unbound. Which alternative of the
union is used depends on the `redirect' field above. */
union {
- Lisp_Object value;
- struct Lisp_Symbol *alias;
- struct Lisp_Buffer_Local_Value *blv;
- union Lisp_Fwd *fwd;
- } val;
+ Lisp_Object value_;
+ sym_t alias_;
+ struct Lisp_Buffer_Local_Value *blv_;
+ union Lisp_Fwd *fwd_;
+ };
};
-/* Value is name of symbol. */
+#define SYMBOL_SELF(sym) (scm_c_vector_ref (sym, 0))
+#define SET_SYMBOL_SELF(sym, v) (scm_c_vector_set_x (sym, 0, v))
+#define SYMBOL_REDIRECT(sym) (XINT (scm_c_vector_ref (sym, 1)))
+#define SET_SYMBOL_REDIRECT(sym, v) (scm_c_vector_set_x (sym, 1, make_number (v)))
+#define SYMBOL_CONSTANT(sym) (XINT (scm_c_vector_ref (sym, 2)))
+#define SET_SYMBOL_CONSTANT(sym, v) (scm_c_vector_set_x (sym, 2, make_number (v)))
+#define SYMBOL_DECLARED_SPECIAL(sym) (XINT (scm_c_vector_ref (sym, 3)))
+#define SET_SYMBOL_DECLARED_SPECIAL(sym, v) (scm_c_vector_set_x (sym, 3, make_number (v)))
-LISP_MACRO_DEFUN (SYMBOL_VAL, Lisp_Object, (struct Lisp_Symbol *sym), (sym))
+/* Value is name of symbol. */
-INLINE struct Lisp_Symbol *
-SYMBOL_ALIAS (struct Lisp_Symbol *sym)
+INLINE sym_t
+SYMBOL_ALIAS (sym_t sym)
{
- eassert (sym->redirect == SYMBOL_VARALIAS);
- return sym->val.alias;
+ eassert (SYMBOL_REDIRECT (sym) == SYMBOL_VARALIAS);
+ return scm_c_vector_ref (sym, 4);
}
INLINE struct Lisp_Buffer_Local_Value *
-SYMBOL_BLV (struct Lisp_Symbol *sym)
+SYMBOL_BLV (sym_t sym)
{
- eassert (sym->redirect == SYMBOL_LOCALIZED);
- return sym->val.blv;
+ eassert (SYMBOL_REDIRECT (sym) == SYMBOL_LOCALIZED);
+ return scm_to_pointer (scm_c_vector_ref (sym, 4));
}
INLINE union Lisp_Fwd *
-SYMBOL_FWD (struct Lisp_Symbol *sym)
+SYMBOL_FWD (sym_t sym)
{
- eassert (sym->redirect == SYMBOL_FORWARDED);
- return sym->val.fwd;
+ eassert (SYMBOL_REDIRECT (sym) == SYMBOL_FORWARDED);
+ return scm_to_pointer (scm_c_vector_ref (sym, 4));
}
LISP_MACRO_DEFUN_VOID (SET_SYMBOL_VAL,
- (struct Lisp_Symbol *sym, Lisp_Object v), (sym, v))
+ (sym_t sym, Lisp_Object v), (sym, v))
INLINE void
-SET_SYMBOL_ALIAS (struct Lisp_Symbol *sym, struct Lisp_Symbol *v)
+SET_SYMBOL_ALIAS (sym_t sym, sym_t v)
{
- eassert (sym->redirect == SYMBOL_VARALIAS);
- sym->val.alias = v;
+ eassert (SYMBOL_REDIRECT (sym) == SYMBOL_VARALIAS);
+ scm_c_vector_set_x (sym, 4, v);
}
INLINE void
-SET_SYMBOL_BLV (struct Lisp_Symbol *sym, struct Lisp_Buffer_Local_Value *v)
+SET_SYMBOL_BLV (sym_t sym, struct Lisp_Buffer_Local_Value *v)
{
- eassert (sym->redirect == SYMBOL_LOCALIZED);
- sym->val.blv = v;
+ eassert (SYMBOL_REDIRECT (sym) == SYMBOL_LOCALIZED);
+ scm_c_vector_set_x (sym, 4, scm_from_pointer (v, NULL));
}
INLINE void
-SET_SYMBOL_FWD (struct Lisp_Symbol *sym, union Lisp_Fwd *v)
+SET_SYMBOL_FWD (sym_t sym, union Lisp_Fwd *v)
{
- eassert (sym->redirect == SYMBOL_FORWARDED);
- sym->val.fwd = v;
+ eassert (SYMBOL_REDIRECT (sym) == SYMBOL_FORWARDED);
+ scm_c_vector_set_x (sym, 4, scm_from_pointer (v, NULL));
}
INLINE Lisp_Object
SYMBOL_NAME (Lisp_Object sym)
{
- if (EQ (sym, Qnil)) sym = Qnil_;
- if (EQ (sym, Qt)) sym = Qt_;
- return build_string (scm_to_locale_string (scm_symbol_to_string (sym)));
+ return build_string (scm_to_locale_string (scm_call_1 (scm_c_public_ref ("language elisp runtime", "symbol-name"), sym)));
}
/* Value is true if SYM is an interned symbol. */
INLINE bool
SYMBOL_INTERNED_P (Lisp_Object sym)
{
- if (EQ (sym, Qnil)) sym = Qnil_;
- if (EQ (sym, Qt)) sym = Qt_;
+ if (EQ (sym, Qnil)) return true;
+ if (EQ (sym, Qt)) return true;
return scm_is_true (scm_symbol_interned_p (sym));
}
+extern Lisp_Object Ffboundp (Lisp_Object);
+extern Lisp_Object Fmakunbound (Lisp_Object);
+extern Lisp_Object Ffmakunbound (Lisp_Object);
+extern Lisp_Object Ffset (Lisp_Object, Lisp_Object);
+extern Lisp_Object Fsymbol_function (Lisp_Object);
+
INLINE Lisp_Object
SYMBOL_FUNCTION (Lisp_Object sym)
{
- if (EQ (sym, Qnil)) sym = Qnil_;
- if (EQ (sym, Qt)) sym = Qt_;
- return scm_variable_ref (scm_module_lookup (function_module, sym));
+ return Fsymbol_function (sym);
}
/* Value is non-zero if symbol is considered a constant, i.e. its
#define DEFSYM(sym, name) \
do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (false)
+LISP_MACRO_DEFUN (SYMBOL_VAL, Lisp_Object, (sym_t sym), (sym))
+
\f
/***********************************************************************
Hash Tables
#define DEFUN_ARGS_8 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
+#define WRAP1(cfn, lfn) \
+ SCM_SNARF_INIT (DEFSYM (cfn ## _sym, lfn)) \
+ static Lisp_Object cfn ## _sym; \
+ Lisp_Object cfn (Lisp_Object a) \
+ { return call1 (cfn ## _sym, a); }
+#define WRAP2(cfn, lfn) Lisp_Object cfn (Lisp_Object a, Lisp_Object b) { return call2 (intern (lfn), a, b); }
+
/* True if OBJ is a Lisp function. */
INLINE bool
FUNCTIONP (Lisp_Object obj)
union specbinding. But only eval.c should access it. */
enum specbind_tag {
- SPECPDL_BACKTRACE, /* An element of the backtrace. */
SPECPDL_LET, /* A plain and simple dynamic let-binding. */
/* Tags greater than SPECPDL_LET must be "subkinds" of LET. */
SPECPDL_LET_LOCAL, /* A buffer-local let-binding. */
Lisp_Object body;
struct handler *next;
EMACS_INT lisp_eval_depth;
- int poll_suppress_count;
int interrupt_input_blocked;
};
INLINE void
set_symbol_function (Lisp_Object sym, Lisp_Object function)
{
- if (EQ (sym, Qnil)) sym = Qnil_;
- if (EQ (sym, Qt)) sym = Qt_;
- scm_variable_set_x (scm_module_lookup (function_module, sym), function);
+ scm_call_2 (scm_c_public_ref ("language elisp runtime", "set-symbol-function!"),
+ sym, function);
}
INLINE Lisp_Object
symbol_plist (Lisp_Object sym)
{
- if (EQ (sym, Qnil)) sym = Qnil_;
- if (EQ (sym, Qt)) sym = Qt_;
- return scm_variable_ref (scm_module_lookup (plist_module, sym));
+ return scm_call_1 (scm_c_public_ref ("language elisp runtime", "symbol-plist"),
+ sym);
}
INLINE void
set_symbol_plist (Lisp_Object sym, Lisp_Object plist)
{
- if (EQ (sym, Qnil)) sym = Qnil_;
- if (EQ (sym, Qt)) sym = Qt_;
- scm_variable_set_x (scm_module_lookup (plist_module, sym), plist);
+ scm_call_2 (scm_c_public_ref ("language elisp runtime", "set-symbol-plist!"),
+ sym, plist);
}
/* Buffer-local (also frame-local) variable access functions. */
extern intmax_t cons_to_signed (Lisp_Object, intmax_t, intmax_t);
extern uintmax_t cons_to_unsigned (Lisp_Object, uintmax_t);
-extern struct Lisp_Symbol *indirect_variable (struct Lisp_Symbol *);
+extern sym_t indirect_variable (sym_t );
extern _Noreturn void args_out_of_range (Lisp_Object, Lisp_Object);
extern _Noreturn void args_out_of_range_3 (Lisp_Object, Lisp_Object,
Lisp_Object);
extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool);
extern void syms_of_data (void);
-extern void swap_in_global_binding (struct Lisp_Symbol *);
+extern void swap_in_global_binding (sym_t );
/* Defined in cmds.c */
extern void syms_of_cmds (void);
/* Defined in alloc.c. */
extern void check_pure_size (void);
extern void free_misc (Lisp_Object);
-extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT);
+extern void allocate_string_data (Lisp_Object, EMACS_INT, EMACS_INT);
extern void malloc_warning (const char *);
extern _Noreturn void memory_full (size_t);
extern _Noreturn void buffer_memory_full (ptrdiff_t);
extern Lisp_Object intern_1 (const char *, ptrdiff_t);
extern Lisp_Object intern_c_string_1 (const char *, ptrdiff_t);
extern Lisp_Object obhash (Lisp_Object);
-extern Lisp_Object oblookup (Lisp_Object, const char *, ptrdiff_t, ptrdiff_t);
INLINE void
LOADHIST_ATTACH (Lisp_Object x)
{
extern void init_eval (void);
extern void syms_of_eval (void);
extern void unwind_body (Lisp_Object);
-extern void record_in_backtrace (Lisp_Object function,
- Lisp_Object *args, ptrdiff_t nargs);
extern void mark_specpdl (void);
-extern void get_backtrace (Lisp_Object array);
-Lisp_Object backtrace_top_function (void);
-extern bool let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol);
+extern bool let_shadows_buffer_binding_p (sym_t symbol);
extern bool let_shadows_global_binding_p (Lisp_Object symbol);
extern _Noreturn SCM abort_to_prompt (SCM, SCM);
extern SCM call_with_prompt (SCM, SCM, SCM);
return;
}
+extern Lisp_Object Ffboundp (Lisp_Object);
+
INLINE bool
functionp (Lisp_Object object)
{
Lisp_Object car = XCAR (object);
return EQ (car, Qlambda) || EQ (car, Qclosure);
}
+ else
+ return false;
+}
+
+extern Lisp_Object xsymbol_fn;
+
+INLINE sym_t
+XSYMBOL (Lisp_Object a)
+{
+ return scm_call_1 (xsymbol_fn, a);
}
INLINE_HEADER_END