c J. Wallin 2002 c c A sample code using macros c c To use this code, c 1) type "cpp -P macro.f" This will show c you the effects of the cpp on the file. c c 2) type "cpp -P -Ddebug macro.f" This will show c you the effects of the cpp on the file with c debug defined. c c 3) type "cpp -P -Ddebug macro.f > m.f" to preprocess c with the debug flag and direct the out put to the file c "m.f" c c 4) use the f77 (not the f90) compiler to compile the c code. If you use f90, it gets confused. c #define mult(a,b) ((a)*(b)) #define nsize 30 program test double precision x, y, z c declaration using define real g1(nsize) x = 1 y = 2 c a macro based function z = mult(x,y) c macro based debugging #ifdef debug print*,z #endif call duck(g1) stop end subroutine duck real g(nsize) return end