extern void pkg_early_intern_symbol (Lisp_Object symbol);
extern Lisp_Object pkg_lookup_c_string (const char *ptr, ptrdiff_t nchars, ptrdiff_t nbytes);
extern void pkg_break (void);
+extern void pkg_map_symbols (Lisp_Object function, Lisp_Object oackage);
extern bool package_system_ready;
}
}
-static void
-mapatoms_1 (Lisp_Object sym, Lisp_Object function)
-{
- eassert (package_system_ready);
- call1 (function, sym);
-}
-
DEFUN ("mapatoms", Fmapatoms, Smapatoms, 1, 2, 0,
doc: /* Call FUNCTION on every symbol in OBARRAY.
OBARRAY defaults to the value of `obarray'. */)
(Lisp_Object function, Lisp_Object obarray)
{
- eassert (package_system_ready);
- if (NILP (obarray)) obarray = Vobarray;
- obarray = check_obarray (obarray);
-
- map_obarray (obarray, mapatoms_1, function);
+ pkg_map_symbols (function, obarray);
return Qnil;
}
return !NILP (Fmemq (obj, early_keywords));
}
+
+/* Map FUNCTION over all symbols in PACKAGE. */
+
+void
+pkg_map_symbols (Lisp_Object function, Lisp_Object package)
+{
+ eassert (package_system_ready);
+ package = package_or_default (package);
+ FOR_EACH_KEY_VALUE (it, XPACKAGE (package)->symbols)
+ call1 (function, it.key);
+}
+
\f
/***********************************************************************
Lisp functions