parrotcode: Class and object | |
Contents | C |
objects.c - Class and object
Handles class and object manipulation.
INTVAL Parrot_get_vtable_index(Interp *, STRING *name)
name
is a valid vtable slot name.static PMC *find_vtable_meth_ns(Interp *interp, PMC *ns, INTVAL vtable_index)
PMC *Parrot_find_vtable_meth(Interp *interp, PMC *pmc, STRING *meth)
STRING *readable_name(Interp *interp, PMC *name)
static void fail_if_exist(Interp *interp, PMC *name)
static void create_deleg_pmc_vtable(Interp *, PMC *_class, PMC *class_name, int full)
const char *Parrot_MMD_method_name(Interp*, INTVAL)
INTVAL Parrot_MMD_method_idx(Interp*, STRING *)
PMC *Parrot_single_subclass(Interp *interp, PMC *base_class, PMC *child_class_name)
child_class
is NULL
,
this is an anonymous subclass we're creating,
function.void Parrot_new_class(Interp *interp, PMC *_class, PMC *class_name)
class_name
.PMC *Parrot_class_lookup(Interp *interp, STRING *class_name)
PMC *Parrot_class_lookup_p(Interp *interp, PMC *class_name)
class_name
and returns it if it exists.
Otherwise it returns PMCNULL
.static void parrot_class_register(Interp *interp, PMC *class_name, PMC *new_class, PMC *mro)
init
method initializes objects of the class rather than the class itself,
and adding it to the interpreter's base type table so you can create a new foo
in PASM like this: new Px, foo
.void Parrot_instantiate_object(Interp *interp, PMC *object, PMC *init)
PMC *Parrot_add_parent(Interp *interp, PMC *_class, PMC *parent)
PMC *Parrot_remove_parent(Interp *interp, PMC *removed_class, PMC *existing_class)
NULL
.PMC *Parrot_multi_subclass(Interp *interp, PMC *base_class_array, STRING *child_class_name)
NULL
.INTVAL Parrot_object_isa(Interp *interp, PMC *pmc, PMC *cl)
pmc
is an instance of class cl
.PMC *Parrot_new_method_cache(Interp *interp)
NULL
.PMC *Parrot_find_method_with_cache(Interp *interp, PMC *_class, STRING *method_name)
PMC *Parrot_find_method_direct(Interp *interp, PMC *_class, STRING *method_name)
void Parrot_note_method_offset(Interp *interp, UINTVAL offset, PMC *method)
INTVAL Parrot_add_attribute(Interp *interp, PMC *_class, STRING *attr)
attr
to the class.PMC *Parrot_get_attrib_by_num(Interp *interp, PMC *object, INTVAL attrib)
attrib
from object
.
Presumably the code is asking for the correct attribute number.PMC *Parrot_get_attrib_by_str(Interp *interp, PMC *object, STRING *attr)
attr
from object
.PMC *Parrot_set_attrib_by_num(Interp *interp, PMC *object, INTVAL attrib, PMC *value)
attrib
from object
to value
.
Presumably the code is asking for the correct attribute number.PMC *Parrot_set_attrib_by_str(Interp *interp, PMC *object, STRING *attr, PMC *value)
attr
from object
to value
.PMC *Parrot_find_class_constructor(Interp *interp, STRING *_class, INTVAL classtoken)
PMC *Parrot_ComputeMRO_C3(Interp *interp, PMC *_class)
void Parrot_ComposeRole(Interp *interp, PMC *role, PMC *exclude, int got_exclude, PMC *alias, int got_alias, PMC *methods_hash, PMC *roles_list)
role
parameter is the role that we are composing into the class or role.
methods_hash
is the hash of method names to invokable PMCs that contains the methods the class or role has.
roles_list
is the list of roles the the class or method does.role
parameter is only dealt with by its external interface.
Whether this routine is usable by any other object system implemented in Parrot very much depends on how closely the role composition semantics they want are to the default implementation.include/parrot/objects.h, docs/pdds/pdd15_objects.pod.
|