Shared.PreprocInt.pas 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. unit Shared.PreprocInt;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2024 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. Compiler preprocessor interface used by ISCmplr and ISPP
  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. TPreprocIdleProc = procedure(CompilerData: TPreprocCompilerData); stdcall;
  40. PPreprocessScriptParams = ^TPreprocessScriptParams;
  41. TPreprocessScriptParams = record
  42. Size: Cardinal; { [in] Set to SizeOf(TPreprocessScriptParams).
  43. Preprocessor must return ispeInvalidParam
  44. if value is not recognized. }
  45. InterfaceVersion: Cardinal; { [in] Currently set to 3.
  46. Preprocessor must return ispeInvalidParam
  47. if value is not recognized. }
  48. CompilerBinVersion: Cardinal; { [in] Compiler version as an integer }
  49. Filename: PChar; { [in] The full name of the file being
  50. preprocessed, or an empty string if
  51. preprocessing the main script. }
  52. SourcePath: PChar; { [in] The default source directory, and
  53. directory to look in for #include files.
  54. Normally, this is the directory containing
  55. the script file. }
  56. CompilerPath: PChar; { [in] The "compiler:" directory. This is
  57. the directory which contains the *.e32
  58. files. }
  59. Options: PChar; { [in] The 'ISPP:'-prefixed options that
  60. were passed to the compiler in
  61. TCompileScriptParamsEx.Options. }
  62. CompilerData: TPreprocCompilerData; { [in] Opaque value supplied by the
  63. compiler that the preprocessor must
  64. pass unchanged when calling the
  65. *Proc callback functions. }
  66. LoadFileProc: TPreprocLoadFileProc;
  67. { [in] Call to load a new file. Returns
  68. a "handle" to the file which can be
  69. passed to LineInProc. On failure,
  70. returns -1 and internally calls
  71. ErrorProc with a description of the
  72. error. }
  73. LineInProc: TPreprocLineInProc; { [in] Call to read a line from the
  74. specified file. LineIndex is
  75. zero-based. The returned pointer is
  76. valid only until the next LineInProc
  77. call is made (or the preprocess
  78. function returns). NULL is returned
  79. if EOF is reached. }
  80. LineOutProc: TPreprocLineOutProc; { [in] Call to send preprocessed
  81. line back to the compiler. }
  82. StatusProc: TPreprocStatusProc; { [in] Call to log a message. }
  83. ErrorProc: TPreprocErrorProc; { [in] Call to report an error. }
  84. PrependDirNameProc: TPreprocPrependDirNameProc;
  85. { [in] If the specified filename is
  86. relative, prepends the specified
  87. directory name (must include trailing
  88. path separator). If the specified
  89. filename begins with a prefix, such
  90. as "compiler:", expands the prefix.
  91. The returned pointer is valid only
  92. until the next PrependDirNameProc
  93. call is made (or the preprocess
  94. function returns). On failure,
  95. returns NULL and internally calls
  96. ErrorProc with a description of the
  97. error.}
  98. IdleProc: TPreprocIdleProc; { [in] Call at various intervals during
  99. preprocessing. Doesn't allow an Abort
  100. by the host. }
  101. PreprocCleanupProc: TPreprocCleanupProc;
  102. { [out] Preprocessor-defined function
  103. that, if set, is called after
  104. compilation completes or is aborted.
  105. Note: This function will still be
  106. called if the preprocess function
  107. returns a non-ispeSuccess value. }
  108. PreprocCleanupProcData: Pointer; { [out] Preprocessor-defined value
  109. passed to PreprocCleanupProc. }
  110. end;
  111. TPreprocessScriptProc = function(var Params: TPreprocessScriptParams): Integer;
  112. stdcall;
  113. implementation
  114. end.