extern Lisp_Object pkg_emacs_intern (Lisp_Object name, Lisp_Object package);
extern Lisp_Object pkg_emacs_intern_soft (Lisp_Object name, Lisp_Object package);
extern Lisp_Object pkg_emacs_unintern (Lisp_Object name, Lisp_Object package);
+extern Lisp_Object pkg_emacs_mapatoms (Lisp_Object fn, Lisp_Object package);
extern Lisp_Object pkg_intern_non_keyword (Lisp_Object name);
extern Lisp_Object pkg_intern_non_keyword_c_string (const char *p, ptrdiff_t len);
extern Lisp_Object pkg_lookup_non_keyword_c_string (const char *ptr, ptrdiff_t nchars, ptrdiff_t nbytes);
extern Lisp_Object pkg_intern_maybe_keyword (Lisp_Object name);
extern void pkg_break (void);
extern void pkg_define_builtin_symbols (void);
-extern void pkg_map_package_symbols (Lisp_Object fn, Lisp_Object package);
-extern void pkg_map_symbols (Lisp_Object function);
extern void pkg_map_symbols_c_fn (void (*fn) (Lisp_Object, Lisp_Object), Lisp_Object arg);
extern Lisp_Object Vpackage_registry;
it defaults to the value of `obarray'. */)
(Lisp_Object string, Lisp_Object package)
{
- eassert (SREF (string, 0) != ':');
+ if (SREF (string, 0) == ':' && NILP (package))
+ {
+ /* PKG-FIXME: We are assuming that this is intended to be a
+ keyword like it was before. */
+ string = Fsubstring (string, make_fixnum (1), Qnil);
+ package = Vkeyword_package;
+ }
return pkg_emacs_intern (string, package);
}
OBARRAY defaults to the value of `obarray'. */)
(Lisp_Object function, Lisp_Object obarray)
{
- pkg_map_package_symbols (function, obarray);
- return Qnil;
+ return pkg_emacs_mapatoms (function, obarray);
}
void
return EQ (SYMBOL_PACKAGE (obj), Vkeyword_package);
}
-void
+static void
pkg_map_package_symbols (Lisp_Object fn, Lisp_Object package)
{
package = check_package (package);
/* Map FUNCTION over all symbols in PACKAGE. */
-void
+static void
pkg_map_symbols (Lisp_Object function)
{
FOR_EACH_KEY_VALUE (it_package, Vpackage_registry)
fn (it_symbol.value, arg);
}
+Lisp_Object
+pkg_emacs_mapatoms (Lisp_Object function, Lisp_Object package)
+{
+ if (NILP (package))
+ pkg_map_symbols (function);
+ else
+ pkg_map_package_symbols (function, package);
+ return Qnil;
+}
+
\f
/***********************************************************************
Lisp functions
DEFSYM (Qpackagep, "packagep");
staticpro (&Vpackage_registry);
- /* PKG-FIXME: Not sure about the purecopy (last arg). */
Vpackage_registry = make_hash_table (hashtest_equal, DEFAULT_HASH_SIZE,
DEFAULT_REHASH_SIZE,
DEFAULT_REHASH_THRESHOLD,
Qnil, false);
- Vemacs_package = make_package (build_pure_c_string ("emacs"));
+ Vemacs_package = make_package (build_string ("emacs"));
staticpro (&Vemacs_package);
- Vkeyword_package = make_package (build_pure_c_string ("keyword"));
+ Vkeyword_package = make_package (build_string ("keyword"));
register_package (Vemacs_package);
staticpro (&Vkeyword_package);
- XPACKAGE (Vkeyword_package)->nicknames = Fcons (build_pure_c_string (""), Qnil);
+ XPACKAGE (Vkeyword_package)->nicknames = Fcons (build_string (""), Qnil);
register_package (Vkeyword_package);
staticpro (&Vearmuffs_package);