diff options
author | Paul A. Patience <paul@apatience.com> | 2022-07-01 23:44:25 -0400 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-07-02 17:02:47 -0700 |
commit | e70a3d3728b24b72435661f893f1e2e5161a8382 (patch) | |
tree | 414d983f938d7c96ad33e6f9e8ad2a102e4abf4d | |
parent | da98d5314731206cd03038d589d10c5c32a0ce8c (diff) | |
download | cppawk-e70a3d3728b24b72435661f893f1e2e5161a8382.tar.gz cppawk-e70a3d3728b24b72435661f893f1e2e5161a8382.tar.bz2 cppawk-e70a3d3728b24b72435661f893f1e2e5161a8382.zip |
README: fix some typos.
-rw-r--r-- | README.md | 31 |
1 files changed, 16 insertions, 15 deletions
@@ -1,14 +1,14 @@ ## What is `cppawk`? `cppawk` is a tiny shell script that is used like `awk`. It invokes -the C preprocessor (GNU `cpp`) on the Awk code and calls `gawk`. +the C preprocessor (GNU `cpp`) on the Awk code and calls Awk on the result. `cppawk` understands the basic Awk options like `-F` and `-v`, and also -understand common `cpp` options like `-I` and `-Dmacro=value`. +understands common `cpp` options like `-I` and `-Dmacro=value`. The [`cppawk` man page](../tree/cppawk.1) describes all the invocation and usage details. -For instance, if we define a file called `awkloop.h` which has these contents +For instance, if we define a file called `awkloop.h` which has these contents: :::c #define awkloop(file) for (; getline < file > 0 || (close(file) && 0); ) @@ -32,12 +32,12 @@ Then this sort of code is possible: main() } -We have implemented a facsimile of an Awk input scanning loop inside a function -with a bit of syntactic sugar. However, this these few preprocessing directives -are just a toy example, compared to what is provided in the `cppawk` standard +We have implemented a facsimile of an Awk input-scanning loop inside a function +with a bit of syntactic sugar. However, these few preprocessing directives are +just a toy example, compared to what is provided in the `cppawk` standard headers. -`cppawk` has low dependencies. It's written in shell, and makes use of the +`cppawk` has few dependencies. It's written in shell, and makes use of the `sed` and `printf` utilities. Preprocessed programs can be captured and transferred for execution to systems that have Awk but do not have a preprocessor. @@ -91,8 +91,8 @@ expressive, not to mention **user-definable** classes using a preprocessor that is famous for lacking power? It turns out that a significant part of the problem with C preprocessing is the -back-end languages being targeted. The C and C++ languages rob their -preprocessing front-end of its full power. C macros in the context of the +backend languages being targeted. The C and C++ languages rob their +preprocessing frontend of its full power. C macros in the context of the "home language" have to contend with syntactic roadblocks, such as identifiers having to be declared before use. Because Awk is a flexibly typed language in which variables don't have to be declared, it creates opportunities for @@ -103,12 +103,12 @@ preprocessor were tailor-made for Awk. ## Roadmap -`cppawk` is been carefully developed, and has a regression test suite. +`cppawk` has been carefully developed, and has a regression test suite. Nearly every feature and fix was developed by first writing one or more failing tests and getting them to pass. The script is stable and nearly feature-complete, since it is out of the project scope to modify Awk or the C preprocessor. The remaining work is likely solving portability -issues, like using with different implementations of the C preprocessor. +issues, like using different implementations of the C preprocessor. Among future directions for `cppawk` is the development of a small library of useful standard headers. The foundation has been laid for @@ -125,6 +125,7 @@ There are currently efficient but portable code. Additionally, the `case` statement requires clauses to be explicit about whether they fall through or break, which makes it safer to use. + * [`<narg.h>`](../tree/cppawk-narg.1): provides useful primitives for easily writing variadic macros. @@ -168,7 +169,7 @@ Several unreleased headers are in the development queue: * You can organize an Awk program into a tree of files that the preprocessor "compiles" into a single "executable". -* You can use macros for C-style meta-programming, and for conditional +* You can use macros for C-style metaprogramming, and for conditional selection of code. * Powerful library: list manipulation, iteration, variadic functions. @@ -196,15 +197,15 @@ Several unreleased headers are in the development queue: `@include` syntax. It reacts to an `AWKPATH` environment variable which has no provision for referencing relative to the location of the parent file. -* `@include` requires, syntactically, a string-literal-like specification +* `@include` requires, syntactically, a string-literal–like specification of the path name to be included. An expression is not allowed. For - instance, if a GNU Awk program cannot do this: + instance, a GNU Awk program cannot do this: ::awk self = calculate_own_path_somehow(); @include self "lib/util" # error - By contrast `cppawk` program just does this: + By contrast, a `cppawk` program just does this: ::c #include "lib/util" // no problem |