parrotcode: Export globals from one namespace to another | |
Contents | PMCs |
src/pmc/exporter.pmc - Export globals from one namespace to another
Exports globals from one namespace to another. Exporter always uses the typed namespace interface, as outlined in docs/pdds/pdd21_namespaces.pod.
Exporter is not derived from any other PMC, and does not provide any standard interface--its interface consists solely of non-vtable methods.
The Exporter PMC structure (Parrot_Exporter
) consists of three items:
ns_src
ns_dest
globals
void init()
void destroy()
void mark()
PCCMETHOD void source(PMC *src :optional, int got_src :opt_flag)
ns_src
.) Sets the value if src
is passed,
otherwise returns the value.
Throws an exception if a non-NameSpace PMC is passed.PCCMETHOD void destination(PMC *dest :optional, int got_dest :opt_flag)
ns_dest
.) Sets the value if dest
is passed,
otherwise returns the value.
Throws an exception if a non-NameSpace PMC is passed.PCCMETHOD void globals(PMC *glb :optional, int got_glb :opt_flag)
globals
.) Sets the array if glb
is passed,
otherwise returns the value.
If glb
is a String,
it is split on ascii whitespace.
If glb
is a FixedStringArray,
it is cloned and set.PCCMETHOD void add_global(PMC *global :optional, int has_global :opt_flag)
global
to the array of globals (globals
.) Sets the array if global
is passed,
otherwise does nothing.PCCMETHOD void import(PMC *dest :optional :named["destination"], int got_dest :opt_flag, PMC *src :optional :named["source"], int got_src :opt_flag, PMC *globals :optional :named["globals"], int got_globals :opt_flag)
globals
from the src
namespace to the dest
namespace.
If src
,
dest
,
or globals
are passed,
they will override the current value.
import
follows the semantics of the export_to
method of the NameSpace
PMC.
in particular,
if a NULL value is passed for globals
,
the default set of items will be imported.
Throws an exception upon error.Unstable. This PMC is under active development; major portions of the interface have not yet been completed.
docs/pdds/pdd17_basic_types.pod, docs/pdds/pdd21_namespaces.pod.
|