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 LispPackage
ClassNamespace
static LispPackage
CLNamespace
static ThreadLocation<LispPackage>
currentPackage
Common Lisp*package*
special.Namespace
exported
The set of exported symbols.static LispPackage
KawaNamespace
static LispPackage
KeywordNamespace
-
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 void
addNickNames(LispPackage name, LList nicks)
LList
allExternalSymbols()
The list of symbols exported from this package.LList
allInternalSymbols()
The list of symbols interned into this package.LList
allSymbols(Namespace ns)
The list of symbols managed by a given namespace.static void
exportPkg(LList syms, LispPackage pkg)
Export a list of symbols from a package, checking for conflicts.static LispPackage
findPackage(String name)
Returns null if no package exists.Values.Values2
findSymbol(Object name)
LList
getShadowingSymbols()
static void
importPkg(LList syms, LispPackage pkg)
Import a list of symbols into the internal table of a package.static Object
intern(String name, LispPackage pkg)
boolean
isPresent(String name)
static boolean
keywordp(Object x)
Symbol
lookup(String name, int hash, boolean create)
Symbol
lookupPresent(String name, int hash, boolean intern)
static LispPackage
makeLispPackage(Object name, LList nicks, LList used)
static LList
pkgUsedByList(LispPackage lp)
Used for the CL PACKAGE-USED-BY-LIST functionstatic LList
pkgUsesList(LispPackage lp)
Used for the CL PACKAGE-USE-LIST function.void
setExportedNamespace(Namespace exp)
void
shadow(String name)
The core of the Common Lisp shadow function.void
shadowingImport(Symbol symbol)
static void
signal(String msg)
Temporary stub until Kawa supports conditional restarts.static Object
symbolPackage(Object x)
boolean
unintern(Symbol symbol)
static void
use(LispPackage importing, LispPackage imported)
static void
usePackages(LList importees, LispPackage importer)
static LispPackage
valueOf(String name)
Look up a given package in theNamespace
map.static Namespace
valueOfNoCreate(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 theNamespace
map. 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
LispPackage
named byname
ornull
if aNamespace
is already named byname
but 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.
-
-