From 7c2b95c04cd3a0f566d076fa1ac2d8d93721b2ec Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 10 Nov 2016 06:57:06 -0800 Subject: Implementing package foreign symbol concept. * eval.c (eval_init): Register new intrinsics: package-local-symbols, package-foreign-symbols, use-sym, unuse-sym, use-package, unuse-package, unintern. * gc.c (mark_obj): Mark new hidhash member of struct package. * lib.c (make_package): Initialize new hidhash member of struct package. (lookup_package): New static function. (find_package): Allow string or symbol argument. (get_package): New static function. (delete_package, package_symbols): Use get_package for flexible package argument; delete_package removes symbols from other packages via unuse_package. (package_local_symbols, package_foreign_symbols): New functions. (use_sym, unuse_sym): New functions. (resolve_package_designators): New static function. (use_package, unuse_package): New functions. (symbol_present): New static function. (intern): Revised with get_package for flexible package argument. (unintern): New function. (rehome_sym): Use get_package. Semantics revised. (obj_print_impl): Use symbol_present function to determine whether object is visible in *package* and can be printed without a prefix, rather than naive home package test. * lib.h (struct package): New member, hidhash. (package_local_symbols, package_foreign_symbols, use_sym, unuse_sym, use_package, unuse_package, unintern): Declared. * txr.1: Documentation updated. Extended section introducing the design of packages, and argument conventions. New functions described. Existing function descriptions revised, particularly rehome-sym. Missing description of delete-package added. --- gc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gc.c') diff --git a/gc.c b/gc.c index d9cca476..34edb9f4 100644 --- a/gc.c +++ b/gc.c @@ -355,6 +355,7 @@ tail_call: mark_obj_tail(obj->s.package); case PKG: mark_obj(obj->pk.name); + mark_obj(obj->pk.hidhash); mark_obj_tail(obj->pk.symhash); case FUN: mark_obj(obj->f.env); -- cgit v1.2.3