aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md34
1 files changed, 27 insertions, 7 deletions
diff --git a/README.md b/README.md
index 571ff7b..08fce62 100644
--- a/README.md
+++ b/README.md
@@ -76,7 +76,33 @@ and go get it!
this sort of thing can be useful in devops land.
-## How about systems that have `awk` but no `cpp`?
+8. `cppawk` has a `--prepro-only` option to generate the preprocessed
+ Awk program on standard output rather than execute it. This is useful
+ in several ways:
+ * debugging the inclusion process;
+ * preprocessing code on a machine with `cpp` to execute it on a system
+ which has no `cpp`.
+ * conditionally generating multiple programs from a single source
+ based on preprocessor symbols passed in via `-D` arguments.
+
+## But GNU Awk has `@include`?
+
+* GNU Awk's `@include` isn't a full preprocessor. There are no conditional
+ expressions, and no macros.
+
+* It is only implemented in GNU Awk.
+
+* It provides no way to capture all the included output.
+
+* The way `@include` searches for files is inferior to `cpp`. GNU Awk's include
+ search is driven by the `AWKPATH` variable which brings in all the
+ disadvantages shared by shared by `PATH`-like variables.
+ In contrast `cpp` implements the familiar behavior that an `#include "..."`
+ directive is resolved relative to the directory of the file which contains
+ that `#include` directive. No configuration is required for a program
+ to find all of its included pieces.
+
+## What about systems that have `awk` but no `cpp`?
`cppawk` is used directly on systems that have `cpp`, as if
it were an Awk implementation.
@@ -85,9 +111,3 @@ it were an Awk implementation.
which can be captured and transferred to a system that has no
preprocessor installed, such as an embedded board that has
BusyBox Awk.
-
-Of course, capturing the preprocessed output has other uses.
-It's possible to generate different versions of an Awk program
-by using `cppawk --prepro-only` in conjunction with conditional
-preprocessing which reacts to different values of a macro defined
-on the command line via `-D`.