[fpc-pascal] Proper preprocessor?

Michael Van Canneyt michael at freepascal.org
Fri Jun 22 12:04:45 CEST 2018



On Fri, 22 Jun 2018, denisgolovan wrote:

>> Do you have examples here?
>
> There are several use-cases I often see.
>
> 1. The task is to allow declaration of some container structure (vector, tree, etc.)
> 2. Meta declarations for global entities with names/ids/descriptions/etc. 
> 3. Dynamic libraries exports.
> 4. Published functions/classes/ into interpreted languages
>
> That's more or less it. 
> At least those I quickly gathered from real project.

All these use cases I also have. But I use code generators for this.
The source does not need to be pascal (although it can be). 
It just needs some structured format, from which Pascal code is then generated.

Currently I employ code generators (written in pascal) that start from XML, JSON, 
IDL, or datasets (and in some limited cases pascal code). 
They generate the target code, plus unit test testsuites.

using fcl-passrc it is really easy to generate bindings for e.g. lua or any
other embedded pascal scripting tool.

Michael.



More information about the fpc-pascal mailing list