home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1999 March
/
Chip_1999-03_cd.bin
/
zkuste
/
delphi
/
D234C13
/
RALIB.ZIP
/
RALib
/
Lib
/
RAIIntf.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-08-03
|
13KB
|
337 lines
{***********************************************************
R&A Library
Copyright (C) 1996-98 R&A
description : R&A interpreter
programer : black
e-mail : blacknbs@chat.ru
www : www.chat.ru\~blacknbs\ralib
************************************************************}
{$INCLUDE RA.INC}
unit RAIIntf;
{ RAInter interfaces }
interface
const
{ Inter GUIDs }
IID_IIObject : TGUID = '{8C6BA261-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_IIValue : TGUID = '{8C6BA262-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_IIVar : TGUID = '{8C6BA263-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_IIArgs : TGUID = '{8C6BA264-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_IIInterObject : TGUID = '{8C6BA265-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_IIDebugObject : TGUID = '{8C6BA266-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_IITranslator : TGUID = '{8C6BA267-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_IIInter : TGUID = '{8C6BA268-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_IIDebugger : TGUID = '{8C6BA269-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_IIObjectInfo : TGUID = '{8C6BA26A-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_ISystem : TGUID = '{8C6BA280-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_ISysUtils : TGUID = '{8C6BA281-08FC-11d1-BA5A-F44E9C5EF10B}';
IID_IOleAuto : TGUID = '{8C6BA282-08FC-11d1-BA5A-F44E9C5EF10B}';
type
{$IFNDEF RA_D4H}
HResult = integer;
{$ENDIF RA_D4H}
IIObject = interface;
IIValue = interface;
IIArgs = interface;
{iString - string type used by RAInter}
iString = PChar; { this enables create DLL, that work with standard types only }
bufString = ShortString;
TSGIDebugFlags = (dfAll, dfHint, dfEvaluate); {for debugger}
{TSetGetInfo}
TSetGetInfo = record
Name : iString;
Args : IIArgs;
Res : IIValue;
IObjOut : IIObject;
Get : boolean;
DebugFlags : TSGIDebugFlags;
end;
PSetGetInfo = ^TSetGetInfo;
TIValueTyp = (ivEmpty, ivVariant, ivIdentifer, ivClass, ivFormula,
ivInteger, ivReal, ivBoolean, ivString, ivObject, ivPointer,
{internal} ivAny);
IIObject = interface(IUnknown)
['{8C6BA261-08FC-11d1-BA5A-F44E9C5EF10B}']
function SetGetValue(var SGI : TSetGetInfo) : boolean;
end;
IIValue = interface(IIObject)
['{8C6BA262-08FC-11d1-BA5A-F44E9C5EF10B}']
procedure Empty;
procedure SetStr(S : iString);
function GetStr : iString;
function GetAsString : iString;
function GetTyp : TIValueTyp;
procedure SetvString (vString : iString);
procedure SetvClass (vClass : iString);
procedure SetvFormula (vFormula : iString);
procedure SetvIdentifer(vIdentifer : iString);
procedure SetvInteger(vInteger : integer );
procedure SetvReal (vReal : double );
procedure SetvBoolean(vBoolean : boolean );
procedure SetvObject (vObject : IIObject);
procedure SetvPointer(vPointer : IIValue );
function GetvString : iString;
function GetvIdentifer : iString;
function GetvFormula : iString;
function GetvClass : iString;
function GetvInteger : integer ;
function GetvReal : double ;
function GetvBoolean : boolean ;
function GetvObject : IIObject;
function GetvPointer : IIValue ;
property Typ : TIValueTyp read GetTyp;
property Str : iString read GetStr write SetStr;
property AsString : iString read GetAsString write SetStr;
property vString : iString read GetvString write SetvString ;
property vIdentifer : iString read GetvIdentifer write SetvIdentifer ;
property vFormula : iString read GetvFormula write SetvFormula ;
property vClass : iString read GetvClass write SetvClass ;
property vInteger : integer read GetvInteger write SetvInteger;
property vReal : double read GetvReal write SetvReal ;
property vBoolean : boolean read GetvBoolean write SetvBoolean;
property vObject : IIObject read GetvObject write SetvObject ;
property vPointer : IIValue read GetvPointer write SetvPointer;
end;
IIVar = interface(IIValue)
['{8C6BA263-08FC-11d1-BA5A-F44E9C5EF10B}']
function GetName : iString;
procedure SetName(AName : iString);
property Name : iString read GetName write SetName;
end;
IIArgs = interface(IIObject)
['{8C6BA264-08FC-11d1-BA5A-F44E9C5EF10B}']
function GetResTyp : TIValueTyp;
function GetItem(index : integer) : IIVar;
function Count : integer;
procedure Delete(index : integer);
property ResTyp : TIValueTyp read GetResTyp;
property Items [index : integer] : IIVar read GetItem; default;
end;
{********************* IIInterObject *********************}
{ evaluator interface - Φφ≥σ≡⌠σΘ± Ωεφ≥≡εδΦ≡≤■∙ΦΘ Γ√≈Φ±δσφΦ }
{Error information}
TProgError = record
ErrProcName : bufString; {Error function name}
ErrUnitName : bufString; {Error unit name}
ErrMessage : bufString; {Error message}
ErrPos : integer; {Error position - index in pcProgram}
ErrCode : integer; {Error code}
ErrVarName : bufString; {Additional information: Error variable name or other name}
ErrIObj : IIObject;
end;
{Run parameters}
TRunParams = record
UnitName : iString; {Current unit name, can be empty} {╚∞ ≥σΩ≤∙σπε ∞εΣ≤δ (∞εµσ≥ = '', ≥επΣα Γ Formula ∩≡Φ Γ√τεΓσ ⌠≤φΩ÷ΦΘ φαΣε ±±√δα≥ⁿ± φα ∞εΣ≤δⁿ (φα∩≡Φ∞σ≡, σ±δΦ UnitName = '', ≥ε Formula = 'MyUnit.MyFunc'. └ σ±δΦ UnitName = 'MyUnit', ≥ε ∞εµφε ∩Φ±α≥ⁿ Formula = 'MyFunc'))}
Formula : iString; {Program source}
ReloadAll : boolean; {if true, all loaded units must be unload before starting program} {⌠δαπ ∩εΩατ√Γασ≥ φαΣε δΦ Γ√π≡≤τΦ≥ⁿ Γ±σ Unit'√}
RemoveUnit : boolean; {if true and UnitName <> '', unit UnitName will be unload after program done} {σ±δΦ UnitName <> '', ≥ε ⌠δαπ ∩εΩατ√Γασ≥ φαΣε δΦ Γ√π≡≤τΦ≥ⁿ Unit (ε±ΓεßεΣΦ≥ⁿ ∩α∞ ≥ⁿ ε≥ φσπε) ∩ε±δσ Γ√∩εδφσφΦ }
CompileOnly : boolean; {if true, only synax check will be done - not implemented} {≥εδⁿΩε ε≥Ωε∞∩ΦδΦ≡εΓα≥ⁿ ∞εΣ≤δⁿ - φσ Γ√∩εδφ ≥ⁿ}
AppHandle : longint; {Application.Handle - used by DLL version for internal error MessageBox}
end;
IIInterObject = interface(IIObject)
['{8C6BA265-08FC-11d1-BA5A-F44E9C5EF10B}']
function IsTerminated : boolean;
function GetUnitSource(UnitName : iString; var UnitSource, UnitFullName : iString) : boolean;
procedure Clear;
procedure Done(var Error : TProgError);
procedure GetRunParams(var RunParams : TRunParams);
function GetRes : IIValue;
property Res : IIValue read GetRes;
end;
{********************* IIDebugObject *********************}
{debugger interface}
IIDebugObject = interface
['{8C6BA266-08FC-11d1-BA5A-F44E9C5EF10B}']
procedure Debug;
function GetDebugMode : boolean;
{if DebugMode is true, method Debug will be called on each step - Γ√τ√Γα≥ⁿ ∞σ≥εΣ Debug φα ΩαµΣε∞ °απσ Γ√∩εδφσφΦ }
property DebugMode : boolean read GetDebugMode;
end;
{********************* IITranslator *********************}
{external translator interface - Φφ≥σ≡⌠σΘ± Ωεφ≥≡εδΦ≡≤■∙ΦΘ Γφσ°φ■■ ≥≡αφ±δ ÷Φ■}
TTranslateData = record
UnitName : iString; {In}
pcProgram : PChar; {In}
Offs : integer; {In/Out}
end;
IITranslator = interface(IIObject)
['{8C6BA267-08FC-11d1-BA5A-F44E9C5EF10B}']
function Translate(var Data : TTranslateData) : boolean;
end;
{********************* IIInter *********************}
{RA Inter - ±εß±≥Γσφφε Φφ≥σ≡∩≡σ≥α≥ε≡}
IIInter = interface(IUnknown)
['{8C6BA268-08FC-11d1-BA5A-F44E9C5EF10B}']
procedure Run(IInterObject : IIInterObject);
end;
{ and interface to internal structures - , Φφ≥σ≡⌠σΘ± Ω σπε Γφ≤≥≡σφφΦ∞ ±≥≡≤Ω≥≤≡α∞}
IICallStack = interface;
IIDebugger = interface(IUnknown)
['{8C6BA269-08FC-11d1-BA5A-F44E9C5EF10B}']
procedure SetDebugMode(ADebugMode : boolean);
function EvaluateModify(Watch : iString; var Value : iString; var SGIDebugFlags : TSGIDebugFlags) : boolean;
function GetCallStack : IICallStack;
property DebugMode : boolean write SetDebugMode; {Γ√τ√Γα≥ⁿ ∞σ≥εΣ Debug φα ΩαµΣε∞ °απσ Γ√∩εδφσφΦ }
property CallStack : IICallStack read GetCallStack;
end;
{ and its internal structures - , Φ σπε Γφ≤≥≡σφφΦσ ±≥≡≤Ω≥≤≡√}
TCallStackItem = record
UnitName : iString;
FuncName : iString;
pcProgram : PChar; {Unit source - ≥σΩ±≥ ∞εΣ≤δ }
pcPos : PChar; {Current parser position - ≥σΩ≤∙α ∩ετΦ÷Φ ∩α≡±σ≡α}
PosBeg, PosEnd : integer; {Current executed block in pcProgram - ∩ετΦ÷Φ ε±≥αφεΓα Γ FFormula}
Args : IIArgs;
end;
IICallStack = interface(IUnknown)
['{8C6BA26A-08FC-11d1-BA5A-F44E9C5EF10B}']
function Count : integer;
function GetItem(index : integer) : TCallStackItem;
property Items[index : integer] : TCallStackItem read GetItem; default;
end;
{********************* IIObjectInfo *********************}
{φσεß τα≥σδⁿφ√Θ Φφ≥σ≡⌠σΘ± Σδ IIInterObject - ∩ετΓεδ σ≥ Γ√Γσ±≥Φ ßεδσσ
≥ε≈φ≤■ Φφ⌠ε≡∞α÷Φ■ ε Γφσ°φσΘ ε°ΦßΩσ Γ ≡σαδΦτα÷ΦΦ IIInterObject}
TIObjectData = record
ClassName : bufString;
end;
IIObjectInfo = interface(IUnknown)
['{8C6BA26B-08FC-11d1-BA5A-F44E9C5EF10B}']
procedure GetIObjectData(var IObjectData : TIObjectData);
end;
type
TInterError = integer;
const
{RA Inter error codes}
{╩εΣ√ ε°ΦßεΩ Φφ≥σ≡∩≡σ≥α≥ε≡α}
ieUnknown = -1;
ieInternal = 111;
ieOk = 0; {²≥≤ ε°ΦßΩ≤ φσ ∩εΩατ√Γα≥ⁿ}
ieUserBreak = 102; {²≥≤ ε°ΦßΩ≤ φσ ∩εΩατ√Γα≥ⁿ}
ieBadIInterObject = 103;
ieCalcEventNotAssigned = 104;
ieNotImplemented = 105; {Σαφφα Γετ∞εµφε±≥ⁿ Γ ≥σΩ≤∙σΘ Γσ≡±ΦΦ φσ ≡σαδΦτεΓαφα}
ieFormulaEmpty = 106; {∩σ≡σΣαφα φα Γ√≈Φ±δσφΦσ ∩≤±≥α ⌠ε≡∞≤δα}
ieInterObject = 107; {∩σ≡σΣαφ φα Γ√≈Φ±δσφΦσ ∩≤±≥εΘ InterObject}
{run-time errors - Γ≡σ∞σφΦ Γ√∩εδφσφΦ }
ieDivisionByZero = 1;
iePeriodMonth = 2;
iePeriodDay = 3;
iePeriodBrice = 4;
iePeriodSeparator = 5;
iePeriodBeg = 6;
iePeriodBegEnd = 7;
// ieRecursion = 8;
ieStackOverFlow = 9;
ieResultNotSolved = 10;{═σε∩≡σΣσδσφφα ε°ΦßΩα Γ Γ√≡αµσφΦΦ(φε ≥ε≈φε σ±≥ⁿ)}
ieCikl = 11;{┬φ≤≥≡σφφ - τα÷ΦΩδΦΓαφΦσ}
ieExternalError = 12;{∩≡Φ Γ√τεΓσ GetVar ΦδΦ SetVar}
ieTypeMistmach = 13;{φσ±εε≥Γσ≥±≥ΓΦσ ≥Φ∩εΓ}
ieIntegerOverflow = 14;{±δΦ°Ωε∞ ΣδΦφφ√Θ Φφ≥σπσ≡}
{Syntax errors - ╤Φφ≥αΩ±Φ≈σ±ΩΦσ}
ieDoNotFound = 30;
ieEndWhileNotFound = 31;
ieSyntax = 40;
ieLeftBrices = 41;
ieRightBrices = 42;
ieLeftBricesSqr = 43;
ieRightBricesSqr = 44;
ieUnknownIdentifer = 45;
ieBadRemark = 46;
ieUnknownLexem = ieSyntax{47};
ieTwoZnaks = 48;
ieSeparatorExpected = 49;{∩≡ε∩≤∙σφ ≡ατΣσδΦ≥σδⁿ(φσ τφαΩ ε∩σ≡α÷ΦΦ !!!!!)}
ieIdentiferExpected = 50;
ieEnd = 51;
ieThenNotFound = 52;
// ieEndWOBegin = 53; {end ßστ begin}
ieEndIfNotFound = 53;
ieElseNotFound = 54;
ieLabelNotFound = 55;
ieLabel = 56;
ieVarDecl = 57;
ieVarDeclName = 58;
ieIdentiferRedeclared = 59;
ieVarDeclNotReal = 60;
ieVarDeclReal = 61;
ieVarDeclUses = 62;{±σΩ÷Φ Uses Σεδµφα ß√≥ⁿ Σε εß· ΓδσφΦ ∩σ≡σ∞σφφ√⌡}
ieBegin = 63;
ieLinks = 64;
ieEndLineExpected = 65;{∩≡ε∩≤∙σφα ';'}
ieIfEndIf = 66;{EndIf ßστ If}
ieAtNotLocal = 67;{∩ε∩√≥Ωα Γτ ≥Φ αΣ≡σ±α φσ ≤ δεΩαδⁿφεΘ ∩σ≡σ∞σφφεΘ}
iePtrNotLocal = 68;{∩ε∩√≥Ωα ±φ ≥Φ ≤Ωατα≥σδ φσ ≤ ≤Ωατα≥σδ }
ieLetNotIdentifer = 69;{∩ε∩√≥Ωα ∩≡Φ±ΓαΦΓαφΦ φσ Γ ΦΣσφ≥Φ⌠ΦΩα≥ε≡}
ieMainNotFound = 70;{φσ φαΘΣσφα ⌠≤φΩ÷Φ main}
ieFuncNotFound = 70;{φσ φαΘΣσφα ⌠≤φΩ÷Φ IInterObject.UnitFunc}
ieEndUnit = 71;{φσ φαΘΣσφ Ωεφσ÷ ∞εΣ≤δ }
ieEndFunc = 72;{φσ φαΘΣσφ Ωεφσ÷ ⌠≤φΩ÷ΦΦ}
ieBadOpCode = 73;{φσ ∩εΣΣσ≡µΦΓασ∞√Θ τφαΩ ε∩σ≡α÷ΦΦ Σδ Σαφφ√⌡ ε∩σ≡αφΣεΓ}
ieUnitNotFound = 74;{φσ φαΘΣσφ ∞εΣ≤δⁿ}
ieConstantExpected = 75;
ieTZExpected = 76;{∩≡ε∩≤∙σφ τφαΩ ';'}
ieExpected = 77;{≈≥ε-≥ε ∩≡ε∩≤∙σφε, α Φ∞σφφε ErrVarName}
ieIdOrConstExpected = 78;{∩≡ε∩≤∙σφ ΦΣσφ≥Φ⌠ΦΩα≥ε≡ ΦδΦ Ωεφ≥±≥αφ≥α}
{Function call errors - ─δ ⌠≤φΩ÷ΦΘ}
ieParams = 81;{φσΓσ≡φ√σ ∩α≡α∞σ≥≡√ Σδ ⌠≤φΩ÷ΦΦ ..}
ieParamTypMistmach = 82;{.. ßεδσσ ΩεφΩ≡σ≥φε}
ieNotEnoughParams = 83;{.. ßεδσσ ΩεφΩ≡σ≥φε}
ieTooManyParams = 84;{.. ßεδσσ ΩεφΩ≡σ≥φε}
ieParam = 85;{.. φσΣε∩≤±≥Φ∞εσ τφα≈σφΦσ ∩α≡α∞σ≥≡α}
// ieLeftBraceExpected = 86;
ieRightBraceExpected = 87;
ieBadStringConst = 88;
(* ieLetExpected = 87; {∩≡ε∩≤∙σφ τφαΩ ∩≡Φ±ΓαΦΓαφΦ ':='}
ieExpExpected = 88; {∩≡ε∩≤∙σφε Γ√≡αµσφΦσ}
*)
ieFuncInFunc = 90;{φσδⁿτ εß·Γδ ≥ⁿ ⌠≤φΩ÷Φ■ Γφ≤≥≡Φ ⌠≤φΩ÷ΦΦ}
implementation
{nothing to implement - this is an interface unit}
end.