[comp.sources.d] Wordperfect to Troff code

suhans@let.vu.nl (suhans) (06/16/89)

This is the sharfile for the WordPerfect to Troff code.
Unshar the file and read the README file for some comments

#!/bin/sh
# This is a shell archive. Feed this file to "unshar" with
# "unshar file" or remove all lines above the "#!/bin/sh" line
# from this file and then feed it to "/bin/sh" with "sh file"
echo 'This file will create: ' 'README conv_wp.h wp.h wpc.c wpunix.c'
echo 'Extracting README ...'
sed 's/^X//' > 'README' <<'End_of_shar'
X
XThis is I think a very prelimanary version but it does translate.
X
XThis is the source for translating Wordperfect in troff 
XThe Turbo-C source is written two years ago 
XThe Turbo-C sources are:
X	wpunix.c	main program
X	convert_wp.h	translate codes etc.
XThere are some dutch var names in it, but I think you understand them.
X
XI have working on the Unix version and I was trying to simplify the program
XThe problem is that I don't have the time to continue, so I send the sources
Xon the net. I hope you can use them.
XThe Unix(BSD) sources are:
X	wpc.c		main program
X	wp.h		translate codes etc.
X
XIf you print wp.h you find all the codes with explantion and format in
Xenglish this time.
XIf there are questions, I am gladly to answer them.
XI have used the book " More file formats" to generate the comments.
X
XHans Varkevisser
Xlet.vu.nl@hans, hans!let.vu.nl
X
End_of_shar
ls -l 'README'

echo 'Extracting conv_wp.h ...'
sed 's/^X//' > 'conv_wp.h' <<'End_of_shar'
X#define	FALSE		0
X#define	TRUE		 1
X#define	MAX_CHAR	40
X
Xstatic FILE *ofp,*ifp;
Xstatic char *name[20];
Xstatic int i,hrt_on,lf_on,key,sup,sub,noot,block;
Xstatic long max_bytes, teller;
X 
X#define	TAB	0x09	/* 009 */
X#define	HRT	0x0a	/* 010 */
X#define	SD_PA	0x0b	/* 011 */
X#define	HD_PA	0x0c	/* 012 */
X#define	ZRT	0x0d	/* 013 */
X#define	SPACE	0x20	/* 032 */
X#define	UIT_AAN	0x81	/* 129 */
X#define	UIT_UIT	0x82	/* 130 */
X#define	CTR_OFF	0x83	/* 131 */
X#define	SR_OFF 	0x84	/* 132 */
X#define	MATH1	0x85	/* 133 */
X#define	CNT_PG	0x86	/* 134 */
X#define	S_COL	0x87	/* 135 */
X#define	E_COL	0x88	/* 136 */
X#define	TAB_R	0x89	/* 137 */
X#define	WI_ON	0x8a	/* 138 */
X#define	WI_OF	0x8b	/* 139 */
X#define	HD_LN	0x8c	/* 140 */
X#define	FN_NR	0x8d	/* 141 */
X#define	RES1	0x8e	/* 142 */
X#define	RES2	0x8f	/* 143 */
X#define	RD_ON	0x90	/* 144 */
X#define	RD_OF	0x91	/* 145 */
X#define	ST_ON	0x92	/* 146 */
X#define	ST_OF	0x93	/* 147 */
X#define	UL_ON	0x94	/* 148 */
X#define	UL_OFF	0x95	/* 149 */
X#define	RES3	0x96	/* 150 */
X#define	RES4	0x97	/* 151 */
X#define	O_SLAG	0x99	/* 153 */
X#define	BD_OFF	0x9c	/* 156 */
X#define	BD_ON	0x9d	/* 157 */
X#define	STREEP	0xa9	/* 169 */
X#define	S_HYPH	0xaa	/* 170 */
X#define	H_HYPH	0xac	/* 171 */
X#define	SUP_ON	0xbc	/* 188 */
X#define	SUB_ON	0xbd	/* 189 */
X#define	UP_ON	0xbe	/* 190 */
X#define	DOWN_ON	0xbf	/* 191 */
X#define	KNTL	0xc0	/* 192 */
X#define	RG_AFST	0xc1	/* 193 */
X#define	CTR_ON	0xc3	/* 195 */
X#define	SR_ON	0xc4	/* 196 */
X#define	RE_HY	0xc5	/* 197 */
X#define	POS_NUM	0xc6	/* 198 */
X#define	NEW_NUM	0xc7	/* 199 */
X#define	PG_POS	0xc8	/* 200 */
X#define	GEEN1	0xc9	/* 201 */
X#define	C_E_PG	0xca	/* 202 */
X#define	LET_SET	0xcb	/* 203 */
X#define	INSPR	0xcc	/* 204 */
X#define	T_MARG	0xcd	/* 205 */
X#define	BO_MARG	0xce	/* 206 */
X#define	NO_ALL	0xcf	/* 207 */
X#define	PG_LNGT	0xd0	/* 208 */
X#define	HE_FT	0xd1	/* 209 */
X#define	FT_NUM	0xd3	/* 211 */
X#define	LF_HLF	0xd4	/* 212 */
X#define	RPI_SET	0xd5	/* 213 */
X#define	EXT_TAB	0xd6	/* 214 */
X#define	DF_MCOL	0xd7	/* 215 */
X#define	S_ALIGN	0xd8	/* 216 */
X#define	RES5	0xd9	/* 217 */
X#define	UL_SET	0xda	/* 218 */
X#define	HP_SET	0xdc	/* 220 */
X#define	DF_COL	0xdd	/* 221 */
X#define	CEN_OFF	0xde	/* 222 */
X#define	CEN_IN	0xe0	/* 224 */
X#define	EX_CH	0xe1	/* 225 */
X#define	NOOT	0xe2	/* 226 */
X#define	NOOT_OP	0xe3	/* 227 */
X#define	NEW_FT	0xe4	/* 228 */
X#define	DF_PAR	0xe5	/* 229 */
X#define	PR_NUM	0xe6	/* 230 */
X#define	T_MARB	0xe7	/* 231 */
X#define	T_MARE	0xe8	/* 232 */
X#define	T_M_DF	0xe9	/* 233 */
X#define	DF_I_M	0xea	/* 234 */
X#define	SYS_DAT	0xeb	/* 235 */
X#define	BLK_PR	0xec	/* 236 */
X#define	NUM_SET	0xf0	/* 240 */
X#define	TAB_SET	0xf1	/* 241 */
X
X/* convert table for accents etc */
X
Xstatic char *troff_table[256]={
X/* 000 */ "\\000","\\001","\\002","\\003","\\004","\\005","\\006","\\007",	
X/* 008 */ "\\008","\\009","\\010","\\011","\\012","\\013","\\014","\\015",
X/* 016 */ "\\016","\\017","\\018","\\019","\\020","\\021","\\022","\\023",
X/* 024 */ "\\024","\\025","\\026","\\027","\\028","\\029","\\030","\\031",	
X/* 032 */ "\\032","\\033","\\034","\\035","\\036","\\037","\\038","\\039",	
X/* 040 */ "\\040","\\041","\\042","\\043","\\044","\\045","\\046","\\047",	
X/* 048 */ "\\048","\\049","\\050","\\051","\\052","\\053","\\054","\\055",	
X/* 056 */ "\\056","\\057","\\058","\\059","\\060","\\061","\\062","\\063", 
X/* 064 */ "\\064","\\065","\\066","\\067","\\068","\\069","\\070","\\071",	
X/* 072 */ "\\072","\\073","\\074","\\075","\\076","\\077","\\078","\\079",	
X/* 080 */ "\\080","\\081","\\082","\\083","\\084","\\085","\\086","\\087",
X/* 088 */ "\\088","\\089","\\090","\\091","\\092","\\093","\\094","\\095",	
X/* 096 */ "\\096","\\097","\\098","\\099","\\100","\\101","\\102","\\103", 
X/* 104 */ "\\104","\\105","\\106","\\107","\\108","\\109","\\110","\\111",
X/* 112 */ "\\112","\\113","\\114","\\115","\\116","\\117","\\118","\\119",	
X/* 120 */ "\\120","\\121","\\122","\\123","\\124","\\125","\\126","\\127",	
X/* 128 */ "\\(,C","\\(:u","\\('e","\\(^a","\\(:a","\\(`a","\\(oa","\\(,c",
X/* 136 */ "\\(^e","\\(:e","\\(`e","\\(:i","\\(^i","\\(`i","\\(:A","\\(oA",	
X/* 144 */ "\\('E","\\(ae","\\(AE","\\(^o","\\(:o","\\(`o","\\(^u","\\(`u",	
X/* 152 */ "\\(:y","\\(:O","\\(:U","\\(xx","\\(Po","\\(Ye","\\(Pt","\\(xx",	
X/* 160 */ "\\('a","\\('i","\\('o","\\('u","\\(~n","\\(~N","\\(of","\\(Om",	
X/* 168 */ "\\(r?","\\(xx","\\(no","\\(12","\\(14","\\(r!","\\(Fo","\\(Fc",	
X/* 176 */ "\\(bx","\\(bx","\\(bx","\\179","\\180","\\181","\\182","\\183",	
X/* 184 */ "\\184","\\185","\\186","\\187","\\188","\\189","\\190","\\191",	
X/* 192 */ "\\192","\\193","\\194","\\195","\\196","\\197","\\198","\\199",	
X/* 200 */ "\\200","\\201","\\202","\\203","\\204","\\205","\\206","\\207", 
X/* 208 */ "\\208","\\209","\\210","\\211","\\212","\\213","\\214","\\215",	
X/* 216 */ "\\216","\\217","\\218","\\219","\\220","\\221","\\222","\\223",	
X/* 224 */ "\\(*a","\\(*b","\\(*G","\\(*p","\\(*S","\\(*s","\\(*m","\\(*t",	
X/* 232 */ "\\(*f","\\(*T","\\(*W","\\(*d","\\(if","\\(*F","\\(*e","\\(ca",	
X/* 240 */ "\\(==","\\(+-","\\(>=","\\(<=","\\(is","\\(rb","\\(dv","\\(~~",	
X/* 248 */ "\\(de","\\(bu","\\(md","\\(sr","\\(*y","\\(ps","\\(xx","\\255"	
X};	
X/* table for troff codes */
X
Xstatic char *troff_code[256]={
X
X/*0	1	2	3	4	5	 6	7 */
X
X/*000*/ "000","001","002","003","004","005","006","007",
X/*008*/ "008","009",".sp\n","011",".bp\n","013","014","015",
X/*016*/ "016","017","018","019","020","021","022","023",
X/*024*/ "024","025","026","027","028","029","030","031",
X/*032*/ "032","033","034","035","036","037","038","039",
X/*040*/ "040","041","042","043","044","045","046","047",
X/*048*/ "048","049","050","051","052","053","054","055",
X/*056*/ "056","057","058","059","060","\\*]","\\*>","063",
X/*064*/ "064","065","066","067","068","069","070","071",
X/*072*/ "072","073","074","075",".)l\n","077","078","079",
X/*080*/ "080","081","082","083","084","085","086","087",
X/*088*/ "088","089","090","091","092","093","094","095",
X/*096*/ "096","097","098",".)f\n","100","101","102","103",
X/*104*/ "","","","","","","","",
X/*112*/ "112","113","114","115","116","117","118","119",
X/*120*/ "120","121","122","123","124","125","126","127",
X/*128*/ "","","",".sp 1\n","","","","",
X/*136*/ "","","","","","","","",
X/*144*/ "008","009","010","011",".ft I\n",".ft R\n","014","015",
X/*152*/ "000","001","002","003",".ft R\n",".ft B\n","006","007",
X/*160*/ "008","009","010","011","012","013","014","015",
X/*168*/ "000","\\-","002","003","004","005","006","007",
X/*176*/ "008","009","010","011","012","013","014","015",
X/*184*/ "000","001","002","003","\\*[","\\*<","006","007",
X/*192*/ "008","009","010",".ce\n","012","013","014","015",
X/*200*/ "200","201","202","203",".(l F\n","205","206","207",
X/*208*/ "008","009","010","011","012","013","014","015",
X/*216*/ "008","009","010","011","012","013","222","015",
X/*224*/ "224","225","\\**\n.(f\n\\**","227","228","229","230","231",
X/*232*/ "008","009","010","011","012","013","014","015",
X/*240*/ "008","009","010","011","012","013","014","015",
X/*248*/ "008","009","010","011","012","013","014","015"
X};	
X
End_of_shar
ls -l 'conv_wp.h'

echo 'Extracting wp.h ...'
sed 's/^X//' > 'wp.h' <<'End_of_shar'
X/* Alle the definitions are Wordperfect 4.1 codes */
X/* but it works fine with 4.2 */
X/* */
X#define MAX_STRING	25
X#define HEADER_FOOTER	209
X#define EXT_CHAR	225
X#define FOOTNOTE	226
X
Xtypedef struct wp_codes{
X	int trans;	/* 0= no translation 1= translation 2= special */
X	int number;	/* 0= 1 code 1= long code*/
X	char troff_b[MAX_STRING];	/* begin code for troff with me macro */
X	char troff_e[MAX_STRING];	/* end code for troff with me macro */
X	int special;	/* 1= special 0= normal */
X	int new_line;	/* code uses new_line at end of code */
X	int start_lf;	/* code needs new_line at begin of code */
X};
X	
Xstruct wp_codes codes[256] = { 	/* initialize codes */
X/* 000 */ 	{0,0," 0000","e000",0,0,0},	/* special */
X/* 001 */ 	{1,0," 0001","e000",0,0,0},	/* special */
X/* 002 */ 	{1,0,"","e000",0,0,0},	/* PAGE NUMBER 4.2 */
X/* 003 */ 	{0,0," 0003","e000",0,0,0},	/* special */
X/* 004 */ 	{0,0," 0004","e000",0,0,0},	/* special */
X/* 005 */ 	{0,0," 0005","e000",0,0,0},	/* special */
X/* 006 */ 	{0,0," 0006","e000",0,0,0},	/* special */
X/* 007 */ 	{0,0," 0007","e000",0,0,0},	/* special */
X/* 008 */ 	{0,0," 0008","e000",0,0,0},	/* special */
X/* 009 */ 	{1,0,"\t","e000",1,1,0},	/* TAB */
X/* 010 */ 	{1,0,".br\n",".sp\n",1,1,1},	/* HARD NEW LINE */
X/* 011 */ 	{1,0,"","e000",1,1,0},		/* SOFT NEW PAGE */
X/* 012 */ 	{1,0,".bp\n","e000",1,1,1},	/* HARD NEW PAGE */
X/* 013 */ 	{1,0,"\n","e000",1,1,0},	/* SOFT NEW LINE */
X/* 014 */ 	{1,0," 0014","e000",1,1,0},	/* special code */
X/* 015 */ 	{1,0," 0015","e000",1,1,0},	/* special code */
X/* 016 */ 	{0,0," 0016","e000",0,0,0},	/* ASCII CODE */
X/* 017 */ 	{0,0," 0017","e000",0,0,0},	/* ASCII CODE */
X/* 018 */ 	{0,0," 0018","e000",0,0,0},	/* ASCII CODE */
X/* 019 */ 	{0,0," 0019","e000",0,0,0},	/* ASCII CODE */
X/* 020 */ 	{0,0," 0020","e000",0,0,0},	/* ASCII CODE */
X/* 021 */ 	{0,0," 0021","e000",0,0,0},	/* ASCII CODE */
X/* 022 */ 	{0,0," 0022","e000",0,0,0},	/* ASCII CODE */
X/* 023 */ 	{0,0," 0023","e000",0,0,0},	/* ASCII CODE */
X/* 024 */ 	{0,0," 0024","e000",0,0,0},	/* ASCII CODE */
X/* 025 */ 	{0,0," 0025","e000",0,0,0},	/* ASCII CODE */
X/* 026 */ 	{0,0," 0026","e000",0,0,0},	/* ASCII CODE */
X/* 027 */ 	{0,0," 0027","e000",0,0,0},	/* ASCII CODE */
X/* 028 */ 	{0,0," 0028","e000",0,0,0},	/* ASCII CODE */
X/* 029 */ 	{0,0," 0029","e000",0,0,0},	/* ASCII CODE */
X/* 030 */ 	{0,0," 0030","e000",0,0,0},	/* ASCII CODE */
X/* 031 */ 	{0,0," 0031","e000",0,0,0},	/* ASCII CODE */
X/* 032 */ 	{1,0," ","e000",1,0,0},		/* ASCII CODE */
X/* 033 */ 	{0,0," 0033","e000",0,0,0},	/* ASCII CODE */
X/* 034 */ 	{0,0," 0034","e000",0,0,0},	/* ASCII CODE */
X/* 035 */ 	{0,0," 0035","e000",0,0,0},	/* ASCII CODE */
X/* 036 */ 	{0,0," 0036","e000",0,0,0},	/* ASCII CODE */
X/* 037 */ 	{0,0," 0037","e000",0,0,0},	/* ASCII CODE */
X/* 038 */ 	{0,0," 0038","e000",0,0,0},	/* ASCII CODE */
X/* 039 */ 	{0,0," 0039","e000",0,0,0},	/* ASCII CODE */
X/* 040 */ 	{0,0," 0040","e000",0,0,0},	/* ASCII CODE */
X/* 041 */ 	{0,0," 0041","e000",0,0,0},	/* ASCII CODE */
X/* 042 */ 	{0,0," 0042","e000",0,0,0},	/* ASCII CODE */
X/* 043 */ 	{0,0," 0043","e000",0,0,0},	/* ASCII CODE */
X/* 044 */ 	{0,0," 0044","e000",0,0,0},	/* ASCII CODE */
X/* 045 */ 	{0,0," 0045","e000",0,0,0},	/* ASCII CODE */
X/* 046 */ 	{1,0,"\\(md","e000",1,0,0},	/* ASCII CODE */
X/* 047 */ 	{0,0," 0047","e000",0,0,0},	/* ASCII CODE */
X/* 048 */ 	{0,0," 0048","e000",0,0,0},	/* ASCII CODE */
X/* 049 */ 	{0,0," 049","e000",0,0,0},	/* ASCII CODE */
X/* 050 */ 	{0,0," 0050","e000",0,0,0},	/* ASCII CODE */
X/* 051 */ 	{0,0," 0051","e000",0,0,0},	/* ASCII CODE */
X/* 052 */ 	{0,0," 0052","e000",0,0,0},	/* ASCII CODE */
X/* 053 */ 	{0,0," 0053","e000",0,0,0},	/* ASCII CODE */
X/* 054 */ 	{0,0," 0054","e000",0,0,0},	/* ASCII CODE */
X/* 055 */ 	{0,0," 0055","e000",0,0,0},	/* ASCII CODE */
X/* 056 */ 	{0,0," 0056","e000",0,0,0},	/* ASCII CODE */
X/* 057 */ 	{0,0," 0057","e000",0,0,0},	/* ASCII CODE */
X/* 058 */ 	{0,0," 0058","e000",0,0,0},	/* ASCII CODE */
X/* 059 */ 	{0,0," 0059","e000",0,0,0},	/* ASCII CODE */
X/* 060 */ 	{0,0," 0060","e000",0,0,0},	/* ASCII CODE */
X/* 061 */ 	{0,0," 0061","e000",0,0,0},	/* ASCII CODE */
X/* 062 */ 	{0,0," 0062","e000",0,0,0},	/* ASCII CODE */
X/* 063 */ 	{0,0," 0063","e000",0,0,0},	/* ASCII CODE */
X/* 064 */ 	{0,0," 0064","e000",0,0,0},	/* ASCII CODE */	
X/* 065 */ 	{0,0," 0065","e000",0,0,0},	/* ASCII CODE */
X/* 066 */ 	{0,0," 0066","e000",0,0,0},	/* ASCII CODE */
X/* 067 */ 	{0,0," 0067","e000",0,0,0},	/* ASCII CODE */
X/* 068 */ 	{0,0," 0068","e000",0,0,0},	/* ASCII CODE */
X/* 069 */ 	{0,0," 0069","e000",0,0,0},	/* ASCII CODE */
X/* 070 */ 	{0,0," 0070","e000",0,0,0},	/* ASCII CODE */
X/* 071 */ 	{0,0," 0071","e000",0,0,0},	/* ASCII CODE */
X/* 072 */ 	{0,0," 0072","e000",0,0,0},	/* ASCII CODE */
X/* 073 */ 	{0,0," 0073","e000",0,0,0},	/* ASCII CODE */
X/* 074 */ 	{0,0," 0074","e000",0,0,0},	/* ASCII CODE */
X/* 075 */ 	{0,0," 0075","e000",0,0,0},	/* ASCII CODE */
X/* 076 */ 	{0,0," 0076","e000",0,0,0},	/* ASCII CODE */
X/* 077 */ 	{0,0," 0077","e000",0,0,0},	/* ASCII CODE */
X/* 078 */ 	{0,0," 0078","e000",0,0,0},	/* ASCII CODE */
X/* 079 */ 	{0,0," 0079","e000",0,0,0},	/* ASCII CODE */
X/* 080 */ 	{0,0," 0080","e000",0,0,0},	/* ASCII CODE */
X/* 081 */ 	{0,0," 0081","e000",0,0,0},	/* ASCII CODE */
X/* 082 */ 	{0,0," 0082","e000",0,0,0},	/* ASCII CODE */
X/* 083 */ 	{0,0," 0083","e000",0,0,0},	/* ASCII CODE */
X/* 084 */ 	{0,0," 0084","e000",0,0,0},	/* ASCII CODE */
X/* 085 */ 	{0,0," 0085","e000",0,0,0},	/* ASCII CODE */
X/* 086 */ 	{0,0," 0086","e000",0,0,0},	/* ASCII CODE */
X/* 087 */ 	{0,0," 0087","e000",0,0,0},	/* ASCII CODE */
X/* 088 */ 	{0,0," 0088","e000",0,0,0},	/* ASCII CODE */
X/* 089 */ 	{0,0," 0089","e000",0,0,0},	/* ASCII CODE */
X/* 090 */ 	{0,0," 0090","e000",0,0,0},	/* ASCII CODE */
X/* 091 */ 	{0,0," 0091","e000",0,0,0},	/* ASCII CODE */
X/* 092 */ 	{0,0," 0092","e000",0,0,0},	/* ASCII CODE */
X/* 093 */ 	{0,0," 0093","e000",0,0,0},	/* ASCII CODE */
X/* 094 */ 	{0,0," 0094","e000",0,0,0},	/* ASCII CODE */
X/* 095 */ 	{0,0," 0095","e000",0,0,0},	/* ASCII CODE */
X/* 096 */ 	{0,0," 0096","e000",0,0,0},	/* ASCII CODE */
X/* 097 */ 	{0,0," 0097","e000",0,0,0},	/* ASCII CODE */
X/* 098 */ 	{0,0," 0098","e000",0,0,0},	/* ASCII CODE */
X/* 099 */ 	{0,0," 0099","e000",0,0,0},	/* ASCII CODE */
X/* 100 */ 	{0,0," 0100","e000",0,0,0},	/* ASCII CODE */
X/* 101 */ 	{0,0," 0101","e000",0,0,0},	/* ASCII CODE */
X/* 102 */ 	{0,0," 0102","e000",0,0,0},	/* ASCII CODE */
X/* 103 */ 	{0,0," 0103","e000",0,0,0},	/* ASCII CODE */
X/* 104 */ 	{0,0," 0104","e000",0,0,0},	/* ASCII CODE */
X/* 105 */ 	{0,0," 0105","e000",0,0,0},	/* ASCII CODE */
X/* 106 */ 	{0,0," 0106","e000",0,0,0},	/* ASCII CODE */
X/* 107 */ 	{0,0," 0107","e000",0,0,0},	/* ASCII CODE */
X/* 108 */ 	{0,0," 0108","e000",0,0,0},	/* ASCII CODE */
X/* 109 */ 	{0,0," 0109","e000",0,0,0},	/* ASCII CODE */
X/* 110 */ 	{0,0," 0110","e000",0,0,0},	/* ASCII CODE */
X/* 111 */ 	{0,0," 0111","e000",0,0,0},	/* ASCII CODE */
X/* 112 */ 	{0,0," 0112","e000",0,0,0},	/* ASCII CODE */
X/* 113 */ 	{0,0," 0113","e000",0,0,0},	/* ASCII CODE */
X/* 114 */ 	{0,0," 0114","e000",0,0,0},	/* ASCII CODE */
X/* 115 */ 	{0,0," 0115","e000",0,0,0},	/* ASCII CODE */
X/* 116 */ 	{0,0," 0116","e000",0,0,0},	/* ASCII CODE */
X/* 117 */ 	{0,0," 0117","e000",0,0,0},	/* ASCII CODE */
X/* 118 */ 	{0,0," 0118","e000",0,0,0},	/* ASCII CODE */
X/* 119 */ 	{0,0," 0119","e000",0,0,0},	/* ASCII CODE */
X/* 120 */ 	{0,0," 0120","e000",0,0,0},	/* ASCII CODE */
X/* 121 */ 	{0,0," 0121","e000",0,0,0},	/* ASCII CODE */
X/* 122 */ 	{0,0," 0122","e000",0,0,0},	/* ASCII CODE */
X/* 123 */ 	{0,0," 0123","e000",0,0,0},	/* ASCII CODE */
X/* 124 */ 	{0,0," 0124","e000",0,0,0},	/* ASCII CODE */
X/* 125 */ 	{0,0," 0125","e000",0,0,0},	/* ASCII CODE */
X/* 126 */ 	{0,0," 0126","e000",0,0,0},	/* ASCII CODE */
X/* 127 */ 	{0,0," 0127","e000",0,0,0},	/* ASCII CODE */
X/* 128 */ 	{1,0," 0128","e000",0,0,0},	/* NO_OP */
X/* 129 */ 	{1,0," 0129","e000",0,0,0},	/* RIGHT JUST ON */
X/* 130 */ 	{1,0," 0130","e000",0,0,0},	/* RIGHT JUST OFF */
X/* 131 */ 	{1,0," 0131","e000",0,0,0},	/* END CENTERED TEXT */
X/* 132 */ 	{1,0,"","e000",0,0,0},	/* END ALIGNED TEXT */
X/* 133 */ 	{1,0," 0133","e000",0,0,0},	/* TEMP START MATH CALC */
X/* 134 */ 	{1,0," 0134","e000",0,0,0},	/* CENTER PAGE */
X/* 135 */ 	{1,0," 0135","e000",0,0,0},	/* BEGIN COLUMN MODE */
X/* 136 */ 	{1,0," 0136","e000",0,0,0},	/* END COLUMN MODE */
X/* 137 */ 	{1,0," 0137","e000",0,0,0},	/* TAB AFTER RIGHT MARGIN */
X/* 138 */ 	{1,0," 0138","e000",0,0,0},	/* WIDOW CONTROL ON */
X/* 139 */ 	{1,0," 0139","e000",0,0,0},	/* WIDOW CONTROL OFF */
X/* 140 */ 	{1,0,"","e000",0,0,0},		/* HARD EOL AND SOFT EOP */
X/* 141 */ 	{1,0," 0141","e000",0,0,0},	/* FOOTNOTE NUMBER */
X/* 142 */ 	{1,0," 0142","e000",0,0,0},	/* RESERVED */
X/* 143 */ 	{1,0," 0143","e000",0,0,0},	/* RESERVED */
X/* 144 */ 	{1,0," 0144","e000",0,0,0},	/* RED LINE ON */
X/* 145 */ 	{1,0," 0145","e000",0,0,0},	/* RED LINE OFF */
X/* 146 */ 	{1,0," 0146","e000",0,0,0},	/* STRIKE OUT ON */
X/* 147 */ 	{1,0," 0147","e000",0,0,0},	/* STRIKE OUT OFF */
X/* 148 */ 	{1,0,".ft I\n","e000",0,1,1},	/* UNDERLINE ON */
X/* 149 */ 	{1,0,".ft R\n","e000",0,1,1},	/* UNDERLINE OFF */
X/* 150 */ 	{1,0," 0150","e000",0,0,0},	/* REVERSE VIDEO ON*/
X/* 151 */ 	{1,0," 0151","e000",0,0,0},	/* REVERSE VIDEO OFF */
X/* 152 */ 	{1,0," 0152","e000",0,0,0},	/* TABLE OF PLACEHOLDER */
X/* 153 */ 	{1,0," 0153","e000",0,0,0},	/* OVERSTRIKE */
X/* 154 */ 	{1,0," 0154","e000",0,0,0},	/* CANCEL HYPH WORD */
X/* 155 */ 	{1,0," 0155","e000",0,0,0},	/* END OF GEN. TEXT */
X/* 156 */ 	{1,0,".ft R\n","e000",0,1,1},	/* BOLD OFF */
X/* 157 */ 	{1,0,".ft B\n","e000",0,1,1},	/* BOLD ON */
X/* 158 */ 	{1,0," 0158","e000",0,0,0},	/* HYPHENATION OFF */
X/* 159 */ 	{1,0," 0159","e000",0,0,0},	/* HYPHENATION ON */
X/* 160 */ 	{1,0," ","e000",0,0,0},		/* HARD SPACE */
X/* 161 */ 	{1,0,"","e000",0,0,0},		/* DO SUBTOTAL */
X/* 162 */ 	{1,0,"","e000",0,0,0},		/* SUBTOTAL ENTRY */
X/* 163 */ 	{1,0,"","e000",0,0,0},		/* DO TOTAL*/
X/* 164 */ 	{1,0," 0164","e000",0,0,0},	/* TOTAL ENTRY */
X/* 165 */ 	{1,0," 0165","e000",0,0,0},	/* DO GRAND TOTAL */
X/* 166 */ 	{1,0," 0166","e000",0,0,0},	/* MATH CALC COLUMN */
X/* 167 */ 	{1,0," 0167","e000",0,0,0},	/* BEGIN MATH MODE */
X/* 168 */ 	{1,0," 0168","e000",0,0,0},	/* END MATH MODE */
X/* 169 */ 	{1,0,"-","e000",0,0,0},		/* HARD HYPHEN IN LINE */
X/* 170 */ 	{1,0,"-","e000",0,0,0},		/* HARD HYPHEN AT EOL */
X/* 171 */ 	{1,0,"-","e000",0,0,0},		/* HARD HYPHEN AT EOP */
X/* 172 */ 	{1,0,"","e000",0,0,0},		/* SOFT HYPHEN */
X/* 173 */ 	{1,0,"","e000",0,0,0},		/* SOFT HYPHEN AT EOL */
X/* 174 */ 	{0,0,"","e000",0,0,0},		/* SOFT HYPHEN AT EOP */
X/* 175 */ 	{1,0," 0175","e000",0,0,0},	/* EOT COLUMNS AND EOL */
X/* 176 */ 	{1,0," 0176","e000",0,0,0},	/* EOT COLUMNS AND EOP */
X/* 177 */ 	{1,0," 0177","e000",0,0,0},	/* NOT KNOWN YET */
X/* 178 */ 	{1,0," 0178","e000",0,0,0},	/* NOT KNOWN YET */
X/* 179 */ 	{1,0," 0179","e000",0,0,0},	/* NOT KNOWN YET */
X/* 180 */ 	{1,0," 0180","e000",0,0,0},	/* NOT KNOWN YET */
X/* 181 */ 	{1,0," 0181","e000",0,0,0},	/* NOT KNOWN YET */
X/* 182 */ 	{1,0," 0182","e000",0,0,0},	/* NOT KNOWN YET */
X/* 183 */ 	{1,0," 0183","e000",0,0,0},	/* NOT KNOWN YET */
X/* 184 */ 	{1,0," 0184","e000",0,0,0},	/* NOT KNOWN YET */
X/* 185 */ 	{1,0," 0185","e000",0,0,0},	/* NOT KNOWN YET */
X/* 186 */ 	{1,0," 0186","e000",0,0,0},	/* NOT KNOWN YET */
X/* 187 */ 	{1,0," 0187","e000",0,0,0},	/* NOT KNOWN YET */
X/* 188 */ 	{1,0," 0188","e000",0,0,0},	/* SUPERSCRIPT */
X/* 189 */ 	{1,0," 0189","e000",0,0,0},	/* SUBSCRIPT */
X/* 190 */ 	{1,0," 0190","e000",0,0,0},	/* ADV. PRINTER 1/2 L UP */
X/* 191 */ 	{1,0," 0191","e000",0,0,0},	/* ADV. PRINTER 1/2 L DOWN */
X		/* The next codes are multi-byte formatting codes */
X		/* The code are in hex( <C0> = 192 )*/
X/*						*/
X/* 192 */ 	{1,1,"","e000",0,0,0},		/* MARGIN RESET */
X
X		/*
X		<C0><old left><old right><new left><new right><C0>
X		*/
X
X/* 193 */ 	{1,1," 0193","e000",0,0,0},	/* SPACING RESET */
X
X		/*
X		<C1><old spacing><new spacing><C1>
X		*/
X
X/* 194 */ 	{1,1," 0194","e000",0,0,0},	/* LEFT MARGIN RELEASE */
X
X		/*
X		<C2><# spaces to go left><C2> 
X		*/
X
X/* 195 */ 	{1,1,".ce\n","e000",1,1,1},	/* CENTER FOLLOWING TEXT*/
X
X		/*
X		<C3><type><center col#><start col#><C3><text><83>
X
X		type=0 for centering between margins
X		type=1 for centering around current column
X		<83> is the code for ending centered text
X		*/
X
X/* 196 */ 	{1,1," 0196","e000",0,0,0},	/* ALIGN OR FLUSH RIGHT */
X
X		/*
X		<C4><align char><align col#><start col#><C4><text><84>
X
X		If align char=12(newline), this is a flush right command
X		and the align col# is the right margin; otherwise, the 
X		align col# is the next tab stop.
X		If the high bit of the align char is set, then this is
X		a dot leader aliign or dot leader flush right.
X		<84> is the code for ending aligned or flushed right
X		*/
X
X/* 197 */ 	{1,1," 0197","e000",0,0,0},	/* RESET HYPH ZONE */
X
X		/*
X		<C5><old left><old right><new left><new right><C5>
X		*/
X
X/* 198 */ 	{1,1," 0198","e000",0,0,0},	/* SET PAGE NO POSITION */
X
X		/*
X		<C6><old pos code><new pos code><C6>
X
X		code: 0=none, 1=top left, 2=top center, 3=top right
X		      4=top L&R, 5=bot left, 6=bot center, 7= bot right
X		      8=bot L&R
X		*/
X
X/* 199 */ 	{1,1," 0199","e000",0,0,0},	/* SET PAGE NUMBER */
X
X		/*
X		<C7><old# high ord><old# low ord><new# high ord><new#
X		low ord><C7>
X
X		Only the low order 15 bits determine the page number.If
X		high bit is set the numbers are Roman numerals;if not,
X		Arabic numbers.
X		*/
X
X/* 200 */ 	{1,1," 0200","e000",0,0,0},	/* SET PAGE NU COLUMN */
X
X		/*
X		<C8><old left><old center><old right><new left>
X		<new center><new right><C8>
X		*/
X
X/* 201 */ 	{1,1," 0201","e000",0,0,0},	/* SET TABS */
X
X		/*
X		<C9><old tab table(20 bytes)><new tab table(20 bytes)>
X		<C9>
X
X		Each bit represents one character position from bit 0
X		to bit 159. There ara a maximum of 160 characters
X		allowed in a Wordperfect line.
X		*/
X
X/* 202 */ 	{1,1," 0202","e000",0,0,0},	/* CONDITIONAL EOP */
X
X		/*
X		<CA><number of single spaced ines not to be broken>
X		<CA>
X		*/
X/* 203 */ 	{1,1,"","e000",0,0,0},	/* SET PITCH OR FONT */
X
X		/*
X		<CB><old pitch><old font><new pitch><new font><CB>
X
X		If the pitch is a negative value, then the font is
X		proportional.
X		*/
X
X/* 204 */ 	{1,1,"","e000",0,0,0},	/* SET TEMP. MARGIN */
X
X		/*
X		<CC><old tmpmargin><new tmpmargin><CC>
X		*/
X
X/* 205 */ 	{1,1," 0205","e000",0,0,0},	/* OLD END OF TEMP. MARGIN */
X
X		/*
X		no longer used
X		<CD><tmpmargin><CD>
X		*/
X
X/* 206 */ 	{1,1," 0206","e000",0,0,0},	/* SET TOP MARGIN */
X
X		/*
X		<CE><old top margin><new top margin><CE>
X		*/
X
X/* 207 */ 	{1,1,"","e000",0,0,0},	/* SUPPRESS PAGE CHARACTERISTICS */
X
X		/*
X		<CF><suppress codes><CF>
X
X		Codes:(any or all bits may be inclusive or'd together)
X		1=all suppressed, 2=page number suppressed
X		4=page numbers moved to bottom
X		10=all headers suppressed,20=header a suppressed
X		40=header b suppressed,100=footer a suppressed
X		200=footer b suppressed
X		*/
X
X/* 208 */ 	{1,1," 0208","e000",0,0,0},	/* SET FORM LENGTH */
X
X		/*
X		<D0><old form len><old # text lines><new form len>
X		<new # text lines><D0>
X		*/
X
X/* 209 */ 	{2,1,"[H//F]\n","'\n",1,1,1},	/* HEADER/FOOTER */
X
X		/*
X		<D1><old def byte<# half-lines use by header/footer>
X		<FF><FF><lmargin><rmargin><text><FF>
X		<#half-lines used by new header/footer><new def byte>
X	 	<D1>
X
X		Def byte contents are type(two low-order bits> and
X		occurence (six high bits). The low-order 2 bits of the
X		Def byte MUST be correct
X		Type		Occurence
X		0 = header a	0 = never
X		1 = header b	1 = all pages
X		2 = footer a	2 = odd pages
X		3 = footer b	4 = even pages
X		*/
X
X/* 210 */ 	{1,1," 0210","e000",0,0,0},	/* FOOTNOTE */
X
X		/*
X		Not used in version 4.0 and above;see 343/E4
X
X		<D2><fn#><# half-lines><FF><lmargin><rmargin><text><D2>
X		*/
X
X/* 211 */ 	{1,1," 0211","e000",0,0,0},	/* SET FOOTNOTE NUMBER */
X
X		/*
X		not used in version 4.0 and above
X
X		<D3><old line #><new line #><D3>
X		*/
X
X/* 212 */ 	{1,1," 0212","e000",0,0,0},	/* ADVANCE TO HALF LINE # */
X
X		/*
X		stored in half-line units
X
X		<D4><old line #><advance to half line #><D4>
X		*/
X
X/* 213 */ 	{1,1," 0213","e000",0,0,0},	/* SET LINES PER INCH */
X
X		/*
X		6 or 8 lpi are the only valid values
X
X		<D5><old lpi code><new lpi code><D5>
X		*/
X
X/* 214 */ 	{1,1," 0214","e000",0,0,0},	/* SET EXTENDED TABS */
X
X		/*
X		<D6><old start><old increment><new start><new increment
X		<D6>
X		*/
X
X/* 215 */ 	{1,1," 0215","e000",0,0,0},	/* DEFINE MATH COLUMNS */
X
X		/*
X		<D7><old column def (24 bytes)>[<old calc 0>]<0>
X		[<old calc 1>]<0>[<old calc 2>]<0>[<old calc 3>]
X		<0><D7><new column def (24 bytes)>[<new calc 0>]
X		<0>[<new calc 1>]<0>[<new calc 2>]<0>[<new calc 3>]
X		<0><D7>
X
X		See "define columns"(code <DD>) for the 24 byte column
X		definition
X		 */
X
X/* 216 */ 	{1,1," 0216","e000",0,0,0},	/* SET ALIGNMENT CHAR */
X
X		/*
X		<D8><old char><new char><D8>
X		*/
X
X/* 217 */ 	{1,1," 0217","e000",0,0,0},	/* SET LEFT MARGIN RELEASE */
X
X		/*
X		columns to go left not used in version 4.0 and above
X
X		<D9><old #><new #><D9>
X		*/
X
X/* 218 */ 	{1,1," 0218","e000",0,0,0},	/* SET UNDERLINE MODE */
X
X		/*
X		<DA><old mode><new mode><DA>
X
X		0=normal underlining(breaks at word spaces)
X		1=double underlining(breaks)
X		2=single underlining(continuous)
X		3=double underlining(continuous)
X		*/
X
X/* 219 */ 	{1,1," 0219","e000",0,0,0},	/* SHEETFEED BIN NUMBER */
X
X		/*
X		<DB><old #><new #><DB>
X
X		Wordperfect stores the number as one less than the
X		bin number (bin #1 =0)
X		*/
X
X/* 220 */ 	{1,1,"","e000",0,0,0},		/* EOP FUNCTION */
X
X		/*
X		<DC><# of half-lines at EOP, low 7 bits><high 7 bits>
X		<# of half-lines used for footnotes>
X		<# pages used for footnotes>
X		<# footnotes on this page>
X		<ceop flag><suppress code><DC>
X		*/
X
X/* 221 */ 	{1,1," 0221","e000",0,0,0},	/* DEFINE COLUMNS */
X
X		/*
X		<DD><old # cols><l1><r1><l2><r2><l3><r3><l4><r4>
X		<l5><r5>
X		<new # cols><l1><r1><l2><r2><l3><r3><l4><r4>
X		<l5><r5>
X		<DD>
X
X		# cols:low-order 7 bits = the number
X		high-order 1 bit = 1 if parallel colums	
X		*/
X
X/* 222 */ 	{1,1,"","e000",0,0,0},	/* END OF TEMP.MARGIN */
X
X		/*
X		<DE><old left tmp margin><old right tmp margin><DE>
X		*/
X
X/* 223 */ 	{1,1," 0223","e000",0,0,0},	/* INVISIBLE CHARS */
X
X		/*
X		<DF><text in 7-bit characters><DF>
X
X		If a character has an ASCII code >= <6F> (ASCII 191)
X		the text portion of this function represents it as
X		<6F><(char-6F)>.
X		For example, the character ASCII 232(E8) would appear
X		as: <6F><(E8-6F)> or <6F><79>.
X		*/
X
X/* 224 */ 	{1,1,"","e000",0,0,0},	/* LEFT/RIGHT TEMP.MARGIN */
X
X		/*
X		pre 4.0 format:
X
X		<E0><new rt tmp margin><new lt tmp margin><E0>
X
X		4.0 and later format:
X		<E0><0><difference between old and new left margin><E0>
X		*/
X
X/* 225 */ 	{2,1," 0225","e000",1,0,0},	/* EXTENDED CHAR */
X
X		/*
X		<E1><character><E1>
X		*/
X
X/* 226 */ 	{2,1,".f(\n",".f)\n",1,1,1},	/* NEW FOOTNOTE/ENDNOTE */
X
X		/*
X		<E2><def><a><b><c><d><old ftnote line><# lines page 1>
X		<# lines page 2><# lines page n><# pages><FF>
X		<l margin><r margin><text><E2>
X
X		where:
X		def: 
X		bit 0: 0= use numbers,1= use characters
X		bit 1: 0= footnote, 1= endnote
X		a,b: 	if def bit 0 is a 0 then a,b are footnote and 
X			endnote numbers.
X			if def bit 0 is a 1 then a= # characters and
X			b = a character
X		c,d:	numbers of lines in footnote/endnote
X		NOTE:a,b and c,d are 14 bits numbers split into two
X		7 bit bytes, high-order byte first.For endnotes, there
X		is only a null between <d> and <FF>
X
X		*/
X
X/* 227 */ 	{1,1," 0227","e000",0,0,0},	/* FOOTNOTE OPTIONS */
X
X		/*
X		<E3><old values 74 bytes><new values 74 bytes><E3>
X
X		Byte	Meaning
X		1	spacing in footnotes
X		2	spacing between footnotes
X		3	number of lines to keep together
X		4	flag byte (bits: b ln en ft n)
X			n:	1 if numbering starts on each page
X			en,ft	0= use numbers
X				1= use characters
X				2= use letters
X			ln:	0= no line separator
X				1= 2 inch line
X				2= line from left to right margin
X			b:	0= footnotes after text
X				1= footnotes at bottom of page
X		5	# of characters used in place of footnotenumbers
X		6-10	"numbering" characters (null terminated if <5)
X		11	# displayable chars in string for footnote(text)
X		12-26	string for footnote (text)
X		27	# displayable chars in string for endnote(text)
X		28-42	string for endnote (text)
X		43	# of displayable characters in string for 
X			footnote (note)
X		44-58	string for footnote (note)
X		59	# of displayable characters in string for 
X			endnote (note)
X		60-74	string for endnote (note)
X		*/
X
X/* 228 */ 	{1,1," 0228","e000",0,0,0},	/* NEW SET FOOTNOTE */
X
X		/*
X		<E4><old # high> old # low><new # high><new # low><E4>
X
X		Footnote numbers are 14-bit numbers split into two 
X		7-bits bytes, high-order byte first
X		*/
X
X/* 229 */ 	{1,1," 0229","e000",0,0,0},	/* PARAGRAPH NUMBER DEF */
X
X		/*
X		<E5><old 7 level numbers><old 7 def bytes>
X		<new 7 level numbers><new 7 def bytes>
X		<E5>
X		A def byte is two nibbles:
X		Style			Punctuation
X		(low nibble)		(high nibble)
X		0 = caps Roman		0 = nothing
X		1 = lcase Roman		1 = "." after number
X		2 = caps letter		2 = ")" after number
X		3 = lcase letter	3 = "(" before ")" after
X		4 = Arabic		
X		5 = Arabic with previous levels
X		    separated by "." (Ex:3.4.1)
X		*/
X
X/* 230 */ 	{1,1," 0230","e000",0,0,0},	/* PARAGRAPH NUMBER */
X
X		/*
X		<E6><new level #><def byte><old 7 numbers><E6>
X
X		Level number is 0 for first level, 1 second etc.
X		*/
X
X/* 231 */ 	{1,1," 0231","e000",0,0,0},	/* BEGIN MARKED TEXT */
X
X		/*
X		<E9><def, info><5 byte definition><E9>
X
X		The def, info byte is the same as the mark and end mark
X		except that the low nibble is significant only for lists
X		For the table contents, the five definition bytes
X		represents five levels.
X		For index and lists only, the first definition byte
X		is significant
X		Definition bytes:
X		0 = no page numbers
X		1 = page # after text, preceded by two spaces
X		2 = page # after text,in parentheses preceded by 1 space
X		3 = page # flush right
X		4 = page # flush right with dot leader
X		*/
X
X/* 232 */ 	{1,1," 0232","e000",0,0,0},	/* END MARKED TEXT */
X
X		/*
X		<EA>< 30 byte, null terminated format string><EA>
X		*/
X
X/* 233 */ 	{1,1," 0233","e000",0,0,0},	/* DEFINE MARKED TEXT */
X
X		/*
X		<EB>< 30 byte, null terminated format string><EB>
X		*/
X
X/* 234 */ 	{1,1," 0234","e000",0,0,0},	/* DEFINE INDEX MARK */
X
X		/*
X		<EC><def><# of half lines in block><EC>
X
X		Def:	0 for block protect on
X			1 for block protect off
X		*/
X
X/* 235 */ 	{1,1," 0235","e000",0,0,0},	/* DATE/TIME FUNTION */
X
X		/**/
X
X/* 236 */ 	{1,1," 0236","e000",0,0,0},	/* BLOCK PROTECT */
X
X		/**/
X
X/* 237 */ 	{0,0," 0237","e000",0,0,0},	/* NOT KNOWN YET */
X
X/* 238 */ 	{0,0," 0238","e000",0,0,0},	/* NOT KNOWN YET */
X
X/* 239 */ 	{0,0," 0239","e000",0,0,0},	/* NOT KNOWN YET */
X/* 240 */ 	{0,0," 0240","e000",0,0,0},	/* NOT KNOWN YET */
X/* 241 */ 	{0,0," 0241","e000",0,0,0},	/* NOT KNOWN YET */
X/* 242 */ 	{0,0," 0242","e000",0,0,0},	/* NOT KNOWN YET */
X/* 243 */ 	{0,0," 0243","e000",0,0,0},	/* NOT KNOWN YET */
X/* 244 */ 	{0,0," 0244","e000",0,0,0},	/* NOT KNOWN YET */
X/* 245 */ 	{0,0," 0245","e000",0,0,0},	/* NOT KNOWN YET */
X/* 246 */ 	{0,0," 0246","e000",0,0,0},	/* NOT KNOWN YET */
X/* 247 */ 	{0,0," 0247","e000",0,0,0},	/* NOT KNOWN YET */
X/* 248 */ 	{0,0," 0248","e000",0,0,0},	/* NOT KNOWN YET */
X/* 249 */ 	{0,0," 0249","e000",0,0,0},	/* NOT KNOWN YET */
X/* 250 */ 	{0,0," 0250","e000",0,0,0},	/* NOT KNOWN YET */
X/* 251 */ 	{0,0," 0251","e000",0,0,0},	/* NOT KNOWN YET */
X/* 252 */ 	{0,0," 0252","e000",0,0,0},	/* NOT KNOWN YET */
X/* 253 */ 	{0,0," 0253","e000",0,0,0},	/* NOT KNOWN YET */
X/* 254 */ 	{0,0," 0254","e000",0,0,0},	/* NOT KNOWN YET */
X/* 255 */ 	{0,0," 0255","e000",0,0,0}	/* NOT KNOWN YET */
X};
X
X/* Table to convert special characters to troff codes */
X
Xchar *troff_table[256]={
X/* 000 */ "\\000","\\001","\\002","\\003","\\004","\\005","\\006","\\007",	
X/* 008 */ "\\008","\\009","\\010","\\011","\\012","\\013","\\014","\\015",
X/* 016 */ "\\016","\\017","\\018","\\019","\\020","\\021","\\022","\\023",
X/* 024 */ "\\024","\\025","\\026","\\027","\\028","\\029","\\030","\\031",	
X/* 032 */ "\\032","\\033","\\034","\\035","\\036","\\037","\\038","\\039",	
X/* 040 */ "\\040","\\041","\\042","\\043","\\044","\\045","\\046","\\047",	
X/* 048 */ "\\048","\\049","\\050","\\051","\\052","\\053","\\054","\\055",	
X/* 056 */ "\\056","\\057","\\058","\\059","\\060","\\061","\\062","\\063", 
X/* 064 */ "\\064","\\065","\\066","\\067","\\068","\\069","\\070","\\071",	
X/* 072 */ "\\072","\\073","\\074","\\075","\\076","\\077","\\078","\\079",	
X/* 080 */ "\\080","\\081","\\082","\\083","\\084","\\085","\\086","\\087",
X/* 088 */ "\\088","\\089","\\090","\\091","\\092","\\093","\\094","\\095",	
X/* 096 */ "\\096","\\097","\\098","\\099","\\100","\\101","\\102","\\103", 
X/* 104 */ "\\104","\\105","\\106","\\107","\\108","\\109","\\110","\\111",
X/* 112 */ "\\112","\\113","\\114","\\115","\\116","\\117","\\118","\\119",	
X/* 120 */ "\\120","\\121","\\122","\\123","\\124","\\125","\\126","\\127",	
X/* 128 */ "\\(,C","\\(:u","\\('e","\\(^a","\\(:a","\\(`a","\\(oa","\\(,c",
X/* 136 */ "\\(^e","\\(:e","\\(`e","\\(:i","\\(^i","\\(`i","\\(:A","\\(oA",	
X/* 144 */ "\\('E","\\(ae","\\(AE","\\(^o","\\(:o","\\(`o","\\(^u","\\(`u",	
X/* 152 */ "\\(:y","\\(:O","\\(:U","\\(xx","\\(Po","\\(Ye","\\(Pt","\\(xx",	
X/* 160 */ "\\('a","\\('i","\\('o","\\('u","\\(~n","\\(~N","\\(of","\\(Om",	
X/* 168 */ "\\(r?","\\(xx","\\(no","\\(12","\\(14","\\(r!","\\(Fo","\\(Fc",	
X/* 176 */ "\\(bx","\\(bx","\\(bx","\\179","\\180","\\181","\\182","\\183",	
X/* 184 */ "\\184","\\185","\\186","\\187","\\188","\\189","\\190","\\191",	
X/* 192 */ "\\192","\\193","\\194","\\195","\\196","\\197","\\198","\\199",	
X/* 200 */ "\\200","\\201","\\202","\\203","\\204","\\205","\\206","\\207", 
X/* 208 */ "\\208","\\209","\\210","\\211","\\212","\\213","\\214","\\215",	
X/* 216 */ "\\216","\\217","\\218","\\219","\\220","\\221","\\222","\\223",	
X/* 224 */ "\\(*a","\\(ss","\\(*G","\\(*p","\\(*S","\\(*s","\\(*m","\\(*t",	
X/* 232 */ "\\(*f","\\(*T","\\(*W","\\(*d","\\(if","\\(/o","\\(*e","\\(ca",	
X/* 240 */ "\\(==","\\(+-","\\(>=","\\(<=","\\(is","\\(rb","\\(dv","\\(~~",	
X/* 248 */ "\\(de","\\(bu","\\(md","\\(sr","\\(*y","\\(ps","\\(xx","\\255"	
X};	
End_of_shar
ls -l 'wp.h'

echo 'Extracting wpc.c ...'
sed 's/^X//' > 'wpc.c' <<'End_of_shar'
X#include <stdio.h>
X#include <ctype.h>  
X#include <fcntl.h>  
X#include <string.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <sys/file.h>
X#include <sys/signal.h>
X#include "wp.h"
X
Xstatic int count,key,help_key,new_line_used,i,j;
Xstatic FILE *ifp,*ofp,*fclose(),*tfp;
Xstatic int foot_note;
Xstatic char tfn[]=".WXXXXX";
X#define	FALSE		0
X#define	TRUE		 1
X#define	MAX_CHAR	40
X#define	MAX_BUF		20480
X#define MAX_LENGTH	70
X
Xstatic int use_buffer;
Xstatic int ready;
Xint convert_buffer[10000];
Xread_char()
X{
X	if (use_buffer){
X		key=convert_buffer[i++];
X	}
X	else {
X		key=fgetc(ifp);
X		if (key == EOF)
X			ready=TRUE;
X	}
X}
X
X
Xwrite_special_code()
X{
Xif (( ! new_line_used ) && (codes[key].start_lf)){
X		fprintf(tfp,"\n");
X}
Xswitch (key)
X	{
X	case EXT_CHAR:
X		read_char();
X		fprintf(tfp,"%s",troff_table[key]);
X		read_char();
X		break;
X	default :
X		if (use_buffer) {
X			fprintf(tfp,"%s",codes[key].troff_e);
X			use_buffer=FALSE;
X			break;
X		}
X		i=0;
X		help_key=key;
X		fprintf(tfp,"%s",codes[key].troff_b);
X		read_char();
X		while (key != help_key) {
X			convert_buffer[i++]=key;
X			read_char();
X		}
X		convert_buffer[i]=key;
X		i=0;
X		use_buffer=TRUE;
X		break;
X	}
X}
Xwrite_normal_code()
X{
Xif (( ! new_line_used ) && (codes[key].start_lf)){
X		fprintf(tfp,"\n");
X}
Xif (codes[key].number){
X	help_key=key;
X	read_char();
X	while (key != help_key) {
X		read_char();
X	}
X	fprintf(tfp,"%s",codes[key].troff_b);
X}
Xelse
X	fprintf(tfp,"%s",codes[key].troff_b);
X}
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
Xint next;
X     if (argc < 1) {
X          printf("Usage %s [inputfile]\n",argv[0]);
X          exit(-1);
X     }
Xfor (next = 1; next < argc; next++) {
Xchar out_name[128];
X     printf("Convert program from Wordperfect 4.2 to Troff with me macro\n\n");
X     printf("By Hans Varkevisser (hans@let.vu.nl.UUCP)\n");
X     printf("Copyright Hans Varkevisser (Public domain)\n\n");
X
X
Xif ((ifp = fopen (argv[next], "r")) == NULL) {
X	fprintf(stderr,"Cannot open inputfile %s\n",argv[next]);
X	exit(1);
X}
X
Xmktemp(tfn);
Xstrcpy(out_name,argv[next]);
Xstrcat(out_name,tfn);
Xif ((tfp = fopen(out_name,"w")) == NULL) {
X	fprintf(stderr,"Cannot open outputfile %s\n",out_name);
X	exit(1);
X}
Xnew_line_used=0;
Xuse_buffer=FALSE;
Xready=FALSE;
Xkey=0;
Xwhile (! ready){
X	read_char();
X	new_line_used == codes[key].new_line;
X	switch ( codes[key].trans )
X	{
X		case 0:		/* No translation */
X			fprintf(tfp,"%c",key);
X		break;
X		case 1:		/* Normal translation */
X			write_normal_code();
X		break;
X		case 2:		/* special codes */
X			write_special_code();
X		break;
X	}
X}
X     fclose(tfp);
X}
X}
End_of_shar
ls -l 'wpc.c'

echo 'Extracting wpunix.c ...'
sed 's/^X//' > 'wpunix.c' <<'End_of_shar'
X#include "stdio.h"
X#include "ctype.h"  
X#include "fcntl.h"  
X#include "io.h"  
X#include  "conv_wp.h"  
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
Xteller=0;
Xnoot=TRUE;
Xlf_on=TRUE;
Xhrt_on=FALSE;
Xsub=FALSE;
Xsup=FALSE;
Xblock=FALSE;
X     printf("Convert program from Wordperfect 4.2 to Troff with me\n\n");
X     printf("By Hans Varkevisser (hans@let.vu.nl)\n");
X     printf("Public Domain\n\n");
X     if (argc != 2) {
X          printf("Usage wpunix [inputfile]\n");
X          exit(-1);
X     }
X
X     if ((ifp = fopen(argv[1], "r+b")) == NULL) {
X          printf("Can't open inputfile [%s]", argv[1]);
X          exit(-1);
X     }
X     key='x';
X     strcpy(name,argv[1]);
X     make_file_name(name);
X     if ((ofp = fopen(name , "r+b")) != NULL) {
X          printf("Outputfile [%s] exists ", name);
X          printf("Overwrite y/n ? ");
X     key=fgetc(stdin);
X     }
X     if ((key=='n') || (key=='N')){
X          exit(-1);
X          }
X     else{
X     fclose(ofp);
X     }
X     if ((ofp = fopen(name , "wb")) == NULL) {
X          printf("Can't open outputfile [%s]\n", name);
X          exit(-1);
X     }
X     max_bytes=filelength(fileno(ifp));
X     if (max_bytes == -1L){
X          puts("Can't get filesize !!! ");
X          exit(-1);
X     }
X     printf("\n Inputfile [%s] is %ld bytes \n",argv[1],max_bytes);
Xwhile (teller != max_bytes)
X{
Xkey = fgetc(ifp);
Xteller++;
Xswitch (key)
X     {
Xcase STREEP:
X	   key='-';
X           hrt_on=TRUE;
X           fprintf(ofp,"%c",key);
X     break;
Xcase GEEN1 :
X     while ((key=fgetc(ifp)) != GEEN1 ) {
X     teller++;
X     }
X     break;
Xcase RG_AFST :
X     while ((key=fgetc(ifp)) != RG_AFST ) {
X     teller++;
X     }
X     break;
Xcase RE_HY :
X     while ((key=fgetc(ifp)) != RE_HY ) {
X     teller++;
X     }
X     break;
Xcase POS_NUM :
X     while ((key=fgetc(ifp)) != POS_NUM ) {
X     teller++;
X     }
X     break;
Xcase NEW_NUM :
X     while ((key=fgetc(ifp)) != NEW_NUM ) {
X     teller++;
X     }
X     break;
Xcase PG_POS :
X     while ((key=fgetc(ifp)) != PG_POS ) {
X     teller++;
X     }
X     break;
Xcase C_E_PG :
X     while ((key=fgetc(ifp)) != C_E_PG ) {
X     teller++;
X     }
X     break;
Xcase T_MARG :
X     while ((key=fgetc(ifp)) != T_MARG ) {
X     teller++;
X     }
X     break;
Xcase BO_MARG :
X     while ((key=fgetc(ifp)) != BO_MARG ) {
X     teller++;
X     }
X     break;
Xcase NO_ALL :
X     while ((key=fgetc(ifp)) != NO_ALL ) {
X     teller++;
X     }
X     break;
Xcase PG_LNGT :
X     while ((key=fgetc(ifp)) != PG_LNGT ) {
X     teller++;
X     }
X     break;
Xcase FT_NUM :
X     while ((key=fgetc(ifp)) != FT_NUM ) {
X     teller++;
X     }
X     break;
Xcase LF_HLF :
X     while ((key=fgetc(ifp)) != LF_HLF ) {
X     teller++;
X     }
X     break;
Xcase EXT_TAB :
X     while ((key=fgetc(ifp)) != EXT_TAB ) {
X     teller++;
X     }
X     break;
Xcase DF_MCOL :
X     while ((key=fgetc(ifp)) != DF_MCOL ) {
X     teller++;
X     }
X     break;
Xcase S_ALIGN :
X     while ((key=fgetc(ifp)) != S_ALIGN ) {
X     teller++;
X     }
X     break;
Xcase RES5 :
X     while ((key=fgetc(ifp)) != RES5 ) {
X     teller++;
X     }
X     break;
Xcase UL_SET :
X     while ((key=fgetc(ifp)) != UL_SET ) {
X     teller++;
X     }
X     break;
Xcase HP_SET :
X     while ((key=fgetc(ifp)) != HP_SET ) {
X     teller++;
X     }
X     break;
Xcase DF_COL :
X     while ((key=fgetc(ifp)) != DF_COL ) {
X     teller++;
X     }
X     break;
Xcase NEW_FT :
X     while ((key=fgetc(ifp)) != NEW_FT ) {
X     teller++;
X     }
X     break;
Xcase DF_PAR :
X     while ((key=fgetc(ifp)) != DF_PAR ) {
X     teller++;
X     }
X     break;
Xcase PR_NUM :
X     while ((key=fgetc(ifp)) != PR_NUM ) {
X     teller++;
X     }
X     break;
Xcase T_MARB :
X     while ((key=fgetc(ifp)) != T_MARB ) {
X     teller++;
X     }
X     break;
Xcase T_MARE :
X     while ((key=fgetc(ifp)) != T_MARE ) {
X     teller++;
X     }
X     break;
Xcase T_M_DF :
X     while ((key=fgetc(ifp)) != T_M_DF ) {
X     teller++;
X     }
X     break;
Xcase DF_I_M :
X     while ((key=fgetc(ifp)) != DF_I_M ) {
X     teller++;
X     }
X     break;
Xcase BLK_PR :
X     while ((key=fgetc(ifp)) != BLK_PR ) {
X     teller++;
X     }
X     break;
Xcase SR_ON :
X     key=key;
X     key=0;
X     while ((key=fgetc(ifp)) != SR_ON ) {
X     teller++;
X     }
Xcase HE_FT :
X     key=key;
X     key=0;
X     while ((key=fgetc(ifp)) != HE_FT ) {
X     teller++;
X     }
X     break;
Xcase LET_SET :
X     key=key;
X     key=0;
X     while ((key=fgetc(ifp)) != LET_SET ) {
X     teller++;
X     }
X     break;
Xcase NOOT :
X     if (noot){
X           noot=FALSE;
X           while ((key=fgetc(ifp)) != 0xff ) {
X             teller++;
X           }
X           for (i=1; i <= 3; ++i){
X             key=fgetc(ifp);
X             teller++;
X           }
X           lf_on=write_code_lf(NOOT,lf_on);
X           break;
X     }
X     if ( ! noot);{
X         noot=TRUE;
X         lf_on=write_code_lf(NOOT-127,lf_on);
X     }
X      break;
Xcase SYS_DAT :
X     while ((key=fgetc(ifp)) != SYS_DAT ) {
X       teller++;
X       }
X     break;
Xcase NOOT_OP :
X     while ((key=fgetc(ifp)) != NOOT_OP ) {
X       teller++;
X       }
X     break;
Xcase INSPR :
X     for (i=1; i <= 3; ++i){
X     key=fgetc(ifp);
X     teller++;
X     }
X     if (block){
X	break;
X     }
X     block=TRUE;
X     lf_on=write_code_lf(INSPR,lf_on);
X     break;
Xcase RPI_SET :
X     for (i=1; i <= 3; ++i){
X     key=fgetc(ifp);
X     teller++;
X     }
X     break;
X case KNTL :
X     for (i=1; i <= 5; ++i){
X     key=fgetc(ifp);
X     teller++;
X     }
X     break;
Xcase UIT_AAN :
X     break;
Xcase UIT_UIT :
X     break;
Xcase SPACE:
X         if (lf_on){
X            fprintf(ofp,"%c",key);
X         }
X     break;
Xcase TAB :
X          if (! hrt_on) {
X             fprintf(ofp,"%c",key);
X          }
X     lf_on=TRUE;
X     break;
Xcase HRT :
X     if (block) {
X           block=FALSE;
X           lf_on=write_code_lf(INSPR-128,lf_on);
X	   break;
X     }
X     if ( ! hrt_on) {
X           lf_on=write_code_lf(HRT,lf_on);
X           hrt_on=TRUE;
X         }
X     break;
Xcase CEN_IN :
X     while ((key=fgetc(ifp)) != CEN_IN ) {
X       teller++;
X       }
X     break;
Xcase CEN_OFF :
X     while ((key=fgetc(ifp)) != CEN_OFF ) {
X      teller++;
X       }
X     break;
Xcase ZRT :
X     if (lf_on) {
X        fprintf(ofp," \n");
X        lf_on=FALSE;
X     }
X     else {
X        fprintf(ofp," ");
X        lf_on=TRUE;
X      }
X     hrt_on=FALSE;
X     break;
Xcase HD_PA :
X       lf_on=write_code_lf(HD_PA,lf_on);
Xcase BD_ON :
X       lf_on=write_code_lf(BD_ON,lf_on);
Xbreak;
Xcase BD_OFF :
X           lf_on=write_code_lf(BD_OFF,lf_on);
X     break;
Xcase UL_ON :
X           lf_on=write_code_lf(UL_ON,lf_on);
Xbreak;
Xcase UL_OFF :
X           lf_on=write_code_lf(UL_OFF,lf_on);
X     break;
Xcase TAB_SET :
X     while ((key=fgetc(ifp)) != TAB_SET ) {
X       teller++;
X        }
X      break;
Xcase CTR_ON :
X     while ((key=fgetc(ifp)) != CTR_ON ) {
X       teller++;
X        }
X        lf_on=write_code_lf(CTR_ON,lf_on);
X      break;
Xcase CTR_OFF :
X        lf_on=write_code_lf(CTR_OFF,lf_on);
X     break;
Xcase SUP_ON :
X     sup=TRUE;
X     write_code(SUP_ON);
X     break;
Xcase SUB_ON :
X     sub=TRUE;
X     write_code(SUB_ON);
Xbreak;
Xcase EX_CH :
X     key=fgetc(ifp);
X     teller++;
X        fprintf(ofp,"%s",troff_table[key]);
X        key=fgetc(ifp);
X     teller++;
X     hrt_on=FALSE;
X     lf_on=TRUE;
X     break;
Xdefault  :
X           if (iscntrl(key)){
X               break;
X          }
X          if (key < 128){
X               write_char();
X          }
X          break;
X}
X}
X     fclose(ifp);
X     fclose(ofp);
X     if ((ifp = fopen(name, "r+b")) == NULL) {
X          printf("Can't open [%s]", argv[1]);
X          exit(-1);
X     }
X     teller=filelength(fileno(ifp));
X     printf("Outputfile [%s] is %ld bytes \n",name,teller);
X     fclose(ifp);
X}
X#include "ctype.h"
Xmake_file_name(string)
Xchar *string;
X{
Xint size;
Xsize=0;
Xwhile ((strlen(string) > size) && (string[size] != '.') && (size != 8)){
X     size++;
X     }
X     *(string + size)= '\0';
X     strcat(string,".txt");
X}
X
X#include "ctype.h"
Xwrite_code_lf(key,lf_on)
X{
X   if (lf_on) {
X        fprintf(ofp,"\n%s",troff_code[key]);
X   }
X   else {
X        fprintf(ofp,"%s",troff_code[key]);
X   }
Xlf_on=FALSE;
Xreturn(lf_on);
X}
X
X#include "ctype.h"
Xwrite_code(key)
X{
X        fprintf(ofp,"%s",troff_code[key]);
X}
X
X
X#include "ctype.h"
Xwrite_char()
X{
Xif ((sub) || (sup)){
X        if (sub) {
X           fprintf(ofp,"%c",key);
X           fprintf(ofp,"%s",troff_code[SUB_ON-127]);
X           sub=FALSE;
X        }
X        else {
X           fprintf(ofp,"%c",key);
X           fprintf(ofp,"%s",troff_code[SUP_ON-127]);
X           sup=FALSE;
X        }
X}
Xelse {
X        fprintf(ofp,"%c",key);
X}
Xhrt_on=FALSE;
Xlf_on=TRUE;
X}
End_of_shar
ls -l 'wpunix.c'