Jonespelsia

Disponível somente no TrabalhosFeitos
  • Páginas : 33 (8146 palavras )
  • Download(s) : 0
  • Publicado : 11 de fevereiro de 2013
Ler documento completo
Amostra do texto
FastScript 1.9
Scripting library


Developer's manual











Copyright (c) 1998-2005 by Fast Reports Inc.

Author: Alexander Tzyganenko
e-mail: tz@fast-report.com
home page: http://www.fastreport.ru
http://www.fast-report.com


Introduction



What is FastScript
Quick start
Features and missing features
Language reference
Script structureData types
Classes
Functions
Events
Enumerations and sets
Arrays



What is FastScript

FastScript is a scripting library. It is useful for the programmers who want to add scripting ability to their projects. FastScript is written on 100% Object Pascal and can be installed in Borland Delphi 4-7, C++Builder 4-6 and Kylix 1-3.
Unique feature of FastScript is ability to use severallanguages (PascalScript, C++Script, JScript and BasicScript), so you can write scripts using your favourite language. FastScript doesn't use Microsoft Scripting Host, so it can be used in Windows and Linux environment.
FastScript combines cross-platform scripting, fast code execution, small footprint, rich set of features and a splendid scalability. Make your applications the most flexible andpowerful ones with FastScript!


Quick start

Here is a sample code which demonstrates the easiest way of using FastScript. For the correct work of the example put the components fsScript1: TfsScript and fsPascal1: TfsPascal on the form .

uses FS_iInterpreter;

procedure TForm1.Button1Click(Sender: TObject);
begin
fsScript1.Clear; // do this if you running many scripts from onecomponent
fsScript1.Lines.Text := 'begin ShowMessage(''Hello!'') end.';
fsScript1.Parent := fsGlobalUnit; // use standard classes and methods
fsScript1.SyntaxType := 'PascalScript';
if fsScript1.Compile then
fsScript1.Execute else
ShowMessage(fsScript1.ErrorMsg);
end;

As you can see, there is nothing difficult here. At first we fill in the fsScript1.Lines propertywith the script text. For using standard types and functions we set Parent property to the fsGlobalUnit. Then we compile the script using PascalScript language (you can use C++Script, BasicScript, JScript as well). If compilation is successful Compile method returns True and we can Execute the script. Otherwise the error message is shown.


Features and missing features
Features

-Multi-language architecture allows you to use a number of languages (at present moment PascalScript, C++Script, BasicScript, JScript). You can add any procedural language (language grammar is stored in XML format).
- Standard language set: variables, constants, procedures, functions (nested functions allowed) with var/const/default parameters, all the standard operators and statements (including case,try/finally/except, with), types (int, float, bool, char, string, multi-dimensional array, enum, variant), classes (with methods, events, properties, indices and default properties).
- Types compatibility checking.
- Access to any object inside your application. Standard libraries for the access to the base classes, controls, forms and BD. Easily expandable library architecture.
- Small footprint- 90-150Kb depending on used modules.
- Can be used in multi-thread environment.
Missing features

- No type declarations (records, classes) in the script; no records, no pointers, no sets (but you can use 'IN' operator - "a in ['a'..'c','d']"), no shortstrings, no GOTO statement.
- C++Script: no octal constants; no 'break' in the SWITCH operator (SWITCH works like Pascal CASE); '++' and'--' operators are possible only after the variables, that is '++i' is not allowed; '--', '++' and '=' operators do not return a value, that is 'if(i++)' is not allowed; all the identifiers are case-insensitive; NULL constant is the Pascal Null - use nil instead of NULL.
- JScript and BasicScript: see syntax diagrams.


Language reference

PascalScript syntax:

Program -> [PROGRAM Ident...
tracking img