summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/lib.c b/lib.c
index ad209037..ad9e04f1 100644
--- a/lib.c
+++ b/lib.c
@@ -5145,6 +5145,18 @@ val gensym(val prefix)
return make_sym(name);
}
+static val make_package_common(val name)
+{
+ val obj = make_obj();
+ obj->pk.type = PKG;
+ obj->pk.name = name;
+ obj->pk.symhash = nil; /* make_hash calls below could trigger gc! */
+ obj->pk.hidhash = nil;
+ obj->pk.symhash = make_hash(nil, nil, lit("t")); /* don't have t yet! */
+ obj->pk.hidhash = make_hash(nil, nil, lit("t"));
+ return obj;
+}
+
val make_package(val name)
{
if (find_package(name)) {
@@ -5155,19 +5167,17 @@ val make_package(val name)
uw_throwf(error_s, lit("make-package: package name can't be empty string"),
nao);
} else {
- val obj = make_obj();
- obj->pk.type = PKG;
- obj->pk.name = name;
- obj->pk.symhash = nil; /* make_hash calls below could trigger gc! */
- obj->pk.hidhash = nil;
- obj->pk.symhash = make_hash(nil, nil, lit("t")); /* don't have t yet! */
- obj->pk.hidhash = make_hash(nil, nil, lit("t"));
-
+ val obj = make_package_common(name);
mpush(cons(name, obj), cur_package_alist_loc);
return obj;
}
}
+val make_anon_package(void)
+{
+ return make_package_common(lit("#<anon-package>"));
+}
+
val packagep(val obj)
{
return type(obj) == PKG ? t : nil;