src/pmc/default.pmc - Abstract root class
These are the vtable functions for the default PMC class.
All methods which are not defined here get a default implementation generated from src/vtable.tbl by tools/build/pmc2c.pl.
static STRING *caller(PARROT_INTERP, PMC *pmc)
- Returns a C string for the name of
*pmc
.
static void cant_do_method(PARROT_INTERP, PMC *pmc, const char *methname)
- Throws an exception "$methname() not implemented in class '$class'",
used by all unimplemented messages.
static INTVAL check_set_std_props(PARROT_INTERP, PMC *pmc, STRING *key, PMC *value)
- Called from
setprop()
.
- Returns a true value if
setprop()
can avoid actually setting a property in the prophash.
If it returns true,
the property setting will be reflected in a future call to propagate_std_props()
static void propagate_std_props(PARROT_INTERP, PMC *self, PMC *prop_hash)
- Set pending standard properties in
prop_hash
.
static INTVAL has_pending_std_props(PMC *self)
- Returns true if propagate_std_props() would create a non-empty prophash.
static PMC *check_get_std_props(PARROT_INTERPeter, PMC *self, STRING *key)
- Checks if we can infer the value of
key
property from self
without looking at its prophash.
Returns PMCNULL
if not,
returns the value otherwise.
static PMC *make_prop_hash(PARROT_INTERP, PMC *self)
- Create a property hash for
self
.
Returns the created hash.
Inferred properties will be added to the hash and it will be set as PMC_metadata(self)
.
static INTVAL does_isa(PARROT_INTERP, STRING *method, STRING *what)
- Compares
*method
and *what
.
Returns true (1) if method is found in what,
false (0) otherwise.
void init()
- Does nothing.
void init_pmc(PMC *initializer)
- With a null
initializer
,
calls init()
,
else throws an exception.
PMC *instantiate(PMC *init)
- Default fallback.
Creates a new PMC of the type of the class SELF and calls init().
void mark()
- Panics with a "no custom mark routine defined" error message.
PMC *getprop(STRING *key)
- Returns the property for
*key
.
If no property is defined then the NULL PMC is returned.
void setprop(STRING *key, PMC *value)
- Sets the property for
*key
to *value
.
void delprop(STRING *key)
- Deletes the property for
*key
.
PMC *getprops()
- Returns the PMC's properties or the NULL PMC if no properties exist.
INTVAL type()
- Returns the PMC's type.
STRING *name()
- Returns the name of the PMC.
PMC *get_namespace
- Return the namespace for this PMC.
PMC *find_method(STRING *method_name)
- Looks up the method for
*method_name
and returns it.
If no method is found then NULL
is returned.
void add_method(STRING *method_name, PMC *sub)
- Store the method as a global in the namespace of this class.
INTVAL get_integer_keyed_int(INTVAL key)
- Converts
key
to a PMC key and returns the result of calling get_integer_keyed()
with it.
FLOATVAL get_number_keyed_int(INTVAL key)
- Converts
key
to a PMC key and returns the result of calling get_number_keyed()
with it.
STRING *get_string_keyed_int(INTVAL key)
- Converts
key
to a PMC key and returns the result of calling get_string_keyed()
with it.
INTVAL elements_keyed_int(INTVAL key)
- Converts
key
to a PMC key and returns the result of calling elements_keyed()
with it.
PMC *get_pmc_keyed_int(INTVAL key)
- Converts
key
to a PMC key and returns the result of calling get_pmc_keyed()
with it.
void *get_pointer()
- Returns the address of the PMC.
INTVAL is_same(PMC *value)
- Returns whether the PMC is numerically equal to
value
.
void assign_pmc(PMC *value)
void assign_string_native(PMC *value)
- Defaults fall back to
set_pmc
and set_string_native
.
void morph(INTVAL type)
- Changes the PMC to a PMC of a new type
void set_integer_keyed_int(INTVAL key, INTVAL value)
- Converts
key
to a PMC key and calls set_integer_keyed()
with it and value
.
void set_number_keyed_int(INTVAL key, FLOATVAL value)
- Converts
key
to a PMC key and calls set_number_keyed()
with it and value
.
void set_string_keyed_int(INTVAL key, STRING *string)
- Converts
key
to a PMC key and calls set_string_keyed()
with it and value
.
void set_bool_keyed_int(INTVAL key, INTVAL value)
- Converts
key
to a PMC key and calls set_bool_keyed()
with it and value
.
void set_pmc_keyed_int(INTVAL key, PMC *value)
- Converts
key
to a PMC key and calls set_pmc_keyed()
with it and value
.
INTVAL is_equal(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'is_equal'.
INTVAL is_equal_num(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'is_equal_num'.
INTVAL is_equal_string(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'is_equal'.
INTVAL exists_keyed_int(INTVAL key)
- Converts
key
to a PMC key and returns the result of calling exists_keyed()
with it.
INTVAL defined()
- Returns true.
INTVAL defined_keyed_int(INTVAL key)
- Converts
key
to a PMC key and returns the result of calling defined_keyed()
with it.
void delete_keyed_int(INTVAL key)
- Converts
key
to a PMC key and calls delete_keyed()
with it.
PMC *nextkey_keyed_int(INTVAL key, INTVAL w)
- Converts
key
to a PMC key and returns the result of calling nextkey_keyed()
with it.
INTVAL can(STRING *method)
- Reports whether the PMC "can" perform
method
.
If the PMC implements the vtable function method
,
true (1) is returned; otherwise,
false (0) is returned.
INTVAL does(STRING *interface)
- Reports whether the PMC "does" perform
interface
.
If the interface interface
is found in the PMC's interface list,
true (1) is returned; otherwise,
false (0) is returned.
INTVAL does_pmc(PMC *role)
- Reports whether the PMC "does" the
role
.
INTVAL isa_pmc(PMC *_class)
- Reports whether the PMC "isa"
_class
.
If the class _class
is found in the PMC's class hierarchy,
true (1) is returned; otherwise,
false (0) is returned.
INTVAL isa(STRING *_class)
- Reports whether the PMC "isa"
_class
.
If the class _class
is found in the PMC's class hierarchy,
true (1) is returned; otherwise,
false (0) is returned.
PMC *inspect_str(STRING *what)
- Provides introspection of a specific piece of information about the PMC.
PMC *inspect()
- Returns a Hash describing the class,
with key/value pairs as described in inspect_str.
PMC *get_class()
- Returns SELF.
A PMC is its own class.
PMC *get_attr_str(STRING *attr)
- Look for NCI methods and properties.
PMC *get_attr_keyed(PMC *key, STRING *name)
- Default version of keyed attribute lookups.
Discards the key and does a lookup by the string name passed in.
void set_attr_keyed(PMC *key, STRING *name, PMC *value)
- Default version of keyed attribute set.
Discards the key and does a set by the string name passed in.
void add_parent(PMC *parent)
- Add class
parent
to the list of our parents.
void visit(visit_info *info)
- Used by DOD to mark the PMC.
PMC *clone()
- Clones this PMC.
By default,
this just does a freeze and thaw.
void freeze(visit_info *info)
- Does nothing.
void thaw(visit_info *info)
- Initializes the PMC during unarchiving.
void thawfinish(visit_info *info)
- Does nothing.
PMC *add(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'add'.
PMC *add_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'add_int'.
PMC *add_float(FLOATVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'add_float'.
void i_add(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_add'.
void i_add_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_add_int'.
void i_add_float(FLOATVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_add_float'.
PMC *subtract(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'subtract'.
PMC *subtract_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'subtract_int'.
PMC *subtract_float(FLOATVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'subtract_float'.
void i_subtract(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_subtract'.
void i_subtract_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_subtract_int'.
void i_subtract_float(FLOATVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_subtract_float'.
PMC *multiply(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'multiply'.
PMC *multiply_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'multiply_int'.
PMC *multiply_float(FLOATVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'multiply_float'.
void i_multiply(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_multiply'.
void i_multiply_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_multiply_int'.
void i_multiply_float(FLOATVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_multiply_float'.
PMC *divide(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'divide'.
PMC *divide_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'divide_int'.
PMC *divide_float(FLOATVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'divide_float'.
void i_divide(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_divide'.
void i_divide_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_divide_int'.
void i_divide_float(FLOATVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_divide_float'.
PMC *floor_divide(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'floor_divide'.
PMC *floor_divide_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'floor_divide_int'.
PMC *floor_divide_float(FLOATVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'floor_divide_float'.
void i_floor_divide(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_floor_divide'.
void i_floor_divide_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_floor_divide_int'.
void i_floor_divide_float(FLOATVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_floor_divide_float'.
PMC *modulus(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'modulus'.
PMC *modulus_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'modulus_int'.
PMC *modulus_float(FLOATVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'modulus_float'.
void i_modulus(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_modulus'.
void i_modulus_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_modulus_int'.
void i_modulus_float(FLOATVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_modulus_float'.
PMC *pow(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'pow'.
PMC *pow_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'pow_int'.
PMC *pow_float(FLOATVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'pow_float'.
void i_pow(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_pow'.
void i_pow_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_pow_int'.
void i_pow_float(FLOATVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_pow_float'.
PMC *bitwise_or(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_or'.
PMC *bitwise_or_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_or_int'.
void i_bitwise_or(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_or'.
void i_bitwise_or_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_or_int'.
PMC *bitwise_and(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_and'.
PMC *bitwise_and_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_and_int'.
void i_bitwise_and(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_and'.
void i_bitwise_and_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_and_int'.
PMC *bitwise_xor(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_xor'.
PMC *bitwise_xor_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_xor_int'.
void i_bitwise_xor(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_xor'.
void i_bitwise_xor_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_xor_int'.
PMC *bitwise_ors(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_ors'.
PMC *bitwise_ors_str(STRING *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_ors_str'.
void i_bitwise_ors(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_ors'.
void i_bitwise_ors_str(STRING *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_ors_str'.
PMC *bitwise_ands(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_ands'.
PMC *bitwise_ands_str(STRING *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_ands_str'.
void i_bitwise_ands(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_ands'.
void i_bitwise_ands_str(STRING *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_ands_str'.
PMC *bitwise_xors(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_xors'.
PMC *bitwise_xors_str(STRING *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_xors_str'.
void i_bitwise_xors(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_xors'.
void i_bitwise_xors_str(STRING *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_xors_str'.
PMC *bitwise_shl(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_shl'.
PMC *bitwise_shl_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_shl_int'.
void i_bitwise_shl(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_shl'.
void i_bitwise_shl_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_shl_int'.
PMC *bitwise_shr(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_shr'.
PMC *bitwise_shr_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_shr_int'.
void i_bitwise_shr(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_shr'.
void i_bitwise_shr_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_shr_int'.
PMC *bitwise_lsr(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_lsr'.
PMC *bitwise_lsr_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'bitwise_lsr_int'.
void i_bitwise_lsr(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_lsr'.
void i_bitwise_lsr_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_bitwise_lsr_int'.
INTVAL cmp(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'cmp'.
INTVAL cmp_num(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'cmp_num'.
INTVAL cmp_string(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'cmp_string'.
PMC *cmp_pmc(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'cmp_pmc'.
PMC *logical_or(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'logical_or'.
PMC *logical_and(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'logical_and'.
PMC *logical_xor(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'logical_xor'.
PMC *concatenate(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'concatenate'.
PMC *concatenate_str(STRING *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'concatenate_str'.
void i_concatenate(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_concatenate'.
void i_concatenate_str(STRING *value)
- Default fallback.
Performs a multiple dispatch call for 'i_concatenate_str'.
PMC *repeat(PMC *value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'repeat'.
PMC *repeat_int(INTVAL value, PMC *dest)
- Default fallback.
Performs a multiple dispatch call for 'repeat_int'.
void i_repeat(PMC *value)
- Default fallback.
Performs a multiple dispatch call for 'i_repeat'.
void i_repeat_int(INTVAL value)
- Default fallback.
Performs a multiple dispatch call for 'i_repeat_int'.