Loading ...
Sorry, an error occurred while loading the content.

91ParseXS: What Got Refactored

Expand Messages
  • James E Keenan
    May 11, 2010
    • 0 Attachment
      Rafael Garcia-Suarez requested a summary of the changes represented
      by the previously posted diff. Here's a quick attempt at such a
      summary. Please see my posts to the parsexs group on yahoo (late
      March and April of this year) for more detailed discussion.

      Moved main documentation to lib/ExtUtils/ParseXS.pod

      ExtUtils::ParseXS::Constants:
      Initialization of certain non-subroutine variables in
      ExtUtils::ParseXS and some of its supporting packages was moved into
      this package so that those values can be defined exactly once and
      then re-used in any package (e.g., tests).
      @InitFileCode
      $FH
      $proto_re
      $Overload
      $errors
      $Fallback
      @keywords

      ExtUtils::ParseXS::CountLines:
      This package had been defined in the same file as ExtUtils::ParseXS.
      Moved to separate file to make its contents more easily testable.

      ExtUtils::ParseXS::Utilities:
      This is a grab-bag and its name should be treated as provisional.
      Nonetheless, the contents are important. Essentially: Anything that
      I could transform into a fully encapsulated subroutine was so
      transformed and placed into this package. The subroutines thereby
      became testable by new files in the test suite. Some of these
      subroutines exist in CPAN lib/ExtUtils/ParseXS.pm; others are the
      results of my refactoring.
      sub standard_typemap_locations
      sub trim_whitespace
      sub tidy_type
      sub C_string
      sub valid_proto_string
      sub process_typemaps
      sub process_single_typemap
      sub make_targetable
      sub map_type
      sub standard_XS_defs
      sub assign_func_args
      sub analyze_preprocessor_statements
      sub set_cond
      sub Warn
      sub blurt
      sub death
      sub check_conditional_preprocessor_statements

      Test suite: Renumbered existing tests to begin with 3 0-padded
      digits. New test files I wrote start at t/101.

      lib/ExtUtils/MM_Unix.pm: This should not be considered part of the
      ParseXS distro per se, but it was needed to get the test harness to
      work.

      Renaming and rescoping of variables:
      Major effort went in to identifying the scope of all variables.
      There were several instances of different variables having same name,
      distinguished only by scope. Tried to rename appropariately. Most
      globals were rescoped as 'our'. Some could be rescoped as 'my'.

      Lots of code-tidying, e.g., elimination of hard tabs; uncuddling of
      elsifs and elses; more consistent indentation; changed most
      subroutine names to be all lower-case rather than CamelCase.