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

Move code-running functions out of src/packfile/api.c

completed by: Kristaba

mentors: whiteknight

Task Description: In Parrot source code files are arranged in a very specific way. Individual subsystems have their own directory in src/. Inside the subsystem directory, there should be a file api.c which contains the external API for the subsystem.  Functions in api.c should be public and decorated with PARROT_EXPORT, unless the function is exposed as a pointer in a struct.  Other files in the folder should contain the internal (and private) machinery that makes the subsystem work. If the subsystem needs a private header file, it should be called <subsystem_name>_private.h

Separate out some functions relating to executing functions from a PackFile out of src/packfile/api.c into a new file src/packfile/execute.c. These functions include:

  • run_sub()
  • do_1_sub_pragma()
  • do_sub_pragmas()
  • sub_pragma()

Steps to Complete:

  1. Create a fork of parrot/parrot on Github
  2. Create a new file src/packfile/packfile_private.h. This is a private header file for the subsystem. Include the necessary tags for headerizer.
  3. Create a new file src/packfile/execute.c. Include the necessary POD documentation header and file footer information. Include headerizer tags for static functions and for public functions to be headerizered in src/packfile/packfile_private.h
  4. Move the listed functions into the new file
  5. #include "packfile_private.h" in src/packfile/api.c
  6. Replace all public (outside the src/packfile/ directory) uses of the function do_sub_pragmas with the function PackFile_fixup_subs
  7. Run headerizer, and verify that the new function prototypes are located in the proper locations.
  8. Build parrot and run all tests
  9. Open a pull request on github