NAME ^

classes/ - Parrot Object

DESCRIPTION ^

A Parrot Object is reasonably simple. Its data pointer points to an array with the attributes of the object in it. The int cache value holds the offset in that array of the first attribute, so we can front-load the array with invisible options.

The array holds:

0

The first element of the attribute array is a pointer to the class PMC for this object.

1

The class name (taken from the class PMC)

2...

Attributes.

The object is actually constructed by the instantiation code in src/objects.c, at least for right now.

Methods ^

void init()

Raises an exception to make sure all users call new on the registered class PMC and not the ParrotObject itself.

During Parrot_class_register() this init() method gets replaced by Parrot_instantiate_object().

void init_pmc(PMC *init)

void init_pmc_props(PMC *init, PMC *props)

These two methods just call init(). The arguments are ignored.

PMC *find_method(STRING *name)

Finds the method for *name.

PMC *get_attr(INTVAL idx)

Return attribute number idx.

PMC *get_attr_str(STRING *name)

Return attribute named name.

void set_attr(INTVAL idx, PMC *val)

Set attribute number idx.

void set_attr_str(STRING *name, PMC *val)

Set attribute named name.

PMC *get_class()

Return the class of this object.

void visit(visit_info *info)

This is used by freeze/thaw to visit the contents of the object.

*info is the visit info, (see include/parrot/pmc_freeze.h).

void freeze(visit_info *info)

Used to archive the object.

void thaw(visit_info *info)

Used to unarchive the object.

void thawfinish(visit_info *info)


parrot