October 2024
Intermediate to advanced
272 pages
6h 54m
English
m4 macros can function as global variables when expanded without arguments or as functions when arguments are provided. In both cases, m4 can use the existence of a macro to control program execution flow.
The built-in macro ifdef(name,true_string,false_string) tests if the macro name is defined and expands to true_string or false_string, depending on the outcome.
With this macro, you can reorganize the code fragment to focus on the decision (ACCEPT vs. REJECT) and define the MOOD and STATUS appropriately.
| | divert(-1) |
| | define(`AUTHOR', Alice) |
| | define(`MANUSCRIPT', My Friend Bob) |
| | |
| | # The status of the manuscript |
| | define(`ACCEPT') |
| | define(`MOOD', ifdef(`ACCEPT',happy,sorry)) ... |
Read now
Unlock full access