gmslOpcodeClass
- Mark Juras
Owned by Mark Juras
The Opcode Service Class
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 gmBasic toolset. The primary context in which these methods are used is in Transform event handlers used in code migrations. The presentation here assumes knowledge of the material presented in the section on gmIL.Opcode Class CommentOut Method
gmSL: int Opcode.CommentOut(int iStart,int nCode,int nDelete);<Method id="CommentOut" type="Integer" opcode="SCM.Opcode_CommentOut" > <Argument id="iStart" type="Integer" status="ByVal" /> <Argument id="cmtType" type="Integer" status="ByVal" /> </Method>
cmtType | Description |
Delete | Removes the statement from the authored output |
CommentOut | Precedes the statement with a comment identifying the causing component and then comments the statement out. |
Deprecated | Precedes the statement with a Deprecated comment identifying the causing component and then does not comment the statement out. |
NotImplemented | Precedes the statement with a Not Implemented comment identifying the causing component, and then comments the statement out. |
MustCorrect | Precedes the statement with a Must Correct comment identifying the causing component, and then comments the statement out. |
The code samples below work with a simple statement
ConvertToString = CStr(v)
54 | | | | LEV | Nest0 56 | | | | BIF | Component:CStr:196867 61 | | | | LEV | Nest1 63 | 1.63 | 1.63 | Object | LDA | Variable:v:286901 68 | 1.63 | | | ARG | Void 70 | 1.63 | 1.70 | String | VBF | CStr 72 | 1.63 | | | ARG | String 74 | 2.74 | 1.74 | String | LDA | Subprogram:ConvertToString:286847 79 | | | | STR | AssignValue
54 | | | | LEV | Nest0 56 | | | | BIF | Component:CStr:196867 61 | | | | LEV | Nest1 63 | 1.63 | 1.63 | Object | LDA | Variable:v:286901 68 | 1.63 | | | ARG | Void 70 | 1.63 | 1.70 | String | VBF | CStr 72 | 1.63 | | | ARG | String 74 | 2.74 | 1.74 | String | LDA | Subprogram:ConvertToString:286847 79 | | | | CMT | Delete
54 | 1.54 | 1.54 | String | LSP | 16:Vb6Function.CStr 59 | 1.54 | | | CMT | CommentOut 61 | 1.54 | | | LEV | Nest0 63 | 1.54 | | | BIF | Component:CStr:196867 68 | 1.54 | | | LEV | Nest1 70 | 2.70 | 1.70 | Object | LDA | Variable:v:286901 75 | 2.70 | | | ARG | Void 77 | 2.70 | 1.77 | String | VBF | CStr 79 | 2.70 | | | ARG | String 81 | 3.81 | 1.81 | String | LDA | Subprogram:ConvertToString:286847 86 | | | | STR | AssignValue 88 | | | | CMT | CommentOut
54 | 1.54 | 1.54 | String | LSP | 16:Vb6Function.CStr 59 | 1.54 | | | CMT | Deprecated 61 | 1.54 | | | LEV | Nest0 63 | 1.54 | | | BIF | Component:CStr:196867 68 | 1.54 | | | LEV | Nest1 70 | 2.70 | 1.70 | Object | LDA | Variable:v:286901 75 | 2.70 | | | ARG | Void 77 | 2.70 | 1.77 | String | VBF | CStr 79 | 2.70 | | | ARG | String 81 | 3.81 | 1.81 | String | LDA | Subprogram:ConvertToString:286847 86 | | | | STR | AssignValue
54 | 1.54 | 1.54 | String | LSP | 16:Vb6Function.CStr 59 | 1.54 | | | CMT | NotImplemented 61 | 1.54 | | | LEV | Nest0 63 | 1.54 | | | BIF | Component:CStr:196867 68 | 1.54 | | | LEV | Nest1 70 | 2.70 | 1.70 | Object | LDA | Variable:v:286901 75 | 2.70 | | | ARG | Void 77 | 2.70 | 1.77 | String | VBF | CStr 79 | 2.70 | | | ARG | String 81 | 3.81 | 1.81 | String | LDA | Subprogram:ConvertToString:286847 86 | | | | STR | AssignValue 88 | | | | CMT | CommentOut
Select.CodeCommentOut = False; subRoot = Symbol.FindIdentifier("FMStocks_DB.ConvertToString"); subInfo = Store.GetVector(subRoot); codptr = Opcode.GetCode(); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Opcode.SetLength(nCode); Write.Line("Authored code before commenting out statement"); Runtime.AuthorCode(0,nCode); for(icode = 0; icode >= 0; icode = Opcode.GetNext(codptr,icode,nCode)) { oper = = Opcode.GetOperation(codptr,icode,subOper); if(oper == OPC.VBF && subOper == OPC.VBF.CStr) break; } Write.Line("Found VBF.Cstr at location " + icode); Opcode.CommentOut(icode,OPC.CMT.Delete); nCode = Opcode.GetLength(); Write.Line("Authored code after commenting out statement with Delete"); Runtime.AuthorCode(0,nCode); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Opcode.SetLength(nCode); Opcode.CommentOut(icode,OPC.CMT.CommentOut); nCode = Opcode.GetLength(); Write.Line("Authored code after commenting out statement with CommentOut"); Runtime.AuthorCode(0,nCode); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Opcode.SetLength(nCode); Opcode.CommentOut(icode,OPC.CMT.Deprecated); nCode = Opcode.GetLength(); Write.Line("Authored code after commenting out statement with Deprecated"); Runtime.AuthorCode(0,nCode); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Opcode.SetLength(nCode); Opcode.CommentOut(icode,OPC.CMT.NotImplemented); nCode = Opcode.GetLength(); Write.Line("Authored code after commenting out statement with NotImplemented"); Runtime.AuthorCode(0,nCode); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Opcode.SetLength(nCode); Opcode.CommentOut(icode,OPC.CMT.MustCorrect); nCode = Opcode.GetLength(); Write.Line("Authored code after commenting out statement with MustCorrect"); Runtime.AuthorCode(0,nCode);
Authored code before commenting out statement if (VBNET.Information.IsNothing(v)) { Helpers.ConvertToString = ""; } else { Helpers.ConvertToString = Convert.ToString(v); } Found VBF.Cstr at location 70 Authored code after commenting out statement with Delete if (VBNET.Information.IsNothing(v)) { Helpers.ConvertToString = ""; } else { } Authored code after commenting out statement with CommentOut if (VBNET.Information.IsNothing(v)) { Helpers.ConvertToString = ""; } else { // Vb6Function.CStr // Helpers.ConvertToString = Convert.ToString(v); } Authored code after commenting out statement with Deprecated if (VBNET.Information.IsNothing(v)) { Helpers.ConvertToString = ""; } else { #if !DEBUG #warning "UPGRADE WARNING: Vb6Function.CStr was upgraded, but is should be reviewed." #endif Helpers.ConvertToString = Convert.ToString(v); } Authored code after commenting out statement with NotImplemented if (VBNET.Information.IsNothing(v)) { Helpers.ConvertToString = ""; } else { #if !DEBUG #warning "UPGRADE ISSUE: Vb6Function.CStr was not upgraded." #endif // Helpers.ConvertToString = Convert.ToString(v); } Authored code after commenting out statement with MustCorrect if (VBNET.Information.IsNothing(v)) { Helpers.ConvertToString = ""; } else { #if !DEBUG #error "UPGRADE ISSUE: Vb6Function.CStr was not upgraded." #endif // Helpers.ConvertToString = Convert.ToString(v); }
<property id="WordWrap" type="Boolean" status="ByVal" opcode="LAB.31" migStatus="NotImplemented" migComment=" WordWrap is now always on by default. See http://migration/finish_work/wordwrap.htm"
2912 | | | | NEW | 541 lblRedirect.WordWrap = True 2915 | 1.2915 | 1.2915 | String | LSP | 14:Label.WordWrap 2920 | 2.2920 | 2.2920 | String | LSP | WordWrap is now always on by default. See http://migration/finish_work/wordwrap.htm 2925 | 1.2915 | | | CMT | IssueComment 2927 | 1.2915 | | | LEV | Nest0 2929 | 2.2929 | 1.2929 | Boolean | LBC | True 2931 | 2.2929 | | | ARG | Boolean 2933 | 3.2933 | 1.2933 | Label | LDA | Label:lblRedirect:5808347 2938 | 4.2938 | 1.2933 | Boolean | LAB | WordWrap 2940 | 3.2933 | 1.2933 | Boolean | MEM | Child 2942 | | | | STR | AssignValue 2944 | | | | CMT | CommentOut
#if COMMENT #warning "UPGRADE ISSUE: Label.WordWrap was not upgraded. WordWrap is now always on by default. See http://migration/finish_work/wordwrap.htm" #endif // lblRedirect.WordWrap = true;
Opcode.DeleteCode Method
gmSL: int Opcode.DeleteCode(int iStart,int nCode,int nDelete);<Method id="DeleteCode" type="Integer" opcode="SCM.Opcode_DeleteCode" > <Argument id="iStart" type="Integer" status="ByVal" /> <Argument id="nCode" type="Integer" status="ByVal" /> <Argument id="nDelete" type="Integer" status="ByVal" /> </Method>
int subRoot; tVbSub subInfo; tCodeBlock codptr; int nCode; Execute.Storage("Open","\fkgtest\fmstocks\fmstock1"); subRoot = Symbol.FindIdentifier("FMStocks_DB.Version.Version"); subInfo = Store.GetVector(subRoot); codptr = Opcode.GetCode(); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Opcode.SetLength(nCode); Execute.Output(,,,"on"); Write.Line("Code Dump before deleting REF"); Opcode.DumpCode(0,nCode); nCode = Opcode.DeleteCode(12,nCode,sizeof(OPC.REF)); Write.Line("Code Dump after deleting REF"); Opcode.DumpCode(0,nCode);
Code Dump before deleting REF Offset | Sl.Start | Ql.Start | Quantity type | Opcode | Operation support information ------ | -------- | -------- | ------------- | ------ | ----------------------------- 0 | | | | NEW | 30 3 | | | | LEV | Nest0 5 | 1.5 | 1.5 | String | LDA | Subprogram:GetVersionNumber:252074 10 | 1.5 | 1.5 | String | CUF | Args0 12 | 1.5 | 1.5 | String | REF | Subprogram:GetVersionNumber:252074 17 | 1.5 | | | ARG | String 19 | | | | EXI | Function Code Dump after deleting REF Offset | Sl.Start | Ql.Start | Quantity type | Opcode | Operation support information ------ | -------- | -------- | ------------- | ------ | ----------------------------- 0 | | | | NEW | 30 3 | | | | LEV | Nest0 5 | 1.5 | 1.5 | String | LDA | Subprogram:GetVersionNumber:252074 10 | 1.5 | 1.5 | String | CUF | Args0 12 | 1.5 | | | ARG | String 14 | | | | EXI | Function
Opcode.DumpCode Method
gmSL: void DumpCode(int iStart,int iEnd);<Method id="DumpCode" type="void" opcode="SCM.Opcode_DumpCode" > <Argument id="iStart" type="Integer" status="ByVal" /> <Argument id="iEnd" type="Integer" status="ByVal" /> </Method>
int subRoot; tVbSub subInfo; tCodeBlock codptr; int nCode; Execute.Storage("Open","\fkgtest\fmstocks\fmstock1"); subRoot = Symbol.FindIdentifier("FMStocks_DB.Version.Version"); subInfo = Store.GetVector(subRoot); codptr = Opcode.GetCode(); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Opcode.SetLength(nCode); Execute.Output(,,,"on"); Opcode.DumpCode(0,nCode);
Offset | Sl.Start | Ql.Start | Quantity type | Opcode | Operation support information ------ | -------- | -------- | ------------- | ------ | ----------------------------- 0 | | | | NEW | 30 3 | | | | LEV | Nest0 5 | 1.5 | 1.5 | String | LDA | Subprogram:GetVersionNumber:252074 10 | 1.5 | 1.5 | String | CUF | Args0 12 | 1.5 | 1.5 | String | REF | Subprogram:GetVersionNumber:252074 17 | 1.5 | | | ARG | String 19 | | | | EXI | Function
Opcode.ExpandCode Method
gmSL: int ExpandCode(int iStart,int nCode,int nExpand);<Method id="ExpandCode" type="Integer" opcode="SCM.Opcode_ExpandCode" > <Argument id="iStart" type="Integer" status="ByVal" /> <Argument id="nCode" type="Integer" status="ByVal" /> <Argument id="nExpand" type="Integer" status="ByVal" /> </Method>
int subRoot; tVbSub subInfo; tCodeBlock codptr; int nCode; Execute.Storage("Open","\fkgtest\fmstocks\fmstock1"); subRoot = Symbol.FindIdentifier("FMStocks_DB.Version.Version"); subInfo = Store.GetVector(subRoot); codptr = Opcode.GetCode(); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Opcode.SetLength(nCode); Execute.Output(,,,"on"); Write.Line("Code Dump before inserting CNV"); Opcode.DumpCode(0,nCode); nCode = Opcode.ExpandCode(12,nCode,sizeof(OPC.CNV)); Opcode.SetLength(nCode); Opcode.SetOperation(codptr,12,OPC.CNV,OPC.CNV.ToString); Write.Line("Code Dump after inserting CNV"); Opcode.DumpCode(0,nCode);
Code Dump before inserting CNV Offset | Sl.Start | Ql.Start | Quantity type | Opcode | Operation support information ------ | -------- | -------- | ------------- | ------ | ----------------------------- 0 | | | | NEW | 30 3 | | | | LEV | Nest0 5 | 1.5 | 1.5 | String | LDA | Subprogram:GetVersionNumber:252074 10 | 1.5 | 1.5 | String | CUF | Args0 12 | 1.5 | 1.5 | String | REF | Subprogram:GetVersionNumber:252074 17 | 1.5 | | | ARG | String 19 | | | | EXI | Function Code Dump after inserting CNV Offset | Sl.Start | Ql.Start | Quantity type | Opcode | Operation support information ------ | -------- | -------- | ------------- | ------ | ----------------------------- 0 | | | | NEW | 30 3 | | | | LEV | Nest0 5 | 1.5 | 1.5 | String | LDA | Subprogram:GetVersionNumber:252074 10 | 1.5 | 1.5 | String | CUF | Args0 12 | 1.5 | 1.5 | String | CNV | ToString 14 | 1.5 | 1.5 | String | REF | Subprogram:GetVersionNumber:252074 19 | 1.5 | | | ARG | String 21 | | | | EXI | Function
Opcode.FindArgumentEnd Method
gmSL: int FindArgumentEnd(tCodeBlock userCode,int iStart,int iEnd);Method id="FindArgumentEnd" type="Integer" opcode="SCM_Opcode_FindArgumentEnd" > <Argument id="userCode" type="tCodeBlock" status="ByVal" /> <Argument id="iStart" type="Integer" status="ByVal" /> <Argument id="iEnd" type="Integer" status="ByVal" /> /Method>
int subRoot; tVbSub subInfo; tCodeBlock codptr; int nCode; int icode; int iEnd; int opcd; int subc; Execute.Storage("Open","\fkgtest\fmstocks\fmstock1"); subRoot = Symbol.FindIdentifier("FMStocks_DB.Version.Version"); subInfo = Store.GetVector(subRoot); codptr = Opcode.GetCode(); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Opcode.SetLength(nCode); Execute.Output(,,,"on"); Opcode.DumpCode(0,nCode); for(icode = 0; icode >= 0; icode = Opcode.GetNext(codptr,icode,nCode)) { opcd = Opcode.GetOperation(codptr,icode,subc); if(opcd == OPC.LEV) { iEnd = Opcode.FindArgumentEnd(codptr,icode,nCode); Write.Line("The argument starting at " + icode + " ends at " + iEnd); } }
Offset | Sl.Start | Ql.Start | Quantity type | Opcode | Operation support information ------ | -------- | -------- | ------------- | ------ | ----------------------------- 0 | | | | NEW | 30 3 | | | | LEV | Nest0 5 | 1.5 | 1.5 | String | LDA | Subprogram:GetVersionNumber:252074 10 | 1.5 | 1.5 | String | CUF | Args0 12 | 1.5 | 1.5 | String | REF | Subprogram:GetVersionNumber:252074 17 | 1.5 | | | ARG | String 19 | | | | EXI | Function The argument starting at 3 ends at 19
Opcode.GetArgumentType Method
gmSL: int GetArgumentType(int subRoot,int icode,int lcode);<Method id="GetArgumentType" type="Integer" opcode="SCM.Opcode_GetArgumentType" > <Argument id="subRoot" type="Integer" status="ByVal" /> <Argument id="icode" type="Integer" status="ByVal" /> <Argument id="lcode" type="Integer" status="ByVal" /> </Method>
int subRoot; tVbSub subInfo; tCodeBlock codptr; int nCode; int icode; int itype; int opcd; int subc; Execute.Storage("Open","\fkgtest\fmstocks\fmstock1"); subRoot = Symbol.FindIdentifier("FMStocks_DB.Version.Version"); subInfo = Store.GetVector(subRoot); codptr = Opcode.GetCode(); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Opcode.SetLength(nCode); Execute.Output(,,,"on"); Opcode.DumpCode(0,nCode); for(icode = 0; icode >= 0; icode = Opcode.GetNext(codptr,icode,nCode)) { opcd = Opcode.GetOperation(codptr,icode,subc); if(opcd == OPC.LEV) { iType = Opcode.GetArgumentType(subRoot,icode,0); Write.Line("The argument starting at " + icode + " has type " + Opcode.GetSubcodeLabel(OPC.TYP,iType)); } }
Offset | Sl.Start | Ql.Start | Quantity type | Opcode | Operation support information ------ | -------- | -------- | ------------- | ------ | ----------------------------- 0 | | | | NEW | 30 3 | | | | LEV | Nest0 5 | 1.5 | 1.5 | String | LDA | Subprogram:GetVersionNumber:252074 10 | 1.5 | 1.5 | String | CUF | Args0 12 | 1.5 | 1.5 | String | REF | Subprogram:GetVersionNumber:252074 17 | 1.5 | | | ARG | String 19 | | | | EXI | Function The argument starting at 3 has type String
Opcode.GetCode Method
gmSL: tCodeBlock GetCode();<Method id="GetCode" type="tCodeBlock" opcode="SCM_Opcode_GetCode" />
int subRoot; tVbSub subInfo; tCodeBlock codptr; int nCode; Execute.Storage("Open","\fkgtest\fmstocks\fmstock1"); subRoot = Symbol.FindIdentifier("FMStocks_DB.Version.Version"); subInfo = Store.GetVector(subRoot); codptr = Opcode.GetCode(); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); System.LogMessage("The method FMStocks_DB.Version.Version has " + nCode + " Bytes of analysed code");
The method FMStocks_DB.Version.Version has 21 Bytes of analysed code
Opcode.GetInfo Method
gmSL: tOpcInfo GetInfo(int opcValue);<Method id="GetInfo" type="tOpcInfo" opcode="SCM.Opcode_GetInfo" > <Argument id="opcValue" type="Integer" status="ByVal" /> </Method>
tOpcInfo opcInfo; int pass; for(pass = 0; pass < 3; pass = pass + 1) { if(pass == 0) opcInfo = Opcode.GetInfo(OPC.REM); else if (pass == 1) opcInfo = Opcode.GetInfo(OPC.ADD); else opcInfo = Opcode.GetInfo(OPC.USC); System.LogMessage("The Opcode " + opcInfo.ident + " has value " + opcInfo.value); System.LogMessage(" length = " + opcInfo.length); System.LogMessage(" ident = " + opcInfo.ident); System.LogMessage(" value = " + opcInfo.value); System.LogMessage(" type = " + Symbol.NamedEntryLabel("opcTypes",opcInfo.type)); System.LogMessage(" role = " + Symbol.NamedEntryLabel("opcRoles",opcInfo.role)); System.LogMessage(" subcodes = " + opcInfo.subcodes); System.LogMessage(" sublist = " + opcInfo.sublist); System.LogMessage(" interface = " + opcInfo.interface); }
The Opcode REM has value 3 length = 17 ident = REM value = 3 type = StringAddr role = Comment subcodes = 0 sublist = 0 interface = 0 The Opcode ADD has value 13 length = 17 ident = ADD value = 13 type = Arithmetic role = Binary subcodes = 2 sublist = 3855 interface = 0 The Opcode USC has value 170 length = 17 ident = USC value = 170 type = DoubleByte role = Clsref subcodes = 128 sublist = 58475 interface = 319790
Opcode.GetLength Method
gmSL: int GetLength();<Method id="GetLength" type="Integer" opcode="SCM_Opcode_GetLength" />
int subRoot; tVbSub subInfo; tCodeBlock codptr; int nCode; Execute.Storage("Open","\fkgtest\fmstocks\fmstock1"); subRoot = Symbol.FindIdentifier("FMStocks_DB.Version.Version"); subInfo = Store.GetVector(subRoot); codptr = Opcode.GetCode(); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); System.LogMessage("Code length before set is " + Opcode.GetLength()); Opcode.SetLength(nCode); System.LogMessage("Code length after set is " + Opcode.GetLength());
Code length before set is 0 Code length after set is 21
Opcode.GetNext Method
gmSL:int GetNext(tCodeBlock codptr,int icode,int nCode)<Method id="GetNext" type="Integer" opcode="SCM_Opcode_GetNext" > <Argument id="codptr" type="Object" status="ByVal" /> <Argument id="icode" type="Integer" status="ByVal" /> <Argument id="nCode" type="Integer" status="ByVal" /> </Method>
OpcTypes | len Meaning |
Arithmetic | 2 is an arithmetic operation with hierarchy |
SingleByte | 1 consists of a single byte operation code |
DoubleByte | 2 Consists of a 2-byte operation code |
ShortValue | 3 Operation code followed by 2-byte value |
SymbolAddr | 5 Operation code followed by 4-byte symbol address |
StringAddr | 5 Operation code followed by 4-byte string address |
OpcodeAddr | 5 Operation code followed by 4-byte pcode offset |
BinaryType | 2 2-byte operation specifying binary type |
LibraryAdr | 5 Operation code followed by 4-byte library offset |
LibPattern | 5 Operation code followed by 4-byte pattern offset |
ObjectType | 5 Operation code followed by 4-byte object type code |
The argument pcode controls the byte storage area that contains the intermediate code being traversed. It is typically obtained via the method Opcode_GetCode. The argument opadr contains offset in the byte storage area of the current operation. The argument codeEnd contains the length of the code being traversed. 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.
<gmBasic> <!-- Unit test for Opcode_GetOperation() and Opcode_GetNext() Methods --> <Storage Action="Open" Identifier="..\fmstocks\fmstock1.vbi" /> <Output Status="New" Filename="demo046.out" /> <gmsl> int subRoot; tVbSub subInfo; tCodeBlock codptr; int nCode; int icode; int opc; int subc; tOpcInfo opcInfo; subRoot = Symbol_FindIdentifier("FMStocks_DB.Version.Version", 0); subInfo = Store_GetVector(subRoot); codptr = Opcode_GetCode(); nCode = Store_ReadInfo(codptr,subInfo.anaCodeStart); Write_Line("The method FMStocks_DB.Version.Version has " + nCode + " Bytes of analysed code as follows:"); icode = 0; while(icode >= 0) { opc = Opcode_GetOperation(codptr,icode,subc); opcInfo = Opcode_GetInfo(opc); Write_Line("codptr(" + icode + ") " + opcInfo.ident + " has subcode " + subc); icode = Opcode_GetNext(codptr,icode,nCode); } </gmsl> <Storage Action="Close" /> </gmBasic>
The method FMStocks_DB.Version.Version has 21 Bytes of analysed code as follows: codptr(0) NEW has subcode 30 codptr(3) LEV has subcode 0 codptr(5) LDA has subcode 252074 codptr(10) CUF has subcode 0 codptr(12) REF has subcode 252074 codptr(17) ARG has subcode 8 codptr(19) EXI has subcode 2
Opcode.GetOperation Method
gmSL:Opcode.GetSubcodeLabel Method
gmSL:Opcode.SetLength Method
gmSL: void SetLength(int nCode);<Method id="SetLength" type="void" opcode="SCM.Opcode_SetLength" > <Argument id="nCode" type="Integer" status="ByVal" /> </Method>
int subRoot; tVbSub subInfo; tCodeBlock codptr; int nCode; Execute.Storage("Open","\fkgtest\fmstocks\fmstock1"); subRoot = Symbol.FindIdentifier("FMStocks_DB.Version.Version"); subInfo = Store.GetVector(subRoot); codptr = Opcode.GetCode(); nCode = Store.ReadInfo(codptr,subInfo.anaCodeStart); Execute.Output(,,,"on"); Write.Line("Code Dump before setting length"); Opcode.DumpCode(0,nCode); Opcode.SetLength(nCode); Write.Line("Code Dump after setting length"); Opcode.DumpCode(0,nCode);
Code Dump before setting length Offset | Sl.Start | Ql.Start | Quantity type | Opcode | Operation support information ------ | -------- | -------- | ------------- | ------ | ----------------------------- 0 | | | | NEW | 30 Code Dump after setting length Offset | Sl.Start | Ql.Start | Quantity type | Opcode | Operation support information ------ | -------- | -------- | ------------- | ------ | ----------------------------- 0 | | | | NEW | 30 3 | | | | LEV | Nest0 5 | 1.5 | 1.5 | String | LDA | Subprogram:GetVersionNumber:252074 10 | 1.5 | 1.5 | String | CUF | Args0 12 | 1.5 | 1.5 | String | REF | Subprogram:GetVersionNumber:252074 17 | 1.5 | | | ARG | String 19 | | | | EXI | Function
Opcode.SetOperation Method
gmSL:Table of Contents