Componentes.Terceros.jvcl/official/3.32/examples/RaLib/RaInterpreter/JvInterpreterTest.ini

512 lines
14 KiB
INI

[Demos]
Count=21
Item0=Simple expression
Item1=One function
Item2=One function with variable
Item3=Unit and recursion
Item4=OnGetValue Event
Item5=Access to Delphi's objects
Item6=Exception handling
Item7=Working with sets
Item8=Handling Delphi events
Item9=Records
Item10=Calling external functions
Item11=Ole automation
Item12=JvInterpreter Adapters
Item13=How to import Delphi units
Item14=Arrays
Item15=Running delphi forms
Item16=Running delphi reports
Item17=Running delphi units
Item18=List of supported statements
Item19=Credits
Item20=Our plans
[Simple expression\Source]
Count=1
Item0=2*2+(122.34-54.67)*123.5
[Simple expression\Description]
Count=12
Item0=This is simple expression.
Item1=JvInterpreterProgram component automatically
Item2=detects 3 types of sources:
Item3=" 1) simple expression;"
Item4=" 2) one function;"
Item5=" 3) unit;"
Item6=
Item7=Press 'Run' button, please.
Item8=Button 'Compile' requires unit as source,
Item9=so it doesn't work with this sample.
Item10=
Item11=See next example...
[One function\Source]
Count=4
Item0=begin
Item1=" Result := '2*2+(122.34-54.67)*123.5=' +"
Item2=" IntToStr(2*2+(122.34-54.67)*123.5);"
Item3=end;
[One function\Description]
Count=3
Item0=This is one function.
Item1=JvInterpreter detects it by first word;
Item2=it have to be 'begin' or 'var'.
[One function with variable\Source]
Count=6
Item0=var
Item1=" Variable : real {type ignored} ;"
Item2=begin
Item3=" Variable := 2*2+(122.34-54.67)*123.5;"
Item4=" Result := '2*2+(122.34-54.67)*123.5=' + IntToStr(Variable);"
Item5=end;
[One function with variable\Description]
Count=3
Item0=This is one function with var-statement.
Item1=JvInterpreter detects function by first word;
Item2=it have to be 'begin' or 'var'.
[Unit and recursion\Source]
Count=20
Item0=unit MyUnit;
Item1=
Item2=function main: string;
Item3=var
Item4=" IntVariable : integer;"
Item5=begin
Item6=" IntVariable := 5;"
Item7=" Result := 'Factorial(5)=' +"
Item8=" IntToStr(Factorial(IntVariable));"
Item9=end;
Item10=
Item11=function Factorial(F : integer) : integer;
Item12=begin
Item13=" if F <= 1 then"
Item14=" Result := F"
Item15=" else"
Item16=" Result := F * Factorial(F-1);"
Item17=end;
Item18=
Item19=end.
[Unit and recursion\Description]
Count=4
Item0=This example shows structure of JvInterpreter unit.
Item1=It is similar to delphi's unit, but 'interface'
Item2=and 'implementation' keywords are not required
Item3=(more over, they are raise an error).
[OnGetValue Event\Source]
Count=1
Item0=MyFunction(10000)
[OnGetValue Event\Description]
Count=2
Item0=Function MyFunction is calculated in OnGetValue - event.
Item1=It simply adds 1 to passed value.
[Access to Delphi's objects\Source]
Count=22
Item0=var
Item1=" v : TObject;"
Item2=" B : TStringList;"
Item3=" L : integer;"
Item4=" r : boolean;"
Item5=begin
Item6=" V := Application.FindComponent('Test')."
Item7=" FindComponent('Memo2').Lines;"
Item8=" B := TStringList.Create;"
Item9=" try"
Item10=" B.Assign(V);"
Item11=" B.Add('MyLine');"
Item12=" r := B.Find('MyLine', L);"
Item13=" if r then"
Item14=" Result := 'found line at position ' +"
Item15=" IntToStr(L)"
Item16=" else"
Item17=" Result := 'not found';"
Item18=" finally"
Item19=" B.Free;"
Item20=" end;"
Item21=end;
[Access to Delphi's objects\Description]
Count=9
Item0=This example demonstrates:
Item1=" - assigning delphi object to JvInterpreter variable;"
Item2=" - calling method from object;"
Item3=" - creating new object through to"
Item4=" class function Create;"
Item5=" - calling function with var parameter"
Item6=" (TStringList.Find);"
Item7=" - if/then/else statement;"
Item8=" - try/finally statement;"
[Exception handling\Source]
Count=20
Item0=var
Item1=" v, B : Variant;"
Item2=begin
Item3=" B := 'ok';"
Item4=" try"
Item5=" // raise Exception.Create('Self generated error');"
Item6=" V := 1 div 0;"
Item7=" V := V + 1;"
Item8=" except"
Item9=" on E: EOverflow do"
Item10=" B : = 'EOverflow: ' + E.Message;"
Item11=" on EIntOverflow do"
Item12=" B : = 'EIntOverflow: ' + E.Message;"
Item13=" on E: EZeroDivide do"
Item14=" B : = 'EZeroDivide: ' + E.Message;"
Item15=" else"
Item16=" raise"
Item17=" end;"
Item18=" Result := ': ' + B;"
Item19=end;
[Exception handling\Description]
Count=17
Item0=JvInterpreter understands try/finally and
Item1=try/except statements.
Item2=Exceptions in JvInterpreter is native Delphi
Item3=exceptions. It means that exceptions
Item4=raised in JvInterpreter may be handled in
Item5=Delphi and exceptions, raised in
Item6=Delphi functions called from JvInterpreter
Item7=source may be handled in JvInterpreter source.
Item8=To raise exception use standard
Item9=Delphi directive: raise <Object>.
Item10=
Item11=Note: to raise exceptions you need
Item12=create instance of object. It means,
Item13=that this object must be registered
Item14=in JvInterpreter adapter.
Item15=
Item16=See next examples.
[Handling Delphi events]
Page=Event
[Handling Delphi events\Source]
Count=18
Item0=unit Unit1;
Item1=
Item2=procedure ButtonClick(Sender: TObject);
Item3=begin
Item4=" MessageBox(0, TButton(Sender).Caption + ' clicked!', 'Information', MB_ICONINFORMATION);"
Item5=end;
Item6=
Item7=procedure main;
Item8=var
Item9=" v, B : Variant;"
Item10=" L : integer;"
Item11=" r : boolean;"
Item12=begin
Item13=" V := Test.FindComponent('Button4');"
Item14=" TButton(V).OnClick := ButtonClick;"
Item15=end;
Item16=
Item17=end.
[Handling Delphi events\Description]
Count=8
Item0=In JvInterpreter source you can handle
Item1=delphi events with standard delphi
Item2=manner.
Item3=
Item4=Note: to handle events event type
Item5=must be registered in JvInterpreter Adapter.
Item6=
Item7=Now click 'Run', then click 'Button4'.
[Working with sets\Source]
Count=17
Item0=var
Item1=" v : Variant;"
Item2=" S : string;"
Item3=" St: Variant;"
Item4=begin
Item5=" V := Test.FindComponent('Button1');"
Item6=" St := V.Font.Style;"
Item7=" S := V.Caption;"
Item8=" try"
Item9=" V.Font.Style := V.Font.Style + [fsBold, fsItalic];"
Item10=" V.Caption := 'Hello';"
Item11=" MessageBox(0, 'Hello', 'Information', MB_ICONINFORMATION);"
Item12=" finally"
Item13=" V.Caption := S;"
Item14=" V.Font.Style := St;"
Item15=" end;"
Item16=end;
[Working with sets\Description]
Count=7
Item0=JvInterpreter allows you to work with native
Item1=delphi sets, but only sets with
Item2=up to 32 elements are allowed.
Item3=
Item4=Note: you can't work with charset,
Item5=because it contains more than 32 elements.
Item6=Sorry.
[Records\Source]
Count=19
Item0=var
Item1=" F : TSearchRec;"
Item2=" DosError: Integer;"
Item3=" Strings: TStrings;"
Item4=begin
Item5=" Strings := Test.FindComponent('Memo2').Lines;"
Item6=" Strings.Clear;"
Item7=" DosError := FindFirst('C:\*.*', faAnyFile, F);"
Item8=" while DosError = 0 do"
Item9=" begin"
Item10=" if (F.Attr and faDirectory) = 0 then"
Item11=" Strings.Add(F.Name)"
Item12=" else"
Item13=" Strings.Add('\' + F.Name);"
Item14=" DosError := FindNext(F);"
Item15=" end;"
Item16=" FindClose(F);"
Item17=" DosError := 0;"
Item18=end;
[Records\Description]
Count=7
Item0=In JvInterpreter you can work with Delphi
Item1=records. We provide access to
Item2=following record types:
Item3=TPoint, TRect, TSearchRec.
Item4=
Item5=You can add other records using
Item6=JvInterpreter Adapters.
[Calling external functions\Source]
Count=11
Item0=unit Unit1;
Item1=
Item2=function MessageBox(hWnd: integer; lpText, lpCaption: PChar; uType: integer): Integer;
Item3=" external 'user32.dll' name 'MessageBoxA';"
Item4=
Item5=Procedure main;
Item6=begin
Item7=" MessageBox(0, 'Hello, World !', 'calling dll', MB_ICONINFORMATION);"
Item8=end;
Item9=
Item10=end.
[Calling external functions\Description]
Count=5
Item0=You can declare external function
Item1=in source and then call it.
Item2=
Item3=Note: only standard types are allowed;
Item4=var parameters don't allowed.
[JvInterpreter Adapters]
Page=Empty
[JvInterpreter Adapters\Description]
Count=33
Item0=All functions, classes, records, ..
Item1=must be registered in JvInterpreter Adapter
Item2=before they can be used in JvInterpreter
Item3=source. Usually you create special
Item4=unit to obtain access to delphi
Item5=functions and objects.
Item6=We call this special units as
Item7='JvInterpreter Adapters' or 'Adapters'.
Item8=
Item9=This version of JVCL Library includes
Item10=Adapters:
Item11=JvInterpreter_System, JvInterpreter_SysUtils,
Item12=JvInterpreter_Windows(only few functions and constants),
Item13=JvInterpreter_Classes, JvInterpreter_Controls,
Item14=JvInterpreter_StdCtrls, JvInterpreter_ExtCtrls,
Item15=JvInterpreter_Forms, JvInterpreter_Dialogs,
Item16=JvInterpreter_Graphics, JvInterpreter_Menus,
Item17=JvInterpreter_Grids, JvInterpreter_Db,
Item18=JvInterpreter_DbTables, JvInterpreter_DBCtrls,
Item19=JvInterpreter_DBGrids, JvInterpreter_Quickrpt;
Item20=
Item21=All adapters are based on Delphi 3
Item22=units;
Item23=Compiler {$IF} directives allow
Item24=to compile it in all version.
Item25=
Item26='Quickrpt' unit is very different
Item27=in different Delphi versions.
Item28=JvInterpreter_Quickrpt is based on Delphi3
Item29=and contains code for Delphi2
Item30=and CBuilder1, but this code not
Item31=complete, because we don't have
Item32=QuickReport 1 sources.
[Ole automation\Source]
Count=10
Item0=var
Item1=" MSW: Variant;"
Item2=" i: Integer;"
Item3=begin
Item4=" MSW := GetOleObject('Word.Basic');"
Item5=" MSW.AppShow;"
Item6=" MSW.FileNew;"
Item7=" MSW.Insert('JvInterpreter Demo !');"
Item8=" MSW := 0;"
Item9=end;
[How to import Delphi units]
Page=Empty
[How to import Delphi units\Description]
Count=17
Item0=You can create adapter units
Item1=manually, but it is not very
Item2=interesting.
Item3=
Item4=Use program Pas2JvInterpreter, placed in
Item5='RALib\Tools\Pas2JvInterpreter' folder to
Item6=automatically create JvInterpreter Adapters.
Item7=In most cases errors occured when
Item8=you try to compile created unit, so
Item9=you must manually correct it.
Item10=
Item11=Take a look at the adapter sources,
Item12=which are included in JVCL Library.
Item13=Those are good examples. All adapters
Item14=illustrate access to Delphi objects.
Item15=JvInterpreter_Windows shows access to
Item16=records and external functions.
[Running delphi forms]
Page=ExternalForm
[Running delphi forms\Description]
Count=12
Item0=TJvInterpreterFm component can create
Item1=delphi form from dfm-file, and load
Item2=assotiated pas-file.
Item3=Then it can show form, or you can
Item4=call any function from its pas-file.
Item5=
Item6=JvInterpreter attempts to load normal Delphi
Item7=pas-file and ignore all interface part.
Item8=
Item9=Click 'Run form...' and select
Item10='Unit1.pas'. Then try to interact
Item11=with form.
[Running delphi reports]
Page=ExternalReport
[Running delphi reports\Description]
Count=16
Item0=This sample is based on previous one
Item1=but loaded form is not shown.
Item2=We attempt to find QuickRep1 (for
Item3=QR2) or QuickReport1 (for QR1)
Item4=component on the form and then
Item5=call its Preview method.
Item6=
Item7=Loaded form can contain its own
Item8=data access components or reference
Item9=to components in .exe forms or
Item10=data modules;
Item11=
Item12=Click 'Run report...' and select
Item13='QRUnit_D3_D4_B3.pas' or
Item14='QRUnit_D2_B1.pas' depending on
Item15=your Delphi versions.
[Running delphi units]
Page=ExternalUnit
[Running delphi units\Description]
Count=11
Item0=This is more efficient way
Item1=to work with Delphi forms.
Item2=
Item3=Delphi's pas/dfm file can be placed
Item4=in uses clause of JvInterpreter-script.
Item5=This allows to manipulate with
Item6=other form with standard Delphi manner
Item7=
Item8=Click 'Run unit...' and select
Item9='project1\project1.pas'.
Item10=Then try to interact with form.
[List of supported statements]
Page=Empty
[List of supported statements\Description]
Count=18
Item0=Now JvInterpreter supports following pascal
Item1=statements:
Item2=" - begin/end;"
Item3=" - var declaration;"
Item4=" - const declaration;"
Item5=" - if/then/else;"
Item6=" - for/do;"
Item7=" - while/do;"
Item8=" - repeat/until;"
Item9=" - break, continue;"
Item10=" - case;"
Item11=" - exit;"
Item12=" - try/finally;"
Item13=" - try/except/on;"
Item14=" - raise and raise <object>;"
Item15=" - assignment;"
Item16=" - function calls;"
Item17=" - uses clause;"
[Credits]
Page=Empty
[Credits\Source]
Count=1
Item0==>
[Credits\Description]
Count=13
Item0=JvInterpreter is fully written by us,
Item1=R&A Library authors.
Item2=
Item3=But some good ideas (no line
Item4=of code) was taken from
Item5='Delphin interpreter' by
Item6=Dream Company:
Item7=" www.dreamcompany.com"
Item8=
Item9=Many guys sent us bug reports and
Item10=fixes.
Item11=Andrej Olejnik has coded initial
Item12=array support in JvInterpreter.
[Our plans]
Page=Empty
[Our plans\Source]
Count=1
Item0==>
[Our plans\Description]
Count=13
Item0=Like all great product :) JvInterpreter
Item1=is always in development.
Item2=Now it contains most of things
Item3=we are need to.
Item4=And all that we do now are
Item5=we correct bugs.
Item6=
Item7=We very need you comments.
Item8=If you found JvInterpreter interesting
Item9=or have found any bug
Item10=please mail to us:
Item11=
Item12=" black@infa.ru."