-Often more complex operations are necessary.
-.PP
-The \fB%\fR encodings have the following meanings:
-.PP
-.DT
-.nf
-.ta .5i 1.5i
- \s-1%% outputs `%'
- %d print pop() as in printf
- %2d print pop() like %2d
- %3d print pop() like %3d
- %02d
- %03d as in printf
- %x print pop() as in printf
- %2x print pop() like %2x
- %3x print pop() like %3x
- %02x
- %03x as in printf
- %c print pop() gives %c
- %s print pop() gives %s
-
- %p[1-9] push i'th parm
- %P[a-z] set variable [a-z] to pop()
- %g[a-z] get variable [a-z] and push it
- %'c' char constant c
- %{nn} integer constant nn
-
- %+ %- %* %/ %m
- arithmetic (%m is mod): push(pop() op pop())
- %& %| %^ bit operations: push(pop() op pop())
- %= %> %< logical operations: push(pop() op pop())
- %A, %O logical and & or operations (for conditionals)
- %! %~ unary operations push(op pop())
- %i add 1 to first two parms (for ANSI terminals)
-
- %? expr %t thenpart %e elsepart %;
- if-then-else, %e elsepart is optional.
- else-if's are possible a la Algol 68:
- %? c\d1\u %t b\d1\u %e c\d2\u %t b\d2\u %e c\d3\u %t b\d3\u %e c\d4\u %t b\d4\u %e %;
-\s+1 c\di\u are conditions, b\di\u are bodies.
-.fi
+Print (e.g., \*(``%d\*('') is a special case.
+Other operations, including \*(``%t\*('' pop their operand from the stack.
+It is noted that more complex operations are often necessary,
+e.g., in the \fBsgr\fP string.
+.PP
+The \fB%\fP encodings have the following meanings:
+.TP 5
+\fB%%\fP
+outputs \*(``%\*(''
+.TP
+\fB%\fI[[\fR:\fI]flags][width[.precision]][\fBdoxXs\fI]\fR
+as in \fBprintf\fP(3), flags are \fI[\-+#]\fP and \fIspace\fP.
+Use a \*(``:\*('' to allow the next character to be a \*(``\-\*('' flag,
+avoiding interpreting \*(``%\-\*('' as an operator.
+.TP
+\fB%c\fP
+print \fIpop()\fP like %c in \fBprintf\fP
+.TP
+\fB%s\fP
+print \fIpop()\fP like %s in \fBprintf\fP
+.TP
+\fB%p\fI[1\-9]\fR
+push \fIi\fP'th parameter
+.TP
+\fB%P\fI[a\-z]\fR
+set dynamic variable \fI[a\-z]\fP to \fIpop()\fP
+.TP
+\fB%g\fI[a\-z]\fR
+get dynamic variable \fI[a\-z]\fP and push it
+.TP
+\fB%P\fI[A\-Z]\fR
+set static variable \fI[a\-z]\fP to \fIpop()\fP
+.TP
+\fB%g\fI[A\-Z]\fR
+get static variable \fI[a\-z]\fP and push it
+.IP
+The terms \*(``static\*('' and \*(``dynamic\*('' are misleading.
+Historically, these are simply two different sets of variables,
+whose values are not reset between calls to \fBtparm\fP(3X).
+However, that fact is not documented in other implementations.
+Relying on it will adversely impact portability to other implementations:
+.RS
+.bP
+SVr2 curses supported \fIdynamic\fP variables.
+Those are set only by a \fB%P\fP operator.
+A \fB%g\fP for a given variable without first setting it with \fB%P\fP
+will give unpredictable results, because dynamic variables are
+an uninitialized local array on the stack in the \fBtparm\fP function.
+.bP
+SVr3.2 curses supported \fIstatic\fP variables.
+Those are an array in the \fI\%TERMINAL\fP
+structure (declared in \fBterm.h\fP),
+and are zeroed automatically when the \fBsetupterm\fP function
+allocates the data.
+.bP
+SVr4 curses made no further improvements
+to the \fIdynamic/static\fP variable feature.
+.bP
+Solaris XPG4 curses does not distinguish between \fIdynamic\fP and
+\fIstatic\fP variables.
+They are the same.
+Like SVr4 curses, XPG4 curses does not initialize these explicitly.
+.bP
+Before version 6.3,
+\fI\%ncurses\fP stores both \fIdynamic\fP and \fIstatic\fP
+variables in persistent storage, initialized to zeros.
+.bP
+Beginning with version 6.3,
+\fI\%ncurses\fP stores \fIstatic\fP and \fIdynamic\fP
+variables in the same manner as SVr4.
+.RS
+.bP
+Unlike other implementations, \fI\%ncurses\fP zeros dynamic variables
+before the first \fB%g\fP or \fB%P\fP operator.
+.bP
+Like SVr2,
+the scope of dynamic variables in \fI\%ncurses\fP
+is within the current call to
+\fBtparm\fP.
+Use static variables if persistent storage is needed.
+.RE
+.RE
+.TP
+\fB%\*'\fIc\fB\*'\fR
+char constant \fIc\fP
+.TP
+\fB%{\fInn\fB}\fR
+integer constant \fInn\fP
+.TP
+\fB%l\fP
+push strlen(pop)
+.TP
+\fB%+\fP, \fB%\-\fP, \fB%*\fP, \fB%/\fP, \fB%m\fP
+arithmetic (%m is \fImod\fP): \fIpush(pop() op pop())\fP
+.TP
+\fB%&\fP, \fB%|\fP, \fB%\*^\fP
+bit operations (AND, OR and exclusive-OR): \fIpush(pop() op pop())\fP
+.TP
+\fB%=\fP, \fB%>\fP, \fB%<\fP
+logical operations: \fIpush(pop() op pop())\fP
+.TP
+\fB%A\fP, \fB%O\fP
+logical AND and OR operations (for conditionals)
+.TP
+\fB%!\fP, \fB%\*~\fP
+unary operations (logical and bit complement): \fIpush(op pop())\fP
+.TP
+\fB%i\fP
+add 1 to first two parameters (for ANSI terminals)
+.TP
+\fB%?\fP \fIexpr\fP \fB%t\fP \fIthenpart\fP \fB%e\fP \fIelsepart\fP \fB%;\fP
+This forms an if-then-else.
+The \fB%e\fP \fIelsepart\fP is optional.
+Usually the \fB%?\fP \fIexpr\fP part pushes a value onto the stack,
+and \fB%t\fP pops it from the stack, testing if it is nonzero (true).
+If it is zero (false), control passes to the \fB%e\fP (else) part.
+.IP
+It is possible to form else-if's a la Algol 68:
+.RS
+\fB%?\fP c\d1\u \fB%t\fP b\d1\u \fB%e\fP c\d2\u \fB%t\fP b\d2\u \fB%e\fP c\d3\u \fB%t\fP b\d3\u \fB%e\fP c\d4\u \fB%t\fP b\d4\u \fB%e\fP \fB%;\fP
+.RE
+.IP
+where c\di\u are conditions, b\di\u are bodies.
+.IP
+Use the \fB\-f\fP option of \fB@TIC@\fP or \fB@INFOCMP@\fP to see
+the structure of if-then-else's.
+Some strings, e.g., \fBsgr\fP can be very complicated when written
+on one line.
+The \fB\-f\fP option splits the string into lines with the parts indented.