NAME ^

src/dynpmc/gdbmhash.pmc - GDBM PMC

DESCRIPTION ^

This is an interface to the GNU dbm library.

keys ^

On inserted and fetch, keys are converted to STRINGs.

store ^

PMC insert values are converted to STRINGs. RT#46387: Integer insert values are converted to STRINGs. RT#46389: Number insert values are converted to STRINGs.

fetch ^

get_integer_keyed() and get_number_keyed() probably don't make any sense, as integers usually can't be converted.

When a PMC is requested, a String PMC is returned.

RT#46391: return None PMC for nonexisting keys.

Functions ^

static STRING *make_hash_key(PARROT_INTERP, PMC *key)

Returns a Parrot string for *key.

void class_init()

Class initialization. GDBMHash is a dynamic PMC, meaning that a dynamically loadable module is created. On Unix-like systems this is a shared library. When it is available, the shared library has linked in the library 'gdbm'.

On WIN32 the relevant library seems to be called 'gdbm3'. So we do a bit of cheating here, and load it during class initialization.

VOID set_string_native(STRING *value)

Open a or create a new dbm file.

INTVAL get_integer()

Returns the number of pairs in the hash. A uninitialized GDBMHash returns 0.

INTVAL get_bool()

Returns true if the hash size is not zero.

void set_string_keyed(PMC *key, STRING *value)

STRING *get_string_keyed(PMC *key)

Returns the string value for the element at *key.

void set_pmc_keyed(PMC *key, PMC *value)

Convert value to a string and set the string for the key.

PMC *get_pmc_keyed(PMC *key)

Returns the PMC value for the element at *key.

void set_integer_keyed(PMC *key, INTVAL value)

Convert value to a string and set the string for the key.

void set_number_keyed(PMC *key, FLOATVAL value)

Convert value to a string and set the string for the key.

INTVAL exists_keyed(PMC *key)

Returns whether a key *key exists in the hash.

void delete_keyed(PMC *key)

Deletes the element associated with *key.

SEE ALSO ^

docs/pdds/pdd08_keys.pod, http://gdbm.gnu.org


parrot