Unix render frontend patch - User manual
Introduction
Nicolas Calimet <pov4grasp@free.fr> Updated Aug 29, 2006 |
Click for full-size (24 KB) |
This patch allows to better control the way those streams are output. Each stream can be assigned a color (actually several attributes such as foreground and background color, text blinking, etc.) and a format (typically, simple prefix and suffix texts surrounding the original message). Additionally, custom tab stops can be defined to properly handle the stream messages containing tabular characters (tabs are internally expanded to spaces). A tab marker may be displayed using an user-specified character.
The terminal is defined by the value of the TERM
environment
variable or the --term
command-line option.
Usually the appropriate value for the TERM
environment is
automatically set when starting a new shell.
Terminal capabilities are defined in so-called terminfo files which are
located under the /usr/share/terminfo/ hierarchy (also called terminfo
database) by default.
An alternate location can be set via the TERMINFO
environment
variable.
Note: There is no command-line option to override the
TERMINFO
setting.
A given terminfo file is located in a subdirectory of the terminfo database
named from the first letter of the terminal.
For instance, the capabilities for the "xterm" terminal are described in
the $TERMINFO/x/xterm
file.
A terminfo file contains binary data only.
Refer to the terminfo(5) manual for details.
A wrap width of 80 characters is ideal for the terminals that were originally designed for displaying 80x24 (vt100) or 80x25 (IBM PC) characters on a text-only console screen. However, most modern terminals and terminal emulators support arbitrary sizes and can display lines of more than e.g. 150 characters depending on the screen resolution and font size. Example of such a terminal is "xterm".
This patch offers the possibility to change the wrap width so as to benefit from wide terminals.
export POV_STREAM_WRAP_WIDTH=INTEGER
# bash-like shells setenv POV_STREAM_WRAP_WIDTHINTEGER
# csh-like shells
--pov-stream-wrap-width=INTEGER
INTEGER
is a positive value of at least 80.
Note: Only wrap width values equal to or above 80 are valid.
export POV_STREAM_WRAP_WIDTH=120will wrap the text lines after 120 characters unless the terminal window is smaller (and its size can be determined).
POV_STREAM_COLOR
export POV_STREAM_COLOR=MODE
# bash-like shells setenv POV_STREAM_COLORMODE
# csh-like shells
--pov-stream-color=MODE
MODE
:
never | always | auto
never
: never use colors for the POV-Ray streams
always
: always use colors
auto
: stream colors are used only if the standard error is
connected to a terminal (tty)
Note: always
and auto
assume that
the user-defined colors exist and are valid.
always
behaviour.
export POV_STREAM_COLOR=autowill allow to color the POV-Ray streams when the standard error is connected to a terminal (e.g. screen output) and disable stream colors otherwise (e.g. when redirecting stderr to a file or pipe).
POV_STREAM_COLORS
Note: The colors are not used when the POV-Ray streams
are redirected to files using the appropriate POV-Ray options (e.g.
+GAfile
).
export POV_STREAM_COLORS=COLORS
# bash-like shells setenv POV_STREAM_COLORSCOLORS
# csh-like shells
--pov-stream-colors=COLORS
COLORS
:
STREAMCOLOR[:STREAMCOLOR:...:STREAMCOLOR]
STREAMCOLOR
:
STREAM
=COLORDEF
STREAM
:
all | banner | debug | fatal | render | statistic | status | warning
COLORDEF
:
INTEGER[;INTEGER;...;INTEGER]
A color definition COLORDEF
consists of a sequence of integers
(codes) seperated by semi-colons, in any order.
The valid numeric codes and their usual meaning are defined in categories
as follows:
code | 30 | 31 |
32 | 33 |
34 | 35 |
36 | 37 |
---|---|---|---|---|---|---|---|---|
meaning | black | red | green | yellow | blue | magenta | cyan | gray |
code | 40 | 41 |
42 | 43 |
44 | 45 |
46 | 47 |
---|---|---|---|---|---|---|---|---|
meaning | gray | red | green | yellow | blue | magenta | cyan | white |
code | 0 | 1 | 2 |
4 | 5 | 7 |
8 |
---|---|---|---|---|---|---|---|
meaning | none | bold | dim | underline | blink | reverse | invisible |
05
or
000041
, are valid too.
In case two color codes belong to the same category (i.e. foreground or
background) the last code specified is used.
Attributes codes can be mixed to obtain combined effects.
For instance, the definition 1;4;31;42
should give
this
.
Note: The colors and attributes scheme above does entirely depend on your terminal capabilities and settings. For instance, the xterm terminal does not recognize the "invisible" attribute. Some terminals may replace the bold attribute by a brighter intensity for the text color. Others allow to redefine the individual color codes with arbitrary RGB triplets.
The all
stream is a special definition that applies to all
of the POV-Ray streams and is inherited by the other definitions.
This behaviour allows to define a default setting for all the POV-Ray streams
at once (for instance the background color) and then tweak some of the streams
individually by adding more codes (for instance text color, bold attribute).
export POV_STREAM_COLORS="all=1;31:fatal=43"will color all text streams in bold red and add a yellow background to the fatal error stream.
export POV_STREAM_COLOR=auto case "$TERM" in linux*) export POV_STREAM_COLORS="all=1:fatal=37;41:warning=33:debug=0;35";; xterm*) export POV_STREAM_COLORS="fatal=1;37;41:warning=30;43:status=1:debug=35";; esacYou may place such definitions in your ~/.bashrc or ~/.profile startup script.
setenv POV_STREAM_COLOR auto switch ("$TERM") case "linux*": setenv POV_STREAM_COLORS "all=1:fatal=37;41:warning=33:debug=0;35" breaksw case "xterm*": setenv POV_STREAM_COLORS "fatal=1;37;41:warning=30;43:status=1:debug=35" breaksw endswYou may place such definitions in your ~/.cshrc or ~/.profile startup script.
POV_STREAM_FORMAT
export POV_STREAM_FORMAT=MODE
# bash-like shells setenv POV_STREAM_FORMATMODE
# csh-like shells
--pov-stream-format=MODE
MODE
:
never | always | auto
never
: never output user formats, only the original POV-Ray
message
always
: always output formatted messages
auto
: stream formats are used only if the standard error is
connected to a terminal (tty)
Note: always
and auto
assume that
the user-defined formats exist and are valid.
always
behaviour.
export POV_STREAM_FORMAT=autowill allow to format the POV-Ray streams when the standard error is connected to a terminal (e.g. screen output) and disable stream formats otherwise (e.g. when redirecting stderr to a file or pipe).
POV_STREAM_FORMATS
Note: The formats are not used when the POV-Ray streams
are redirected to files using the appropriate POV-Ray options (e.g.
+GAfile
).
export POV_STREAM_FORMATS=FORMATS
# bash-like shells setenv POV_STREAM_FORMATSFORMATS
# csh-like shells
--pov-stream-formats=FORMATS
FORMATS
:
STREAMFORMAT[:STREAMFORMAT:...:STREAMFORMAT]
STREAMFORMAT
:
STREAM
=FORMATDEF
STREAM
:
all | banner | debug | fatal | render | statistic | status | warning
FORMATDEF
:
[STRING] [%s] [STRING]
A format definition FORMATDEF
is a string containing arbitrary
text and at least one %s
formatter that indicates the original
POV-Ray message to output.
For instance:
prefix-text %s suffix-text
A single %s
formatter is allowed, i.e. only the first one found
in the format string will be expanded to the original POV-Ray message.
If either no %s
formatter is found or the format string is
empty/not valid (see below) then no custom formatting is applied and the
original POV-Ray message is output as-is.
Any colon character (:
) that is part of the format string must be
escaped with a backslash (\:
) otherwise it is recognized as a
format seperator.
Backslash is escaped as double-backslashes (\\
) unless the
shell interprets it as a single backslash (in which case \\\\
should be used instead).
Other usual control characters such as newline (\n
) or tab
(\t
) are not allowed and are passed as n
and t
, respectively.
The all
stream is a special definition that applies to all of
the POV-Ray streams except those that have their own format specified
explicitely.
Therefore, to unformat a particular stream while the all
definition is present, one has to define the format of this stream
by using any of:
status=%s
status=
status=junk
export POV_STREAM_FORMATS="warning=WARNING: %s"will format the warning messages with a "WARNING: " prefix while all the other streams will output their original, unformatted messages.
export POV_STREAM_FORMAT=always export POV_STREAM_FORMATS="all=POV> %s <POV:fatal=*** %s ***:banner="You may place such definitions in your ~/.bashrc or ~/.profile startup script.
setenv POV_STREAM_FORMAT always setenv POV_STREAM_FORMATS "all=POV> %s <POV:fatal=*** %s ***:banner="You may place such definitions in your ~/.cshrc or ~/.profile startup script.
In this example, all POV-Ray streams (unless specified otherwise) are formatted (whether output to the screen or not) with a leading "POV> " and a trailing " <POV" surrounding the original message. As special cases, the fatal errors are formatted with surrounding stars and the banner messages are not formatted at all.
To let POV-Ray consistently display the tabs together with the stream formats and (background) colors, this patch internally replaces all tab characters by spaces when sending the messages to stderr. Since the tab stops settings of the terminal are thus ignored, the patch allows to define custom tab stops in order to emulate the terminal behaviour. The option syntax is inspired by the less utility.
Tab stops can be optionally displayed in the form of a single character ("tab mark") that is either left or right-aligned on the tab boundary.
export POV_STREAM_TAB_STOPS=INTEGER[,INTEGER,...,INTEGER]
# bash-like shells export POV_STREAM_TAB_MARK=MARKER
setenv POV_STREAM_TAB_STOPSINTEGER[,INTEGER,...,INTEGER]
# csh-like shells setenv POV_STREAM_TAB_MARKMARKER
--pov-stream-tab-stops=INTEGER[,INTEGER,...,INTEGER]
--pov-stream-tab-mark=MARKER
MARKER
:
CHARACTER
|INTEGER
x
: tab stops are set at multiples
of x
;
x1,x2,...,xN
:
tab stops are set at those columns and then continue with the same spacing
as the last two.
Note: Only positive, 1-based tab stops are allowed. Comma-seperated values should define a series of increasing numbers otherwise some tab stops will be ignored (and reported as such).
The value for the stream tab mark is either:
_
for underscore) that is always right-aligned
to the tab boundary;
0nnn
), decimal
(nnn
), or hexadecimal (0xnn
) number which sign
specifies the character alignment (positive is right-aligned, negative is
left-aligned).
Note: Not all characters or character codes are allowed: characters which decimal code is 127 or below 32 are forbidden. A left-aligned character alignment cannot be specified when using the single-character syntax.
Tab mark is a space character.