Software Archive
Read-only legacy content
공지
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.

Defines and FPP

Intel_C_Intel
직원
818 조회수
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 포인트
5 응답
Steven_L_Intel1
818 조회수
In the Fortran Project Options, change /fpp to /fpp:"/m" to enable macro substitution.

Steve
0 포인트
Intel_C_Intel
직원
818 조회수
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 포인트
Steven_L_Intel1
818 조회수
It is if you use #include. fpp doesn't process Fortran INCLUDE.

Steve
0 포인트
Intel_C_Intel
직원
818 조회수
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 포인트
Steven_L_Intel1
818 조회수
Please send an example to vf-support@compaq.com - our fpp expert (not me!) will look at it.

Steve
0 포인트
응답