CompPreprocInt.pas 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. unit CompPreprocInt;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2020 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. Compiler preprocessor interface
  8. }
  9. interface
  10. uses
  11. Windows;
  12. const
  13. ispeSuccess = 0;
  14. ispeInvalidParam = 1;
  15. ispePreprocessError = 2;
  16. ispeSilentAbort = 3;
  17. type
  18. TPreprocCompilerData = type Pointer;
  19. TPreprocFileHandle = type Integer;
  20. TPreprocLoadFileProc =
  21. function(CompilerData: TPreprocCompilerData; Filename: PChar;
  22. ErrorFilename: PChar; ErrorLine: Integer;
  23. ErrorColumn: Integer): TPreprocFileHandle; stdcall;
  24. TPreprocLineInProc =
  25. function(CompilerData: TPreprocCompilerData; FileHandle: TPreprocFileHandle;
  26. LineIndex: Integer): PChar; stdcall;
  27. TPreprocLineOutProc =
  28. procedure(CompilerData: TPreprocCompilerData; LineFilename: PChar;
  29. LineNumber: Integer; LineText: PChar); stdcall;
  30. TPreprocErrorProc =
  31. procedure(CompilerData: TPreprocCompilerData; ErrorMsg: PChar;
  32. ErrorFilename: PChar; ErrorLine: Integer; ErrorColumn: Integer); stdcall;
  33. TPreprocStatusProc =
  34. procedure(CompilerData: TPreprocCompilerData; StatusMsg: PChar; Warning: BOOL); stdcall;
  35. TPreprocPrependDirNameProc =
  36. function(CompilerData: TPreprocCompilerData; Filename: PChar; Dir: PChar;
  37. ErrorFilename: PChar; ErrorLine: Integer; ErrorColumn: Integer): PChar; stdcall;
  38. TPreprocCleanupProc = function(CleanupProcData: Pointer): Integer; stdcall;
  39. PPreprocessScriptParams = ^TPreprocessScriptParams;
  40. TPreprocessScriptParams = record
  41. Size: Cardinal; { [in] Set to SizeOf(TPreprocessScriptParams).
  42. Preprocessor must return ispeInvalidParam
  43. if value is not recognized. }
  44. InterfaceVersion: Cardinal; { [in] Currently set to 2.
  45. Preprocessor must return ispeInvalidParam
  46. if value is not recognized. }
  47. CompilerBinVersion: Cardinal; { [in] Compiler version as an integer }
  48. Filename: PChar; { [in] The full name of the file being
  49. preprocessed, or an empty string if
  50. preprocessing the main script. }
  51. SourcePath: PChar; { [in] The default source directory, and
  52. directory to look in for #include files.
  53. Normally, this is the directory containing
  54. the script file. }
  55. CompilerPath: PChar; { [in] The "compiler:" directory. This is
  56. the directory which contains the *.e32
  57. files. }
  58. Options: PChar; { [in] The 'ISPP:'-prefixed options that
  59. were passed to the compiler in
  60. TCompileScriptParamsEx.Options. }
  61. CompilerData: TPreprocCompilerData; { [in] Opaque value supplied by the
  62. compiler that the preprocessor must
  63. pass unchanged when calling the
  64. *Proc callback functions. }
  65. LoadFileProc: TPreprocLoadFileProc;
  66. { [in] Call to load a new file. Returns
  67. a "handle" to the file which can be
  68. passed to LineInProc. On failure,
  69. returns -1 and internally calls
  70. ErrorProc with a description of the
  71. error. }
  72. LineInProc: TPreprocLineInProc; { [in] Call to read a line from the
  73. specified file. LineIndex is
  74. zero-based. The returned pointer is
  75. valid only until the next LineInProc
  76. call is made (or the preprocess
  77. function returns). NULL is returned
  78. if EOF is reached. }
  79. LineOutProc: TPreprocLineOutProc; { [in] Call to send preprocessed
  80. line back to the compiler. }
  81. StatusProc: TPreprocStatusProc; { [in] Call to log a message. }
  82. ErrorProc: TPreprocErrorProc; { [in] Call to report an error. }
  83. PrependDirNameProc: TPreprocPrependDirNameProc;
  84. { [in] If the specified filename is
  85. relative, prepends the specified
  86. directory name (must include trailing
  87. path separator). If the specified
  88. filename begins with a prefix, such
  89. as "compiler:", expands the prefix.
  90. The returned pointer is valid only
  91. until the next PrependDirNameProc
  92. call is made (or the preprocess
  93. function returns). On failure,
  94. returns NULL and internally calls
  95. ErrorProc with a description of the
  96. error.}
  97. PreprocCleanupProc: TPreprocCleanupProc;
  98. { [out] Preprocessor-defined function
  99. that, if set, is called after
  100. compilation completes or is aborted.
  101. Note: This function will still be
  102. called if the preprocess function
  103. returns a non-ispeSuccess value. }
  104. PreprocCleanupProcData: Pointer; { [out] Preprocessor-defined value
  105. passed to PreprocCleanupProc. }
  106. end;
  107. TPreprocessScriptProc = function(var Params: TPreprocessScriptParams): Integer;
  108. stdcall;
  109. implementation
  110. end.