Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
What's Delphi Script ? Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
10-Nov-03
Category
OLE
Language
Delphi 3.x
Views
141
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Max Kleiner

There are tools which support DelphiScript. Or other tools are interpreter which 
implement sort of pascal-scripting. What's the aim of these tools and where you can 
find it. 

Answer:

Maybe you have noticed, that I put the article in the OLE category. So in a short 
way, DelphiScript is an OLE scripting language, like VBScript or JScript. Depending 
on the history, the language root is Standard Pascal and not ObjectPascal. 

Extensions 

There are extensions which supports OLE objects and the OLE variant type. It then 
deals with all Standard Pascal types as OLEVariant, or it does support them, e.g. 
not supported are pointers (of course), files, set operators (replaced with 
procedures), records (but records are replaced by untyped arrays). Therfore you can 
declare the type of a variable or parameter, it is allowed, but has no effect. 
Another extension supports exception handling the same way as OPascal does. 
Bref, all variables are of the OleVariant type. 

Comparison 

Delphi Script and VBScript are case insensitive while JavaScript is case sensitive. 
Delphi Script is strongly typed while VBScript and JavaScript is loosely typed. 
This means variable declaration is mandatory in Delphi Script, but variable 
declaration is not needed in VBScript and JavaScript. 
Delphi Script uses square brackets to access data property and round brackets for 
function calls. VBScripts and JavaScript do not make this distinction. For example, 
the following statements are equivalent: 
(Delphi Script) sum := Data1.Value[0] + tq_min(Data2.Value[0],0); 
(VBScript) sum = Data1.Value(0) + tq_min(Data2.Value(0),0) 
(JavaScript) sum = Data1.value(0) + tq_min(Data2.Value(0),0);

A Tool Example 

The easiest way to begin scripting is to use a recorder. Later you can edit the 
script and so on. For example DelphiScript support is built into AQTest: 
www.automatedqa.com http://www.automatedqa.com
It's a highly recommended tool that comes out of the box with 19 profilers.  The 
two that we are interested in most, is "listing unused units", and "identifying who 
calls what method" are included. (The method call profiler display its info through 
a diagram. fantastic cool.;) 
So let's get back to DelphiScript(DS). DS code can be read by Delphi. 
DS supports almost all Standard Pascal operators and routines, minus those that 
deal with type conversion or I/O, type conversion are always implicit. 
Interesting is, there are units. But as DS is meant for scripting and selfstanding 
routines, units are simply groupings of scripts in one file. That means, no unit 
structure (interface, implementation etc.) is possible. 
   
1. Concrete Implementation Dream Scripter 

Dream Scripter supports Delphi Script language - the subset of Object Pascal. 
Before execution the script is compiled to native processor code and that's why 
Delphi Script is much faster than other scripting languages. Another cool feature - 
you don't need to have any scripting engine or extra DLLs on the user computer to 
use Delphi Script.   

Dream Scripter is written entirely with Delphi. You don't need any extra DLLs or 
OCXs. Source is compatible and tested with Delphi 3, Delphi 4, Delphi 5, C++ 
Builder 3, C++ Builder 4, and C++ Builder 5 
http://www.dream-com.com/scripter.htmlhttp://www.dream-com.com/scripter.html

2. Conrete Implementation PasScript 
 
PasScript is an interpreter of a vast subset of the OP (ObjectPascal) language 
which supports all OP data types except interfaces. 
This subset was extended by the Poly data type that allows you to operate with 
dynamic data structures (lists, trees, and more) without using pointers and apply 
Pascal language in the Artificial Intelligence data domain with the same success. 
But what are differences between PasScript and another Pascal scripting engines? 
PasScript supports more wide subset of the OP language. You can use such concepts 
as units, default parameters, overloaded routines, open arrays, records, sets, 
pointers, classes, objects, class references, events, exceptions, and more in a 
script. PasScript syntax is 100% compatible 
with OP. 
All calling conventions register, pascal, stdcall, cdecl, safecall are supported 
Script-defined handlers for Windows messages Script-defined callback functions. 
For example, you can define WindowProc function directly in a script More flexible 
importing Delphi classes. You can use instances of any Delphi class in a script 
create new instances of a Delphi class in a script and destroy them create new 
PasScript class in a script which inherits a Delphi class. More wide possibilities 
regarding the event handlers. You can create script-defined event handler for 
Delphi defined event and vice versa. You can pause, resume and terminate scripts 
and PasScript allows you to control an OLE Automation server. 
The TPasScript component allows you to embed the interpreter into your Delphi, 
Kylix or C++ Builder application, so you can extend and customize the application 
without having to recompile it. 
http://users.ints.net/virtlabor/http://users.ints.net/virtlabor/

One of the latest invention is to use OP as a script language for ASP.NET: 
Recognizing Delphi as a script language works like this: 
The first step in getting support for ASP.NET is making sure it recognizes Delphi 
as a scripting language, and knows how to invoke the Delphi for .NET compiler for 
the various ASP file types. 

ASP.NET will look for a web.config file in the root of whatever virtual directories 
you set up for IIS. Here are the contents of this file for using Delphi as a 
scripting language with ASP.NET. 

The first step in getting support for ASP.NET is making sure it recognizes Delphi 
as a scripting language, and knows how to invoke the Delphi for .NET compiler for 
the various ASP file types. 
ASP.NET will look for a web.config file in the root of whatever virtual directories 
you set up for IIS. Here are the contents of this file for using Delphi as a 
scripting language with ASP.NET. 


configuration> 
  system.web>                             
    compilation debug="true"> 
       assemblies> 
          add assembly="DelphiProvider" /> 
       assemblies> 
       compilers> 
          compiler language="Delphi" extension=".pas" 
            type="Borland.Delphi.DelphiCodeProvider,DelphiProvider" />   
       compilers> 
    compilation> 
  system.web> 
configuration> 

more on that on: http://bdn.borland.com/article/0,1410,28974,00.html http://bdn.borland.com/article/0,1410,28974,00.html 

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC