gmslAPI  0.1
gmslAPI: An API for Developing Upgrade Solutions using Great Migrations Technology
gmslLibrary.Services.Execute Class Reference

The class Execute executes the mainline translation operations performed by the tool. The individual methods correspond exactly with the gmPL commands of the same name, have string parameters whose names match the attribute names of the corresponding gmPL command, and literally execute the same implementation code in the tool. In addition to the matching parameters the ability of gmPL commands to process embedded refactoring and fix commands is also implemented in this class via the use of the text buffers. More...

Static Public Member Functions

static void Analyse (string project=null, string dialect=null, int commands=0)
 The method Analyse initiates the code analysis phase of the translation process. This phase takes as input the intermediate code produced by the compiler and outputs an intermediate code that can be authored in the target language. Once completed each active code unit has two intermediate code representations stored in the virtual binary information file. This method performs the same operations as are performed by the gmPL statement Analyse. More...
 
static void Author (string project=null, string name=null, int commands=0)
 The method Author takes as input the intermediate code produced by the analysis phase of the translation process. Using that code and the information contained in the symbol table it produces a fully functional code in the target language. This method performs the same operations as are performed by the gmPL statement Author. More...
 
static void Compile (string project=null, string echo=null, string resx=null, string level=null, string pageslice=null, int commands=0)
 The method Compile 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 code that describes the actual operations being performed. Both VB6 projects and ASP sites can be compiled. The project parameter compiles VB6 projects and the pageslice parameter compiles ASP pages. This method performs the same operations as are performed by the gmPL statement Compile. More...
 
static int gmPL (string command)
 The Execute_gmPL method executes a single gmPL statement or a block of gmPL statements. It has two overloads. With a single string "command" , it assumes that the string contains the gmPL statement to be executed. With an integer root offset "commands" and a string "endTag" it assumes that a series of gmPL statements in a text stream are to be executed that end with the indicated tag. More...
 
static int gmPL (int commands, string endTag="gmPL")
 
static void Load (string sourcecode=null, string project=null, string page=null, int commands=0)
 The method Load loads source compilation units so that they can be edited, analysed, or ordered by other utility operations in preparation for processing. This method performs the same operations as are performed by the gmPL statement Load. More...
 
static void Output (string filename=null, string status=null, string syntax=null, string stripTrail=null)
 The method Output specifies where information being output should be written and how it should be formatted. This method performs the same operations as are performed by the gmPL statement Output. More...
 
static int Reference (string id=null, string location=null, string registry=null)
 The method Reference explicitly loads a reference file into the current storage area. The typical reason for using this statement with VB6 project translations is that the project file does not explicitly list an external library whose members are in fact being referenced in the source code. In the case of ASP web translations, the external references are not explicitly defined; therefore, they must be supplied to the translation. More...
 
static int Refactor (string dllName=null, string evtName=null, string id=null, string errorStatus=null, string fileFilter=null, int commands=0)
 The method Refactor introduces a set of refactoring statements that are being entered at the main command level as opposed to being embedded within calls to the Compile method. More...
 
static void Registry (string source=null, string target=null, string type=null, int commands=0)
 The method Registry makes an entry in the registry, which stores named settings and options for a variety of special uses within the tool or within user specified runtime Dlls. It contains a simple hierarchical set of name-value pairs stored under a type identifier. The values are either simple strings or a text buffer. This method performs the same operations as are performed by the gmPL statement Registry. More...
 
static void LoadRuntime (string dllname=null, string dllevent=null, string filename=null)
 The method LoadRuntime loads a runtime Dll into the current execution space of the tool. This Dll may well be intermingled with Dlls loaded via the selected runtime environment and Dlls loaded via refactoring operations. There are a maximum of 64 Dlls that may be loaded. Each DLL exports certain methods, event handlers, that are then looked for by the execution logic of the tool when certain things happen or when certain points in the processing are reached. This method performs the same operations as are performed by the gmPL statement LoadRuntime. More...
 
static void Storage (string action=null, string identifier=null, string startup=null)
 The method Storage specifies the status of the virtual binary information file to be used. It should always be included if a translation is to be performed. This method performs the same operations as are performed by the gmPL statement Storage. More...
 

Detailed Description

The class Execute executes the mainline translation operations performed by the tool. The individual methods correspond exactly with the gmPL commands of the same name, have string parameters whose names match the attribute names of the corresponding gmPL command, and literally execute the same implementation code in the tool. In addition to the matching parameters the ability of gmPL commands to process embedded refactoring and fix commands is also implemented in this class via the use of the text buffers.

Member Function Documentation

◆ Analyse()

static void gmslLibrary.Services.Execute.Analyse ( string  project = null,
string  dialect = null,
int  commands = 0 
)
static

The method Analyse initiates the code analysis phase of the translation process. This phase takes as input the intermediate code produced by the compiler and outputs an intermediate code that can be authored in the target language. Once completed each active code unit has two intermediate code representations stored in the virtual binary information file. This method performs the same operations as are performed by the gmPL statement Analyse.

Parameters
projectThe optional parameter project specifies the name of a previously compiled VBP project or ASP page. It restricts the analyzer to effect the specified component only. The use of this parameter should be limited to complex migrations where the order in which code units are processed must be controlled.
dialectThe optional parameter dialect specifies one of the three target language identifiers csh, vbn, or usr. It changes the system wide target language as selected and thus effects all further processing.
commandsThe optional parameter commands is the root offset of an set of gmPL refactoring statement to be executed. Though this parameter is available, the Analyse method has no substatements at this time.

◆ Author()

static void gmslLibrary.Services.Execute.Author ( string  project = null,
string  name = null,
int  commands = 0 
)
static

The method Author takes as input the intermediate code produced by the analysis phase of the translation process. Using that code and the information contained in the symbol table it produces a fully functional code in the target language. This method performs the same operations as are performed by the gmPL statement Author.

Parameters
projectThe optional parameter project specifies the name of a previously compiled and analysed VBP project or ASP page. It restricts the author to that component only. If not specified, all active components are authored.
nameThe optional parameter name specifies the overall name to be used as the web project name for an ASP site translation. If not specified, the name "WebProject" is used. This parameter is ignored in VB6 translations.
commandsThe optional parameter commands is the root offset of an set of gmPL fix statements to be executed.

◆ Compile()

static void gmslLibrary.Services.Execute.Compile ( string  project = null,
string  echo = null,
string  resx = null,
string  level = null,
string  pageslice = null,
int  commands = 0 
)
static

The method Compile 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 code that describes the actual operations being performed. Both VB6 projects and ASP sites can be compiled. The project parameter compiles VB6 projects and the pageslice parameter compiles ASP pages. This method performs the same operations as are performed by the gmPL statement Compile.

Parameters
projectThe optional parameter project requests that the indicated project file, "vbp", along with all references it makes and any code files that it loads be compiled.
echoThe optional parameter echo has one of the values "Pass1", "Pass2", or "All". It is used to override the echoing of source code input as set in the Select class attributes for the current compilation only.
resxThe 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. The optional parameter resx specifies the name of this separate file. The compiler searches this file first for property values before it searches the project supplied resX files.
levelThe optional parameter level has one of the values "Project", "Load", "Pass1", "Pass2", and "All". This parameter requests that the compile phase end after completing the indicated step. The default is "All".
pagesliceThe optional parameter pageslice 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.
commandsThe optional parameter commands is the root offset of an set of gmPL refactor and/or fix statements to be executed.

◆ gmPL()

static int gmslLibrary.Services.Execute.gmPL ( string  command)
static

The Execute_gmPL method executes a single gmPL statement or a block of gmPL statements. It has two overloads. With a single string "command" , it assumes that the string contains the gmPL statement to be executed. With an integer root offset "commands" and a string "endTag" it assumes that a series of gmPL statements in a text stream are to be executed that end with the indicated tag.

Parameters
commandThe command parameter if used contains a single terminal gmPL command to be executed via the tool's mainline command processor.
commandsThe commands parameter if nonzero is the root offset of the text stream whose records are to be read in the current context. This parameter must be used in conjunction with the endTag parameter.
endTagThe endTag parameter is used to specify whether a single or block of statements is to be executed. If it is non-NULL than a block of statements is to be executed whose endtag value is specified by this parameter. Typical values here might be "gmBasic" or "gmPL". This method processes statements from the current Xml input stream until an end tag with this value is encountered.
Returns
If all goes well then this method returns a zero; else if returns a non zero value taken from the global field "ErrorCode_Value".

◆ Load()

static void gmslLibrary.Services.Execute.Load ( string  sourcecode = null,
string  project = null,
string  page = null,
int  commands = 0 
)
static

The method Load loads source compilation units so that they can be edited, analysed, or ordered by other utility operations in preparation for processing. This method performs the same operations as are performed by the gmPL statement Load.

Parameters
sourcecodeThe optional parameter sourcecode applies only to project loads. If "on", the individual source files in the project are loaded. This 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.
projectThe optional parameter project names a project file to be loaded in the same manner as the first step of the compiler. Loading the project file 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 Exename32 entries whose values are then stored in the symbol table.
pageThe optional parameter page names a file in an ASP site to be loaded into a text buffer in raw form. This is not a PageSlice load as is performed by the compiler.
commandsThe optional parameter commands is the root offset of a set of gmPL fix statements to be executed.

◆ LoadRuntime()

static void gmslLibrary.Services.Execute.LoadRuntime ( string  dllname = null,
string  dllevent = null,
string  filename = null 
)
static

The method LoadRuntime loads a runtime Dll into the current execution space of the tool. This Dll may well be intermingled with Dlls loaded via the selected runtime environment and Dlls loaded via refactoring operations. There are a maximum of 64 Dlls that may be loaded. Each DLL exports certain methods, event handlers, that are then looked for by the execution logic of the tool when certain things happen or when certain points in the processing are reached. This method performs the same operations as are performed by the gmPL statement LoadRuntime.

Parameters
dllnameThe optional parameter dllname specifies a simple local file name of the runtime Dll to be loaded. It is looked for using the standard search order. That order is target location, local location, system location, and language location.
eventIf the DLL being loaded implements a CodeEvent event handler then the optional parameter event specifies the identifier of this event. This event is triggered by references in the code to subcomponents that have a migUserCode value attributed to them.
filenameThe optional parameter filename specifies the full pathname of the runtime Dll to be loaded. It is used only if the dllname parameter is not specified.

◆ Output()

static void gmslLibrary.Services.Execute.Output ( string  filename = null,
string  status = null,
string  syntax = null,
string  stripTrail = null 
)
static

The method Output specifies where information being output should be written and how it should be formatted. This method performs the same operations as are performed by the gmPL statement Output.

Parameters
filenameThe optional parameter filename contains the full pathname of the text file that is to receive the output to be produced. If this attribute is not specified, then the standard output file is used.
statusThe optional parameter status specifies the status of the file – "New" means create a new file, "Old" means open an existing file and append the coming output at its end, and "Close" means simply close the current file. If not specified, then "New" is assumed.
syntaxBesides authoring record-oriented translations, the tool can also be used to write tabular reports. via the DataTable class, based on the information collected while it was processing the source codes. The optional parameter syntax specifies the output style to be used when producing these tabular reports. They can be produced in one of three styles: "Tabbed" simple tab delimited; "Text" text tabular; or "Html" html tabular. If not specified, then the style is "Text".
striptrailThe optional parameter striptrail if "On", requests that any trailing blanks be stripped from output records. This attribute is rarely needed.

◆ Refactor()

static int gmslLibrary.Services.Execute.Refactor ( string  dllName = null,
string  evtName = null,
string  id = null,
string  errorStatus = null,
string  fileFilter = null,
int  commands = 0 
)
static

The method Refactor introduces a set of refactoring statements that are being entered at the main command level as opposed to being embedded within calls to the Compile method.

Parameters
dllNameThis paramter specifies the name of a dll file that should be loaded when the refactor statement is processed and should remain loaded for the remainder of the current execution.
evtNameThis parameter is used to trigger a set of generic user migration code events within the analyser. These events are triggered first during the initialization phase and second during the code review phase for each code block in the current scope of the analyzer by references in the code to subcomponents that have a "UserCode" property set true. The start of the string stored in the comment field of the component must match this parameter value to trigger the code events in the dll file
idThis parameter is the hostid. It is the identifier of the library or project being refactored. Libraries are identified via their local filename enclosed in square brackets like "[mso.dll]" or "[msword9.olb]". In this context fully qualified names, whose identifiers are separated by periods can also be used. The brackets are used to avoid confusion.
errorStatus This parameter controls the consequences of an error. If it is "Ignore", then no message is displayed and the tool simply continues. If it is "Warning", then a message is displayed and the tool continues. If it is "Error" then a message is displayed, and an abnormal exit to the operating system is taken. The default setting for this parameter is "Error".
fileFilterThis parameter is the fully qualified identifier of the user code file whose components are being refactored. It specifies the filefilter for the following refactoring statements.
commandsThis parameter is the root offset of the actual text buffer that contains the refactoring comands themselves.
Returns
If there is a problem with the refactoring a one is returned. If all goes well, a zero is returned.

◆ Reference()

static int gmslLibrary.Services.Execute.Reference ( string  id = null,
string  location = null,
string  registry = null 
)
static

The method Reference explicitly loads a reference file into the current storage area. The typical reason for using this statement with VB6 project translations is that the project file does not explicitly list an external library whose members are in fact being referenced in the source code. In the case of ASP web translations, the external references are not explicitly defined; therefore, they must be supplied to the translation.

Parameters
idThis parameter simply identifies the external library to be loaded via its local filename like "mso.dll" or "msword9.olb". The reference is then loaded using the same conventions as those used when loading an external referenced within a VBP project file.
locationThis parameter specifies the full pathname of an external library as opposed to its simple local name. The file is loaded directly without going through the normal search logic and without first ensuring that it has not yet already been loaded. This parametere should only be used in special utility contexts. Note that when using this the Id parameter, which is used internally to identify the external must be specified as well.
registryThis parameter, when specified as "Off", requests that the normal Libname registry search not be performed. The default is "on".
Returns
If there is a problem loading the reference a one is returned. If all goes well, a zero is returned.

◆ Registry()

static void gmslLibrary.Services.Execute.Registry ( string  source = null,
string  target = null,
string  type = null,
int  commands = 0 
)
static

The method Registry makes an entry in the registry, which stores named settings and options for a variety of special uses within the tool or within user specified runtime Dlls. It contains a simple hierarchical set of name-value pairs stored under a type identifier. The values are either simple strings or a text buffer. This method performs the same operations as are performed by the gmPL statement Registry.

Parameters
sourceThe parameter source contains the source name of the pair to which a target value is to be assigned. It may have any content. If a given pair is intended to be unique within a given type, then its name must be unique within that type only.
targetThe optional parameter target is used only when the commands parameter is not specified. It contains the target value of the pair. It may have any content and need not be unique. At any given time a given source with a given type can have only one target. If not specified, then the name value pair is treated as though it no longer exists within its location.
typeThe optional parameter type contains the identifier of the "special use" of the name-value pair being entered. If not specified, then the value "LibName" is supplied.
commandsThe optional parameter commands is the root offset of an set of a text buffer to be the value of the name-value pair.

◆ Storage()

static void gmslLibrary.Services.Execute.Storage ( string  action = null,
string  identifier = null,
string  startup = null 
)
static

The method Storage specifies the status of the virtual binary information file to be used. It should always be included if a translation is to be performed. This method performs the same operations as are performed by the gmPL statement Storage.

Parameters
actionThe parameter action specifies the storage action to be performed. It can have one of five options – "CREATE", "OPEN", "APPEND", "CLOSE", and "SAVE".
identifierThe optional parameter identifier is the full pathname of the file containing or to contain the information being stored. Optionally, the filename extension may be omitted. In which case the extension "vbi" is used. If this parameter is not specified, then a memory-based storage area is used. Memory-based storage can be quicker to use, but any information stored is lost when the run ends.
startupThe optional parameter startup is the full pathname of a file whose content should be used to initialize the current storage area when it is created. Optionally, the filename extension may be omitted. In this case, "vbi" is used. This parameter is only valid when a file-based storage area is being created. The content of the startup file itself is not changed.

The documentation for this class was generated from the following file: