Automatic removal of Delphi IFDEf compiler directives

I am currently working with “legacy” code that (randomly scattered throughout) contains a bunch of conditional compilers based on the Delphi version, returning to Delphi 2. From now on, all development will be with Delphi 2009 or the future. Is there a tool or plugin in Delphi 2009 that automatically deletes compiler conditional code segments based on the specified "minimum" version?

+3
source share
5 answers

I highly recommend the Delphi Inspiration Pascal Preprocessor (DIPP)

This can do several things with the source file in addition to deleting conditional definitions, including “pasting” the included files and deleting comments (all, of course, very customizable and controlled by the parameters provided by the processor).

Functional conditional definitions are especially useful since you can simply remove all such conditional expressions or provide the DEFINE set that you want to apply. DIPP then emits the source file, which reflects how it will appear to the compiler with these DEFINED characters, but without the conditional directives themselves.

So, in your case, you just defined the characters that correspond to your "baseline" version of Delphi.

+6
source

JEDI PreProcessor (Pascal PreProcessor) JCL .

SVN jcl/devtools/jpp (2.1) zip- jpp.exe dir devtools.

+4

, , .

  • FindFirst FindNext
  • TStringList.LoadFromFile pas.
  • {$IfDef}. , , D2009, {$EndIf}.
  • TStringList.SaveToFile .
+1

, . , , , IFDEF, . IFDEF VERxxx, , VER70UP . include, {$ I???. INC} , , .

$DEFINE/$UNDEF , , ... , .

+1

GExperts, GrepSearch GrepRegularExpressions , "" GrepResults , .

/. , , . , , - IDE. .

0

Source: https://habr.com/ru/post/1727859/


All Articles