gmplGmslStatement

Gmsl Statement Summary

Gmsl is a nonterminal, utility statement that occurs in command scripts and within Refactor statements. The statement introduces Great Migrations Scripting Language gmSL subprograms that can then be executed. The conventions of gmSL itself are described elsewhere.


The attributes of the gmSL statement are as follows:


Attribute Description
NameSpaceThe required identifier of the namespace of the class. There is one reserved namespace gmSL that contains code called by gmBasic itself. The other namespace convention relates to library refactoring files. Here the value of the event attribute of the refactor command is the required namespace.  A gmSL Namespace may not contain the underscore character.  The namespace must be unique in the population of namespaces in the model, so a best practice is to namespace it as <Name><Purpose> where <Name> is some other unique namespace in the model and <Purpose> is the reason for creating the new gmSL namespace.  For example a namespace containing routines for refactoring the MSGrid API could be named something like MSGridRefactor.  
ClassThe identifier of the class within the namespace that the code belongs to.
SourceThe name of the file that contains the source code to be compiled. If this attribute is omitted then the source is assumed to be contained within the script itself. The extension for this source file should be gmsl. These gmsl source files contain only gmSL source code and no gmPL statements or XML-style syntax. It is strongly recommended that any nontrivial gmSL code be placed in an external gmsl file.

The gmSL statement has no substatements as such. When the Source attribute is omitted, the gmSL source itself is contained within the statement bounded by the Xml CDATA notation. This might look as follows.


  <gmSL namespace="gmSL" class="TextCode" ><![CDATA[
     Sub AddUserCompiles
      ...
     End Sub
 
There is also a command version of the gmSL statement which contains no attributes at all. The code contained within the starting and ending tag is executed immediately. The following gmPL script shows how a gmSL commands be used to debug a malfunctioning script.


 <gmBasic>
    <Storage Action="Create" />
    <gmsl>
       Write.LogSetName("Demo018.log")
       Write.LogMessage("<!-- translation options -->")
    </gmsl>
    <Select progress="1" />
    <Select DevEnv="VS2010" />
    <Select Dialect="csh" />
    <Select BuildFile="global" />
 <gmsl>Write.LogMessage("<!-- directories for deployment and external assemblies -->")</gmsl>
    <Select DeployLocation="c:\gmProj\lab\deploy\externs\CrashV1003_csh" />
    <Select Library="c:\gmProj\lab\deploy\externs" />
    <select Target="c:\gmProj\lab\idf\FromCode" />
    <Select Local="c:\gmProj\lab\idf\FromCode" />
    <Select System="c:\gmProj\lab\idf\FromIdl" />
 <gmsl>Write.LogMessage("<!-- processing commands -->")</gmsl>
    <Compile Project="c:\gmSrc\GMTest\CrashV1003\CrashV1003.vbp" />
    <gmsl>Write.LogSetName(Null)</gmsl>
    <Analyse />
 <gmsl>Write.LogMessage("<!-- authoring commands -->")</gmsl>
    <Output Status="New" Filename="Demo018.bnd" />
    <Author />
    <Storage Action="Close" />
 <gmsl>Write.LogMessage("<!-- End of script -->")</gmsl>
 </gmBasic>
Note that single gmSL statements can be entered on a single line, but one or more statements may be grouped together using a block format.


The script errors associated with the gmSL statement are as follows:


Error Description
1159The gmSL attributes namespace and class are both required.
1160Unable to open gmSL source file: %1d
1161Unable to add project [%1d] to data storage area.
1162Unable to add code [%1d] to data storage area.
1163Encountered EOF while reading gmSL code from script.

In more detail, the gmSL statement directs gmBasic to compile a gmSL class and to store its code and symbol information so that it can be compiled and can be executed by the standard execution engine. The gmSL compiler processes a simple contemporary syntax much like that used by Java or C#. The details of the gmSL language are described elsewhere.
Table of Contents