Skip to content

Commit

Permalink
add iter logic to dynlexpad PMC for TT parrot#1028
Browse files Browse the repository at this point in the history
  • Loading branch information
Whiteknight committed Nov 20, 2010
1 parent 28b24ab commit aecd881
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/dynpmc/dynlexpad.pmc
Expand Up @@ -37,6 +37,7 @@ lexinfo.
=cut

*/

VTABLE void init_pmc(PMC* lexinfo) {
Hash *hash;

Expand All @@ -63,6 +64,7 @@ Initialize the LexPad PMC and remember the associate context.
=cut

*/

VTABLE void set_pointer(void* ctx) {
PMC *std_pad = PARROT_DYNLEXPAD(SELF)->init;
if (std_pad)
Expand All @@ -71,19 +73,50 @@ Initialize the LexPad PMC and remember the associate context.

/*

=item C<void* get_pointer()>

Return the raw Hash pointer, for use in iterators

=cut

*/

VTABLE void *get_pointer() {
return PARROT_DYNLEXPAD(SELF)->hash;
}

/*

=item C<PMC *get_iter()>

Get an iterator for items in the DynLexPad

=cut

*/

VTABLE PMC *get_iter() {
return Parrot_pmc_new_init(INTERP, enum_class_HashIterator, SELF);
}

/*

=item C<INTVAL elements()>

Returns the number of elements in the hash.

=cut

*/

VTABLE INTVAL elements() {
return parrot_hash_size(INTERP, PARROT_DYNLEXPAD(SELF)->hash);
}

/*

/*

=item C<INTVAL exists_keyed(PMC *name)>

=item C<INTVAL exists_keyed_str(STRING *name)>
Expand Down

0 comments on commit aecd881

Please sign in to comment.