Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

To declare a method, test, add it to a gmSL block:

<gmSL namespace="gmSL" class="gm"><[CDATA[[
void test(string arg1)
{
        System.LogMessage("Here i am: " + arg1);
}
]]></gmsl>

To run a method, invoke it with a RunCommand statement, using a gm. prefix. For example:

<RunCommand id="test" Prams="Mark" />


Another example – pre-inspection of a file:



   <Load Project="%SrcPath%" SourceCode="on" />
   
   <gmSL namespace="gmSL" class="gm"><[CDATA[[
   void InspectCode()
   {
      int       levels(19);
      int       iRoot;
      tInfoFile formFile;
      Text      textStream;
      int       nRecord;
      int       curRecord;
      int       length = 0;
      int       rai = 0;
      string    record;
      string    token;
      int       lexeme;

      for(iRoot = Store.FindFirstChild(levels,0); iRoot != 0; iRoot = Store.FindNextChild(levels))
      {         
         if(Store.GetObjectType(iRoot) != ObjectType.FormFile) continue;
         string name = Symbol.FullName(iRoot,0);
         System.LogMessage("name=" + name);
         
         formFile = Store.GetVector(iRoot);
         if(formFile.textBase == 0) continue;
         System.LogMessage("formFile.textBase=" + formFile.textBase);
         
         textStream = Text.Open(Store.GetHandle(),formFile.textBase);
         System.LogMessage("textStream=" + textStream);

         nRecord = Text.Maximum(textStream);
         curRecord = 0;
         while(curRecord < nRecord)
         {
            curRecord = curRecord + 1;
            Text.Position(textStream,curRecord);
            record = Text.Access(textStream, length, rai, 0);
            if(length < 10) continue;
            Parser.SetStatement(record);
            token = Parser.GetToken(lexeme);
            if(token == "Attribute") break;
            if(token != "Begin") continue;
            token = Parser.GetToken(lexeme);
            if(token != "MSComctlLib") continue;
            System.LogMessage("record=" + record);
            while(lexeme>0)
            {
               System.LogMessage("  token=[" + token + "] lexeme=" + lexeme);
               token = Parser.GetToken(lexeme);
            }   
         }
         Text.Close(textStream);
      }
   }
]]></gmsl>
   <RunCommand id="InspectCode"  />
 
	<Compile...>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Translation Log: C:\gmSamples\NewSamples\FileExplorerAPI\proj_csh\log\FileExplorer_csh-FileExplorer-gms-csh.TRAN.log
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Basic Processor V30.76(07/18/18) System Build(07/18/18 5:26:53)
Processing file: C:\gmSamples\NewSamples\FileExplorerAPI\src\FileExplorer.vbp
Reprocessing file: gm.cls
Reprocessing file: gm.cls
name=frmExploreLite.frm
formFile.textBase=3838
textStream=4
record=   Begin MSComctlLib.Toolbar Toolbar1
  token=[MSComctlLib] lexeme=2
  token=[.] lexeme=1
  token=[Toolbar] lexeme=2
  token=[Toolbar1] lexeme=2
record=   Begin MSComctlLib.ImageList ilSmall
  token=[MSComctlLib] lexeme=2
  token=[.] lexeme=1
  token=[ImageList] lexeme=2
  token=[ilSmall] lexeme=2
record=   Begin MSComctlLib.ImageList ilMain
  token=[MSComctlLib] lexeme=2
  token=[.] lexeme=1
  token=[ImageList] lexeme=2
  token=[ilMain] lexeme=2
record=   Begin MSComctlLib.ListView lvListView
  token=[MSComctlLib] lexeme=2
  token=[.] lexeme=1
  token=[ListView] lexeme=2
  token=[lvListView] lexeme=2
record=   Begin MSComctlLib.TreeView tvTreeView
  token=[MSComctlLib] lexeme=2
  token=[.] lexeme=1
  token=[TreeView] lexeme=2
  token=[tvTreeView] lexeme=2
record=   Begin MSComctlLib.StatusBar sbStatusBar
  token=[MSComctlLib] lexeme=2
  token=[.] lexeme=1
  token=[StatusBar] lexeme=2
  token=[sbStatusBar] lexeme=2
...
Translation Time (sec) = 0.25




  • No labels