Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • gmPL Scripts using an XML-like notation to implement declarative specifications that direct and inform the translation engine's operation

  • gmSL Scripts using a C-like notation to implement classes, methods, and event handlers that can extend the services of the translation engine's operation

Many gmPL and gmSL files are included in the standard gmStudio distribution and also available for download from this documentation portal. Furthermore, gmPL and gmSL provide a great deal of expressive power and precision. For example, we built several advanced COM API migrations, and a VB6 Forms to WPF/XAML extension using gmSL. Many gmPL and gmSL files are included in the standard gmStudio distribution and others are available for download from this documentation portal. But, they have their limitations. For example, gmSL lacked a contemporary development support (i.e. no intellisense and no debugger).

In early 2018, during the course of planning a big VB6-to-WPF project, the customer asked if they could use a C# API instead of the scripting language gmSL language for their WPF migration and gmAPI was born. gmAPI is as a powerful alternative to gmSL. gmAPI can access the same even more system services as than gmSL, but gmAPI logic is developed in C# (or http://VB.NET of VBNET) so has it enjoys all of the benefits of being part of the .NET ecosystem (such as using a contempora4ry contemporary IDE, pre-compilationbeing a fully compiled language, interactive debugging, .NET framework services and tools, etc.)

The introduction of gmPL Extensions makes integrating gmAPI logic with the translation engine more robust and seamless. gmPL Extensions define the conventions for defining new gmPL language elements and integrating gmAPI assemblies with the core translation engine. gmPL Extensions extend the set of gmPL statements that are recognized and processed by the translation gmStudio platform to provide new allowing motivated users to develop the code analysis and transformation features they need.

gmPL Extension dll Resolution and

...

Invocation

When gmBasic is processing a gmPL script and it encounters a script statement that it does not recognize, it looks for a .NET assembly named "gmPL_(%statement%).dll". If the dll is found, gmBasic looks for a class "gBasicMain.gmPL_(%statement%)". If that class can be instantiated, the resulting instance is used to invoke a method named XeqStatement to handle the extended command.

The process for finding the extension DLL first looks in the folder containing gmBasic. If the extension DLL is to be placed in a different location, then the extension element must specify that location in a Dllname attributeThis is used for the gmPL dlls in the gmStudio distribution.For example, the extension tag below will engage extension code in gmPL_GlobalStubs.dll located in the same folder as gmBasic.exe. This is used for the gmPL dlls in the gmStudio distribution.

Code Block
languagecode-xml
<GlobalStubs>
   ...
</GlobalStubs>

The extension tag below will engage extension If the extension DLL is to be placed in a different location, then the extension element must specify that location in a Dllname attribute. For example, the extension tag below will engage extension code in gmPL_GlobalStubs.dll located in the C:\Dev\gmGlobalStubs\bin\Debug\ folder.

...

languagexml

...

The

...

DllName

...

value

...

will

...

typically

...

be

...

specified

...

as

...

a

...

relative

...

path

...

or

...

a

...

path

...

using

...

a

...

gmPL

...

script

...

variable

...

(e.g.

...

%UserFolder%).

Code Block
languagexml
<GlobalStubs DllName="C:\Dev\gmGlobalStubs\bin\Debug\gmPL_GlobalStubs.dll">
   ...
</GlobalStubs>

Within their implementation, gmPL extensions assemblies and classes must have the following conventions:

...

  1. Define your requirements and decide on a name for your extension

  2. Implement a .NET DLL following gmPL extension conventions and using gmAPI methods to access and manipulate the translation model

  3. Engage your extension by adding one or more extension XML Elements into your template translation scriptsscript

If your gmPL extension will interact at several points in the translation process, XeqStatement must return Script.HasEventHandlers. This tells gmBasic to hand-off processing to the gmPL dll when it encounters the three main processing operations (Compile, Analyse, and Author). During each hand-off, the gmPL extension may engage its own pre- and post-processing logic and engage the tools standard processing for these operations. For example, see the implementation of the gmPL_CodeStyle below.

...