On Monday 31 March 2008 11:50:44 [EMAIL PROTECTED] wrote:
> Modified:
> trunk/src/pmc/resizablepmcarray.pmc
> trunk/t/pmc/resizablepmcarray.t
>
> Log:
> * Add shift, unshift, push, pop, and elems methods to ResizablePMCArray.
>
>
> Modified: trunk/src/pmc/resizablepmcarray.pmc
> ===========================================================================
>=== --- trunk/src/pmc/resizablepmcarray.pmc (original)
> +++ trunk/src/pmc/resizablepmcarray.pmc Mon Mar 31 11:50:43 2008
> @@ -724,6 +724,65 @@
> VTABLE_set_pmc_keyed_int(INTERP, SELF, i + offset,
> VTABLE_get_pmc_keyed_int(INTERP, value, i));
> }
> +
> +/*
> +
> +=item METHOD PMC* shift()
> +
> +=item METHOD PMC* pop()
> +
> +Method forms to remove and return a PMC from the beginning or
> +end of the array.
> +
> +=cut
> +
> +*/
> +
> + METHOD PMC* shift() {
> + PMC* value = VTABLE_shift_pmc(INTERP, SELF);
> + RETURN(PMC *value);
> + }
Coding standards nit: the pointer symbol goes on the variable name in the
declaration.
PMC *value = VTABLE_shift_pmc(INTERP, SELF);
That way it's more difficult to write the wrong thing as in:
PMC* some_pointer, not_a_pointer;
-- c