forked from jrsoftware/issrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIsppBase.pas
79 lines (60 loc) · 2.02 KB
/
IsppBase.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
Inno Setup Preprocessor
Copyright (C) 2001-2002 Alex Yackimoff
Inno Setup
Copyright (C) 1997-2010 Jordan Russell
Portions by Martijn Laan
For conditions of distribution and use, see LICENSE.TXT.
}
unit IsppBase;
interface
uses IsppIntf, SysUtils;
type
ICallContext = interface;
PIsppVariant = ^TIsppVariant;
TIsppVariant = record
Typ: TIsppVarType;
AsStr: string;
AsCallContext: ICallContext;
case TIsppVarType of
evInt: (AsInt: Int64);
evLValue: (AsPtr: PIsppVariant);
end;
TIsppParamFlags = set of (pfTypeDefined, pfHasDefault, pfByRef, pfFunc);
TIsppMacroParam = record
Name: string;
ParamFlags: TIsppParamFlags;
DefValue: TIsppVariant;
end;
PParamList = ^TParamList;
TParamList = array[Byte] of TIsppMacroParam;
TArgGroupingStyle = (agsNone, agsParenteses, agsBrackets, agsBraces);
ICallContext = interface
procedure Add(const Name: string; const Value: TIsppVariant);
function Call: TIsppVariant;
function GroupingStyle: TArgGroupingStyle;
procedure Clone(out NewContext: ICallContext);
end;
TIdentType = (itUnknown, itVariable, itMacro, itFunc, itDefinedFunc,
itTypeOfFunc, itDimOfFunc);
IIdentManager = interface
function GetIdent(const Name: string; out CallContext: ICallContext): TIdentType;
function Defined(const Name: string): Boolean;
function TypeOf(const Name: string): Byte;
function DimOf(const Name: string): Integer;
end;
function GetOption(const Options: TOptions; Option: Char): Boolean;
procedure SetOption(var Options: TOptions; Option: Char; Value: Boolean);
implementation
function GetOption(const Options: TOptions; Option: Char): Boolean;
begin
Result := (Ord(UpCase(Option)) - Ord('A')) in Options
end;
procedure SetOption(var Options: TOptions; Option: Char; Value: Boolean);
begin
if Value then
Include(Options, Ord(UpCase(Option)) - Ord('A'))
else
Exclude(Options, Ord(UpCase(Option)) - Ord('A'))
end;
end.