Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dwscript - how to enumerate all available types?

Hey, Delphi Web Script is really great scripting engine. I'm trying to use it in one of my projects. However, I'm not sure if it is possible to enumerate all the types, functions that are available within the scripting engine, e.g. I want to have a list with all the methods which I could use while scripting (this includes all the internal and external types, functions, procedures, etc.). Fast script has the treeview component which exposes all the types you can use. I'm looking for something like this in dwscript. Thanks in advance.

like image 887
Linas Avatar asked May 30 '11 20:05

Linas


1 Answers

You'll find all the types in the symbol tables (TSymbolTable) that are attached to every compiled DWScript entity, you have one in the compiled programs, in the compiled functions/methods, and in the blocks that have a scope.

If you want to enumerate all the symbols visible in a particular scope, you'll have not only to look at what a particular TSymbolTable contains, but also look at its parents (which are TSymbolTable too), which hold the symbols from the parent scopes (including unit and library symbols). For class methods & types, you'll find them in the Members[] of a TClassSymbol.

DWS2 repository on sourceforge contains some samples which haven't been converted yet in the DWS2.x repository, but should be reasonably straightforward to adapt.

like image 92
Eric Grange Avatar answered Sep 28 '22 20:09

Eric Grange