Proposal: String iterator rewrite

Nick Wellnhofer wellnhofer at aevum.de
Tue Feb 16 23:01:31 UTC 2010


Here is another version of my attempt to rewrite the string iterator 
API. It does the following:

1. Remove the members str, get_and_advance, set_and_advance and 
set_position from struct string_iterator_t, keeping only bytepos and 
charpos.

2. Switch the internal string iterator API to the following new macros:

STRING_ITER_INIT(i, iter)
STRING_ITER_GET(i, str, iter, offset)
STRING_ITER_SKIP(i, str, iter, skip)
STRING_ITER_GET_AND_ADVANCE(i, str, iter)
STRING_ITER_SET_AND_ADVANCE(i, str, iter, c)
STRING_ITER_SET_POSITION(i, str, iter, pos)

3. Change the string iterator PMC to actually use string iterators.

4. Rewrite Parrot_str_split to use string iterators.

The patch is split in two parts. The first part makes the changes 
described above but keeps the old API. The second part removes the old API.

Nick
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: string-iter-v4.diff
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20100217/06d6fbd9/attachment-0002.diff>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: string-iter-remove-old-api-v4.diff
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20100217/06d6fbd9/attachment-0003.diff>


More information about the parrot-dev mailing list