The
System Symbol Service Class
The class
Symbol works with the symbols as stored in the various active storage areas.
Symbol Class ClassName Method
gmSL: string Symbol.ClassName(int iRoot)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="ClassName" type="String" opcode="SCM.Symbol_ClassName" >
<Argument id="iRoot" type="Integer" status="ByVal" />
</Method>
|
The method
ClassName returns the name of the class containing a specified symbol.
Symbol Class DisplayInfo Method
gmSL: void Symbol.DisplayInfo(int infValue,int dispType)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="DisplayInfo" type="void" opcode="SCM.Symbol_DisplayInfo" >
<Argument id="infValue" type="Integer" status="ByVal" />
<Argument id="dispType" type="Integer" status="ByVal" />
</Method>
|
The method
DisplayInfo displays various types of information associated with a symbol. It is used primarily by methods that are auditing the content of a storage area.
Symbol Class EnumStringValue Method
gmSL: string Symbol.EnumStringValue(string enumeration, string entry)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="EnumStringValue" type="String" opcode="SCM.Symbol_EnumStringValue" >
<Argument id="enumeration" type="String" status="ByVal" />
<Argument id="entry" type="String" status="ByVal" />
</Method>
|
The method
EnumStringValue returns the string value of a named entry in a named string based enumeration.
Symbol Class FindIdentifier Method
gmSL: int Symbol.FindIdentifier(string identifier,int parent)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="FindIdentifier" type="Integer" opcode="SCM.Symbol_FindIdentifier" >
<Argument id="identifier" type="String" status="ByVal" />
<Argument id="parent" type="Integer" status="ByVal" optional="0" />
</Method>
|
The method
FindIdentifier finds a qualified identifier in the symbol table beneath a specified parent or anywhere within the tree.
Symbol Class FullName Method
gmSL: string Symbol.FullName(int iRoot, int context)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="FullName" type="string" opcode="SCM.Symbol_FullName" >
<Argument id="iRoot" type="Integer" status="ByVal" />
<Argument id="context" type="Integer" status="ByVal" >
</Method>
|
The method
FullName returns the fully qualified name of a symbol either as defined in the source or as written in the target.
Symbol Class FullType Method
gmSL: int Symbol.FullType(string typeName,int context,int migStatus,int idfStatus)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="FullType" type="Integer" opcode="SCM.Symbol_FullType" >
<Argument id="typeName" type="String" status="ByVal" />
<Argument id="context" type="Integer" status="ByRef" >
<Argument id="migStatus" type="Integer" status="ByRef" >
<Argument id="idfStatus" type="Integer" status="ByVal" >
</Method>
|
The method
FullType processes a type specification string and returns its type code and any status or context flags associated with it.
Symbol Class GetDefault Method
gmSL: int Symbol.GetDefault(int clsRoot)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="GetDefault" type="Integer" opcode="SCM.Symbol_GetDefault" >
<Argument id="clsRoot" type="Integer" status="ByVal" />
</Method>
|
The method
GetDefault gets the root of the default component of a class. The default component is the implied referenced component referenced via singleton class reference.
Symbol Class GetTemplate Method
gmSL: string Symbol.GetTemplate(string TemplateName)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="GetTemplate" type="string" opcode="SCM.Symbol_GetTemplate" >
<Argument id="TemplateName" type="string" status="ByVal"/>
</Method>
|
The method
GetTemplate gets the template string for the specified template
amd and current language dialog.
Symbol Class NamedEntryLabel Method
gmSL: string Symbol.NamedEntryLabel(string enumName,int iValue)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="NamedEntryLabel" type="string" opcode="SCM.Symbol_NamedEntryLabel" >
<Argument id="enumName" type="String" status="ByVal" />
<Argument id="iValue" type="Integer" status="ByVal" >
</Method>
|
The method
NamedEntryLabel gets the name of an entry in a specified enumeration that has a specified value.
Symbol Class ReferenceName Method
gmSL: string Symbol.ReferenceName(string refName)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="ReferenceName" type="String" opcode="SCM.Symbol_ReferenceName" >
<Argument id="refName" type="string" status="ByVal" />
</Method>
|
The method
ReferenceName gets the actual name of an external reference library based on its name in the source.
Symbol Class Rename Method
gmSL: void Symbol.Rename(string newName,int iRoot)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="Rename" type="void" opcode="SCM.Symbol_Rename" >
<Argument id="newName" type="string" status="ByVal" />
<Argument id="iRoot" type="Integer" status="ByVal" />
</Method>
|
The method
Rename renames a symbol for use by the target. This involves either changing its name property in its storage table or changing its pattern in its structure table.
Symbol Class StorePattern Method
gmSL: int Symbol.StorePattern(string allPattern,int nPram)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="StorePattern" type="Integer" opcode="SCM.Symbol_StorePattern" >
<Argument id="allPattern" type="string" status="ByVal" />
<Argument id="nPram" type="Integer" status="ByVal" />
</Method>
|
The method
StorePattern stores a surface pattern along with the number of parameters
that that pattern uses from the string stack in the current storage area. The parameter
allPattern is the pattern string itself. Note that this method does not support multiple dialects as it is assumed that the dialect will be known at the time that the gmSL procedure performing this operation is executed. The parameter specifies the number of parameters to be associated with the pattern string.
To show how this method operates consider the following code that loads a compiled storage area and looks for a method FMStocks_DB.ConvertToString. That method contains a reference to the VB6 intrinsic CStr which is by default translated as Convert.ToString. In this case we wish to use a method MySupport.newStr instead.
Code Block |
---|
language | cpp |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<gmBasic> <!-- Unit test for Symbol.StorePattern method -->
<gmSL>
int subRoot;
tVbSub subInfo;
tCodeBlock codptr;
int nCode;
int icode;
int oper;
int subOper;
Execute.Output("Demo118.out","New","Text","on");
Write.Line "Unit test for Symbol.StorePattern() Method"
Execute.Storage("Open","Demo000");
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 changing pattern");
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);
) subOper = Symbol.StorePattern("MySupport.newStr(%1d)",1);
) Opcode.Replace(icode,OPC.APS,subOper,1);
nCode = Opcode.GetLength();
Write.Line("Authored code after changing pattern");
Runtime.AuthorCode(0,nCode);
</gmSL>
</gmBasic>
|
First, the code locates the reference to
Cstr using its operation code
VBF.Cstr. Second, it uses
Symbol.StorePattern to store a surface pattern that references
MySupport.newStr with one parameter. Third, it replaces the old
VBF.Cstr operation with an
APS operation that references the new pattern. The output of the code is as follows.
Code Block |
---|
language | none |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
Unit test for Symbol.StorePattern() Method
Authored code before changing pattern
if (VBNET.Information.IsNothing(v))
{
Helpers.ConvertToString = "";
}
else
{
Helpers.ConvertToString = Convert.ToString(v);
}
Found VBF.Cstr at location 70
Authored code after changing pattern
if (VBNET.Information.IsNothing(v))
{
Helpers.ConvertToString = "";
}
else
{
Helpers.ConvertToString = MySupport.newStr(v);
}
|
Symbol Class Unused Method
gmSL: int Symbol.Unused(int iRoot)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="Unused" type="Integer" opcode="SCM.Symbol_Unused" >
<Argument id="iRoot" type="Integer" status="ByVal" />
</Method>
|
The method
Unused determines whether a specified symbol is used within a compiled code base.
Symbol Class UseTemplate Method
gmSL: string Symbol.UseTemplate(string template,string identifier)
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<Method id="UseTemplate" type="String" opcode="SCM.Symbol_UseTemplate" >
<Argument id="template" type="String" status="ByVal" />
<Argument id="identifier" type="String" status="ByVal" />
</Method>
|
The method
UseTemplate retrieves a specified template and evaluates its output string using a specified identifier.