gmplLoadEnviromentStatement

LoadEnviroment Statement Summary

LoadEnviroment is a terminal, command statement that can occur only in command scripts. Before any code can be processed the environment within which that compilation is to occur must be established. For a given command script the loading of this information occurs only once. The compiler checks if this load has occurred before it executes a Compile or Reference statement. This statement can force the load to occur immediately in case it is needed for some special context.

The LoadEnviroment statement has no attributes.

The environment is described via four optional files: an Environment file, a TypeInference file, a Language file, and a GlobalSettings file. In addition, the environment can include dynamic link libraries that use the gmNI services to perform special processing operations as any number of translation process events occur.

The Environment file is a reference script. It is normally created once by the user and contains settings that should always be used for a given code base. It is called Environment.%id%.xml and typically contains Select and Registry commands. It may be placed in any one of the search locations, but is normally placed in the target location.

The TypeInferences file is reference script. It is normally authored by gmBasic to report the type inferences that it has made while processing a code base. The purpose in creating this file is to give subsequent compilations knowledge about the ultimate types of the symbols that are weakly typed in the source code. This knowledge can then improve the quality of the translations. It is called TypeInference.%id%.xml and as authored by gmBasic contains only FixType Registry statements. It may be placed in any one of the search locations, but as authored it is sent to the Local location.

The Language file is a reference script whose class descriptions are intended to override the class descriptions in the language file itself. It is called Language.%id%.xml. Other than the criteria for when it is loaded, this file behaves exactly like any other reference script. It may be augmented by a file Mig.language.%id%.xml and may contain refactoring statements and may trigger events. Since many traditional COM component libraries contain classes whose names match the traditional VB6 controls like Label, TextBox, etc., one additional adornment is needed for classes intended to override an internal VB6 class, migStatus="OverrideUser". Thus, an entry


 <class id="DriveListBox" parent="None" default="Drive" migStatus="OverrideUser" >
overrides the definition of the internal DriveListBox control in the language file; while, the entry


 <class id="TextBox" parent="None">
as taken from the Excel.exe.xml reference script does not override the internal TextBox control in the language file.

The GlobalSettings file is a pre compiled virtual binary information file built using a command script. It may contain any kind of information, though present applications only use Reference, Registry, and gmSL statements within the scripts that create GlobalSettings files. The full pathname is specified via a GlobalSettings="filename" Select attribute. Many entries in the GlobalSettings file are authored either by gmBasic or by the user via gmNI event handlers. It is discussed further under the description of the Registry statement.

Finally, any default runtime dynamic link libraries are loaded. These are specified via two specifications. The Select.RuntimeDlls attribute contains a semicolon delimited list of libraries to be loaded. These are loaded first. Then the RuntimeDlls enumeration in the language files contains a list of libraries that are to be loaded automatically by default.

Table of Contents