- Created by Mark Juras , last modified on Apr 22, 2013
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 2 Next »
Compile Statement Summary
Compile is a nonterminal, command statement that occurs only in command scripts. It compiles a specified source code project or ASP file. Within the translation process, the first significant step beyond simply loading a source code is converting that source code into an intermediate representation that can be analysed, refactored, and authored. The intermediate representation itself contains two subcomponents -- a symbol table that describes the components being manipulated and intermediate gmILcode that describes the actual operations being performed.Both VB6 projects and ASP sites can be compiled. The Project attribute compiles VB6 projects and the PageSliceattribute compiles ASP pages.
The attributes of the Compilestatement are as follows:
Attribute | Description |
Echo | This attribute has one of the values Pass1, Pass2, or All. It is used to override the echoing of source code input as specified via the Select statement for the current compilation only. |
Include | This deprecated attribute requests that a single include file within an ASP site be compiled. |
Level | This attribute has one of the values Project, Load, Pass1, Pass2, and All. This attribute requests that the compile phase end after completing the indicated step. The default is All. The other values are only used for debugging purposes. |
Page | This deprecated attribute requests that a single page file within an ASP site be compiled without loading any includes that it might reference. |
PageSlice | This attribute requests that the specified page file within an ASP site be compiled, treating it in the same manner as it would be treated by the server when it gets a request for a page. It builds a source representation starting with any ASA file and its includes and then loads the page inserting any other includes as it sees them. The result of this step is a single source representation that can be compiled. |
Project | This attribute requests that the indicated project file, vbp, along with all references it makes and any code files that it loads be compiled. |
ResX | The gmStudio has the capability needed to author into a separate file the resX information for controls that do not use the standard resX conventions to store their property values. This attribute specifies the name of this separate file. The compiler searches this file first for property values before it searches the project supplied resX files. At present this feature is used only to use ImageStream Resx data generated from MSComCtl.ImageLists that are being replaced by WinForms.ImageList. |
Script | This deprecated attribute requests that a single script file within an ASP site be compiled. |
The substatements of the Compilestatement are as follows:
Substatement | Description |
Exename | This substatement changes the Exename32 associated with the project, |
Fix | Using the Fix command statement as a substatement of the compile restricts the range of application of the fixes to code files within the project or pageslice. |
Refactor | Using the Refactor refactoring statement as a substatement of the compile restricts the range of application of any refactoring to the symbols defined within the project or pageslice. |
Reference | Using the Reference command statement as a substatement of the compile restricts references to its components to the current project or pageslice. |
Select | Using the Select command statement as a substatement of the compile is no different that using it outside of the compile. It is included as a substatement for convenience only. |
The script errors associated with the Compilestatement are as follows:
Error | Description |
1109 | Encountered illegal COMPILE directive %1d |
1110 | Encountered illegal COMPILE directive %1d |
1157 | Unable to open project file [%1d] |
1158 | Unable to add project [%1d] to data storage area. |
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. In addition, the script can force the load to occur using LoadEnvironmentstatement. See the description of that statement for a details.
The compilation of VB6 project files consists of 4 distinct steps: first, the project file itself is loaded; second, all class, module, and form/usercontrol files are loaded; third, the individual source files are parsed and the symbols defined are organized into a symbol table; and fourth, the statements within the individual source files are converted into an intermediate representation.
Loading the project files begins by first storing the name of the project file in the symbol table and making certain that it is unique. Second, the project file itself is loaded into an edit buffer. Third, the GlobalSettings file is checked to see if any edit fixes are to be applied to the project file. Fourth, the file is searched for the its Name and Exename32entries whose values are then stored in the symbol table.
Loading the individual source files involves searching the project file for Form, UserDocument, UserControl, Module, and Class entries whose values are the source code filenames to be loaded. Each file is then loaded into an edit buffer and its name is stored in the symbol table. For each file the GlobalSettings file is checked to see if any edit fixes are to be applied to it. In addition, the EditAspSource event is triggered, which could make additional changes to the file. Once all files have been loaded and individually edited, the subcommands associated with the statement are executed, up to any Refactorstatements.
The initial parsing of the source files to organize the symbols defined into the symbol table is referred to as Pass1of the compiler. If source code errors are encountered during this pass, then further processing within the compiler is blocked. If there were no problems, the final step is to tabulate all of the global symbols found so that they can be quickly identified by the next pass of the compiler.
The converting of the actual statements in the source files into intermediate gmIL code is referred to as Pass2 of the compiler. The first step is to process any Refactor substatements that remain. The quality of translations can often be greatly improved if symbols are strongly typed before the compiler processes the statements that reference them. Next if any Resource files are specified via the ResX attribute, they are loaded. Finally, the actual compilation into intermediate code is performed. There may well be syntax errors and warnings generated by this compilation; however, unlike pass1 errors these do not block further processing. Error causing source code statements are simply entered into the target translations as though they had been commented out in the source.
Exename Compile Substatement Summary
Exename is a terminal substatement of the Compile statement. It changes the value of the Exename32 attribute in the project file before the first compiler pass has begun. If used, this substatement must precede any Refactor subcommands within the same specification. Note that an existing Exename32is replaced by the new name; therefore, if there is no existing name, this substatement does nothing.The attributes of the Exenamesubstatement are as follows:
Attribute | Description |
id | This attribute specifies the new Exename32 to be assigned to the project. |
Table of Contents
- No labels