| 1 | #include <stdio.h> |
| 2 | |
| 3 | #define SPLICE(a, b) INNER_SPLICE(a, b) |
| 4 | #define INNER_SPLICE(a, b) a ## b |
| 5 | #define STRINGIFY(a) INNER_STRINGIFY(a) |
| 6 | #define INNER_STRINGIFY(a) #a |
| 7 | |
| 8 | /* A macro named UNTIL_<func> is #defined until just before the |
| 9 | definition of the function <func>. |
| 10 | |
| 11 | A macro named BEFORE_<func> is not #defined until just before the |
| 12 | definition of <func>. |
| 13 | |
| 14 | The macro WHERE is redefined before each function <func> to the |
| 15 | token list ``before <func>''. |
| 16 | |
| 17 | The macscp IN_MACSCP2_H and IN_MACSCP3_H are defined while |
| 18 | processing those header files; macscp4.h uses them to choose |
| 19 | appropriate function names, output strings, and macro definitions. */ |
| 20 | |
| 21 | #define UNTIL_MACSCP1_1 |
| 22 | #define UNTIL_MACSCP2_1 |
| 23 | #define UNTIL_MACSCP4_1_FROM_MACSCP2 |
| 24 | #define UNTIL_MACSCP4_2_FROM_MACSCP2 |
| 25 | #define UNTIL_MACSCP2_2 |
| 26 | #define UNTIL_MACSCP1_2 |
| 27 | #define UNTIL_MACSCP3_1 |
| 28 | #define UNTIL_MACSCP4_1_FROM_MACSCP3 |
| 29 | #define UNTIL_MACSCP4_2_FROM_MACSCP3 |
| 30 | #define UNTIL_MACSCP3_2 |
| 31 | #define UNTIL_MACSCP1_3 |
| 32 | |
| 33 | #define WHERE before macscp1_1 |
| 34 | #define BEFORE_MACSCP1_1 |
| 35 | #undef UNTIL_MACSCP1_1 |
| 36 | void |
| 37 | macscp1_1 () |
| 38 | { |
| 39 | puts ("macscp1_1"); |
| 40 | } |
| 41 | |
| 42 | #include "macscp2.h" |
| 43 | |
| 44 | #undef WHERE |
| 45 | #define WHERE before macscp1_2 |
| 46 | #define BEFORE_MACSCP1_2 |
| 47 | #undef UNTIL_MACSCP1_2 |
| 48 | void |
| 49 | macscp1_2 () |
| 50 | { |
| 51 | puts ("macscp1_2"); |
| 52 | } |
| 53 | |
| 54 | #include "macscp3.h" |
| 55 | |
| 56 | #undef WHERE |
| 57 | #define WHERE before macscp1_3 |
| 58 | #define BEFORE_MACSCP1_3 |
| 59 | #undef UNTIL_MACSCP1_3 |
| 60 | void |
| 61 | macscp1_3 () |
| 62 | { |
| 63 | puts ("macscp1_3"); |
| 64 | } |
| 65 | |
| 66 | int |
| 67 | main (int argc, char **argv) |
| 68 | { |
| 69 | macscp1_1 (); |
| 70 | macscp2_1 (); |
| 71 | macscp4_1_from_macscp2 (); |
| 72 | macscp4_2_from_macscp2 (); |
| 73 | macscp2_2 (); |
| 74 | macscp1_2 (); |
| 75 | macscp3_1 (); |
| 76 | macscp4_1_from_macscp3 (); |
| 77 | macscp4_2_from_macscp3 (); |
| 78 | macscp3_2 (); |
| 79 | macscp1_3 (); |
| 80 | } |