Software Archive
Read-only legacy content
Annonces
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Defines and FPP

Intel_C_Intel
Employé
813 Visites
Is there a way to do text substitution similar to a #define in C++? For example in C++,
#define somevar someothervar
replaces all instances of somevar with the string someothervar. Trying the same thing in Fortran seems to have no effect.
The documentation for FPP says ?FPP is a modified version of the ANSI C preprocessor and supports ? #define , #elif, #else, ??. Is preprocessor text substitution possible in Fortran?
0 Compliments
5 Réponses
Steven_L_Intel1
Employé
813 Visites
In the Fortran Project Options, change /fpp to /fpp:"/m" to enable macro substitution.

Steve
0 Compliments
Intel_C_Intel
Employé
813 Visites
Thanks Steve. That works well in the source file. It doesn't work if the #define occurs in an included file. Is this supported?
0 Compliments
Steven_L_Intel1
Employé
813 Visites
It is if you use #include. fpp doesn't process Fortran INCLUDE.

Steve
0 Compliments
Intel_C_Intel
Employé
813 Visites
Thanks Steve. This works well until you have an array index, e.g.:
type(sometype) somevar
#define myindex somevar.myindex

integer someArray(5), i
...
myindex = 5
i = someArray(myindex)

The first instance of myindex is substitued nicely, but the second instance (used as the index of someArray) doesn't get substituted.
Any way to do this? The command line help for fpp doesn't seem to mention anything.

Thanks,
Brad
0 Compliments
Steven_L_Intel1
Employé
813 Visites
Please send an example to vf-support@compaq.com - our fpp expert (not me!) will look at it.

Steve
0 Compliments
Répondre