GSoC/GCI Archive
Google Code-in 2011 Parrot Foundation

Cleanup src/extend.c

completed by: Peter Poláčik

mentors: Andrew Whitworth

Task Description

The file src/extend.c contains a collection of older functions and is in need of cleaning. See Parrot Ticket #2133 for more information. Do the following:

  • Parrot_*printf and clones: If possible, remove these functions and replace usages with equivalents in src/misc.c. If there are no equivalents, move the function from src/extend.c to src/misc.c. We do not want any printf-related functions in src/extend.c. If you move functions, please refactor them as much as possible to reuse existing code.
  • Parrot_get_root_namespace should be moved to src/namespace.c, if there isn't already another function there that does the same thing. If there is a duplicate function, delete Parrot_get_root_namespace. Otherwise, move it to src/namespace.c and rename it to Parrot_ns_get_root_namespace
  • Parrot_PMC_new should be deleted. All calls should be diverted to Parrot_pmc_new (src/pmc.c)
  • Parrot_PMC_null should be renamed Parrot_pmc_null and moved to src/pmc.c
  • All functions for setting/accessing registers directly are really bad and need to be deleted without being replaced. Any code that uses these functions (I do not think they are used, but I might be wrong) needs to be fixed.
  • Parrot_new_string should be deleted and all calls should be redirected to Parrot_str_new or Parrot_str_new_init (src/string/api.c) instead.
  • Parrot_register_pmc and Parrot_unregister_pmc shoudl both be deleted. All calls should be redirected to Parrot_pmc_gc_register and Parrot_pmc_gc_unregister (src/pmc.c) respectively. Same thing with Parrot_register_string and Parrot_unregister_string (Parrot_str_gc_register and Parrot_str_gc_unregister in src/string/api.c)
  • Other functions not mentioned above are fine and do not need to be modified in any way.

Steps To Complete This Task

      1. Create a fork of parrot.git on github.com
      2. Make all changes described above
      3. Run "make headerizer" to update include files.
      4. Build Parrot and run all tests (make test). Verify that nothing is broken.
      5. Create a Github pull request (button on the upper right of your fork) to have your changes incorporated into the master repository

Requirements

      1. C Programming Language
      2. Optional: sed, grep, ack, perl, or any other tool with regular expressions and searching to help make this job easier

Additional Links