Question

Is there a macro preprocessor for Delphi 7?

There isn't one built in so maybe there's a possibilty to use a third party or some other languages preprocessor (like c preprocessor).

If there's one, how to set it up for Delphi 7?

I'm trying to do function inlining (for speed). Macro preprocessor seems to be the only easy option for delphi.

Thanks, Egon

Was it helpful?

Solution

You can always run an external macro processor, such as m4 or even (shudder) cpp on your code before you compile it. I wouldn't recommend this however - in my experience the benefits of inlining (which is what you seem to want to do) are quite small, and can be offset by slowdowns caused increases in code size.

OTHER TIPS

Here's how I used m4:

// uses lookup for counting bits
function PopCount(const Number: Cardinal): Byte;
begin
  Result := WordBitCount[Number and $FFFF] + WordBitCount[Number shr 16];
end;
{ M4 macro
define(PopCount, (WordBitCount[$@ and $FFFF] + WordBitCount[$@ shr 16]))
}

It's still easily compilable, but can be sped up with m4.

You can use the [JEDI Pascal Preprocessor](JEDI Pascal PreProcessor) which is part of the JEDI Code Library.

You can fetch the current JCL release from its SourceForge project page, and you can browse the JPP course code here.

I haven't heard of any third-party macros in Delphi 7, but versions 2007+ have automatic inlining if that's an option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top