interned in the initial obarray. */)
(Lisp_Object object)
{
- if (SYMBOLP (object)
- && SREF (SYMBOL_NAME (object), 0) == ':'
- && SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (object))
- return Qt;
- return Qnil;
+ return pkg_keywordp (object) ? Qt : Qnil;
}
DEFUN ("vectorp", Fvectorp, Svectorp, 1, 1, 0,
Lisp_Object
find_symbol_value (Lisp_Object symbol)
{
- struct Lisp_Symbol *sym;
-
CHECK_SYMBOL (symbol);
- sym = XSYMBOL (symbol);
+ struct Lisp_Symbol *sym = XSYMBOL (symbol);
- start:
- switch (sym->u.s.redirect)
- {
- case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
- case SYMBOL_PLAINVAL: return SYMBOL_VAL (sym);
- case SYMBOL_LOCALIZED:
+ for (;;)
+ switch (sym->u.s.redirect)
{
- struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
- swap_in_symval_forwarding (sym, blv);
- return (blv->fwd.fwdptr
- ? do_symval_forwarding (blv->fwd)
- : blv_value (blv));
+ case SYMBOL_VARALIAS:
+ sym = indirect_variable (sym);
+ break;
+ case SYMBOL_PLAINVAL:
+ return SYMBOL_VAL (sym);
+ case SYMBOL_LOCALIZED:
+ {
+ struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
+ swap_in_symval_forwarding (sym, blv);
+ return (blv->fwd.fwdptr
+ ? do_symval_forwarding (blv->fwd)
+ : blv_value (blv));
+ }
+ case SYMBOL_FORWARDED:
+ return do_symval_forwarding (SYMBOL_FWD (sym));
+ default:
+ emacs_abort ();
}
- case SYMBOL_FORWARDED:
- return do_symval_forwarding (SYMBOL_FWD (sym));
- default: emacs_abort ();
- }
}
DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0,
global value outside of any lexical scope. */)
(Lisp_Object symbol)
{
- Lisp_Object val;
-
- val = find_symbol_value (symbol);
- if (!BASE_EQ (val, Qunbound))
- return val;
-
- xsignal1 (Qvoid_variable, symbol);
+ const Lisp_Object val = find_symbol_value (symbol);
+ if (EQ (val, Qunbound))
+ xsignal1 (Qvoid_variable, symbol);
+ return val;
}
DEFUN ("set", Fset, Sset, 2, 2, 0,
extern void init_pkg_once (void);
extern void init_pkg (void);
extern void syms_of_pkg (void);
-extern void fix_symbol_packages (void);
-extern Lisp_Object pkg_insert_new_symbol (Lisp_Object symbol, Lisp_Object package);
+extern Lisp_Object pkg_qualified_symbol (Lisp_Object name, Lisp_Object package, bool external);
+extern void pkg_error (const char *fmt, ...);
+extern Lisp_Object pkg_unqualified_symbol (Lisp_Object name);
+extern bool pkg_keywordp (Lisp_Object obj);
+extern Lisp_Object pkg_add_keyword (Lisp_Object sym);
+extern Lisp_Object pkg_add_symbol (Lisp_Object symbol, Lisp_Object package);
\f
/* Return whether a value might be a valid docstring.
/* Defined in lread.c. */
extern Lisp_Object check_obarray (Lisp_Object);
-extern Lisp_Object intern_1 (const char *, ptrdiff_t);
-extern Lisp_Object intern_c_string_1 (const char *, ptrdiff_t);
-extern Lisp_Object intern_driver (Lisp_Object, Lisp_Object, Lisp_Object);
extern void init_symbol (Lisp_Object, Lisp_Object);
extern Lisp_Object oblookup (Lisp_Object, const char *, ptrdiff_t, ptrdiff_t);
INLINE void
extern void init_lread (void);
extern void syms_of_lread (void);
extern void mark_lread (void);
+extern Lisp_Object intern_1 (const char *str, ptrdiff_t len);
+extern Lisp_Object intern_c_string_1 (const char *str, ptrdiff_t len);
+extern Lisp_Object intern_driver (Lisp_Object string, Lisp_Object obarray, Lisp_Object index);
INLINE Lisp_Object
intern (const char *str)
in lexically bound elisp signal an error, as documented. */
XSYMBOL (sym)->u.s.declared_special = true;
SET_SYMBOL_VAL (XSYMBOL (sym), sym);
- pkg_insert_new_symbol (sym, Vkeyword_package);
+ pkg_add_keyword (sym);
}
else
- pkg_insert_new_symbol (sym, Vearmuffs_package);
+ pkg_add_symbol (sym, Vearmuffs_package);
ptr = aref_addr (obarray, XFIXNUM (index));
set_symbol_next (sym, SYMBOLP (*ptr) ? XSYMBOL (*ptr) : NULL);