Questions tagged [dwscript]

DWScript is an object-oriented scripting engine for Delphi based on the Delphi language, with extensions borrowed from other Pascal languages (FreePascal, Prism, etc.).

DWScript (Delphi Web Script) is an object-oriented scripting engine for Delphi based on the Delphi language, with extensions borrowed from other Pascal languages (FreePascal, Prism, etc.). It introduces a few Pascal language extensions of its own as well.

DWScript is an open-source project, issues that do not pertain to DWScript programming, usage or integration in host applications are probably best reported in the issue tracker.

93 questions
3
votes
1 answer

dwscript - can anyone help with editor-debugger examples please?

I'm looking at the excellent dwscript for Delphi see here which provides a useful set of classes to implement a built in pascal script for your Application. I would very much appreciate some help with an example of how to link together the supplied…
Brian Frost
  • 13,334
  • 11
  • 80
  • 154
3
votes
1 answer

Is it possible to create a Read–eval–print loop (REPL) using DWScript?

I am trying to create a Read–eval–print loop (REPL) with DWScript and I'm not sure this is possible. Based on the name, I assumed that RecompileInContext would work fine in that context but I am experiencing some limitations: A buggy line is…
jonjbar
  • 3,896
  • 1
  • 25
  • 46
3
votes
1 answer

DWScript: How to read a meta class parameter from Delphi side

I'm having trouble using meta classes in DWScript. We are using scripting to enable VARs and end users to customize our application. Our application data basically consist of a lot of small objects in a tree structure. Each object can either be…
SpeedFreak
  • 876
  • 6
  • 16
3
votes
2 answers

Call a procedure of a class from DWScript

How can I call a procedure from a class that is created in main Form. Can it be done like this pseudo code shows? type TDemo = class procedure test; constructor Create; destructor Destroy; override; end; var Form28: TForm28; …
user1647411
3
votes
1 answer

How to find variable calling TdwsGlobal.onReadVar/OnWriteVar event

I am dynamically creating variables within a DWSUnit as follows: v := dwsUnit.Variables.Add('c', 'float'); // etc v.OnWriteVar := writeVar; v.OnReadVar := readVar; All variables point to the same event procedure. The problems is I can't figure out…
Ashley West
  • 53
  • 1
  • 1
  • 4
3
votes
2 answers

Setting entry point in DWScript

Is there a way to set an entry point in DWScript? For example, if I start a script execution, I'd like it to execute a procedure Main, rather than the code in the regular entry point (begin ... end.). I know it's possible to execute functions from…
FHannes
  • 783
  • 7
  • 22
3
votes
1 answer

DWScript: Add an new array definition to a dwsUnit at runtime

What is the method, using Delphi XE2, to call to add Array definition to a dwsUnit component at runtime? MyDwsUnit.Arrays.Add returns a TCollectionItem, not TdwsArray, while adding an array definition at design time adds a TdwsArray instance!.
Bahaa
  • 123
  • 2
  • 9
2
votes
1 answer

sending a record type as parameter using dwscript

Please consider this record: Type TStudent = record Name:String; Age: Integer; Class:String; end; I have a class TSchool that has the following function: function AddStudent(LStudent:TStudent):Boolean; I want to use this class…
Zeina
  • 1,573
  • 2
  • 24
  • 34
2
votes
1 answer

How to obtain the line numbers of executable lines from DWScript context map or symbol table

I am writing an IDE to use with Delphi DWScript and now have a simple debuggable script. I now want to highlight the executable lines in my source (like the blue dots at the left of the Delphi source). Digging for examples / information I see that…
Brian Frost
  • 13,334
  • 11
  • 80
  • 154
2
votes
1 answer

Delphi Web Script: How to Debug a specific Script Function

Thanks to TdwsDebugger I can debug a complete script using: Debugger := TdwsDebugger.Create(nil); Debugger.BeginDebug(Execution); In my use case I don't run the whole script, but only a function of it: var Func: IInfo; begin [...] Func :=…
Steffen Binas
  • 1,463
  • 20
  • 30
2
votes
1 answer

Delphi Web Script: Accessing a Variable after the Script is Executed

Imagine this Script: var s = TStrings.Create; s.Add('Line 1'); s.Add('Line 2'); procedure MyProc; begin if s.count = 2 then // ... end; When the Script runs it creates the variable "s". Now I'd like to call "MyProc" after the script is…
Steffen Binas
  • 1,463
  • 20
  • 30
2
votes
1 answer

Delphi Web Script: How to Expose a Class via RTTI which contains a Method returning another (exposed) Class

I have this Delphi class type TAnotherClass = class end; TMyClass = class function Foo: TAnotherClass; end; function TMyClass.Foo: TAnotherClass; begin Result := TAnotherClass.Create; end; Now I'd like to expose this class via…
Steffen Binas
  • 1,463
  • 20
  • 30
2
votes
2 answers

Compiling DWScript units with circular references gives ECompileError "Unknown Name"

I have two DWScript unit files: unit unit1; | unit unit2; | interface | interface | procedure Proc1exec; | procedure…
Vlad
  • 43
  • 6
2
votes
1 answer

How to install the latest Subversion version of DWScript?

The most recent preview of DWScript is from October two years ago, and since the project is active and I want to use it in XE7, I thought I would check out the latest source (r2653 at the time of writing) and install from that instead. The latest…
David
  • 13,360
  • 7
  • 66
  • 130
2
votes
0 answers

Pass Object from magic function

I need to use TStringList in dwscript. In compiled delphi code I use both sl := TStringList.Create; and sl := genSL; where genSL creates and poulates the TStringList. I would like to use this in dwscript but I have trouble returning a TStringList…