| parrotcode: Class and object | |
| Contents | C |

objects.c - Class and object

Handles class and object manipulation.

int Parrot_get_vtable_index(Interp *, const char *name)name is a valid vtable slot name.static PMC *find_vtable_override_byname(Interp *interp, PMC *class, STRING *method_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,
which happens commonly enough to warrant an actual single-subclass 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.
|
|
|