ModuleCMethods

Type: Module Parent Module: N/A

This module processes all methods in the library. For each method submodules are called to correct certain pieces of code. Submodules are object classes whose names begin with 'Submodule' followed by the name of this class, followed by the name of the submodule (e.g. Submodule_Methods_ObsoleteCommands, this class name = Methods, submodule name = ObsoleteCommands). When the submodules are first instantiated each returns information about which character strings it is interested in processing. When a method line is encountered which contains one of these search strings, then the $processLine method of the corresponding submodule is called to perform processing on it.

Note that the reason for splitting this module into submodules is for run-time efficiency. This module processes each method in the library only once, whilst the submodules retain the ability to organize different processing of the method code into plug-ins which can easily be disabled and modified.

Functionality

Instantiate all submodules belonging to this module and build a list of submodule instances containing 3 columns:

  1. A reference to each submodule instance.
  2. The name of each submodule (the part that follows "Submodule_").
  3. A list iLstSearchText of character strings which each submodule will process.

When a submodule is instantiated its $construct method must return a list iLstSearchText using a field reference parameter containing 2 columns:

  1. A text string to be searched for in methods that, if located in a method line, is to be processed by the submodule.
  2. The name of a public method in the submodule which will process the method line.

The list of instantiated submodules is sorted by submodule name to enable ordering of execution of submodules (e.g. Submodule_MethodsANotation, Submodule_Methods_CommentLn, Submodule_Methods_ObsoleteC)

For each method in the library:

  1. The list of search strings returned by the submodules' $construct methods is compared with the method text to determine if the method contains the search string.
  2. If a match is found, then the $processLine method in the submodule instance is called to process each method line that contains the search string.
  3. If the $processLine method returns a message then it is added to the log.

After processing each method:

  1. Call the $endMethod of each submodule instance in turn, passing a reference to the method to enable the submodule to carry out any required final postprocessing.
  2. If the method was modified by any submodule, then replace the method code with the new method lines.

The Default $processLine Method

The default $processLine method defined in the superclass oModuleSuper calls the public method for the text string located in a method line that was specified in the list returned by the submodule's $construct method.

See the $processLine method in the documentation for oModuleSuper for a detailed description of the method and its parameters.

Building Submodules

  1. Names of submodules must be prefixed with Submodule_Methods.
  2. The character following this prefix may be used to order execution of submodules (e.g. Submodule_MethodsAexecutedFirst, Submodule_MethodsBexecutedSecond, etc.).