aboutsummaryrefslogtreecommitdiffstats
path: root/cppawk-case.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-03-29 22:35:07 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-03-29 22:35:07 -0700
commit0e0f84f24a0e2abd3e01008fb6f411cdfaee205d (patch)
tree71663454893fedcaaa296db8b2bebc1bde47fc7b /cppawk-case.1
parentde1edfb63a874d62fee0a3bfe176712d48c4927b (diff)
downloadcppawk-0e0f84f24a0e2abd3e01008fb6f411cdfaee205d.tar.gz
cppawk-0e0f84f24a0e2abd3e01008fb6f411cdfaee205d.tar.bz2
cppawk-0e0f84f24a0e2abd3e01008fb6f411cdfaee205d.zip
Fix misuses of formatting macros in man pages.
Diffstat (limited to 'cppawk-case.1')
-rw-r--r--cppawk-case.166
1 files changed, 33 insertions, 33 deletions
diff --git a/cppawk-case.1 b/cppawk-case.1
index 9fd33f3..f3496b0 100644
--- a/cppawk-case.1
+++ b/cppawk-case.1
@@ -27,45 +27,45 @@ case \- macro for portable switch statement
.SH DESCRIPTION
The
-.BI case
+.B case
macro provides syntax which
-.B cppawk
+.I cppawk
translates very directly to the GNU Awk
-.BI switch
+.B switch
statement, or else to alternative code which works with other Awk implementations.
The purpose of the macro is easy conversion of
-.BI switch
+.B switch
code; therefore, it has the same semantics with regard to fall through between
cases, requiring an explicit break.
The clauses of
-.BI case
+.B case
are labeled with the identifiers
-.BI of,
-.BI matching,
+.BR of ,
+.BR matching ,
or
-.BI mixed
+.BR mixed ,
which take arguments, and are followed by one or more statements. The last one
of those statements must always be a
-.BI cbreak,
-.BI cfall
+.BR cbreak ,
+.B cfall
or
-.BI cret
+.B cret
statement, described below.
Regular expression keys must use the
-.BI matching
+.B matching
label; ordinary keys compared for equality must use the
-.BI of
+.B of
label. The
-.BI mixed
+.B mixed
label allows for both keys to be included in one case.
The
-.BI of
+.B of
and
-.BI matching
+.B matching
macros take variable arguments. Multiple matching keys or regular expressions
are specified as multiple arguments, rather than by repetition of the
construct:
@@ -75,7 +75,7 @@ construct:
of (3, 4) print "3 or 4"; cbreak // correct
The
-.BI mixed
+.B mixed
macro takes exactly two arguments, which are parenthesized lists of
keys. The left list must be a list of ordinary value keys, and the
second of regular expression literals:
@@ -83,15 +83,15 @@ second of regular expression literals:
mixed ((1, 2, "a"), (/xyz$/, /^\et/))
Each clause must specify how it terminates: whether it breaks out of the
-.BI case
+.B case
statement, "falls through" to the next case, or returns from the surrounding
function. The macros
-.BI cbreak,
-.BI cfall
+.BR cbreak ,
+.B cfall
and
-.BI cret
+.B cret
must be used for this purpose. The
-.BI cret
+.B cret
macro takes exactly one argument, the expression whose value is to be
returned from the surrounding function:
@@ -112,22 +112,22 @@ returned from the surrounding function:
}
When
-.BI case
+.B case
is transformed into portable code rather than
-.BI switch,
+.BR switch ,
that code depends on hidden state variables.
If
-.BI case
+.B case
is used in a top-level
-.BI BEGIN,
-.BI END
+.BR BEGIN ,
+.B END
or Awk action, those variables will be global.
They will also be global if
-.BI case
+.B case
is used in a function, unless defined as local variables in the parameter list.
Defining the temporary variables as local is done using the provided
-.BI case_temps
+.B case_temps
macro:
#include <case.h>
@@ -144,13 +144,13 @@ macro:
}
}
-.BI case_temps
+.B case_temps
does not have to be in the last argument position. It is guaranteed to expand to one or
more identifiers separated by commas, with no leading or trailing comma. When the target
is GNU Awk,
-.BI case_temps
+.B case_temps
expands to an unspecified identifier in the
-.BI __[a-z]
+.B __[a-z]
reserved namespace.
.SH "SEE ALSO"
@@ -159,7 +159,7 @@ cppawk(1)
.SH BUGS
The
-.BI cond
+.B cond
macro does not currently safely nest with itself.
Forgetting to declare the temporary variables is a programmer pitfall.