home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1650 / wp2latex.c
C/C++ Source or Header  |  1990-12-28  |  54KB  |  2,419 lines

  1. /* Output from p2c, the Pascal-to-C translator */
  2. /* From input file "WP2LATEX.PAS" */
  3.  
  4. static char rcsid[] = "$Header: wp2latex.c,v 2.0 90/08/05 08:16:28 glenn Exp $";
  5.  
  6.  
  7. #ifdef HAVE_P2C
  8. #include <p2c/p2c.h>
  9. #else
  10. #include "p2c.h"
  11. #endif
  12.  
  13.  
  14. /*           Version 1.0
  15.              Date 27-1-1990
  16. */
  17.  
  18.  
  19. Static Char wpd_fn[256], strip_fn[256], tabel_fn[256], latex_fn[256];
  20.  
  21. Static FILE *wpd, *tabel;
  22. Static FILE *strip, *latex;
  23.  
  24. Static unsigned short num_of_lines_stripfile;
  25.  
  26. Static Char open_com[0x11][256], close_com[0x11][256];
  27.  
  28. /* Static Anyptr Exitsave; */
  29. Static Char wpd_NAME[_FNSIZE];
  30. Static Char tabel_NAME[_FNSIZE];
  31. Static Char strip_NAME[_FNSIZE];
  32. Static Char latex_NAME[_FNSIZE];
  33.  
  34. Static Void RunError(); /* simulate Turbo 5 builtin */
  35.  
  36. Static Void Rd_word(f, w)
  37. FILE **f;
  38. unsigned short *w;
  39. {
  40.   /* Deze procedure leest een woord uit de opgegeven binaire file. */
  41.   uchar b;
  42.  
  43.   fread(&b, sizeof(uchar), 1, *f);
  44.   *w = b;
  45.   fread(&b, sizeof(uchar), 1, *f);
  46.   *w += b * 256;
  47. }
  48.  
  49.  
  50. Static Void Wr_word(f, w)
  51. FILE **f;
  52. unsigned short w;
  53. {
  54.   /* Deze procedure schrijft een woord in de opgegeven binaire file. */
  55.   uchar b;
  56.  
  57.   b = w & 255;
  58.   fwrite(&b, sizeof(uchar), 1, *f);
  59.   b = w / 256;
  60.   fwrite(&b, sizeof(uchar), 1, *f);
  61. }
  62.  
  63.  
  64. Static Void Jump_in_file(f, dis)
  65. FILE **f;
  66. long dis;
  67. {
  68.   /* Deze procedure springt in een binaire file het aantal opgegeven bytes. */
  69.   long cur_pos;
  70.  
  71.   cur_pos = ftell(*f) / sizeof(uchar);
  72.   fseek(*f, (cur_pos + dis) * sizeof(uchar), 0);
  73. }
  74.  
  75.  
  76.  
  77. Static Void Wpd_check()
  78. {
  79.   /* Kontroleert of de opgegeven WP-document wel daadwerkelijk een   */
  80.   /* WP5.0-document is.                                              */
  81.   unsigned short id1, id2, std1, std2, filetype, dmp1, dmp2, dmp3;
  82.   long Startdoc;
  83.  
  84.   Rd_word(&wpd, &id1);
  85.   Rd_word(&wpd, &id2);
  86.   Rd_word(&wpd, &std1);
  87.   Rd_word(&wpd, &std2);
  88.   Rd_word(&wpd, &filetype);
  89.   Rd_word(&wpd, &dmp1);
  90.   Rd_word(&wpd, &dmp2);
  91.   Rd_word(&wpd, &dmp3);
  92.  
  93.   Startdoc = std2 * 65536L + std1;
  94.  
  95.   if (id1 == 0x57ff && id2 == 0x4350 && filetype == 0xa01)
  96.     /*and (dmp1=$0) and (dmp2=$0) and (dmp3=$0)*/
  97.       fseek(wpd, Startdoc * sizeof(uchar), 0);
  98.   else {
  99.     RunError(0x201);   /* Het is geen WP5.0-document*/
  100.   }
  101.  
  102.   /* Het is een WP5.0-document*/
  103. }
  104.  
  105.  
  106.  
  107.  
  108. Static Void Filenames()
  109. {
  110.   /* Deze procedure handelt het opgeven van de filenamen af. */
  111.   Char name[256], invoer[256], wpdef[256], latdef[256], filename[256];
  112.   short l, p;
  113.  
  114.   if (P_argc < 2)
  115.     *wpdef = '\0';
  116.   else
  117.     strcpy(wpdef, P_argv[1]);
  118.  
  119.   printf("\n\nWordPerfect-filename [%s] : ", wpdef);
  120.   gets(invoer);
  121.   if (*invoer == '\0')
  122.     strcpy(wpd_fn, wpdef);
  123.   else
  124.     strcpy(wpd_fn, invoer);
  125.  
  126.   if (*wpd_fn == '\0') {   /* No filename entered */
  127.     RunError(0x200);
  128.   }
  129.  
  130.   strcpy(name, wpd_fn);
  131.   l = strlen(name);
  132.   p = strpos2(name, ".", 1);
  133.   if (p == 0)
  134.     p = l + 1;
  135.   sprintf(filename, "%.*s", p - 1, name);
  136.  
  137.   sprintf(strip_fn, "%s.str", filename);
  138.   sprintf(tabel_fn, "%s.tbl", filename);
  139.   sprintf(latdef, "%s.tex", filename);
  140.  
  141.   printf("LaTeX-filename [%s] : ", latdef);
  142.   gets(invoer);
  143.   putchar('\n');
  144.   if (*invoer == '\0')
  145.     strcpy(latex_fn, latdef);
  146.   else
  147.     strcpy(latex_fn, invoer);
  148.  
  149.   strcpy(wpd_NAME, wpd_fn);
  150.   strcpy(strip_NAME, strip_fn);
  151.   strcpy(tabel_NAME, tabel_fn);
  152.   strcpy(latex_NAME, latex_fn);
  153.  
  154. }
  155.  
  156.  
  157. Static Void Init_commando()
  158. {
  159.   strcpy(open_com[0], "{\\LARGE ");
  160.   strcpy(open_com[0x1], "{\\Large ");
  161.   strcpy(open_com[0x2], "{\\large ");
  162.   strcpy(open_com[0x3], "{\\small ");
  163.   strcpy(open_com[0x4], "{\\footnotesize ");
  164.   strcpy(open_com[0x5], "$^{\\rm ");
  165.   strcpy(open_com[0x6], "$_{\\rm ");
  166.   *open_com[0x7] = '\0';
  167.   strcpy(open_com[0x8], "{\\it ");
  168.   *open_com[0x9] = '\0';
  169.   *open_com[0xa] = '\0';
  170.   strcpy(open_com[0xb], "\\underline{\\Underline{");
  171.   strcpy(open_com[0xc], "{\\bf ");
  172.   *open_com[0xd] = '\0';
  173.   strcpy(open_com[0xe], "\\Underline{");
  174.   strcpy(open_com[0xf], "{\\sc ");
  175.  
  176.   strcpy(close_com[0], "}");
  177.   strcpy(close_com[0x1], "}");
  178.   strcpy(close_com[0x2], "}");
  179.   strcpy(close_com[0x3], "}");
  180.   strcpy(close_com[0x4], "}");
  181.   strcpy(close_com[0x5], "}$");
  182.   strcpy(close_com[0x6], "}$");
  183.   *close_com[0x7] = '\0';
  184.   strcpy(close_com[0x8], "\\/}");
  185.   *close_com[0x9] = '\0';
  186.   *close_com[0xa] = '\0';
  187.   strcpy(close_com[0xb], "}}");
  188.   strcpy(close_com[0xc], "}");
  189.   *close_com[0xd] = '\0';
  190.   strcpy(close_com[0xe], "}");
  191.   strcpy(close_com[0xf], "}");
  192. }
  193.  
  194.  
  195. /* Local variables for Convert_first_strike: */
  196. struct LOC_Convert_first_strike {
  197.   uchar by;
  198.   unsigned short regelnum;
  199.  
  200.   Char lat[0x60][26];
  201.   short char_set[0xff];
  202.   short char_code[0xff];
  203.   Char ext_lat[0xff][26];
  204.  
  205.  
  206.   short leegptr[2], openptr[2];
  207.   uchar attr_rij[2][17];
  208.   boolean open_attr_rij[2];
  209.   short depth;
  210.  
  211.   Char envir, line_term;
  212.  
  213.   boolean char_on_line, nomore_valid_tabs, indenting, indent_end, ind_text1,
  214.       ind_text2;
  215.  
  216.   unsigned short ind_leftmargin, ind_rightmargin;
  217.  
  218.   short num_of_tabs, latex_tabpos;
  219.   unsigned short tabpos[40];
  220.   boolean right_tab, align_tab, center_tab;
  221.  
  222.   short WP_sidemargin;
  223. } ;
  224.  
  225.  
  226.  
  227.  
  228. Local Void WP_Default(LINK)
  229. struct LOC_Convert_first_strike *LINK;
  230. {
  231.   short j;
  232.  
  233.   LINK->WP_sidemargin = 1200;
  234.  
  235.   LINK->tabpos[0] = 0x2c5;   /* 1e WP-tab is kantlijn --> */
  236.   for (j = 2; j <= 10; j++)   /* Volgende tabs 1,5  cm     */
  237.     LINK->tabpos[j - 1] = LINK->tabpos[j - 2] + 0x2c5;
  238.   for (j = 10; j <= 39; j++)   /* ($02c5 wpu) verder        */
  239.     LINK->tabpos[j] = 0xffffL;
  240.  
  241.   LINK->num_of_tabs = 10;
  242. }
  243.  
  244.  
  245. Local Void Table_Init(LINK)
  246. struct LOC_Convert_first_strike *LINK;
  247. {
  248.   strcpy(LINK->lat[0], " ");   /*Space*/
  249.   strcpy(LINK->lat[0x1], "!");   /*!*/
  250.   strcpy(LINK->lat[0x2], "\"");   /*"*/
  251.   strcpy(LINK->lat[0x3], "\\#");   /*#*/
  252.   strcpy(LINK->lat[0x4], "\\$");   /*dollar*/
  253.   strcpy(LINK->lat[0x5], "\\%");   /*%*/
  254.   strcpy(LINK->lat[0x6], "\\&");   /*&*/
  255.   strcpy(LINK->lat[0x7], "'");   /*'*/
  256.   strcpy(LINK->lat[0x8], "(");   /*(*/
  257.   strcpy(LINK->lat[0x9], ")");   /*)*/
  258.   strcpy(LINK->lat[0xa], "*");   /***/
  259.   strcpy(LINK->lat[0xb], "+");   /*+*/
  260.   strcpy(LINK->lat[0xc], ",");   /*,*/
  261.   strcpy(LINK->lat[0xd], "-");   /*-*/
  262.   strcpy(LINK->lat[0xe], ".");   /*.*/
  263.   strcpy(LINK->lat[0xf], "/");   /*/*/
  264.   strcpy(LINK->lat[0x10], "0");   /*0*/
  265.   strcpy(LINK->lat[0x11], "1");   /*1*/
  266.   strcpy(LINK->lat[0x12], "2");   /*2*/
  267.   strcpy(LINK->lat[0x13], "3");   /*3*/
  268.   strcpy(LINK->lat[0x14], "4");   /*4*/
  269.   strcpy(LINK->lat[0x15], "5");   /*5*/
  270.   strcpy(LINK->lat[0x16], "6");   /*6*/
  271.   strcpy(LINK->lat[0x17], "7");   /*7*/
  272.   strcpy(LINK->lat[0x18], "8");   /*8*/
  273.   strcpy(LINK->lat[0x19], "9");   /*9*/
  274.   strcpy(LINK->lat[0x1a], ":");   /*:*/
  275.   strcpy(LINK->lat[0x1b], ";");   /*;*/
  276.   strcpy(LINK->lat[0x1c], "$<$");   /*<*/
  277.   strcpy(LINK->lat[0x1d], "=");   /*=*/
  278.   strcpy(LINK->lat[0x1e], "$>$");   /*>*/
  279.   strcpy(LINK->lat[0x1f], "?");   /*?*/
  280.   strcpy(LINK->lat[0x20], "@");   /*@*/
  281.   strcpy(LINK->lat[0x21], "A");   /*A*/
  282.   strcpy(LINK->lat[0x22], "B");   /*B*/
  283.   strcpy(LINK->lat[0x23], "C");   /*C*/
  284.   strcpy(LINK->lat[0x24], "D");   /*D*/
  285.   strcpy(LINK->lat[0x25], "E");   /*E*/
  286.   strcpy(LINK->lat[0x26], "F");   /*F*/
  287.   strcpy(LINK->lat[0x27], "G");   /*G*/
  288.   strcpy(LINK->lat[0x28], "H");   /*H*/
  289.   strcpy(LINK->lat[0x29], "I");   /*I*/
  290.   strcpy(LINK->lat[0x2a], "J");   /*J*/
  291.   strcpy(LINK->lat[0x2b], "K");   /*K*/
  292.   strcpy(LINK->lat[0x2c], "L");   /*L*/
  293.   strcpy(LINK->lat[0x2d], "M");   /*M*/
  294.   strcpy(LINK->lat[0x2e], "N");   /*N*/
  295.   strcpy(LINK->lat[0x2f], "O");   /*O*/
  296.   strcpy(LINK->lat[0x30], "P");   /*P*/
  297.   strcpy(LINK->lat[0x31], "Q");   /*Q*/
  298.   strcpy(LINK->lat[0x32], "R");   /*R*/
  299.   strcpy(LINK->lat[0x33], "S");   /*S*/
  300.   strcpy(LINK->lat[0x34], "T");   /*T*/
  301.   strcpy(LINK->lat[0x35], "U");   /*U*/
  302.   strcpy(LINK->lat[0x36], "V");   /*V*/
  303.   strcpy(LINK->lat[0x37], "W");   /*W*/
  304.   strcpy(LINK->lat[0x38], "X");   /*X*/
  305.   strcpy(LINK->lat[0x39], "Y");   /*Y*/
  306.   strcpy(LINK->lat[0x3a], "Z");   /*Z*/
  307.   strcpy(LINK->lat[0x3b], "[");   /*[*/
  308.   strcpy(LINK->lat[0x3c], "$\\tt\\backslash$");   /*\*/
  309.   strcpy(LINK->lat[0x3d], "]");   /*]*/
  310.   strcpy(LINK->lat[0x3e], "\\^{");   /*^*/
  311.   strcpy(LINK->lat[0x3f], "\\_");   /*_*/
  312.   strcpy(LINK->lat[0x40], "`");   /*`*/
  313.   strcpy(LINK->lat[0x41], "a");   /*a*/
  314.   strcpy(LINK->lat[0x42], "b");   /*b*/
  315.   strcpy(LINK->lat[0x43], "c");   /*c*/
  316.   strcpy(LINK->lat[0x44], "d");   /*d*/
  317.   strcpy(LINK->lat[0x45], "e");   /*e*/
  318.   strcpy(LINK->lat[0x46], "f");   /*f*/
  319.   strcpy(LINK->lat[0x47], "g");   /*g*/
  320.   strcpy(LINK->lat[0x48], "h");   /*h*/
  321.   strcpy(LINK->lat[0x49], "i");   /*i*/
  322.   strcpy(LINK->lat[0x4a], "j");   /*j*/
  323.   strcpy(LINK->lat[0x4b], "k");   /*k*/
  324.   strcpy(LINK->lat[0x4c], "l");   /*l*/
  325.   strcpy(LINK->lat[0x4d], "m");   /*m*/
  326.   strcpy(LINK->lat[0x4e], "n");   /*n*/
  327.   strcpy(LINK->lat[0x4f], "o");   /*o*/
  328.   strcpy(LINK->lat[0x50], "p");   /*p*/
  329.   strcpy(LINK->lat[0x51], "q");   /*q*/
  330.   strcpy(LINK->lat[0x52], "r");   /*r*/
  331.   strcpy(LINK->lat[0x53], "s");   /*s*/
  332.   strcpy(LINK->lat[0x54], "t");   /*t*/
  333.   strcpy(LINK->lat[0x55], "u");   /*u*/
  334.   strcpy(LINK->lat[0x56], "v");   /*v*/
  335.   strcpy(LINK->lat[0x57], "w");   /*w*/
  336.   strcpy(LINK->lat[0x58], "x");   /*x*/
  337.   strcpy(LINK->lat[0x59], "y");   /*y*/
  338.   strcpy(LINK->lat[0x5a], "z");   /*z*/
  339.   strcpy(LINK->lat[0x5b], "\\{");   /*{*/
  340.   strcpy(LINK->lat[0x5c], "$|$");   /*|*/
  341.   strcpy(LINK->lat[0x5d], "\\}");   /* */
  342.   strcpy(LINK->lat[0x5e], "\\tidle{");   /*~*/
  343.   strcpy(LINK->lat[0x5f], " ");   /*Doesn't exsist*/
  344. }
  345.  
  346.  
  347. Local Void Ext_chr_init(LINK)
  348. struct LOC_Convert_first_strike *LINK;
  349. {
  350.   LINK->char_set[0] = 0x1;
  351.   LINK->char_code[0] = 0x26;
  352.   strcpy(LINK->ext_lat[0], "\\c{C}");
  353.   LINK->char_set[0x1] = 0x1;
  354.   LINK->char_code[0x1] = 0x47;
  355.   strcpy(LINK->ext_lat[0x1], "\\\"{u}");
  356.   LINK->char_set[0x2] = 0x1;
  357.   LINK->char_code[0x2] = 0x29;
  358.   strcpy(LINK->ext_lat[0x2], "\\'{e}");
  359.   LINK->char_set[0x3] = 0x1;
  360.   LINK->char_code[0x3] = 0x1d;
  361.   strcpy(LINK->ext_lat[0x3], "\\^{a}");
  362.   LINK->char_set[0x4] = 0x1;
  363.   LINK->char_code[0x4] = 0x1f;
  364.   strcpy(LINK->ext_lat[0x4], "\\\"{a}");
  365.   LINK->char_set[0x5] = 0x1;
  366.   LINK->char_code[0x5] = 0x21;
  367.   strcpy(LINK->ext_lat[0x5], "\\`{a}");
  368.   LINK->char_set[0x6] = 0x1;
  369.   LINK->char_code[0x6] = 0x23;
  370.   strcpy(LINK->ext_lat[0x6], "\\aa ");
  371.   LINK->char_set[0x7] = 0x1;
  372.   LINK->char_code[0x7] = 0x27;
  373.   strcpy(LINK->ext_lat[0x7], "\\c{c}");
  374.   LINK->char_set[0x8] = 0x1;
  375.   LINK->char_code[0x8] = 0x2b;
  376.   strcpy(LINK->ext_lat[0x8], "\\^{e}");
  377.   LINK->char_set[0x9] = 0x1;
  378.   LINK->char_code[0x9] = 0x2d;
  379.   strcpy(LINK->ext_lat[0x9], "\\\"{e}");
  380.   LINK->char_set[0xa] = 0x1;
  381.   LINK->char_code[0xa] = 0x2f;
  382.   strcpy(LINK->ext_lat[0xa], "\\`{e}");
  383.   LINK->char_set[0xb] = 0x1;
  384.   LINK->char_code[0xb] = 0x35;
  385.   strcpy(LINK->ext_lat[0xb], "\\\"{\\i}");
  386.   LINK->char_set[0xc] = 0x1;
  387.   LINK->char_code[0xc] = 0x33;
  388.   strcpy(LINK->ext_lat[0xc], "\\^{\\i}");
  389.   LINK->char_set[0xd] = 0x1;
  390.   LINK->char_code[0xd] = 0x37;
  391.   strcpy(LINK->ext_lat[0xd], "\\`{\\i}");
  392.   LINK->char_set[0xe] = 0x1;
  393.   LINK->char_code[0xe] = 0x1e;
  394.   strcpy(LINK->ext_lat[0xe], "\\\"{A}");
  395.   LINK->char_set[0xf] = 0x1;
  396.   LINK->char_code[0xf] = 0x22;
  397.   strcpy(LINK->ext_lat[0xf], "\\AA ");
  398.   LINK->char_set[0x10] = 0x1;
  399.   LINK->char_code[0x10] = 0x28;
  400.   strcpy(LINK->ext_lat[0x10], "\\'{E}");
  401.   LINK->char_set[0x11] = 0x1;
  402.   LINK->char_code[0x11] = 0x25;
  403.   strcpy(LINK->ext_lat[0x11], "\\ae ");
  404.   LINK->char_set[0x12] = 0x1;
  405.   LINK->char_code[0x12] = 0x24;
  406.   strcpy(LINK->ext_lat[0x12], "\\AE ");
  407.   LINK->char_set[0x13] = 0x1;
  408.   LINK->char_code[0x13] = 0x3d;
  409.   strcpy(LINK->ext_lat[0x13], "\\^{o}");
  410.   LINK->char_set[0x14] = 0x1;
  411.   LINK->char_code[0x14] = 0x3f;
  412.   strcpy(LINK->ext_lat[0x14], "\\\"{o}");
  413.   LINK->char_set[0x15] = 0x1;
  414.   LINK->char_code[0x15] = 0x41;
  415.   strcpy(LINK->ext_lat[0x15], "\\`{o}");
  416.   LINK->char_set[0x16] = 0x1;
  417.   LINK->char_code[0x16] = 0x45;
  418.   strcpy(LINK->ext_lat[0x16], "\\^{u}");
  419.   LINK->char_set[0x17] = 0x1;
  420.   LINK->char_code[0x17] = 0x49;
  421.   strcpy(LINK->ext_lat[0x17], "\\`{u}");
  422.   LINK->char_set[0x18] = 0x1;
  423.   LINK->char_code[0x18] = 0x8b;
  424.   strcpy(LINK->ext_lat[0x18], "\\\"{y}");
  425.   LINK->char_set[0x19] = 0x1;
  426.   LINK->char_code[0x19] = 0x3e;
  427.   strcpy(LINK->ext_lat[0x19], "\\\"{O}");
  428.   LINK->char_set[0x1a] = 0x1;
  429.   LINK->char_code[0x1a] = 0x46;
  430.   strcpy(LINK->ext_lat[0x1a], "\\\"{U}");
  431.   LINK->char_set[0x1b] = 0x4;
  432.   LINK->char_code[0x1b] = 0x13;
  433.   strcpy(LINK->ext_lat[0x1b], "\\ ");
  434.   LINK->char_set[0x1c] = 0x4;
  435.   LINK->char_code[0x1c] = 0xb;
  436.   strcpy(LINK->ext_lat[0x1c], "\\pounds ");
  437.   LINK->char_set[0x1d] = 0x4;
  438.   LINK->char_code[0x1d] = 0xc;
  439.   strcpy(LINK->ext_lat[0x1d], "\\ ");
  440.   LINK->char_set[0x1e] = 0x4;
  441.   LINK->char_code[0x1e] = 0xd;
  442.   strcpy(LINK->ext_lat[0x1e], "\\ ");
  443.   LINK->char_set[0x1f] = 0x4;
  444.   LINK->char_code[0x1f] = 0xe;
  445.   strcpy(LINK->ext_lat[0x1f], "{\\it f}\\/");
  446.   LINK->char_set[0x20] = 0x1;
  447.   LINK->char_code[0x20] = 0x1b;
  448.   strcpy(LINK->ext_lat[0x20], "\\'{a}");
  449.   LINK->char_set[0x21] = 0x1;
  450.   LINK->char_code[0x21] = 0x31;
  451.   strcpy(LINK->ext_lat[0x21], "\\'{\\i}");
  452.   LINK->char_set[0x22] = 0x1;
  453.   LINK->char_code[0x22] = 0x3b;
  454.   strcpy(LINK->ext_lat[0x22], "\\'{o}");
  455.   LINK->char_set[0x23] = 0x1;
  456.   LINK->char_code[0x23] = 0x43;
  457.   strcpy(LINK->ext_lat[0x23], "\\'{u}");
  458.   LINK->char_set[0x24] = 0x1;
  459.   LINK->char_code[0x24] = 0x39;
  460.   strcpy(LINK->ext_lat[0x24], "\\~{n}");
  461.   LINK->char_set[0x25] = 0x1;
  462.   LINK->char_code[0x25] = 0x38;
  463.   strcpy(LINK->ext_lat[0x25], "\\~{N}");
  464.   LINK->char_set[0x26] = 0x4;
  465.   LINK->char_code[0x26] = 0xf;
  466.   strcpy(LINK->ext_lat[0x26], "\\astrike ");
  467.   LINK->char_set[0x27] = 0x4;
  468.   LINK->char_code[0x27] = 0x10;
  469.   strcpy(LINK->ext_lat[0x27], "\\ostrike ");
  470.   LINK->char_set[0x28] = 0x4;
  471.   LINK->char_code[0x28] = 0x8;
  472.   strcpy(LINK->ext_lat[0x28], "?`");
  473.   LINK->char_set[0x29] = 0x5;
  474.   LINK->char_code[0x29] = 0x10;
  475.   strcpy(LINK->ext_lat[0x29], "~");
  476.   LINK->char_set[0x2a] = 0x6;
  477.   LINK->char_code[0x2a] = 0x14;
  478.   strcpy(LINK->ext_lat[0x2a], "~");
  479.   LINK->char_set[0x2b] = 0x4;
  480.   LINK->char_code[0x2b] = 0x11;
  481.   strcpy(LINK->ext_lat[0x2b], "$\\frac{1}{2}$");
  482.   LINK->char_set[0x2c] = 0x4;
  483.   LINK->char_code[0x2c] = 0x12;
  484.   strcpy(LINK->ext_lat[0x2c], "$\\frac{1}{4}$");
  485.   LINK->char_set[0x2d] = 0x4;
  486.   LINK->char_code[0x2d] = 0x7;
  487.   strcpy(LINK->ext_lat[0x2d], "!`");
  488.   LINK->char_set[0x2e] = 0x4;
  489.   LINK->char_code[0x2e] = 0x9;
  490.   strcpy(LINK->ext_lat[0x2e], "$\\ll$");
  491.   LINK->char_set[0x2f] = 0x4;
  492.   LINK->char_code[0x2f] = 0xa;
  493.   strcpy(LINK->ext_lat[0x2f], "$\\gg$");
  494.   LINK->char_set[0x60] = 0x8;
  495.   LINK->char_code[0x60] = 0x1;
  496.   strcpy(LINK->ext_lat[0x60], "$\\alpha$");
  497.   /*
  498.   These are wrong
  499.   LINK->char_set[0x61] = 0x1;
  500.   LINK->char_code[0x61] = 0x17;
  501.   They originally were used to detect beta
  502.   */
  503.   LINK->char_set[0x61] = 0x08;
  504.   LINK->char_code[0x61] = 0x03;
  505.   strcpy(LINK->ext_lat[0x61], "$\\beta$");
  506.   LINK->char_set[0x62] = 0x8;
  507.   LINK->char_code[0x62] = 0x6;
  508.   strcpy(LINK->ext_lat[0x62], "$\\Gamma$");
  509.   LINK->char_set[0x63] = 0x8;
  510.   LINK->char_code[0x63] = 0x21;
  511.   strcpy(LINK->ext_lat[0x63], "$\\pi$");
  512.   LINK->char_set[0x64] = 0x8;
  513.   LINK->char_code[0x64] = 0x24;
  514.   strcpy(LINK->ext_lat[0x64], "$\\Sigma$");
  515.   LINK->char_set[0x65] = 0x8;
  516.   LINK->char_code[0x65] = 0x25;
  517.   strcpy(LINK->ext_lat[0x65], "$\\sigma$");
  518.   LINK->char_set[0x66] = 0x8;
  519.   LINK->char_code[0x66] = 0x19;
  520.   strcpy(LINK->ext_lat[0x66], "$\\mu$");
  521.   LINK->char_set[0x67] = 0x8;
  522.   LINK->char_code[0x67] = 0x29;
  523.   strcpy(LINK->ext_lat[0x67], "$\\tau$");
  524.   LINK->char_set[0x68] = 0x8;
  525.   LINK->char_code[0x68] = 0x2c;
  526.   strcpy(LINK->ext_lat[0x68], "$\\Phi$");
  527.   LINK->char_set[0x69] = 0x8;
  528.   LINK->char_code[0x69] = 0x10;
  529.   strcpy(LINK->ext_lat[0x69], "$\\theta$");
  530.   LINK->char_set[0x6a] = 0x8;
  531.   LINK->char_code[0x6a] = 0x32;
  532.   strcpy(LINK->ext_lat[0x6a], "$\\Omega$");
  533.   LINK->char_set[0x6b] = 0x8;
  534.   LINK->char_code[0x6b] = 0x9;
  535.   strcpy(LINK->ext_lat[0x6b], "$\\delta$");
  536.   LINK->char_set[0x6c] = 0x6;
  537.   LINK->char_code[0x6c] = 0x13;
  538.   strcpy(LINK->ext_lat[0x6c], "$\\infty$");
  539.   LINK->char_set[0x6d] = 0x8;
  540.   LINK->char_code[0x6d] = 0x2d;
  541.   strcpy(LINK->ext_lat[0x6d], "$\\emptyset$");
  542.   LINK->char_set[0x6e] = 0x8;
  543.   LINK->char_code[0x6e] = 0xb;
  544.   strcpy(LINK->ext_lat[0x6e], "$\\epsilon$");
  545.   LINK->char_set[0x6f] = 0x6;
  546.   LINK->char_code[0x6f] = 0x10;
  547.   strcpy(LINK->ext_lat[0x6f], "$\\cap$");
  548.   LINK->char_set[0x70] = 0x6;
  549.   LINK->char_code[0x70] = 0xe;
  550.   strcpy(LINK->ext_lat[0x70], "$\\equiv$");
  551.   LINK->char_set[0x71] = 0x6;
  552.   LINK->char_code[0x71] = 0x1;
  553.   strcpy(LINK->ext_lat[0x71], "$\\pm$");
  554.   LINK->char_set[0x72] = 0x6;
  555.   LINK->char_code[0x72] = 0x3;
  556.   strcpy(LINK->ext_lat[0x72], "$\\geq$");
  557.   LINK->char_set[0x73] = 0x6;
  558.   LINK->char_code[0x73] = 0x2;
  559.   strcpy(LINK->ext_lat[0x73], "$\\leq$");
  560.   LINK->char_set[0x74] = 0x7;
  561.   LINK->char_code[0x74] = 0;
  562.   strcpy(LINK->ext_lat[0x74], "~");
  563.   LINK->char_set[0x75] = 0x7;
  564.   LINK->char_code[0x75] = 0x1;
  565.   strcpy(LINK->ext_lat[0x75], "~");
  566.   LINK->char_set[0x76] = 0x6;
  567.   LINK->char_code[0x76] = 0x8;
  568.   strcpy(LINK->ext_lat[0x76], "$\\div$");
  569.   LINK->char_set[0x77] = 0x6;
  570.   LINK->char_code[0x77] = 0xd;
  571.   strcpy(LINK->ext_lat[0x77], "$\\approx$");
  572.   LINK->char_set[0x78] = 0x6;
  573.   LINK->char_code[0x78] = 0x24;
  574.   strcpy(LINK->ext_lat[0x78], "\\degrees ");
  575.   LINK->char_set[0x79] = 0x6;
  576.   LINK->char_code[0x79] = 0x1f;
  577.   strcpy(LINK->ext_lat[0x79], "~");
  578.   LINK->char_set[0x7a] = 0x6;
  579.   LINK->char_code[0x7a] = 0x20;
  580.   strcpy(LINK->ext_lat[0x7a], "~");
  581.   LINK->char_set[0x7b] = 0x7;
  582.   LINK->char_code[0x7b] = 0x4;
  583.   strcpy(LINK->ext_lat[0x7b], "$\\surd$");
  584.   LINK->char_set[0x7c] = 0x4;
  585.   LINK->char_code[0x7c] = 0x15;
  586.   strcpy(LINK->ext_lat[0x7c], "$^{n}$");
  587.   LINK->char_set[0x7d] = 0x4;
  588.   LINK->char_code[0x7d] = 0x14;
  589.   strcpy(LINK->ext_lat[0x7d], "$^{2}$");
  590.   LINK->char_set[0x7e] = 0x4;
  591.   LINK->char_code[0x7e] = 0x2;
  592.   strcpy(LINK->ext_lat[0x7e], "~");
  593. /*
  594. ** Note: Adding characters is easy. The maximum available is
  595. ** now 256 not 128 (Pascal version).
  596. ** e.g. The Greek character set is char_set 0x8,
  597. ** \Alpha has char_code 0x0, \alpha has char_code 0x1 ...
  598. ** \Omega has char_code 0x32 and \omega has char_code 0x33
  599. ** I suspect that there are two versions of some letters
  600. ** I've only added the ones I've needed for translating.
  601. ** Hence the apparent randomness.
  602. */
  603.   LINK->char_set[0x7f] = 0x8;
  604.   LINK->char_code[0x7f] = 0x15;
  605.   strcpy(LINK->ext_lat[0x7f], "$\\kappa$");
  606.   LINK->char_set[0x80] = 0x8;
  607.   LINK->char_code[0x80] = 0x8;
  608.   strcpy(LINK->ext_lat[0x80], "$\\Delta$");
  609.   LINK->char_set[0x81] = 0x8;
  610.   LINK->char_code[0x81] = 0xf;
  611.   strcpy(LINK->ext_lat[0x81], "$\\eta$");
  612.   LINK->char_set[0x82] = 0x8;
  613.   LINK->char_code[0x82] = 0x27;
  614.   strcpy(LINK->ext_lat[0x82], "$\\zeta$");
  615.   LINK->char_set[0x83] = 0x06;
  616.   LINK->char_code[0x83] = 0x0a;
  617.   strcpy(LINK->ext_lat[0x83], "$<$");
  618.   LINK->char_set[0x84] = 0x06;
  619.   LINK->char_code[0x84] = 0x09;
  620.   strcpy(LINK->ext_lat[0x84], "$|$");
  621.   LINK->char_set[0x85] = 0x8;
  622.   LINK->char_code[0x85] = 0x7;
  623.   strcpy(LINK->ext_lat[0x85], "$\\gamma$");
  624.   LINK->char_set[0x86] = 0x8;
  625.   LINK->char_code[0x86] = 0x2b;
  626.   strcpy(LINK->ext_lat[0x86], "$\\phi$");
  627.   LINK->char_set[0x87] = 0x6;
  628.   LINK->char_code[0x87] = 0x27;
  629.   strcpy(LINK->ext_lat[0x87], "$\\times$");
  630.   LINK->char_set[0x88] = 0x6;
  631.   LINK->char_code[0x88] = 0x28;
  632.   strcpy(LINK->ext_lat[0x88], "$\\int$");
  633.   LINK->char_set[0x89] = 0x8;
  634.   LINK->char_code[0x89] = 0x31;
  635.   strcpy(LINK->ext_lat[0x89], "$\\psi$");
  636.   LINK->char_set[0x8a] = 0x6;
  637.   LINK->char_code[0x8a] = 0xb;
  638.   strcpy(LINK->ext_lat[0x8a], "$>$");
  639.   LINK->char_set[0x8b] = 0x8;
  640.   LINK->char_code[0x8b] = 0x2f;
  641.   strcpy(LINK->ext_lat[0x8b], "$\\chi$");
  642.   LINK->char_set[0x8c] = 0x6;
  643.   LINK->char_code[0x8c] = 0x17;
  644.   strcpy(LINK->ext_lat[0x8c], "$\\uparrow$");
  645.   LINK->char_set[0x8d] = 0x6;
  646.   LINK->char_code[0x8d] = 0x15;
  647.   strcpy(LINK->ext_lat[0x8d], "$\\rightarrow$");
  648.   LINK->char_set[0x8e] = 0x8;
  649.   LINK->char_code[0x8e] = 0x17;
  650.   strcpy(LINK->ext_lat[0x8e], "$\\lambda$");
  651.   LINK->char_set[0x8f] = 0x8;
  652.   LINK->char_code[0x8f] = 0x33;
  653.   strcpy(LINK->ext_lat[0x8f], "$\\omega$");
  654. }
  655.  
  656.  
  657. Local Void Make_tabelentry_attr(LINK)
  658. struct LOC_Convert_first_strike *LINK;
  659. {
  660.   uchar num_of_attr;
  661.   short j;
  662.  
  663.   num_of_attr = LINK->openptr[LINK->depth];
  664.   fwrite(&num_of_attr, sizeof(uchar), 1, tabel);
  665.  
  666.   for (j = 1; j <= num_of_attr; j++)
  667.     fwrite(&LINK->attr_rij[LINK->depth][j], sizeof(uchar), 1, tabel);
  668.  
  669. }
  670.  
  671.  
  672.  
  673. Local Void Make_tabelentry_tabset(LINK)
  674. struct LOC_Convert_first_strike *LINK;
  675. {
  676.   uchar b;
  677.   short j, FORLIM;
  678.  
  679.   b = 'S';
  680.   fwrite(&b, sizeof(uchar), 1, tabel);
  681.  
  682.   b = LINK->num_of_tabs;
  683.   fwrite(&b, sizeof(uchar), 1, tabel);
  684.  
  685.   FORLIM = LINK->num_of_tabs;
  686.   for (j = 0; j < FORLIM; j++)
  687.     Wr_word(&tabel, LINK->tabpos[j]);
  688. }
  689.  
  690.  
  691. Local Void Make_tabelentry_rightjustification(LINK)
  692. struct LOC_Convert_first_strike *LINK;
  693. {
  694.   uchar b;
  695.  
  696.   b = 'U';
  697.   fwrite(&b, sizeof(uchar), 1, tabel);
  698.  
  699.   if (LINK->by == 0x81)   /* regels NIET uitvullen */
  700.     b = 1;   /* regels WEL uitvullen */
  701.   else
  702.     b = 0;
  703.   fwrite(&b, sizeof(uchar), 1, tabel);
  704. }
  705.  
  706.  
  707.  
  708.  
  709. Local Void Make_tabelentry_envir_extra_end(LINK)
  710. struct LOC_Convert_first_strike *LINK;
  711. {
  712.   uchar b;
  713.  
  714.  
  715.   switch (LINK->envir) {
  716.  
  717.   case 'C':
  718.     b = 'C';
  719.     fwrite(&b, sizeof(uchar), 1, tabel);
  720.     break;
  721.  
  722.   case 'T':
  723.     b = 'T';
  724.     fwrite(&b, sizeof(uchar), 1, tabel);
  725.     break;
  726.  
  727.   case 'I':
  728.     b = 'I';
  729.     fwrite(&b, sizeof(uchar), 1, tabel);
  730.     Wr_word(&tabel, LINK->ind_leftmargin);
  731.     Wr_word(&tabel, LINK->ind_rightmargin);
  732.  
  733.     if (LINK->ind_text2) {
  734.       b = 1;
  735.       fwrite(&b, sizeof(uchar), 1, tabel);
  736.     } else {
  737.       b = 0;
  738.       fwrite(&b, sizeof(uchar), 1, tabel);
  739.     }
  740.  
  741.     break;
  742.  
  743.   }/*Case*/
  744.  
  745.   b = LINK->line_term;
  746.   fwrite(&b, sizeof(uchar), 1, tabel);
  747.  
  748.   b = 0xff;
  749.   fwrite(&b, sizeof(uchar), 1, tabel);
  750.  
  751. }
  752.  
  753.  
  754. Local Void Reset_attr_rij(d, LINK)
  755. short d;
  756. struct LOC_Convert_first_strike *LINK;
  757. {
  758.   short j;
  759.  
  760.   for (j = 0; j <= 16; j++)
  761.     LINK->attr_rij[d][j] = 0;
  762.   LINK->leegptr[d] = 1;
  763.   LINK->openptr[d] = 0;
  764. }
  765.  
  766.  
  767.  
  768. Local Void Open_all_attr(LINK)
  769. struct LOC_Convert_first_strike *LINK;
  770. {
  771.   /* -- Open alle commando's door de Attributen-rij af te lopen -- */
  772.   short j, FORLIM;
  773.  
  774.   FORLIM = LINK->leegptr[LINK->depth];
  775.   for (j = LINK->openptr[LINK->depth] + 1; j < FORLIM; j++) {
  776.     fputs(open_com[LINK->attr_rij[LINK->depth][j]], strip);
  777.     LINK->openptr[LINK->depth]++;
  778.   }
  779.  
  780.   LINK->open_attr_rij[LINK->depth] = false;
  781.       /* Alle attributen staan weer goed */
  782. }
  783.  
  784.  
  785.  
  786. Local Void Close_all_attr(LINK)
  787. struct LOC_Convert_first_strike *LINK;
  788. {
  789.   /* -- Sluit alle commando's door de Attributen-rij af te lopen -- */
  790.   short j;
  791.  
  792.   for (j = LINK->openptr[LINK->depth]; j >= 1; j--) {
  793.     fputs(close_com[LINK->attr_rij[LINK->depth][j]], strip);
  794.     LINK->openptr[LINK->depth]--;
  795.   }
  796.   LINK->open_attr_rij[LINK->depth] = true;
  797. }
  798.  
  799.  
  800.  
  801. Local Void Attr_ON(LINK)
  802. struct LOC_Convert_first_strike *LINK;
  803. {
  804.   /* Deze procedure plaatst een attribuut (lettertype) in de attribuut-rij */
  805.   uchar b;
  806.  
  807.   fread(&b, sizeof(uchar), 1, wpd);   /* lees attribuut-code */
  808.  
  809.   LINK->attr_rij[LINK->depth][LINK->leegptr[LINK->depth]] = b;
  810.       /* attribuut in attr-rij */
  811.   LINK->leegptr[LINK->depth]++;   /* plaats 1 verder. */
  812.   LINK->open_attr_rij[LINK->depth] = true;   /* openstaande attr-rij */
  813.  
  814.   fread(&b, sizeof(uchar), 1, wpd);   /* lees voorbij afsluitcode */
  815. }
  816.  
  817.  
  818.  
  819. Local Void Attr_OFF(LINK)
  820. struct LOC_Convert_first_strike *LINK;
  821. {
  822.   /* Deze procedure haalt een uit een attribuut (lettertype) uit de */
  823.   /* attribuut-rij door middel van een stack principe omdat binnen  */
  824.   /* LaTeX de later geopende kommando's eerst afgesloten te worden  */
  825.   uchar b;
  826.   boolean found;
  827.   short j, codeptr, FORLIM;
  828.  
  829.   fread(&b, sizeof(uchar), 1, wpd);   /* lees attribuut-code */
  830.  
  831.   j = LINK->leegptr[LINK->depth];   /* zoek vanaf top attr-rij */
  832.   found = false;   /* nog niet gevonden */
  833.  
  834.   while (j > 1 && !found) {   /* zoek attr-code in attr-rij */
  835.     j--;
  836.     found = (LINK->attr_rij[LINK->depth][j] == b);
  837.   }
  838.  
  839.   if (j <= 0) {   /* Moet nooit kunnen voorkomen */
  840.     RunError(0x100);
  841.   }
  842.   codeptr = j;   /* plaats van attr-code in rij */
  843.  
  844.   /* Sluit alle commando's t/m de desbetreffende code als deze nog niet */
  845.   /* gesloten zijn.                                                     */
  846.  
  847.   if (codeptr <= LINK->openptr[LINK->depth]) {
  848.     for (j = LINK->openptr[LINK->depth]; j >= codeptr; j--) {
  849.       fputs(close_com[LINK->attr_rij[LINK->depth][j]], strip);
  850.       LINK->openptr[LINK->depth]--;
  851.     }
  852.   }
  853.  
  854.   FORLIM = LINK->leegptr[LINK->depth];
  855.   /* Haal de desbetreffende attribuut uit de rij en werk pointers bij */
  856.  
  857.   for (j = codeptr; j < FORLIM; j++)
  858.     LINK->attr_rij[LINK->depth][j] = LINK->attr_rij[LINK->depth][j + 1];
  859.   LINK->leegptr[LINK->depth]--;
  860.  
  861.   LINK->open_attr_rij[LINK->depth] = true;   /* openstaande attr-rij */
  862.  
  863.   fread(&b, sizeof(uchar), 1, wpd);   /* lees voorbij afsluitcode */
  864. }
  865.  
  866.  
  867.  
  868. Local Void Center(LINK)
  869. struct LOC_Convert_first_strike *LINK;
  870. {
  871.   /* Deze procedure zorgt voor center environment zolang er nog geen */
  872.   /* andere environment is begonnen.                                 */
  873.   if (LINK->envir == ' ')   /* environment = center */
  874.     LINK->envir = 'C';
  875.  
  876.   Jump_in_file(&wpd, 7L);   /* rest van code overslaan */
  877. }
  878.  
  879.  
  880.  
  881. Local Void End_Align(LINK)
  882. struct LOC_Convert_first_strike *LINK;
  883. {
  884.   if (LINK->align_tab) {
  885.     Close_all_attr(LINK);
  886.     fprintf(strip, "\\'");
  887.     LINK->align_tab = false;
  888.     Open_all_attr(LINK);
  889.   }
  890.  
  891.   if (LINK->right_tab) {
  892.     Close_all_attr(LINK);
  893.     fprintf(strip, "\\'");
  894.     LINK->right_tab = false;
  895.     Open_all_attr(LINK);
  896.   }
  897.  
  898.   if (!LINK->center_tab)
  899.     return;
  900.   Close_all_attr(LINK);
  901.   putc('}', strip);
  902.   LINK->center_tab = false;
  903.   Open_all_attr(LINK);
  904. }
  905.  
  906.  
  907.  
  908. Local Void Tab(LINK)
  909. struct LOC_Convert_first_strike *LINK;
  910. {
  911.   short j;
  912.   unsigned short wpu;
  913.   short tabnum, new_tabs, FORLIM;
  914.  
  915.   if (LINK->envir == 'I' || LINK->nomore_valid_tabs)
  916.   {   /* Noggeen indent --> normaal tab */
  917.     Jump_in_file(&wpd, 7L);
  918.     return;
  919.   }
  920.  
  921.  
  922.   if (LINK->by == 0x48)
  923.     LINK->right_tab = true;
  924.  
  925.   if (LINK->by == 0x40)
  926.     LINK->align_tab = true;
  927.  
  928.   if (LINK->by == 0xc8)
  929.     LINK->center_tab = true;
  930.  
  931.   Jump_in_file(&wpd, 2L);
  932.  
  933.   Rd_word(&wpd, &wpu);   /* Lees abs.-indent [wpu] */
  934.   wpu -= LINK->WP_sidemargin;   /* Correctie ivm WP kantlijn */
  935.  
  936.   tabnum = 0;
  937.   FORLIM = LINK->num_of_tabs;
  938.   for (j = 1; j <= FORLIM; j++) {   /* Bepaal welke tabpos */
  939.     if (wpu >= LINK->tabpos[j - 1])
  940.       tabnum = j;
  941.   }
  942.  
  943.   new_tabs = tabnum - LINK->latex_tabpos;
  944.  
  945.   if (new_tabs > 0) {
  946.     Close_all_attr(LINK);
  947.  
  948.     for (j = 1; j <= new_tabs; j++)
  949.       fprintf(strip, "\\>");
  950.  
  951.     if (LINK->center_tab)
  952.       fprintf(strip, "\\ctab{");
  953.  
  954.     Open_all_attr(LINK);
  955.   }
  956.  
  957.   LINK->latex_tabpos = tabnum;
  958.  
  959.   Jump_in_file(&wpd, 3L);
  960.  
  961.   LINK->envir = 'T';   /* Er zit een tab in deze regel */
  962. }
  963.  
  964.  
  965.  
  966. Local Void Flush_right_tab(LINK)
  967. struct LOC_Convert_first_strike *LINK;
  968. {
  969.   if (LINK->envir != 'I') {
  970.     Close_all_attr(LINK);
  971.     fprintf(strip, "\\`");
  972.     Open_all_attr(LINK);
  973.  
  974.     LINK->nomore_valid_tabs = true;
  975.  
  976.     LINK->envir = 'T';
  977.   }
  978.  
  979.   Jump_in_file(&wpd, 7L);
  980. }
  981.  
  982.  
  983.  
  984. Local Void Indent(LINK)
  985. struct LOC_Convert_first_strike *LINK;
  986. {
  987.   unsigned short dif, abs;
  988.   uchar b;
  989.  
  990.   if (LINK->envir == 'T') {
  991.     /*Al een tabcommando gezet dus er mag geen insp */
  992.       Jump_in_file(&wpd, 10L);
  993.     return;
  994.   }
  995.   LINK->envir = 'I';
  996.   LINK->indenting = true;
  997.  
  998.   if (LINK->ind_text2) {
  999.     Jump_in_file(&wpd, 10L);
  1000.     return;
  1001.   }
  1002.   fread(&b, sizeof(uchar), 1, wpd);
  1003.   b &= 0x1;
  1004.  
  1005.   Rd_word(&wpd, &dif);
  1006.   Rd_word(&wpd, &abs);   /* Eigenlijk Old current column */
  1007.   Rd_word(&wpd, &abs);
  1008.  
  1009.   LINK->ind_leftmargin = abs - LINK->WP_sidemargin;
  1010.  
  1011.   if (b == 1)
  1012.     LINK->ind_rightmargin += dif;
  1013.   /*Margins bepaald lees voorby rest van functie-codes */
  1014.   Jump_in_file(&wpd, 3L);
  1015.  
  1016.   if (LINK->ind_text1)
  1017.     return;
  1018.   if (LINK->char_on_line) {
  1019.     putc('}', strip);
  1020.     LINK->ind_text1 = true;
  1021.   }
  1022. }
  1023.  
  1024.  
  1025. Local Void End_of_indent(LINK)
  1026. struct LOC_Convert_first_strike *LINK;
  1027. {
  1028.   LINK->indent_end = true;
  1029.   Jump_in_file(&wpd, 5L);
  1030. }
  1031.  
  1032.  
  1033.  
  1034. Local Void Tabset(LINK)
  1035. struct LOC_Convert_first_strike *LINK;
  1036. {
  1037.   short j;
  1038.   unsigned short w;
  1039.  
  1040.   Jump_in_file(&wpd, 102L);   /* Ga naar TAB-info */
  1041.  
  1042.   LINK->num_of_tabs = 0;
  1043.  
  1044.   for (j = 1; j <= 40; j++) {
  1045.     Rd_word(&wpd, &w);
  1046.     if (w > LINK->WP_sidemargin && w != 0xffffL) {
  1047.       LINK->num_of_tabs++;
  1048.       LINK->tabpos[LINK->num_of_tabs - 1] = w - LINK->WP_sidemargin;
  1049.     }
  1050.   }
  1051.  
  1052.   Jump_in_file(&wpd, 24L);
  1053.  
  1054.   Make_tabelentry_tabset(LINK);
  1055. }
  1056.  
  1057.  
  1058.  
  1059. Local Void Page_number_position(LINK)
  1060. struct LOC_Convert_first_strike *LINK;
  1061. {
  1062.   uchar position_code;
  1063.  
  1064.   Jump_in_file(&wpd, 5L);   /*Skip length of code; always 10*/
  1065.   /* + old information */
  1066.   fread(&position_code, sizeof(uchar), 1, wpd);
  1067.  
  1068.   fprintf(strip, "\\pagenumpos");
  1069.   switch (position_code) {
  1070.  
  1071.   case 0x1:
  1072.     fprintf(strip, "{\\pntl}");
  1073.     break;
  1074.  
  1075.   case 0x2:
  1076.     fprintf(strip, "{\\pntc}");
  1077.     break;
  1078.  
  1079.   case 0x3:
  1080.     fprintf(strip, "{\\pntr}");
  1081.     break;
  1082.  
  1083.   case 0x5:
  1084.     fprintf(strip, "{\\pnbl}");
  1085.     break;
  1086.  
  1087.   case 0x6:
  1088.     fprintf(strip, "{\\pnbc}");
  1089.     break;
  1090.  
  1091.   case 0x7:
  1092.     fprintf(strip, "{\\pnbr}");
  1093.     break;
  1094.  
  1095.   default:
  1096.     fprintf(strip, "{\\pnno}");
  1097.     break;
  1098.   }
  1099.  
  1100.   Jump_in_file(&wpd, 6L);
  1101. }
  1102.  
  1103.  
  1104.  
  1105. Local Void Character(LINK)
  1106. struct LOC_Convert_first_strike *LINK;
  1107. {
  1108.   Char ch[256];
  1109.  
  1110.   short j;
  1111.   uchar chr_code, chr_set, b;
  1112.   boolean found;
  1113.  
  1114.  
  1115.   if (LINK->open_attr_rij[LINK->depth])
  1116.     Open_all_attr(LINK);
  1117.  
  1118.   switch (LINK->by) {
  1119.  
  1120.   case 0xa9:   /* Special_char */
  1121.     if (LINK->by == 0xa9)
  1122.       strcpy(ch, "-");
  1123.     else
  1124.       strcpy(ch, "\\ ");
  1125.     break;
  1126.  
  1127.   case 0xc0:   /* Extended_char */
  1128.     j = 127;
  1129.     found = false;
  1130.  
  1131.     fread(&chr_code, sizeof(uchar), 1, wpd);
  1132.     fread(&chr_set, sizeof(uchar), 1, wpd);
  1133.  
  1134.     while (j < 511 && !found) {
  1135.       j++;
  1136.       if (chr_code == LINK->char_code[j - 0x80] &&
  1137.       chr_set == LINK->char_set[j - 0x80])
  1138.     found = true;
  1139.     }
  1140.  
  1141.     if (found)
  1142.       strcpy(ch, LINK->ext_lat[j - 0x80]);
  1143.     else
  1144.       strcpy(ch, "\\ ");
  1145.  
  1146.     fread(&b, sizeof(uchar), 1, wpd);
  1147.     break;
  1148.  
  1149.   default:
  1150.     if (LINK->by >= 0x20 && LINK->by <= 0x7f) {
  1151.       /* Normal_char  */
  1152.       strcpy(ch, LINK->lat[LINK->by - 0x20]);
  1153.     }
  1154.  
  1155.     break;
  1156.   }
  1157.  
  1158.   fputs(ch, strip);
  1159.  
  1160. }
  1161.  
  1162.  
  1163.  
  1164. Local Void Return_Page(LINK)
  1165. struct LOC_Convert_first_strike *LINK;
  1166. {
  1167.   switch (LINK->by) {
  1168.  
  1169.   case 0x0a:
  1170.   case 0x8c:   /* Hard return */
  1171.     LINK->line_term = 'R';
  1172.     break;
  1173.  
  1174.   case 0x0d:   /* Soft return */
  1175.     LINK->line_term = 'r';
  1176.     break;
  1177.  
  1178.   case 0xc:   /* Hard page */
  1179.     LINK->line_term = 'P';
  1180.     break;
  1181.  
  1182.   case 0xb:   /* Soft page */
  1183.     LINK->line_term = 'p';
  1184.     break;
  1185.   }
  1186.  
  1187.   putc('\n', strip);
  1188.  
  1189.   Make_tabelentry_envir_extra_end(LINK);
  1190.  
  1191.   if (LINK->indent_end) {
  1192.     LINK->envir = ' ';
  1193.     LINK->indenting = false;
  1194.     LINK->ind_text1 = false;
  1195.     LINK->ind_text2 = false;
  1196.     LINK->ind_leftmargin = 0;
  1197.     LINK->ind_rightmargin = 0;
  1198.  
  1199.     LINK->indent_end = false;
  1200.   } else if (LINK->envir != 'I')
  1201.     LINK->envir = ' ';
  1202.  
  1203.  
  1204.   LINK->char_on_line = false;
  1205.   LINK->nomore_valid_tabs = false;
  1206.  
  1207.   LINK->regelnum++;
  1208.  
  1209.   Make_tabelentry_attr(LINK);
  1210.  
  1211.   LINK->latex_tabpos = 0;
  1212. }
  1213.  
  1214.  
  1215. Local Void Nop80(LINK)
  1216. struct LOC_Convert_first_strike *LINK;
  1217. {
  1218.   /* Om dat het een 1-byte funktie is hoeft er niks overgeslagen */
  1219.   /* te worden.                                                  */
  1220. }
  1221.  
  1222.  
  1223.  
  1224. Local Void NopC0(LINK)
  1225. struct LOC_Convert_first_strike *LINK;
  1226. {
  1227.   if (LINK->by == 0xc0)
  1228.     Jump_in_file(&wpd, 3L);
  1229.   if (LINK->by == 0xc1)
  1230.     Jump_in_file(&wpd, 8L);
  1231.   if (LINK->by == 0xc2)
  1232.     Jump_in_file(&wpd, 10L);
  1233.   if (LINK->by == 0xc3)
  1234.     Jump_in_file(&wpd, 2L);
  1235.   if (LINK->by == 0xc4)
  1236.     Jump_in_file(&wpd, 2L);
  1237.   if (LINK->by == 0xc5)
  1238.     Jump_in_file(&wpd, 4L);
  1239.   if (LINK->by == 0xc6)
  1240.     Jump_in_file(&wpd, 5L);
  1241.   if (LINK->by == 0xc7)
  1242.     Jump_in_file(&wpd, 6L);
  1243. }
  1244.  
  1245.  
  1246.  
  1247. Local Void NopD0(already_read_subfunc_code, LINK)
  1248. boolean already_read_subfunc_code;
  1249. struct LOC_Convert_first_strike *LINK;
  1250. {
  1251.   uchar b;
  1252.   unsigned short w;
  1253.  
  1254.   if (!already_read_subfunc_code)   /* Lees subfunctioncode */
  1255.     fread(&b, sizeof(uchar), 1, wpd);
  1256.  
  1257.   Rd_word(&wpd, &w);   /* Lees lengte 'die nog volgt ' */
  1258.   fseek(wpd, (ftell(wpd) / sizeof(uchar) + w) * sizeof(uchar), 0);
  1259. }
  1260.  
  1261.  
  1262.  
  1263. Local Void Overstrike(LINK)
  1264. struct LOC_Convert_first_strike *LINK;
  1265. {
  1266.   boolean first_char_os;
  1267.  
  1268.   unsigned short char_width_os, len_of_code;
  1269.   long end_of_code;
  1270.  
  1271.   Rd_word(&wpd, &len_of_code);   /* Lees lengte */
  1272.   end_of_code = ftell(wpd) / sizeof(uchar) + len_of_code - 4;
  1273.  
  1274.   Rd_word(&wpd, &char_width_os);
  1275.  
  1276.   first_char_os = true;
  1277.  
  1278.   while (ftell(wpd) / sizeof(uchar) < end_of_code) {
  1279.     fread(&LINK->by, sizeof(uchar), 1, wpd);
  1280.  
  1281.  
  1282.     if (LINK->by >= 0x20 && LINK->by <= 0x7f || LINK->by == 0xa9 ||
  1283.     LINK->by == 0xc0) {
  1284.       if (first_char_os) {
  1285.     Character(LINK);
  1286.     first_char_os = false;
  1287.       } else {
  1288.     fprintf(strip, "\\llap{");
  1289.     Character(LINK);
  1290.     putc('}', strip);
  1291.       }
  1292.       continue;
  1293.     }
  1294.  
  1295.     if (LINK->by <= 0xbf)
  1296.       Nop80(LINK);
  1297.     else if (LINK->by >= 0xc0 && LINK->by <= 0xcf)
  1298.       NopC0(LINK);
  1299.     else if (LINK->by >= 0xd0 && LINK->by <= 0xfe)
  1300.       NopD0(false, LINK);
  1301.   }
  1302.  
  1303.   Jump_in_file(&wpd, 4L);
  1304.  
  1305. }
  1306.  
  1307.  
  1308.  
  1309. Local Void Footnote(LINK)
  1310. struct LOC_Convert_first_strike *LINK;
  1311. {
  1312.   uchar flags, num_of_pages;
  1313.  
  1314.   unsigned short fn_num, len_of_code;
  1315.   long end_of_code;
  1316.  
  1317.   Rd_word(&wpd, &len_of_code);   /* Lees lengte */
  1318.   end_of_code = ftell(wpd) / sizeof(uchar) + len_of_code - 4;
  1319.  
  1320.   fread(&flags, sizeof(uchar), 1, wpd);
  1321.  
  1322.   Rd_word(&wpd, &fn_num);
  1323.  
  1324.   /* Skip all the shit */
  1325.  
  1326.   fread(&num_of_pages, sizeof(uchar), 1, wpd);
  1327.   Jump_in_file(&wpd, (num_of_pages + 1L) * 2 + 9);
  1328.  
  1329.   Close_all_attr(LINK);
  1330.  
  1331.   LINK->depth = 1;
  1332.   Reset_attr_rij(LINK->depth, LINK);
  1333.  
  1334.   fprintf(strip, "\\footnote[%u]{", fn_num);
  1335.  
  1336.   while (ftell(wpd) / sizeof(uchar) < end_of_code) {
  1337.     fread(&LINK->by, sizeof(uchar), 1, wpd);
  1338.  
  1339.     switch (LINK->by) {
  1340.  
  1341.     case 0xa:
  1342.     case 0xc:
  1343.       fprintf(strip, "\\\\ ");
  1344.       break;
  1345.  
  1346.     case 0xb:
  1347.     case 0xd:
  1348.       putc(' ', strip);
  1349.       break;
  1350.  
  1351.     case 0xc3:
  1352.       Attr_ON(LINK);
  1353.       break;
  1354.  
  1355.     case 0xc4:
  1356.       Attr_OFF(LINK);
  1357.       break;
  1358.  
  1359.     default:
  1360.       if (LINK->by >= 0x20 && LINK->by <= 0x7f || LINK->by == 0xa9 ||
  1361.       LINK->by == 0xc0)
  1362.     Character(LINK);
  1363.       else if (LINK->by <= 0xbf)
  1364.     Nop80(LINK);
  1365.       else if (LINK->by >= 0xc0 && LINK->by <= 0xcf)
  1366.     NopC0(LINK);
  1367.       else if (LINK->by >= 0xd0 && LINK->by <= 0xfe)
  1368.     NopD0(false, LINK);
  1369.  
  1370.       break;
  1371.     }
  1372.  
  1373.   }
  1374.  
  1375.   Close_all_attr(LINK);   /* Echt nodig ? */
  1376.   putc('}', strip);
  1377.  
  1378.   Jump_in_file(&wpd, 4L);
  1379.  
  1380.   LINK->depth = 0;
  1381.   Open_all_attr(LINK);
  1382.  
  1383. }
  1384.  
  1385.  
  1386.  
  1387. Local Void Header_Footer(LINK)
  1388. struct LOC_Convert_first_strike *LINK;
  1389. {
  1390.   uchar subfunc, occurance;
  1391.   unsigned short len_of_code;
  1392.   long end_of_code;
  1393.  
  1394.   boolean hf_left, hf_center, hf_right;
  1395.  
  1396.   short j;
  1397.  
  1398.   fread(&subfunc, sizeof(uchar), 1, wpd);
  1399.   Rd_word(&wpd, &len_of_code);
  1400.  
  1401.   if (len_of_code <= 22) {
  1402.     Jump_in_file(&wpd, (long)len_of_code);
  1403.     return;
  1404.   }
  1405.  
  1406.  
  1407.   end_of_code = ftell(wpd) / sizeof(uchar) + len_of_code - 4;
  1408.  
  1409.   Jump_in_file(&wpd, 7L);
  1410.  
  1411.   fread(&occurance, sizeof(uchar), 1, wpd);
  1412.  
  1413.   Jump_in_file(&wpd, 10L);
  1414.  
  1415.   Close_all_attr(LINK);
  1416.   LINK->depth = 1;
  1417.  
  1418.   /* Geen schone attr._lei; Kopieer attributen uit Niveau 0;  Fout in WP 5.0 ? */
  1419.  
  1420.   for (j = 0; j <= 15; j++)
  1421.     LINK->attr_rij[1][j] = LINK->attr_rij[0][j];
  1422.  
  1423.   LINK->leegptr[1] = LINK->leegptr[0];
  1424.   LINK->openptr[1] = LINK->openptr[0];
  1425.  
  1426.   switch (subfunc) {
  1427.  
  1428.   case 0:
  1429.   case 1:
  1430.     fprintf(strip, "\\headtext");
  1431.     break;
  1432.  
  1433.   case 2:
  1434.   case 3:
  1435.     fprintf(strip, "\\foottext");
  1436.     break;
  1437.   }
  1438.  
  1439.   switch (occurance) {
  1440.  
  1441.   case 0:
  1442.     fprintf(strip, "{\\neverpages}{");
  1443.     break;
  1444.  
  1445.   case 1:
  1446.     fprintf(strip, "{\\allpages}{");
  1447.     break;
  1448.  
  1449.   case 2:
  1450.     fprintf(strip, "{\\oddpages}{");
  1451.     break;
  1452.  
  1453.   case 3:
  1454.     fprintf(strip, "{\\evenpages}{");
  1455.     break;
  1456.   }
  1457.  
  1458.   Open_all_attr(LINK);
  1459.   hf_left = true;   /* Beginnen met de linkerkant */
  1460.   hf_center = false;
  1461.   hf_right = false;
  1462.  
  1463.   while (ftell(wpd) / sizeof(uchar) < end_of_code) {
  1464.     fread(&LINK->by, sizeof(uchar), 1, wpd);
  1465.  
  1466.     switch (LINK->by) {
  1467.  
  1468.     case 0xc1:
  1469.       fread(&LINK->by, sizeof(uchar), 1, wpd);
  1470.       LINK->by &= 0xe0;
  1471.       Jump_in_file(&wpd, 7L);
  1472.  
  1473.       if (LINK->by == 0xe0) {
  1474.     if (hf_left) {
  1475.       Close_all_attr(LINK);
  1476.       fprintf(strip, "}{");
  1477.       Open_all_attr(LINK);
  1478.  
  1479.       hf_left = false;
  1480.       hf_center = true;
  1481.     }
  1482.       }
  1483.  
  1484.       if (LINK->by == 0x60) {
  1485.     if (hf_left) {
  1486.       Close_all_attr(LINK);
  1487.       fprintf(strip, "}{}{");
  1488.       Open_all_attr(LINK);
  1489.  
  1490.       hf_left = false;
  1491.       hf_right = true;
  1492.     }
  1493.  
  1494.     if (hf_center) {
  1495.       Close_all_attr(LINK);
  1496.       fprintf(strip, "}{");
  1497.       Open_all_attr(LINK);
  1498.  
  1499.       hf_center = false;
  1500.       hf_right = true;
  1501.     }
  1502.       }
  1503.       break;
  1504.  
  1505.     case 0xc3:
  1506.       Attr_ON(LINK);
  1507.       break;
  1508.  
  1509.     case 0xc4:
  1510.       Attr_OFF(LINK);
  1511.       break;
  1512.  
  1513.     default:
  1514.       if (LINK->by >= 0x20 && LINK->by <= 0x7f || LINK->by == 0xa9 ||
  1515.       LINK->by == 0xc0)
  1516.     Character(LINK);
  1517.       else if (LINK->by <= 0xbf)
  1518.     Nop80(LINK);
  1519.       else if (LINK->by >= 0xc0 && LINK->by <= 0xcf)
  1520.     NopC0(LINK);
  1521.       else if (LINK->by >= 0xd0 && LINK->by <= 0xfe)
  1522.     NopD0(false, LINK);
  1523.  
  1524.  
  1525.       break;
  1526.     }
  1527.   }
  1528.  
  1529.   Close_all_attr(LINK);   /* Echt nodig ? */
  1530.  
  1531.   Jump_in_file(&wpd, 4L);
  1532.  
  1533.   if (hf_left)
  1534.     fprintf(strip, "}{}{}");
  1535.   if (hf_center)
  1536.     fprintf(strip, "}{}");
  1537.   if (hf_right)
  1538.     putc('}', strip);
  1539.  
  1540.   LINK->depth = 0;
  1541.   Open_all_attr(LINK);
  1542.  
  1543.  
  1544.  
  1545. }
  1546.  
  1547.  
  1548. /*---SLAG1----*/
  1549.  
  1550. Static Void Convert_first_strike()
  1551. {
  1552.   /* Dit is de komplete procedure van de eerste slag met zijn eigen proc.'s. */
  1553.   struct LOC_Convert_first_strike V;
  1554.  
  1555.   short convperc;
  1556.  
  1557.   long srtdocpos, fsize;
  1558.  
  1559.  
  1560.   Table_Init(&V);
  1561.   Ext_chr_init(&V);
  1562.  
  1563.   Reset_attr_rij(0, &V);
  1564.   Reset_attr_rij(1, &V);
  1565.   V.depth = 0;
  1566.  
  1567.   WP_Default(&V);
  1568.  
  1569.   V.latex_tabpos = 0;
  1570.   V.right_tab = false;
  1571.   V.align_tab = false;
  1572.   V.center_tab = false;
  1573.  
  1574.   V.indenting = false;
  1575.   V.indent_end = false;
  1576.   V.ind_text1 = false;
  1577.   V.ind_text2 = false;
  1578.   V.ind_leftmargin = 0;
  1579.   V.ind_rightmargin = 0;
  1580.  
  1581.   V.envir = ' ';
  1582.  
  1583.   V.nomore_valid_tabs = false;
  1584.  
  1585.   printf("First strike :\n");
  1586. #ifndef sun
  1587.   printf("Converting-percentage :     ");
  1588. #endif
  1589.  
  1590.   srtdocpos = ftell(wpd) / sizeof(uchar);
  1591.   fsize = P_maxpos(wpd) / sizeof(uchar) + 1;
  1592.  
  1593.   V.regelnum = 0;
  1594.  
  1595.   Make_tabelentry_attr(&V);   /* attribuut instelling */
  1596.  
  1597.   Make_tabelentry_tabset(&V);   /* Geef de defaulttabinstelling door */
  1598.   /* aan de 2e slag */
  1599.  
  1600.   while (ftell(wpd) / sizeof(uchar) < fsize-2) {
  1601. #ifndef sun
  1602.     convperc = (long)floor((double)(ftell(wpd) / sizeof(uchar) - srtdocpos) /
  1603.                (fsize - srtdocpos) * 100 + 0.5);
  1604.     printf("\b\b\b\b%3d%%", convperc);
  1605. #endif
  1606.  
  1607.     fread(&V.by, sizeof(uchar), 1, wpd);
  1608.  
  1609.     switch (V.by) {
  1610.  
  1611.     case 0xa:
  1612.     case 0xd:
  1613.     case 0xb:
  1614.     case 0xc:
  1615.     case 0x8c:
  1616.       Return_Page(&V);
  1617.       break;
  1618.  
  1619.     case 0xc1:
  1620.       fread(&V.by, sizeof(uchar), 1, wpd);
  1621.       V.by &= 0xe8;
  1622.  
  1623.       switch (V.by) {
  1624.  
  1625.       case 0:
  1626.       case 0xc8:
  1627.       case 0x48:
  1628.       case 0x40:
  1629.     Tab(&V);
  1630.     break;
  1631.  
  1632.       case 0x60:
  1633.     Flush_right_tab(&V);
  1634.     break;
  1635.  
  1636.       case 0xe0:
  1637.     Center(&V);
  1638.     break;
  1639.  
  1640.       default:
  1641.     Jump_in_file(&wpd, 7L);
  1642.     break;
  1643.       }
  1644.       break;
  1645.  
  1646.     case 0x81:
  1647.     case 0x82:
  1648.       Make_tabelentry_rightjustification(&V);
  1649.       break;
  1650.  
  1651.     case 0x83:
  1652.       End_Align(&V);
  1653.       break;
  1654.  
  1655.     case 0xc3:
  1656.       Attr_ON(&V);
  1657.       break;
  1658.  
  1659.     case 0xc4:
  1660.       Attr_OFF(&V);
  1661.       break;
  1662.  
  1663.     case 0xc2:
  1664.       Indent(&V);
  1665.       break;
  1666.  
  1667.     case 0xc6:
  1668.       End_of_indent(&V);
  1669.       break;
  1670.  
  1671.     case 0xc5:
  1672.     case 0xc7:
  1673.       NopC0(&V);
  1674.       break;
  1675.  
  1676.     case 0xd0:
  1677.       fread(&V.by, sizeof(uchar), 1, wpd);
  1678.       switch (V.by) {
  1679.  
  1680.       case 0x4:
  1681.     Tabset(&V);
  1682.     break;
  1683.  
  1684.       case 0x8:
  1685.     Page_number_position(&V);
  1686.     break;
  1687.  
  1688.       default:
  1689.     NopD0(true, &V);
  1690.     break;
  1691.       }
  1692.       break;
  1693.  
  1694.     case 0xd5:
  1695.       Header_Footer(&V);
  1696.       break;
  1697.  
  1698.     case 0xd6:
  1699.       fread(&V.by, sizeof(uchar), 1, wpd);
  1700.       switch (V.by) {
  1701.  
  1702.       case 0:
  1703.     Footnote(&V);
  1704.     break;
  1705.  
  1706.       default:
  1707.     NopD0(true, &V);
  1708.     break;
  1709.       }
  1710.       break;
  1711.  
  1712.     case 0xd8:
  1713.       fread(&V.by, sizeof(uchar), 1, wpd);
  1714.       switch (V.by) {
  1715.  
  1716.       case 0x2:
  1717.     Overstrike(&V);
  1718.     break;
  1719.  
  1720.       default:
  1721.     NopD0(true, &V);
  1722.     break;
  1723.       }
  1724.       break;
  1725.  
  1726.     default:
  1727.       if (V.by >= 0x20 && V.by <= 0x7f || V.by == 0xa9 || V.by == 0xc0) {
  1728.     V.char_on_line = true;   /*Er (al) is een karakter op deze regel */
  1729.     if (V.indenting) {   /*Als er is ingeprongen er na een stuk */
  1730.       if (V.ind_text1)   /*tekst is weer ingesprongen (ind_text1) */
  1731.         V.ind_text2 = true;
  1732.     }
  1733.     /*dan hoort dit char bij het ind_txt-blok */
  1734.  
  1735.     Character(&V);
  1736.       } else if (V.by <= 0x1f || V.by >= 0x80 && V.by <= 0xbf)
  1737.     Nop80(&V);
  1738.       else if (V.by >= 0xd0 && V.by <= 0xff)
  1739.     NopD0(false, &V);
  1740.  
  1741.       break;
  1742.     }
  1743.   }
  1744.  
  1745.   putchar('\n');
  1746.   Make_tabelentry_envir_extra_end(&V);
  1747.  
  1748.   num_of_lines_stripfile = V.regelnum;
  1749.  
  1750.  
  1751.  
  1752.  
  1753. }
  1754.  
  1755.  
  1756. /* Local variables for Convert_second_strike: */
  1757. struct LOC_Convert_second_strike {
  1758.   boolean just_envir_closed;
  1759.  
  1760.   short num_of_tabs;
  1761.   unsigned short tabpos[40];
  1762.  
  1763.   short tabent_num_of_tabs[3];
  1764.   unsigned short tabent_tabpos[3][40];
  1765.  
  1766.   unsigned short ind_leftmargin[3], ind_rightmargin[3];
  1767.   uchar ind_label[3];
  1768.  
  1769.   short pre, cur, next;
  1770.  
  1771.   Char envir[3], line_term[3];
  1772.   boolean new_tabset[3];
  1773.   boolean new_rightjust;
  1774.   boolean new_tabent_rightjust[3], tabent_rightjust[3];
  1775.  
  1776.   short num_of_attr[3];
  1777.   uchar attr_BOL[3][0x11];
  1778.   boolean attr_closed;
  1779. } ;
  1780.  
  1781.  
  1782.  
  1783. Local Void Read_tabelentry(n, LINK)
  1784. short n;
  1785. struct LOC_Convert_second_strike *LINK;
  1786. {
  1787.   unsigned short w;
  1788.   uchar b;
  1789.   short j, FORLIM;
  1790.  
  1791.   /* Begin met een schone lei die dan door deze procedure verder wordt */
  1792.   /* opgevuld. */
  1793.  
  1794.   LINK->envir[n] = ' ';
  1795.   LINK->new_tabset[n] = false;
  1796.   LINK->new_tabent_rightjust[n] = false;
  1797.  
  1798.   LINK->num_of_attr[n] = 0;
  1799.   for (j = 1; j <= 16; j++)
  1800.     LINK->attr_BOL[n][j] = 0;
  1801.  
  1802.   if (ftell(tabel) / sizeof(uchar) > P_maxpos(tabel) / sizeof(uchar))
  1803.     return;
  1804.  
  1805.  
  1806.   /* Er is geen volgende tabelentry dus ook geen volgende regel */
  1807.   /* De tabelentry is 'schoon'.                                 */
  1808.   /* Zodat het document 'schoon' wordt afgesloten.              */
  1809.  
  1810.   fread(&b, sizeof(uchar), 1, tabel);
  1811.   LINK->num_of_attr[n] = b;
  1812.   FORLIM = LINK->num_of_attr[n];
  1813.   for (j = 1; j <= FORLIM; j++)
  1814.     fread(&LINK->attr_BOL[n][j], sizeof(uchar), 1, tabel);
  1815.  
  1816.   b = 0;
  1817.   while ((b != 0xff) && !feof(tabel)) {
  1818.     fread(&b, sizeof(uchar), 1, tabel);
  1819.  
  1820.     switch (b) {   /*Case*/
  1821.  
  1822.     case 'C':
  1823.       LINK->envir[n] = 'C';
  1824.       break;
  1825.  
  1826.     case 'T':
  1827.       LINK->envir[n] = 'T';
  1828.       break;
  1829.  
  1830.     case 'I':
  1831.       LINK->envir[n] = 'I';
  1832.       Rd_word(&tabel, &LINK->ind_leftmargin[n]);
  1833.       Rd_word(&tabel, &LINK->ind_rightmargin[n]);
  1834.       fread(&LINK->ind_label[n], sizeof(uchar), 1, tabel);
  1835.       break;
  1836.  
  1837.     case 'S':
  1838.       LINK->new_tabset[n] = true;
  1839.       fread(&b, sizeof(uchar), 1, tabel);
  1840.       LINK->tabent_num_of_tabs[n] = b;
  1841.  
  1842.       FORLIM = LINK->tabent_num_of_tabs[n];
  1843.       for (j = 0; j < FORLIM; j++) {
  1844.     Rd_word(&tabel, &w);
  1845.     LINK->tabent_tabpos[n][j] = w;
  1846.       }
  1847.       break;
  1848.  
  1849.     case 'U':
  1850.       LINK->new_tabent_rightjust[n] = true;
  1851.       fread(&b, sizeof(uchar), 1, tabel);
  1852.       if (b == 0)
  1853.     LINK->tabent_rightjust[n] = false;
  1854.       else
  1855.     LINK->tabent_rightjust[n] = true;
  1856.       break;
  1857.  
  1858.     case 'R':
  1859.     case 'r':
  1860.     case 'P':
  1861.     case 'p':
  1862.       LINK->line_term[n] = b;
  1863.       break;
  1864.  
  1865.     }
  1866.   }
  1867. }
  1868.  
  1869.  
  1870.  
  1871. Local Void Open_all_attr_BOL(LINK)
  1872. struct LOC_Convert_second_strike *LINK;
  1873. {
  1874.   /* -- Open alle commando's door de Attributen-rij af te lopen -- */
  1875.   short j, FORLIM;
  1876.  
  1877.   FORLIM = LINK->num_of_attr[LINK->cur];
  1878.   for (j = 0x1; j <= FORLIM; j++)
  1879.     fputs(open_com[LINK->attr_BOL[LINK->cur][j]], latex);
  1880.  
  1881.   LINK->attr_closed = false;
  1882. }
  1883.  
  1884.  
  1885. Local Void Close_all_attr_BOL(LINK)
  1886. struct LOC_Convert_second_strike *LINK;
  1887. {
  1888.   /* -- Sluit alle commando's door de Attributen-rij af te lopen -- */
  1889.   short j;
  1890.  
  1891.   for (j = LINK->num_of_attr[LINK->cur]; j >= 0x1; j--)
  1892.     fputs(close_com[LINK->attr_BOL[LINK->cur][j]], latex);
  1893.  
  1894.   LINK->attr_closed = true;
  1895. }
  1896.  
  1897.  
  1898.  
  1899. Local Void Open_all_attr_EOL(LINK)
  1900. struct LOC_Convert_second_strike *LINK;
  1901. {
  1902.   /* -- Open alle commando's door de Attributen-rij af te lopen -- */
  1903.   short j, FORLIM;
  1904.  
  1905.   FORLIM = LINK->num_of_attr[LINK->next];
  1906.   for (j = 0x1; j <= FORLIM; j++)
  1907.     fputs(open_com[LINK->attr_BOL[LINK->next][j]], latex);
  1908.  
  1909.   LINK->attr_closed = false;
  1910. }
  1911.  
  1912.  
  1913.  
  1914. Local Void Close_all_attr_EOL(LINK)
  1915. struct LOC_Convert_second_strike *LINK;
  1916. {
  1917.   /* -- Sluit alle commando's door de Attributen-rij af te lopen -- */
  1918.   short j;
  1919.  
  1920.   for (j = LINK->num_of_attr[LINK->next]; j >= 0x1; j--)
  1921.     fputs(close_com[LINK->attr_BOL[LINK->next][j]], latex);
  1922.  
  1923.   LINK->attr_closed = true;
  1924. }
  1925.  
  1926.  
  1927.  
  1928. Local Void Latex_head(LINK)
  1929. struct LOC_Convert_second_strike *LINK;
  1930. {
  1931.   /* -- Maak het de standard-heading voor een latex-file aan -- */
  1932.   fprintf(latex, "\\documentstyle[11pt,wp2latex]{report}\n");
  1933.   fprintf(latex, "\\begin{document}\n");
  1934. }
  1935.  
  1936.  
  1937.  
  1938. Local Void Latex_foot(LINK)
  1939. struct LOC_Convert_second_strike *LINK;
  1940. {
  1941.   /* -- Sluit de latex-file op de juiste wijze af -- */
  1942.   fprintf(latex, "\\end{document}\n");
  1943. }
  1944.  
  1945.  
  1946.  
  1947. Local Void Latex_tabset(LINK)
  1948. struct LOC_Convert_second_strike *LINK;
  1949. {
  1950.   short atpr, j;
  1951.   double l, ol;
  1952.   short FORLIM;
  1953.  
  1954.   atpr = 0;   /* Huiding aantal tabs per regel */
  1955.   ol = 0.0;
  1956.   FORLIM = LINK->num_of_tabs;
  1957.   for (j = 0; j < FORLIM; j++) {
  1958.     l = LINK->tabpos[j] / 1200.0 * 2.54;
  1959.     fprintf(latex, "\\hspace{%3.2fcm}\\=", l - ol);
  1960.     atpr++;
  1961.     if (atpr >= 4) {
  1962.       fprintf(latex, "%%\n");
  1963.       atpr = 0;
  1964.     }
  1965.     ol = l;
  1966.   }
  1967.   fprintf(latex, "\\kill\n");
  1968. }
  1969.  
  1970.  
  1971.  
  1972. Local boolean Change_envir_BOL(LINK)
  1973. struct LOC_Convert_second_strike *LINK;
  1974. {
  1975.   boolean hulp;
  1976.  
  1977.   hulp = false;
  1978.  
  1979.   hulp = (LINK->envir[LINK->cur] == 'C' && LINK->envir[LINK->pre] != 'C' ||
  1980.       hulp);
  1981.   hulp = (LINK->envir[LINK->cur] == 'T' && LINK->envir[LINK->pre] != 'T' ||
  1982.       hulp);
  1983.   hulp = (LINK->envir[LINK->cur] == 'I' && LINK->envir[LINK->pre] != 'I' ||
  1984.       hulp);
  1985.  
  1986.   return hulp;
  1987. }
  1988.  
  1989.  
  1990.  
  1991. Local boolean Change_envir_EOL(LINK)
  1992. struct LOC_Convert_second_strike *LINK;
  1993. {
  1994.   boolean hulp;
  1995.  
  1996.   hulp = false;
  1997.  
  1998.   hulp = (((LINK->envir[LINK->next] == 'C') ^ (LINK->envir[LINK->cur] == 'C')) ||
  1999.       hulp);
  2000.   hulp = (((LINK->envir[LINK->next] == 'T') ^ (LINK->envir[LINK->cur] == 'T')) ||
  2001.       hulp);
  2002.   hulp = (((LINK->envir[LINK->next] == 'I') ^ (LINK->envir[LINK->cur] == 'I')) ||
  2003.       hulp);
  2004.  
  2005.   return hulp;
  2006. }
  2007.  
  2008.  
  2009.  
  2010.  
  2011. Local Void Open_environment(LINK)
  2012. struct LOC_Convert_second_strike *LINK;
  2013. {
  2014.   if (!Change_envir_BOL(LINK)) {   /* andere environment ? */
  2015.     if (LINK->new_tabset[LINK->cur] && LINK->envir[LINK->cur] == 'T')
  2016.       Latex_tabset(LINK);
  2017.     return;
  2018.   }
  2019.  
  2020.  
  2021.   if (!LINK->attr_closed)
  2022.     Close_all_attr_BOL(LINK);
  2023.  
  2024.   switch (LINK->envir[LINK->cur]) {
  2025.  
  2026.   case 'C':
  2027.     fprintf(latex, "\\begin{center}\n");
  2028.     break;
  2029.  
  2030.   case 'T':
  2031.     fprintf(latex, "\\begin{tabbing}\n");
  2032.     Latex_tabset(LINK);
  2033.     break;
  2034.  
  2035.   case 'I':
  2036.     fprintf(latex, "\\begin{indenting}");
  2037.     fprintf(latex, "{%3.2fcm}",
  2038.         LINK->ind_leftmargin[LINK->cur] / 1200.0 * 2.54);
  2039.     fprintf(latex, "{%3.2fcm}",
  2040.         LINK->ind_rightmargin[LINK->cur] / 1200.0 * 2.54);
  2041.     if (LINK->ind_label[LINK->cur] == 1) {
  2042.       fprintf(latex, "%%\n");
  2043.       putc('{', latex);
  2044.     } else
  2045.       fprintf(latex, "{}\n");
  2046.     break;
  2047.   }
  2048.  
  2049. }
  2050.  
  2051.  
  2052.  
  2053. Local Void Close_environment(LINK)
  2054. struct LOC_Convert_second_strike *LINK;
  2055. {
  2056.   switch (LINK->envir[LINK->cur]) {
  2057.  
  2058.   case 'C':
  2059.     fprintf(latex, "\\end{center}\n");
  2060.     break;
  2061.  
  2062.   case 'T':
  2063.     fprintf(latex, "\\end{tabbing}\n");
  2064.     break;
  2065.  
  2066.   case 'I':
  2067.     fprintf(latex, "\\end{indenting}\n");
  2068.     break;
  2069.   }
  2070.  
  2071.   LINK->just_envir_closed = true;
  2072.  
  2073. }
  2074.  
  2075.  
  2076.  
  2077. Local Void Update_global_information(LINK)
  2078. struct LOC_Convert_second_strike *LINK;
  2079. {
  2080.   short j, FORLIM;
  2081.  
  2082.   if (LINK->new_tabset[LINK->cur]) {
  2083.     LINK->num_of_tabs = LINK->tabent_num_of_tabs[LINK->cur];
  2084.     FORLIM = LINK->num_of_tabs;
  2085.     for (j = 0; j < FORLIM; j++)
  2086.       LINK->tabpos[j] = LINK->tabent_tabpos[LINK->cur][j];
  2087.   }
  2088.  
  2089.   if (LINK->new_tabent_rightjust[LINK->cur])
  2090.     LINK->new_rightjust = LINK->tabent_rightjust[LINK->cur];
  2091.  
  2092. }
  2093.  
  2094.  
  2095. Local Void Change_tabelentry(LINK)
  2096. struct LOC_Convert_second_strike *LINK;
  2097. {
  2098.   short help;
  2099.  
  2100.   help = LINK->pre;
  2101.   LINK->pre = LINK->cur;
  2102.   LINK->cur = LINK->next;
  2103.   LINK->next = help;
  2104.   Read_tabelentry(LINK->next, LINK);
  2105. }
  2106.  
  2107.  
  2108. /*---SLAG2---*/
  2109.  
  2110. Static Void Convert_second_strike()
  2111. {
  2112.   struct LOC_Convert_second_strike V;
  2113.   unsigned short regelnum;
  2114.   short convperc;
  2115.  
  2116.   boolean underline;
  2117.  
  2118.   short i;
  2119.  
  2120.   Char regel[256], hulp_regel[256];
  2121.   short len_reg;
  2122.  
  2123.   boolean rightjust;
  2124.   Char STR3[256];
  2125.   Char *TEMP;
  2126.  
  2127.  
  2128.   V.pre = 0;
  2129.   V.cur = 1;
  2130.   V.next = 2;
  2131.  
  2132.   V.envir[V.pre] = ' ';
  2133.   V.new_tabset[V.pre] = false;
  2134.  
  2135.   V.just_envir_closed = true;
  2136.   V.attr_closed = false;
  2137.  
  2138.   rightjust = true;
  2139.   V.new_rightjust = true;
  2140.   for (i = 0; i <= 2; i++) {
  2141.     V.new_tabent_rightjust[i] = false;
  2142.     V.tabent_rightjust[i] = false;
  2143.   }
  2144.  
  2145.   Read_tabelentry(V.cur, &V);
  2146.   Read_tabelentry(V.next, &V);
  2147.  
  2148.   regelnum = 1;
  2149.  
  2150.   printf("\nSecond strike :\n");
  2151. #ifndef sun
  2152.   printf("Converting-percentage :     ");
  2153. #endif
  2154.  
  2155.  
  2156.  
  2157.   Latex_head(&V);
  2158.  
  2159.   while (!P_eof(strip)) {
  2160.     Update_global_information(&V);
  2161.  
  2162. #ifndef sun
  2163.     convperc = (long)floor(regelnum * 100.0 / num_of_lines_stripfile + 0.5);
  2164.     if (convperc > 100)
  2165.       convperc = 100;
  2166.     printf("\b\b\b\b%3d%%", convperc);
  2167. #endif
  2168.  
  2169.     fgets(regel, 256, strip);
  2170.     TEMP = (char *)strchr(regel, '\n');
  2171.     if (TEMP != NULL)
  2172.       *TEMP = 0;
  2173.  
  2174.     /* Werk eventueel de regel bij d.m.v. een hulp regel. */
  2175.  
  2176.     strcpy(hulp_regel, regel);
  2177.     len_reg = strlen(hulp_regel);
  2178.  
  2179.     /* Meerdere spaties achter elkaar vervangen door harde spaties. */
  2180.  
  2181.     for (i = 1; i < len_reg; i++) {
  2182.       if (regel[i - 1] == ' ' && regel[i] == ' ')
  2183.     hulp_regel[i] = '~';
  2184.     }
  2185.  
  2186.     /* Zoek naar een illegaal argument en zet hier accolades voor. */
  2187.  
  2188.     if (len_reg >= 1 && hulp_regel[0] == '[' ||
  2189.     len_reg >= 2 && hulp_regel[0] == ' ' && hulp_regel[1] == '[')
  2190.       sprintf(hulp_regel, "{}%s", strcpy(STR3, hulp_regel));
  2191.  
  2192.     /* De regel is verwerkt. */
  2193.  
  2194.     strcpy(regel, hulp_regel);
  2195.     len_reg = strlen(regel);
  2196.  
  2197.     if (V.new_rightjust ^ rightjust) {
  2198.       rightjust = V.new_rightjust;
  2199.       if (rightjust)
  2200.     fprintf(latex, "\\justified\n");
  2201.       else
  2202.     fprintf(latex, "\\raggedright\n");
  2203.     }
  2204.  
  2205.     Open_environment(&V);
  2206.  
  2207.     if (len_reg > 0) {
  2208.       if (V.attr_closed)
  2209.     Open_all_attr_BOL(&V);
  2210.  
  2211.       fputs(regel, latex);
  2212.  
  2213.       V.just_envir_closed = false;
  2214.     }
  2215.  
  2216.     switch (V.line_term[V.cur]) {   /*Case*/
  2217.  
  2218.     case 'r':
  2219.     case 'p':
  2220.       fputc('\n', latex);
  2221.       if (Change_envir_EOL(&V)) {
  2222.          if (!V.attr_closed) {
  2223.            Close_all_attr_EOL(&V);
  2224.          }
  2225.  
  2226.          Close_environment(&V);
  2227.       }
  2228.       break;
  2229.  
  2230.     case 'R':
  2231.       if (V.envir[V.cur] == 'I') {
  2232.     if (!V.attr_closed)
  2233.       Close_all_attr_EOL(&V);
  2234.  
  2235.     putc('\n', latex);
  2236.     Close_environment(&V);
  2237.     V.envir[V.cur] = ' ';
  2238.       } else {
  2239.     underline = false;
  2240.     for (i = 0x1; i <= 0x10; i++)
  2241.       underline = (underline || V.attr_BOL[V.next][i] == 0xb ||
  2242.                V.attr_BOL[V.next][i] == 0xe);
  2243.  
  2244.     if (underline && !V.attr_closed)
  2245.       Close_all_attr_EOL(&V);
  2246.  
  2247.     /* Elke Indent-environment moet na een harde Return*/
  2248.     /* Afgesloten worden.*/
  2249.  
  2250.  
  2251.     if (Change_envir_EOL(&V)) {
  2252.       if (V.just_envir_closed)
  2253.         fprintf(latex, "\\nwln\n");
  2254.       else
  2255.         putc('\n', latex);
  2256.  
  2257.       if (!V.attr_closed)
  2258.         Close_all_attr_EOL(&V);
  2259.  
  2260.       Close_environment(&V);
  2261.     } else {
  2262.       if (V.just_envir_closed)
  2263.         fprintf(latex, "\\nwln\n");
  2264.       else
  2265.         fprintf(latex, "\\\\\n");
  2266.     }
  2267.       }
  2268.  
  2269.       break;
  2270.  
  2271.  
  2272.     case 'P':
  2273.       if (!V.attr_closed)
  2274.     Close_all_attr_EOL(&V);
  2275.  
  2276.       putc('\n', latex);
  2277.       Close_environment(&V);
  2278.       fprintf(latex, "\\newpage\n");
  2279.       V.envir[V.cur] = ' ';
  2280.       break;
  2281.  
  2282.     }
  2283.  
  2284.  
  2285.  
  2286.     Change_tabelentry(&V);
  2287.  
  2288.     regelnum++;
  2289.   }
  2290.  
  2291.   Latex_foot(&V);
  2292.   putchar('\n');
  2293. }
  2294.  
  2295. /*---HOOFDPROG---*/
  2296.  
  2297. main(argc, argv)
  2298. int argc;
  2299. Char *argv[];
  2300. {
  2301.  
  2302.   PASCAL_MAIN(argc, argv);
  2303.   latex = NULL;
  2304.   strip = NULL;
  2305.   tabel = NULL;
  2306.   wpd = NULL;
  2307.  
  2308.   Init_commando();
  2309.  
  2310.   /* ClrScr(); */
  2311.   putchar(0xc);
  2312.   printf("\n     Conversion program : From Wordperfect 5.1 to LaTeX  (wp2latex)\n\n");
  2313.   printf("  (c) TUE-Eindhoven ---- Written by R.C.Houtepen ---- Date : 24 Jan 1990\n");
  2314.   printf("      Translated into C by G. Geers ---- Date : 2 Aug 1990\n");
  2315.  
  2316.   Filenames();
  2317.  
  2318.   if (wpd != NULL)
  2319.     wpd = freopen(wpd_NAME, "r+b", wpd);
  2320.   else
  2321.     wpd = fopen(wpd_NAME, "r+b");
  2322.   if (wpd == NULL)
  2323.     _EscIO(FileNotFound);
  2324.   Wpd_check();
  2325.  
  2326.   if (strip != NULL)
  2327.     strip = freopen(strip_NAME, "w", strip);
  2328.   else
  2329.     strip = fopen(strip_NAME, "w");
  2330.   if (strip == NULL)
  2331.     _EscIO(FileNotFound);
  2332.   if (tabel != NULL)
  2333.     tabel = freopen(tabel_NAME, "w+b", tabel);
  2334.   else
  2335.     tabel = fopen(tabel_NAME, "w+b");
  2336.   if (tabel == NULL)
  2337.     _EscIO(FileNotFound);
  2338.  
  2339.   printf("Converting ...\n\n");
  2340.  
  2341.   Convert_first_strike();
  2342.  
  2343.   if (wpd != NULL)
  2344.     fclose(wpd);
  2345.   wpd = NULL;
  2346.   if (strip != NULL)
  2347.     fclose(strip);
  2348.   strip = NULL;
  2349.   if (tabel != NULL)
  2350.     fclose(tabel);
  2351.   tabel = NULL;
  2352.  
  2353.   if (strip != NULL)
  2354.     strip = freopen(strip_NAME, "r", strip);
  2355.   else
  2356.     strip = fopen(strip_NAME, "r");
  2357.   if (strip == NULL)
  2358.     _EscIO(FileNotFound);
  2359.   if (tabel != NULL)
  2360.     tabel = freopen(tabel_NAME, "r+b", tabel);
  2361.   else
  2362.     tabel = fopen(tabel_NAME, "r+b");
  2363.   if (tabel == NULL)
  2364.     _EscIO(FileNotFound);
  2365.   if (latex != NULL)
  2366.     latex = freopen(latex_NAME, "w", latex);
  2367.   else
  2368.     latex = fopen(latex_NAME, "w");
  2369.   if (latex == NULL)
  2370.     _EscIO(FileNotFound);
  2371.  
  2372.   Convert_second_strike();
  2373.  
  2374.   if (wpd != NULL)
  2375.     fclose(wpd);
  2376.   if (latex != NULL)
  2377.     fclose(latex);
  2378.  
  2379. /*
  2380. ** Delete auxillary files
  2381. */
  2382.   if (strip != NULL)
  2383.     unlink(strip_fn);
  2384.   if (tabel != NULL)
  2385.     unlink(tabel_fn);
  2386.  
  2387.   printf("\nConversion completed.\n");
  2388.   exit(0);
  2389. }
  2390. /* End. */
  2391.  
  2392. /*
  2393. ** Extras - hand coded 
  2394. */
  2395.  
  2396. Static Void
  2397. RunError(errcode)
  2398. int errcode;
  2399. {
  2400.     switch (errcode) {
  2401.         case 0x201:
  2402.             fprintf(stderr, "Not a WordPerfect 5.1 document !\n");
  2403.             break;
  2404.         case 0x200:
  2405.             fprintf(stderr, "No filename entered !\n");
  2406.             break;
  2407.         case 0x100:
  2408.             fprintf(stderr, "Program error.\n");
  2409.             break;
  2410.         case 0x03:
  2411.             fprintf(stderr, "Path not found.\n");
  2412.             break;
  2413.         case 0x02:
  2414.             fprintf(stderr, "File not found.\n");
  2415.             break;
  2416.     }
  2417.     exit(errcode);
  2418. }
  2419.