[alt.sources] wp2latex

glenn@extro.ucc.su.oz.au (Glenn Geers) (08/08/90)

By popular demand here comes the source code.
			Glenn


#! /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:
#	wp2latex.c
# This archive created: Wed Aug  8 21:44:44 1990
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'wp2latex.c'" '(53854 characters)'
if test -f 'wp2latex.c'
then
	echo shar: "will not over-write existing file 'wp2latex.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'wp2latex.c'
	X/* Output from p2c, the Pascal-to-C translator */
	X/* From input file "WP2LATEX.PAS" */
	X
	Xstatic char rcsid[] = "$Header: wp2latex.c,v 2.0 90/08/05 08:16:28 glenn Exp $";
	X
	X
	X#ifdef HAVE_P2C
	X#include <p2c/p2c.h>
	X#else
	X#include "p2c.h"
	X#endif
	X
	X
	X/*           Version 1.0
	X             Date 27-1-1990
	X*/
	X
	X
	XStatic Char wpd_fn[256], strip_fn[256], tabel_fn[256], latex_fn[256];
	X
	XStatic FILE *wpd, *tabel;
	XStatic FILE *strip, *latex;
	X
	XStatic unsigned short num_of_lines_stripfile;
	X
	XStatic Char open_com[0x11][256], close_com[0x11][256];
	X
	X/* Static Anyptr Exitsave; */
	XStatic Char wpd_NAME[_FNSIZE];
	XStatic Char tabel_NAME[_FNSIZE];
	XStatic Char strip_NAME[_FNSIZE];
	XStatic Char latex_NAME[_FNSIZE];
	X
	XStatic Void RunError(); /* simulate Turbo 5 builtin */
	X
	XStatic Void Rd_word(f, w)
	XFILE **f;
	Xunsigned short *w;
	X{
	X  /* Deze procedure leest een woord uit de opgegeven binaire file. */
	X  uchar b;
	X
	X  fread(&b, sizeof(uchar), 1, *f);
	X  *w = b;
	X  fread(&b, sizeof(uchar), 1, *f);
	X  *w += b * 256;
	X}
	X
	X
	XStatic Void Wr_word(f, w)
	XFILE **f;
	Xunsigned short w;
	X{
	X  /* Deze procedure schrijft een woord in de opgegeven binaire file. */
	X  uchar b;
	X
	X  b = w & 255;
	X  fwrite(&b, sizeof(uchar), 1, *f);
	X  b = w / 256;
	X  fwrite(&b, sizeof(uchar), 1, *f);
	X}
	X
	X
	XStatic Void Jump_in_file(f, dis)
	XFILE **f;
	Xlong dis;
	X{
	X  /* Deze procedure springt in een binaire file het aantal opgegeven bytes. */
	X  long cur_pos;
	X
	X  cur_pos = ftell(*f) / sizeof(uchar);
	X  fseek(*f, (cur_pos + dis) * sizeof(uchar), 0);
	X}
	X
	X
	X
	XStatic Void Wpd_check()
	X{
	X  /* Kontroleert of de opgegeven WP-document wel daadwerkelijk een   */
	X  /* WP5.0-document is.                                              */
	X  unsigned short id1, id2, std1, std2, filetype, dmp1, dmp2, dmp3;
	X  long Startdoc;
	X
	X  Rd_word(&wpd, &id1);
	X  Rd_word(&wpd, &id2);
	X  Rd_word(&wpd, &std1);
	X  Rd_word(&wpd, &std2);
	X  Rd_word(&wpd, &filetype);
	X  Rd_word(&wpd, &dmp1);
	X  Rd_word(&wpd, &dmp2);
	X  Rd_word(&wpd, &dmp3);
	X
	X  Startdoc = std2 * 65536L + std1;
	X
	X  if (id1 == 0x57ff && id2 == 0x4350 && filetype == 0xa01)
	X	/*and (dmp1=$0) and (dmp2=$0) and (dmp3=$0)*/
	X	  fseek(wpd, Startdoc * sizeof(uchar), 0);
	X  else {
	X    RunError(0x201);   /* Het is geen WP5.0-document*/
	X  }
	X
	X  /* Het is een WP5.0-document*/
	X}
	X
	X
	X
	X
	XStatic Void Filenames()
	X{
	X  /* Deze procedure handelt het opgeven van de filenamen af. */
	X  Char name[256], invoer[256], wpdef[256], latdef[256], filename[256];
	X  short l, p;
	X
	X  if (P_argc < 2)
	X    *wpdef = '\0';
	X  else
	X    strcpy(wpdef, P_argv[1]);
	X
	X  printf("\n\nWordPerfect-filename [%s] : ", wpdef);
	X  gets(invoer);
	X  if (*invoer == '\0')
	X    strcpy(wpd_fn, wpdef);
	X  else
	X    strcpy(wpd_fn, invoer);
	X
	X  if (*wpd_fn == '\0') {   /* No filename entered */
	X    RunError(0x200);
	X  }
	X
	X  strcpy(name, wpd_fn);
	X  l = strlen(name);
	X  p = strpos2(name, ".", 1);
	X  if (p == 0)
	X    p = l + 1;
	X  sprintf(filename, "%.*s", p - 1, name);
	X
	X  sprintf(strip_fn, "%s.str", filename);
	X  sprintf(tabel_fn, "%s.tbl", filename);
	X  sprintf(latdef, "%s.tex", filename);
	X
	X  printf("LaTeX-filename [%s] : ", latdef);
	X  gets(invoer);
	X  putchar('\n');
	X  if (*invoer == '\0')
	X    strcpy(latex_fn, latdef);
	X  else
	X    strcpy(latex_fn, invoer);
	X
	X  strcpy(wpd_NAME, wpd_fn);
	X  strcpy(strip_NAME, strip_fn);
	X  strcpy(tabel_NAME, tabel_fn);
	X  strcpy(latex_NAME, latex_fn);
	X
	X}
	X
	X
	XStatic Void Init_commando()
	X{
	X  strcpy(open_com[0], "{\\LARGE ");
	X  strcpy(open_com[0x1], "{\\Large ");
	X  strcpy(open_com[0x2], "{\\large ");
	X  strcpy(open_com[0x3], "{\\small ");
	X  strcpy(open_com[0x4], "{\\footnotesize ");
	X  strcpy(open_com[0x5], "$^{\\rm ");
	X  strcpy(open_com[0x6], "$_{\\rm ");
	X  *open_com[0x7] = '\0';
	X  strcpy(open_com[0x8], "{\\it ");
	X  *open_com[0x9] = '\0';
	X  *open_com[0xa] = '\0';
	X  strcpy(open_com[0xb], "\\underline{\\Underline{");
	X  strcpy(open_com[0xc], "{\\bf ");
	X  *open_com[0xd] = '\0';
	X  strcpy(open_com[0xe], "\\Underline{");
	X  strcpy(open_com[0xf], "{\\sc ");
	X
	X  strcpy(close_com[0], "}");
	X  strcpy(close_com[0x1], "}");
	X  strcpy(close_com[0x2], "}");
	X  strcpy(close_com[0x3], "}");
	X  strcpy(close_com[0x4], "}");
	X  strcpy(close_com[0x5], "}$");
	X  strcpy(close_com[0x6], "}$");
	X  *close_com[0x7] = '\0';
	X  strcpy(close_com[0x8], "\\/}");
	X  *close_com[0x9] = '\0';
	X  *close_com[0xa] = '\0';
	X  strcpy(close_com[0xb], "}}");
	X  strcpy(close_com[0xc], "}");
	X  *close_com[0xd] = '\0';
	X  strcpy(close_com[0xe], "}");
	X  strcpy(close_com[0xf], "}");
	X}
	X
	X
	X/* Local variables for Convert_first_strike: */
	Xstruct LOC_Convert_first_strike {
	X  uchar by;
	X  unsigned short regelnum;
	X
	X  Char lat[0x60][26];
	X  short char_set[0xff];
	X  short char_code[0xff];
	X  Char ext_lat[0xff][26];
	X
	X
	X  short leegptr[2], openptr[2];
	X  uchar attr_rij[2][17];
	X  boolean open_attr_rij[2];
	X  short depth;
	X
	X  Char envir, line_term;
	X
	X  boolean char_on_line, nomore_valid_tabs, indenting, indent_end, ind_text1,
	X	  ind_text2;
	X
	X  unsigned short ind_leftmargin, ind_rightmargin;
	X
	X  short num_of_tabs, latex_tabpos;
	X  unsigned short tabpos[40];
	X  boolean right_tab, align_tab, center_tab;
	X
	X  short WP_sidemargin;
	X} ;
	X
	X
	X
	X
	XLocal Void WP_Default(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  short j;
	X
	X  LINK->WP_sidemargin = 1200;
	X
	X  LINK->tabpos[0] = 0x2c5;   /* 1e WP-tab is kantlijn --> */
	X  for (j = 2; j <= 10; j++)   /* Volgende tabs 1,5  cm     */
	X    LINK->tabpos[j - 1] = LINK->tabpos[j - 2] + 0x2c5;
	X  for (j = 10; j <= 39; j++)   /* ($02c5 wpu) verder        */
	X    LINK->tabpos[j] = 0xffffL;
	X
	X  LINK->num_of_tabs = 10;
	X}
	X
	X
	XLocal Void Table_Init(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  strcpy(LINK->lat[0], " ");   /*Space*/
	X  strcpy(LINK->lat[0x1], "!");   /*!*/
	X  strcpy(LINK->lat[0x2], "\"");   /*"*/
	X  strcpy(LINK->lat[0x3], "\\#");   /*#*/
	X  strcpy(LINK->lat[0x4], "\\$");   /*dollar*/
	X  strcpy(LINK->lat[0x5], "\\%");   /*%*/
	X  strcpy(LINK->lat[0x6], "\\&");   /*&*/
	X  strcpy(LINK->lat[0x7], "'");   /*'*/
	X  strcpy(LINK->lat[0x8], "(");   /*(*/
	X  strcpy(LINK->lat[0x9], ")");   /*)*/
	X  strcpy(LINK->lat[0xa], "*");   /***/
	X  strcpy(LINK->lat[0xb], "+");   /*+*/
	X  strcpy(LINK->lat[0xc], ",");   /*,*/
	X  strcpy(LINK->lat[0xd], "-");   /*-*/
	X  strcpy(LINK->lat[0xe], ".");   /*.*/
	X  strcpy(LINK->lat[0xf], "/");   /*/*/
	X  strcpy(LINK->lat[0x10], "0");   /*0*/
	X  strcpy(LINK->lat[0x11], "1");   /*1*/
	X  strcpy(LINK->lat[0x12], "2");   /*2*/
	X  strcpy(LINK->lat[0x13], "3");   /*3*/
	X  strcpy(LINK->lat[0x14], "4");   /*4*/
	X  strcpy(LINK->lat[0x15], "5");   /*5*/
	X  strcpy(LINK->lat[0x16], "6");   /*6*/
	X  strcpy(LINK->lat[0x17], "7");   /*7*/
	X  strcpy(LINK->lat[0x18], "8");   /*8*/
	X  strcpy(LINK->lat[0x19], "9");   /*9*/
	X  strcpy(LINK->lat[0x1a], ":");   /*:*/
	X  strcpy(LINK->lat[0x1b], ";");   /*;*/
	X  strcpy(LINK->lat[0x1c], "$<$");   /*<*/
	X  strcpy(LINK->lat[0x1d], "=");   /*=*/
	X  strcpy(LINK->lat[0x1e], "$>$");   /*>*/
	X  strcpy(LINK->lat[0x1f], "?");   /*?*/
	X  strcpy(LINK->lat[0x20], "@");   /*@*/
	X  strcpy(LINK->lat[0x21], "A");   /*A*/
	X  strcpy(LINK->lat[0x22], "B");   /*B*/
	X  strcpy(LINK->lat[0x23], "C");   /*C*/
	X  strcpy(LINK->lat[0x24], "D");   /*D*/
	X  strcpy(LINK->lat[0x25], "E");   /*E*/
	X  strcpy(LINK->lat[0x26], "F");   /*F*/
	X  strcpy(LINK->lat[0x27], "G");   /*G*/
	X  strcpy(LINK->lat[0x28], "H");   /*H*/
	X  strcpy(LINK->lat[0x29], "I");   /*I*/
	X  strcpy(LINK->lat[0x2a], "J");   /*J*/
	X  strcpy(LINK->lat[0x2b], "K");   /*K*/
	X  strcpy(LINK->lat[0x2c], "L");   /*L*/
	X  strcpy(LINK->lat[0x2d], "M");   /*M*/
	X  strcpy(LINK->lat[0x2e], "N");   /*N*/
	X  strcpy(LINK->lat[0x2f], "O");   /*O*/
	X  strcpy(LINK->lat[0x30], "P");   /*P*/
	X  strcpy(LINK->lat[0x31], "Q");   /*Q*/
	X  strcpy(LINK->lat[0x32], "R");   /*R*/
	X  strcpy(LINK->lat[0x33], "S");   /*S*/
	X  strcpy(LINK->lat[0x34], "T");   /*T*/
	X  strcpy(LINK->lat[0x35], "U");   /*U*/
	X  strcpy(LINK->lat[0x36], "V");   /*V*/
	X  strcpy(LINK->lat[0x37], "W");   /*W*/
	X  strcpy(LINK->lat[0x38], "X");   /*X*/
	X  strcpy(LINK->lat[0x39], "Y");   /*Y*/
	X  strcpy(LINK->lat[0x3a], "Z");   /*Z*/
	X  strcpy(LINK->lat[0x3b], "[");   /*[*/
	X  strcpy(LINK->lat[0x3c], "$\\tt\\backslash$");   /*\*/
	X  strcpy(LINK->lat[0x3d], "]");   /*]*/
	X  strcpy(LINK->lat[0x3e], "\\^{");   /*^*/
	X  strcpy(LINK->lat[0x3f], "\\_");   /*_*/
	X  strcpy(LINK->lat[0x40], "`");   /*`*/
	X  strcpy(LINK->lat[0x41], "a");   /*a*/
	X  strcpy(LINK->lat[0x42], "b");   /*b*/
	X  strcpy(LINK->lat[0x43], "c");   /*c*/
	X  strcpy(LINK->lat[0x44], "d");   /*d*/
	X  strcpy(LINK->lat[0x45], "e");   /*e*/
	X  strcpy(LINK->lat[0x46], "f");   /*f*/
	X  strcpy(LINK->lat[0x47], "g");   /*g*/
	X  strcpy(LINK->lat[0x48], "h");   /*h*/
	X  strcpy(LINK->lat[0x49], "i");   /*i*/
	X  strcpy(LINK->lat[0x4a], "j");   /*j*/
	X  strcpy(LINK->lat[0x4b], "k");   /*k*/
	X  strcpy(LINK->lat[0x4c], "l");   /*l*/
	X  strcpy(LINK->lat[0x4d], "m");   /*m*/
	X  strcpy(LINK->lat[0x4e], "n");   /*n*/
	X  strcpy(LINK->lat[0x4f], "o");   /*o*/
	X  strcpy(LINK->lat[0x50], "p");   /*p*/
	X  strcpy(LINK->lat[0x51], "q");   /*q*/
	X  strcpy(LINK->lat[0x52], "r");   /*r*/
	X  strcpy(LINK->lat[0x53], "s");   /*s*/
	X  strcpy(LINK->lat[0x54], "t");   /*t*/
	X  strcpy(LINK->lat[0x55], "u");   /*u*/
	X  strcpy(LINK->lat[0x56], "v");   /*v*/
	X  strcpy(LINK->lat[0x57], "w");   /*w*/
	X  strcpy(LINK->lat[0x58], "x");   /*x*/
	X  strcpy(LINK->lat[0x59], "y");   /*y*/
	X  strcpy(LINK->lat[0x5a], "z");   /*z*/
	X  strcpy(LINK->lat[0x5b], "\\{");   /*{*/
	X  strcpy(LINK->lat[0x5c], "$|$");   /*|*/
	X  strcpy(LINK->lat[0x5d], "\\}");   /* */
	X  strcpy(LINK->lat[0x5e], "\\tidle{");   /*~*/
	X  strcpy(LINK->lat[0x5f], " ");   /*Doesn't exsist*/
	X}
	X
	X
	XLocal Void Ext_chr_init(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  LINK->char_set[0] = 0x1;
	X  LINK->char_code[0] = 0x26;
	X  strcpy(LINK->ext_lat[0], "\\c{C}");
	X  LINK->char_set[0x1] = 0x1;
	X  LINK->char_code[0x1] = 0x47;
	X  strcpy(LINK->ext_lat[0x1], "\\\"{u}");
	X  LINK->char_set[0x2] = 0x1;
	X  LINK->char_code[0x2] = 0x29;
	X  strcpy(LINK->ext_lat[0x2], "\\'{e}");
	X  LINK->char_set[0x3] = 0x1;
	X  LINK->char_code[0x3] = 0x1d;
	X  strcpy(LINK->ext_lat[0x3], "\\^{a}");
	X  LINK->char_set[0x4] = 0x1;
	X  LINK->char_code[0x4] = 0x1f;
	X  strcpy(LINK->ext_lat[0x4], "\\\"{a}");
	X  LINK->char_set[0x5] = 0x1;
	X  LINK->char_code[0x5] = 0x21;
	X  strcpy(LINK->ext_lat[0x5], "\\`{a}");
	X  LINK->char_set[0x6] = 0x1;
	X  LINK->char_code[0x6] = 0x23;
	X  strcpy(LINK->ext_lat[0x6], "\\aa ");
	X  LINK->char_set[0x7] = 0x1;
	X  LINK->char_code[0x7] = 0x27;
	X  strcpy(LINK->ext_lat[0x7], "\\c{c}");
	X  LINK->char_set[0x8] = 0x1;
	X  LINK->char_code[0x8] = 0x2b;
	X  strcpy(LINK->ext_lat[0x8], "\\^{e}");
	X  LINK->char_set[0x9] = 0x1;
	X  LINK->char_code[0x9] = 0x2d;
	X  strcpy(LINK->ext_lat[0x9], "\\\"{e}");
	X  LINK->char_set[0xa] = 0x1;
	X  LINK->char_code[0xa] = 0x2f;
	X  strcpy(LINK->ext_lat[0xa], "\\`{e}");
	X  LINK->char_set[0xb] = 0x1;
	X  LINK->char_code[0xb] = 0x35;
	X  strcpy(LINK->ext_lat[0xb], "\\\"{\\i}");
	X  LINK->char_set[0xc] = 0x1;
	X  LINK->char_code[0xc] = 0x33;
	X  strcpy(LINK->ext_lat[0xc], "\\^{\\i}");
	X  LINK->char_set[0xd] = 0x1;
	X  LINK->char_code[0xd] = 0x37;
	X  strcpy(LINK->ext_lat[0xd], "\\`{\\i}");
	X  LINK->char_set[0xe] = 0x1;
	X  LINK->char_code[0xe] = 0x1e;
	X  strcpy(LINK->ext_lat[0xe], "\\\"{A}");
	X  LINK->char_set[0xf] = 0x1;
	X  LINK->char_code[0xf] = 0x22;
	X  strcpy(LINK->ext_lat[0xf], "\\AA ");
	X  LINK->char_set[0x10] = 0x1;
	X  LINK->char_code[0x10] = 0x28;
	X  strcpy(LINK->ext_lat[0x10], "\\'{E}");
	X  LINK->char_set[0x11] = 0x1;
	X  LINK->char_code[0x11] = 0x25;
	X  strcpy(LINK->ext_lat[0x11], "\\ae ");
	X  LINK->char_set[0x12] = 0x1;
	X  LINK->char_code[0x12] = 0x24;
	X  strcpy(LINK->ext_lat[0x12], "\\AE ");
	X  LINK->char_set[0x13] = 0x1;
	X  LINK->char_code[0x13] = 0x3d;
	X  strcpy(LINK->ext_lat[0x13], "\\^{o}");
	X  LINK->char_set[0x14] = 0x1;
	X  LINK->char_code[0x14] = 0x3f;
	X  strcpy(LINK->ext_lat[0x14], "\\\"{o}");
	X  LINK->char_set[0x15] = 0x1;
	X  LINK->char_code[0x15] = 0x41;
	X  strcpy(LINK->ext_lat[0x15], "\\`{o}");
	X  LINK->char_set[0x16] = 0x1;
	X  LINK->char_code[0x16] = 0x45;
	X  strcpy(LINK->ext_lat[0x16], "\\^{u}");
	X  LINK->char_set[0x17] = 0x1;
	X  LINK->char_code[0x17] = 0x49;
	X  strcpy(LINK->ext_lat[0x17], "\\`{u}");
	X  LINK->char_set[0x18] = 0x1;
	X  LINK->char_code[0x18] = 0x8b;
	X  strcpy(LINK->ext_lat[0x18], "\\\"{y}");
	X  LINK->char_set[0x19] = 0x1;
	X  LINK->char_code[0x19] = 0x3e;
	X  strcpy(LINK->ext_lat[0x19], "\\\"{O}");
	X  LINK->char_set[0x1a] = 0x1;
	X  LINK->char_code[0x1a] = 0x46;
	X  strcpy(LINK->ext_lat[0x1a], "\\\"{U}");
	X  LINK->char_set[0x1b] = 0x4;
	X  LINK->char_code[0x1b] = 0x13;
	X  strcpy(LINK->ext_lat[0x1b], "\\ ");
	X  LINK->char_set[0x1c] = 0x4;
	X  LINK->char_code[0x1c] = 0xb;
	X  strcpy(LINK->ext_lat[0x1c], "\\pounds ");
	X  LINK->char_set[0x1d] = 0x4;
	X  LINK->char_code[0x1d] = 0xc;
	X  strcpy(LINK->ext_lat[0x1d], "\\ ");
	X  LINK->char_set[0x1e] = 0x4;
	X  LINK->char_code[0x1e] = 0xd;
	X  strcpy(LINK->ext_lat[0x1e], "\\ ");
	X  LINK->char_set[0x1f] = 0x4;
	X  LINK->char_code[0x1f] = 0xe;
	X  strcpy(LINK->ext_lat[0x1f], "{\\it f}\\/");
	X  LINK->char_set[0x20] = 0x1;
	X  LINK->char_code[0x20] = 0x1b;
	X  strcpy(LINK->ext_lat[0x20], "\\'{a}");
	X  LINK->char_set[0x21] = 0x1;
	X  LINK->char_code[0x21] = 0x31;
	X  strcpy(LINK->ext_lat[0x21], "\\'{\\i}");
	X  LINK->char_set[0x22] = 0x1;
	X  LINK->char_code[0x22] = 0x3b;
	X  strcpy(LINK->ext_lat[0x22], "\\'{o}");
	X  LINK->char_set[0x23] = 0x1;
	X  LINK->char_code[0x23] = 0x43;
	X  strcpy(LINK->ext_lat[0x23], "\\'{u}");
	X  LINK->char_set[0x24] = 0x1;
	X  LINK->char_code[0x24] = 0x39;
	X  strcpy(LINK->ext_lat[0x24], "\\~{n}");
	X  LINK->char_set[0x25] = 0x1;
	X  LINK->char_code[0x25] = 0x38;
	X  strcpy(LINK->ext_lat[0x25], "\\~{N}");
	X  LINK->char_set[0x26] = 0x4;
	X  LINK->char_code[0x26] = 0xf;
	X  strcpy(LINK->ext_lat[0x26], "\\astrike ");
	X  LINK->char_set[0x27] = 0x4;
	X  LINK->char_code[0x27] = 0x10;
	X  strcpy(LINK->ext_lat[0x27], "\\ostrike ");
	X  LINK->char_set[0x28] = 0x4;
	X  LINK->char_code[0x28] = 0x8;
	X  strcpy(LINK->ext_lat[0x28], "?`");
	X  LINK->char_set[0x29] = 0x5;
	X  LINK->char_code[0x29] = 0x10;
	X  strcpy(LINK->ext_lat[0x29], "~");
	X  LINK->char_set[0x2a] = 0x6;
	X  LINK->char_code[0x2a] = 0x14;
	X  strcpy(LINK->ext_lat[0x2a], "~");
	X  LINK->char_set[0x2b] = 0x4;
	X  LINK->char_code[0x2b] = 0x11;
	X  strcpy(LINK->ext_lat[0x2b], "$\\frac{1}{2}$");
	X  LINK->char_set[0x2c] = 0x4;
	X  LINK->char_code[0x2c] = 0x12;
	X  strcpy(LINK->ext_lat[0x2c], "$\\frac{1}{4}$");
	X  LINK->char_set[0x2d] = 0x4;
	X  LINK->char_code[0x2d] = 0x7;
	X  strcpy(LINK->ext_lat[0x2d], "!`");
	X  LINK->char_set[0x2e] = 0x4;
	X  LINK->char_code[0x2e] = 0x9;
	X  strcpy(LINK->ext_lat[0x2e], "$\\ll$");
	X  LINK->char_set[0x2f] = 0x4;
	X  LINK->char_code[0x2f] = 0xa;
	X  strcpy(LINK->ext_lat[0x2f], "$\\gg$");
	X  LINK->char_set[0x60] = 0x8;
	X  LINK->char_code[0x60] = 0x1;
	X  strcpy(LINK->ext_lat[0x60], "$\\alpha$");
	X  /*
	X  These are wrong
	X  LINK->char_set[0x61] = 0x1;
	X  LINK->char_code[0x61] = 0x17;
	X  They originally were used to detect beta
	X  */
	X  LINK->char_set[0x61] = 0x08;
	X  LINK->char_code[0x61] = 0x03;
	X  strcpy(LINK->ext_lat[0x61], "$\\beta$");
	X  LINK->char_set[0x62] = 0x8;
	X  LINK->char_code[0x62] = 0x6;
	X  strcpy(LINK->ext_lat[0x62], "$\\Gamma$");
	X  LINK->char_set[0x63] = 0x8;
	X  LINK->char_code[0x63] = 0x21;
	X  strcpy(LINK->ext_lat[0x63], "$\\pi$");
	X  LINK->char_set[0x64] = 0x8;
	X  LINK->char_code[0x64] = 0x24;
	X  strcpy(LINK->ext_lat[0x64], "$\\Sigma$");
	X  LINK->char_set[0x65] = 0x8;
	X  LINK->char_code[0x65] = 0x25;
	X  strcpy(LINK->ext_lat[0x65], "$\\sigma$");
	X  LINK->char_set[0x66] = 0x8;
	X  LINK->char_code[0x66] = 0x19;
	X  strcpy(LINK->ext_lat[0x66], "$\\mu$");
	X  LINK->char_set[0x67] = 0x8;
	X  LINK->char_code[0x67] = 0x29;
	X  strcpy(LINK->ext_lat[0x67], "$\\tau$");
	X  LINK->char_set[0x68] = 0x8;
	X  LINK->char_code[0x68] = 0x2c;
	X  strcpy(LINK->ext_lat[0x68], "$\\Phi$");
	X  LINK->char_set[0x69] = 0x8;
	X  LINK->char_code[0x69] = 0x10;
	X  strcpy(LINK->ext_lat[0x69], "$\\theta$");
	X  LINK->char_set[0x6a] = 0x8;
	X  LINK->char_code[0x6a] = 0x32;
	X  strcpy(LINK->ext_lat[0x6a], "$\\Omega$");
	X  LINK->char_set[0x6b] = 0x8;
	X  LINK->char_code[0x6b] = 0x9;
	X  strcpy(LINK->ext_lat[0x6b], "$\\delta$");
	X  LINK->char_set[0x6c] = 0x6;
	X  LINK->char_code[0x6c] = 0x13;
	X  strcpy(LINK->ext_lat[0x6c], "$\\infty$");
	X  LINK->char_set[0x6d] = 0x8;
	X  LINK->char_code[0x6d] = 0x2d;
	X  strcpy(LINK->ext_lat[0x6d], "$\\emptyset$");
	X  LINK->char_set[0x6e] = 0x8;
	X  LINK->char_code[0x6e] = 0xb;
	X  strcpy(LINK->ext_lat[0x6e], "$\\epsilon$");
	X  LINK->char_set[0x6f] = 0x6;
	X  LINK->char_code[0x6f] = 0x10;
	X  strcpy(LINK->ext_lat[0x6f], "$\\cap$");
	X  LINK->char_set[0x70] = 0x6;
	X  LINK->char_code[0x70] = 0xe;
	X  strcpy(LINK->ext_lat[0x70], "$\\equiv$");
	X  LINK->char_set[0x71] = 0x6;
	X  LINK->char_code[0x71] = 0x1;
	X  strcpy(LINK->ext_lat[0x71], "$\\pm$");
	X  LINK->char_set[0x72] = 0x6;
	X  LINK->char_code[0x72] = 0x3;
	X  strcpy(LINK->ext_lat[0x72], "$\\geq$");
	X  LINK->char_set[0x73] = 0x6;
	X  LINK->char_code[0x73] = 0x2;
	X  strcpy(LINK->ext_lat[0x73], "$\\leq$");
	X  LINK->char_set[0x74] = 0x7;
	X  LINK->char_code[0x74] = 0;
	X  strcpy(LINK->ext_lat[0x74], "~");
	X  LINK->char_set[0x75] = 0x7;
	X  LINK->char_code[0x75] = 0x1;
	X  strcpy(LINK->ext_lat[0x75], "~");
	X  LINK->char_set[0x76] = 0x6;
	X  LINK->char_code[0x76] = 0x8;
	X  strcpy(LINK->ext_lat[0x76], "$\\div$");
	X  LINK->char_set[0x77] = 0x6;
	X  LINK->char_code[0x77] = 0xd;
	X  strcpy(LINK->ext_lat[0x77], "$\\approx$");
	X  LINK->char_set[0x78] = 0x6;
	X  LINK->char_code[0x78] = 0x24;
	X  strcpy(LINK->ext_lat[0x78], "\\degrees ");
	X  LINK->char_set[0x79] = 0x6;
	X  LINK->char_code[0x79] = 0x1f;
	X  strcpy(LINK->ext_lat[0x79], "~");
	X  LINK->char_set[0x7a] = 0x6;
	X  LINK->char_code[0x7a] = 0x20;
	X  strcpy(LINK->ext_lat[0x7a], "~");
	X  LINK->char_set[0x7b] = 0x7;
	X  LINK->char_code[0x7b] = 0x4;
	X  strcpy(LINK->ext_lat[0x7b], "$\\surd$");
	X  LINK->char_set[0x7c] = 0x4;
	X  LINK->char_code[0x7c] = 0x15;
	X  strcpy(LINK->ext_lat[0x7c], "$^{n}$");
	X  LINK->char_set[0x7d] = 0x4;
	X  LINK->char_code[0x7d] = 0x14;
	X  strcpy(LINK->ext_lat[0x7d], "$^{2}$");
	X  LINK->char_set[0x7e] = 0x4;
	X  LINK->char_code[0x7e] = 0x2;
	X  strcpy(LINK->ext_lat[0x7e], "~");
	X/*
	X** Note: Adding characters is easy. The maximum available is
	X** now 256 not 128 (Pascal version).
	X** e.g. The Greek character set is char_set 0x8,
	X** \Alpha has char_code 0x0, \alpha has char_code 0x1 ...
	X** \Omega has char_code 0x32 and \omega has char_code 0x33
	X** I suspect that there are two versions of some letters
	X** I've only added the ones I've needed for translating.
	X** Hence the apparent randomness.
	X*/
	X  LINK->char_set[0x7f] = 0x8;
	X  LINK->char_code[0x7f] = 0x15;
	X  strcpy(LINK->ext_lat[0x7f], "$\\kappa$");
	X  LINK->char_set[0x80] = 0x8;
	X  LINK->char_code[0x80] = 0x8;
	X  strcpy(LINK->ext_lat[0x80], "$\\Delta$");
	X  LINK->char_set[0x81] = 0x8;
	X  LINK->char_code[0x81] = 0xf;
	X  strcpy(LINK->ext_lat[0x81], "$\\eta$");
	X  LINK->char_set[0x82] = 0x8;
	X  LINK->char_code[0x82] = 0x27;
	X  strcpy(LINK->ext_lat[0x82], "$\\zeta$");
	X  LINK->char_set[0x83] = 0x06;
	X  LINK->char_code[0x83] = 0x0a;
	X  strcpy(LINK->ext_lat[0x83], "$<$");
	X  LINK->char_set[0x84] = 0x06;
	X  LINK->char_code[0x84] = 0x09;
	X  strcpy(LINK->ext_lat[0x84], "$|$");
	X  LINK->char_set[0x85] = 0x8;
	X  LINK->char_code[0x85] = 0x7;
	X  strcpy(LINK->ext_lat[0x85], "$\\gamma$");
	X  LINK->char_set[0x86] = 0x8;
	X  LINK->char_code[0x86] = 0x2b;
	X  strcpy(LINK->ext_lat[0x86], "$\\phi$");
	X  LINK->char_set[0x87] = 0x6;
	X  LINK->char_code[0x87] = 0x27;
	X  strcpy(LINK->ext_lat[0x87], "$\\times$");
	X  LINK->char_set[0x88] = 0x6;
	X  LINK->char_code[0x88] = 0x28;
	X  strcpy(LINK->ext_lat[0x88], "$\\int$");
	X  LINK->char_set[0x89] = 0x8;
	X  LINK->char_code[0x89] = 0x31;
	X  strcpy(LINK->ext_lat[0x89], "$\\psi$");
	X  LINK->char_set[0x8a] = 0x6;
	X  LINK->char_code[0x8a] = 0xb;
	X  strcpy(LINK->ext_lat[0x8a], "$>$");
	X  LINK->char_set[0x8b] = 0x8;
	X  LINK->char_code[0x8b] = 0x2f;
	X  strcpy(LINK->ext_lat[0x8b], "$\\chi$");
	X  LINK->char_set[0x8c] = 0x6;
	X  LINK->char_code[0x8c] = 0x17;
	X  strcpy(LINK->ext_lat[0x8c], "$\\uparrow$");
	X  LINK->char_set[0x8d] = 0x6;
	X  LINK->char_code[0x8d] = 0x15;
	X  strcpy(LINK->ext_lat[0x8d], "$\\rightarrow$");
	X  LINK->char_set[0x8e] = 0x8;
	X  LINK->char_code[0x8e] = 0x17;
	X  strcpy(LINK->ext_lat[0x8e], "$\\lambda$");
	X  LINK->char_set[0x8f] = 0x8;
	X  LINK->char_code[0x8f] = 0x33;
	X  strcpy(LINK->ext_lat[0x8f], "$\\omega$");
	X}
	X
	X
	XLocal Void Make_tabelentry_attr(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  uchar num_of_attr;
	X  short j;
	X
	X  num_of_attr = LINK->openptr[LINK->depth];
	X  fwrite(&num_of_attr, sizeof(uchar), 1, tabel);
	X
	X  for (j = 1; j <= num_of_attr; j++)
	X    fwrite(&LINK->attr_rij[LINK->depth][j], sizeof(uchar), 1, tabel);
	X
	X}
	X
	X
	X
	XLocal Void Make_tabelentry_tabset(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  uchar b;
	X  short j, FORLIM;
	X
	X  b = 'S';
	X  fwrite(&b, sizeof(uchar), 1, tabel);
	X
	X  b = LINK->num_of_tabs;
	X  fwrite(&b, sizeof(uchar), 1, tabel);
	X
	X  FORLIM = LINK->num_of_tabs;
	X  for (j = 0; j < FORLIM; j++)
	X    Wr_word(&tabel, LINK->tabpos[j]);
	X}
	X
	X
	XLocal Void Make_tabelentry_rightjustification(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  uchar b;
	X
	X  b = 'U';
	X  fwrite(&b, sizeof(uchar), 1, tabel);
	X
	X  if (LINK->by == 0x81)   /* regels NIET uitvullen */
	X    b = 1;   /* regels WEL uitvullen */
	X  else
	X    b = 0;
	X  fwrite(&b, sizeof(uchar), 1, tabel);
	X}
	X
	X
	X
	X
	XLocal Void Make_tabelentry_envir_extra_end(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  uchar b;
	X
	X
	X  switch (LINK->envir) {
	X
	X  case 'C':
	X    b = 'C';
	X    fwrite(&b, sizeof(uchar), 1, tabel);
	X    break;
	X
	X  case 'T':
	X    b = 'T';
	X    fwrite(&b, sizeof(uchar), 1, tabel);
	X    break;
	X
	X  case 'I':
	X    b = 'I';
	X    fwrite(&b, sizeof(uchar), 1, tabel);
	X    Wr_word(&tabel, LINK->ind_leftmargin);
	X    Wr_word(&tabel, LINK->ind_rightmargin);
	X
	X    if (LINK->ind_text2) {
	X      b = 1;
	X      fwrite(&b, sizeof(uchar), 1, tabel);
	X    } else {
	X      b = 0;
	X      fwrite(&b, sizeof(uchar), 1, tabel);
	X    }
	X
	X    break;
	X
	X  }/*Case*/
	X
	X  b = LINK->line_term;
	X  fwrite(&b, sizeof(uchar), 1, tabel);
	X
	X  b = 0xff;
	X  fwrite(&b, sizeof(uchar), 1, tabel);
	X
	X}
	X
	X
	XLocal Void Reset_attr_rij(d, LINK)
	Xshort d;
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  short j;
	X
	X  for (j = 0; j <= 16; j++)
	X    LINK->attr_rij[d][j] = 0;
	X  LINK->leegptr[d] = 1;
	X  LINK->openptr[d] = 0;
	X}
	X
	X
	X
	XLocal Void Open_all_attr(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  /* -- Open alle commando's door de Attributen-rij af te lopen -- */
	X  short j, FORLIM;
	X
	X  FORLIM = LINK->leegptr[LINK->depth];
	X  for (j = LINK->openptr[LINK->depth] + 1; j < FORLIM; j++) {
	X    fputs(open_com[LINK->attr_rij[LINK->depth][j]], strip);
	X    LINK->openptr[LINK->depth]++;
	X  }
	X
	X  LINK->open_attr_rij[LINK->depth] = false;
	X      /* Alle attributen staan weer goed */
	X}
	X
	X
	X
	XLocal Void Close_all_attr(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  /* -- Sluit alle commando's door de Attributen-rij af te lopen -- */
	X  short j;
	X
	X  for (j = LINK->openptr[LINK->depth]; j >= 1; j--) {
	X    fputs(close_com[LINK->attr_rij[LINK->depth][j]], strip);
	X    LINK->openptr[LINK->depth]--;
	X  }
	X  LINK->open_attr_rij[LINK->depth] = true;
	X}
	X
	X
	X
	XLocal Void Attr_ON(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  /* Deze procedure plaatst een attribuut (lettertype) in de attribuut-rij */
	X  uchar b;
	X
	X  fread(&b, sizeof(uchar), 1, wpd);   /* lees attribuut-code */
	X
	X  LINK->attr_rij[LINK->depth][LINK->leegptr[LINK->depth]] = b;
	X      /* attribuut in attr-rij */
	X  LINK->leegptr[LINK->depth]++;   /* plaats 1 verder. */
	X  LINK->open_attr_rij[LINK->depth] = true;   /* openstaande attr-rij */
	X
	X  fread(&b, sizeof(uchar), 1, wpd);   /* lees voorbij afsluitcode */
	X}
	X
	X
	X
	XLocal Void Attr_OFF(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  /* Deze procedure haalt een uit een attribuut (lettertype) uit de */
	X  /* attribuut-rij door middel van een stack principe omdat binnen  */
	X  /* LaTeX de later geopende kommando's eerst afgesloten te worden  */
	X  uchar b;
	X  boolean found;
	X  short j, codeptr, FORLIM;
	X
	X  fread(&b, sizeof(uchar), 1, wpd);   /* lees attribuut-code */
	X
	X  j = LINK->leegptr[LINK->depth];   /* zoek vanaf top attr-rij */
	X  found = false;   /* nog niet gevonden */
	X
	X  while (j > 1 && !found) {   /* zoek attr-code in attr-rij */
	X    j--;
	X    found = (LINK->attr_rij[LINK->depth][j] == b);
	X  }
	X
	X  if (j <= 0) {   /* Moet nooit kunnen voorkomen */
	X    RunError(0x100);
	X  }
	X  codeptr = j;   /* plaats van attr-code in rij */
	X
	X  /* Sluit alle commando's t/m de desbetreffende code als deze nog niet */
	X  /* gesloten zijn.                                                     */
	X
	X  if (codeptr <= LINK->openptr[LINK->depth]) {
	X    for (j = LINK->openptr[LINK->depth]; j >= codeptr; j--) {
	X      fputs(close_com[LINK->attr_rij[LINK->depth][j]], strip);
	X      LINK->openptr[LINK->depth]--;
	X    }
	X  }
	X
	X  FORLIM = LINK->leegptr[LINK->depth];
	X  /* Haal de desbetreffende attribuut uit de rij en werk pointers bij */
	X
	X  for (j = codeptr; j < FORLIM; j++)
	X    LINK->attr_rij[LINK->depth][j] = LINK->attr_rij[LINK->depth][j + 1];
	X  LINK->leegptr[LINK->depth]--;
	X
	X  LINK->open_attr_rij[LINK->depth] = true;   /* openstaande attr-rij */
	X
	X  fread(&b, sizeof(uchar), 1, wpd);   /* lees voorbij afsluitcode */
	X}
	X
	X
	X
	XLocal Void Center(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  /* Deze procedure zorgt voor center environment zolang er nog geen */
	X  /* andere environment is begonnen.                                 */
	X  if (LINK->envir == ' ')   /* environment = center */
	X    LINK->envir = 'C';
	X
	X  Jump_in_file(&wpd, 7L);   /* rest van code overslaan */
	X}
	X
	X
	X
	XLocal Void End_Align(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  if (LINK->align_tab) {
	X    Close_all_attr(LINK);
	X    fprintf(strip, "\\'");
	X    LINK->align_tab = false;
	X    Open_all_attr(LINK);
	X  }
	X
	X  if (LINK->right_tab) {
	X    Close_all_attr(LINK);
	X    fprintf(strip, "\\'");
	X    LINK->right_tab = false;
	X    Open_all_attr(LINK);
	X  }
	X
	X  if (!LINK->center_tab)
	X    return;
	X  Close_all_attr(LINK);
	X  putc('}', strip);
	X  LINK->center_tab = false;
	X  Open_all_attr(LINK);
	X}
	X
	X
	X
	XLocal Void Tab(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  short j;
	X  unsigned short wpu;
	X  short tabnum, new_tabs, FORLIM;
	X
	X  if (LINK->envir == 'I' || LINK->nomore_valid_tabs)
	X  {   /* Noggeen indent --> normaal tab */
	X    Jump_in_file(&wpd, 7L);
	X    return;
	X  }
	X
	X
	X  if (LINK->by == 0x48)
	X    LINK->right_tab = true;
	X
	X  if (LINK->by == 0x40)
	X    LINK->align_tab = true;
	X
	X  if (LINK->by == 0xc8)
	X    LINK->center_tab = true;
	X
	X  Jump_in_file(&wpd, 2L);
	X
	X  Rd_word(&wpd, &wpu);   /* Lees abs.-indent [wpu] */
	X  wpu -= LINK->WP_sidemargin;   /* Correctie ivm WP kantlijn */
	X
	X  tabnum = 0;
	X  FORLIM = LINK->num_of_tabs;
	X  for (j = 1; j <= FORLIM; j++) {   /* Bepaal welke tabpos */
	X    if (wpu >= LINK->tabpos[j - 1])
	X      tabnum = j;
	X  }
	X
	X  new_tabs = tabnum - LINK->latex_tabpos;
	X
	X  if (new_tabs > 0) {
	X    Close_all_attr(LINK);
	X
	X    for (j = 1; j <= new_tabs; j++)
	X      fprintf(strip, "\\>");
	X
	X    if (LINK->center_tab)
	X      fprintf(strip, "\\ctab{");
	X
	X    Open_all_attr(LINK);
	X  }
	X
	X  LINK->latex_tabpos = tabnum;
	X
	X  Jump_in_file(&wpd, 3L);
	X
	X  LINK->envir = 'T';   /* Er zit een tab in deze regel */
	X}
	X
	X
	X
	XLocal Void Flush_right_tab(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  if (LINK->envir != 'I') {
	X    Close_all_attr(LINK);
	X    fprintf(strip, "\\`");
	X    Open_all_attr(LINK);
	X
	X    LINK->nomore_valid_tabs = true;
	X
	X    LINK->envir = 'T';
	X  }
	X
	X  Jump_in_file(&wpd, 7L);
	X}
	X
	X
	X
	XLocal Void Indent(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  unsigned short dif, abs;
	X  uchar b;
	X
	X  if (LINK->envir == 'T') {
	X	/*Al een tabcommando gezet dus er mag geen insp */
	X	  Jump_in_file(&wpd, 10L);
	X    return;
	X  }
	X  LINK->envir = 'I';
	X  LINK->indenting = true;
	X
	X  if (LINK->ind_text2) {
	X    Jump_in_file(&wpd, 10L);
	X    return;
	X  }
	X  fread(&b, sizeof(uchar), 1, wpd);
	X  b &= 0x1;
	X
	X  Rd_word(&wpd, &dif);
	X  Rd_word(&wpd, &abs);   /* Eigenlijk Old current column */
	X  Rd_word(&wpd, &abs);
	X
	X  LINK->ind_leftmargin = abs - LINK->WP_sidemargin;
	X
	X  if (b == 1)
	X    LINK->ind_rightmargin += dif;
	X  /*Margins bepaald lees voorby rest van functie-codes */
	X  Jump_in_file(&wpd, 3L);
	X
	X  if (LINK->ind_text1)
	X    return;
	X  if (LINK->char_on_line) {
	X    putc('}', strip);
	X    LINK->ind_text1 = true;
	X  }
	X}
	X
	X
	XLocal Void End_of_indent(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  LINK->indent_end = true;
	X  Jump_in_file(&wpd, 5L);
	X}
	X
	X
	X
	XLocal Void Tabset(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  short j;
	X  unsigned short w;
	X
	X  Jump_in_file(&wpd, 102L);   /* Ga naar TAB-info */
	X
	X  LINK->num_of_tabs = 0;
	X
	X  for (j = 1; j <= 40; j++) {
	X    Rd_word(&wpd, &w);
	X    if (w > LINK->WP_sidemargin && w != 0xffffL) {
	X      LINK->num_of_tabs++;
	X      LINK->tabpos[LINK->num_of_tabs - 1] = w - LINK->WP_sidemargin;
	X    }
	X  }
	X
	X  Jump_in_file(&wpd, 24L);
	X
	X  Make_tabelentry_tabset(LINK);
	X}
	X
	X
	X
	XLocal Void Page_number_position(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  uchar position_code;
	X
	X  Jump_in_file(&wpd, 5L);   /*Skip length of code; always 10*/
	X  /* + old information */
	X  fread(&position_code, sizeof(uchar), 1, wpd);
	X
	X  fprintf(strip, "\\pagenumpos");
	X  switch (position_code) {
	X
	X  case 0x1:
	X    fprintf(strip, "{\\pntl}");
	X    break;
	X
	X  case 0x2:
	X    fprintf(strip, "{\\pntc}");
	X    break;
	X
	X  case 0x3:
	X    fprintf(strip, "{\\pntr}");
	X    break;
	X
	X  case 0x5:
	X    fprintf(strip, "{\\pnbl}");
	X    break;
	X
	X  case 0x6:
	X    fprintf(strip, "{\\pnbc}");
	X    break;
	X
	X  case 0x7:
	X    fprintf(strip, "{\\pnbr}");
	X    break;
	X
	X  default:
	X    fprintf(strip, "{\\pnno}");
	X    break;
	X  }
	X
	X  Jump_in_file(&wpd, 6L);
	X}
	X
	X
	X
	XLocal Void Character(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  Char ch[256];
	X
	X  short j;
	X  uchar chr_code, chr_set, b;
	X  boolean found;
	X
	X
	X  if (LINK->open_attr_rij[LINK->depth])
	X    Open_all_attr(LINK);
	X
	X  switch (LINK->by) {
	X
	X  case 0xa9:   /* Special_char */
	X    if (LINK->by == 0xa9)
	X      strcpy(ch, "-");
	X    else
	X      strcpy(ch, "\\ ");
	X    break;
	X
	X  case 0xc0:   /* Extended_char */
	X    j = 127;
	X    found = false;
	X
	X    fread(&chr_code, sizeof(uchar), 1, wpd);
	X    fread(&chr_set, sizeof(uchar), 1, wpd);
	X
	X    while (j < 511 && !found) {
	X      j++;
	X      if (chr_code == LINK->char_code[j - 0x80] &&
	X	  chr_set == LINK->char_set[j - 0x80])
	X	found = true;
	X    }
	X
	X    if (found)
	X      strcpy(ch, LINK->ext_lat[j - 0x80]);
	X    else
	X      strcpy(ch, "\\ ");
	X
	X    fread(&b, sizeof(uchar), 1, wpd);
	X    break;
	X
	X  default:
	X    if (LINK->by >= 0x20 && LINK->by <= 0x7f) {
	X      /* Normal_char  */
	X      strcpy(ch, LINK->lat[LINK->by - 0x20]);
	X    }
	X
	X    break;
	X  }
	X
	X  fputs(ch, strip);
	X
	X}
	X
	X
	X
	XLocal Void Return_Page(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  switch (LINK->by) {
	X
	X  case 0x0a:
	X  case 0x8c:   /* Hard return */
	X    LINK->line_term = 'R';
	X    break;
	X
	X  case 0x0d:   /* Soft return */
	X    LINK->line_term = 'r';
	X    break;
	X
	X  case 0xc:   /* Hard page */
	X    LINK->line_term = 'P';
	X    break;
	X
	X  case 0xb:   /* Soft page */
	X    LINK->line_term = 'p';
	X    break;
	X  }
	X
	X  putc('\n', strip);
	X
	X  Make_tabelentry_envir_extra_end(LINK);
	X
	X  if (LINK->indent_end) {
	X    LINK->envir = ' ';
	X    LINK->indenting = false;
	X    LINK->ind_text1 = false;
	X    LINK->ind_text2 = false;
	X    LINK->ind_leftmargin = 0;
	X    LINK->ind_rightmargin = 0;
	X
	X    LINK->indent_end = false;
	X  } else if (LINK->envir != 'I')
	X    LINK->envir = ' ';
	X
	X
	X  LINK->char_on_line = false;
	X  LINK->nomore_valid_tabs = false;
	X
	X  LINK->regelnum++;
	X
	X  Make_tabelentry_attr(LINK);
	X
	X  LINK->latex_tabpos = 0;
	X}
	X
	X
	XLocal Void Nop80(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  /* Om dat het een 1-byte funktie is hoeft er niks overgeslagen */
	X  /* te worden.                                                  */
	X}
	X
	X
	X
	XLocal Void NopC0(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  if (LINK->by == 0xc0)
	X    Jump_in_file(&wpd, 3L);
	X  if (LINK->by == 0xc1)
	X    Jump_in_file(&wpd, 8L);
	X  if (LINK->by == 0xc2)
	X    Jump_in_file(&wpd, 10L);
	X  if (LINK->by == 0xc3)
	X    Jump_in_file(&wpd, 2L);
	X  if (LINK->by == 0xc4)
	X    Jump_in_file(&wpd, 2L);
	X  if (LINK->by == 0xc5)
	X    Jump_in_file(&wpd, 4L);
	X  if (LINK->by == 0xc6)
	X    Jump_in_file(&wpd, 5L);
	X  if (LINK->by == 0xc7)
	X    Jump_in_file(&wpd, 6L);
	X}
	X
	X
	X
	XLocal Void NopD0(already_read_subfunc_code, LINK)
	Xboolean already_read_subfunc_code;
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  uchar b;
	X  unsigned short w;
	X
	X  if (!already_read_subfunc_code)   /* Lees subfunctioncode */
	X    fread(&b, sizeof(uchar), 1, wpd);
	X
	X  Rd_word(&wpd, &w);   /* Lees lengte 'die nog volgt ' */
	X  fseek(wpd, (ftell(wpd) / sizeof(uchar) + w) * sizeof(uchar), 0);
	X}
	X
	X
	X
	XLocal Void Overstrike(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  boolean first_char_os;
	X
	X  unsigned short char_width_os, len_of_code;
	X  long end_of_code;
	X
	X  Rd_word(&wpd, &len_of_code);   /* Lees lengte */
	X  end_of_code = ftell(wpd) / sizeof(uchar) + len_of_code - 4;
	X
	X  Rd_word(&wpd, &char_width_os);
	X
	X  first_char_os = true;
	X
	X  while (ftell(wpd) / sizeof(uchar) < end_of_code) {
	X    fread(&LINK->by, sizeof(uchar), 1, wpd);
	X
	X
	X    if (LINK->by >= 0x20 && LINK->by <= 0x7f || LINK->by == 0xa9 ||
	X	LINK->by == 0xc0) {
	X      if (first_char_os) {
	X	Character(LINK);
	X	first_char_os = false;
	X      } else {
	X	fprintf(strip, "\\llap{");
	X	Character(LINK);
	X	putc('}', strip);
	X      }
	X      continue;
	X    }
	X
	X    if (LINK->by <= 0xbf)
	X      Nop80(LINK);
	X    else if (LINK->by >= 0xc0 && LINK->by <= 0xcf)
	X      NopC0(LINK);
	X    else if (LINK->by >= 0xd0 && LINK->by <= 0xfe)
	X      NopD0(false, LINK);
	X  }
	X
	X  Jump_in_file(&wpd, 4L);
	X
	X}
	X
	X
	X
	XLocal Void Footnote(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  uchar flags, num_of_pages;
	X
	X  unsigned short fn_num, len_of_code;
	X  long end_of_code;
	X
	X  Rd_word(&wpd, &len_of_code);   /* Lees lengte */
	X  end_of_code = ftell(wpd) / sizeof(uchar) + len_of_code - 4;
	X
	X  fread(&flags, sizeof(uchar), 1, wpd);
	X
	X  Rd_word(&wpd, &fn_num);
	X
	X  /* Skip all the shit */
	X
	X  fread(&num_of_pages, sizeof(uchar), 1, wpd);
	X  Jump_in_file(&wpd, (num_of_pages + 1L) * 2 + 9);
	X
	X  Close_all_attr(LINK);
	X
	X  LINK->depth = 1;
	X  Reset_attr_rij(LINK->depth, LINK);
	X
	X  fprintf(strip, "\\footnote[%u]{", fn_num);
	X
	X  while (ftell(wpd) / sizeof(uchar) < end_of_code) {
	X    fread(&LINK->by, sizeof(uchar), 1, wpd);
	X
	X    switch (LINK->by) {
	X
	X    case 0xa:
	X    case 0xc:
	X      fprintf(strip, "\\\\ ");
	X      break;
	X
	X    case 0xb:
	X    case 0xd:
	X      putc(' ', strip);
	X      break;
	X
	X    case 0xc3:
	X      Attr_ON(LINK);
	X      break;
	X
	X    case 0xc4:
	X      Attr_OFF(LINK);
	X      break;
	X
	X    default:
	X      if (LINK->by >= 0x20 && LINK->by <= 0x7f || LINK->by == 0xa9 ||
	X	  LINK->by == 0xc0)
	X	Character(LINK);
	X      else if (LINK->by <= 0xbf)
	X	Nop80(LINK);
	X      else if (LINK->by >= 0xc0 && LINK->by <= 0xcf)
	X	NopC0(LINK);
	X      else if (LINK->by >= 0xd0 && LINK->by <= 0xfe)
	X	NopD0(false, LINK);
	X
	X      break;
	X    }
	X
	X  }
	X
	X  Close_all_attr(LINK);   /* Echt nodig ? */
	X  putc('}', strip);
	X
	X  Jump_in_file(&wpd, 4L);
	X
	X  LINK->depth = 0;
	X  Open_all_attr(LINK);
	X
	X}
	X
	X
	X
	XLocal Void Header_Footer(LINK)
	Xstruct LOC_Convert_first_strike *LINK;
	X{
	X  uchar subfunc, occurance;
	X  unsigned short len_of_code;
	X  long end_of_code;
	X
	X  boolean hf_left, hf_center, hf_right;
	X
	X  short j;
	X
	X  fread(&subfunc, sizeof(uchar), 1, wpd);
	X  Rd_word(&wpd, &len_of_code);
	X
	X  if (len_of_code <= 22) {
	X    Jump_in_file(&wpd, (long)len_of_code);
	X    return;
	X  }
	X
	X
	X  end_of_code = ftell(wpd) / sizeof(uchar) + len_of_code - 4;
	X
	X  Jump_in_file(&wpd, 7L);
	X
	X  fread(&occurance, sizeof(uchar), 1, wpd);
	X
	X  Jump_in_file(&wpd, 10L);
	X
	X  Close_all_attr(LINK);
	X  LINK->depth = 1;
	X
	X  /* Geen schone attr._lei; Kopieer attributen uit Niveau 0;  Fout in WP 5.0 ? */
	X
	X  for (j = 0; j <= 15; j++)
	X    LINK->attr_rij[1][j] = LINK->attr_rij[0][j];
	X
	X  LINK->leegptr[1] = LINK->leegptr[0];
	X  LINK->openptr[1] = LINK->openptr[0];
	X
	X  switch (subfunc) {
	X
	X  case 0:
	X  case 1:
	X    fprintf(strip, "\\headtext");
	X    break;
	X
	X  case 2:
	X  case 3:
	X    fprintf(strip, "\\foottext");
	X    break;
	X  }
	X
	X  switch (occurance) {
	X
	X  case 0:
	X    fprintf(strip, "{\\neverpages}{");
	X    break;
	X
	X  case 1:
	X    fprintf(strip, "{\\allpages}{");
	X    break;
	X
	X  case 2:
	X    fprintf(strip, "{\\oddpages}{");
	X    break;
	X
	X  case 3:
	X    fprintf(strip, "{\\evenpages}{");
	X    break;
	X  }
	X
	X  Open_all_attr(LINK);
	X  hf_left = true;   /* Beginnen met de linkerkant */
	X  hf_center = false;
	X  hf_right = false;
	X
	X  while (ftell(wpd) / sizeof(uchar) < end_of_code) {
	X    fread(&LINK->by, sizeof(uchar), 1, wpd);
	X
	X    switch (LINK->by) {
	X
	X    case 0xc1:
	X      fread(&LINK->by, sizeof(uchar), 1, wpd);
	X      LINK->by &= 0xe0;
	X      Jump_in_file(&wpd, 7L);
	X
	X      if (LINK->by == 0xe0) {
	X	if (hf_left) {
	X	  Close_all_attr(LINK);
	X	  fprintf(strip, "}{");
	X	  Open_all_attr(LINK);
	X
	X	  hf_left = false;
	X	  hf_center = true;
	X	}
	X      }
	X
	X      if (LINK->by == 0x60) {
	X	if (hf_left) {
	X	  Close_all_attr(LINK);
	X	  fprintf(strip, "}{}{");
	X	  Open_all_attr(LINK);
	X
	X	  hf_left = false;
	X	  hf_right = true;
	X	}
	X
	X	if (hf_center) {
	X	  Close_all_attr(LINK);
	X	  fprintf(strip, "}{");
	X	  Open_all_attr(LINK);
	X
	X	  hf_center = false;
	X	  hf_right = true;
	X	}
	X      }
	X      break;
	X
	X    case 0xc3:
	X      Attr_ON(LINK);
	X      break;
	X
	X    case 0xc4:
	X      Attr_OFF(LINK);
	X      break;
	X
	X    default:
	X      if (LINK->by >= 0x20 && LINK->by <= 0x7f || LINK->by == 0xa9 ||
	X	  LINK->by == 0xc0)
	X	Character(LINK);
	X      else if (LINK->by <= 0xbf)
	X	Nop80(LINK);
	X      else if (LINK->by >= 0xc0 && LINK->by <= 0xcf)
	X	NopC0(LINK);
	X      else if (LINK->by >= 0xd0 && LINK->by <= 0xfe)
	X	NopD0(false, LINK);
	X
	X
	X      break;
	X    }
	X  }
	X
	X  Close_all_attr(LINK);   /* Echt nodig ? */
	X
	X  Jump_in_file(&wpd, 4L);
	X
	X  if (hf_left)
	X    fprintf(strip, "}{}{}");
	X  if (hf_center)
	X    fprintf(strip, "}{}");
	X  if (hf_right)
	X    putc('}', strip);
	X
	X  LINK->depth = 0;
	X  Open_all_attr(LINK);
	X
	X
	X
	X}
	X
	X
	X/*---SLAG1----*/
	X
	XStatic Void Convert_first_strike()
	X{
	X  /* Dit is de komplete procedure van de eerste slag met zijn eigen proc.'s. */
	X  struct LOC_Convert_first_strike V;
	X
	X  short convperc;
	X
	X  long srtdocpos, fsize;
	X
	X
	X  Table_Init(&V);
	X  Ext_chr_init(&V);
	X
	X  Reset_attr_rij(0, &V);
	X  Reset_attr_rij(1, &V);
	X  V.depth = 0;
	X
	X  WP_Default(&V);
	X
	X  V.latex_tabpos = 0;
	X  V.right_tab = false;
	X  V.align_tab = false;
	X  V.center_tab = false;
	X
	X  V.indenting = false;
	X  V.indent_end = false;
	X  V.ind_text1 = false;
	X  V.ind_text2 = false;
	X  V.ind_leftmargin = 0;
	X  V.ind_rightmargin = 0;
	X
	X  V.envir = ' ';
	X
	X  V.nomore_valid_tabs = false;
	X
	X  printf("First strike :\n");
	X#ifndef sun
	X  printf("Converting-percentage :     ");
	X#endif
	X
	X  srtdocpos = ftell(wpd) / sizeof(uchar);
	X  fsize = P_maxpos(wpd) / sizeof(uchar) + 1;
	X
	X  V.regelnum = 0;
	X
	X  Make_tabelentry_attr(&V);   /* attribuut instelling */
	X
	X  Make_tabelentry_tabset(&V);   /* Geef de defaulttabinstelling door */
	X  /* aan de 2e slag */
	X
	X  while (ftell(wpd) / sizeof(uchar) < fsize-2) {
	X#ifndef sun
	X    convperc = (long)floor((double)(ftell(wpd) / sizeof(uchar) - srtdocpos) /
	X			   (fsize - srtdocpos) * 100 + 0.5);
	X    printf("\b\b\b\b%3d%%", convperc);
	X#endif
	X
	X    fread(&V.by, sizeof(uchar), 1, wpd);
	X
	X    switch (V.by) {
	X
	X    case 0xa:
	X    case 0xd:
	X    case 0xb:
	X    case 0xc:
	X    case 0x8c:
	X      Return_Page(&V);
	X      break;
	X
	X    case 0xc1:
	X      fread(&V.by, sizeof(uchar), 1, wpd);
	X      V.by &= 0xe8;
	X
	X      switch (V.by) {
	X
	X      case 0:
	X      case 0xc8:
	X      case 0x48:
	X      case 0x40:
	X	Tab(&V);
	X	break;
	X
	X      case 0x60:
	X	Flush_right_tab(&V);
	X	break;
	X
	X      case 0xe0:
	X	Center(&V);
	X	break;
	X
	X      default:
	X	Jump_in_file(&wpd, 7L);
	X	break;
	X      }
	X      break;
	X
	X    case 0x81:
	X    case 0x82:
	X      Make_tabelentry_rightjustification(&V);
	X      break;
	X
	X    case 0x83:
	X      End_Align(&V);
	X      break;
	X
	X    case 0xc3:
	X      Attr_ON(&V);
	X      break;
	X
	X    case 0xc4:
	X      Attr_OFF(&V);
	X      break;
	X
	X    case 0xc2:
	X      Indent(&V);
	X      break;
	X
	X    case 0xc6:
	X      End_of_indent(&V);
	X      break;
	X
	X    case 0xc5:
	X    case 0xc7:
	X      NopC0(&V);
	X      break;
	X
	X    case 0xd0:
	X      fread(&V.by, sizeof(uchar), 1, wpd);
	X      switch (V.by) {
	X
	X      case 0x4:
	X	Tabset(&V);
	X	break;
	X
	X      case 0x8:
	X	Page_number_position(&V);
	X	break;
	X
	X      default:
	X	NopD0(true, &V);
	X	break;
	X      }
	X      break;
	X
	X    case 0xd5:
	X      Header_Footer(&V);
	X      break;
	X
	X    case 0xd6:
	X      fread(&V.by, sizeof(uchar), 1, wpd);
	X      switch (V.by) {
	X
	X      case 0:
	X	Footnote(&V);
	X	break;
	X
	X      default:
	X	NopD0(true, &V);
	X	break;
	X      }
	X      break;
	X
	X    case 0xd8:
	X      fread(&V.by, sizeof(uchar), 1, wpd);
	X      switch (V.by) {
	X
	X      case 0x2:
	X	Overstrike(&V);
	X	break;
	X
	X      default:
	X	NopD0(true, &V);
	X	break;
	X      }
	X      break;
	X
	X    default:
	X      if (V.by >= 0x20 && V.by <= 0x7f || V.by == 0xa9 || V.by == 0xc0) {
	X	V.char_on_line = true;   /*Er (al) is een karakter op deze regel */
	X	if (V.indenting) {   /*Als er is ingeprongen er na een stuk */
	X	  if (V.ind_text1)   /*tekst is weer ingesprongen (ind_text1) */
	X	    V.ind_text2 = true;
	X	}
	X	/*dan hoort dit char bij het ind_txt-blok */
	X
	X	Character(&V);
	X      } else if (V.by <= 0x1f || V.by >= 0x80 && V.by <= 0xbf)
	X	Nop80(&V);
	X      else if (V.by >= 0xd0 && V.by <= 0xff)
	X	NopD0(false, &V);
	X
	X      break;
	X    }
	X  }
	X
	X  putchar('\n');
	X  Make_tabelentry_envir_extra_end(&V);
	X
	X  num_of_lines_stripfile = V.regelnum;
	X
	X
	X
	X
	X}
	X
	X
	X/* Local variables for Convert_second_strike: */
	Xstruct LOC_Convert_second_strike {
	X  boolean just_envir_closed;
	X
	X  short num_of_tabs;
	X  unsigned short tabpos[40];
	X
	X  short tabent_num_of_tabs[3];
	X  unsigned short tabent_tabpos[3][40];
	X
	X  unsigned short ind_leftmargin[3], ind_rightmargin[3];
	X  uchar ind_label[3];
	X
	X  short pre, cur, next;
	X
	X  Char envir[3], line_term[3];
	X  boolean new_tabset[3];
	X  boolean new_rightjust;
	X  boolean new_tabent_rightjust[3], tabent_rightjust[3];
	X
	X  short num_of_attr[3];
	X  uchar attr_BOL[3][0x11];
	X  boolean attr_closed;
	X} ;
	X
	X
	X
	XLocal Void Read_tabelentry(n, LINK)
	Xshort n;
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  unsigned short w;
	X  uchar b;
	X  short j, FORLIM;
	X
	X  /* Begin met een schone lei die dan door deze procedure verder wordt */
	X  /* opgevuld. */
	X
	X  LINK->envir[n] = ' ';
	X  LINK->new_tabset[n] = false;
	X  LINK->new_tabent_rightjust[n] = false;
	X
	X  LINK->num_of_attr[n] = 0;
	X  for (j = 1; j <= 16; j++)
	X    LINK->attr_BOL[n][j] = 0;
	X
	X  if (ftell(tabel) / sizeof(uchar) > P_maxpos(tabel) / sizeof(uchar))
	X    return;
	X
	X
	X  /* Er is geen volgende tabelentry dus ook geen volgende regel */
	X  /* De tabelentry is 'schoon'.                                 */
	X  /* Zodat het document 'schoon' wordt afgesloten.              */
	X
	X  fread(&b, sizeof(uchar), 1, tabel);
	X  LINK->num_of_attr[n] = b;
	X  FORLIM = LINK->num_of_attr[n];
	X  for (j = 1; j <= FORLIM; j++)
	X    fread(&LINK->attr_BOL[n][j], sizeof(uchar), 1, tabel);
	X
	X  b = 0;
	X  while ((b != 0xff) && !feof(tabel)) {
	X    fread(&b, sizeof(uchar), 1, tabel);
	X
	X    switch (b) {   /*Case*/
	X
	X    case 'C':
	X      LINK->envir[n] = 'C';
	X      break;
	X
	X    case 'T':
	X      LINK->envir[n] = 'T';
	X      break;
	X
	X    case 'I':
	X      LINK->envir[n] = 'I';
	X      Rd_word(&tabel, &LINK->ind_leftmargin[n]);
	X      Rd_word(&tabel, &LINK->ind_rightmargin[n]);
	X      fread(&LINK->ind_label[n], sizeof(uchar), 1, tabel);
	X      break;
	X
	X    case 'S':
	X      LINK->new_tabset[n] = true;
	X      fread(&b, sizeof(uchar), 1, tabel);
	X      LINK->tabent_num_of_tabs[n] = b;
	X
	X      FORLIM = LINK->tabent_num_of_tabs[n];
	X      for (j = 0; j < FORLIM; j++) {
	X	Rd_word(&tabel, &w);
	X	LINK->tabent_tabpos[n][j] = w;
	X      }
	X      break;
	X
	X    case 'U':
	X      LINK->new_tabent_rightjust[n] = true;
	X      fread(&b, sizeof(uchar), 1, tabel);
	X      if (b == 0)
	X	LINK->tabent_rightjust[n] = false;
	X      else
	X	LINK->tabent_rightjust[n] = true;
	X      break;
	X
	X    case 'R':
	X    case 'r':
	X    case 'P':
	X    case 'p':
	X      LINK->line_term[n] = b;
	X      break;
	X
	X    }
	X  }
	X}
	X
	X
	X
	XLocal Void Open_all_attr_BOL(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  /* -- Open alle commando's door de Attributen-rij af te lopen -- */
	X  short j, FORLIM;
	X
	X  FORLIM = LINK->num_of_attr[LINK->cur];
	X  for (j = 0x1; j <= FORLIM; j++)
	X    fputs(open_com[LINK->attr_BOL[LINK->cur][j]], latex);
	X
	X  LINK->attr_closed = false;
	X}
	X
	X
	XLocal Void Close_all_attr_BOL(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  /* -- Sluit alle commando's door de Attributen-rij af te lopen -- */
	X  short j;
	X
	X  for (j = LINK->num_of_attr[LINK->cur]; j >= 0x1; j--)
	X    fputs(close_com[LINK->attr_BOL[LINK->cur][j]], latex);
	X
	X  LINK->attr_closed = true;
	X}
	X
	X
	X
	XLocal Void Open_all_attr_EOL(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  /* -- Open alle commando's door de Attributen-rij af te lopen -- */
	X  short j, FORLIM;
	X
	X  FORLIM = LINK->num_of_attr[LINK->next];
	X  for (j = 0x1; j <= FORLIM; j++)
	X    fputs(open_com[LINK->attr_BOL[LINK->next][j]], latex);
	X
	X  LINK->attr_closed = false;
	X}
	X
	X
	X
	XLocal Void Close_all_attr_EOL(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  /* -- Sluit alle commando's door de Attributen-rij af te lopen -- */
	X  short j;
	X
	X  for (j = LINK->num_of_attr[LINK->next]; j >= 0x1; j--)
	X    fputs(close_com[LINK->attr_BOL[LINK->next][j]], latex);
	X
	X  LINK->attr_closed = true;
	X}
	X
	X
	X
	XLocal Void Latex_head(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  /* -- Maak het de standard-heading voor een latex-file aan -- */
	X  fprintf(latex, "\\documentstyle[11pt,wp2latex]{report}\n");
	X  fprintf(latex, "\\begin{document}\n");
	X}
	X
	X
	X
	XLocal Void Latex_foot(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  /* -- Sluit de latex-file op de juiste wijze af -- */
	X  fprintf(latex, "\\end{document}\n");
	X}
	X
	X
	X
	XLocal Void Latex_tabset(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  short atpr, j;
	X  double l, ol;
	X  short FORLIM;
	X
	X  atpr = 0;   /* Huiding aantal tabs per regel */
	X  ol = 0.0;
	X  FORLIM = LINK->num_of_tabs;
	X  for (j = 0; j < FORLIM; j++) {
	X    l = LINK->tabpos[j] / 1200.0 * 2.54;
	X    fprintf(latex, "\\hspace{%3.2fcm}\\=", l - ol);
	X    atpr++;
	X    if (atpr >= 4) {
	X      fprintf(latex, "%%\n");
	X      atpr = 0;
	X    }
	X    ol = l;
	X  }
	X  fprintf(latex, "\\kill\n");
	X}
	X
	X
	X
	XLocal boolean Change_envir_BOL(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  boolean hulp;
	X
	X  hulp = false;
	X
	X  hulp = (LINK->envir[LINK->cur] == 'C' && LINK->envir[LINK->pre] != 'C' ||
	X	  hulp);
	X  hulp = (LINK->envir[LINK->cur] == 'T' && LINK->envir[LINK->pre] != 'T' ||
	X	  hulp);
	X  hulp = (LINK->envir[LINK->cur] == 'I' && LINK->envir[LINK->pre] != 'I' ||
	X	  hulp);
	X
	X  return hulp;
	X}
	X
	X
	X
	XLocal boolean Change_envir_EOL(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  boolean hulp;
	X
	X  hulp = false;
	X
	X  hulp = (((LINK->envir[LINK->next] == 'C') ^ (LINK->envir[LINK->cur] == 'C')) ||
	X	  hulp);
	X  hulp = (((LINK->envir[LINK->next] == 'T') ^ (LINK->envir[LINK->cur] == 'T')) ||
	X	  hulp);
	X  hulp = (((LINK->envir[LINK->next] == 'I') ^ (LINK->envir[LINK->cur] == 'I')) ||
	X	  hulp);
	X
	X  return hulp;
	X}
	X
	X
	X
	X
	XLocal Void Open_environment(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  if (!Change_envir_BOL(LINK)) {   /* andere environment ? */
	X    if (LINK->new_tabset[LINK->cur] && LINK->envir[LINK->cur] == 'T')
	X      Latex_tabset(LINK);
	X    return;
	X  }
	X
	X
	X  if (!LINK->attr_closed)
	X    Close_all_attr_BOL(LINK);
	X
	X  switch (LINK->envir[LINK->cur]) {
	X
	X  case 'C':
	X    fprintf(latex, "\\begin{center}\n");
	X    break;
	X
	X  case 'T':
	X    fprintf(latex, "\\begin{tabbing}\n");
	X    Latex_tabset(LINK);
	X    break;
	X
	X  case 'I':
	X    fprintf(latex, "\\begin{indenting}");
	X    fprintf(latex, "{%3.2fcm}",
	X	    LINK->ind_leftmargin[LINK->cur] / 1200.0 * 2.54);
	X    fprintf(latex, "{%3.2fcm}",
	X	    LINK->ind_rightmargin[LINK->cur] / 1200.0 * 2.54);
	X    if (LINK->ind_label[LINK->cur] == 1) {
	X      fprintf(latex, "%%\n");
	X      putc('{', latex);
	X    } else
	X      fprintf(latex, "{}\n");
	X    break;
	X  }
	X
	X}
	X
	X
	X
	XLocal Void Close_environment(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  switch (LINK->envir[LINK->cur]) {
	X
	X  case 'C':
	X    fprintf(latex, "\\end{center}\n");
	X    break;
	X
	X  case 'T':
	X    fprintf(latex, "\\end{tabbing}\n");
	X    break;
	X
	X  case 'I':
	X    fprintf(latex, "\\end{indenting}\n");
	X    break;
	X  }
	X
	X  LINK->just_envir_closed = true;
	X
	X}
	X
	X
	X
	XLocal Void Update_global_information(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  short j, FORLIM;
	X
	X  if (LINK->new_tabset[LINK->cur]) {
	X    LINK->num_of_tabs = LINK->tabent_num_of_tabs[LINK->cur];
	X    FORLIM = LINK->num_of_tabs;
	X    for (j = 0; j < FORLIM; j++)
	X      LINK->tabpos[j] = LINK->tabent_tabpos[LINK->cur][j];
	X  }
	X
	X  if (LINK->new_tabent_rightjust[LINK->cur])
	X    LINK->new_rightjust = LINK->tabent_rightjust[LINK->cur];
	X
	X}
	X
	X
	XLocal Void Change_tabelentry(LINK)
	Xstruct LOC_Convert_second_strike *LINK;
	X{
	X  short help;
	X
	X  help = LINK->pre;
	X  LINK->pre = LINK->cur;
	X  LINK->cur = LINK->next;
	X  LINK->next = help;
	X  Read_tabelentry(LINK->next, LINK);
	X}
	X
	X
	X/*---SLAG2---*/
	X
	XStatic Void Convert_second_strike()
	X{
	X  struct LOC_Convert_second_strike V;
	X  unsigned short regelnum;
	X  short convperc;
	X
	X  boolean underline;
	X
	X  short i;
	X
	X  Char regel[256], hulp_regel[256];
	X  short len_reg;
	X
	X  boolean rightjust;
	X  Char STR3[256];
	X  Char *TEMP;
	X
	X
	X  V.pre = 0;
	X  V.cur = 1;
	X  V.next = 2;
	X
	X  V.envir[V.pre] = ' ';
	X  V.new_tabset[V.pre] = false;
	X
	X  V.just_envir_closed = true;
	X  V.attr_closed = false;
	X
	X  rightjust = true;
	X  V.new_rightjust = true;
	X  for (i = 0; i <= 2; i++) {
	X    V.new_tabent_rightjust[i] = false;
	X    V.tabent_rightjust[i] = false;
	X  }
	X
	X  Read_tabelentry(V.cur, &V);
	X  Read_tabelentry(V.next, &V);
	X
	X  regelnum = 1;
	X
	X  printf("\nSecond strike :\n");
	X#ifndef sun
	X  printf("Converting-percentage :     ");
	X#endif
	X
	X
	X
	X  Latex_head(&V);
	X
	X  while (!P_eof(strip)) {
	X    Update_global_information(&V);
	X
	X#ifndef sun
	X    convperc = (long)floor(regelnum * 100.0 / num_of_lines_stripfile + 0.5);
	X    if (convperc > 100)
	X      convperc = 100;
	X    printf("\b\b\b\b%3d%%", convperc);
	X#endif
	X
	X    fgets(regel, 256, strip);
	X    TEMP = (char *)strchr(regel, '\n');
	X    if (TEMP != NULL)
	X      *TEMP = 0;
	X
	X    /* Werk eventueel de regel bij d.m.v. een hulp regel. */
	X
	X    strcpy(hulp_regel, regel);
	X    len_reg = strlen(hulp_regel);
	X
	X    /* Meerdere spaties achter elkaar vervangen door harde spaties. */
	X
	X    for (i = 1; i < len_reg; i++) {
	X      if (regel[i - 1] == ' ' && regel[i] == ' ')
	X	hulp_regel[i] = '~';
	X    }
	X
	X    /* Zoek naar een illegaal argument en zet hier accolades voor. */
	X
	X    if (len_reg >= 1 && hulp_regel[0] == '[' ||
	X	len_reg >= 2 && hulp_regel[0] == ' ' && hulp_regel[1] == '[')
	X      sprintf(hulp_regel, "{}%s", strcpy(STR3, hulp_regel));
	X
	X    /* De regel is verwerkt. */
	X
	X    strcpy(regel, hulp_regel);
	X    len_reg = strlen(regel);
	X
	X    if (V.new_rightjust ^ rightjust) {
	X      rightjust = V.new_rightjust;
	X      if (rightjust)
	X	fprintf(latex, "\\justified\n");
	X      else
	X	fprintf(latex, "\\raggedright\n");
	X    }
	X
	X    Open_environment(&V);
	X
	X    if (len_reg > 0) {
	X      if (V.attr_closed)
	X	Open_all_attr_BOL(&V);
	X
	X      fputs(regel, latex);
	X
	X      V.just_envir_closed = false;
	X    }
	X
	X    switch (V.line_term[V.cur]) {   /*Case*/
	X
	X    case 'r':
	X    case 'p':
	X	  fputc('\n', latex);
	X      if (Change_envir_EOL(&V)) {
	X	     if (!V.attr_closed) {
	X	       Close_all_attr_EOL(&V);
	X		 }
	X
	X	     Close_environment(&V);
	X      }
	X      break;
	X
	X    case 'R':
	X      if (V.envir[V.cur] == 'I') {
	X	if (!V.attr_closed)
	X	  Close_all_attr_EOL(&V);
	X
	X	putc('\n', latex);
	X	Close_environment(&V);
	X	V.envir[V.cur] = ' ';
	X      } else {
	X	underline = false;
	X	for (i = 0x1; i <= 0x10; i++)
	X	  underline = (underline || V.attr_BOL[V.next][i] == 0xb ||
	X		       V.attr_BOL[V.next][i] == 0xe);
	X
	X	if (underline && !V.attr_closed)
	X	  Close_all_attr_EOL(&V);
	X
	X	/* Elke Indent-environment moet na een harde Return*/
	X	/* Afgesloten worden.*/
	X
	X
	X	if (Change_envir_EOL(&V)) {
	X	  if (V.just_envir_closed)
	X	    fprintf(latex, "\\nwln\n");
	X	  else
	X	    putc('\n', latex);
	X
	X	  if (!V.attr_closed)
	X	    Close_all_attr_EOL(&V);
	X
	X	  Close_environment(&V);
	X	} else {
	X	  if (V.just_envir_closed)
	X	    fprintf(latex, "\\nwln\n");
	X	  else
	X	    fprintf(latex, "\\\\\n");
	X	}
	X      }
	X
	X      break;
	X
	X
	X    case 'P':
	X      if (!V.attr_closed)
	X	Close_all_attr_EOL(&V);
	X
	X      putc('\n', latex);
	X      Close_environment(&V);
	X      fprintf(latex, "\\newpage\n");
	X      V.envir[V.cur] = ' ';
	X      break;
	X
	X    }
	X
	X
	X
	X    Change_tabelentry(&V);
	X
	X    regelnum++;
	X  }
	X
	X  Latex_foot(&V);
	X  putchar('\n');
	X}
	X
	X/*---HOOFDPROG---*/
	X
	Xmain(argc, argv)
	Xint argc;
	XChar *argv[];
	X{
	X
	X  PASCAL_MAIN(argc, argv);
	X  latex = NULL;
	X  strip = NULL;
	X  tabel = NULL;
	X  wpd = NULL;
	X
	X  Init_commando();
	X
	X  /* ClrScr(); */
	X  putchar(0xc);
	X  printf("\n     Conversion program : From Wordperfect 5.1 to LaTeX  (wp2latex)\n\n");
	X  printf("  (c) TUE-Eindhoven ---- Written by R.C.Houtepen ---- Date : 24 Jan 1990\n");
	X  printf("      Translated into C by G. Geers ---- Date : 2 Aug 1990\n");
	X
	X  Filenames();
	X
	X  if (wpd != NULL)
	X    wpd = freopen(wpd_NAME, "r+b", wpd);
	X  else
	X    wpd = fopen(wpd_NAME, "r+b");
	X  if (wpd == NULL)
	X    _EscIO(FileNotFound);
	X  Wpd_check();
	X
	X  if (strip != NULL)
	X    strip = freopen(strip_NAME, "w", strip);
	X  else
	X    strip = fopen(strip_NAME, "w");
	X  if (strip == NULL)
	X    _EscIO(FileNotFound);
	X  if (tabel != NULL)
	X    tabel = freopen(tabel_NAME, "w+b", tabel);
	X  else
	X    tabel = fopen(tabel_NAME, "w+b");
	X  if (tabel == NULL)
	X    _EscIO(FileNotFound);
	X
	X  printf("Converting ...\n\n");
	X
	X  Convert_first_strike();
	X
	X  if (wpd != NULL)
	X    fclose(wpd);
	X  wpd = NULL;
	X  if (strip != NULL)
	X    fclose(strip);
	X  strip = NULL;
	X  if (tabel != NULL)
	X    fclose(tabel);
	X  tabel = NULL;
	X
	X  if (strip != NULL)
	X    strip = freopen(strip_NAME, "r", strip);
	X  else
	X    strip = fopen(strip_NAME, "r");
	X  if (strip == NULL)
	X    _EscIO(FileNotFound);
	X  if (tabel != NULL)
	X    tabel = freopen(tabel_NAME, "r+b", tabel);
	X  else
	X    tabel = fopen(tabel_NAME, "r+b");
	X  if (tabel == NULL)
	X    _EscIO(FileNotFound);
	X  if (latex != NULL)
	X    latex = freopen(latex_NAME, "w", latex);
	X  else
	X    latex = fopen(latex_NAME, "w");
	X  if (latex == NULL)
	X    _EscIO(FileNotFound);
	X
	X  Convert_second_strike();
	X
	X  if (wpd != NULL)
	X    fclose(wpd);
	X  if (latex != NULL)
	X    fclose(latex);
	X
	X/*
	X** Delete auxillary files
	X*/
	X  if (strip != NULL)
	X    unlink(strip_fn);
	X  if (tabel != NULL)
	X    unlink(tabel_fn);
	X
	X  printf("\nConversion completed.\n");
	X  exit(0);
	X}
	X/* End. */
	X
	X/*
	X** Extras - hand coded 
	X*/
	X
	XStatic Void
	XRunError(errcode)
	Xint errcode;
	X{
	X	switch (errcode) {
	X		case 0x201:
	X			fprintf(stderr, "Not a WordPerfect 5.1 document !\n");
	X			break;
	X		case 0x200:
	X			fprintf(stderr, "No filename entered !\n");
	X			break;
	X		case 0x100:
	X			fprintf(stderr, "Program error.\n");
	X			break;
	X		case 0x03:
	X			fprintf(stderr, "Path not found.\n");
	X			break;
	X		case 0x02:
	X			fprintf(stderr, "File not found.\n");
	X			break;
	X	}
	X	exit(errcode);
	X}
SHAR_EOF
if test 53854 -ne "`wc -c < 'wp2latex.c'`"
then
	echo shar: "error transmitting 'wp2latex.c'" '(should have been 53854 characters)'
fi
fi
exit 0
#	End of shell archive
--
Glenn Geers                       | "So when it's over, we're back to people.
Department of Theoretical Physics |  Just to prove that human touch can have
The University of Sydney          |  no equal."
Sydney NSW 2006 Australia         |  - Basia Trzetrzelewska, 'Prime Time TV'

glenn@extro.ucc.su.oz.au (Glenn Geers) (08/08/90)

#! /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:
#	wp2latex.pas
# This archive created: Wed Aug  8 21:44:56 1990
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'wp2latex.pas'" '(49507 characters)'
if test -f 'wp2latex.pas'
then
	echo shar: "will not over-write existing file 'wp2latex.pas'"
else
sed 's/^	X//' << \SHAR_EOF > 'wp2latex.pas'
	XProgram WordPerfect_to_LaTeX;
	X
	X{           Version 1.0
	X            Date 27-1-1990
	X}
	X
	X{$R+}       { Range check error }
	X
	X
	XUses Crt;   { Clearscreen }
	X
	XType  Bin = file of byte;
	X
	XVar
	X   wpd_fn,
	X   strip_fn,
	X   tabel_fn,
	X   latex_fn  : String;
	X
	X   wpd,
	X   tabel : Bin;
	X   strip,
	X   latex : Text;
	X
	X   num_of_lines_stripfile : Word;
	X
	X   open_com,
	X   close_com : Array [$0..$10] of String;
	X
	X   Exitsave : pointer;
	X
	X
	XProcedure Rd_word(Var f:Bin; Var w:Word);
	X{ Deze procedure leest een woord uit de opgegeven binaire file. }
	X
	XVar
	X   b : Byte;
	X
	XBegin
	X   Read(f,b);
	X   w:=b;
	X   Read(f,b);
	X   w:=w+256*b
	XEnd;
	X
	X
	XProcedure Wr_word(Var f:Bin; w:Word);
	X{ Deze procedure schrijft een woord in de opgegeven binaire file. }
	X
	XVar
	X   b : Byte;
	X
	XBegin
	X   b:=w mod 256;
	X   Write(f,b);
	X   b:=w div 256;
	X   Write(f,b);
	XEnd;
	X
	X
	XProcedure Jump_in_file(Var f:Bin; dis:Longint);
	X{ Deze procedure springt in een binaire file het aantal opgegeven bytes. }
	X
	XVar
	X   cur_pos : Longint;
	X
	XBegin
	X   cur_pos := Filepos(f);
	X   Seek(f,cur_pos+dis);
	XEnd;
	X
	X
	X
	XProcedure Wpd_check;
	X{ Kontroleert of de opgegeven WP-document wel daadwerkelijk een   }
	X{ WP5.0-document is.                                              }
	X
	XVar id1,id2,std1,std2,filetype,dmp1,dmp2,dmp3 : Word;
	X    Startdoc, Pointer : Longint;
	X    b:Byte;
	X
	XBegin
	X   Rd_word(wpd,id1); Rd_word(wpd,id2);
	X   Rd_word(wpd,std1); Rd_word(wpd,std2);
	X   Rd_word(wpd,filetype);
	X   Rd_word(wpd,dmp1); Rd_word(wpd,dmp2); Rd_word(wpd,dmp3);
	X
	X   Startdoc:=std2*65536+std1;
	X
	X   If (id1=$57ff) and (id2=$4350) and
	X      (filetype=$0A01)  {and (dmp1=$0) and (dmp2=$0) and (dmp3=$0)}
	X
	X   Then Seek(wpd,startdoc)    { Het is een WP5.0-document}
	X   Else RunError($0201)       { Het is geen WP5.0-document}
	XEnd;
	X
	X
	X
	X
	XProcedure Filenames;
	X{ Deze procedure handelt het opgeven van de filenamen af. }
	X
	XVar
	X   name,
	X   invoer,
	X   wpdef,
	X   latdef,
	X   filename,
	X   ext           : String;
	X   l,p           : Integer;
	X
	XBegin
	X   If ParamCount<1
	X   Then wpdef:=''
	X   Else wpdef:=Paramstr(1);
	X
	X   Writeln;
	X   Writeln;
	X   Write('WordPerfect-filename [',wpdef,'] : ');
	X   Readln(invoer);
	X   If invoer=''
	X   Then wpd_fn:=wpdef
	X   Else wpd_fn:=invoer;
	X
	X   If wpd_fn=''                 { No filename entered }
	X   Then RunError($200);
	X
	X   name:=wpd_fn;
	X   l:=Length(name);
	X   p:=Pos('.',name);
	X   if p=0 then p:=l+1;
	X   filename:=copy(name,1,p-1);
	X
	X   strip_fn:=concat(filename,'.STR');
	X   tabel_fn:=concat(filename,'.TBL');
	X   latdef:=concat(filename,'.TEX');
	X
	X   Write('LaTeX-filename [',latdef,'] : ');
	X   Readln(invoer);
	X   Writeln;
	X   If invoer=''
	X   Then latex_fn:=latdef
	X   Else latex_fn:=invoer;
	X
	X   Assign(wpd,wpd_fn);
	X   Assign(strip,strip_fn);
	X   Assign(tabel,tabel_fn);
	X   Assign(latex,latex_fn);
	X
	XEnd;
	X
	X
	X{$F+}
	XProcedure Einde_prog;
	X{ Deze procedure wordt aan het einde van het programma aangeroepen. }
	X{ Er wordt gekeken of er zich Run-Time error heeft voor gedaan.     }
	X
	XVar
	X   save_ErrorAddr : Pointer;
	X
	XBegin
	X   Writeln;
	X
	X   ExitProc:=Exitsave;
	X   save_ErrorAddr := ErrorAddr;
	X   ErrorAddr := nil;
	X
	X   If save_ErrorAddr <> nil
	X   Then Case Exitcode of
	X               $0002 : Writeln('File not found.');
	X               $0003 : Writeln('Path not found.');
	X               $0100 : Writeln('Program Error.');
	X               $0200 : Writeln('No filename entered !');
	X               $0201 : Writeln('Not a WordPerfect 5.0 document !');
	X
	X             Else ErrorAddr := save_ErrorAddr;
	X        End
	X
	X   Else Begin
	X           Writeln('Conversion completed.');
	X           Writeln;
	X        End;
	X
	X   Writeln;
	XEnd;
	X{$F-}
	X
	X
	XProcedure Init_commando;
	XBegin
	X   Open_com[$0]:='{\LARGE ';
	X   Open_com[$1]:='{\Large ';
	X   Open_com[$2]:='{\large ';
	X   Open_com[$3]:='{\small ';
	X   Open_com[$4]:='{\footnotesize ';
	X   Open_com[$5]:='$^{\rm ';
	X   Open_com[$6]:='$_{\rm ';
	X   Open_com[$7]:='';
	X   Open_com[$8]:='{\it ';
	X   Open_com[$9]:='';
	X   Open_com[$A]:='';
	X   Open_com[$B]:='\underline{\Underline{';
	X   Open_com[$C]:='{\bf ';
	X   Open_com[$D]:='';
	X   Open_com[$E]:='\Underline{';
	X   Open_com[$F]:='{\sc ';
	X
	X   Close_com[$0]:='}';
	X   Close_com[$1]:='}';
	X   Close_com[$2]:='}';
	X   Close_com[$3]:='}';
	X   Close_com[$4]:='}';
	X   Close_com[$5]:='}$';
	X   Close_com[$6]:='}$';
	X   Close_com[$7]:='';
	X   Close_com[$8]:='\/}';
	X   Close_com[$9]:='';
	X   Close_com[$A]:='';
	X   Close_com[$B]:='}}';
	X   Close_com[$C]:='}';
	X   Close_com[$D]:='';
	X   Close_com[$E]:='}';
	X   Close_com[$F]:='}';
	XEnd;
	X
	X
	X{---SLAG1----}
	X
	XProcedure Convert_first_strike;
	X{ Dit is de komplete procedure van de eerste slag met zijn eigen proc.'s. }
	X
	XVar
	X   by  : Byte;
	X   wo,
	X   regelnum  : Word;
	X
	X   convperc,
	X   i     : Integer;
	X
	X   srtdocpos,
	X   fsize,
	X   fpos,
	X   nextdocpos : longint;
	X
	X   lat    : Array[$20..$7F] of String[25];
	X   char_set  : Array[$80..$FE] of Integer;
	X   char_code : Array[$80..$FE] of Integer;
	X   ext_lat   : Array[$80..$FE] of String[25];
	X
	X
	X   leegptr,
	X   openptr               : Array [0..1] of Integer;
	X   attr_rij              : Array [0..1,0..16] of Byte;
	X   open_attr_rij         : Array [0..1] of Boolean;
	X   depth                 : Integer;
	X
	X   envir,
	X   line_term      : Char;
	X
	X   char_on_line,
	X   nomore_valid_tabs,
	X   indenting,
	X   indent_end,
	X   ind_text1,
	X   ind_text2  : Boolean;
	X
	X   ind_leftmargin,
	X   ind_rightmargin : Word;
	X
	X   num_of_tabs,
	X   latex_tabpos : Integer;
	X   tabpos       : Array [1..40] of Word;
	X   right_tab,
	X   align_tab,
	X   center_tab   : Boolean;
	X
	X   WP_sidemargin  : Integer;
	X
	X
	X
	X
	XProcedure WP_Default;
	XVar
	X   j : Integer;
	X
	XBegin
	X   WP_sidemargin := 1200;
	X
	X   tabpos[1]:=$02c5;                      { 1e WP-tab is kantlijn --> }
	X   For j:=2 to 10
	X   Do tabpos[j]:=tabpos[j-1]+$02c5;       { Volgende tabs 1,5  cm     }
	X   For j:=11 to 40                        { ($02c5 wpu) verder        }
	X   Do tabpos[j]:=$FFFF;
	X
	X   num_of_tabs:=10;
	XEnd;
	X
	X
	XProcedure Table_Init;
	XBegin
	X   lat[$20]:=' ';                        {Space}
	X   lat[$21]:='!';                        {!}
	X   lat[$22]:='"';                        {"}
	X   lat[$23]:='\#';                       {#}
	X   lat[$24]:='\$';                       {dollar}
	X   lat[$25]:='\%';                       {%}
	X   lat[$26]:='\&';                       {&}
	X   lat[$27]:='''';                        {'}
	X   lat[$28]:='(';                        {(}
	X   lat[$29]:=')';                        {)}
	X   lat[$2A]:='*';                        {*}
	X   lat[$2B]:='+';                        {+}
	X   lat[$2C]:=',';                        {,}
	X   lat[$2D]:='-';                        {-}
	X   lat[$2E]:='.';                        {.}
	X   lat[$2F]:='/';                        {/}
	X   lat[$30]:='0';                        {0}
	X   lat[$31]:='1';                        {1}
	X   lat[$32]:='2';                        {2}
	X   lat[$33]:='3';                        {3}
	X   lat[$34]:='4';                        {4}
	X   lat[$35]:='5';                        {5}
	X   lat[$36]:='6';                        {6}
	X   lat[$37]:='7';                        {7}
	X   lat[$38]:='8';                        {8}
	X   lat[$39]:='9';                        {9}
	X   lat[$3A]:=':';                        {:}
	X   lat[$3B]:=';';                        {;}
	X   lat[$3C]:='$<$';                      {<}
	X   lat[$3D]:='=';                        {=}
	X   lat[$3E]:='$>$';                      {>}
	X   lat[$3F]:='?';                        {?}
	X   lat[$40]:='@';                        {@}
	X   lat[$41]:='A';                        {A}
	X   lat[$42]:='B';                        {B}
	X   lat[$43]:='C';                        {C}
	X   lat[$44]:='D';                        {D}
	X   lat[$45]:='E';                        {E}
	X   lat[$46]:='F';                        {F}
	X   lat[$47]:='G';                        {G}
	X   lat[$48]:='H';                        {H}
	X   lat[$49]:='I';                        {I}
	X   lat[$4A]:='J';                        {J}
	X   lat[$4B]:='K';                        {K}
	X   lat[$4C]:='L';                        {L}
	X   lat[$4D]:='M';                        {M}
	X   lat[$4E]:='N';                        {N}
	X   lat[$4F]:='O';                        {O}
	X   lat[$50]:='P';                        {P}
	X   lat[$51]:='Q';                        {Q}
	X   lat[$52]:='R';                        {R}
	X   lat[$53]:='S';                        {S}
	X   lat[$54]:='T';                        {T}
	X   lat[$55]:='U';                        {U}
	X   lat[$56]:='V';                        {V}
	X   lat[$57]:='W';                        {W}
	X   lat[$58]:='X';                        {X}
	X   lat[$59]:='Y';                        {Y}
	X   lat[$5A]:='Z';                        {Z}
	X   lat[$5B]:='[';                        {[}
	X   lat[$5C]:='$\tt\backslash$';          {\}
	X   lat[$5D]:=']';                        {]}
	X   lat[$5E]:='\^{';                      {^}
	X   lat[$5F]:='\_';                       {_}
	X   lat[$60]:='`';                        {`}
	X   lat[$61]:='a';                        {a}
	X   lat[$62]:='b';                        {b}
	X   lat[$63]:='c';                        {c}
	X   lat[$64]:='d';                        {d}
	X   lat[$65]:='e';                        {e}
	X   lat[$66]:='f';                        {f}
	X   lat[$67]:='g';                        {g}
	X   lat[$68]:='h';                        {h}
	X   lat[$69]:='i';                        {i}
	X   lat[$6A]:='j';                        {j}
	X   lat[$6B]:='k';                        {k}
	X   lat[$6C]:='l';                        {l}
	X   lat[$6D]:='m';                        {m}
	X   lat[$6E]:='n';                        {n}
	X   lat[$6F]:='o';                        {o}
	X   lat[$70]:='p';                        {p}
	X   lat[$71]:='q';                        {q}
	X   lat[$72]:='r';                        {r}
	X   lat[$73]:='s';                        {s}
	X   lat[$74]:='t';                        {t}
	X   lat[$75]:='u';                        {u}
	X   lat[$76]:='v';                        {v}
	X   lat[$77]:='w';                        {w}
	X   lat[$78]:='x';                        {x}
	X   lat[$79]:='y';                        {y}
	X   lat[$7A]:='z';                        {z}
	X   lat[$7B]:='\{';                       {{}
	X   lat[$7C]:='$|$';                      {|}
	X   lat[$7D]:='\}';                       { }
	X   lat[$7E]:='\tidle{';                  {~}
	X   lat[$7F]:=' ';                        {Don't exsist}
	XEnd;
	X
	X
	XProcedure Ext_chr_init;
	XBegin
	X   char_set[$80]:=$01;  char_code[$80]:=$26;  ext_lat[$80]:='\c{C}';
	X   char_set[$81]:=$01;  char_code[$81]:=$47;  ext_lat[$81]:='\"{u}';
	X   char_set[$82]:=$01;  char_code[$82]:=$29;  ext_lat[$82]:='\''{e}';
	X   char_set[$83]:=$01;  char_code[$83]:=$1D;  ext_lat[$83]:='\^{a}';
	X   char_set[$84]:=$01;  char_code[$84]:=$1F;  ext_lat[$84]:='\"{a}';
	X   char_set[$85]:=$01;  char_code[$85]:=$21;  ext_lat[$85]:='\`{a}';
	X   char_set[$86]:=$01;  char_code[$86]:=$23;  ext_lat[$86]:='\aa ';
	X   char_set[$87]:=$01;  char_code[$87]:=$27;  ext_lat[$87]:='\c{c}';
	X   char_set[$88]:=$01;  char_code[$88]:=$2B;  ext_lat[$88]:='\^{e}';
	X   char_set[$89]:=$01;  char_code[$89]:=$2D;  ext_lat[$89]:='\"{e}';
	X   char_set[$8A]:=$01;  char_code[$8A]:=$2F;  ext_lat[$8A]:='\`{e}';
	X   char_set[$8B]:=$01;  char_code[$8B]:=$35;  ext_lat[$8B]:='\"{\i}';
	X   char_set[$8C]:=$01;  char_code[$8C]:=$33;  ext_lat[$8C]:='\^{\i}';
	X   char_set[$8D]:=$01;  char_code[$8D]:=$37;  ext_lat[$8D]:='\`{\i}';
	X   char_set[$8E]:=$01;  char_code[$8E]:=$1E;  ext_lat[$8E]:='\"{A}';
	X   char_set[$8F]:=$01;  char_code[$8F]:=$22;  ext_lat[$8F]:='\AA ';
	X   char_set[$90]:=$01;  char_code[$90]:=$28;  ext_lat[$90]:='\''{E}';
	X   char_set[$91]:=$01;  char_code[$91]:=$25;  ext_lat[$91]:='\ae ';
	X   char_set[$92]:=$01;  char_code[$92]:=$24;  ext_lat[$92]:='\AE ';
	X   char_set[$93]:=$01;  char_code[$93]:=$3D;  ext_lat[$93]:='\^{o}';
	X   char_set[$94]:=$01;  char_code[$94]:=$3F;  ext_lat[$94]:='\"{o}';
	X   char_set[$95]:=$01;  char_code[$95]:=$41;  ext_lat[$95]:='\`{o}';
	X   char_set[$96]:=$01;  char_code[$96]:=$45;  ext_lat[$96]:='\^{u}';
	X   char_set[$97]:=$01;  char_code[$97]:=$49;  ext_lat[$97]:='\`{u}';
	X   char_set[$98]:=$01;  char_code[$98]:=$8B;  ext_lat[$98]:='\"{y}';
	X   char_set[$99]:=$01;  char_code[$99]:=$3E;  ext_lat[$99]:='\"{O}';
	X   char_set[$9A]:=$01;  char_code[$9A]:=$46;  ext_lat[$9A]:='\"{U}';
	X   char_set[$9B]:=$04;  char_code[$9B]:=$13;  ext_lat[$9B]:='\ ';
	X   char_set[$9C]:=$04;  char_code[$9C]:=$0B;  ext_lat[$9C]:='\pounds ';
	X   char_set[$9D]:=$04;  char_code[$9D]:=$0C;  ext_lat[$9D]:='\ ';
	X   char_set[$9E]:=$04;  char_code[$9E]:=$0D;  ext_lat[$9E]:='\ ';
	X   char_set[$9F]:=$04;  char_code[$9F]:=$0E;  ext_lat[$9F]:='{\it f}\/';
	X   char_set[$A0]:=$01;  char_code[$A0]:=$1B;  ext_lat[$A0]:='\''{a}';
	X   char_set[$A1]:=$01;  char_code[$A1]:=$31;  ext_lat[$A1]:='\''{\i}';
	X   char_set[$A2]:=$01;  char_code[$A2]:=$3B;  ext_lat[$A2]:='\''{o}';
	X   char_set[$A3]:=$01;  char_code[$A3]:=$43;  ext_lat[$A3]:='\''{u}';
	X   char_set[$A4]:=$01;  char_code[$A4]:=$39;  ext_lat[$A4]:='\~{n}';
	X   char_set[$A5]:=$01;  char_code[$A5]:=$38;  ext_lat[$A5]:='\~{N}';
	X   char_set[$A6]:=$04;  char_code[$A6]:=$0F;  ext_lat[$A6]:='\astrike ';
	X   char_set[$A7]:=$04;  char_code[$A7]:=$10;  ext_lat[$A7]:='\ostrike ';
	X   char_set[$A8]:=$04;  char_code[$A8]:=$08;  ext_lat[$A8]:='?`';
	X   char_set[$A9]:=$05;  char_code[$A9]:=$10;  ext_lat[$A9]:='~';
	X   char_set[$AA]:=$06;  char_code[$AA]:=$14;  ext_lat[$AA]:='~';
	X   char_set[$AB]:=$04;  char_code[$AB]:=$11;  ext_lat[$AB]:='$\frac{1}{2}$';
	X   char_set[$AC]:=$04;  char_code[$AC]:=$12;  ext_lat[$AC]:='$\frac{1}{4}$';
	X   char_set[$AD]:=$04;  char_code[$AD]:=$07;  ext_lat[$AD]:='!`';
	X   char_set[$AE]:=$04;  char_code[$AE]:=$09;  ext_lat[$AE]:='$\ll$';
	X   char_set[$AF]:=$04;  char_code[$AF]:=$0A;  ext_lat[$AF]:='$\gg$';
	X   char_set[$E0]:=$08;  char_code[$E0]:=$01;  ext_lat[$E0]:='$\alpha$';
	X   char_set[$E1]:=$01;  char_code[$E1]:=$17;  ext_lat[$E1]:='$\beta$';
	X   char_set[$E2]:=$08;  char_code[$E2]:=$06;  ext_lat[$E2]:='$\Gamma$';
	X   char_set[$E3]:=$08;  char_code[$E3]:=$21;  ext_lat[$E3]:='$\pi$';
	X   char_set[$E4]:=$08;  char_code[$E4]:=$24;  ext_lat[$E4]:='$\Sigma$';
	X   char_set[$E5]:=$08;  char_code[$E5]:=$25;  ext_lat[$E5]:='$\sigma$';
	X   char_set[$E6]:=$08;  char_code[$E6]:=$19;  ext_lat[$E6]:='$\mu$';
	X   char_set[$E7]:=$08;  char_code[$E7]:=$29;  ext_lat[$E7]:='$\tau$';
	X   char_set[$E8]:=$08;  char_code[$E8]:=$2C;  ext_lat[$E8]:='$\Phi$';
	X   char_set[$E9]:=$08;  char_code[$E9]:=$10;  ext_lat[$E9]:='$\theta$';
	X   char_set[$EA]:=$08;  char_code[$EA]:=$32;  ext_lat[$EA]:='$\Omega$';
	X   char_set[$EB]:=$08;  char_code[$EB]:=$09;  ext_lat[$EB]:='$\delta$';
	X   char_set[$EC]:=$06;  char_code[$EC]:=$13;  ext_lat[$EC]:='$\infty$';
	X   char_set[$ED]:=$08;  char_code[$ED]:=$2D;  ext_lat[$ED]:='$\emptyset$';
	X   char_set[$EE]:=$08;  char_code[$EE]:=$0B;  ext_lat[$EE]:='$\epsilon$';
	X   char_set[$EF]:=$06;  char_code[$EF]:=$10;  ext_lat[$EF]:='$\cap$';
	X   char_set[$F0]:=$06;  char_code[$F0]:=$0E;  ext_lat[$F0]:='$\equiv$';
	X   char_set[$F1]:=$06;  char_code[$F1]:=$01;  ext_lat[$F1]:='$\pm$';
	X   char_set[$F2]:=$06;  char_code[$F2]:=$03;  ext_lat[$F2]:='$\geq$';
	X   char_set[$F3]:=$06;  char_code[$F3]:=$02;  ext_lat[$F3]:='$\leq$';
	X   char_set[$F4]:=$07;  char_code[$F4]:=$00;  ext_lat[$F4]:='~';
	X   char_set[$F5]:=$07;  char_code[$F5]:=$01;  ext_lat[$F5]:='~';
	X   char_set[$F6]:=$06;  char_code[$F6]:=$08;  ext_lat[$F6]:='$\div$';
	X   char_set[$F7]:=$06;  char_code[$F7]:=$0D;  ext_lat[$F7]:='$\approx$';
	X   char_set[$F8]:=$06;  char_code[$F8]:=$24;  ext_lat[$F8]:='\degrees ';
	X   char_set[$F9]:=$06;  char_code[$F9]:=$1F;  ext_lat[$F9]:='~';
	X   char_set[$FA]:=$06;  char_code[$FA]:=$20;  ext_lat[$FA]:='~';
	X   char_set[$FB]:=$07;  char_code[$FB]:=$04;  ext_lat[$FB]:='$\surd$';
	X   char_set[$FC]:=$04;  char_code[$FC]:=$15;  ext_lat[$FC]:='$^{n}$';
	X   char_set[$FD]:=$04;  char_code[$FD]:=$14;  ext_lat[$FD]:='$^{2}$';
	X   char_set[$FE]:=$04;  char_code[$FE]:=$02;  ext_lat[$FE]:='~';
	XEnd;
	X
	X
	XProcedure Make_tabelentry_attr;
	XVar
	X   b,
	X   num_of_attr : Byte;
	X   j : Integer;
	X
	XBegin
	X   num_of_attr := openptr[depth];
	X   Write(tabel,num_of_attr);
	X
	X   For j:=1 to num_of_attr
	X   Do Write(tabel,attr_rij[depth,j]);
	X
	XEnd;
	X
	X
	X
	XProcedure Make_tabelentry_tabset;
	XVar
	X   b : Byte;
	X   j : Integer;
	X
	XBegin
	X   b := ord('S');
	X   Write(tabel,b);
	X
	X   b:=num_of_tabs;
	X   Write(tabel,b);
	X
	X   For j:=1 to num_of_tabs
	X   Do Wr_word(tabel,tabpos[j]);
	XEnd;
	X
	X
	XProcedure Make_tabelentry_rightjustification;
	XVar
	X   b : Byte;
	X
	XBegin
	X   b := Ord('U');
	X   Write(tabel,b);
	X
	X   If by=$81
	X   Then b:=01                            { regels WEL uitvullen }
	X   Else b:=00;                           { regels NIET uitvullen }
	X   Write(tabel,b);
	XEnd;
	X
	X
	X
	X
	XProcedure Make_tabelentry_envir_extra_end;
	XVar
	X   b : Byte;
	X
	XBegin
	X
	X   Case envir of
	X      'C' : Begin
	X               b:=ord('C');
	X               Write(tabel,b);
	X            End;
	X
	X      'T' : Begin
	X               b:=ord('T');
	X               Write(tabel,b);
	X            End;
	X
	X      'I' : Begin
	X               b:=ord('I');
	X               Write(tabel,b);
	X               Wr_word(tabel,ind_leftmargin);
	X               Wr_word(tabel,ind_rightmargin);
	X
	X               If ind_text2
	X               Then Begin
	X                       b:=01;
	X                       Write(tabel,b)
	X                    End
	X               Else Begin
	X                       b:=00;
	X                       Write(tabel,b)
	X                    End;
	X
	X            End;
	X
	X   End;  {Case}
	X
	X   b := Ord(line_term);
	X   write(tabel,b);
	X
	X   b:=$FF;
	X   Write(tabel,b);
	X
	XEnd;
	X
	X
	XProcedure Reset_attr_rij(d : Integer);
	XVar
	X   j : Integer;
	X
	XBegin
	X   For j:=0 to 16
	X   Do attr_rij[d,j]:=$00;
	X   leegptr[d]:=1;
	X   openptr[d]:=0;
	XEnd;
	X
	X
	X
	XProcedure Open_all_attr;
	X{ -- Open alle commando's door de Attributen-rij af te lopen -- }
	X
	XVar j:Integer;
	XBegin
	X  For j:=(openptr[depth]+1) to (leegptr[depth]-1)
	X  Do Begin
	X         Write(strip,Open_com[attr_rij[depth,j]]);
	X         openptr[depth]:=openptr[depth]+1;
	X      End;
	X
	X  open_attr_rij[depth]:=False            { Alle attributen staan weer goed }
	XEnd;
	X
	X
	X
	XProcedure Close_all_attr;
	X{ -- Sluit alle commando's door de Attributen-rij af te lopen -- }
	XVar j:Integer;
	XBegin
	X  For j:=openptr[depth] Downto 1
	X  Do Begin
	X        Write(strip,Close_com[attr_rij[depth,j]]);
	X        openptr[depth]:=openptr[depth]-1;
	X     End;
	X  open_attr_rij[depth] := True;
	XEnd;
	X
	X
	X
	XProcedure Attr_ON;
	X{ Deze procedure plaatst een attribuut (lettertype) in de attribuut-rij }
	X
	XVar
	X   b : Byte;
	X
	XBegin
	X   Read(wpd,b);                             { lees attribuut-code }
	X
	X   attr_rij[depth,leegptr[depth]]:=b;       { attribuut in attr-rij }
	X   leegptr[depth]:=leegptr[depth]+1;        { plaats 1 verder. }
	X   open_attr_rij[depth]:=True;              { openstaande attr-rij }
	X
	X   Read(wpd,b);                             { lees voorbij afsluitcode }
	XEnd;
	X
	X
	X
	XProcedure Attr_OFF;
	X{ Deze procedure haalt een uit een attribuut (lettertype) uit de }
	X{ attribuut-rij door middel van een stack principe omdat binnen  }
	X{ LaTeX de later geopende kommando's eerst afgesloten te worden  }
	X
	XVar
	X   b       : Byte;
	X   found   : Boolean;
	X   j,
	X   codeptr : Integer;
	X
	XBegin
	X   Read(wpd,b);                             { lees attribuut-code }
	X
	X   j:=leegptr[depth];                       { zoek vanaf top attr-rij }
	X   found:=False;                            { nog niet gevonden }
	X
	X   While (j>1) and (Not found)              { zoek attr-code in attr-rij }
	X   Do Begin
	X        j:=j-1;
	X        found:=(attr_rij[depth,j]=b)
	X      End;
	X
	X   If j<=0 Then RunError($0100);            { Moet nooit kunnen voorkomen }
	X   codeptr:=j;                              { plaats van attr-code in rij }
	X
	X{ Sluit alle commando's t/m de desbetreffende code als deze nog niet }
	X{ gesloten zijn.                                                     }
	X
	X   If codeptr<=openptr[depth]
	X   Then Begin
	X           For j:=openptr[depth] downto codeptr
	X           Do Begin
	X                 Write(strip,Close_com[attr_rij[depth,j]]);
	X                 openptr[depth]:=openptr[depth]-1;
	X              End;
	X        End;
	X
	X{ Haal de desbetreffende attribuut uit de rij en werk pointers bij }
	X
	X   For j:=codeptr to (leegptr[depth]-1)
	X   Do attr_rij[depth,j]:=attr_rij[depth,j+1];
	X   leegptr[depth]:=leegptr[depth]-1;
	X
	X   open_attr_rij[depth]:=True;                { openstaande attr-rij }
	X
	X   Read(wpd,b);                               { lees voorbij afsluitcode }
	XEnd;
	X
	X
	X
	XProcedure Center;
	X{ Deze procedure zorgt voor center environment zolang er nog geen }
	X{ andere environment is begonnen.                                 }
	X
	XBegin
	X   If envir=' '
	X   Then envir:='C';                    { environment = center }
	X
	X   Jump_in_file(wpd,7);                { rest van code overslaan }
	XEnd;
	X
	X
	X
	XProcedure End_Align;
	XBegin
	X   If align_tab
	X   Then Begin
	X           Close_all_attr;
	X           Write(strip,'\''');
	X           align_tab := False;
	X           Open_all_attr;
	X        End;
	X
	X   If right_tab
	X   Then Begin
	X           Close_all_attr;
	X           Write(strip,'\''');
	X           right_tab := False;
	X           Open_all_attr;
	X        End;
	X
	X   If center_tab
	X   Then Begin
	X           Close_all_attr;
	X           Write(strip,'}');
	X           center_tab := False;
	X           Open_all_attr;
	X        End;
	XEnd;
	X
	X
	X
	XProcedure Tab;
	XVar
	X   j : integer;
	X   wpu : word;
	X   tabnum,
	X   new_tabs : Integer;
	X
	XBegin
	X   If (envir<>'I') and Not Nomore_valid_tabs      { Noggeen indent --> normaal tab }
	X   Then Begin
	X           If by=$48
	X           Then right_tab := True;
	X
	X           If by=$40
	X           Then align_tab := True;
	X
	X           If by=$C8
	X           Then center_tab := True;
	X
	X           Jump_in_file(wpd,2);
	X
	X           Rd_word(wpd,wpu);                       { Lees abs.-indent [wpu] }
	X           wpu := wpu - WP_sidemargin;             { Correctie ivm WP kantlijn }
	X
	X           tabnum:=0;
	X           For j:=1 to num_of_tabs                 { Bepaal welke tabpos }
	X           Do If wpu>=tabpos[j]
	X              Then tabnum:=j;
	X
	X           new_tabs := tabnum - latex_tabpos;
	X
	X           If new_tabs>0
	X           Then Begin
	X                   Close_all_attr;
	X
	X                   For j:=1 to new_tabs
	X                   Do Write(strip,'\>');
	X
	X                   If center_tab
	X                   Then Write(strip,'\ctab{');
	X
	X                   Open_all_attr;
	X                End;
	X
	X           latex_tabpos:=tabnum;
	X
	X           Jump_in_file(wpd,3);
	X
	X           envir:='T';                              { Er zit een tab in deze regel }
	X        End
	X
	X   Else Jump_in_file(wpd,7);
	X
	XEnd;
	X
	X
	X
	XProcedure Flush_right_tab;
	XBegin
	X   If envir<>'I'
	X   Then Begin
	X           Close_all_attr;
	X           Write(strip,'\`');
	X           Open_all_attr;
	X
	X           Nomore_valid_tabs := True;
	X
	X           envir:='T';
	X        End;
	X
	X   Jump_in_file(wpd,7);
	XEnd;
	X
	X
	X
	XProcedure Indent;
	XVar
	X   dif,
	X   abs        : Word;
	X   b          : Byte;
	X
	XBegin
	X   If envir<>'T'
	X   Then Begin       {Al een tabcommando gezet dus er mag geen insp }
	X           Envir:='I';
	X           indenting:=True;
	X
	X           If Not ind_text2
	X           Then Begin
	X                   Read(wpd,b);
	X                   b:=b And $01;
	X
	X                   Rd_word(wpd,dif);
	X                   Rd_word(wpd,abs); { Eigenlijk Old current column }
	X                   Rd_word(wpd,abs);
	X
	X                   ind_leftmargin:=abs-WP_sidemargin;
	X
	X                   If b=1
	X                   Then ind_rightmargin:=ind_rightmargin+dif;
	X                   {Margins bepaald lees voorby rest van functie-codes }
	X                   Jump_in_file(wpd,3);
	X
	X                   If Not ind_text1
	X                   Then Begin
	X                           If char_on_line
	X                           Then Begin
	X                                   Write(strip,'}');
	X                                   ind_text1:=True;
	X                                End;
	X                         End;
	X                 End
	X           Else Jump_in_file(wpd,10);
	X        End
	X   Else Jump_in_file(wpd,10);
	XEnd;
	X
	X
	XProcedure End_of_indent;
	XBegin
	X   indent_end := True;
	X   Jump_in_file(wpd,5);
	XEnd;
	X
	X
	X
	XProcedure Tabset;
	XVar
	X   j           : Integer;
	X   w           : Word;
	X   b           : Byte;
	X
	XBegin
	X   Jump_in_file(wpd,102);        { Ga naar TAB-info }
	X
	X   num_of_tabs:=0;
	X
	X   For j:=1 to 40
	X   Do Begin
	X         Rd_word(wpd,w);
	X         If (w>WP_sidemargin) and (w<>$FFFF)
	X         Then Begin
	X                 num_of_tabs:=num_of_tabs+1;
	X                 tabpos[num_of_tabs] := w - WP_sidemargin;
	X              End;
	X      End;
	X
	X   Jump_in_file(wpd,24);
	X
	X   Make_tabelentry_tabset;
	XEnd;
	X
	X
	X
	XProcedure Page_number_position;
	XVar
	X   position_code : Byte;
	X
	XBegin
	X   Jump_in_file(wpd,5);            {Skip length of code; always 10}
	X                                   { + old information }
	X   Read(wpd,position_code);
	X
	X   Write(strip,'\pagenumpos');
	X   Case position_code of
	X     $01 : Write(strip,'{\pntl}');
	X     $02 : Write(strip,'{\pntc}');
	X     $03 : Write(strip,'{\pntr}');
	X     $05 : Write(strip,'{\pnbl}');
	X     $06 : Write(strip,'{\pnbc}');
	X     $07 : Write(strip,'{\pnbr}');
	X     Else  Write(strip,'{\pnno}');
	X   End;
	X
	X   Jump_in_file(wpd,6);
	XEnd;
	X
	X 
	X
	XProcedure Character;
	XVar
	X   ch          : String;
	X
	X   j           : Integer;
	X   chr_code,
	X   chr_set,
	X   b           : Byte;
	X   found       : Boolean;
	X
	X
	XBegin
	X   If open_attr_rij[depth]
	X   Then Open_all_attr;
	X
	X   Case by of
	X      $20..$7F : { Normal_char  }
	X                 Begin
	X                    ch := lat[by];
	X                 End;
	X
	X      $A9      : { Special_char }
	X                 Begin
	X                    If by=$A9
	X                    Then ch:='-'
	X                    Else ch:='\ ';
	X                 End;
	X
	X      $C0      : { Extended_char }
	X                 Begin
	X                    j:=127;
	X                    found:=false;
	X
	X                    Read(wpd,chr_code);
	X                    Read(wpd,chr_set);
	X
	X                    While (j<254) and not found
	X                    Do Begin
	X                          j:=j+1;
	X                          If (chr_code=char_code[j]) and (chr_set=char_set[j])
	X                          Then found:=True;
	X                       End;
	X
	X                    If found
	X                    Then ch:=ext_lat[j]
	X                    Else ch:='\ ';
	X
	X                    Read(wpd,b);
	X                 End;
	X
	X      End;
	X
	X   Write(strip,ch);
	X
	XEnd;
	X
	X
	X
	XProcedure Return_Page;
	XVar
	X   j :Integer;
	X   ond : Boolean;
	X
	XBegin
	X
	X   Case by of
	X    $0A,$8C : line_term := 'R';     { Hard return }
	X      $0D   : line_term := 'r';     { Soft return }
	X      $0C   : line_term := 'P';     { Hard page }
	X      $0B   : line_term := 'p';     { Soft page }
	X   End;
	X
	X   Writeln(strip);
	X
	X   Make_Tabelentry_envir_extra_end;
	X
	X   If indent_end
	X   Then Begin
	X           envir:=' ';
	X           indenting:=False;
	X           ind_text1:=False;
	X           ind_text2:=False;
	X           ind_leftmargin:=0;
	X           ind_rightmargin:=0;
	X
	X           indent_end:=False;
	X        End
	X
	X   Else If envir<>'I'
	X        Then envir:=' ';
	X
	X   char_on_line:=False;
	X   nomore_valid_tabs := False;
	X
	X   regelnum:=regelnum+1;
	X
	X   Make_tabelentry_attr;
	X
	X   latex_tabpos:=0;
	XEnd;
	X
	X
	XProcedure Nop80;
	XBegin
	X   { Om dat het een 1-byte funktie is hoeft er niks overgeslagen }
	X   { te worden.                                                  }
	XEnd;
	X
	X
	X
	XProcedure NopC0;
	XBegin
	X   If by=$C0 Then Jump_in_file(wpd,3);
	X   If by=$C1 Then Jump_in_file(wpd,8);
	X   If by=$C2 Then Jump_in_file(wpd,10);
	X   If by=$C3 Then Jump_in_file(wpd,2);
	X   If by=$C4 Then Jump_in_file(wpd,2);
	X   If by=$C5 Then Jump_in_file(wpd,4);
	X   If by=$C6 Then Jump_in_file(wpd,5);
	X   If by=$C7 Then Jump_in_file(wpd,6);
	XEnd;
	X
	X
	X
	XProcedure NopD0(already_read_subfunc_code : Boolean);
	XVar
	X   b : Byte;
	X   w : Word;
	X
	XBegin
	X   If Not already_read_subfunc_code
	X   Then Read(wpd,b);      { Lees subfunctioncode }
	X
	X   Rd_word(wpd,w);       { Lees lengte 'die nog volgt ' }
	X   Seek(wpd,filepos(wpd)+w);
	XEnd;
	X
	X
	X
	XProcedure Overstrike;
	X
	XVar
	X   first_char_os    : Boolean;
	X
	X   char_width_os,
	X   len_of_code      : Word;
	X   end_of_code      : LongInt;
	X
	XBegin
	X   Rd_word(wpd,len_of_code);             { Lees lengte }
	X   end_of_code := filepos(wpd) + len_of_code - 4;
	X
	X   Rd_word(wpd,char_width_os);
	X
	X   first_char_os := True;
	X
	X   While FilePos(wpd) < end_of_code
	X   Do Begin
	X         Read(wpd,by);
	X
	X         Case by of
	X           $20..$7F,
	X           $A9,$C0  : If first_char_os
	X                      Then Begin
	X                              Character;
	X                              first_char_os := False;
	X                           End
	X                      Else Begin
	X                              Write(strip,'\llap{');
	X                              Character;
	X                              Write(strip,'}');
	X                           End;
	X
	X           $00..$BF : Nop80;
	X           $C0..$CF : NopC0;
	X           $D0..$FE : NopD0(False);
	X         End;
	X
	X      End;
	X
	X   Jump_in_file(wpd,4);
	X
	XEnd;
	X
	X
	X
	XProcedure Footnote;
	XVar
	X   flags,
	X   num_of_pages     : Byte;
	X
	X   fn_num,
	X   len_of_code      : Word;
	X   end_of_code      : LongInt;
	X
	XBegin
	X   Rd_word(wpd,len_of_code);             { Lees lengte }
	X   end_of_code := filepos(wpd) + len_of_code - 4;
	X
	X   Read(wpd,flags);
	X
	X   Rd_word(wpd,fn_num);
	X
	X{ Skip all the shit }
	X
	X   Read(wpd,num_of_pages);
	X   Jump_in_file(wpd,2*(num_of_pages+1)+9);
	X
	X   Close_all_attr;
	X
	X   depth := 1;
	X   Reset_attr_rij(depth);
	X
	X   Write(strip,'\footnote[',fn_num:1,']{');
	X
	X   While FilePos(wpd) < end_of_code
	X   Do Begin
	X         Read(wpd,by);
	X
	X         Case by of
	X           $20..$7F,
	X           $A9,$C0  : Character;
	X
	X           $0A,$0C  : Write(strip,'\\ ');
	X
	X           $0B,$0D  : Write(strip,' ');
	X
	X            $C3     : Attr_ON;
	X
	X            $C4     : Attr_OFF;
	X
	X           $00..$BF : Nop80;
	X           $C0..$CF : NopC0;
	X           $D0..$FE : NopD0(False);
	X         End;
	X
	X      End;
	X
	X   Close_all_attr;      { Echt nodig ? }
	X   Write(strip,'}');
	X
	X   Jump_in_file(wpd,4);
	X
	X   depth := 0;
	X   Open_all_attr;
	X
	XEnd;
	X
	X
	X
	XProcedure Header_Footer;
	XVar
	X   subfunc,
	X   occurance : Byte;
	X   len_of_code : Word;
	X   end_of_code : LongInt;
	X
	X   hf_left,
	X   hf_center,
	X   hf_right  : Boolean;
	X
	X   j : Integer;
	X
	XBegin
	X   Read(wpd,subfunc);
	X   Rd_word(wpd,len_of_code);
	X
	X   If len_of_code > 22
	X   Then Begin
	X           end_of_code := FilePos(wpd) + len_of_code - 4;
	X
	X           Jump_in_file(wpd,7);
	X
	X           Read(wpd,occurance);
	X
	X           Jump_in_file(wpd,10);
	X
	X           Close_all_attr;
	X           depth := 1;
	X
	X{ Geen schone attr._lei; Kopieer attributen uit Niveau 0;  Fout in WP 5.0 ? }
	X
	X           For j:=0 to 15
	X           Do attr_rij[1,j] := attr_rij[0,j];
	X
	X           leegptr[1]:=leegptr[0];
	X           openptr[1]:=openptr[0];
	X
	X           Case subfunc of
	X             00,01 : Write(strip,'\headtext');
	X             02,03 : Write(strip,'\foottext');
	X           End;
	X
	X           Case occurance of
	X             00 : Write(strip,'{\neverpages}{');
	X             01 : Write(strip,'{\allpages}{');
	X             02 : Write(strip,'{\oddpages}{');
	X             03 : Write(strip,'{\evenpages}{');
	X           End;
	X
	X           Open_all_attr;
	X           hf_left   := True;           { Beginnen met de linkerkant }
	X           hf_center := False;
	X           hf_right  := False;
	X
	X           While FilePos(wpd) < end_of_code
	X           Do Begin
	X                 Read(wpd,by);
	X
	X                 Case by of
	X                   $20..$7F,
	X                   $A9,$C0  : Character;
	X
	X
	X                     $C1    : Begin
	X                                 Read(wpd,by);
	X                                 by := by and $E0;
	X                                 Jump_in_file(wpd,7);
	X
	X                                 If by=$E0
	X                                 Then Begin
	X                                         If hf_left
	X                                         Then Begin
	X                                                 Close_all_attr;
	X                                                 Write(strip,'}{');
	X                                                 Open_all_attr;
	X
	X                                                 hf_left   := False;
	X                                                 hf_center := True;
	X                                              End;
	X                                      End;
	X
	X                                 If by=$60
	X                                 Then Begin
	X                                         If hf_left
	X                                         Then Begin
	X                                                 Close_all_attr;
	X                                                 Write(strip,'}{}{');
	X                                                 Open_all_attr;
	X
	X                                                 hf_left  := False;
	X                                                 hf_right := True;
	X                                              End;
	X
	X                                         If hf_center
	X                                         Then Begin
	X                                                 Close_all_attr;
	X                                                 Write(strip,'}{');
	X                                                 Open_all_attr;
	X
	X                                                 hf_center := False;
	X                                                 hf_right  := True;
	X                                              End;
	X                                      End;
	X                              End;
	X
	X                     $C3    : Attr_ON;
	X
	X                     $C4    : Attr_OFF;
	X
	X                   $00..$BF : Nop80;
	X                   $C0..$CF : NopC0;
	X                   $D0..$FE : NopD0(False);
	X
	X                 End;
	X              End;
	X
	X           Close_all_attr;      { Echt nodig ? }
	X
	X           Jump_in_file(wpd,4);
	X
	X           If hf_left   Then Write(strip,'}{}{}');
	X           If hf_center Then Write(strip,'}{}');
	X           If hf_right  Then Write(strip,'}');
	X
	X           depth := 0;
	X           Open_all_attr;
	X
	X        End
	X
	X   Else Jump_in_file(wpd,len_of_code);
	X
	XEnd;
	X
	X
	XBegin
	X   Table_Init;
	X   Ext_chr_init;
	X
	X   Reset_attr_rij(0);
	X   Reset_attr_rij(1);
	X   depth := 0;
	X
	X   WP_default;
	X
	X   latex_tabpos:=0;
	X   right_tab := False;
	X   align_tab := False;
	X   center_tab := False;
	X
	X   indenting:=False;
	X   indent_end:=False;
	X   ind_text1:=False;
	X   ind_text2:=False;
	X   ind_leftmargin:=0;
	X   ind_rightmargin:=0;
	X
	X   envir:=' ';
	X
	X   nomore_valid_tabs := False;
	X
	X   Writeln('First strike :');
	X   Write('Converting-percentage :     ');
	X
	X   srtdocpos:=filepos(wpd);
	X   fsize:=FileSize(wpd);
	X
	X   regelnum := 0;
	X
	X   Make_tabelentry_attr;           { attribuut instelling }
	X
	X   Make_tabelentry_tabset;         { Geef de defaulttabinstelling door }
	X                                   { aan de 2e slag }
	X
	X  
	X
	X   While (FilePos(wpd)<fsize)
	X   Do Begin
	X        convperc:=round((FilePos(wpd)-srtdocpos)/(fsize-srtdocpos)*100);
	X        Write(chr(8),chr(8),chr(8),chr(8),convperc:3,'%');
	X
	X        Read(wpd,by);
	X
	X        Case by of
	X          $20..$7F,
	X          $A9,$C0  : Begin
	X                         char_on_line:=True;            {Er (al) is een karakter op deze regel }
	X                         If indenting                   {Als er is ingeprongen er na een stuk }
	X                         Then If ind_text1              {tekst is weer ingesprongen (ind_text1) }
	X                              Then ind_text2:=True;     {dan hoort dit char bij het ind_txt-blok }
	X
	X                         Character;
	X                      End;
	X
	X          $0A,$0D,
	X          $0B,$0C,
	X          $8C      : Return_Page;
	X
	X          $C1      : Begin
	X                        Read(wpd,by);
	X                        by:=by and $E8;
	X
	X                        Case by of
	X                          $00,$C8,
	X                          $48,$40     : Tab;
	X                          $60         : Flush_right_tab;
	X                          $E0         : Center;
	X                          Else          Jump_in_file(wpd,7);
	X                        End;
	X                     End;
	X          $81,$82  : Make_tabelentry_rightjustification;
	X          $83      : End_Align;
	X          $C3      : Attr_ON;
	X          $C4      : Attr_OFF;
	X          $C2      : Indent;
	X          $C6      : End_of_indent;
	X          $C5,$C7  : NopC0;
	X
	X          $D0      : Begin
	X                        Read(wpd,by);
	X                        Case by of
	X                          $04 : Tabset;
	X                          $08 : Page_number_position;
	X                          Else  NopD0(True);
	X                        End;
	X                     End;
	X
	X          $D5      : Header_Footer;
	X
	X          $D6      : Begin
	X                        Read(wpd,by);
	X                        Case by of
	X                          $00 : Footnote;
	X                          Else NopD0(True);
	X                        End;
	X                     End;
	X
	X          $D8      : Begin
	X                        Read(wpd,by);
	X                        Case by of
	X                          $02 : Overstrike;
	X                          Else NopD0(True);
	X                        End;
	X                     End;
	X
	X          $00..$1F,
	X          $80..$BF : Nop80;
	X
	X          $D0..$FF : NopD0(False);
	X
	X        End;
	X      End;
	X
	X   Writeln;
	X   Make_tabelentry_envir_extra_end;
	X
	X   num_of_lines_stripfile := regelnum;
	X
	XEnd;
	X
	X
	X{---SLAG2---}
	X
	XProcedure Convert_second_strike;
	XVar
	X   regelnum : Word;
	X   convperc : Integer;
	X
	X   underline,
	X   illegal_argument,
	X   just_envir_closed      : Boolean;
	X
	X   i     : Integer;
	X
	X   regel,
	X   hulp_regel            : String;
	X   len_reg               : Integer;
	X
	X   num_of_tabs           : Integer;
	X   tabpos                : Array [1..40] of Word;
	X
	X   tabent_num_of_tabs    : Array [0..2] of Integer;
	X   tabent_tabpos         : Array [0..2,1..40] of Word;
	X
	X   ind_leftmargin,
	X   ind_rightmargin       : Array [0..2] of Word;
	X   ind_label             : Array [0..2] of Byte;
	X
	X   pre,
	X   cur,
	X   next     : Integer;
	X
	X   envir,
	X   line_term  : Array [0..2] of Char;
	X   new_tabset : Array [0..2] of Boolean;
	X
	X   rightjust,
	X   new_rightjust         : Boolean;
	X   new_tabent_rightjust,
	X   tabent_rightjust      : Array [0..2] of Boolean;
	X
	X   num_of_attr : Array[0..2] of Integer;
	X   attr_BOL    : Array[0..2,$00..$10] of Byte;
	X   attr_closed : Boolean;
	X
	X
	X
	XProcedure Read_tabelentry(n:Integer);
	XVar
	X   w  : Word;
	X   b  : Byte;
	X   j  : Integer;
	X
	XBegin
	X   { Begin met een schone lei die dan door deze procedure verder wordt }
	X   { opgevuld. }
	X
	X   envir[n]:=' ';
	X   new_tabset[n]:=False;
	X   new_tabent_rightjust[n]:=False;
	X
	X   num_of_attr[n] := 0;
	X   For j:=1 to 16
	X   Do attr_BOL[n,j]:=0;
	X
	X   If filepos(tabel)<filesize(tabel)
	X   Then Begin
	X
	X           Read(tabel,b);
	X           num_of_attr[n] := b;
	X           For j:=1 to num_of_attr[n]
	X           Do Read(tabel,Attr_BOL[n,j]);
	X
	X           b:=$00;
	X           While b<>$FF
	X           Do Begin
	X                 Read(tabel,b);
	X
	X                 Case chr(b) Of
	X                   'C' : envir[n]:='C';
	X                   'T' : envir[n]:='T';
	X                   'I' : Begin
	X                            envir[n]:='I';
	X                            Rd_word(tabel,ind_leftmargin[n]);
	X                            Rd_word(tabel,ind_rightmargin[n]);
	X                            Read(tabel,ind_label[n]);
	X                         End;
	X
	X                   'S' : Begin
	X                            new_tabset[n]:=True;
	X                            Read(tabel,b);
	X                            tabent_num_of_tabs[n]:=b;
	X
	X                            For j:=1 to tabent_num_of_tabs[n]
	X                            Do Begin
	X                                  Rd_word(tabel,w);
	X                                  tabent_tabpos[n,j]:=w;
	X                               End;
	X                         End;
	X
	X                   'U' : Begin
	X                            new_tabent_rightjust[n]:=True;
	X                            Read(tabel,b);
	X                            If b=0
	X                            Then tabent_rightjust[n]:=False
	X                            Else tabent_rightjust[n]:=True;
	X                         End;
	X
	X                   'R','r','P','p' : line_term[n]:=chr(b);
	X
	X                End {Case};
	X              End;
	X        End
	X
	X{ Er is geen volgende tabelentry dus ook geen volgende regel }
	X{ De tabelentry is 'schoon'.                                 }
	X{ Zodat het document 'schoon' wordt afgesloten.              }
	X
	XEnd;
	X
	X
	X
	XProcedure Open_all_attr_BOL;
	X{ -- Open alle commando's door de Attributen-rij af te lopen -- }
	XVar
	X   j:Integer;
	XBegin
	X   For j:=$01 to num_of_attr[cur]
	X   Do Write(latex,Open_com[attr_BOL[cur,j]]);
	X
	X   attr_closed := False;
	XEnd;
	X
	X
	XProcedure Close_all_attr_BOL;
	X{ -- Sluit alle commando's door de Attributen-rij af te lopen -- }
	XVar
	X   j:Integer;
	XBegin
	X   For j:=num_of_attr[cur] Downto $01
	X   Do Write(latex,Close_com[Attr_BOL[cur,j]]);
	X
	X   attr_closed := True;
	XEnd;
	X
	X
	X
	XProcedure Open_all_attr_EOL;
	X{ -- Open alle commando's door de Attributen-rij af te lopen -- }
	XVar j:Integer;
	XBegin
	X  For j:=$01 to num_of_attr[next]
	X  Do Write(latex,Open_com[Attr_BOL[next,j]]);
	X
	X  attr_closed := False;
	XEnd;
	X
	X
	X
	XProcedure Close_all_attr_EOL;
	X{ -- Sluit alle commando's door de Attributen-rij af te lopen -- }
	XVar j:Integer;
	XBegin
	X  For j:=num_of_attr[next] Downto $01
	X  Do Write(latex,Close_com[Attr_BOL[next,j]]);
	X
	X  attr_closed := True;
	XEnd;
	X
	X
	X
	XProcedure Latex_head;
	X{ -- Maak het de standard-heading voor een latex-file aan -- }
	XBegin
	X  Writeln(latex,'\documentstyle[11pt,wp2latex]{report}');
	X  Writeln(latex,'\begin{document}')
	XEnd;
	X
	X
	X
	XProcedure Latex_foot;
	X{ -- Sluit de latex-file op de juiste wijze af -- }
	XBegin
	X  Writeln(latex,'\end{document}')
	XEnd;
	X
	X
	X
	XProcedure Latex_tabset;
	XVar
	X   atpr,j    : Integer;
	X   l,ol : Real;
	X
	XBegin
	X   atpr:=0;                  { Huiding aantal tabs per regel }
	X   ol:=0;
	X   For j:=1 to num_of_tabs
	X   Do Begin
	X         l:=tabpos[j]/1200 * 2.54;
	X         Write(latex,'\hspace{', l-ol :3:2,'cm}\=');
	X         atpr:=atpr+1;
	X         If atpr>=4
	X         Then Begin
	X                 Writeln(latex,'%');
	X                 atpr:=0;
	X              End;
	X         ol:=l;
	X      End;
	X   Writeln(latex,'\kill');
	XEnd;
	X
	X
	X
	XFunction Change_envir_BOL : Boolean;
	XVar
	X   hulp : Boolean;
	X
	XBegin
	X   hulp := False;
	X
	X   hulp := ((envir[cur]='C') And Not (envir[pre]='C')) Or hulp;
	X   hulp := ((envir[cur]='T') And Not (envir[pre]='T')) Or hulp;
	X   hulp := ((envir[cur]='I') And Not (envir[pre]='I')) Or hulp;
	X
	X   change_envir_BOL := hulp;
	XEnd;
	X
	X
	X
	XFunction Change_envir_EOL : Boolean;
	XVar
	X   hulp : Boolean;
	X
	XBegin
	X   hulp := False;
	X
	X   hulp := ((envir[next]='C') Xor (envir[cur]='C')) Or hulp;
	X   hulp := ((envir[next]='T') Xor (envir[cur]='T')) Or hulp;
	X   hulp := ((envir[next]='I') Xor (envir[cur]='I')) Or hulp;
	X
	X   change_envir_EOL := hulp;
	XEnd;
	X
	X
	X
	X
	XProcedure Open_environment;
	X
	XBegin
	X   If change_envir_BOL                 { andere environment ? }
	X   Then Begin
	X           If Not attr_closed
	X           Then Close_all_attr_BOL;
	X
	X           Case envir[cur] of
	X              'C' : Begin
	X                       Writeln(latex,'\begin{center}');
	X                    End;
	X
	X              'T' : Begin
	X                       Writeln(latex,'\begin{tabbing}');
	X                       Latex_tabset;
	X                    End;
	X
	X              'I' : Begin
	X                       Write(latex,'\begin{indenting}');
	X                       Write(latex,'{',ind_leftmargin[cur]/1200*2.54:3:2,'cm}');
	X                       Write(latex,'{',ind_rightmargin[cur]/1200*2.54:3:2,'cm}');
	X                       If ind_label[cur]=1
	X                       Then Begin
	X                               Writeln(latex,'%');
	X                               Write(latex,'{');
	X                            End
	X                       Else Writeln(latex,'{}');
	X                    End
	X           End;
	X
	X        End
	X
	X   Else If new_tabset[cur] and (envir[cur]='T')
	X        Then Latex_tabset;
	X
	XEnd;
	X
	X
	X
	XProcedure Close_environment;
	X
	XBegin
	X
	X           Case envir[cur] of
	X              'C' : Begin
	X                       Writeln(latex,'\end{center}');
	X                    End;
	X
	X              'T' : Begin
	X                       Writeln(latex,'\end{tabbing}');
	X                    End;
	X
	X              'I' : Begin
	X                       Writeln(latex,'\end{indenting}');
	X                    End;
	X           End;
	X
	X           just_envir_closed := True;
	X
	XEnd;
	X
	X
	X
	XProcedure Update_global_information;
	XVar
	X   j : Integer;
	X
	XBegin
	X   If new_tabset[cur]
	X   Then Begin
	X           num_of_tabs:=tabent_num_of_tabs[cur];
	X           For j:=1 to num_of_tabs
	X           Do tabpos[j]:=tabent_tabpos[cur,j]
	X        End;
	X
	X   If new_tabent_rightjust[cur]
	X   Then new_rightjust := tabent_rightjust[cur];
	X
	XEnd;
	X
	X
	XProcedure Change_tabelentry;
	XVar
	X   help : Integer;
	X
	XBegin
	X   help:=pre;
	X   pre:=cur;
	X   cur:=next;
	X   next:=help;
	X   Read_tabelentry(next);
	XEnd;
	X
	X
	XBegin
	X   pre:=0;
	X   cur:=1;
	X   next:=2;
	X
	X   envir[pre]:=' ';
	X   new_tabset[pre]:=False;
	X
	X   just_envir_closed:=True;
	X   attr_closed := False;
	X
	X   rightjust:=True;
	X   new_rightjust:=True;
	X   For i:=0 to 2
	X   Do Begin
	X         new_tabent_rightjust[i]:=False;
	X         tabent_rightjust[i]:=False;
	X      End;
	X
	X   Read_tabelentry(cur);
	X   Read_tabelentry(next);
	X
	X   regelnum:=1;
	X
	X   Writeln;
	X   Writeln('Second strike :');
	X   Write('Converting-percentage :     ');
	X
	X  
	X
	X   Latex_head;
	X
	X   While (Not Eof(strip)) and (not keypressed)
	X   Do Begin
	X         Update_global_information;
	X
	X         convperc := round(100*regelnum/num_of_lines_stripfile);
	X         if convperc>100 then convperc:=100;
	X         Write(chr(8),chr(8),chr(8),chr(8),convperc:3,'%');
	X
	X         Readln(strip,regel);
	X
	X{ Werk eventueel de regel bij d.m.v. een hulp regel. }
	X
	X         hulp_regel := regel;
	X         len_reg := length(hulp_regel);
	X
	X{ Meerdere spaties achter elkaar vervangen door harde spaties. }
	X
	X         For i:=1 to len_reg-1
	X         Do If (regel[i]=' ') and (regel[i+1]=' ')
	X            Then hulp_regel[i+1]:='~';
	X
	X{ Zoek naar een illegaal argument en zet hier accolades voor. }
	X
	X         If ((len_reg>=1) and (hulp_regel[1]='[')) or
	X            ((len_reg>=2) and (hulp_regel[1]=' ') and (hulp_regel[2]='['))
	X         Then hulp_regel:='{}' + hulp_regel;
	X
	X{ De regel is verwerkt. }
	X
	X         regel := hulp_regel;
	X         len_reg := length(regel);
	X
	X         If new_rightjust xor rightjust
	X         Then Begin
	X                 rightjust := new_rightjust;
	X                 If rightjust
	X                 Then Writeln(latex,'\justified')
	X                 Else Writeln(latex,'\raggedright');
	X              End;
	X
	X         Open_environment;
	X
	X         If len_reg>0
	X         Then Begin
	X                 If attr_closed
	X                 Then Open_all_attr_BOL;
	X
	X                 Write(latex,regel);
	X
	X                 just_envir_closed := False;
	X              End;
	X
	X         Case line_term[cur] of
	X
	X          'r','p' : Begin
	X                       Writeln(latex);
	X                       If Change_envir_EOL
	X                       Then Begin
	X                               If Not attr_closed
	X                               Then Close_all_attr_EOL;
	X
	X                               Close_environment;
	X                            End;
	X                    End;
	X
	X              'R' : Begin
	X
	X                       If envir[cur]='I'
	X                       Then Begin
	X                               If Not attr_closed
	X                               Then Close_all_attr_EOL;
	X
	X                               Writeln(latex);
	X                               Close_environment;
	X                               envir[cur]:=' ';
	X                            End
	X
	X                       Else Begin
	X                               underline:=False;
	X                               For i:=$01 to $10
	X                               Do underline := underline
	X                                               Or (Attr_Bol[next,i]=$B)
	X                                               Or (Attr_bol[next,i]=$E);
	X
	X                               If underline and Not attr_closed
	X                               Then Close_all_attr_EOL;
	X
	X                       { Elke Indent-environment moet na een harde Return}
	X                       { Afgesloten worden.}
	X
	X
	X                               If Change_envir_EOL
	X                               Then Begin
	X                                       If just_envir_closed
	X                                       Then Writeln(latex,'\nwln')
	X                                       Else Writeln(latex);
	X
	X                                       If Not attr_closed
	X                                       Then Close_all_attr_EOL;
	X
	X                                       Close_environment;
	X                                    End
	X                               Else Begin
	X                                       If just_envir_closed
	X                                       Then Writeln(latex,'\nwln')
	X                                       Else Writeln(latex,'\\');
	X                                     End;
	X                            End;
	X                    End;
	X
	X              'P' : Begin
	X                       If Not attr_closed
	X                       Then Close_all_attr_EOL;
	X
	X                       Writeln(latex);
	X                       Close_environment;
	X                       Writeln(latex,'\newpage');
	X                       envir[cur]:=' ';
	X                    End;
	X
	X         End {Case};
	X
	X
	X
	X         Change_tabelentry;
	X
	X         regelnum:=regelnum+1;
	X      End;
	X
	X   Latex_foot;
	X   Writeln;
	XEnd;
	X
	X
	X{---HOOFDPROG---}
	X
	X
	XBegin
	X   Exitsave:=Exitproc;                { Bewaar de orginele exit-pointer }
	X   Exitproc:=@Einde_prog;             { Spring bij Exit naar Proc. Einde_prog }
	X
	X   Init_commando;
	X
	X   ClrScr;
	X   Writeln;
	X   Writeln('     Conversionprogram : From Wordperfect 5.0 to LaTeX  (WP2latEX)');
	X   Writeln;
	X   Writeln('  (c) TUE-Eindhoven ---- Made by R.C.Houtepen ---- Date : 24 Jan 1990');
	X
	X   Filenames;
	X
	X   Reset(wpd);
	X   Wpd_check;
	X
	X   Rewrite(strip);
	X   Rewrite(tabel);
	X
	X   Writeln('Converting ...');
	X   Writeln;
	X
	X   Convert_first_strike;
	X
	X   Close(wpd);
	X   Close(strip);
	X   Close(tabel);
	X
	X   Reset(strip);
	X   Reset(tabel);
	X   Rewrite(latex);
	X
	X   Convert_second_strike;
	X
	X   Close(strip);
	X   Close(tabel);
	X   Close(latex);
	X
	X   Erase(strip);
	X   Erase(tabel);
	X
	XEnd.
SHAR_EOF
if test 49507 -ne "`wc -c < 'wp2latex.pas'`"
then
	echo shar: "error transmitting 'wp2latex.pas'" '(should have been 49507 characters)'
fi
fi
exit 0
#	End of shell archive
--
Glenn Geers                       | "So when it's over, we're back to people.
Department of Theoretical Physics |  Just to prove that human touch can have
The University of Sydney          |  no equal."
Sydney NSW 2006 Australia         |  - Basia Trzetrzelewska, 'Prime Time TV'

glenn@extro.ucc.su.oz.au (Glenn Geers) (08/08/90)

#! /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:
#	MANIFEST
#	Makefile
#	README.C
#	nl.sty
#	p2c.h
#	p2clib.c
# This archive created: Wed Aug  8 21:47:12 1990
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'MANIFEST'" '(513 characters)'
if test -f 'MANIFEST'
then
	echo shar: "will not over-write existing file 'MANIFEST'"
else
sed 's/^	X//' << \SHAR_EOF > 'MANIFEST'
	XThis shar archive contains:
	XMANIFEST     - this file
	XMakefile     - makefile for wp2latex
	XREADME.C     - C specific stuff
	Xnl.sty       - Dutch style file
	Xp2c.h        - header file (part of p2c)
	Xp2clib.c     - C source of Pascal support library (part of p2c)
	Xwp2latex.c   - C source code
	Xwp2latex.doc - English language doc
	Xwp2latex.msg - original cover note
	Xwp2latex.pas - original Pascal source code
	Xwp2latex.sty - needed style file
	Xwp2latex.tex - documentation in Dutch
	Xwp2leng.tex  - documentation in English
SHAR_EOF
if test 513 -ne "`wc -c < 'MANIFEST'`"
then
	echo shar: "error transmitting 'MANIFEST'" '(should have been 513 characters)'
fi
fi
echo shar: "extracting 'Makefile'" '(671 characters)'
if test -f 'Makefile'
then
	echo shar: "will not over-write existing file 'Makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'Makefile'
	X# Makefile for wp2latex
	X
	XCC = cc
	X
	XPROG = wp2latex
	XPROGSRC = wp2latex.c
	XPROGOBJ = wp2latex.o
	X
	X# Select the one appropriate to your setup
	X# remember to remove the -DHAVE_P2C if p2c is not installed
	X#CFLAGS = -O -fstrength-reduce -DHAVE_P2C
	X# generic UNIX cc
	XCFLAGS = -O
	X# Xenix cross-compiling to DOS
	X#CFLAGS = -dos -M2le -Ox -CSON -F 3000 -DHAVE_P2C
	X
	X# library selection
	X# select p2clib.o if you have deleted HAVE_P2C above
	X#LIB1 = -lp2c
	XLIB1 = p2clib.o
	XLIBS = $(LIB1) -lm
	X
	X# ld flags
	X# Xenix cross-compiling to DOS
	X#LFLAGS = -dos
	X# SUN's
	XLFLAGS =
	X
	X$(PROG) : $(PROGOBJ) $(LIB1)
	X	$(CC) $(LFLAGS) -o $(PROG) $(PROGOBJ) $(LIBS)
	X
	Xclean:
	X	rm -f $(PROGOBJ) $(LIB1) $(PROG) core
SHAR_EOF
if test 671 -ne "`wc -c < 'Makefile'`"
then
	echo shar: "error transmitting 'Makefile'" '(should have been 671 characters)'
fi
fi
echo shar: "extracting 'README.C'" '(771 characters)'
if test -f 'README.C'
then
	echo shar: "will not over-write existing file 'README.C'"
else
sed 's/^	X//' << \SHAR_EOF > 'README.C'
	XI have tested wp2latex (C version) using the following OS/compiler
	Xcombinations:
	X1. 386 Xenix 2.3.2/cc & gcc
	X2. DOS/Xenix cc -dos & MSC 5.1
	X3. SunOS 4.0.3 & 4.1(SPARC)/cc
	X
	XThe DOS versions require a large model compilation and a stack size of
	X0x3000 in order to run.
	X
	XThe SUN version runs exceedingly slowly. I don't know why. (By slow I mean
	Xa 4.77MHz XT is *faster*) I have profiled the code and seems to be spending
	Xa lot of time in lseek. Any ideas would be welcome. I've sorted this out.
	XSun machines are catered for automatically.
	X
	XDefine HAVE_P2C in the Makefile and correct the libraries required if you 
	Xhave p2c 1.14 or higher installed.
	X
	X
	XPlease note: This version differs slightly from that on ymir.
	X
	X			Share and enjoy,
	X				Glenn
	X
	Xglenn@qed.physics.su.oz.au
SHAR_EOF
if test 771 -ne "`wc -c < 'README.C'`"
then
	echo shar: "error transmitting 'README.C'" '(should have been 771 characters)'
fi
fi
echo shar: "extracting 'nl.sty'" '(4508 characters)'
if test -f 'nl.sty'
then
	echo shar: "will not over-write existing file 'nl.sty'"
else
sed 's/^	X//' << \SHAR_EOF > 'nl.sty'
	X% Met ========== onderstreept nederlandse teksten
	X\@ifundefined{chapter}
	X{%%%%%%%%%%%%%%% dit is voor article style %%%%%%%%%%%%%%%%%%%%%
	X\def\@part[#1]#2{\ifnum \c@secnumdepth >\m@ne \refstepcounter{part}
	X\addcontentsline{toc}{part}{\thepart \hspace{1em}#1}\else
	X\addcontentsline{toc}{part}{#1}\fi { \parindent 0pt \raggedright 
	X \ifnum \c@secnumdepth >\m@ne \Large \bf Deel \thepart \par \nobreak \fi \huge
	X%                                        ====
	X\bf #2\markboth{}{}\par } \nobreak \vskip 3ex \@afterheading } 
	X\def\tableofcontents{\section*{Inhoud\markboth{INHOUD}{INHOUD}}
	X%                              ======          ======  ======
	X \@starttoc{toc}}
	X\def\listoffigures{\section*{Lijst van figuren\markboth
	X%                           ==================
	X {LIJST VAN FIGUREN}{LIJST VAN FIGUREN}}\@starttoc{lof}}
	X% =================  =================
	X\def\listoftables{\section*{Lijst van tabellen\markboth
	X%                           ==================
	X {LIJST VAN TABELLEN}{LIJST VAN TABELLEN}}\@starttoc{lot}}
	X% ==================  ==================
	X\def\thebibliography#1{\section*{Referenties\markboth
	X%                                ===========
	X {REFERENTIES}{REFERENTIES}}\list
	X% ===========  ===========
	X {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
	X \advance\leftmargin\labelsep
	X \usecounter{enumi}}
	X \def\newblock{\hskip .11em plus .33em minus -.07em}
	X \sloppy
	X \sfcode`\.=1000\relax}
	X\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
	X\columnseprule \z@
	X\columnsep 35pt\twocolumn[\section*{Index}]
	X%                                   =====
	X \markboth{INDEX}{INDEX}\thispagestyle{plain}\parindent\z@
	X%          =====  =====
	X \parskip\z@ plus .3pt\relax\let\item\@idxitem}
	X\def\abstract{\if@twocolumn
	X\section*{Samenvatting}
	X%         ============
	X\else \small 
	X\begin{center}
	X{\bf Samenvatting\vspace{-.5em}\vspace{0pt}} 
	X%    ============
	X\end{center}
	X\quotation 
	X\fi}}
	X{%%%%%%%%%%%%%% Dit is voor report en book style %%%%%%%%%%%%%%%
	X\def\@part[#1]#2{\ifnum \c@secnumdepth >-2\relax \refstepcounter{part}
	X\addcontentsline{toc}{part}{\thepart \hspace{1em}#1}\else
	X\addcontentsline{toc}{part}{#1}\fi \markboth{}{}
	X \ifnum \c@secnumdepth >-2\relax \huge\bf Deel \thepart \par \vskip 20pt \fi
	X%                                         ====
	X\Huge \bf #1\@endpart} 
	X\def\@chapapp{Hoofdstuk}
	X%             =========
	X\def\appendix{\par
	X \setcounter{chapter}{0}
	X \setcounter{section}{0}
	X \def\@chapapp{Appendix}
	X%              ========
	X \def\thechapter{\Alph{chapter}}}
	X\def\tableofcontents{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
	X \fi\chapter*{Inhoud\@mkboth{INHOUD}{INHOUD}}
	X%             ======         ======  ======
	X \@starttoc{toc}\if@restonecol\twocolumn\fi}
	X\def\listoffigures{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
	X \fi\chapter*{Lijst van figuren\@mkboth
	X%             =================
	X {LIJST VAN FIGUREN}{LIJST VAN FIGUREN}}\@starttoc{lof}\if@restonecol\twocolumn
	X% =================  =================
	X \fi}
	X\def\listoftables{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
	X \fi\chapter*{Lijst van tabellen\@mkboth
	X%             ==================
	X {LIJST VAN TABELLEN}{LIJST VAN TABELLEN}}\@starttoc{lot}\if@restonecol
	X% ==================  ==================
	X \twocolumn\fi}
	X\def\thebibliography#1{\chapter*{Referenties\@mkboth
	X%                                ===========
	X {REFERENTIES}{REFERENTIES}}\list
	X% ============  ============
	X {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
	X \advance\leftmargin\labelsep
	X \usecounter{enumi}}
	X \def\newblock{\hskip .11em plus .33em minus -.07em}
	X \sloppy
	X \sfcode`\.=1000\relax}
	X\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
	X\columnseprule \z@
	X\columnsep 35pt\twocolumn[\@makeschapterhead{Index}]
	X%                                            =====
	X \@mkboth{INDEX}{INDEX}\thispagestyle{plain}\parindent\z@
	X%         =====  =====
	X \parskip\z@ plus .3pt\relax\let\item\@idxitem}
	X\def\abstract{\titlepage
	X\null\vfil
	X\begin{center}
	X{\bf Samenvatting}
	X%    ============
	X\end{center}}
	X}
	X%%%%%%%%%%%%%%%%%%% dit is voor allebei %%%%%%%%%%%%%%%%%%%%%%%%%%
	X\def\today{\number\day\space\ifcase\month%
	X\or jan\or feb\or maart\or apr\or mei\or juni%
	X%   ===    ===    =====    ===    ===    ====
	X\or juli\or aug\or sept\or okt\or nov\or dec\fi
	X%   ====    ===    ====    ===    ===    ===
	X\space\number\year}
	X\def\fnum@figure{Figuur \thefigure}
	X%                ======
	X\def\fnum@table{Tabel \thetable}
	X%               =====
SHAR_EOF
if test 4508 -ne "`wc -c < 'nl.sty'`"
then
	echo shar: "error transmitting 'nl.sty'" '(should have been 4508 characters)'
fi
fi
echo shar: "extracting 'p2c.h'" '(11337 characters)'
if test -f 'p2c.h'
then
	echo shar: "will not over-write existing file 'p2c.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'p2c.h'
	X#ifndef P2C_H
	X#define P2C_H
	X
	X
	X/* Header file for code generated by "p2c", the Pascal-to-C translator */
	X
	X/* "p2c"  Copyright (C) 1989 Dave Gillespie, version 1.18.
	X * This file may be copied, modified, etc. in any way.  It is not restricted
	X * by the licence agreement accompanying p2c itself.
	X */
	X
	X
	X#include <stdio.h>
	X
	X
	X
	X/* If the following heuristic fails, compile -DBSD=0 for non-BSD systems,
	X   or -DBSD=1 for BSD systems. */
	X
	X#ifdef M_XENIX
	X# undef BSD
	X#endif
	X
	X#ifdef FILE       /* a #define in BSD, a typedef in SYSV (hp-ux, at least) */
	X# ifndef BSD	  /*  (a convenient, but horrible kludge!) */
	X#  define BSD 1
	X# endif
	X#endif
	X
	X#ifdef BSD
	X# if !BSD
	X#  undef BSD
	X# endif
	X#endif
	X
	X
	X#ifdef __STDC__
	X# include <stddef.h>
	X# include <stdlib.h>
	X# define HAS_STDLIB
	X# define __CAT__(a,b)a##b
	X#else
	X# ifndef BSD
	X#  include <memory.h>
	X# endif
	X# include <sys/types.h>
	X# define __ID__(a)a
	X# define __CAT__(a,b)__ID__(a)b
	X#endif
	X
	X
	X#ifdef BSD
	X# include <strings.h>
	X# define memcpy(a,b,n) (bcopy(b,a,n),a)
	X# define memcmp(a,b,n) bcmp(a,b,n)
	X/*
	X# define strchr(s,c) index(s,c)
	X# define strrchr(s,c) rindex(s,c)
	X*/
	X#else
	X# include <string.h>
	X#endif
	X
	X#include <ctype.h>
	X#include <math.h>
	X#include <setjmp.h>
	X#include <assert.h>
	X
	X
	Xtypedef struct __p2c_jmp_buf {
	X    struct __p2c_jmp_buf *next;
	X    jmp_buf jbuf;
	X} __p2c_jmp_buf;
	X
	X
	X/* Warning: The following will not work if setjmp is used simultaneously.
	X   This also violates the ANSI restriction about using vars after longjmp,
	X   but a typical implementation of longjmp will get it right anyway. */
	X
	X#ifndef FAKE_TRY
	X# define TRY(x)         do { __p2c_jmp_buf __try_jb;  \
	X			     __try_jb.next = __top_jb;  \
	X			     if (!setjmp((__top_jb = &__try_jb)->jbuf)) {
	X# define RECOVER(x)	__top_jb = __try_jb.next; } else {
	X# define RECOVER2(x,L)  __top_jb = __try_jb.next; } else {  \
	X			     if (0) { L: __top_jb = __try_jb.next; }
	X# define ENDTRY(x)      } } while (0) 
	X#else
	X# define TRY(x)         if (1) {
	X# define RECOVER(x)     } else do {
	X# define RECOVER2(x,L)  } else do { L: ;
	X# define ENDTRY(x)      } while (0)
	X#endif
	X
	X
	X
	X#ifdef M_XENIX  /* avoid compiler bug */
	X# define SHORT_MAX  (32767)
	X# define SHORT_MIN  (-32768)
	X#endif
	X
	X
	X/* The following definitions work only on twos-complement machines */
	X#ifndef SHORT_MAX
	X# define SHORT_MAX  (((unsigned short) -1) >> 1)
	X# define SHORT_MIN  (~SHORT_MAX)
	X#endif
	X
	X#ifndef INT_MAX
	X# define INT_MAX    (((unsigned int) -1) >> 1)
	X# define INT_MIN    (~INT_MAX)
	X#endif
	X
	X#ifndef LONG_MAX
	X# define LONG_MAX   (((unsigned long) -1) >> 1)
	X# define LONG_MIN   (~LONG_MAX)
	X#endif
	X
	X#ifndef SEEK_SET
	X# define SEEK_SET   0
	X# define SEEK_CUR   1
	X# define SEEK_END   2
	X#endif
	X
	X#ifndef EXIT_SUCCESS
	X# define EXIT_SUCCESS  0
	X# define EXIT_FAILURE  1
	X#endif
	X
	X
	X#define SETBITS  32
	X
	X
	X#ifdef __STDC__
	X# define Signed     signed
	X# define Void       void      /* Void f() = procedure */
	X# ifndef Const
	X#  define Const     const
	X# endif
	X# ifndef Volatile
	X# define Volatile  volatile
	X# endif
	X# define PP(x)      x         /* function prototype */
	X# define PV()       (void)    /* null function prototype */
	Xtypedef void *Anyptr;
	X#else
	X# define Signed
	X# define Void       void
	X# ifndef Const
	X#  define Const
	X# endif
	X# ifndef Volatile
	X#  define Volatile
	X# endif
	X# define PP(x)      ()
	X# define PV()       ()
	Xtypedef char *Anyptr;
	X#endif
	X
	X#ifdef __GNUC__
	X# define Inline     inline
	X#else
	X# define Inline
	X#endif
	X
	X#define Register    register  /* Register variables */
	X#define Char        char      /* Characters (not bytes) */
	X
	X#ifndef Static
	X# define Static     static    /* Private global funcs and vars */
	X#endif
	X
	X#ifndef Local
	X# define Local      static    /* Nested functions */
	X#endif
	X
	Xtypedef Signed   char schar;
	Xtypedef unsigned char uchar;
	Xtypedef unsigned char boolean;
	X
	X#ifndef true
	X# define true    1
	X# define false   0
	X#endif
	X
	X
	Xtypedef struct {
	X    Anyptr proc, link;
	X} _PROCEDURE;
	X
	X#ifndef _FNSIZE
	X# define _FNSIZE  120
	X#endif
	X
	X
	Xextern Void    PASCAL_MAIN  PP( (int, Char **) );
	Xextern Char    **P_argv;
	Xextern int     P_argc;
	Xextern short   P_escapecode;
	Xextern int     P_ioresult;
	Xextern __p2c_jmp_buf *__top_jb;
	X
	X
	X#ifdef P2C_H_PROTO   /* if you have Ansi C but non-prototyped header files */
	Xextern Char    *strcat      PP( (Char *, Const Char *) );
	Xextern Char    *strchr      PP( (Const Char *, int) );
	Xextern int      strcmp      PP( (Const Char *, Const Char *) );
	Xextern Char    *strcpy      PP( (Char *, Const Char *) );
	Xextern size_t   strlen      PP( (Const Char *) );
	Xextern Char    *strncat     PP( (Char *, Const Char *, size_t) );
	Xextern int      strncmp     PP( (Const Char *, Const Char *, size_t) );
	Xextern Char    *strncpy     PP( (Char *, Const Char *, size_t) );
	Xextern Char    *strrchr     PP( (Const Char *, int) );
	X
	Xextern Anyptr   memchr      PP( (Const Anyptr, int, size_t) );
	Xextern Anyptr   memmove     PP( (Anyptr, Const Anyptr, size_t) );
	Xextern Anyptr   memset      PP( (Anyptr, int, size_t) );
	X#ifndef memcpy
	Xextern Anyptr   memcpy      PP( (Anyptr, Const Anyptr, size_t) );
	Xextern int      memcmp      PP( (Const Anyptr, Const Anyptr, size_t) );
	X#endif
	X
	Xextern int      atoi        PP( (Const Char *) );
	Xextern double   atof        PP( (Const Char *) );
	Xextern long     atol        PP( (Const Char *) );
	Xextern double   strtod      PP( (Const Char *, Char **) );
	Xextern long     strtol      PP( (Const Char *, Char **, int) );
	X#endif /*P2C_H_PROTO*/
	X
	X#ifndef HAS_STDLIB
	Xextern Anyptr   malloc      PP( (size_t) );
	Xextern Void     free        PP( (Anyptr) );
	X#endif
	X
	Xextern int      _OutMem     PV();
	Xextern int      _CaseCheck  PV();
	Xextern int      _NilCheck   PV();
	Xextern int	_Escape     PP( (int) );
	Xextern int	_EscIO      PP( (int) );
	X
	Xextern long     ipow        PP( (long, long) );
	Xextern Char    *strsub      PP( (Char *, Char *, int, int) );
	Xextern Char    *strltrim    PP( (Char *) );
	Xextern Char    *strrtrim    PP( (Char *) );
	Xextern Char    *strrpt      PP( (Char *, Char *, int) );
	Xextern Char    *strpad      PP( (Char *, Char *, int, int) );
	Xextern int      strpos2     PP( (Char *, Char *, int) );
	Xextern long     memavail    PV();
	Xextern int      P_peek      PP( (FILE *) );
	Xextern int      P_eof       PP( (FILE *) );
	Xextern int      P_eoln      PP( (FILE *) );
	Xextern Void     P_readpaoc  PP( (FILE *, Char *, int) );
	Xextern Void     P_readlnpaoc PP( (FILE *, Char *, int) );
	Xextern long     P_maxpos    PP( (FILE *) );
	Xextern Char    *P_trimname  PP( (Char *, int) );
	Xextern long    *P_setunion  PP( (long *, long *, long *) );
	Xextern long    *P_setint    PP( (long *, long *, long *) );
	Xextern long    *P_setdiff   PP( (long *, long *, long *) );
	Xextern long    *P_setxor    PP( (long *, long *, long *) );
	Xextern int      P_inset     PP( (unsigned, long *) );
	Xextern int      P_setequal  PP( (long *, long *) );
	Xextern int      P_subset    PP( (long *, long *) );
	Xextern long    *P_addset    PP( (long *, unsigned) );
	Xextern long    *P_addsetr   PP( (long *, unsigned, unsigned) );
	Xextern long    *P_remset    PP( (long *, unsigned) );
	Xextern long    *P_setcpy    PP( (long *, long *) );
	Xextern long    *P_expset    PP( (long *, long) );
	Xextern long     P_packset   PP( (long *) );
	Xextern int      P_getcmdline PP( (int l, int h, Char *line) );
	Xextern Void     TimeStamp   PP( (int *Day, int *Month, int *Year,
	X				 int *Hour, int *Min, int *Sec) );
	Xextern Void	P_sun_argv  PP( (char *, int, int) );
	X
	X
	X/* I/O error handling */
	X#define _CHKIO(cond,ior,val,def)  ((cond) ? P_ioresult=0,(val)  \
	X					  : P_ioresult=(ior),(def))
	X#define _SETIO(cond,ior)          (P_ioresult = (cond) ? 0 : (ior))
	X
	X/* Following defines are suitable for the HP Pascal operating system */
	X#define FileNotFound     10
	X#define FileNotOpen      13
	X#define FileWriteError   38
	X#define BadInputFormat   14
	X#define EndOfFile        30
	X
	X/* Creating temporary files */
	X#if (defined(BSD) || defined(NO_TMPFILE)) && !defined(HAVE_TMPFILE)
	X# define tmpfile()  (fopen(tmpnam(NULL), "w+"))
	X#endif
	X
	X/* File buffers */
	X#define FILEBUF(f,sc,type) sc int __CAT__(f,_BFLAGS);   \
	X			   sc type __CAT__(f,_BUFFER)
	X
	X#define RESETBUF(f,type)   (__CAT__(f,_BFLAGS) = 1)
	X#define SETUPBUF(f,type)   (__CAT__(f,_BFLAGS) = 0)
	X
	X#define GETFBUF(f,type)    (*((__CAT__(f,_BFLAGS) == 1 &&   \
	X			       ((__CAT__(f,_BFLAGS) = 2),   \
	X				fread(&__CAT__(f,_BUFFER),  \
	X				      sizeof(type),1,(f)))),\
	X			      &__CAT__(f,_BUFFER)))
	X#define AGETFBUF(f,type)   ((__CAT__(f,_BFLAGS) == 1 &&   \
	X			     ((__CAT__(f,_BFLAGS) = 2),   \
	X			      fread(&__CAT__(f,_BUFFER),  \
	X				    sizeof(type),1,(f)))),\
	X			    __CAT__(f,_BUFFER))
	X
	X#define PUTFBUF(f,type,v)  (GETFBUF(f,type) = (v))
	X#define CPUTFBUF(f,v)      (PUTFBUF(f,char,v))
	X#define APUTFBUF(f,type,v) (memcpy(GETFBUF(f,type), (v),  \
	X				   sizeof(__CAT__(f,_BUFFER))))
	X
	X#define GET(f,type)        (__CAT__(f,_BFLAGS) == 1 ?   \
	X			    fread(&__CAT__(f,_BUFFER),sizeof(type),1,(f)) :  \
	X			    (__CAT__(f,_BFLAGS) = 1))
	X
	X#define PUT(f,type)        (fwrite(&__CAT__(f,_BUFFER),sizeof(type),1,(f)),  \
	X			    (__CAT__(f,_BFLAGS) = 0))
	X#define CPUT(f)            (PUT(f,char))
	X
	X#define BUFEOF(f)	   (__CAT__(f,_BFLAGS) != 2 && P_eof(f))
	X#define BUFFPOS(f)	   (ftell(f) - (__CAT__(f,_BFLAGS) == 2))
	X
	Xtypedef struct {
	X    FILE *f;
	X    FILEBUF(f,,Char);
	X    Char name[_FNSIZE];
	X} _TEXT;
	X
	X/* Memory allocation */
	X#ifdef __GCC__
	X# define Malloc(n)  (malloc(n) ?: (Anyptr)_OutMem())
	X#else
	Xextern Anyptr __MallocTemp__;
	X# define Malloc(n)  ((__MallocTemp__ = malloc(n)) ? __MallocTemp__ : (Anyptr)_OutMem())
	X#endif
	X#define FreeR(p)    (free((Anyptr)(p)))    /* used if arg is an rvalue */
	X#define Free(p)     (free((Anyptr)(p)), (p)=NULL)
	X
	X/* sign extension */
	X#define SEXT(x,n)   ((x) | -(((x) & (1L<<((n)-1))) << 1))
	X
	X/* packed arrays */   /* BEWARE: these are untested! */
	X#define P_getbits_UB(a,i,n,L)   ((int)((a)[(i)>>(L)-(n)] >>   \
	X				       (((~(i))&((1<<(L)-(n))-1)) << (n)) &  \
	X				       (1<<(1<<(n)))-1))
	X
	X#define P_getbits_SB(a,i,n,L)   ((int)((a)[(i)>>(L)-(n)] <<   \
	X				       (16 - ((((~(i))&((1<<(L)-(n))-1))+1) <<\
	X					      (n)) >> (16-(1<<(n))))))
	X
	X#define P_putbits_UB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |=   \
	X				 (x) << (((~(i))&((1<<(L)-(n))-1)) << (n)))
	X
	X#define P_putbits_SB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |=   \
	X				 ((x) & (1<<(1<<(n)))-1) <<   \
	X				 (((~(i))&((1<<(L)-(n))-1)) << (n)))
	X
	X#define P_clrbits_B(a,i,n,L)    ((a)[(i)>>(L)-(n)] &=   \
	X				 ~( ((1<<(1<<(n)))-1) <<   \
	X				   (((~(i))&((1<<(L)-(n))-1)) << (n))) )
	X
	X/* small packed arrays */
	X#define P_getbits_US(v,i,n)     ((int)((v) >> ((i)<<(n)) & (1<<(1<<(n)))-1))
	X#define P_getbits_SS(v,i,n)     ((int)((long)(v) << (SETBITS - (((i)+1) << (n))) >> (SETBITS-(1<<(n)))))
	X#define P_putbits_US(v,i,x,n)   ((v) |= (x) << ((i) << (n)))
	X#define P_putbits_SS(v,i,x,n)   ((v) |= ((x) & (1<<(1<<(n)))-1) << ((i)<<(n)))
	X#define P_clrbits_S(v,i,n)      ((v) &= ~( ((1<<(1<<(n)))-1) << ((i)<<(n)) ))
	X
	X#define P_max(a,b)   ((a) > (b) ? (a) : (b))
	X#define P_min(a,b)   ((a) < (b) ? (a) : (b))
	X
	X
	X/* Fix toupper/tolower on Suns and other stupid BSD systems */
	X#ifdef toupper
	X# undef toupper
	X# undef tolower
	X# define toupper(c)   my_toupper(c)
	X# define tolower(c)   my_tolower(c)
	X#endif
	X
	X#ifndef _toupper
	X# if 'A' == 65 && 'a' == 97
	X#  define _toupper(c)  ((c)-'a'+'A')
	X#  define _tolower(c)  ((c)-'A'+'a')
	X# else
	X#  define _toupper(c)  toupper(c)
	X#  define _tolower(c)  tolower(c)
	X# endif
	X#endif
	X
	X
	X#endif    /* P2C_H */
	X
	X
	X
	X/* End. */
	X
	X
SHAR_EOF
if test 11337 -ne "`wc -c < 'p2c.h'`"
then
	echo shar: "error transmitting 'p2c.h'" '(should have been 11337 characters)'
fi
fi
echo shar: "extracting 'p2clib.c'" '(16729 characters)'
if test -f 'p2clib.c'
then
	echo shar: "will not over-write existing file 'p2clib.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'p2clib.c'
	X
	X/* Run-time library for use with "p2c", the Pascal to C translator */
	X
	X/* "p2c"  Copyright (C) 1989 Dave Gillespie.
	X * This file may be copied, modified, etc. in any way.  It is not restricted
	X * by the licence agreement accompanying p2c itself.
	X */
	X
	X
	X
	X#include "p2c.h"
	X
	X
	X/* #define LACK_LABS     */   /* Define these if necessary */
	X/* #define LACK_MEMMOVE  */
	X
	X
	X#ifndef NO_TIME
	X# include <time.h>
	X#endif
	X
	X
	X#define Isspace(c)  isspace(c)      /* or "((c) == ' ')" if preferred */
	X
	X
	X
	X
	Xint P_argc;
	Xchar **P_argv;
	X
	Xshort P_escapecode;
	Xint P_ioresult;
	X
	Xlong EXCP_LINE;    /* Used by Pascal workstation system */
	X
	XAnyptr __MallocTemp__;
	X
	X__p2c_jmp_buf *__top_jb;
	X
	X
	X
	X
	Xvoid PASCAL_MAIN(argc, argv)
	Xint argc;
	Xchar **argv;
	X{
	X    P_argc = argc;
	X    P_argv = argv;
	X    __top_jb = NULL;
	X
	X#ifdef LOCAL_INIT
	X    LOCAL_INIT();
	X#endif
	X}
	X
	X
	X
	X
	X
	X/* In case your system lacks these... */
	X
	X#ifdef LACK_LABS
	Xlong labs(x)
	Xlong x;
	X{
	X    return((x > 0) ? x : -x);
	X}
	X#endif
	X
	X
	X#ifdef LACK_MEMMOVE
	XAnyptr memmove(d, s, n)
	XAnyptr d, s;
	Xregister long n;
	X{
	X    if (d < s || d - s >= n) {
	X	memcpy(d, s, n);
	X	return d;
	X    } else if (n > 0) {
	X	register char *dd = d + n, *ss = s + n;
	X	while (--n >= 0)
	X	    *--dd = *--ss;
	X    }
	X    return d;
	X}
	X#endif
	X
	X
	Xint my_toupper(c)
	Xint c;
	X{
	X    if (islower(c))
	X	return _toupper(c);
	X    else
	X	return c;
	X}
	X
	X
	Xint my_tolower(c)
	Xint c;
	X{
	X    if (isupper(c))
	X	return _tolower(c);
	X    else
	X	return c;
	X}
	X
	X
	X
	X
	Xlong ipow(a, b)
	Xlong a, b;
	X{
	X    long v;
	X
	X    if (a == 0 || a == 1)
	X	return a;
	X    if (a == -1)
	X	return (b & 1) ? -1 : 1;
	X    if (b < 0)
	X	return 0;
	X    if (a == 2)
	X	return 1 << b;
	X    v = (b & 1) ? a : 1;
	X    while ((b >>= 1) > 0) {
	X	a *= a;
	X	if (b & 1)
	X	    v *= a;
	X    }
	X    return v;
	X}
	X
	X
	X
	X
	X/* Common string functions: */
	X
	X/* Store in "ret" the substring of length "len" starting from "pos" (1-based).
	X   Store a shorter or null string if out-of-range.  Return "ret". */
	X
	Xchar *strsub(ret, s, pos, len)
	Xregister char *ret, *s;
	Xregister int pos, len;
	X{
	X    register char *s2;
	X
	X    if (--pos < 0 || len <= 0) {
	X        *ret = 0;
	X        return ret;
	X    }
	X    while (pos > 0) {
	X        if (!*s++) {
	X            *ret = 0;
	X            return ret;
	X        }
	X        pos--;
	X    }
	X    s2 = ret;
	X    while (--len >= 0) {
	X        if (!(*s2++ = *s++))
	X            return ret;
	X    }
	X    *s2 = 0;
	X    return ret;
	X}
	X
	X
	X/* Return the index of the first occurrence of "pat" as a substring of "s",
	X   starting at index "pos" (1-based).  Result is 1-based, 0 if not found. */
	X
	Xint strpos2(s, pat, pos)
	Xchar *s;
	Xregister char *pat;
	Xregister int pos;
	X{
	X    register char *cp, ch;
	X    register int slen;
	X
	X    if (--pos < 0)
	X        return 0;
	X    slen = strlen(s) - pos;
	X    cp = s + pos;
	X    if (!(ch = *pat++))
	X        return 0;
	X    pos = strlen(pat);
	X    slen -= pos;
	X    while (--slen >= 0) {
	X        if (*cp++ == ch && !strncmp(cp, pat, pos))
	X            return cp - s;
	X    }
	X    return 0;
	X}
	X
	X
	X/* Case-insensitive version of strcmp. */
	X
	Xint strcicmp(s1, s2)
	Xregister char *s1, *s2;
	X{
	X    register unsigned char c1, c2;
	X
	X    while (*s1) {
	X	if (*s1++ != *s2++) {
	X	    if (!s2[-1])
	X		return 1;
	X	    c1 = toupper(s1[-1]);
	X	    c2 = toupper(s2[-1]);
	X	    if (c1 != c2)
	X		return c1 - c2;
	X	}
	X    }
	X    if (*s2)
	X	return -1;
	X    return 0;
	X}
	X
	X
	X
	X
	X/* HP and Turbo Pascal string functions: */
	X
	X/* Trim blanks at left end of string. */
	X
	Xchar *strltrim(s)
	Xregister char *s;
	X{
	X    while (Isspace(*s++)) ;
	X    return s - 1;
	X}
	X
	X
	X/* Trim blanks at right end of string. */
	X
	Xchar *strrtrim(s)
	Xregister char *s;
	X{
	X    register char *s2 = s;
	X
	X    while (*++s2) ;
	X    while (s2 > s && Isspace(*--s2))
	X        *s2 = 0;
	X    return s;
	X}
	X
	X
	X/* Store in "ret" "num" copies of string "s".  Return "ret". */
	X
	Xchar *strrpt(ret, s, num)
	Xchar *ret;
	Xregister char *s;
	Xregister int num;
	X{
	X    register char *s2 = ret;
	X    register char *s1;
	X
	X    while (--num >= 0) {
	X        s1 = s;
	X        while ((*s2++ = *s1++)) ;
	X        s2--;
	X    }
	X    return ret;
	X}
	X
	X
	X/* Store in "ret" string "s" with enough pad chars added to reach "size". */
	X
	Xchar *strpad(ret, s, padchar, num)
	Xchar *ret;
	Xregister char *s;
	Xregister int padchar, num;
	X{
	X    register char *d = ret;
	X
	X    if (s == d) {
	X	while (*d++) ;
	X    } else {
	X	while ((*d++ = *s++)) ;
	X    }
	X    num -= (--d - ret);
	X    while (--num >= 0)
	X	*d++ = padchar;
	X    *d = 0;
	X    return ret;
	X}
	X
	X
	X/* Copy the substring of length "len" from index "spos" of "s" (1-based)
	X   to index "dpos" of "d", lengthening "d" if necessary.  Length and
	X   indices must be in-range. */
	X
	Xvoid strmove(len, s, spos, d, dpos)
	Xregister char *s, *d;
	Xregister int len, spos, dpos;
	X{
	X    s += spos - 1;
	X    d += dpos - 1;
	X    while (*d && --len >= 0)
	X	*d++ = *s++;
	X    if (len > 0) {
	X	while (--len >= 0)
	X	    *d++ = *s++;
	X	*d = 0;
	X    }
	X}
	X
	X
	X/* Delete the substring of length "len" at index "pos" from "s".
	X   Delete less if out-of-range. */
	X
	Xvoid strdelete(s, pos, len)
	Xregister char *s;
	Xregister int pos, len;
	X{
	X    register int slen;
	X
	X    if (--pos < 0)
	X        return;
	X    slen = strlen(s) - pos;
	X    if (slen <= 0)
	X        return;
	X    s += pos;
	X    if (slen <= len) {
	X        *s = 0;
	X        return;
	X    }
	X    while ((*s = s[len])) s++;
	X}
	X
	X
	X/* Insert string "src" at index "pos" of "dst". */
	X
	Xvoid strinsert(src, dst, pos)
	Xregister char *src, *dst;
	Xregister int pos;
	X{
	X    register int slen, dlen;
	X
	X    if (--pos < 0)
	X        return;
	X    dlen = strlen(dst);
	X    dst += dlen;
	X    dlen -= pos;
	X    if (dlen <= 0) {
	X        strcpy(dst, src);
	X        return;
	X    }
	X    slen = strlen(src);
	X    do {
	X        dst[slen] = *dst;
	X        --dst;
	X    } while (--dlen >= 0);
	X    dst++;
	X    while (--slen >= 0)
	X        *dst++ = *src++;
	X}
	X
	X
	X
	X
	X/* File functions */
	X
	X/* Peek at next character of input stream; return EOF at end-of-file. */
	X
	Xint P_peek(f)
	XFILE *f;
	X{
	X    int ch;
	X
	X    ch = getc(f);
	X    if (ch == EOF)
	X	return EOF;
	X    ungetc(ch, f);
	X    return (ch == '\n') ? ' ' : ch;
	X}
	X
	X
	X/* Check if at end of file, using Pascal "eof" semantics.  End-of-file for
	X   stdin is broken; remove the special case for it to be broken in a
	X   different way. */
	X
	Xint P_eof(f)
	XFILE *f;
	X{
	X    register int ch;
	X
	X    if (feof(f))
	X	return 1;
	X    if (f == stdin)
	X	return 0;    /* not safe to look-ahead on the keyboard! */
	X    ch = getc(f);
	X    if (ch == EOF)
	X	return 1;
	X    ungetc(ch, f);
	X    return 0;
	X}
	X
	X
	X/* Check if at end of line (or end of entire file). */
	X
	Xint P_eoln(f)
	XFILE *f;
	X{
	X    register int ch;
	X
	X    ch = getc(f);
	X    if (ch == EOF)
	X        return 1;
	X    ungetc(ch, f);
	X    return (ch == '\n');
	X}
	X
	X
	X/* Read a packed array of characters from a file. */
	X
	XVoid P_readpaoc(f, s, len)
	XFILE *f;
	Xchar *s;
	Xint len;
	X{
	X    int ch;
	X
	X    for (;;) {
	X	if (len <= 0)
	X	    return;
	X	ch = getc(f);
	X	if (ch == EOF || ch == '\n')
	X	    break;
	X	*s++ = ch;
	X	--len;
	X    }
	X    while (--len >= 0)
	X	*s++ = ' ';
	X    if (ch != EOF)
	X	ungetc(ch, f);
	X}
	X
	XVoid P_readlnpaoc(f, s, len)
	XFILE *f;
	Xchar *s;
	Xint len;
	X{
	X    int ch;
	X
	X    for (;;) {
	X	ch = getc(f);
	X	if (ch == EOF || ch == '\n')
	X	    break;
	X	if (len > 0) {
	X	    *s++ = ch;
	X	    --len;
	X	}
	X    }
	X    while (--len >= 0)
	X	*s++ = ' ';
	X}
	X
	X
	X/* Compute maximum legal "seek" index in file (0-based). */
	X
	Xlong P_maxpos(f)
	XFILE *f;
	X{
	X    long savepos = ftell(f);
	X    long val;
	X
	X    if (fseek(f, 0L, SEEK_END))
	X        return -1;
	X    val = ftell(f);
	X    if (fseek(f, savepos, SEEK_SET))
	X        return -1;
	X    return val;
	X}
	X
	X
	X/* Use packed array of char for a file name. */
	X
	Xchar *P_trimname(fn, len)
	Xregister char *fn;
	Xregister int len;
	X{
	X    static char fnbuf[256];
	X    register char *cp = fnbuf;
	X    
	X    while (--len >= 0 && *fn && !isspace(*fn))
	X	*cp++ = *fn++;
	X    return fnbuf;
	X}
	X
	X
	X
	X
	X/* Pascal's "memavail" doesn't make much sense in Unix with virtual memory.
	X   We fix memory size as 10Meg as a reasonable compromise. */
	X
	Xlong memavail()
	X{
	X    return 10000000;            /* worry about this later! */
	X}
	X
	Xlong maxavail()
	X{
	X    return memavail();
	X}
	X
	X
	X
	X
	X/* Sets are stored as an array of longs.  S[0] is the size of the set;
	X   S[N] is the N'th 32-bit chunk of the set.  S[0] equals the maximum
	X   I such that S[I] is nonzero.  S[0] is zero for an empty set.  Within
	X   each long, bits are packed from lsb to msb.  The first bit of the
	X   set is the element with ordinal value 0.  (Thus, for a "set of 5..99",
	X   the lowest five bits of the first long are unused and always zero.) */
	X
	X/* (Sets with 32 or fewer elements are normally stored as plain longs.) */
	X
	Xlong *P_setunion(d, s1, s2)         /* d := s1 + s2 */
	Xregister long *d, *s1, *s2;
	X{
	X    long *dbase = d++;
	X    register int sz1 = *s1++, sz2 = *s2++;
	X    while (sz1 > 0 && sz2 > 0) {
	X        *d++ = *s1++ | *s2++;
	X	sz1--, sz2--;
	X    }
	X    while (--sz1 >= 0)
	X	*d++ = *s1++;
	X    while (--sz2 >= 0)
	X	*d++ = *s2++;
	X    *dbase = d - dbase - 1;
	X    return dbase;
	X}
	X
	X
	Xlong *P_setint(d, s1, s2)           /* d := s1 * s2 */
	Xregister long *d, *s1, *s2;
	X{
	X    long *dbase = d++;
	X    register int sz1 = *s1++, sz2 = *s2++;
	X    while (--sz1 >= 0 && --sz2 >= 0)
	X        *d++ = *s1++ & *s2++;
	X    while (--d > dbase && !*d) ;
	X    *dbase = d - dbase;
	X    return dbase;
	X}
	X
	X
	Xlong *P_setdiff(d, s1, s2)          /* d := s1 - s2 */
	Xregister long *d, *s1, *s2;
	X{
	X    long *dbase = d++;
	X    register int sz1 = *s1++, sz2 = *s2++;
	X    while (--sz1 >= 0 && --sz2 >= 0)
	X        *d++ = *s1++ & ~*s2++;
	X    if (sz1 >= 0) {
	X        while (sz1-- >= 0)
	X            *d++ = *s1++;
	X    }
	X    while (--d > dbase && !*d) ;
	X    *dbase = d - dbase;
	X    return dbase;
	X}
	X
	X
	Xlong *P_setxor(d, s1, s2)         /* d := s1 / s2 */
	Xregister long *d, *s1, *s2;
	X{
	X    long *dbase = d++;
	X    register int sz1 = *s1++, sz2 = *s2++;
	X    while (sz1 > 0 && sz2 > 0) {
	X        *d++ = *s1++ ^ *s2++;
	X	sz1--, sz2--;
	X    }
	X    while (--sz1 >= 0)
	X	*d++ = *s1++;
	X    while (--sz2 >= 0)
	X	*d++ = *s2++;
	X    *dbase = d - dbase - 1;
	X    return dbase;
	X}
	X
	X
	Xint P_inset(val, s)                 /* val IN s */
	Xregister unsigned val;
	Xregister long *s;
	X{
	X    register int bit;
	X    bit = val % SETBITS;
	X    val /= SETBITS;
	X    if (val < *s++ && ((1<<bit) & s[val]))
	X	return 1;
	X    return 0;
	X}
	X
	X
	Xlong *P_addset(s, val)              /* s := s + [val] */
	Xregister long *s;
	Xregister unsigned val;
	X{
	X    register long *sbase = s;
	X    register int bit, size;
	X    bit = val % SETBITS;
	X    val /= SETBITS;
	X    size = *s;
	X    if (++val > size) {
	X        s += size;
	X        while (val > size)
	X            *++s = 0, size++;
	X        *sbase = size;
	X    } else
	X        s += val;
	X    *s |= 1<<bit;
	X    return sbase;
	X}
	X
	X
	Xlong *P_addsetr(s, v1, v2)              /* s := s + [v1..v2] */
	Xregister long *s;
	Xregister unsigned v1, v2;
	X{
	X    register long *sbase = s;
	X    register int b1, b2, size;
	X    if (v1 > v2)
	X	return sbase;
	X    b1 = v1 % SETBITS;
	X    v1 /= SETBITS;
	X    b2 = v2 % SETBITS;
	X    v2 /= SETBITS;
	X    size = *s;
	X    v1++;
	X    if (++v2 > size) {
	X        while (v2 > size)
	X            s[++size] = 0;
	X        s[v2] = 0;
	X        *s = v2;
	X    }
	X    s += v1;
	X    if (v1 == v2) {
	X        *s |= (~((-2)<<(b2-b1))) << b1;
	X    } else {
	X        *s++ |= (-1) << b1;
	X        while (++v1 < v2)
	X            *s++ = -1;
	X        *s |= ~((-2) << b2);
	X    }
	X    return sbase;
	X}
	X
	X
	Xlong *P_remset(s, val)              /* s := s - [val] */
	Xregister long *s;
	Xregister unsigned val;
	X{
	X    register int bit;
	X    bit = val % SETBITS;
	X    val /= SETBITS;
	X    if (++val <= *s)
	X	s[val] &= ~(1<<bit);
	X    return s;
	X}
	X
	X
	Xint P_setequal(s1, s2)              /* s1 = s2 */
	Xregister long *s1, *s2;
	X{
	X    register int size = *s1++;
	X    if (*s2++ != size)
	X        return 0;
	X    while (--size >= 0) {
	X        if (*s1++ != *s2++)
	X            return 0;
	X    }
	X    return 1;
	X}
	X
	X
	Xint P_subset(s1, s2)                /* s1 <= s2 */
	Xregister long *s1, *s2;
	X{
	X    register int sz1 = *s1++, sz2 = *s2++;
	X    if (sz1 > sz2)
	X        return 0;
	X    while (--sz1 >= 0) {
	X        if (*s1++ & ~*s2++)
	X            return 0;
	X    }
	X    return 1;
	X}
	X
	X
	Xlong *P_setcpy(d, s)                /* d := s */
	Xregister long *d, *s;
	X{
	X    register long *save_d = d;
	X
	X#ifdef SETCPY_MEMCPY
	X    memcpy(d, s, (*s + 1) * sizeof(long));
	X#else
	X    register int i = *s + 1;
	X    while (--i >= 0)
	X        *d++ = *s++;
	X#endif
	X    return save_d;
	X}
	X
	X
	X/* s is a "smallset", i.e., a 32-bit or less set stored
	X   directly in a long. */
	X
	Xlong *P_expset(d, s)                /* d := s */
	Xregister long *d;
	Xlong s;
	X{
	X    if ((d[1] = s))
	X        *d = 1;
	X    else
	X        *d = 0;
	X    return d;
	X}
	X
	X
	Xlong P_packset(s)                   /* convert s to a small-set */
	Xregister long *s;
	X{
	X    if (*s++)
	X        return *s;
	X    else
	X        return 0;
	X}
	X
	X
	X
	X
	X
	X/* Oregon Software Pascal extensions, courtesy of William Bader */
	X
	Xint P_getcmdline(l, h, line)
	Xint l, h;
	XChar *line;
	X{
	X    int i, len;
	X    char *s;
	X    
	X    h = h - l + 1;
	X    len = 0;
	X    for(i = 1; i < P_argc; i++) {
	X	s = P_argv[i];
	X	while (*s) {
	X	    if (len >= h) return len;
	X	    line[len++] = *s++;
	X	}
	X	if (len >= h) return len;
	X	line[len++] = ' ';
	X    }
	X    return len;
	X}
	X
	XVoid TimeStamp(Day, Month, Year, Hour, Min, Sec)
	Xint *Day, *Month, *Year, *Hour, *Min, *Sec;
	X{
	X#ifndef NO_TIME
	X    struct tm *tm;
	X    long clock;
	X
	X    time(&clock);
	X    tm = localtime(&clock);
	X    *Day = tm->tm_mday;
	X    *Month = tm->tm_mon + 1;		/* Jan = 0 */
	X    *Year = tm->tm_year;
	X    if (*Year < 1900)
	X	*Year += 1900;     /* year since 1900 */
	X    *Hour = tm->tm_hour;
	X    *Min = tm->tm_min;
	X    *Sec = tm->tm_sec;
	X#endif
	X}
	X
	X
	X
	X
	X/* SUN Berkeley Pascal extensions */
	X
	XVoid P_sun_argv(s, len, n)
	Xregister char *s;
	Xregister int len, n;
	X{
	X    register char *cp;
	X
	X    if ((unsigned)n < P_argc)
	X	cp = P_argv[n];
	X    else
	X	cp = "";
	X    while (*cp && --len >= 0)
	X	*s++ = *cp++;
	X    while (--len >= 0)
	X	*s++ = ' ';
	X}
	X
	X
	X
	X
	Xint _OutMem()
	X{
	X    return _Escape(-2);
	X}
	X
	Xint _CaseCheck()
	X{
	X    return _Escape(-9);
	X}
	X
	Xint _NilCheck()
	X{
	X    return _Escape(-3);
	X}
	X
	X
	X
	X
	X
	X/* The following is suitable for the HP Pascal operating system.
	X   It might want to be revised when emulating another system. */
	X
	Xchar *_ShowEscape(buf, code, ior, prefix)
	Xchar *buf, *prefix;
	Xint code, ior;
	X{
	X    char *bufp;
	X
	X    if (prefix && *prefix) {
	X        strcpy(buf, prefix);
	X	strcat(buf, ": ");
	X        bufp = buf + strlen(buf);
	X    } else {
	X        bufp = buf;
	X    }
	X    if (code == -10) {
	X        sprintf(bufp, "Pascal system I/O error %d", ior);
	X        switch (ior) {
	X            case 3:
	X                strcat(buf, " (illegal I/O request)");
	X                break;
	X            case 7:
	X                strcat(buf, " (bad file name)");
	X                break;
	X            case FileNotFound:   /*10*/
	X                strcat(buf, " (file not found)");
	X                break;
	X            case FileNotOpen:    /*13*/
	X                strcat(buf, " (file not open)");
	X                break;
	X            case BadInputFormat: /*14*/
	X                strcat(buf, " (bad input format)");
	X                break;
	X            case 24:
	X                strcat(buf, " (not open for reading)");
	X                break;
	X            case 25:
	X                strcat(buf, " (not open for writing)");
	X                break;
	X            case 26:
	X                strcat(buf, " (not open for direct access)");
	X                break;
	X            case 28:
	X                strcat(buf, " (string subscript out of range)");
	X                break;
	X            case EndOfFile:      /*30*/
	X                strcat(buf, " (end-of-file)");
	X                break;
	X            case FileWriteError: /*38*/
	X		strcat(buf, " (file write error)");
	X		break;
	X        }
	X    } else {
	X        sprintf(bufp, "Pascal system error %d", code);
	X        switch (code) {
	X            case -2:
	X                strcat(buf, " (out of memory)");
	X                break;
	X            case -3:
	X                strcat(buf, " (reference to NIL pointer)");
	X                break;
	X            case -4:
	X                strcat(buf, " (integer overflow)");
	X                break;
	X            case -5:
	X                strcat(buf, " (divide by zero)");
	X                break;
	X            case -6:
	X                strcat(buf, " (real math overflow)");
	X                break;
	X            case -8:
	X                strcat(buf, " (value range error)");
	X                break;
	X            case -9:
	X                strcat(buf, " (CASE value range error)");
	X                break;
	X            case -12:
	X                strcat(buf, " (bus error)");
	X                break;
	X            case -20:
	X                strcat(buf, " (stopped by user)");
	X                break;
	X        }
	X    }
	X    return buf;
	X}
	X
	X
	Xint _Escape(code)
	Xint code;
	X{
	X    char buf[100];
	X
	X    P_escapecode = code;
	X    if (__top_jb) {
	X	__p2c_jmp_buf *jb = __top_jb;
	X	__top_jb = jb->next;
	X	longjmp(jb->jbuf, 1);
	X    }
	X    if (code == 0)
	X        exit(0);
	X    if (code == -1)
	X        exit(1);
	X    fprintf(stderr, "%s\n", _ShowEscape(buf, P_escapecode, P_ioresult, ""));
	X    exit(1);
	X}
	X
	Xint _EscIO(code)
	Xint code;
	X{
	X    P_ioresult = code;
	X    return _Escape(-10);
	X}
	X
	X
	X
	X
	X/* End. */
	X
	X
	X
SHAR_EOF
if test 16729 -ne "`wc -c < 'p2clib.c'`"
then
	echo shar: "error transmitting 'p2clib.c'" '(should have been 16729 characters)'
fi
fi
exit 0
#	End of shell archive
--
Glenn Geers                       | "So when it's over, we're back to people.
Department of Theoretical Physics |  Just to prove that human touch can have
The University of Sydney          |  no equal."
Sydney NSW 2006 Australia         |  - Basia Trzetrzelewska, 'Prime Time TV'

glenn@extro.ucc.su.oz.au (Glenn Geers) (08/08/90)

#! /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:
#	wp2l-nl.tex
#	wp2latex.doc
#	wp2latex.msg
#	wp2latex.sty
#	wp2latex.tex
# This archive created: Wed Aug  8 21:48:02 1990
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'wp2l-nl.tex'" '(18575 characters)'
if test -f 'wp2l-nl.tex'
then
	echo shar: "will not over-write existing file 'wp2l-nl.tex'"
else
sed 's/^	X//' << \SHAR_EOF > 'wp2l-nl.tex'
	X\documentstyle[11pt,nl,wp2latex]{report}
	X
	X\newcommand{\pijl}{$\rightarrow$}
	X\renewcommand{\thechapter}{}
	X\renewcommand{\thesection}{\arabic{section}}
	X\renewcommand{\thefigure}{\arabic{figure}}
	X
	X\title{Handleiding bij het programma\\
	X \hspace{1cm}\\
	X       \WPtoLaTeX}
	X\author{R.C. Houtepen}
	X
	X\begin{document}
	X
	X\maketitle
	X
	X\newpage
	X
	X\pagenumbering{roman}
	X\tableofcontents
	X
	X\newpage
	X
	X\pagenumpos{\pnbc}
	X\pagenumbering{arabic}
	X
	X\section{Inleiding}
	X
	XHet programma \WPtoLaTeX\ biedt de mogelijkheid om dokumenten
	Xafkomstig van WordPerfect 5.0 te konverteren naar \LaTeX-invoerfiles.
	XHet programma is geschreven in het kader van een stageopdracht uitgevoerd
	Xbij het Rekencentrum van de Technische Universiteit Eindhoven.
	XDe gebruikte programmeertaal is Turbo Pascal 5.0.\\
	X\\
	XHet projecteren van een bepaalde wereld (WordPerfect = tekstverwerking)
	Xop een andere wereld (\LaTeX\ = typesetting) vraagt om enige
	Xdiscipline van de gebruiker. \\
	XOmdat het gebruik van \LaTeX\ aan strikte regels gebonden
	Xis, moeten we, willen we het WordPerfect 5.0 dokument zo goed mogelijk
	Xkonverteren, bij het gebruik van WordPerfect rekening houden met
	Xdeze regels.
	XIn deze handleiding wordt op deze regels ingegaan.\\
	X
	X\newpage
	X
	X\section{De konversiemogelijkheden}
	X\label{mogelijk}
	X
	XOmdat de mogelijkheden en eigenschappen van WordPerfect en
	X\LaTeX\ sterk uiteen lopen, kunnen niet alle WordPerfect `features'
	Xgekonverteerd worden.\\
	X\\
	XDe konversiemogelijkheden van \WPtoLaTeX\ zijn :\\
	X\begin{itemize}
	X  \item harde regelovergangen
	X  \item harde paginaovergangen
	X  \item de lettertypen :
	X    \begin{itemize}
	X      \item extra groot
	X      \item zeer groot
	X      \item groot
	X      \item klein
	X      \item zeer klein
	X      \item superscript
	X      \item subscript
	X      \item cursief
	X      \item kleine kapitalen
	X      \item vet
	X      \item onderstrepen
	X      \item dubbel onderstrepen
	X    \end{itemize}
	X  \item extended karakters (wel accenten, geen linedraw)
	X  \item overslag
	X  \item tabs :
	X    \begin{itemize}
	X      \item instelling
	X      \item linkertabs
	X      \item centertabs
	X      \item rechtertabs
	X    \end{itemize}
	X  \item rechts springen
	X  \item uitlijnen
	X  \item inspringen :
	X    \begin{itemize}
	X      \item links
	X      \item links en rechts
	X    \end{itemize}
	X  \item voetnoten
	X  \item  kop- en voetteksten
	X  \item paginanummerpositie
	X  \item uitvullen aan/uit
	X\end{itemize}
	X\nwln
	X{\bf Niet} gekonverteerd worden :
	X\begin{itemize}
	X  \item kantlijninstellingen
	X  \item krantestijlkolommen
	X  \item regelafstanden
	X  \item onder- en bovenmarge
	X  \item index
	X  \item referenties
	X  \item eindnoten
	X  \item inhoudsopgave
	X  \item grafische afbeeldingen
	X\end{itemize}
	X
	X\newpage
	X
	X\section{Werkregels}
	X
	X\subsection{Tabs}
	X
	XHet tab-stop kommando wordt gebruikt om stukken tekst exact te kunnen
	Xpositioneren, b.v. bij het maken van tabellen. We kunnen hier twee soorten
	Xkommando's onderscheiden. Allereerst zijn er de tab-instellingen. Hiermee
	Xwordt aangegeven {\em waar} de tabs moeten worden gepositioneerd.
	XDaarnaast zijn er de tab-stops, die aangeven dat er naar een bepaalde
	Xpositie {\em gesprongen} moet worden. Binnen \LaTeX\ kunnen tab-stops alleen binnen
	Xeen \verb|tabbing|-omgeving worden gebruikt. \WPtoLaTeX\ zorgt er voor
	Xdat alleen regels waar \'e\'en of meerdere tab-stops in voorkomen in
	Xzo'n \verb|tabbing|-omgeving worden gezet.\\
	X\\
	XBinnen WordPerfect dient een regel waarin tabs voorkomen afgesloten te worden
	Xmet een harde regelovergang. Is dit niet het geval, dan zullen de
	Xtab-posities in het gegenereerde \LaTeX-dokument niet vastliggen. \LaTeX\
	Xzal zulke regels foutief uitvullen.\\
	X
	XDe volgende WordPerfect-invoer zal foutief gekonverteerd worden :\\
	X
	X\begin{verbatim}
	X   Tekst1 [Tab] tekst2 [Tab] tekst3 [ZRt]
	X   tekst4 [Tab] tekst5. [HRt]
	X\end{verbatim}
	X\nwln
	X
	XBeter is :\\
	X
	X\begin{verbatim}
	X   Tekst1 [Tab] tekst2 [Tab] tekst3 [HRt]
	X   tekst4 [Tab] tekst5. [HRt]
	X\end{verbatim}
	X\nwln
	X
	XEen tab-instelling binnen een regel geldt voor de hele regel.
	XGeadviseerd wordt om tab-instellingen v\'o\'or een regel of vooraan
	Xin de desbetreffende regel te plaatsen.\\
	X\\
	X\\
	X{\bf Enkele restricties :}\\
	X\\
	XBij \LaTeX\ worden in een \verb|tabbing|-omgeving kommando's als \verb|\'|,
	X\verb|\`| en \verb|\=| gebruikt. Deze kommando's dienen
	Xbuiten een \verb|tabbing|-omgeving voor het plaatsen van accenten. Binnen een
	X\verb|tabbing|-omgeving moeten deze kommando's voor het plaatsen van
	Xaccenten vervangen worden door resp. \verb|\a'|, \verb|\a`| en \verb|\a=|.
	X\WPtoLaTeX\ houdt hier g\'{e}\'{e}n rekening mee.
	XDit betekent dat de gebruiker, n\'{a} de konversie, zelf deze kommando's
	Xdient te vervangen.\\
	X\\
	XBinnen WordPerfect 5.0 kunnen maximaal 40 tabs ingesteld worden.
	X\LaTeX\ kent maximaal 14 tabinstellingen. Dit heeft tot gevolg
	Xdat, wil men gaan konverteren, er binnen WordPerfect maximaal
	X14 tabs ingesteld mogen worden.\\
	XWorden er meer dan 14 tabs ingesteld, dan zal de verwerking door
	X\LaTeX\ resulteren in een aantal foutmeldingen met als uiteindelijke
	Xresultaat dat een aantal tabs worden genegeerd.\\
	X
	X\newpage
	X
	X\subsection{Inspringen}
	X\label{inspring}
	X
	XHet inspring kommando wordt gebruikt om de kantlijnen van
	Xstukken tekst (alinea's) te veranderen.\\
	XDe konversiemogelijkheden die met betrekking tot inspringen
	Xworden geboden zijn :\\
	X
	XVoorbeelden :\\
	X\\
	X\begin{tabbing}
	X\verb|   [|\pijl\verb|Inspr]|$^*$\verb|  |\=
	X        \verb|Een ingesprongen alinea die over [ZRt]| \\
	X     \> \verb|meerdere regels verspreid mag worden en [ZRt]| \\
	X     \> \verb|afgesloten wordt met een harde [ZRt]| \\
	X     \> \verb|regelovergang. [HRt]| \\
	X\end{tabbing}
	X\begin{tabbing}
	X\verb|   label  [|\pijl\verb|Inspr]|$^*$\verb|  |
	X  \= \verb|Zoals we hier zien bestaat de [ZRt]| \\
	X  \> \verb|mogelijkheid om een `label' voor [ZRt]| \\
	X  \> \verb|een ingesprongen tekst te plaatsen. [HRt]| \\
	X\end{tabbing}
	X\begin{tabbing}
	X\verb|   [|\pijl\verb|Inspr]|$^*$\verb|  label  [|\pijl\verb|Inspr]|$^*$\verb|  |
	X  \= \verb|Het is ook mogelijk om een [ZRt]| \\
	X  \> \verb|`ingesprongen label' voor [ZRt]| \\
	X  \> \verb|een ingesprongen tekst te plaatsen. [HRt]| \\
	X\end{tabbing}
	X
	X\nwln
	XWaarbij \verb|[|\pijl\verb|Inspr]|$^*$ overeenkomt met \'e\'en of meerdere
	X\verb|[|\pijl\verb|Inspr]| kommando's. \\
	X
	X\vspace{1cm}
	X
	X{\bf Opmerking :}\\
	X
	XHet is bij gebruik van \WPtoLaTeX\ {\bf niet} mogelijk bij inspringen
	Xm\'e\'er dan twee indentatieniveau's te konverteren.\\
	X
	X\newpage
	X
	X\subsection{Kombinaties van tabs en inspringen}
	X
	XIn de praktijk blijkt dat de tab-stop en inspring kommando's vaak
	Xdoor elkaar heen gebruikt worden. Het effect hiervan binnen
	XWordPerfect is vaak identiek : woorden komen op de plek waar
	Xmen ze hebben wil, zowel op het beeldscherm als uiteindelijk
	Xop papier (What You See Is What You Get).\\
	XBinnen \LaTeX\ is het verschil tussen tab-stops en inspring kommando's
	Xechter essentieel. Het is dan ook van belang dat de WordPerfect-gebruiker
	Xhier rekening mee houdt. Voor tab-stops mag dus alleen het
	X\verb|[Tab]| kommando gebruikt worden en voor inspringen alleen het
	X\verb|[|\pijl\verb|Inspr]| kommando.
	X\\
	XWorden echter tab-stop en inspring kommando's binnen \'e\'en regel
	Xdoor elkaar gebruikt, dan worden alleen de kommando's van het
	Xtype dat het eerst op de betreffende regel voorkomt gekonverteerd. \\
	X\\
	XEen voorbeeld:\\
	X\\
	X\begin{tabbing}
	X\verb|   [Tab] piet [Tab] jan [|\pijl\verb|Inspr] klaas [HRt]| \\
	X\end{tabbing}
	X
	XHier komt het tab-stop kommando eerder dan het inspring kommando op de
	Xregel voor. De interpretatie hiervan door \WPtoLaTeX\ is dan : \\
	X\\
	X\begin{tabbing}
	X\verb|   [Tab] piet [Tab] jan klaas [HRt]| \\
	X\end{tabbing}
	X
	XHet inspring kommando wordt genegeerd. De regel zou er als volgt uit
	Xmoeten zien :\\
	X\\
	X\begin{tabbing}
	X\verb|   [Tab] piet [Tab] jan [Tab] klaas [HRt]| \\
	X\end{tabbing}
	X
	X\newpage
	X
	X\subsection{Voetnoten}
	X
	XBinnen een voetnoot worden alleen regelovergangen en lettertypen
	X(zie \S~\ref{mogelijk}) gekonverteerd. Een voetnootnummer mag
	Xalleen uit cijfers bestaan.\\
	X\\
	XVoetnoten binnen regels waarin tab-stops voorkomen verschijnen
	Xbij \LaTeX, in tegenstelling tot WordPerfect, niet onderaan de pagina.
	XDit een beperking van \LaTeX.\\
	X\\
	X
	X\newpage
	X
	X\subsection{Kop- en voetteksten}
	X
	XBinnen een kop- of voettekst worden alleen lettertypen
	Xgekonverteerd (zie \S~\ref{mogelijk}). \\
	X\\
	XEen kop- of voettekst kan men indelen in drie stukken :
	X\begin{itemize}
	X  \item linksuitgelijnd
	X  \item gecentreerd
	X  \item rechtsuitgelijnd
	X\end{itemize}
	X\nwln
	XDeze drie delen dienen binnen WordPerfect gescheiden te worden door het
	Xcentreer kommando (Shift F6) en spring-rechts kommando (Alt F6).\\
	XHet effect van de WordPerfect kommando's voor de koptekst : \\
	X
	X\begin{verbatim}
	X   Links[Centr]Midden[C/U/SR/D][Spr rechts]Rechts
	X\end{verbatim}
	X\nwln
	Xzal na konversie door \LaTeX\ ge\"{\i}nterpreteerd worden als in
	Xfiguur~\ref{fig:koptekst} wordt weergegeven.
	XBij het kiezen van de pagina's waar de kop- of voettekst geplaatst moet
	Xworden, wordt bij het kiezen van alleen een even of oneven
	Xpagina de eerdere kop- of voettekst-instelling van de andere
	Xpagina niet be\"{\i}nvloed.\\
	X
	X\begin{figure}[hbt]
	X\centering
	X\setlength{\unitlength}{3mm}
	X\begin{picture}(12,16)
	X \thicklines
	X \put(0,0){\framebox(12,16)}
	X \put(1,14){\makebox(10,1)[l]{{\tiny Links}}}
	X \put(1,14){\makebox(10,1){{\tiny Midden}}}
	X \put(1,14){\makebox(10,1)[r]{{\tiny Rechts}}}
	X \put(1,12){\line(1,0){10}}
	X \put(1,11){\line(1,0){10}}
	X \put(1,10){\line(1,0){10}}
	X \put(1,9){\line(1,0){10}}
	X \put(1,8){\line(1,0){10}}
	X \put(1,7){\line(1,0){10}}
	X \put(1,6){\line(1,0){10}}
	X \put(1,5){\line(1,0){10}}
	X \put(1,4){\line(1,0){10}}
	X \put(1,3){\line(1,0){10}}
	X \put(1,2){\line(1,0){10}}
	X\end{picture}
	X\caption{kopteksten}
	X\label{fig:koptekst}
	X\end{figure}
	X
	X\newpage
	X
	X\subsection{Paginanummerpositie}
	X
	XHet WordPerfect-dokument wordt gekonverteerd naar een enkelzijdig
	Xdokument. Dit houdt in dat de paginanummerposities 4 en 8 niet
	Xgekonverteerd worden. De paginanummer-posities die door \WPtoLaTeX\
	Xgekonverteerd worden, worden in figuur~\ref{fig:pagnr} weergegeven.\\
	X
	X\begin{figure}[hbt]
	X\centering
	X\setlength{\unitlength}{3mm}
	X\begin{picture}(12,16)
	X \thicklines
	X \put(0,0){\framebox(12,16)}
	X \put(1,14){\makebox(10,1)[l]{1}}
	X \put(1,14){\makebox(10,1){2}}
	X \put(1,14){\makebox(10,1)[r]{3}}
	X \put(1,1){\makebox(10,1)[l]{5}}
	X \put(1,1){\makebox(10,1){6}}
	X \put(1,1){\makebox(10,1)[r]{7}}
	X\end{picture}
	X\caption{paginanummer posities}
	X\label{fig:pagnr}
	X\end{figure}
	X
	X\newpage
	X
	X\subsection{WordPerfect defaultwaarden}
	X
	XHet konversieprogramma genereert, onafhankelijk van de
	XWordPerfect-instellingen, een \LaTeX-bestand met een linkerkantlijn
	Xvan 2,54cm (1 inch). Deze wordt binnen het hele dokument gehandhaafd.
	XDit omdat \LaTeX\ zowel een minimale linkermarge als
	Xeen minimale bovenmarge van 2,54cm hanteert (zie figuur~\ref{fig:tabs}).
	XDit betekent dat \WPtoLaTeX\ er van uit gaat dat binnen het
	XWordPerfect-dokument de linkerkantlijn ook op 2,54cm ingesteld is
	Xen dat deze niet verandert. \\
	XTevens wordt er van een standaard tab-instelling uitgegaan van
	Xbeginnend met 2,54cm en vervolgens iedere 2,54cm (14 tab-stops).
	XEen afwijkende standaard tab-instelling kan vanaf de eerste
	Xregel geplaatst worden.\\
	X\\
	XWordt er niet aan de bovenstaande standaard instellingen
	Xvoldaan, dan kan dit leiden tot foutmeldingen bij de
	Xverwerking door \LaTeX. Dit heeft onder meer te maken met de manier
	Xwaarop WordPerfect de tab-stops positioneert en die waarop \LaTeX\
	Xdat doet (zie figuur~\ref{fig:tabs}). \LaTeX\ positioneert de tab-stops
	Xt.o.v. de linkermarge, die zoals gezegd minimaal 2,54cm breed is. Bij
	XWordPerfect zijn de linkermarge en de tab-posities onafhankelijk
	Xvan elkaar.\\
	X
	X\begin{figure}[hbt]
	X\centering
	X\setlength{\unitlength}{1.5mm}
	X\begin{picture}(60,50)
	X \thicklines
	X \put(0,0){\framebox(28,35)}
	X \put(32,0){\framebox(28,35)}
	X \thinlines
	X \put(0,37){\makebox(1,3)[l]{WordPerfect}}
	X \put(32,37){\makebox(1,3)[l]{\LaTeX}}
	X \put(36,31){\line(1,0){21}}
	X \put(36,31){\line(0,-1){28}}
	X \put(32,31){\vector(1,0){4}}
	X \put(36,31){\vector(-1,0){4}}
	X \put(36,31){\vector(0,1){4}}
	X \put(36,35){\vector(0,-1){4}}
	X \put(37,31){\makebox(1,4)[l]{{\small 1"}}}
	X \put(32,28){\makebox(4,2){{\small 1"}}}
	X \put(36,27){\vector(1,0){3}}
	X \put(40,27){\makebox(1,1)[tl]{{\scriptsize tab 1}}}
	X \put(36,25){\vector(1,0){6}}
	X \put(43,25){\makebox(1,1)[tl]{{\scriptsize tab 2}}}
	X \put(36,23){\vector(1,0){9}}
	X \put(46,23){\makebox(1,1)[tl]{{\scriptsize tab 3}}}
	X \put(4,31){\line(0,-1){28}}
	X \put(4,31){\line(1,0){21}}
	X \put(0,27){\vector(1,0){7}}
	X \put(8,27){\makebox(1,1)[tl]{{\scriptsize tab 1}}}
	X \put(0,25){\vector(1,0){10}}
	X \put(11,25){\makebox(1,1)[tl]{{\scriptsize tab 2}}}
	X \put(0,23){\vector(1,0){13}}
	X \put(14,23){\makebox(1,1)[tl]{{\scriptsize tab 3}}}
	X\end{picture}
	X\caption{tab-stop instellingen bij WordPerfect en \LaTeX}
	X\label{fig:tabs}
	X\end{figure}
	X
	X\newpage
	X
	X\subsection{Spaties}
	X
	XOmdat het gebruik van WordPerfect het visueel ontwerpen van een
	Xdokument in de hand werkt, hebben gebruikers vaak de neiging
	Xom met behulp van spaties voor een acceptabele layout te zorgen.
	XMeerdere spaties achter elkaar hebben binnen \LaTeX\ echter hetzelfde
	Xeffect als \'e\'en spatie.\\
	XBij het konverteren van een WordPerfect-bestand worden meerdere spaties
	Xna elkaar gekonverteerd naar `harde' \LaTeX-spaties. \\
	X
	XVoorbeeld : \\
	X
	X\begin{tabular}{|l|l|}
	X\hline
	XWordPerfect                & \LaTeX \rule[-.5cm]{0cm}{1.5cm} \\
	X\hline
	X\verb*|woord1    woord2|   & \verb*|woord1 ~~~woord2|\rule[-.5cm]{0cm}{1.5cm} \\
	X\hline
	X\end{tabular}
	X\nwln
	X
	XWanneer deze aan het begin van een regel voorkomen hebben ze echter
	Xg\'e\'en effect.
	XBovendien zal de layout die in het WordPerfect-bestand gebruikt wordt
	Xzelden in \LaTeX\ bereikt worden vanwege de afwijkende zetspiegel, 
	Xlettertypes en uitvulregels die \LaTeX\ hanteert.
	X
	X\newpage
	X
	X\section{Het programma}
	X
	XHet \WPtoLaTeX-pakket bevat de files :\\
	X
	X\begin{itemize}
	X  \item \verb|WP2LATEX.EXE| (het konversieprogramma)
	X  \item \verb|WP2LATEX.STY| (stijl-file nodig bij verwerking door \LaTeX)
	X  \item \verb|WP2LATEX.TEX| (deze handleiding in \LaTeX-opmaak)
	X  \item \verb|LEESME.BAT  | (batch-file met gebruikers-instrukties)
	X\end{itemize}
	X\nwln
	XHet programma wordt aangeroepen middels het kommando :\\
	X
	X\begin{verbatim}
	X   WP2LATEX [WP-filenaam.WPF]
	X\end{verbatim}
	X
	X\nwln
	XDe parameter \verb|WP-filenaam.WPF|\footnote{Dit mag een WordPefect 5.0 
	Xbestand zijn met een andere existentie dan \verb|.WPF|} is optioneel. 
	XHet programma start met een
	Xopeningsboodschap en vraagt om de WordPerfect filenaam. De default
	XWordPerfect-filenaam wordt tussen vierkante haken \mbox{(\verb|[ ]|)} 
	Xvermeld. Dit is de filenaam die eventueel als optionele parameter werd 
	Xmeegegeven bij de aanroep van \verb|WP2LATEX|. De gebruiker kan nu 
	Xalsnog een andere WordPerfect-filenaam intypen of hij kan middels return 
	Xvoor de default filenaam kiezen. Vervolgens vraagt het programma om de 
	Xfilenaam van het te genereren \LaTeX-dokument. Als default filenaam wordt
	Xde WordPerfect-filenaam met existentie \verb|.TEX| genomen. Deze filenaam 
	Xwordt weer tussen rechte haken weergegeven. Ook hier kan de gebruiker 
	Xvoor een afwijkende \LaTeX-filenaam\footnote{Dit mag een file zijn
	Xmet een andere existentie dan \verb|.TEX|} kiezen. Wanneer de filenamen zijn 
	Xingegeven kunnen de volgende foutmeldingen verschijnen :\\
	X
	X\begin{itemize}
	X  \item \Underline{File not found :} De opgegeven WordPerfect file is niet gevonden.
	X  \item \Underline{Path not found :} Bij het opgeven van de filenamen is een
	X        ongeldig pad opgegeven.
	X  \item \Underline{Not a WordPerfect 5.0 dokument :} De opgegeven WordPerfect file is
	X        niet afkomstig van WordPerfect 5.0
	X\end{itemize}
	X\nwln
	XDe konversie gebeurt in twee fasen. In de eerste fase wordt de 
	XWordPerfect-invoerfile byte voor byte ingelezen. Op grond hiervan worden de
	Xfiles \verb|WP-filenaam.STR| en \verb|WP_filenaam.TBL| aangemaakt.
	XIn \verb|WP-filenaam.STR| worden de karakters, tab-stops en overgangen
	Xvan lettertypes weergegeven. De file \verb|WP-filenaam.TBL| bevat gegevens
	Xover de verschillende \LaTeX\ omgevingen die geopend en gesloten
	Xmoeten worden.
	XIn de tweede fase worden deze files verwerkt tot \'e\'en \LaTeX-file.
	XNa een succesvolle konversie worden de files \verb|WP-filenaam.STR| en
	X\verb|WP-filenaam.TBL| automatisch gewist.\\
	X
	X\newpage
	X
	XBij een aanroep van \WPtoLaTeX\ om het WordPerfect 5.0 dokument
	X\verb|C:\WPTEST\TEST.WP5| te konverteren zal het volgende op het
	Xbeeldscherm verschijnen :\\
	X
	X\begin{verbatim}
	X
	X     Conversionprogram : From Wordperfect 5.0 to LaTeX  (WP2LATEX)
	X
	X  (c) TUE-Eindhoven ---- Made by R.C.Houtepen ---- Date : 24 Jan 1990
	X
	X
	XWordPerfect-filename [ ] :  c:\wptest\test.wp5
	XLaTeX-filename [c:\wptest\test.TEX] :
	X
	XConverting ...
	X
	XFirst strike :
	XConverting-percentage : 100%
	X
	XSecond strike :
	XConverting-percentage : 100%
	X
	XConversion completed.
	X
	X\end{verbatim}
	X
	XDe heading van de gegenereerde \LaTeX-file, in dit geval de file
	X\verb|C:\WPTEST\TEST.TEX|, ziet er dan als volgt uit : \\
	X
	X\begin{verbatim}
	X   \documentstyle[11pt,wp2latex]{report}
	X\end{verbatim}
	X\nwln
	X
	XBij het aanroepen van \LaTeX\ dient de stijl-file \verb|WP2LATEX.STY| in de
	Xhuidige directory of in de directory van stijl-files
	X(\verb|\PCTEX\TEXINPUT|) te staan.\\
	X
	XIn deze stijl-file worden onder andere een aantal kommando's en omgevingen
	Xgedefinieerd, die regelmatig in de gegenereerde \LaTeX-files zullen worden
	Xgebruikt. Voorbeelden hiervan zijn het kommando \verb|\nwln| en de
	Xomgeving \verb|indenting|. \verb|\nwln| genereert een harde regelovergang
	Xna het afsluiten van een \LaTeX-omgeving. De omgeving \verb|indenting| is
	Xgemaakt t.b.v. de konversie van het inspring kommando
	X(zie \S~\ref{inspring}). \\
	X
	X\newpage
	X
	X\section{Tot slot}
	X
	XEen 100\% goede konversie van een WordPerfect-dokument wordt niet
	Xgegarandeerd. Tijdens de verwerking door \LaTeX\ van het gegeneerde 
	Xdokument kunnen altijd nog foutmeldingen optreden.
	XEnige aanpassing van de gegenereerde \LaTeX-file zal in veel gevallen
	Xnodig zijn.\\
	X\\
	XDe hoogste prioriteit werd gegeven aan :
	X\begin{itemize}
	X  \item het niet verloren gaan van tekst
	X  \item het niet vastlopen van het programma.
	X\end{itemize}
	X\nwln
	X
	XHeeft u opmerkingen of commentaar m.b.t. het programma, dan kunt u zich
	Xwenden tot : \\
	X
	X\vspace{2cm}
	X
	X\begin{minipage}[t]{6cm}
	XR.C. Houtepen \\
	XBrusselstraat 150 \\
	X4826 NK Breda \\
	XTel: 076-714777
	X\end{minipage}
	X\hfill of \hfill
	X\begin{minipage}[t]{6cm}
	X\raggedleft
	XR.L.M. Helwig \\
	XT.U.E. \\
	XPostbus 513\\
	X5600 MB Eindhoven\\
	XTel: 040 - 472724\\
	X\nwln
	Xuucp : rcronh@urc.tue.nl\\
	Xbitnet : rcronh@heitue5
	X\end{minipage}
	X
	X\newpage
	X\nwln
	X\begin{center}
	X(Deze pagina is opzettelijk voor aantekeningen wit gelaten.)
	X\end{center}
	X\nwln
	X\end{document}
SHAR_EOF
if test 18575 -ne "`wc -c < 'wp2l-nl.tex'`"
then
	echo shar: "error transmitting 'wp2l-nl.tex'" '(should have been 18575 characters)'
fi
fi
echo shar: "extracting 'wp2latex.doc'" '(5987 characters)'
if test -f 'wp2latex.doc'
then
	echo shar: "will not over-write existing file 'wp2latex.doc'"
else
sed 's/^	X//' << \SHAR_EOF > 'wp2latex.doc'
	X
	XDear Wordperfect and/or LaTeX user,
	X
	XIn january the WP2LaTeX program was released from Eindhoven
	XUniversity of Technology. Unfortunately the original 
	Xdocumentation was in Dutch. There is no english version available. 
	XHowever, this shouldn't be to big a problem. In short, this is
	Xsummary of what the original documentation is about. In this translation
	XI sometimes refer to some pictures form the original documentation, so
	Xplease use this translation as well as the original documentation.
	X
	X1. Introduction
	X   The program tries to make a projection from the world of
	X   wordprocessing (Wordperfect) to the world of typesetting (LaTeX).
	X   This implicates that certain rules should be taken into 
	X   consideration when making a document using Wordperfect.
	X
	X2. What is being converted and what is not
	X
	X   converted :
	X   - hard return (hard line break)
	X   - hard page break
	X   - typefaces:
	X     - extra big
	X     - ...
	X     - very small
	X     - superscript
	X     - subscript
	X     - italics
	X     - small caps
	X     - boldface
	X     - underscore
	X     - double underscore
	X   - some extended characters
	X   - overstrike
	X   - tabs (left, right, center)
	X   - jump right (Alt F6)
	X   - parallel columns (fixed position decimal colon)
	X   - indenting (left, left and right)
	X   - footnotes
	X   - headers en footers
	X   - position pagenumber
	X   - justification on/off
	X
	X  Not being converted:
	X  - margin settings
	X  - newspaper-style columns
	X  - line spacing
	X  - top- and bottom margins
	X  - index
	X  - references
	X  - end-notes
	X  - table of contents
	X  - grafical images
	X
	X3 Guidelines
	X
	X3.1 Tabbing
	X    Never allow a line containing [Tab]'s to be broken by a soft return
	X    ( [ZRt] in the Dutch version of Wordperfect, [SRt] in the English
	X    one I assume).
	X
	X    If you use accents in a tabbing-environment, be aware of the fact
	X    that wp2latex doesn't convert these accents correctly. Normally accents
	X    are made by \', \` and \=, but in a tabbing-environment these
	X    commands have another definition. They should be replaced by
	X    \a`, \a` en \a= respectively. The maximum number of tabs LaTeX
	X    can handle is 14. Wordperfect can handle 40 tabs on one line.
	X    So don't use more than 14 tabs.
	X
	X3.2 Indenting
	X    There are 3 options that can be converted:
	X
	X    [Indent]*   One paragraph that may [SRt]
	X                be spread over several lines [SRt]
	X                and must be ended by a hard return. [HRt]
	X
	X    label [Indent]*  A label (some text) may be put [SRt]
	X                     in front of a paragraph. [HRt]
	X
	X    [Indent]* label [Indent]* The label itself may be indented [SRt]
	X                              so that we have 2 indentation [SRt]
	X                              levels. [HRt]
	X
	X    [Indent]*  means one or more than one [Indent] (F4)
	X
	X    By [SRt] I mean a soft line break (soft return). I am not shure
	X    that I'm using the right translations because I don't use an
	X    English version of Wordperfect. 
	X
	X3.3 Combinations of tabs en indenting.
	X    You should not mix tabbing and indentation when you plan on using
	X    this conversion program. This is because these 2 things are
	X    completely different in the world of LaTeX, although this 
	X    distinction is hard to make for a Wordperfect user.
	X
	X3.4 Footnotes
	X    Within a footnote only hard returns and typeface-changes (section 2)
	X    will be converted. A footnote-number may only contain digits.
	X
	X    When using footnotes within a line containing tabs, the footnote
	X    will not be put at the bottom of the page. This is a LaTeX-bug.
	X
	X3.5 Headers and footers
	X    Only typefaces will be converted. The header/footer may be split
	X    into 3 parts. A left part, a centered part and a right part 
	X    (see figure 1). Use Shft F6 for centering and Alt F6 for the 
	X    right part.
	X
	X3.6 Page number posotions
	X    The positions shown in figure 2 will be converted.
	X
	X3.7 Wordperfect defaults
	X    The left margin of the converted document will be 1 inch. Therefor
	X    the program assumes that the Wordperfect left-margin is also 1 inch
	X    and not being changed in the document. The default tab-settings will
	X    be set on every inch.
	X    It can be tricky not to follow the above guideline because in LaTeX
	X    the tab-setting is relative to the left margin, whereas in
	X    Wordperfect these two are independent (see figure 3).
	X
	X3.8 Spaces
	X    Normally LaTeX ignores more than one space, and treats them like there
	X    was only one space. Because many Wordperfect users use the spacebar
	X    for lay-outing, obsolete spaces will be converted into tildes (~) and
	X    therefor not be ignored.
	X
	X4 The program
	X  I think this section is clear without further translation. The first line
	X  of the converted document will always be:
	X
	X  \documentstyle[11pt,wp2latex]{report}
	X
	X  where wp2latex.sty is a style-file that should be used when LaTeX-ing
	X  a converted document. It contains some macros like \nwln.
	X
	X5 Finally
	X  A 100 percent correct conversion can not be guaranteed. In most cases
	X  the converted document will need some modification in order to
	X  get the best results.
	X
	X
	XBecause the sources are included (Turbo Pascal 5.0) you should be able to
	Xmodify the program when you want to convert Wordperfect 5.1 documents, 
	Xprovided you know what file formats are being used by Wordperfect.
	XThe file formats we used for our program, we found in the WordPerfect
	X5.0 Developer's Toolkit. I would assume that there exists such a toolkit
	Xfor version 5.1 of Wordperfect. Because 5.0 documents are compatible with
	X5.1 documents (are they ?) it shouldn't be such a big deal. Of course
	Xyou shouldn't try to convert the new 5.1 formula's because they are
	Xtreated as graphical images as I understood (at this moment I don't
	Xuse version 5.1).
	X
	XI hope this short translation will help you using the wp2latex-program.
	XIf you have any further questions, don't hesitate to ask them.
	X
	X
	XSincerely,
	X
	X   Ron Helwig
	X   Eindhoven University of Technology
	X   Department of Mathematics and Computer Science
	X   The Netherlands
	X
	X   e-mail: rcronh@urc.tue.nl
SHAR_EOF
if test 5987 -ne "`wc -c < 'wp2latex.doc'`"
then
	echo shar: "error transmitting 'wp2latex.doc'" '(should have been 5987 characters)'
fi
fi
echo shar: "extracting 'wp2latex.msg'" '(763 characters)'
if test -f 'wp2latex.msg'
then
	echo shar: "will not over-write existing file 'wp2latex.msg'"
else
sed 's/^	X//' << \SHAR_EOF > 'wp2latex.msg'
	X
	XWell somebody at Eindhoven Univ of Techn wrote a wordperfect 5.0 to LaTeX
	Xconversion program (only running on MSDOS of course) :=)
	X
	X     Conversionprogram : From Wordperfect 5.0 to LaTeX  (WP2LATEX)
	X
	X  (c) TUE-Eindhoven ---- Made by R.C.Houtepen ---- Date : 24 Jan 1990
	X
	XContact:
	Xuucp : rcronh@urc.tue.nl
	Xbitnet : rcronh@heitue5
	X
	XI have it available in our FTP/mail-server archive. ftp sol.cs.ruu.nl
	X[131.211.80.5],directory pub/TEX, or send HELP to mail-server@cs.ruu.nl.
	XThe file is wp2latex.arc.
	X--
	XPiet* van Oostrum, Dept of Computer Science, Utrecht University,
	XPadualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
	XTelephone: +31-30-531806   Uucp:   uunet!mcsun!hp4nl!ruuinf!piet
	XTelefax:   +31-30-513791   Internet:  piet@cs.ruu.nl   (*`Pete')
SHAR_EOF
if test 763 -ne "`wc -c < 'wp2latex.msg'`"
then
	echo shar: "error transmitting 'wp2latex.msg'" '(should have been 763 characters)'
fi
fi
echo shar: "extracting 'wp2latex.sty'" '(8077 characters)'
if test -f 'wp2latex.sty'
then
	echo shar: "will not over-write existing file 'wp2latex.sty'"
else
sed 's/^	X//' << \SHAR_EOF > 'wp2latex.sty'
	X%
	X%  Style-input-file t.b.v conversie
	X%  WordPerfect 5.0 --> LaTeX
	X%
	X%  (c) Rob Houtepen   Januari 1989
	X%  Rekencentrum  TU-Eindhoven
	X%
	X%
	X\typeout{Extra style `wp2latex' <16 Jan 90>.}
	X
	X\def\WPtoLaTeX{{\rm W \kern-.38em\hbox{P}\kern-.2em\lower.7ex\hbox{2}\kern-.07em\hbox{\LaTeX}}}
	X
	X% Dit is een herdefinitie van de paginalayout-parameters
	X%
	X\if@twoside \oddsidemargin 0pt \evensidemargin 0pt \marginparwidth 107pt
	X\else \oddsidemargin 0pt \evensidemargin 0pt
	X\marginparwidth 90pt
	X\fi
	X\marginparsep 11pt
	X\topmargin 0pt \headheight 12pt \headsep 25pt \footheight 12pt \footskip 30pt
	X\textheight 22cm \textwidth 15.8cm \columnsep 10pt \columnseprule 0pt
	X\parskip 0pt plus 1pt \parindent 15pt \topsep 0pt plus 2pt minus 4pt
	X\partopsep 2pt plus 1pt minus 1pt \itemsep 0pt plus 2pt minus 1pt
	X\tolerance 9990    % Voorkomt veel-te-lege regels
	X
	X\parindent 0pt
	X\parskip 0pt
	X\tabbingsep 0pt
	X
	X% speciale chars
	X%
	X\newlength\@circht
	X\newcommand{\@twodots}[1]{\mathrel{.\llap{\raisebox{#1}{.}}}}
	X\newcommand{\@spjoinrel}{\mathrel{\mkern-9mu}}
	X\newcommand{\sbullet}{\mbox{\the\scriptfont2\char'017}}
	X\newcommand{\trademark}{\raisebox{0.7ex}{\the\scriptscriptfont0 TM}}
	X\newcommand{\circchar}[1]{%
	X            {\ooalign{\hfil%
	X                 \raise0.07ex\hbox{\the\scriptscriptfont0\raise0.15ex\hbox{#1}}%
	X                      \hfil\crcr\mathhexbox20D%
	X                     }%
	X            }}
	X\newcommand{\regmark}{\circchar{R}}
	X\newcommand{\circdots}{\setbox0=\hbox{$\circ$}\setlength{\@circht}{\ht0}%
	X                       \mbox{$\@twodots{\@circht}%
	X                              \@spjoinrel\raisebox{0.1ex}{$\circ$}%
	X                              \@spjoinrel\@twodots{\@circht}%
	X                             $%
	X                            }%
	X                      }
	X\newcommand{\charstrike}[1]{\raisebox{0.7ex}{\the\scriptfont0\b{#1}}}
	X\newcommand{\astrike}{\charstrike{a}}
	X\newcommand{\ostrike}{\charstrike{o}}
	X\newcommand{\lowerquote}{\raisebox{-1.2ex}{"}}
	X\newcommand{\mound}{\mbox{$.\raisebox{0.8ex}{.}.$}}
	X\newcommand{\bslash}{{\tt\char'134}}
	X\newcommand{\circumflex}{{\char'136}}
	X\newcommand{\snake}{{\char'176}}
	X\newcommand{\degrees}{{\char'027}}
	X\newcommand{\gtlt}{\mbox{
	X     \raisebox{0.6ex}{\the\scriptscriptfont1 >}\llap{%
	X     \raisebox{-0.4ex}{\the\scriptscriptfont1 <}} }}
	X
	X% \justified maakt \raggedright, \raggedleft en \centering zo goed mogelijk
	X% ongedaan.  N.B. het effect is merkbaar in de hele alinea, dus ook op evt.
	X% voorgaande regels.
	X%
	X\def\justified{\let\\=\@normalcr \@rightskip 0pt%
	X               \rightskip\@rightskip \leftskip 0pt
	X              }
	X%
	X% Nieuwe harde regel onafhankelijk van enviroment
	X%
	X\newcommand{\nwln}{\vspace{\baselineskip}}
	X
	X%
	X% Een gecentreerde tab:
	X%
	X\newcommand{\ctab}[1]{\makebox[0pt][c]{#1}}
	X
	X%
	X% Een onderstreepkommando met de lijn altijd tegen de schrijflijn
	X%
	X\def\Underline#1{$\underline{\smash{\hbox{#1}}}$}
	X
	X%
	X% Nieuw environment tbv van Inspringen
	X%
	X\newenvironment{indenting}[3]%
	X{\begin{list}{#3}{\setlength{\leftmargin}{#1}
	X                  \setlength{\labelwidth}{#1}
	X                  \setlength{\rightmargin}{#2}
	X                  \setlength{\topsep}{0pt}
	X                  \setlength{\partopsep}{0pt}
	X                  \setlength{\parskip}{0pt}
	X                  \setlength{\parsep}{0pt}
	X                  \setlength{\itemsep}{0pt}
	X                  } \item }%
	X{\end{list}}
	X%
	X%       **************************************************************
	X%       *      TUE HEADERS EN FOOTERS EN PAGINANUMMERPLAATSING       *
	X%       **************************************************************
	X%
	X%       (c) R.C.Houtepen 7-12-89
	X%
	X%    Variablen t.b.v. plaatsing paginanummers.
	X%
	X\newtoks\pntl \newtoks\pntc \newtoks\pntr
	X\newtoks\pnbl \newtoks\pnbc \newtoks\pnbr
	X\newtoks\pnno
	X
	X\def\@pntopleft{}     \def\@pntopcenter{}     \def\@pntopright{}
	X\def\@pnbottomleft{}  \def\@pnbottomcenter{}  \def\@pnbottomright{}
	X
	X\newlength{\pnheadfootsep}  \setlength{\pnheadfootsep}{1em}
	X%
	X%     Het paginanummerplaats-commando:
	X%
	X\newcommand{\pagenumpos}[1]{%
	X     \gdef\@pntopleft{}     \gdef\@pntopcenter{}    \gdef\@pntopright{}%
	X     \gdef\@pnbottomleft{}  \gdef\@pnbottomcenter{} \gdef\@pnbottomright{}%
	X           \ifx#1\pntl \gdef\@pntopleft{\thepage \hspace{\pnheadfootsep}}%
	X     \else \ifx#1\pntc \gdef\@pntopcenter{\hspace{\pnheadfootsep} \thepage}%
	X     \else \ifx#1\pntr \gdef\@pntopright{\hspace{\pnheadfootsep} \thepage}%
	X     \else \ifx#1\pnbl \gdef\@pnbottomleft{\thepage \hspace{\pnheadfootsep}}%
	X     \else \ifx#1\pnbc \gdef\@pnbottomcenter{\hspace{\pnheadfootsep} \thepage}%
	X     \else \ifx#1\pnbr \gdef\@pnbottomright{\hspace{\pnheadfootsep} \thepage}%
	X        \fi\fi\fi\fi\fi\fi     }
	X
	X%
	X%     Variabelen T.b.v Headers en footers
	X%
	X\newtoks\oddpages \newtoks\evenpages \newtoks\allpages
	X\newtoks\neverpages
	X
	X\def\@elefthead{} \def\@emidhead{} \def\@erighthead{}
	X\def\@eleftfoot{} \def\@emidfoot{} \def\@erightfoot{}
	X\def\@olefthead{} \def\@omidhead{} \def\@orighthead{}
	X\def\@oleftfoot{} \def\@omidfoot{} \def\@orightfoot{}
	X
	X\newlength{\@hfleni} \newlength{\@hflenii}
	X
	X%
	X%     Het headtext-commando:
	X%
	X\newcommand{\headtext}[4]{%
	X          \ifx#1\oddpages
	X               \gdef\@olefthead{#2}\gdef\@omidhead{#3}\gdef\@orighthead{#4}%
	X          \else\ifx#1\evenpages
	X               \gdef\@elefthead{#2}\gdef\@emidhead{#3}\gdef\@erighthead{#4}%
	X          \else\ifx#1\allpages
	X               \gdef\@olefthead{#2}\gdef\@omidhead{#3}\gdef\@orighthead{#4}%
	X               \gdef\@elefthead{#2}\gdef\@emidhead{#3}\gdef\@erighthead{#4}%
	X          \else\ifx#1\neverpages
	X               \gdef\@olefthead{}\gdef\@omidhead{}\gdef\@orighthead{}%
	X               \gdef\@elefthead{}\gdef\@emidhead{}\gdef\@erighthead{}%
	X          \fi\fi\fi\fi
	X                        }
	X
	X%
	X%     Het foottext-commando:
	X%
	X\newcommand{\foottext}[4]{%
	X          \ifx#1\oddpages
	X               \gdef\@oleftfoot{#2}\gdef\@omidfoot{#3}\gdef\@orightfoot{#4}%
	X          \else\ifx#1\evenpages
	X               \gdef\@eleftfoot{#2}\gdef\@emidfoot{#3}\gdef\@erightfoot{#4}%
	X          \else\ifx#1\allpages
	X               \gdef\@oleftfoot{#2}\gdef\@omidfoot{#3}\gdef\@orightfoot{#4}%
	X               \gdef\@eleftfoot{#2}\gdef\@emidfoot{#3}\gdef\@erightfoot{#4}%
	X          \else\ifx#1\neverpages
	X               \gdef\@oleftfoot{}\gdef\@omidfoot{}\gdef\@orightfoot{}%
	X               \gdef\@eleftfoot{}\gdef\@emidfoot{}\gdef\@erightfoot{}%
	X          \fi\fi\fi\fi
	X                          }
	X%
	X%    Het werkelijk plaatsen van de headers en footers
	X%
	X\newcommand{\@headfoot}[3]{%
	X            \settowidth{\@hfleni}{#2}%
	X            \ifdim\@hfleni=0pt \makebox[\textwidth]{#1\hspace*{\fill}#3}%
	X            \else \settowidth{\@hfleni}{#1}%
	X                  \settowidth{\@hflenii}{#3}%
	X                  \ifdim\@hflenii>\@hfleni
	X                          \setlength{\@hfleni}{\@hflenii}%
	X                  \fi%
	X                  \makebox[\textwidth]{\makebox[\@hfleni]{#1\hspace*{\fill}}%
	X                                       \hspace*{\fill}{#2}\hspace*{\fill}%
	X                                       \makebox[\@hfleni]{\hspace*{\fill}#3}%
	X                                      }%
	X            \fi
	X                    }
	X%
	X%     Dit commando wordt aan het begin en aan het eind van een
	X%     pagina uitgevoerd.
	X%
	X\def\ps@wptolatex{%
	X        \def\@oddhead{\ifodd\value{page}%
	X                              \@headfoot{\@pntopleft\@olefthead}{\@omidhead\@pntopcenter}{\@orighthead\@pntopright}%
	X                      \else
	X                              \@headfoot{\@pntopleft\@elefthead}{\@emidhead\@pntopleft}{\@erighthead\@pntopright}%
	X                      \fi
	X                     }%
	X        \def\@evenhead{\@oddhead}%
	X        \def\@oddfoot{\ifodd\value{page}%
	X                              \@headfoot{\@pnbottomleft\@oleftfoot}{\@omidfoot\@pnbottomcenter}{\@orightfoot\@pnbottomright}%
	X                      \else
	X                              \@headfoot{\@pnbottomleft\@eleftfoot}{\@emidfoot\@pnbottomcenter}{\@erightfoot\@pnbottomright}%
	X                      \fi
	X                     }%
	X        \def\@evenfoot{\@oddfoot}%
	X                }
	X
	X\pagestyle{wptolatex}
SHAR_EOF
if test 8077 -ne "`wc -c < 'wp2latex.sty'`"
then
	echo shar: "error transmitting 'wp2latex.sty'" '(should have been 8077 characters)'
fi
fi
echo shar: "extracting 'wp2latex.tex'" '(17878 characters)'
if test -f 'wp2latex.tex'
then
	echo shar: "will not over-write existing file 'wp2latex.tex'"
else
sed 's/^	X//' << \SHAR_EOF > 'wp2latex.tex'
	X\documentstyle[11pt,wp2latex]{report}
	X
	X\newcommand{\arrow}{$\rightarrow$}
	X\renewcommand{\thechapter}{}
	X\renewcommand{\thesection}{\arabic{section}}
	X\renewcommand{\thefigure}{\arabic{figure}}
	X
	X\title{\WPtoLaTeX\\
	X \hspace{1cm}\\
	X       User's Guide}
	X\author{R.C. Houtepen\thanks{Translated from the Dutch by G. R. Roelofs}}
	X
	X\begin{document}
	X
	X\maketitle
	X
	X\newpage
	X
	X\pagenumbering{roman}
	X\tableofcontents
	X
	X\newpage
	X
	X\pagenumpos{\pnbc}
	X\pagenumbering{arabic}
	X
	X\section{Introduction}
	X
	XThe program \WPtoLaTeX\ allows the conversion of WordPerfect 5.0 documents
	Xinto \LaTeX\ format.  The program was written in the framework of a 
	Xcommissioned publication by the Computation Center of the Eindhoven University 
	Xof Technology, the Netherlands.  The programming language used was Turbo 
	XPascal 5.0.\\
	X\\
	XThe projection from one paradigm (WordPerfect = word processing) to another
	X(\LaTeX\ = typesetting) requires some cooperation on the part of the user.
	XBecause the use of \LaTeX\ is tied to strict rules, one must take these rules 
	Xinto consideration when using WordPerfect, if the WordPerfect 5.0 document is
	Xto be converted as accurately as possible.  This guide discusses those rules.\\
	X
	X\newpage
	X
	X\section{Conversion possibilities}
	X\label{capabilities}
	X
	XBecause the capabilities of WordPerfect and \LaTeX\ differ strongly, it is
	Xnot possible to convert all of WordPerfect's `features'.\\
	X\\
	XThe conversions which are performed by \WPtoLaTeX\ are :\\
	X\begin{itemize}
	X  \item hard returns
	X  \item hard page breaks
	X  \item the following typefaces :
	X    \begin{itemize}
	X      \item extra large
	X      \item very large
	X      \item large
	X      \item small
	X      \item fine
	X      \item superscript
	X      \item subscript
	X      \item italic
	X      \item small caps
	X      \item bold
	X      \item underlined
	X      \item double-underlined
	X    \end{itemize}
	X  \item extended characters (foreign language/accented, not linedrawing)
	X  \item overstriking
	X  \item tabs :
	X    \begin{itemize}
	X      \item setting
	X      \item left tabs
	X      \item center tabs
	X      \item right tabs
	X    \end{itemize}
	X  \item flush-right text
	X  \item outlining
	X  \item indenting :
	X    \begin{itemize}
	X      \item left
	X      \item left and right
	X    \end{itemize}
	X  \item footnotes
	X  \item headers and footers
	X  \item page number positioning
	X  \item full justification on/off 
	X\end{itemize}
	X\nwln
	X{\bf Not} converted are :
	X\begin{itemize}
	X  \item margin settings
	X  \item newspaper-style columns
	X  \item line spacing
	X  \item top and bottom margins
	X  \item index
	X  \item references
	X  \item endnotes
	X  \item table of contents
	X  \item graphics boxes
	X\end{itemize}
	X
	X\newpage
	X
	X\section{Guidelines}
	X
	X\subsection{Tabbing}
	X
	XTab settings allow the exact placement of pieces of text, e.g., for creating
	Xtables.  There are two sorts of commands involved here.  First, there is the
	Xsetting of tabs; this defines {\em where} subsequent tab-stop commands will
	Xplace text.  Then there are the tabs themselves, which force a {\em jump} to
	Xone of the previously-defined positions.  In \LaTeX , however, tabs
	Xare enabled only within a \verb|tabbing| environment.  \WPtoLaTeX\ takes
	Xcare of that by invoking a \verb|tabbing| environment only for those lines
	Xwhere one or more tabs appear.\\
	X\\
	XWithin WordPerfect, a line containing tabs must terminate with a hard
	Xcarriage return.  If this is not the case, the tab positions in the generated
	X\LaTeX-document will not be fixed.  \LaTeX\ will incorrectly typeset the
	Xspacing of such lines.\\
	X
	XThe following WordPerfect text will be incorrectly converted :\\
	X
	X\begin{verbatim}
	X   Text1 [Tab] text2 [Tab] text3 [SRt]
	X   text4 [Tab] text5. [HRt]
	X\end{verbatim}
	X\nwln
	X
	XThe following is better :\\
	X
	X\begin{verbatim}
	X   Text1 [Tab] text2 [Tab] text3 [HRt]
	X   text4 [Tab] text5. [HRt]
	X\end{verbatim}
	X\nwln
	X
	XA tab-setting within a line holds only for the whole line.  It is
	Xtherefore advisable to place tab-settings at the beginning of or prior to the
	Xpertinent line.\\
	X\\
	X\\
	X{\bf A few restrictions :}\\
	X\\
	X\LaTeX\ endows such commands as \verb|\'|, \verb|\`| and \verb|\=| with special
	Xmeanings within a \verb|tabbing| environment.  Outside a \verb|tabbing|
	Xenvironment, these commands are used for the placement of accents; within
	Xone, however, they must be replaced by \verb|\a'|, \verb|\a`| and \verb|\a=|, 
	Xrespectively.  \hbox{\WPtoLaTeX} does not perform this replacement, so it is 
	Xleft to the user to do it after the conversion.\\
	X\\
	XWordPerfect 5.0 allows up to 40 tabstops to be set.  \LaTeX\ can set at most
	X14 of them.  As a result, if tabs are to be converted properly, the user may
	Xset no more than 14 tabstops within WordPerfect, either.  If more than 14
	Xtabs are set, processing by \LaTeX\ will result in a number of error messages,
	Xand ultimately one or more tabs may be lost.\\
	X
	X\newpage
	X
	X\subsection{Indenting}
	X\label{indent}
	X
	XIndenting is used to alter the margins of pieces of text (paragraphs).
	XPossible conversions with regard to indenting commands are :\\
	X
	XExamples :\\
	X\\
	X\begin{tabbing}
	X\verb|   [|\arrow\verb|Indent]|$^*$\verb|  |\=
	X        \verb|An indented paragraph which [SRt]| \\
	X     \> \verb|extends over several lines and [SRt]| \\
	X     \> \verb|is closed with a hard carriage [SRt]| \\
	X     \> \verb|return. [HRt]| \\
	X\end{tabbing}
	X\begin{tabbing}
	X\verb|   label  [|\arrow\verb|Indent]|$^*$\verb|  |
	X  \= \verb|We see here the possibility of [SRt]| \\
	X  \> \verb|placing a `label' in front of [SRt]| \\
	X  \> \verb|indented text. [HRt]| \\
	X\end{tabbing}
	X\begin{tabbing}
	X\verb|   [|\arrow\verb|Indent]|$^*$\verb|  label  [|
	X\arrow\verb|Indent]|$^*$\verb|  |
	X  \= \verb|It is also possible to place [SRt]| \\
	X  \> \verb|an `indented label' in front [SRt]| \\
	X  \> \verb|of indented text. [HRt]| \\
	X\end{tabbing}
	X
	X\nwln
	Xwhere \verb|[|\arrow\verb|Indent]|$^*$ indicates one or more 
	X\verb|[|\arrow\verb|Indent]| commands. \\
	X
	X\vspace{1cm}
	X
	X{\bf Remark :}\\
	X
	XWhen using \WPtoLaTeX\ it is {\bf not} possible to convert more than two 
	Xlevels of indented text.\\
	X
	X\newpage
	X
	X\subsection{Combinations of tabbing and indenting}
	X
	XIn practice it is evident that tabbing and indenting commands are often
	Xused together.  The effect of that within WordPerfect is often identical:
	Xwords come out on the page where one wishes, on the screen as well
	Xas on paper (What You See Is What You Get).\\
	X\\
	XIn \LaTeX, however, the difference between tabs and indents is fundamental.
	XIt is important that the WordPerfect-user take this into account.  Thus only
	Xthe \verb|[Tab]| command may be used for tabbing and only the 
	X\verb|[|\arrow\verb|Indent]| command for indenting.  If both tabbing and 
	Xindenting commands are used within a single line, only the type which is 
	Xencountered first will be converted.\\
	X\\
	XAn example :\\
	X\begin{tabbing}
	X\verb|   [Tab] tom [Tab] dick [|\arrow\verb|Indent] harry [HRt]| \\
	X\end{tabbing}
	X
	XThe tab command in this line comes before the indenting command.  The
	Xinterpretation by \hbox{\WPtoLaTeX} is then : \\
	X\begin{tabbing}
	X\verb|   [Tab] tom [Tab] dick harry [HRt]| \\
	X\end{tabbing}
	X
	XThe indent-command is eliminated.  The line should instead look as follows :\\
	X\begin{tabbing}
	X\verb|   [Tab] tom [Tab] dick [Tab] harry [HRt]| \\
	X\end{tabbing}
	X
	X\newpage
	X
	X\subsection{Footnotes}
	X
	XWithin a footnote only carriage returns and typefaces (see 
	X\S~\ref{capabilities}) are converted.  A footnote number may 
	Xconsist only of numerals.\\
	X\\
	XFootnotes within lines which contain tab settings will not appear at the bottom
	Xof the page; \LaTeX, in contrast to WordPerfect, does not process them.  This
	Xis a limitation (read:  bug) of \LaTeX.\\
	X\\
	X
	X\newpage
	X
	X\subsection{Headers and footers}
	X
	XWithin a header or footer only typefaces are converted (see 
	X\S~\ref{capabilities}).\\
	X\\
	XOne can split a header or footer into three pieces :
	X\begin{itemize}
	X  \item left-aligned
	X  \item centered
	X  \item right-aligned
	X\end{itemize}
	X\nwln
	XThese three parts are separated within WordPerfect by using the centering
	Xcommand (Shift F6) and the flush-right command (Alt F6).\\
	X\\
	XThe effect of the WordPerfect commands in the header\\
	X
	X\begin{verbatim}
	X   Left[Centr]Middle[C/U/SR/D][Flush Right]Right
	X\end{verbatim}
	X\nwln
	Xwill, after conversion to \LaTeX\ format, be interpreted as is shown in
	Xfigure~\ref{fig:header}.  Choosing a new setting for the placement
	Xof header or footer text on only even (or only odd) pages does not affect 
	Xthe alternate pages' previous setting.\\
	X
	X\begin{figure}[hbt]
	X\centering
	X\setlength{\unitlength}{3mm}
	X\begin{picture}(12,16)
	X \thicklines
	X \put(0,0){\framebox(12,16)}
	X \put(1,14){\makebox(10,1)[l]{{\tiny Left}}}
	X \put(1,14){\makebox(10,1){{\tiny Middle}}}
	X \put(1,14){\makebox(10,1)[r]{{\tiny Right}}}
	X \put(1,12){\line(1,0){10}}
	X \put(1,11){\line(1,0){10}}
	X \put(1,10){\line(1,0){10}}
	X \put(1,9){\line(1,0){10}}
	X \put(1,8){\line(1,0){10}}
	X \put(1,7){\line(1,0){10}}
	X \put(1,6){\line(1,0){10}}
	X \put(1,5){\line(1,0){10}}
	X \put(1,4){\line(1,0){10}}
	X \put(1,3){\line(1,0){10}}
	X \put(1,2){\line(1,0){10}}
	X\end{picture}
	X\caption{headers}
	X\label{fig:header}
	X\end{figure}
	X
	X\newpage
	X
	X\subsection{Page number positioning}
	X
	XThe WordPerfect document is converted to a single-sided document.  This
	Xmeans that page number positions 4 and 8 are not converted.  The page
	Xnumber positions which \WPtoLaTeX\ will convert are reproduced in 
	Xfigure~\ref{fig:pagnr}.\\
	X
	X\begin{figure}[hbt]
	X\centering
	X\setlength{\unitlength}{3mm}
	X\begin{picture}(12,16)
	X \thicklines
	X \put(0,0){\framebox(12,16)}
	X \put(1,14){\makebox(10,1)[l]{1}}
	X \put(1,14){\makebox(10,1){2}}
	X \put(1,14){\makebox(10,1)[r]{3}}
	X \put(1,1){\makebox(10,1)[l]{5}}
	X \put(1,1){\makebox(10,1){6}}
	X \put(1,1){\makebox(10,1)[r]{7}}
	X\end{picture}
	X\caption{page number positions}
	X\label{fig:pagnr}
	X\end{figure}
	X
	X\newpage
	X
	X\subsection{WordPerfect default values}
	X
	XThe conversion program generates, independently of the WordPerfect settings,
	Xa \LaTeX\ document with a left margin of 1 inch (2.54cm).  This is because
	X\LaTeX\ enforces left and top margins of at least 1 inch (see 
	Xfigure~\ref{fig:tabs}).  \WPtoLaTeX\ therefore assumes that the margins 
	Xin the WordPerfect document are also set to 1 inch and that they do not 
	Xchange.\\
	X\\
	XTabs are set every inch by default (14 tab stops).  A different default 
	Xtab-setting can be placed at the first line.  If the standard, one-inch 
	Xdefault settings are not used, however, processing by \LaTeX\ may produce 
	Xerror messages.  This has more to do with the manner in which WordPerfect 
	Xpositions tab-stops than it does with \LaTeX (see figure~\ref{fig:tabs}). 
	X\LaTeX\ positions tab stops relative to the left margin, which, as mentioned
	Xabove, is a minimum of 1 inch wide.  In WordPerfect the left margin and the
	Xtab settings are independent of each other.\\
	X
	X\begin{figure}[hbt]
	X\centering
	X\setlength{\unitlength}{1.5mm}
	X\begin{picture}(60,50)
	X \thicklines
	X \put(0,0){\framebox(28,35)}
	X \put(32,0){\framebox(28,35)}
	X \thinlines
	X \put(0,37){\makebox(1,3)[l]{WordPerfect}}
	X \put(32,37){\makebox(1,3)[l]{\LaTeX}}
	X \put(36,31){\line(1,0){21}}
	X \put(36,31){\line(0,-1){28}}
	X \put(32,31){\vector(1,0){4}}
	X \put(36,31){\vector(-1,0){4}}
	X \put(36,31){\vector(0,1){4}}
	X \put(36,35){\vector(0,-1){4}}
	X \put(37,31){\makebox(1,4)[l]{{\small 1"}}}
	X \put(32,28){\makebox(4,2){{\small 1"}}}
	X \put(36,27){\vector(1,0){3}}
	X \put(40,27){\makebox(1,1)[tl]{{\scriptsize tab 1}}}
	X \put(36,25){\vector(1,0){6}}
	X \put(43,25){\makebox(1,1)[tl]{{\scriptsize tab 2}}}
	X \put(36,23){\vector(1,0){9}}
	X \put(46,23){\makebox(1,1)[tl]{{\scriptsize tab 3}}}
	X \put(4,31){\line(0,-1){28}}
	X \put(4,31){\line(1,0){21}}
	X \put(0,27){\vector(1,0){7}}
	X \put(8,27){\makebox(1,1)[tl]{{\scriptsize tab 1}}}
	X \put(0,25){\vector(1,0){10}}
	X \put(11,25){\makebox(1,1)[tl]{{\scriptsize tab 2}}}
	X \put(0,23){\vector(1,0){13}}
	X \put(14,23){\makebox(1,1)[tl]{{\scriptsize tab 3}}}
	X\end{picture}
	X\caption{tab settings in WordPerfect and \LaTeX}
	X\label{fig:tabs}
	X\end{figure}
	X
	X\newpage
	X
	X\subsection{Spaces}
	X
	XBecause WordPerfect works well as tool for the visual design of a document, 
	Xusers often have the tendency to use spaces to produce an acceptable layout.
	XMultiple spaces within \LaTeX, however, have the same effect as a single 
	Xspace.  Therefore, in converting a WordPerfect document, multiple spaces are 
	Xchanged into `hard' \LaTeX-spaces. \\
	X
	XFor example : \\
	X
	X\begin{tabular}{|l|l|}
	X\hline
	XWordPerfect                & \LaTeX \rule[-.5cm]{0cm}{1.5cm} \\
	X\hline
	X\verb*|word1    word2|   & \verb*|word1 ~~~word2|\rule[-.5cm]{0cm}{1.5cm} \\
	X\hline
	X\end{tabular}
	X\nwln
	X
	XWhen these come at the beginning of a line, however, they have no effect.
	XMoreover, the layout which existed in the WordPerfect environment will seldom 
	Xbe properly achieved in \LaTeX, because of the different typographic rules, 
	Xtypefaces and text-spacing that the latter handles.
	X
	X\newpage
	X
	X\section{The program}
	X
	XThe \WPtoLaTeX\ package contains the following files :\\
	X
	X\begin{itemize}
	X  \item \verb|WP2LATEX.EXE| (the conversion program)
	X  \item \verb|WP2LATEX.PAS| (the original Turbo Pascal 5.0 sources)
	X  \item \verb|WP2LATEX.STY| (style file needed by \LaTeX\ for processing)
	X  \item \verb|WP2LTX.TEX  | (this user's guide)
	X  \item \verb|README.BAT  | (batch-file with user instructions)
	X\end{itemize}
	X\nwln
	XThe program is invoked with the command :\\
	X
	X\begin{verbatim}
	X   WP2LATEX [WP-filename.WPF]
	X\end{verbatim}
	X
	X\nwln
	XThe parameter \verb|WP-filename.WPF|\footnote{This may be a WordPefect 5.0
	Xdocument with an extension other than \verb|.WPF|} is optional.
	XThe program starts with an opening screen and asks for the WordPerfect 
	Xfilename.  The default filename is printed inside square brackets 
	X\mbox{(\verb|[ ]|)} and is the parameter which was optionally included in
	Xthe initial invocation of \verb|WP2LATEX|\null.  The user can at this point type
	Xin another WordPerfect filename, or he can hit return to choose the default
	Xfilename.  The program next requests the name of the generated \LaTeX\ 
	Xdocument.  The default given within brackets is the name of the 
	XWordPerfect file, with the extension \verb|.TEX|\null.  Once again the user
	Xmay accept this name or enter another\footnote{This may be a file with an
	Xextension other than \verb|.TEX|}.  Once the filenames are given, the 
	Xfollowing error messages may appear :
	X
	X\begin{itemize}
	X  \item \Underline{File not found :} The given WordPerfect file does not exist.
	X  \item \Underline{Path not found :} An invalid path was given in the name
	X        of one of the files.
	X  \item \Underline{Not a WordPerfect 5.0 dokument :} The given WordPerfect
	X        file was not created in WordPerfect 5.0
	X\end{itemize}
	X\nwln
	XThe conversion takes place in two passes.  In the first pass the WordPerfect
	Xinput-file is read in, byte by byte.  On the basis of that are created two
	Xfiles, \verb|WP-filenaam.STR| and \verb|WP_filenaam.TBL|\null.  
	X\verb|WP-filenaam.STR| contains the characters, tab settings and changes of
	Xtypefaces; \verb|WP-filenaam.TBL| holds information regarding the various
	X\LaTeX\ environments that must be opened and closed.  In the second pass these
	Xfiles are assimilated into a single \LaTeX\ file.  After a successful 
	Xconversion the files \verb|WP-filenaam.STR| and \verb|WP-filenaam.TBL| are 
	Xautomatically deleted.\\
	X
	X\newpage
	X
	XInvoking \WPtoLaTeX\ to convert the WordPerfect 5.0 document 
	X\verb|C:\WPTEST\TEST.WP5| will cause the following screen to appear :\\
	X
	X\begin{verbatim}
	X
	X     Conversionprogram : From Wordperfect 5.0 to LaTeX  (WP2LATEX)
	X
	X  (c) TUE-Eindhoven ---- Made by R.C.Houtepen ---- Date : 24 Jan 1990
	X
	X
	XWordPerfect-filename [ ] :  c:\wptest\test.wp5
	XLaTeX-filename [c:\wptest\test.TEX] :
	X
	XConverting ...
	X
	XFirst strike :
	XConverting-percentage : 100%
	X
	XSecond strike :
	XConverting-percentage : 100%
	X
	XConversion completed.
	X
	X\end{verbatim}
	X
	XThe first line of the generated \LaTeX\ file, in the case of the file
	X\verb|C:\WPTEST\TEST.TEX|, will look as follows : \\
	X
	X\begin{verbatim}
	X   \documentstyle[11pt,wp2latex]{report}
	X\end{verbatim}
	X\nwln
	X
	XWhen calling \LaTeX\ to typeset the converted document, the style file
	X\verb|WP2LATEX.STY| should be in the current directory or in the style-file
	Xdirectory (e.g., \verb|\PCTEX\TEXINPUT|).
	XThis style file defines a number of macros and environments which are
	Xregularly used in the generated \LaTeX\ files.  Examples include the command
	X\verb|\nwln| and the \verb|indenting| environment. \verb|\nwln| generates a
	Xhard carriage return after the end of a \LaTeX-environment.  The 
	X\verb|indenting| environment is used in the conversion of WordPerfect's
	X\verb|[|\arrow\verb|Indent]| command (see \S~\ref{indent}). \\
	X
	X\newpage
	X
	X\section{Conclusion}
	X
	XThe 100\%-correct conversion of a WordPerfect-document is not guaranteed.
	XError messages can always appear during processing by \LaTeX.  Some
	Xadjustments to the generated \LaTeX\ file will in many cases be necessary.\\
	X\\
	XThe following were given the highest priority :
	X\begin{itemize}
	X  \item preventing the loss of text
	X  \item avoiding program crashes
	X\end{itemize}
	X\nwln
	X
	XBecause the sources are included (Turbo Pascal 5.0 format) it should not be
	Xtoo difficult modifying the program to convert Wordperfect 5.1 documents,
	Xprovided the WordPerfect file formats are known. \\
	XThe file formats we used for our program, we found in the WordPerfect
	X5.0 Developer's Toolkit. Most likely such a toolkit is available for version
	X5.1 of Wordperfect. \\
	X
	XIf you have remarks or comments regarding the program, you can send them
	Xto : \\
	X
	X\vspace{2cm}
	X
	X\begin{minipage}[t]{6cm}
	XR.C. Houtepen \\
	XBrusselstraat 150 \\
	X4826 NK Breda \\
	XThe Netherlands \\
	XTel: 076-714777
	X\end{minipage}
	X\hfill or \hfill
	X\begin{minipage}[t]{6cm}
	X\raggedleft
	XR.L.M. Helwig \\
	XEindhoven University of Technology \\
	XP.O. BOX 513\\
	X5600 MB Eindhoven\\
	XThe Netherlands \\
	XTel: 040 - 472724\\
	X\nwln
	Xuucp : rcronh@urc.tue.nl\\
	Xbitnet : rcronh@heitue5
	X\end{minipage}
	X
	X\newpage
	X\nwln
	X\begin{center}
	X(This page is intentionally left blank for notes.)
	X\end{center}
	X\nwln
	X\end{document}
SHAR_EOF
if test 17878 -ne "`wc -c < 'wp2latex.tex'`"
then
	echo shar: "error transmitting 'wp2latex.tex'" '(should have been 17878 characters)'
fi
fi
exit 0
#	End of shell archive
--
Glenn Geers                       | "So when it's over, we're back to people.
Department of Theoretical Physics |  Just to prove that human touch can have
The University of Sydney          |  no equal."
Sydney NSW 2006 Australia         |  - Basia Trzetrzelewska, 'Prime Time TV'