parrotcode: Hash PMC | |
Contents | PMCs |
classes/hash.pmc - Hash PMC
These are the vtable functions for the Hash PMC.
*/
#include "parrot/parrot.h" #include <assert.h>
/* These are set in class_init */
/*
static PMC *get_integer_pmc(Interp *interpreter, INTVAL base_type )
Lookup the PMC type which is used for storing native integers.
TODO: PMCs extending Hash should probably register themselves.
static PMC *get_none_pmc(Interp *interpreter, INTVAL base_type )
As
PerlUndef
andNone
are singleton PMCs, it is probably cheap to callpmc_new
.TODO: PMCs extending Hash should probably register themselves.
static PMC *get_number_pmc(Interp *interpreter, INTVAL base_type )
Lookup the PMC type which is used for floating point numbers.
TODO: PMCs extending Hash should probably register themselves.
static PMC *get_string_pmc(Interp *interpreter, INTVAL base_type )
Lookup the PMC type which is used for storing strings.
TODO: PMCs extending Hash should probably register themselves.
static STRING *make_hash_key(Interp *interpreter, PMC *key)
Returns a Parrot string for
*key
.
void init()
Initializes the instance.
void destroy()
Free hash structure.
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.
STRING *get_repr()
Return a representation of the hash contents.
STRING *get_string_keyed_str(STRING *key)
STRING *get_string_keyed_int(INTVAL key)
STRING *get_string_keyed(PMC *key)
Returns the string 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 *get_iter ()
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 two 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.
Hey! The above document had some coding errors, which are explained below:
|