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

The gmBasic class is the primary interface to the gmBasic tool. It contains the utilities that the start up and terminate interactions with the tool. In addition it contains the low level utilities needed to mediate between the C# level and the C level. More...

Static Public Member Functions

static int GetInteger (int address, int offset)
 At a logical level a C storage area is viewed as consisting of a simple sequence of words. In this implementation a word is a 32-bit signed integer. All information is stored on a word boundary and all offsets are expressed in terms of words. The method GetInteger accesses a single word relative to a starting address. More...
 
static void SetInteger (int address, int offset, int value)
 At a logical level a C storage area is viewed as consisting of a simple sequence of words. In this implementation a word is a 32-bit signed integer. All information is stored on a word boundary and all offsets are expressed in terms of words. The method SetInteger sets the value of a single word relative to a starting address. More...
 
static byte [] getByteVector (string identifier, int nByte=0)
 The getByteVector method is a utility used by the interface methods to convert C# strings into null-terminated byte[] vectors which can then be passed to methods in the C-based runtime libraries which view strings as consisting of a sequence of unsigned nonzero 8-bit values, range 1 to 255, terminated by a zero byte. More...
 
static string getString (byte[] vector, int nVector)
 The getString method is a utility used by the interface methods to convert unsigned byte vectors received from the C-based runtime methods into C# strings. The C-based nethods view strings as consisting of a sequence of unsigned nonzero 8-bit values, range 1 to 255, terminated by a zero byte. More...
 
static string getString (byte[] vector)
 
static int StartUp (string startup=null, string subSystem=null, string[] commandArgs=null, int iStart=1)
 The StartUp method MUST be called before the C# code attempts to execute any of the gmsl methods. More...
 
static int Command (string methodName, string parameters, int parent)
 The Command method executes a method written in gmSL stored in the language file of a user supplied file containing compiled gmSL methods. More...
 
static int Command (string methodName, int param1)
 
static void Terminate ()
 The Terminate method must be called when the program ends. It returns any system resources being used by the C-based runtime and ensures that all open files are properly flushed and closed. More...
 

Public Attributes

const int MaxStringSize = 4096
 The constant MaxStringSize is the maximum string length supported at the C level. More...
 

Detailed Description

The gmBasic class is the primary interface to the gmBasic tool. It contains the utilities that the start up and terminate interactions with the tool. In addition it contains the low level utilities needed to mediate between the C# level and the C level.

Member Function Documentation

◆ Command()

static int gmslLibrary.Services.gmBasic.Command ( string  methodName,
string  parameters,
int  parent 
)
static

The Command method executes a method written in gmSL stored in the language file of a user supplied file containing compiled gmSL methods.

Parameters
methodNameThe string methodName parameter contains the fully qualified name of the procedure to execute.
parametersThe string parameters parameter contains a semi-colon delimited list of the arguments to be passed to the method.
parentThis integer parameter contains the root offset of the parent of the method to be executed. If it is zero, the tool searchs for the method.
Returns
If the method cannot be found, a zero is returned; else the method is executed and a one is returned.

◆ getByteVector()

static byte [] gmslLibrary.Services.gmBasic.getByteVector ( string  identifier,
int  nByte = 0 
)
static

The getByteVector method is a utility used by the interface methods to convert C# strings into null-terminated byte[] vectors which can then be passed to methods in the C-based runtime libraries which view strings as consisting of a sequence of unsigned nonzero 8-bit values, range 1 to 255, terminated by a zero byte.

Parameters
identifierContains the string to be converted and then passed to the C-based runtime. It may be null or empty.
Returns
The byte vector containing the byte values of the string characters followed by a zero byte value. If the C# string was null or empty as one-byte vector is returned which simply contains the zero.

◆ GetInteger()

static int gmslLibrary.Services.gmBasic.GetInteger ( int  address,
int  offset 
)
static

At a logical level a C storage area is viewed as consisting of a simple sequence of words. In this implementation a word is a 32-bit signed integer. All information is stored on a word boundary and all offsets are expressed in terms of words. The method GetInteger accesses a single word relative to a starting address.

Parameters
addressThe integer parameter address is a value previously retrieved from the storage manager that represents a logical starting offset for word accesses.
offsetThe integer parameter offset is a simple offset relative to zero of the value to be accessed.
Returns
The method returns the value at the specified location.

◆ getString()

static string gmslLibrary.Services.gmBasic.getString ( byte []  vector,
int  nVector 
)
static

The getString method is a utility used by the interface methods to convert unsigned byte vectors received from the C-based runtime methods into C# strings. The C-based nethods view strings as consisting of a sequence of unsigned nonzero 8-bit values, range 1 to 255, terminated by a zero byte.

Parameters
vectorContains the byte values to be converted to C# characters which are then combined into a C# string.
nVectorSpecifies the number of bytes from the vector to be combined into the C# string. This need not be equal to the length of the vector and it must not include any terminating zero byte. If omitted it is set equal to the length of the vector minus one, to exclude to zero byte.
Returns
The C# string formed from the character values in the byte vector.

◆ SetInteger()

static void gmslLibrary.Services.gmBasic.SetInteger ( int  address,
int  offset,
int  value 
)
static

At a logical level a C storage area is viewed as consisting of a simple sequence of words. In this implementation a word is a 32-bit signed integer. All information is stored on a word boundary and all offsets are expressed in terms of words. The method SetInteger sets the value of a single word relative to a starting address.

Parameters
addressThe integer parameter address is a value previously retrieved from the storage manager that represents a logical starting offset for word accesses.
offsetThe integer parameter offset is a simple offset relative to zero of the value to be set.
valueThe value parameter contains the actual value to be stored and the specified location.

◆ StartUp()

static int gmslLibrary.Services.gmBasic.StartUp ( string  startup = null,
string  subSystem = null,
string []  commandArgs = null,
int  iStart = 1 
)
static

The StartUp method MUST be called before the C# code attempts to execute any of the gmsl methods.

Parameters
startupContains the full pathname of the startup file. If omitted or null, then the default language startup is used ".xml".
subSystemContains the subsystem identifier to be used. If omitted or null, the "std" is used.
commandArgsContains the command argument strings to be passed to the C-based library. This will usually the C# "void Main(string[] args)" args argument whose zero based member contains the program name and whose additional members contain the command arguments whose content will typically be select attribute name=value pairs. It may be null.
iStartSpecifies which entry in the command arguments entry is the starting argument. If omitted or null and if the arguments entry is not null, then a value of one is used.
Returns
If all went well, then this method returns a zero. A non zero value is one of the global error code values as described in the "messages.xml" language file and indicates that the execution program should be terminated immediately.

◆ Terminate()

static void gmslLibrary.Services.gmBasic.Terminate ( )
static

The Terminate method must be called when the program ends. It returns any system resources being used by the C-based runtime and ensures that all open files are properly flushed and closed.

Member Data Documentation

◆ MaxStringSize

const int gmslLibrary.Services.gmBasic.MaxStringSize = 4096

The constant MaxStringSize is the maximum string length supported at the C level.


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