home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 26
/
CD_ASCQ_26_1295.iso
/
vrac
/
reansi12.zip
/
REANSI.DOC
< prev
next >
Wrap
Text File
|
1995-08-17
|
10KB
|
255 lines
REANSI 1.2 -- a program to convert between ANSI/AVATAR/ASCII
Written and copyright 1995 by Thomas Almy
REANSI can be used without charge, and distributed providing
no modifications are made and no charge (other than media or access
time) is made. REANSI may not be bundled with any commercial product.
A valid distribution of REANSI contains the following files:
REANSI.C Source code
REANSI.EXE Executable code
REANSI.DOC This documentation
This program converts files containing ANSI and/or AVATAR terminal
control sequences and/or PC-8 ("ANSI Graphic") characters into "plain
vanila" ASCII, optimal (?) ANSI, or AVATAR. It is based on the author's
program UNANSI which converts ANSI and/or PC-8 to plain ASCII. This
program is a superset of UNANSI.
Common uses of REANSI include:
Compressing ANSI display files, and removing "animation".
Converting ANSI display files to monochrome.
Converting ANSI display files to AVATAR.
Displaying AVATAR files.
Converting ASCII files to "plain vanilla" ASCII.
Making printer files containing overstrikes displayable.
Making display files (ANSI or AVATAR) printable.
Converting into and out of RemoteAccess(TM) color codes
REANSI works by maintaining a "virtual display" of how the characters
would appear, and then writes to the output what gets scrolled off
the top of the screen or would get erased. Because a standard 24 line
terminal is being emulated, it is assumed that only 24 lines can
appear on the virtual display. (Note: if you need the program to work
for some other screen size, the program can be easily modified and
recompiled using any C compiler).
Because of the virtual display, REANSI removes all "animation" in the
input file.
REANSI can be used as a filter, reading from standard input and
writing to standard output. If a single filename is given on the
command line, that is the input file. A second filename will be taken
as the output file. Any command switches follow the file names.
Execute "REANSI -?" to get a usage message.
The input file may contain any of the ANSI commands, and the program
will respond to cursor positioning, erase, and display attribute
(color,bright,blink) commands supported by DOS ANSI.SYS. In addition,
tab, formfeed and backspace characters are processed. AVATAR/0 codes
(cursor positioning, display attribute, and run-length encoding) are
also processed. The AVATAR codes start with control-V or control-Y
and should not interfere with normal use.
To perform successfully, several input and output options are
available as command line switches. The input options control how the
incoming file is used to write to the virtual display, while the
output options control how the virtual display contents are written
to the file. You set the input options for the type of file you are
converting and the output options for the type of file you are
converting to.
INPUT OPTIONS
-p -- input is for printer
-s -- input assumes cursor sticks at right edge
-cN -- initial color attribute is N (hexidecimal value)
-i -- ignore AVATAR codes in input
-r -- accept RemoteAccess color codes in input
If the input file was intended for a printer, it might assume the
ability to overprint. The -p switch causes whitespace to be non-printing
(so overprinting a space won't erase what is beneath it), and also
will ignore underscores that would overprint characters.
When the 80th character is written on a line (in the "virtual
display"), it is assumed the cursor wraps to the next line. An ANSI
control sequence (or the -s command line switch) can change the
operation mode so that the cursor sticks at the 80th column. This
might be necessary for input files intended for printers.
The initial color attribute is assumed to be white on black. The -c
option allows setting the value. This would normally only need to be
done for environments where the display color is different. For
instance AVATAR defaults to cyan on black (-c3). If the default
background color is wrong, then "bleeding" will occur at the end of
lines and there could be some color errors blank background areas. If
the default foreground is wrong then text may start in the wrong
color.
The value can be set by adding up the hexidecimal values for the three
fields:
******************************
foreground color:
01 Blue
02 Green
03 Cyan
04 Red
05 Magenta
06 Brown
07 White (light grey)
08 Dark grey
09 Bright blue
0A Bright green
0B Bright cyan
0C Bright red
0D Bright magenta
0E Yellow
0F Bright White
background color:
10 Blue
20 Green
30 Cyan
40 Red
50 Magenta
60 Brown
70 White (light grey)
blink:
80 blink
******************************
The -i option prevents the interpretation of AVATAR codes in the
input. Note that the formfeed character clears the virtual screen and
set the color to cyan on black when AVATAR is used, while with the -i
option the screen is cleared to the current color.
The -r switch is used when reading files using the RemoteAccess BBS
software color codes (^K[nn format). By default, this feature is
disabled. Note that REANSI cannot handle the language prompt commands
in input.
OUTPUT OPTIONS
-x -- don't translate PC-8 to ASCII
-f -- don't output formfeeds
-w -- output wraps after 80 characters
-t -- use tab characters in output
-a -- output ANSI positioning codes and color codes
-m -- output ANSI positioning codes only
-v -- output AVATAR codes
-o -- output RemoteAccess color codes
The -x option is very important. Normally characters in the PC-8
character set (the IBM graphic characters which are commonly found in
ANSI/AVATAR files) are converted to 7 bit ASCII, which can be
universally displayed and printed. This translation is inhibited with
the -x option. You will probably always want to use -x if you also
use -a, -m, or -v (described below).
The -w switch controls the handling of the 80th column. By default
it is assumed that the output file will be sent to devices that will
print 80 characters without wrapping (such as most printers). If
output is destined for a device which wraps (such as an 80 column
display), the -w switch should be used. On the other hand, if output
is to the display, and is always less than 80 characters or the
display is set to "stick" (and ANSI option), or the display is larger
than 80 columns, then the -w switch should not be used. Got that?
The tab character is not used in the output unless the -t command
line switch is given. Use of -t can reduce file size, but not all
output devices recognize tabs. The -t switch cannot be used when the
-a, -m, or -v switches are specified; cursor travel is controlled
by ANSI or AVATAR sequences in these cases. The -t switch cannot be
used with the -o switch since no special cursor control is used in
that case.
The ANSI (or AVATAR) clear display command is interpreted to mean the
end of a page. When this occurs, the contents of the virtual display
are written out, followed by a formfeed character. This should handle
multi-frame ANSI files. The formfeeds can be eliminated by the -f
switch. If the -a, -m, or -v switches are used, the appropriate ANSI
or AVATAR clearscreen codes are always sent, and the -f switch is
ignored. If the -o switch is used, the -f switch is forced.
When the -a switch is used, color ANSI is output, while when -m is
used monochrome ANSI (ANSI cursor positioning sequences, but no color
selection) is output, and when -v is used color AVATAR is output.
With these selections one would typically also use the -x switch.
For best results with -a and -v, input should be limited to 79
characters per line and have been created making no assumptions as to
colors. The colors are always reset to default at the end of the
output. Note that all animation is removed, and display is always
left to right then top to bottom.
The -o switch is for RemoteAccess BBS software users. It generates a
file that can be used as an .ASC file which will have color codes
that will be ignored, converted to ANSI, or converted to AVATAR on
the fly depending on the caller's terminal settings. This can result
in a substantial savings in number of files and space needed in a
typical RemoteAccess installation.
Examples of use>>>>>
To convert a color ANSI display file (no more than 79 characters per
line), X.ANS, to an AVATAR file, X.AVT, execute:
REANSI x.ans x.avt -x -v
To display an AVATAR file, X.AVT, (assuming an ANSI.SYS driver is
loaded):
REANSI x.avt -x -a
To convert a color ANSI display file, X.ANS, to a monchrome file
viewable on a PC without ANSI.SYS, X.ASC, execute:
REANSI x.ans x.asc -x -w -f -t
As above, but assuming the PC has ANSI.SYS:
REANSI x.ans x.asc -x -w -f -m
To print the file on a dot matrix printer on LPT1 capable of
displaying the PC character set, execute:
REANSI x.ans lpt1 -x
To convert to a file, X.ASC, to one that can be viewed on any
terminal, execute:
REANSI x.ans x.asc -w -f -t
To convert a file X.DOC that uses the PC-8 character set and
"overprints" for bold or underline effects into a file, X.TXT, that
is pure ASCII for printing or viewing on the display:
REANSI x.doc x.txt -p
To convert an ANSI RemoteAccess BBS menu to a universal *.ASC file,
execute:
REANSI menu.ans menu.asc -o -x
(be sure to delete the menu.asc file when you are done!)
To convert the RemoteAccess .ASC file back to ANSI, execute:
REANSI menu.asc menu.ans -r -x
While REANSI was designed to compile on MSDOS systems, it should
compile with few modifications on any system.
Tom Almy
08/95
I can be contacted at tom.almy@tek.com, or 1:105/290, or by mail at
17830 SW Shasta Trail, Tualatin, OR 97062. When coresponding via
mail, please enclose a stamped, self-addressed envelope if you desire a
reply.