main
| Line | |
|---|
| 1 | #include "macros.h"
|
|---|
| 2 |
|
|---|
| 3 | C A Fortran program example used for testing that
|
|---|
| 4 | C ABC shall correctly handle C preprocessor directives
|
|---|
| 5 | C defined in Fortran source code.
|
|---|
| 6 | C Directives are used mainly for two purposes:
|
|---|
| 7 | C 1. User-specified conditional compilation
|
|---|
| 8 | C 2. Macro expansion / String substitution
|
|---|
| 9 | C Directives tested here are:
|
|---|
| 10 | C "include", "define", "undef", "if", "ifdef", "ifndef"
|
|---|
| 11 | C "error"
|
|---|
| 12 |
|
|---|
| 13 | program HelloWorld
|
|---|
| 14 | #if NUM_MSG==1
|
|---|
| 15 | print *, MSG_HW
|
|---|
| 16 | #elif NUM_MSG==2
|
|---|
| 17 | print *, MSG_HW
|
|---|
| 18 | print *, MSG_HI, NAME
|
|---|
| 19 | #elif NUM_MSG>=3
|
|---|
| 20 | print *, MSG_HW
|
|---|
| 21 | print *, MSG_HI, NAME
|
|---|
| 22 | #ifdef BYE
|
|---|
| 23 | print *, MSG_BW
|
|---|
| 24 | #undef BYE
|
|---|
| 25 | #endif
|
|---|
| 26 | #ifdef BYE
|
|---|
| 27 | #error "BYE should be undefined."
|
|---|
| 28 | #endif
|
|---|
| 29 | #else
|
|---|
| 30 | print *, MSG_NM
|
|---|
| 31 | #endif
|
|---|
| 32 | end
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.