Article View: comp.text
Article #39098-bit nroff fixes
From: Jack Nelson
Date: Sun, 02 Aug 1987 17:24
Date: Sun, 02 Aug 1987 17:24
460 lines
13477 bytes
13477 bytes
Here is a diff -c of n10.c of nroff code (from BSD 2.9, but almost
the same as BSD 4.3) which allows access to printer fonts above 0200;
this is nice if you want to use math or foreign language capabilities
of a laserjet, for example, but keep the speed and simplicity of nroff.
All nroff terminal tables will still work. What this code does is
extend the use of character constant \200 in the code.term table
to act as an escape, telling nroff that the next character should
be output as a high-ascii code, not used as a plot motion command.
The \200 can be used anywhere in the output string of the description
to quote the next character, as well as in its usual place at the
second character to start plot mode for other reasons.
For the HP laserjet, series II, plot mode should be defined
as HMI zero and VMI zero, I think. Then each movement is governed
by the description string, i.e. it overprints unless you move the
cursor.
Here are the diffs, and a slightly tested table for laserjet
based mostly on xerox model and data from Eric Allman's paper
posted to the net last year.
UUCP: { akgua | allegra | cmcl2 | idis | ihnp4 | mi-cec | pitt |
psuvax1 | sun | sunrise | vax135 } ! cadre ! nelslab ! jack
ARPA: jack@cadre.dsl.pittsburgh.edu
John P. Nelson, M.D., 3811 O'Hara St, Pittsburgh, PA 15213, t:412-624-1769
Dept. of Psychiatry, U. of Pittsburgh
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
# n10.diffc
# tabhplj.c
# code.hplj
# This archive created: Fri Jul 17 15:00:13 1987
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'n10.diffc'
then
echo shar: "will not over-write existing file 'n10.diffc'"
else
cat << \SHAR_EOF > 'n10.diffc'
*** n10.c.org Fri Jul 10 17:29:16 1981
--- n10.c Thu Jul 16 16:14:30 1987
***************
*** 167,172
{
register int i;
register char *j, *k;
if(!plotmode)oputs(t.ploton);
k = x;
--- 167,175 -----
{
register int i;
register char *j, *k;
+ int bit8flg;
+ # define TRUE (1)
+ # define FALSE (0)
if(!plotmode)oputs(t.ploton);
k = x;
***************
*** 170,176
if(!plotmode)oputs(t.ploton);
k = x;
! if((*k & 0377) == 0200)k++;
for(; *k; k++){
if(*k & 0200){
if(*k & 0100){
--- 173,182 -----
if(!plotmode)oputs(t.ploton);
k = x;
! if((*k & 0377) == 0200){
! k++;
! bit8flg = TRUE;
! } else bit8flg = FALSE;
for(; *k; k++){
if((*k & 0377) == 0200){
bit8flg = TRUE;
***************
*** 172,178
k = x;
if((*k & 0377) == 0200)k++;
for(; *k; k++){
! if(*k & 0200){
if(*k & 0100){
if(*k & 040)j = t.up; else j = t.down;
}else{
--- 178,188 -----
bit8flg = TRUE;
} else bit8flg = FALSE;
for(; *k; k++){
! if((*k & 0377) == 0200){
! bit8flg = TRUE;
! continue;
! }
! if((*k & 0200) && (bit8flg == FALSE)){
if(*k & 0100){
if(*k & 040)j = t.up; else j = t.down;
}else{
***************
*** 180,186
}
if(!(i = *k & 037))return(++k);
while(i--)oputs(j);
! }else oput(*k);
}
return(k);
}
--- 190,199 -----
}
if(!(i = *k & 037))return(++k);
while(i--)oputs(j);
! }else{
! oput(*k);
! bit8flg = FALSE;
! }
}
return(k);
}
SHAR_EOF
chmod +x 'n10.diffc'
fi
if test -f 'tabhplj.c'
then
echo shar: "will not over-write existing file 'tabhplj.c'"
else
cat << \SHAR_EOF > 'tabhplj.c'
/* tabhplj.c 4.1 83/08/05 */
#define INCH 240
/*
* Hewlett Packard laser-jet series II
* nroff driving table
* by J. P. Nelson 7-9-87
* Because the c:itoh will backspace only in incremental mode,
* need to write a program to place commands Esc[ and Esc] around ^H.
* If you want true underline mode instead of _^Hx_^Hy, etc.,
* have the script first replace _^Hx with EscXxEscY, etc.
* Further refinements are possible to clean up files and
* minimize throughput (e.g., delete all EscYEscX pairs).
* In the terminal initialization (twinit) and exit (twrest)
* strings, EscN sets 10-pitch. Twrest clears by commanding
* Esc Y, Esc", and Esc$ to clear ul, bold, and "greek",
* Esc] to restore logic-seek print, Escf and EscT24 to restore
* forward linefeed at 6 lines/inch, Esc< for bidirectional
* print, EscN, and ^M (\015) to clear the print buffer.
* Since the itoh has no keyboard, you have to run it through
* a video terminal or micro printer port.
* The first twinit code (Esc`) and the last twrest code
* (Esca) set the (proper) "transparent" or "buffered" print
* mode for tvi950 and tvi925 and Freedom 100. This mode
* is necessary on intelligent terminals to keep all the Esc
* codes in the driver tables from scrambling the terminal's
* brains. (If you have a dumb terminal, almost any print
* mode should be safe. Smart terminals without buffered print,
* such as the tvi920, present problems.)
* If you have a different terminal,
* the shell script should also replace these codes with those
* appropriate for your machine. If you are using an sed
* stream for the script, make sure to use single quotes to
* isolate the ` from the shell.
*/
struct {
int bset;
int breset;
int Hor;
int Vert;
int Newline;
int Char;
int Em;
int Halfline;
int Adj;
char *twinit;
char *twrest;
char *twnl;
char *hlr;
char *hlf;
char *flr;
char *bdon;
char *bdoff;
char *ploton;
char *plotoff;
char *up;
char *down;
char *right;
char *left;
char *codetab[256-32];
int zzz;
} t = {
/*bset*/ 0,
/*breset*/ 0177420,
/*Hor*/ INCH/60,
/*Vert*/ INCH/48,
/*Newline*/ INCH/6,
/*Char*/ INCH/10,
/*Em*/ INCH/10,
/*Halfline*/ INCH/12,
/*Adj*/ INCH/10,
/*twinit*/ "", /* jpn: do it with filters */
/*twrest*/ "",
/*twnl*/ "\015\n",
/*hlr*/ "\033&a-0.5R",
/*hlf*/ "\033&a+0.5R",
/*flr*/ "\033&a-1.0R",
/*bdon*/ "\033(s3B",
/*bdoff*/ "\033(s0B",
/*ploton*/ "\033&k0H\033&l0C",
/*plotoff*/ "\033&k10H\033&l8C",
/*up*/ "\033&a-15V",
/*down*/ "\033&a+15V",
/*right*/ "\033&a+12H",
/*left*/ "\033&a-12H",
/*codetab*/
#include "code.hplj"
SHAR_EOF
chmod +x 'tabhplj.c'
fi
if test -f 'code.hplj'
then
echo shar: "will not over-write existing file 'code.hplj'"
else
cat << \SHAR_EOF > 'code.hplj'
/* code.hplj jpn 7-10-87 */
"\001 ", /*space*/
"\001!", /*!*/
"\001\"", /*"*/
"\001#", /*#*/
"\001$", /*$*/
"\001%", /*%*/
"\001&", /*&*/
"\001'", /*' close*/
"\001(", /*(*/
"\001)", /*)*/
"\001*", /***/
"\001+", /*+*/
"\001,", /*,*/
"\001-", /*- hyphen*/
"\001.", /*.*/
"\001/", /*/*/
"\2010", /*0*/
"\2011", /*1*/
"\2012", /*2*/
"\2013", /*3*/
"\2014", /*4*/
"\2015", /*5*/
"\2016", /*6*/
"\2017", /*7*/
"\2018", /*8*/
"\2019", /*9*/
"\001:", /*:*/
"\001;", /*;*/
"\001<", /*<*/
"\001=", /*=*/
"\001>", /*>*/
"\001?", /*?*/
"\001@", /*@*/
"\201A", /*A*/
"\201B", /*B*/
"\201C", /*C*/
"\201D", /*D*/
"\201E", /*E*/
"\201F", /*F*/
"\201G", /*G*/
"\201H", /*H*/
"\201I", /*I*/
"\201J", /*J*/
"\201K", /*K*/
"\201L", /*L*/
"\201M", /*M*/
"\201N", /*N*/
"\201O", /*O*/
"\201P", /*P*/
"\201Q", /*Q*/
"\201R", /*R*/
"\201S", /*S*/
"\201T", /*T*/
"\201U", /*U*/
"\201V", /*V*/
"\201W", /*W*/
"\201X", /*X*/
"\201Y", /*Y*/
"\201Z", /*Z*/
"\001[", /*[*/
"\001\\", /*\*/
"\001]", /*]*/
"\001^", /*^*/
"\001\137", /*_ dash*/
"\001`", /*` open*/
"\201a", /*a*/
"\201b", /*b*/
"\201c", /*c*/
"\201d", /*d*/
"\201e", /*e*/
"\201f", /*f*/
"\201g", /*g*/
"\201h", /*h*/
"\201i", /*i*/
"\201j", /*j*/
"\201k", /*k*/
"\201l", /*l*/
"\201m", /*m*/
"\201n", /*n*/
"\201o", /*o*/
"\201p", /*p*/
"\201q", /*q*/
"\201r", /*r*/
"\201s", /*s*/
"\201t", /*t*/
"\201u", /*u*/
"\201v", /*v*/
"\201w", /*w*/
"\201x", /*x*/
"\201y", /*y*/
"\201z", /*z*/
"\001{", /*{*/
"\001|", /*|*/
"\001}", /*}*/
"\001~", /*~*/
"\000\0", /*narrow sp*/
"\001-", /*hyphen*/
"\001\200\362", /*bullet*/
"\001\200\374", /*square*/
"\001\200\366", /*3/4 em dash*/
"\001\200\260", /*rule--should properly be up one unit*/
"\001\200\367", /*1/4*/
"\001\200\370", /*1/2*/
"\001\200\365", /*3/4*/
"\001-", /*minus*/
"\202\033&a-20Hf\033&a-45Hi", /*fi*/
"\202\033&a-20Hf\033&a-45Hl", /*fl*/
"\202\033&a-20Hf\033&a-45Hf", /*ff*/
"\203\033&a-30Hf\033&a-45Hf\033&a-45Hi", /*ffi*/
"\203\033&a-30Hf\033&a-45Hf\033&a-45Hl", /*ffl*/
"\001\200\263", /*degree*/
"\001|\b\342-\302", /*dagger*/
"\001\200\275", /*section*/
"\001\200\250", /*foot mark*/
"\001\200\250", /*acute accent*/
"\001\200\251", /*grave accent*/
"\001\137", /*underrule*/
"\001/", /*slash (longer)*/
"\000\0", /*half narrow space*/
"\001 ", /*unpaddable space*/
"\001\241c\202(\241", /*alpha*/
"\001\200B\242\302|\202\342", /*beta*/
"\001\200)\201/\241", /*gamma*/
"\001\200o\343<\303", /*delta*/
"\001C\b-", /*epsilon*/
"\001\200c\201\301,\241\344<\303", /*zeta*/
"\001\200n\202\302|\242\342", /*eta*/
"\001O\b\341-\301", /*theta*/
"\001i", /*iota*/
"\001k", /*kappa*/
"\001\200\\\304\241'\301\241'\345\202", /*lambda*/
"\001\200\363", /*mu*/
"\001\241(\203/\242", /*nu*/
"\001\200c\201\301,\241\343c\241\301`\201\301", /*xi*/
"\001o", /*omicron*/
"\001\341-\303\"\301\"\343", /*pi*/
"\001\200o\242\302|\342\202", /*rho*/
"\001\200o\301\202~\341\242", /*sigma*/
"\001\200t\301\202~\243~\201\341", /*tau*/
"\001v", /*upsilon*/
"\001o\b/", /*phi*/
"\001x", /*chi*/
"\001\200/-\302\202'\244'\202\342", /*psi*/
"\001\241u\203u\242", /*omega*/
"\001\242|\202\344-\304\202`\242", /*Gamma*/
"\001\242/\303-\204-\343\\\242", /*Delta*/
"\001O\b=", /*Theta*/
"\001\242/\204\\\242", /*Lambda*/
"\001-\b\342_\345_\307", /*Xi*/
"\001\242[]\204[]\242\343-\303", /*Pi*/
"\001\341>\303-\346-\304", /*Sigma*/
"\000\0", /**/
"\001Y", /*Upsilon*/
"\001o\b[\b]", /*Phi*/
"\001\200[]-\302\202'\244`\202\342", /*Psi*/
"\001\200O\302\241-\202-\241\342", /*Omega*/
"\001/\b\242v\202", /*square root*/
"\001\033Z", /*\(ts yields logical not*/
"\001\350_\310", /*root en*/
"\001>\b_", /*>=*/
"\001<\b_", /*<=*/
"\001=\b_", /*identically equal*/
"\001-", /*equation minus*/
"\001=\b~", /*approx =*/
"\001\241~\202~\241", /*approximates*/
"\001=\b/", /*not equal*/
"\002-\242-\202>", /*right arrow*/
"\002<\b\202-\242\200-", /*left arrow*/
"\001|\b^", /*up arrow*/
"\001|\b\302v\342", /*down arrow*/
"\001=", /*equation equal*/
"\001x", /*multiply*/
"\001:\b-", /*divide*/
"\001\200\376", /*plus-minus*/
"\001\243|\203_\203|\243", /*cup (union)*/
"\001\243|\203\351_\311\203|\243", /*cap (intersection)*/
"\001\243(\203\302-\345-\303", /*subset of*/
"\001\302-\345-\303\203)\243", /*superset of*/
"\001_\b\243(\203\302-\345-\303", /*improper subset*/
"\001_\b\302-\345-\303\203)\243", /*improper superset*/
"\002o\242o\202", /*infinity*/
"\001\200o\201\301`\241\341`\241\341`\201\301", /*partial derivative*/
"\001\242\\\343-\204-\303/\242", /*gradient*/
"\001\200-\202\341,\301\242", /*not*/
"\001\200|'\202`\243\306'\241`\202\346", /*integral sign*/
"\002o\242c\202", /*proportional to*/
"\001O\b/", /*empty set*/
"\001<\b\341-\302", /*member of*/
"\001+", /*equation plus*/
"\003\200OR", /*registered*/
"\003\200Oc", /*copyright*/
"\001|", /*box rule */
"\001\200\277", /*cent sign*/
"\001|\b\342=\302", /*double dagger*/
"\002=>", /*right hand*/
"\002<=", /*left hand*/
"\001*", /*math * */
"\001\\", /*\(bs yields unkeyable char*/
"\001|", /*or (was star)*/
"\001O", /*circle*/
"\001|", /*left top (of big curly)*/
"\001|", /*left bottom*/
"\001|", /*right top*/
"\001|", /*right bot*/
"\001|", /*left center of big curly bracket*/
"\001|", /*right center of big curly bracket*/
"\001|", /*bold vertical*/
"\001|", /*left floor (left bot of big sq bract)*/
"\001|", /*right floor (rb of ")*/
"\001|", /*left ceiling (lt of ")*/
"\001|", /*right ceiling (rt of ")*/
"\001\033\046O\033\044", /*superscript 0 */
"\001\033\046P\033\044", /*superscript 1 */
"\001\033\046Q\033\044", /*superscript 2 */
"\001\033\046R\033\044", /*superscript 3 */
"\001\033\046S\033\044", /*superscript 4 */
"\001\033\046T\033\044", /*superscript 5 */
"\001\033\046U\033\044", /*superscript 6 */
"\001\033\046V\033\044", /*superscript 7 */
"\001\033\046W\033\044", /*superscript 8 */
"\001\033\046X\033\044", /*superscript 9 */
};
SHAR_EOF
chmod +x 'code.hplj'
fi
exit 0
# End of shell archive
--
UUCP: { akgua | allegra | cmcl2 | idis | ihnp4 | mi-cec | pitt | psuvax1 | sun | sunrise | vax135 } ! cadre ! nelslab ! jack
ARPA: jack@cadre.dsl.pittsburgh.edu
John P. Nelson, M.D., 3811 O'Hara St, Pittsburgh, PA 15213, t:412-624-1769 Dept. of Psychiatry, U. of Pittsburgh
Technical Details
Message-ID:
<760@cadre.dsl.PITTSBURGH.EDU>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!rochester!pt!cadre!jackShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!rochester!pt!cadre!jack From: jack@cadre.dsl.PITTSBURGH.EDU (Jack Nelson) Newsgroups: comp.text Subject: 8-bit nroff fixes Message-ID: <760@cadre.dsl.PITTSBURGH.EDU> Date: Sun, 2-Aug-87 13:24:48 EDT Article-I.D.: cadre.760 Posted: Sun Aug 2 13:24:48 1987 Date-Received: Sun, 2-Aug-87 23:49:42 EDT Organization: Decision Systems Lab., Univ. of Pittsburgh, PA. Lines: 460 Keywords: nroff laser font