gmplCommandStatements

gmBasic Command Statements

The details of the processing performed by gmBasic are controlled via XML-based command line scripts. The command statements are the primary instructions used to produce translations as opposed to making and modifying declarations or performing auxiliary tasks. The statement keyword for each command line script is usually gmBasic; however, it may be anything. Each of the command statements is a substatement of the gmBasic statement; however, several may be used in other contexts as well. A simple script doing a translation might look as follows


<gmBasic>
   <Storage Action="Create" Identifier="Demo000" />
   <Select Local="C:\gmProj\FmStocks\IDF\FromCode" />
   <Select System="C:\gmProj\FmStocks\IDF\FromIDL" />
   <Select Target="C:\gmProj\FmStocks\IDF\FromIDL" />
   <Compile Project="C:\gmSrc\fmstocks\vb6\FMStocks_DB\FMStocks_DB.vbp" />
   <Analyse />
   <Output Status="New" Filename="Demo000.out" />
   <Author />
   <Storage Action="Close" />
</gmBasic>
The details of what these commands do are discussed within this presentation. In essence a persistent storage area is created; the locations of the reference files to be used are specified; a source code is compiled and analysed; and finally authored in the target language to a specified output file.

The gmBasic statement itself has one optional attribute LanguageFile. All processing performed by gmBasic is ultimately controlled via specifications in a compiled language file. A standard version of this file is distributed with the tool. Once migrations of particular code bases proceed, however, they often require/desire special language specifications. These specifications can be entered using gmPL statements and a modified language file can be created. The LanguageFile attribute specifies the full pathname of this modified file.

The command statements entered within the command file itself are as follows:

Statement Description of use
Analyse Controls the code analysis of a compiled code. Analysis is performed to change the intermediate code produced by the compiler into a form that can be authored in the target language.
Author Controls the actual authoring of the analysed intermediate code in the target language.
Compile Compiles a BASIC project or an ASP pageslice into an intermediate code unit. It also loads all information about externally referenced libraries and builds a table of all symbols encountered in either the source code or the external libraries.
Fix Supports making changes to the source code before it is compiled or target code before it is written.
If Specifies certain conditions for the inclusion or exclusion of the substatements within its scope.
Include Specifies the name of an external gmPL file whose statements are to be processed before processing the next statement in the including script.
LoadEnvironment Forces the loading of the environment that must be defined before any code can be processed.
LoadRuntime Loads a gmNI runtime Dll into the current execution space. This Dll may well be intermingled with Dlls loaded via refactoring and select statements.
Output Specifies where information being written should be sent and how it should be formatted.
Reference Alters the references information associated with a compilation unit.
Registry Enters various identifier pairs into storage for a variety of purposes. Registry statements are a primary vehicle used by gmBasic to communicate with itself during the translation tuning phase.
RunCommand Executes a method written using gmSL. This method may be predefined via the metalanguage. It may also be in a separate GlobalSettings file or it may be locally defined within the current script.
Select Specifies a wide range of attributes which control the behavior of gmBasic and which supply values for the properties of the gmSL Select class.
Storage Specifies how information gathered by the current script is to be stored in a virtual binary information file.


Table of Contents