|
| 1 | +#define TOKEN_CAT_(X, Y) X##Y |
| 2 | +#define TOKEN_CAT(X, Y) TOKEN_CAT_(X, Y) |
| 3 | + |
| 4 | +#define DONE_NODE(id) { id [label="Done.", style=filled, fillcolor=green, shape=box, color=green, fontcolor=white]; } |
| 5 | +#define ILL_FORMED_NODE(id) { id [label="The program is ill-formed.", shape=box, style=filled, color=red, fontcolor=white]; } |
| 6 | +#define RECURSE_NODE(id) { id [label="Recurse with the new initialization.", shape=box, style=filled, color=blue, fontcolor=white]} |
| 7 | + |
| 8 | +#define NEW_DONE() { DONE_NODE(TOKEN_CAT(__local_done_, __COUNTER__)); } |
| 9 | +#define NEW_ILL_FORMED() { ILL_FORMED_NODE(TOKEN_CAT(__local_ill_formed_, __COUNTER__)); } |
| 10 | +#define NEW_RECURSE() { RECURSE_NODE(TOKEN_CAT(__local_recurse, __COUNTER__)); } |
| 11 | +#define INTERNALLY_RECURSES(id) { id -> { RECURSE_NODE(TOKEN_CAT(id, __recurse)); } [style="dotted"]; } |
| 12 | + |
| 13 | +// Arguments: name of source node, optional edge attrs. |
| 14 | +#define LINK_TO_DONE(id, ...) { id -> { DONE_NODE(TOKEN_CAT(id, __generated_done)); } __VA_ARGS__; } |
| 15 | +#define LINK_TO_ILL_FORMED(id, ...) { id -> { ILL_FORMED_NODE(TOKEN_CAT(id, __generated_ill_formed)); } __VA_ARGS__; } |
| 16 | + |
| 17 | +// Arguments: name, description (string literal), optional citation. |
| 18 | +#define QUESTION_NODE(id, text, ...) { id [shape=diamond, label=text __VA_OPT__(+ "\n" +) __VA_ARGS__]; } |
| 19 | +#define INSTRUCTION_NODE(id, text, ...) { id [shape=box, label=text __VA_OPT__(+ "\n" +) __VA_ARGS__]; } |
| 20 | + |
| 21 | +// Arguments: name, description (string literal), citation (string literal), yes node ID, no node ID. |
| 22 | +#define YN_QUESTION_NODE(id, text, cite, yes_id, no_id) { \ |
| 23 | + QUESTION_NODE(id, text, cite); \ |
| 24 | + id -> yes_id [label="Yes"]; \ |
| 25 | + id -> no_id [label="No"]; \ |
| 26 | +} |
| 27 | + |
| 28 | +// Arguments: name, description (string literal), citation (string literal), yes node ID, no node ID. |
| 29 | +#define YN_QUESTION_NODE_NO_CITE(id, text, yes_id, no_id) { \ |
| 30 | + QUESTION_NODE(id, text); \ |
| 31 | + id -> yes_id [label="Yes"]; \ |
| 32 | + id -> no_id [label="No"]; \ |
| 33 | +} |
| 34 | + |
| 35 | +#define INIT_AS_FOLLOWS(id, ...) { INSTRUCTION_NODE(id, "The object is initialized as follows:", __VA_ARGS__); } |
| 36 | + |
| 37 | +#define LOOP_BACKEDGE(source, loop_header) { source -> loop_header [style="dashed", constraint="true"]; } |
0 commit comments