Package gnu.kawa.lispexpr
Class LispPackage
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- gnu.kawa.util.AbstractHashTable<gnu.mapping.SymbolRef,String,Symbol>
-
- gnu.mapping.Namespace
-
- gnu.kawa.lispexpr.LispPackage
-
- All Implemented Interfaces:
HasNamedParts,Externalizable,Serializable,Map<String,Symbol>
public class LispPackage extends Namespace
Implement a Common Lisp "package" value.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description static LispPackageClassNamespacestatic LispPackageCLNamespacestatic ThreadLocation<LispPackage>currentPackageCommon Lisp*package*special.NamespaceexportedThe set of exported symbols.static LispPackageKawaNamespacestatic LispPackageKeywordNamespace-
Fields inherited from class gnu.mapping.Namespace
EmptyNamespace, nsTable, prefix, UNKNOWN_NAMESPACE
-
Fields inherited from class gnu.kawa.util.AbstractHashTable
DEFAULT_INITIAL_SIZE, mask, num_bindings, table
-
-
Constructor Summary
Constructors Constructor Description LispPackage()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddNickNames(LispPackage name, LList nicks)LListallExternalSymbols()The list of symbols exported from this package.LListallInternalSymbols()The list of symbols interned into this package.LListallSymbols(Namespace ns)The list of symbols managed by a given namespace.static voidexportPkg(LList syms, LispPackage pkg)Export a list of symbols from a package, checking for conflicts.static LispPackagefindPackage(String name)Returns null if no package exists.Values.Values2findSymbol(Object name)LListgetShadowingSymbols()static voidimportPkg(LList syms, LispPackage pkg)Import a list of symbols into the internal table of a package.static Objectintern(String name, LispPackage pkg)booleanisPresent(String name)static booleankeywordp(Object x)Symbollookup(String name, int hash, boolean create)SymbollookupPresent(String name, int hash, boolean intern)static LispPackagemakeLispPackage(Object name, LList nicks, LList used)static LListpkgUsedByList(LispPackage lp)Used for the CL PACKAGE-USED-BY-LIST functionstatic LListpkgUsesList(LispPackage lp)Used for the CL PACKAGE-USE-LIST function.voidsetExportedNamespace(Namespace exp)voidshadow(String name)The core of the Common Lisp shadow function.voidshadowingImport(Symbol symbol)static voidsignal(String msg)Temporary stub until Kawa supports conditional restarts.static ObjectsymbolPackage(Object x)booleanunintern(Symbol symbol)static voiduse(LispPackage importing, LispPackage imported)static voidusePackages(LList importees, LispPackage importer)static LispPackagevalueOf(String name)Look up a given package in theNamespacemap.static NamespacevalueOfNoCreate(String name)-
Methods inherited from class gnu.mapping.Namespace
add, allocEntries, create, create, get, get, getDefault, getDefaultSymbol, getEntryHashCode, getEntryNext, getName, getPrefix, getSymbol, isConstant, isUnknownNamespace, lookup, lookupInternal, makeEntry, makeUnknownNamespace, readExternal, readResolve, remove, setEntryNext, setName, toString, valueOf, valueOf, valueOf, writeExternal
-
Methods inherited from class gnu.kawa.util.AbstractHashTable
clear, entrySet, get, getNode, getOrDefault, hash, hashToIndex, matches, matches, put, put, rehash, remove, size
-
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Field Detail
-
exported
public Namespace exported
The set of exported symbols. This is one of the packages in importing.
-
CLNamespace
public static final LispPackage CLNamespace
-
KeywordNamespace
public static final LispPackage KeywordNamespace
-
KawaNamespace
public static final LispPackage KawaNamespace
-
ClassNamespace
public static final LispPackage ClassNamespace
-
currentPackage
public static ThreadLocation<LispPackage> currentPackage
Common Lisp*package*special.
-
-
Method Detail
-
setExportedNamespace
public void setExportedNamespace(Namespace exp)
-
getShadowingSymbols
public LList getShadowingSymbols()
-
pkgUsesList
public static LList pkgUsesList(LispPackage lp)
Used for the CL PACKAGE-USE-LIST function.
-
pkgUsedByList
public static LList pkgUsedByList(LispPackage lp)
Used for the CL PACKAGE-USED-BY-LIST function
-
addNickNames
public static void addNickNames(LispPackage name, LList nicks)
-
usePackages
public static void usePackages(LList importees, LispPackage importer)
-
makeLispPackage
public static LispPackage makeLispPackage(Object name, LList nicks, LList used)
-
valueOf
public static LispPackage valueOf(String name)
Look up a given package in theNamespacemap. This method creates a new Lisp package in the namespace if it does not already exist.- Parameters:
name- The name of the package to look up.- Returns:
- The
LispPackagenamed bynameornullif aNamespaceis already named bynamebut is not a lisp package.
-
findSymbol
public Values.Values2 findSymbol(Object name)
-
exportPkg
public static void exportPkg(LList syms, LispPackage pkg)
Export a list of symbols from a package, checking for conflicts.- Parameters:
syms- The list of symbols to export.pkg- The package to export the symbols from.
-
importPkg
public static void importPkg(LList syms, LispPackage pkg)
Import a list of symbols into the internal table of a package. This method checks for conflicts, and should in the future allow the user to shadow import any conflicts.- Parameters:
syms- the list of symbols to import.pkg- the package to import into.
-
allSymbols
public LList allSymbols(Namespace ns)
The list of symbols managed by a given namespace.- Parameters:
ns- The namespace whose symbol table we query- Returns:
- The list of symbols managed by the given namespace.
-
allExternalSymbols
public LList allExternalSymbols()
The list of symbols exported from this package.- Returns:
- A list of the the exported symbols from the current package.
-
allInternalSymbols
public LList allInternalSymbols()
The list of symbols interned into this package.- Returns:
- A list of the interned symbols in this package.
-
use
public static void use(LispPackage importing, LispPackage imported)
-
isPresent
public boolean isPresent(String name)
-
unintern
public boolean unintern(Symbol symbol)
-
shadow
public void shadow(String name)
The core of the Common Lisp shadow function.
-
shadowingImport
public void shadowingImport(Symbol symbol)
-
keywordp
public static boolean keywordp(Object x)
-
intern
public static Object intern(String name, LispPackage pkg)
-
findPackage
public static LispPackage findPackage(String name)
Returns null if no package exists.
-
signal
public static void signal(String msg)
Temporary stub until Kawa supports conditional restarts.
-
-