Reputation: 136451
I'm using the Documentation Insight feature to document a Delphi library, currently this work fine with Delphi 2005 to XE3. Now I want to add support for old versions of Delphi (5, 6, 7) too.
But when try to compile a code like this in Delphi versions minor than 2005 (Delphi 5, 6, 7)
{$REGION 'Documentation'}
/// <summary>
/// This is a sample text
/// </summary>
{$ENDREGION}
TFoo=class
procedure Tick;
end;
I receive a compiler error
Invalid Compiler Directive REGION
What is fine because the REGION
reserved word was introduced when the Delphi IDE was Changed to Galileo (Delphi 2005).
So, for now as workaround I'm using this syntax in order to compile the code in Delphi 5 - to XE3.
{$IFDEF NODEF}{$REGION 'Documentation'}{$ENDIF}
/// <summary>
/// This is a sample text
/// </summary>
{$IFDEF NODEF}{$ENDREGION}{$ENDIF}
TFoo=class
procedure Tick;
end;
But now using such code the Documentation Insight no longer works in Delphi XE2 and XE3.
So the question is, How i can compile documented Delphi code in older versions of Delphi without affect Documentation Insight in the newer Delphi versions?
Upvotes: 8
Views: 972
Reputation: 652
Documentation Insight support some built-in region styles (see the Options dialog). You may choose Compatible style and it will auto generate directives like {$IFDEF NoDEF}{$REGION 'xxx'}{$ENDIF}.
Upvotes: 0
Reputation: 7394
If you have to have one code base that compiles with no changes in old and new Delphi, this solution won't work.
It's ugly and would have to be done and undone as you move back and forth from an older version of Delphi to a newer one.
But, you could grep your entire project back and forth.
When going from XE2 to D7, for example, you'd convert this
{$REGION 'Documentation'}
by inserting a space and removing the trailing } so it looks like this:
{ $REGION 'Documumentation'
And going from D7 to XE2 you'd do the reverse adding a } at the end of every line that begins with
{$ REGION
and removing the space after the $.
Like I said, it's ugly.
Upvotes: 5
Reputation: 598394
If you get rid of the {$REGION}
tags, Document Insight still works, and older versions should treat the documentation as normal comments. You just won't be able to collapse the documentation anymore in IDE versions that support code folding, that's all.
Upvotes: 7