NAME
src/pmc/namespace.pmc - NameSpace PMC
DESCRIPTION
These are the vtable functions for the namespace PMC.
Functions
- void init()Initialize a
- void mark()Marks the namespace as live.
- void destroy()Frees the namespace info struct.
- PMC *get_class()Returns the class or role PMC that is associated with this namespace.
- void set_pmc_keyed_str(STRING *key, PMC *value)Sets
- void set_pmc_keyed(PMC *key, PMC *value)If
- PMC *get_pmc_keyed(PMC *key)Return the given namespace or PMCNULL.
- PMC *get_pmc_keyed_str(STRING *key)Return the given namespace item or PMCNULL.
If the named item is either a NameSpace or a var,
the NameSpace is returned.
- PMC *get_pmc_keyed_int(INTVAL key)Return a Sub representing an overridden vtable entry or PMCNULL.
This is not really a public API.
- void *get_pointer_keyed_str(STRING *key)
- void *get_pointer_keyed(PMC *key)Return the given namespace item or PMCNULL.
If the named item is either a NameSpace or a var,
the var is returned.TOTAL KLUDGE.
ON THE CHOPPING BLOCK.
- STRING *get_string()Return the name of this namespace part.
NameSpace PMC.
*value as the namespace item for *key.
This is part of the raw interface.
If the PMC value is exactly a NameSpace,
SELF will be set as the parent of that namespace and the name key of value is stored too.
key is a simple key,
it works like above.
If key is an array of strings or a chained key,
add all components to the namespace.
key is either an array of strings,
or a possibly nested key.
Methods
- METHOD make_namespace(PMC* key)Create and retrieve the namespace given by
- METHOD add_namespace(STRING *name, PMC *namespace)Stores the given namespace under this namespace,
with the given name.
Throws an invalid type exception if
- METHOD add_sub(STRING *name, PMC *sub)Stores the given sub under this namespace,
with the given name.
Throws an invalid type exception if
- METHOD add_var(STRING *name, PMC *var)Stores the given variable under this namespace,
with the given name.
- METHOD get_name()Returns the name of the namespace as an array of strings.
- METHOD find_namespace(STRING *name)Return the namespace with the given name.
- METHOD find_sub(STRING *name)Return the Sub PMC with the given name.
- METHOD find_var(STRING *name)Return the PMC with the given name.
- METHOD del_namespace(STRING *name)Deletes the contained NameSpace PMC with the given name. Throws an invalid type exception if the item to delete is not a NameSpace PMC or subclass, and does not delete the PMC.
- METHOD del_sub(STRING *name)Deletes the contained Sub PMC with the given name. Throws an invalid type exception if the item to delete is not a Sub PMC or subclass, and does not delete the PMC.
- METHOD del_var(STRING *name)Deletes the contained variable-like PMC with the given name.
- METHOD get_sym(STRING *name)Return the symbol (var or sub) with the given name. This can be used to retrieve symbols, if a NameSpace with the same name exists.
- METHOD export_to(PMC *dest, PMC *what)Export items from this NameSpace into the
- METHOD get_parent()Return the parent NameSpace or PMCNULL, if none.
- METHOD get_class()Returns the class or role PMC that is associated with this namespace.
- METHOD set_class(PMC *class_or_role)Sets the class or role PMC that is associated with this namespace.
- METHOD get_associated_methods()Gets the Hash of methods associated with this namespace and removes it from the namespace.
- METHOD get_associated_vtable_methods()Gets the Hash of vtable methods associated with this namespace and removes it from the namespace.
key.
If the namespace already exists,
only retrieve it.
namespace is not a NameSpace PMC or subclass.
sub is not a Sub PMC or subclass.
$P2 = $P3.'get_name'() $S0 = join '::', $P2 # '::Foo::Bar'
dest NameSpace. The items to export are named in what, which may be an array of strings, a hash, or null. If what is an array of strings, interpretation of items in an array follows the conventions of the source (exporting) namespace. If what is a hash, the keys correspond to the names in the source namespace, and the values correspond to the names in the destination namespace. if a hash value is null or an empty string, the name in the hash key is used. A null what requests the 'default' set of items. Any other type passed in what throws an exception.NOTE: exporting 'default' set of items is not yet implemented.
