ISPP.Base.pas 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {
  2. Inno Setup Preprocessor
  3. Copyright (C) 2001-2002 Alex Yackimoff
  4. Inno Setup
  5. Copyright (C) 1997-2010 Jordan Russell
  6. Portions by Martijn Laan
  7. For conditions of distribution and use, see LICENSE.TXT.
  8. }
  9. unit ISPP.Base;
  10. interface
  11. uses ISPP.Intf, SysUtils;
  12. type
  13. ICallContext = interface;
  14. PIsppVariant = ^TIsppVariant;
  15. TIsppVariant = record
  16. Typ: TIsppVarType;
  17. AsStr: string;
  18. AsCallContext: ICallContext;
  19. case TIsppVarType of
  20. evInt: (AsInt: Int64);
  21. evLValue: (AsPtr: PIsppVariant);
  22. end;
  23. TIsppParamFlags = set of (pfTypeDefined, pfHasDefault, pfByRef, pfFunc);
  24. TIsppMacroParam = record
  25. Name: string;
  26. ParamFlags: TIsppParamFlags;
  27. DefValue: TIsppVariant;
  28. end;
  29. PParamList = ^TParamList;
  30. TParamList = array[Byte] of TIsppMacroParam;
  31. TArgGroupingStyle = (agsNone, agsParenteses, agsBrackets, agsBraces);
  32. ICallContext = interface
  33. procedure Add(const Name: string; const Value: TIsppVariant);
  34. function Call: TIsppVariant;
  35. function GroupingStyle: TArgGroupingStyle;
  36. procedure Clone(out NewContext: ICallContext);
  37. end;
  38. TIdentType = (itUnknown, itVariable, itMacro, itFunc, itDefinedFunc,
  39. itTypeOfFunc, itDimOfFunc);
  40. IIdentManager = interface
  41. function GetIdent(const Name: string; out CallContext: ICallContext): TIdentType;
  42. function Defined(const Name: string): Boolean;
  43. function TypeOf(const Name: string): Byte;
  44. function DimOf(const Name: string): Integer;
  45. end;
  46. function GetOption(const Options: TOptions; Option: Char): Boolean;
  47. procedure SetOption(var Options: TOptions; Option: Char; Value: Boolean);
  48. implementation
  49. function GetOption(const Options: TOptions; Option: Char): Boolean;
  50. begin
  51. Result := (Ord(UpCase(Option)) - Ord('A')) in Options
  52. end;
  53. procedure SetOption(var Options: TOptions; Option: Char; Value: Boolean);
  54. begin
  55. if Value then
  56. Include(Options, Ord(UpCase(Option)) - Ord('A'))
  57. else
  58. Exclude(Options, Ord(UpCase(Option)) - Ord('A'))
  59. end;
  60. end.