Forum > General

FPC Compiler Directives Macros... Tips?

<< < (2/3) > >>

avra:
You can make a little code generator to automate this, either native or as a pascal script application.

marcov:

--- Quote from: Leledumbo on November 16, 2014, 06:35:29 pm ---Yes, FPC's preprocessor (I don't think this is the right term, since we don't really have true preprocessor that runs before compilation)

--- End quote ---

(It is. It works on "text" level, not on tree level, which is what the "pre" in preprocessor is, before the compilation step. Doesn't mean the intermediate result must be stored or that the preprocessor must be a different process)

Leledumbo:

--- Quote from: marcov on November 17, 2014, 10:44:36 am ---
--- Quote from: Leledumbo on November 16, 2014, 06:35:29 pm ---Yes, FPC's preprocessor (I don't think this is the right term, since we don't really have true preprocessor that runs before compilation)

--- End quote ---

(It is. It works on "text" level, not on tree level, which is what the "pre" in preprocessor is, before the compilation step. Doesn't mean the intermediate result must be stored or that the preprocessor must be a different process)

--- End quote ---
Mmm...I always thought that "pre" means it happens before lexer-parser works, so it should be a separate process, but since it's interleaved along with lexer and parser, I don't consider it a preprocessor. Just a different interpretation ::)

marcov:

--- Quote from: Leledumbo on November 17, 2014, 10:58:49 am ---
--- Quote from: marcov on November 17, 2014, 10:44:36 am ---
--- Quote from: Leledumbo on November 16, 2014, 06:35:29 pm ---Yes, FPC's preprocessor (I don't think this is the right term, since we don't really have true preprocessor that runs before compilation)

--- End quote ---

(It is. It works on "text" level, not on tree level, which is what the "pre" in preprocessor is, before the compilation step. Doesn't mean the intermediate result must be stored or that the preprocessor must be a different process)

--- End quote ---
Mmm...I always thought that "pre" means it happens before lexer-parser works

--- End quote ---

That is correct. Basically compilation in my remark is lexer-parse-semantic-codegen-optimization-results writeout.

Before the lexer it is still text.


--- Quote --- so it should be a separate process,

--- End quote ---

I meant process on OS level, as in separate EXE.


--- Quote ---but since it's interleaved along with lexer and parser, I don't consider it a preprocessor.

Just a different interpretation ::)

--- End quote ---

I consider the integration an optimization. Since we can't have an external preprocessor the way C has due to the module system, it is a sane one.

So that leaves manual preprocessing, which specially in cases like this isn't so bad, since you can also check in the preprocessed result that one time you modify the header. It probably won't be the case that it changes so often that automatic preprocessing via the compiler is worthwhile.

trn76:

--- Quote from: avra on November 17, 2014, 10:13:43 am ---You can make a little code generator to automate this, either native or as a pascal script application.

--- End quote ---
You where thinking offline? How would I do this, and with what...?
I'm thinking it would be cool, but too much hassel - it should have been integrated in Lazarus or else it is easy to mess up.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version