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

The class Opcode works with the intermediate language streams. Its methods actively manage and reference the opcodes of the intermediate language. Their description and use assume a knowledge of that language and of its internal structure as applied by the toolset. More...

Static Public Member Functions

static int CommentOut (int iStart, int cmtType)
 The method CommentOut comments out a block of intermediate operations so that they will either not appear in the target translation at all or at least will be commented out in the target translation. More...
 
static void Delete (int iStart, int nDelete)
 The method Delete deletes one or more operations stored in the global code block. From the standpoint of the gmSL this along with Replace are the preferred methods for removing and inserting operations into the global code block. More...
 
static int DeleteCode (int iStart, int nCode, int nDelete)
 The method DeleteCode deletes a sequence of byte codes from the global code vector used to contain the compiled code associated with the various components. More...
 
static void DumpCode (int iStart, int iEnd)
 The method DumpCode gives a code dump display from the global code vector used to contain the compiled code associated with the various components. More...
 
static int ExpandCode (int iStart, int nCode, int nExpand)
 The method ExpandCode expands a sequence of byte codes from the global code vector used to contain the compiled code associated with the various components. More...
 
static int FindArgumentEnd (tCodeBlock userCode, int iStart, int iEnd)
 The method FindArgumentEnd finds the end of the code associated with a given argument within a larger code block. Note that argument code always begins with a LEV operation which specifies the nesting level of the argument code, and ends with an ARG operation which specifies the type of the parameter that is to receive the argument. More...
 
static int GetArgumentType (int subRoot, int icode, int lcode)
 The method GetArgumentType evaluates the binary type of a code subsegment within the global code vector used to contain the compiled code associated with the various components. More...
 
static int GetCallArgs (int subRoot, int lastNew, int funcCode, int[] qeAddr, int[] qeType, int nArg)
 The GetCallArgs method gets the byte code offset and binary type of the actual calling arguments to a method. The method optionally also gets the context and migration status flags of the arguments. More...
 
static tCodeBlock GetCode (int iStart)
 The method GetCode returns a tCodeBlock instance for the global vector used to contain the compiled code associated with the various components. More...
 
static tCodeBlock GetCode ()
 
static int GetLength ()
 The method GetLength gets the overall length of intermediate code stored in the global code storage area. This value is needed by other methods that access this code storage area to ensure that they do not exceed its bounds. More...
 
static int GetMember (int opcValue, int subValue)
 The GetMember method gets the library member associated with an operation. Those opcodes that have the role CLSREF(class reference) can have a full library component associated with them in language storage. This library component is used to contain additional migration information about the underlying class component. This method retrieves the root address of this component in the subcode information storage area. A zero root address means that there is no class member associated with the opcode-subcode pair. More...
 
static int GetNext (tCodeBlock codptr, int icode, int nCode)
 The method GetNext returns the offset of the start of the next operation code in the specified code storage area following the operation code offset specified. This method uses the operation type codes specified in the OPCODES section of the meta language description file to move through the code. More...
 
static int GetOperation (tCodeBlock codptr, int icode, ref int subcode)
 The GetOperation method gets the value of the current operation in a code block. More...
 
static int GetOperation (tCodeBlock codptr, int icode)
 
static int GetOperation (int icode)
 
static int GetOperation (int icode, ref int subcode)
 
static int GetPrevious (tCodeBlock codptr, int opAdr, int codeEnd)
 The GetPrevious method moves to a previous operation in a code block. This method returns the offset of the start of the operation code that is directly before an operation code offset specified. Since the operation codes are variable-length and are stored sequentially, this operation requires that the code be scanned from the front starting with a known operation offset. More...
 
static string GetString (int icode, int lcode)
 The GetString method computes the string value represented by a sequence of operations in the global code block. The computation itself is performed by the same engine that executes the gmSL procedures. More...
 
static string GetSubcodeLabel (int opcValue, int sbcValue)
 The GetSubcodeLabel method gets the label for a subcode of an opcode. This is the label entered in the language description under the subcodes specification for the opcode. More...
 
static bool IntegerValue (int iStart, int iEnd, ref int iValue)
 
static int MoveCode (int iDest, int iStart, int nCode, int nMove)
 The MoveCode method moves byte code from one location in the global code block to a different location in that block. This is a move operation so the byte code is removed from its original location. More...
 
static int QuantityInfo (int icode, int[] qeType, int[] qeAddr, int subRoot)
 The QuantityType method gets information about the quantity represented by a specified position in the global code block. This quantity information is dependent on the preceeding content, so this method must be called each time the code position is incremented. More...
 
static void Replace (int icode, int opcode, int subcode, int nReplace)
 The Replace method replaces zero or more operations stored in the global code block with a new operation. More...
 
static void SetCode (tCodeBlock codptr)
 The SetCode method sets the global code block to the tCodeBlock block specified. More...
 
static void SetLength (int nCode)
 The method SetLength sets the overall length of intermediate code stored in the global code storage area. This value is needed by other methods that access this code storage area to ensure that they do not exceed its bounds. More...
 
static void SetOperation (tCodeBlock codptr, int icode, int opcode, int subcode)
 The SetOperation method stores an operation at a particular location in a code block. It is a low level method and assumes that space has been allocated for the storage. This method has been deprecated. Use the Replace method to insert operations. More...
 
static void SetOperation (int icode, int opcode, int subcode)
 
static int Sizeof (int opValue)
 The Sizeof method returns the length in bytes of a specified operation code. The opcTypes enumeration specifies what the lengths for the various types of operation codes. More...
 

Detailed Description

The class Opcode works with the intermediate language streams. Its methods actively manage and reference the opcodes of the intermediate language. Their description and use assume a knowledge of that language and of its internal structure as applied by the toolset.

Member Function Documentation

◆ CommentOut()

static int gmslLibrary.Services.Opcode.CommentOut ( int  iStart,
int  cmtType 
)
static

The method CommentOut comments out a block of intermediate operations so that they will either not appear in the target translation at all or at least will be commented out in the target translation.

Parameters
iStartThe parameter iStart is the offset in the global code block of the component whose presence is causing the need to comment out the statement, and
cmpTypeThe parameter cmtType specifies how the commented out code is to appear, or not appear, in the output. It should be one of the following CMT operation subcodes: CMT.Delete, CMT.CommentOut, CMT.Deprecated, CMT.NotImplemented, or CMT.MustCorrect.
Returns
The method returns the offset in the global code block of the inserted CMT operation unless that operation was stored at the back of the code block. In that case, -1 is returned.

◆ Delete()

static void gmslLibrary.Services.Opcode.Delete ( int  iStart,
int  nDelete 
)
static

The method Delete deletes one or more operations stored in the global code block. From the standpoint of the gmSL this along with Replace are the preferred methods for removing and inserting operations into the global code block.

Parameters
iStartspecifies the offset in the global code block where the deletion is to begin.
nDeletespecifies the number of existing operations to be deleted.

◆ DeleteCode()

static int gmslLibrary.Services.Opcode.DeleteCode ( int  iStart,
int  nCode,
int  nDelete 
)
static

The method DeleteCode deletes a sequence of byte codes from the global code vector used to contain the compiled code associated with the various components.

Parameters
iStartis the starting offset of the code to be deleted.
nCodeis the overall length of the stored code.
nDeleteis the number of bytes to be deleted.
Returns
The method returns the new overall length of the code storage area.

◆ DumpCode()

static void gmslLibrary.Services.Opcode.DumpCode ( int  iStart,
int  iEnd 
)
static

The method DumpCode gives a code dump display from the global code vector used to contain the compiled code associated with the various components.

Parameters
iStartcontains the starting offset of the code to be displayed.
iEndcontains the ending offset. The method checks that the value of iEnd does not exceed the current length of the code storage area. Therefore, if that length has been changed it is important to call the method SetLength beforecalling this method.

◆ ExpandCode()

static int gmslLibrary.Services.Opcode.ExpandCode ( int  iStart,
int  nCode,
int  nExpand 
)
static

The method ExpandCode expands a sequence of byte codes from the global code vector used to contain the compiled code associated with the various components.

Parameters
iStartis the starting offset of the code to be expanded.
nCodeis the overall length of the stored code.
nExpandis the number of bytes to be expanded by.
Returns
The method returns the new overall length of the code storage area.

◆ FindArgumentEnd()

static int gmslLibrary.Services.Opcode.FindArgumentEnd ( tCodeBlock  userCode,
int  iStart,
int  iEnd 
)
static

The method FindArgumentEnd finds the end of the code associated with a given argument within a larger code block. Note that argument code always begins with a LEV operation which specifies the nesting level of the argument code, and ends with an ARG operation which specifies the type of the parameter that is to receive the argument.

Parameters
userCodeis the code block that contains the argument code.
iStartis the offset of the start of the argument code,
iEndis the offset of the end of the search region. This is normally simply set to the overall length of the code block. The end of the argument code is the offset of the first code following the ARG operation.
Returns
The method returns the end of the argument code which is the offset of the first operation following the ARG operation.

◆ GetArgumentType()

static int gmslLibrary.Services.Opcode.GetArgumentType ( int  subRoot,
int  icode,
int  lcode 
)
static

The method GetArgumentType evaluates the binary type of a code subsegment within the global code vector used to contain the compiled code associated with the various components.

Parameters
subRootis the root offset of the component to which the code belongs.
icodeis the offset of the start of the code subsegment whose binary type is needed. This may or may not be an actual argument description.
lcodedefines the end of the subsegment. If it is nonzero, then it simply specifies the length of the subsegment. If it is zero, and the opcode at the start is LEV, then the entire argument code is evaluated. This is the typical use of this method. If it is zero and the starting opcode is not LEV, then only that one opcode is evaluated.
Returns
The method returns the binary type code of the code segment.

◆ GetCallArgs()

static int gmslLibrary.Services.Opcode.GetCallArgs ( int  subRoot,
int  lastNew,
int  funcCode,
int []  qeAddr,
int []  qeType,
int  nArg 
)
static

The GetCallArgs method gets the byte code offset and binary type of the actual calling arguments to a method. The method optionally also gets the context and migration status flags of the arguments.

Parameters
subRootspecifies the root offset of the method performing the call.
lastNewspecifies the byte code offset of the start of the code for the actual statement performing the call.
funcCodespecifies the offset of the operation that is doing the call.
qeAddrreceives the starting offset of the code for each argument.
qeTypereceives the quantity type code for each argument.
nArgspecifies the number of parameters associated with the method. At this level, all methods have a fixed number of parameters that is determined when they are defined and that must be known when this method is called.
Returns
If this method is unable to isolate the calling argument code it returns a zero, else it returns the number of arguments as found and as specified in the parameter nArg

◆ GetCode()

static tCodeBlock gmslLibrary.Services.Opcode.GetCode ( int  iStart)
static

The method GetCode returns a tCodeBlock instance for the global vector used to contain the compiled code associated with the various components.

Parameters
iStartThe optional parameter iStart specifies a starting offset into the global code vector for the start of this tCodeBlock instance. If not specified, a value of zero is used.
Returns
The requested tCodeBlock instance.

◆ GetLength()

static int gmslLibrary.Services.Opcode.GetLength ( )
static

The method GetLength gets the overall length of intermediate code stored in the global code storage area. This value is needed by other methods that access this code storage area to ensure that they do not exceed its bounds.

Returns
The current length of the global code block.

◆ GetMember()

static int gmslLibrary.Services.Opcode.GetMember ( int  opcValue,
int  subValue 
)
static

The GetMember method gets the library member associated with an operation. Those opcodes that have the role CLSREF(class reference) can have a full library component associated with them in language storage. This library component is used to contain additional migration information about the underlying class component. This method retrieves the root address of this component in the subcode information storage area. A zero root address means that there is no class member associated with the opcode-subcode pair.

Parameters
opcValuespecifies the index of the opcode controlling the operation. This must be a constant defined in the OPC class.
subValuespecifies the sequence number of the desired subcode associated the operation. This must be a constant from the operation code class that has the same identifier as the opcValue.
Returns
If the operation does not have a library member associated with it then this method returns a zero; else the offset in language storage of the associated member is returned.

◆ GetNext()

static int gmslLibrary.Services.Opcode.GetNext ( tCodeBlock  codptr,
int  icode,
int  nCode 
)
static

The method GetNext returns the offset of the start of the next operation code in the specified code storage area following the operation code offset specified. This method uses the operation type codes specified in the OPCODES section of the meta language description file to move through the code.

Parameters
codptrspecifies the byte storage area that contains the intermediate code being traversed. It is typically obtained via the method GetCode.
icodecontains offset in the byte storage area of the current operation.
nCodecontains the length of the code being traversed.
Returns
This method returns the offset of the following operation code if there is a following code. If the current operation is the last one, then a minus one is returned.

◆ GetOperation()

static int gmslLibrary.Services.Opcode.GetOperation ( tCodeBlock  codptr,
int  icode,
ref int  subcode 
)
static

The GetOperation method gets the value of the current operation in a code block.

Parameters
codptrcontains the code block whose operations are being examined. If omitted the global code block is used.
icodespecifies the offset in the code block of the desired operation.
subcodereturns the subcode information associated with the operation. The opcTypes enumeration specifies what the subcode values are for the various types of operation codes. It may be omitted.
Returns
The method returns the opcode of the operation. This is a value from the OPC class.

◆ GetPrevious()

static int gmslLibrary.Services.Opcode.GetPrevious ( tCodeBlock  codptr,
int  opAdr,
int  codeEnd 
)
static

The GetPrevious method moves to a previous operation in a code block. This method returns the offset of the start of the operation code that is directly before an operation code offset specified. Since the operation codes are variable-length and are stored sequentially, this operation requires that the code be scanned from the front starting with a known operation offset.

Parameters
codptrcontains the code block being traversed.
opAdrspecifies the offset of an operation in the code block that is known to precede the current one.
codeEndspecifies the offset in the code block of the current operation.
Returns
The operation offset returned by this method will be between these two offsets or will simply be set equal to the starting offset.

◆ GetString()

static string gmslLibrary.Services.Opcode.GetString ( int  icode,
int  lcode 
)
static

The GetString method computes the string value represented by a sequence of operations in the global code block. The computation itself is performed by the same engine that executes the gmSL procedures.

Parameters
icodespecifies the offset of the first operation defining the value.
lcodespecifies the offset immediately beyond the last operation for the value.
Returns
The method reurns the compute string. If the indicated code did not form a string, then an empty string is returned.

◆ GetSubcodeLabel()

static string gmslLibrary.Services.Opcode.GetSubcodeLabel ( int  opcValue,
int  sbcValue 
)
static

The GetSubcodeLabel method gets the label for a subcode of an opcode. This is the label entered in the language description under the subcodes specification for the opcode.

Parameters
opcValuespecifies the index of the opcode controlling the operation. This must be a constant defined in the OPC class.
sbcValuespecifies the sequence number of the desired subcode associated the operation. This must be a constant from the operation code class that has the same identifier as the opcValue.
Returns
The method returns the label for the subcode. If the subcode has no label defined, then an empty string is returned.

◆ MoveCode()

static int gmslLibrary.Services.Opcode.MoveCode ( int  iDest,
int  iStart,
int  nCode,
int  nMove 
)
static

The MoveCode method moves byte code from one location in the global code block to a different location in that block. This is a move operation so the byte code is removed from its original location.

Parameters
iDestspecifies the offset in the global code block of the destination of the move.
iStartspecifies the offset of the source of the move.
nCodespecifies the overall length of the byte code.
nMovespecifies the number of byte codes to move.
Returns
The method returns the offset of the code destination once the move has been completed.

◆ QuantityInfo()

static int gmslLibrary.Services.Opcode.QuantityInfo ( int  icode,
int []  qeType,
int []  qeAddr,
int  subRoot 
)
static

The QuantityType method gets information about the quantity represented by a specified position in the global code block. This quantity information is dependent on the preceeding content, so this method must be called each time the code position is incremented.

Parameters
icodespecifies the offset of the current operation for which information is needed.
qeTypereceives the quantity type code at each logical level.
qeAddrreceives the starting offset of the code at each logical level.
subRootspecifies the root offset of the method performing the call.
Returns
The method returns the binary type of the curent highest level quantity.

◆ Replace()

static void gmslLibrary.Services.Opcode.Replace ( int  icode,
int  opcode,
int  subcode,
int  nReplace 
)
static

The Replace method replaces zero or more operations stored in the global code block with a new operation.

Parameters
icodespecifies the offset in the global code block where the relacement is to begin.
opcodespecifies the index of the opcode of the operation to be inserted.
subcodecontains the value of the desired subcode associated the operation.
nReplacespecifies the number of existing operations to be relaced. A value of zero indicates that the new operation should simply be inserted.

◆ SetCode()

static void gmslLibrary.Services.Opcode.SetCode ( tCodeBlock  codptr)
static

The SetCode method sets the global code block to the tCodeBlock block specified.

Parameters
codptrspecifies a new value for the global code block.

◆ SetLength()

static void gmslLibrary.Services.Opcode.SetLength ( int  nCode)
static

The method SetLength sets the overall length of intermediate code stored in the global code storage area. This value is needed by other methods that access this code storage area to ensure that they do not exceed its bounds.

Parameters
nCodespecifies the length in bytes.

◆ SetOperation()

static void gmslLibrary.Services.Opcode.SetOperation ( tCodeBlock  codptr,
int  icode,
int  opcode,
int  subcode 
)
static

The SetOperation method stores an operation at a particular location in a code block. It is a low level method and assumes that space has been allocated for the storage. This method has been deprecated. Use the Replace method to insert operations.

Parameters
codptrcontains the code block to receive the operation.
icodespecifies the offset in the code block where the operation is to be stored.
opcodespecifies the index of the opcode of the operation to be inserted.
subcodespecifies the value of the desired subcode associated the operation.

◆ Sizeof()

static int gmslLibrary.Services.Opcode.Sizeof ( int  opValue)
static

The Sizeof method returns the length in bytes of a specified operation code. The opcTypes enumeration specifies what the lengths for the various types of operation codes.

Parameters
opValuespecifies the index of the opcode whose size is desired. This must be a constant defined in the OPC class.
Returns
The method returns the number of bytes used by the operation code. This will be a value between 1 and 5.

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