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

Add wchar_t variants for Parrot embedding API string interface

completed by: Matt Rajca

mentors: whiteknight

Task Description: Parrot is developing a new embedding API to all it to be embedded into other programs. This new API is under development and is currently incomplete. Parrot supports strings in several formats, but currently the online input format accepted is normal null-terminated C ASCII strings. We would like to support Unicode strings using the wchar_t type too.

In the src/embed/strings.c file there are several functions which are specific to ASCII: Parrot_api_string_import_ascii, Parrot_api_string_export_ascii, and Parrot_api_string_free_exported_ascii. We would like to have variants of these for wchar_t strings as well so Parrot can be used easily in UNICODE-enabled applications

Steps to Complete:

  1. Create a fork of parrot/parrot on github.
  2. check out the embed_api2 branch
  3. Add the include <wchar.h> to include/parrot/api.h
  4. Add the new functions Parrot_api_string_import_wchar, Parrot_api_string_export_wchar, and Parrot_api_string_free_exported_wchar. You should be able to copy much of the logic from the ascii functions.
  5. Add tests for your new functions to t/src/embed/strings.t
  6. Open a pull request on github to have your changes merged in

Links: parrot, https://github.com/parrot/parrot/tree/embed_api2