NAME ^

src/pmc/namespace.pmc - NameSpace PMC

DESCRIPTION ^

These are the vtable functions for the namespace PMC.

Data ^

  PMC_struct_val       ... the hash, bucket->value is either a
                           var/sub or a namespace, of a FixedPMCarray
                           of 2 PMCs (namespace, sub/var) slots
  PMC_pmc_val          ... parent namespace
  PMC_data             ... name STRING of this namespace part 

Functions ^

voit init()

Initialze a NameSpace PMC by calling Hash.init and clearing other fields.

void mark()

Marks the namespace as live.

void set_pmc_keyed_str(STRING *key, PMC *value)

Sets *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)

If 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)

Return the given namespace or NULL. key is either an array of strings, or a possibly nested key.

PMC *get_pmc_keyed_str(PMC *key)

Return the given namespace item or NULL. If the named item is either a NameSpace or a var, the NameSpace is returned.

void *get_pointer_keyed_str(PMC *key)

Return the given namespace item or NULL. If the named item is either a NameSpace or a var, the var is returned.

STRING *get_string()

Return the name of this namespace part.

Methods ^

METHOD PMC *name()

Returns the name of the namespace as an array of strings.

XXX Should the NULL String of namespace root be included? See also t/pmc/namespace_20.pir.

  $P2 = $P3.'name'()
  $S0 = join '::', $P2            # '::Foo::Bar'

SEE ALSO ^

docs/pdds/pdd21_namespaces.pod


parrot