Skip to content

gmplCommandStatements

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:

StatementDescription of use
AnalyseControls 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.
AuthorControls the actual authoring of the analysed intermediate code in the target language.
CompileCompiles 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.
FindDynamicsAnalyses a the collection of VBI files in a directory and authors an interface description file for a set of interfaces that satisfy the late bound object.member references in those VBI files. The IDF may be used to generated more precise translations and also generate a classes that expose the required interfaces.
FixSupports making changes to the source code before it is compiled or target code before
it is written.
IfSpecifies certain conditions for the inclusion or exclusion of the substatements
within its scope.
IncludeSpecifies the name of an external gmPL file whose statements are to be processed
before processing the next statement in the including script.
LoadEnvironmentForces the loading of the environment that must be defined before any code can be processed.
LoadRuntimeLoads a gmNI runtime Dll into the current execution space. This Dll may well be
intermingled with Dlls loaded via refactoring and select statements.
OutputSpecifies where information being written should be sent and how it should be formatted.
ReferenceAlters the references information associated with a compilation unit.
RegistryEnters 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.
RunCommandExecutes 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.
SelectSpecifies a wide range of attributes which control the behavior of gmBasic and
which supply values for the properties of the gmSL Select class.
StorageSpecifies how information gathered by the current script is to be stored in a virtual
binary information file.