parrotcode: NameSpace PMC | |
Contents | PMCs |
src/pmc/namespace.pmc - NameSpace PMC
These are the vtable functions for the namespace PMC.
PMC_struct_val ... the hash, bucket->value is a
var/sub, a namespace, or a FixedPMCarray
of 2 PMCs (namespace, sub/var) slots
PMC_pmc_val ... parent namespace
PMC_data ... Namespace information struct (name, class/role)
void init()
NameSpace
PMC by calling Hash.init
and clearing other fields.void mark()
void destroy()
PMC *get_class()
void set_pmc_keyed_str(STRING *key, PMC *value)
*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.void set_pmc_keyed(PMC *key, PMC *value)
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.PMC *get_pmc_keyed(PMC *key)
key
is either an array of strings, or a possibly nested key.PMC *get_pmc_keyed_str(STRING *key)
PMC *get_pmc_keyed_int(INTVAL key)
void *get_pointer_keyed_str(STRING *key)
void *get_pointer_keyed(PMC *key)
STRING *get_string()
METHOD void PMC *add_namespace(STRING *name, PMC *namespace)
namespace
is not a NameSpace PMC or subclass.METHOD void PMC *add_sub(STRING *name, PMC *sub)
sub
is not a Sub PMC or subclass.METHOD void PMC *add_var(STRING *name, PMC *var)
METHOD PMC *get_name()
$P2 = $P3.'get_name'()
$S0 = join '::', $P2 # '::Foo::Bar'
METHOD PMC *find_namespace(STRING *name)
METHOD PMC *find_sub(STRING *name)
METHOD PMC *find_var(STRING *name)
METHOD PMC *del_namespace(STRING *name)
METHOD PMC *del_sub(STRING *name)
METHOD PMC *del_var(STRING *name)
METHOD PMC *get_sym(STRING *name)
METHOD void export_to(PMC *dest, PMC *what)
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.METHOD PMC *get_parent()
PCCMETHOD get_class()
PCCMETHOD set_class(PMC *class_or_role)
PCCMETHOD get_associated_methods()
PCCMETHOD get_associated_vtable_methods()
|