GSoC/GCI Archive
Google Code-in 2010 Parrot Foundation and The Perl Foundation

Write new API functions to perform string-keyed lookup and set

completed by: Matt Rajca

mentors: whiteknight

Task Description: Parrot is developing a new embedding API in the embed_api2 branch. This work is going well and we expect to merge it soon. The API contains enough functions to make basic embedding applications work, but it does not really do enough for the needs of our embedders.

In Parrot, we can index into an aggregate (array, etc) using a variety of methods. We can use an integer (like an array), a string (like a hash/dictionary) or another PMC.

Create two new API functions to do lookup and set using a string key. The new functions would be named Parrot_api_pmc_get_keyed_string, and Parrot_api_set_keyed_string. These functions would take a PMC and a Parrot_String key, and return the PMC contained at that location.

Steps to Compete:

  1. Create a fork of parrot/parrot on Github
  2. checkout the embed_api2 branch
  3. Add new functions Parrot_api_get_keyed_string and Parrot_api_set_keyed_string in src/embed/pmc.c. Feel free to copy from existing examples. Also, ask for help if you are having problems understanding the format of the API.
  4. Write tests for your new functions in t/src/embed/pmc.t. Create that file if necessary. Feel free to copy from existing examples in that directory or elsewhere
  5. Build Parrot and run all tests to verify behavior
  6. Open a pull request on Github to have your changes merged.

Links: https://github.com/parrot/parrot/blob/embed_api2/src/embed/pmc.c,