NAME ^

classes/perlhash.pmc - Perl Hash

DESCRIPTION ^

These are the vtable functions for the PerlHash base class

PerlHash values should probably only be allowed to be PMCs.

Functions ^

static void fromkeys(Interp *interpreter, PMC *self, PMC *keys, PMC *value)

Fill the hash with keys from the aggregate keys and with the optional value. If value isn't given, a None object is filled in as value.

static STRING *make_hash_key(Interp *interpreter, PMC *key)

Returns a Parrot string for *key.

void class_init()

Class initialization. Allocates the memory for the hash.

void *invoke(void *next)

Pythonic object constructor. SELF is a PerlHash Class object. Return a new dict object according to 2.1. Built-in Functions.

void init()

Initializes the instance. Creates a global PerlUndef if it doesn't already exist.

void mark()

Marks the hash as live.

INTVAL type_keyed_str(STRING *key)

Returns the type of the element for *key.

INTVAL type_keyed (PMC *key)

Returns the type of the element for *key.

PMC *clone()

Creates and returns a clone of the hash.

INTVAL get_integer()

Returns the size of the hash.

INTVAL get_integer_keyed_str(STRING *key)

INTVAL get_integer_keyed_int(INTVAL key)

INTVAL get_integer_keyed(PMC *key)

Returns the integer value for the element at *key.

FLOATVAL get_number_keyed_str(STRING *key)

FLOATVAL get_number_keyed_int(INTVAL key)

FLOATVAL get_number_keyed(PMC *key)

Returns the floating-point value for the element at *key.

STRING *get_string()

Returns a string representation of the hash, showing its class name and memory address.

For Python returns its repr.

STRING *get_string_keyed_str(STRING *key)

STRING *get_string_keyed_int(INTVAL key)

STRING *get_string_keyed(PMC *key)

Returns the big number value for the element at *key.

INTVAL get_bool()

Returns true if the hash size is not zero.

INTVAL elements()

Returns the number of elements in the hash.

PMC *get_pmc_keyed_str(STRING *key)

PMC *get_pmc_keyed_int(INTVAL key)

PMC *slice (PMC *key)

Return a new iterator for the slice PMC key

PMC *get_pmc_keyed(PMC *key)

Returns the PMC value for the element at *key.

INTVAL is_same(PMC *other)

Returns whether the hash is the same as *other.

void set_integer_keyed(PMC *key, INTVAL value)

void set_integer_keyed_str(STRING *key, INTVAL value)

void set_number_keyed (PMC *key, FLOATVAL value)

void set_number_keyed_str(STRING *key, FLOATVAL value)

Sets value as the value for *key.

void set_string_keyed(PMC *key, STRING *value)

void set_string_keyed_str(STRING *key, STRING *value)

void set_pmc_keyed(PMC *dest_key, PMC *value)

void set_pmc_keyed_str(STRING *key, PMC *value)

Sets *value as the value for *key.

INTVAL is_equal(PMC *value)

The == operation.

Check if to hashes hold the same keys and values.

INTVAL exists_keyed_str(STRING *key)

INTVAL exists_keyed(PMC *key)

Returns whether a key *key exists in the hash.

INTVAL defined_keyed_str(STRING *key)

INTVAL defined_keyed(PMC *key)

Returns whether the value for *key is defined.

void delete_keyed_str(STRING *key)

void delete_keyed(PMC *key)

Deletes the element associated with *key.

PMC *slice (PMC *key)

Return a new iterator for the slice PMC key

void visit(visit_info *info)

Used during archiving to visit the elements in the hash.

void freeze(visit_info *info)

Used to archive the hash.

void thaw(visit_info *info)

Used to unarchive the hash.

SEE ALSO ^

docs/pdds/pdd08_keys.pod.


parrot