home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume17 / xdvi / patch13 < prev    next >
Encoding:
Text File  |  1992-04-07  |  38.3 KB  |  1,598 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!haven.umd.edu!darwin.sura.net!mips!msi!dcmartin
  3. From: vojta@math.berkeley.edu (Paul Vojta)
  4. Subject: v17i053: xdvi, Patch13, Part01/01
  5. Message-ID: <1992Apr8.163536.16361@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Nntp-Posting-Host: fascet
  9. Organization: Molecular Simulations, Inc.
  10. References: <csx-17i053-xdvi/patch13@uunet.UU.NET>
  11. Date: Wed, 8 Apr 1992 16:35:36 GMT
  12. Approved: dcmartin@msi.com
  13.  
  14. Submitted-by: vojta@math.berkeley.edu (Paul Vojta)
  15. Posting-number: Volume 17, Issue 53
  16. Archive-name: xdvi/patch13
  17. Patch-To: xdvi: Volume 17, Issues 23, 24, 25, 40, 41, 27
  18.  
  19.      This patch implements the standard TeXXeT .dvi op codes to accommodate
  20. right-to-left languages (Hebrew, Arabic, etc.).  It also fixes some bugs,
  21. including one concerned with changing the shrink factor.
  22.  
  23.      Many thanks to Michael Pak <misha@cs.huji.ac.il> for help with this.
  24.  
  25. --Paul Vojta, vojta@math.berkeley.edu
  26.  
  27. -- cut here --
  28. diff -cr xdvi_old/README xdvi_new/README
  29. *** xdvi_old/README    Tue Mar 17 17:03:10 1992
  30. --- xdvi_new/README    Fri Mar 27 21:03:14 1992
  31. ***************
  32. *** 77,82 ****
  33. --- 77,84 ----
  34.       A4        (xdvi.c)  Use European size paper by default.
  35.       NOQUERY        (xdvi.c)  Set this if you have trouble compiling the
  36.               definition of drawingWidgetClass.
  37. +     TEXXET        (everything)  Enables op-codes 250 and 251 (used for
  38. +             right-to-left languages).
  39.   
  40.   All flags should be set in the appropriate Makefile via the variable ``DEFS''.
  41.   
  42. ***************
  43. *** 239,244 ****
  44.   --  Patchlevel 12: --
  45.      29.  Implemented virtual fonts (this does not include built-in
  46.       Postscript<tm> fonts!!!).
  47. !    30.    Numerous bug fixes, and X11R5 support.
  48.   
  49.   Paul Vojta, vojta@math.berkeley.edu
  50. --- 241,248 ----
  51.   --  Patchlevel 12: --
  52.      29.  Implemented virtual fonts (this does not include built-in
  53.       Postscript<tm> fonts!!!).
  54. !    30.    X11R5 support, and numerous bug fixes.
  55. ! --  Patchlevel 13: --
  56. !    31.  Added support for TeXXeT.
  57.   
  58.   Paul Vojta, vojta@math.berkeley.edu
  59. diff -cr xdvi_old/dvi.h xdvi_new/dvi.h
  60. *** xdvi_old/dvi.h    Sun Jan 19 14:41:15 1992
  61. --- xdvi_new/dvi.h    Fri Mar 27 12:27:15 1992
  62. ***************
  63. *** 56,60 ****
  64. --- 56,62 ----
  65.   #define    PRE        247
  66.   #define    POST        248
  67.   #define    POSTPOST    249
  68. + #define    SREFL        250
  69. + #define    EREFL        251
  70.   
  71.   #define    TRAILER        223    /* Trailing bytes at end of file */
  72. diff -cr xdvi_old/dvi_draw.c xdvi_new/dvi_draw.c
  73. *** xdvi_old/dvi_draw.c    Tue Feb 11 13:22:33 1992
  74. --- xdvi_new/dvi_draw.c    Sat Mar 28 13:00:26 1992
  75. ***************
  76. *** 13,18 ****
  77. --- 13,19 ----
  78.    * 2/1989    Added tpic support    --Jeffrey Lee, U of Toronto
  79.    * 4/1989    Modified for System V by Donald Richardson, Clarkson Univ.
  80.    * 3/1990    Added VMS support    --Scott Allendorf, U of Iowa
  81. +  * 7/1990    Added reflection mode    --Michael Pak, Hebrew U of Jerusalem
  82.    *
  83.    *    Compilation options:
  84.    *    SYSV    compile for System V
  85. ***************
  86. *** 25,30 ****
  87. --- 26,32 ----
  88.    *    BMLONG    store bitmaps in longs instead of bytes
  89.    *    ALTFONT    default for -altfont option
  90.    *    A4    use European size paper
  91. +  *    TEXXET    support reflection dvi codes (right-to-left typesetting)
  92.    */
  93.   
  94.   #include <ctype.h>
  95. ***************
  96. *** 36,41 ****
  97. --- 38,46 ----
  98.   #endif
  99.   
  100.   static    struct frame    frame0;        /* dummy head of list */
  101. + #ifdef    TEXXET
  102. + static    struct frame    *scan_frame;    /* head frame for scanning */
  103. + #endif
  104.   
  105.   #ifndef    DVI_BUFFER_LEN
  106.   #define    DVI_BUFFER_LEN    512
  107. ***************
  108. *** 44,49 ****
  109. --- 49,60 ----
  110.   static    ubyte    dvi_buffer[DVI_BUFFER_LEN];
  111.   static    struct frame    *current_frame;
  112.   
  113. + #ifndef    TEXXET
  114. + #define    DIR    1
  115. + #else
  116. + #define    DIR    currinf.dir
  117. + #endif
  118.   /*
  119.    *    Explanation of the following constant:
  120.    *    offset_[xy]   << 16:    margin (defaults to one inch)
  121. ***************
  122. *** 84,96 ****
  123.   #endif    /* BMLONG */
  124.   
  125.   extern    char    *xmalloc();
  126. - extern    volatile void    exit();
  127.   
  128.   #ifndef VMS
  129.   extern    off_t    lseek();
  130.   #else
  131. ! extern  int     lseek();
  132.   #endif
  133.   
  134.   #ifndef    SEEK_SET    /* if <unistd.h> is not provided (or for <X11R5) */
  135.   #define    SEEK_SET    0
  136. --- 95,107 ----
  137.   #endif    /* BMLONG */
  138.   
  139.   extern    char    *xmalloc();
  140.   
  141.   #ifndef VMS
  142.   extern    off_t    lseek();
  143.   #else
  144. ! extern    int    lseek();
  145.   #endif
  146. + extern    long    tell();
  147.   
  148.   #ifndef    SEEK_SET    /* if <unistd.h> is not provided (or for <X11R5) */
  149.   #define    SEEK_SET    0
  150. ***************
  151. *** 148,154 ****
  152.   static    _Xconst    char    *dvi_table2[] = {
  153.       "FNT1", "FNT2", "FNT3", "FNT4", "XXX1", "XXX2", "XXX3", "XXX4",
  154.       "FNTDEF1", "FNTDEF2", "FNTDEF3", "FNTDEF4", "PRE", "POST", "POSTPOST",
  155. !     NULL, NULL, NULL, NULL, NULL, NULL};
  156.   
  157.   static    void
  158.   print_dvi(ch)
  159. --- 159,165 ----
  160.   static    _Xconst    char    *dvi_table2[] = {
  161.       "FNT1", "FNT2", "FNT3", "FNT4", "XXX1", "XXX2", "XXX3", "XXX4",
  162.       "FNTDEF1", "FNTDEF2", "FNTDEF3", "FNTDEF4", "PRE", "POST", "POSTPOST",
  163. !     "SREFL", "EREFL", NULL, NULL, NULL, NULL};
  164.   
  165.   static    void
  166.   print_dvi(ch)
  167. ***************
  168. *** 169,177 ****
  169.           Printf("FNTNUM%d\n", ch - FNTNUM0);
  170.           return;
  171.       }
  172. !     else s = dvi_table2[ch - (FNTNUM0+64)];
  173.       if (s) puts(s);
  174. !     else oops("Unknown op-code %d, offset %d", ch, ftell(dvi_file) - 1);
  175.   }
  176.   
  177.   /*
  178. --- 180,193 ----
  179.           Printf("FNTNUM%d\n", ch - FNTNUM0);
  180.           return;
  181.       }
  182. !     else s = dvi_table2[ch - (FNTNUM0 + 64)];
  183.       if (s) puts(s);
  184. !     else
  185. !         if (currinf.virtual)
  186. !         oops("Unknown op-code %d in virtual font", ch);
  187. !         else
  188. !         oops("Unknown op-code %d, offset %d", ch,
  189. !             tell(fileno(dvi_file)) - (currinf.end - currinf.pos + 1));
  190.   }
  191.   
  192.   /*
  193. ***************
  194. *** 186,192 ****
  195.           return EOP;
  196.       }
  197.       currinf.end = dvi_buffer +
  198. !         read(fileno(dvi_file), (_Xconst char *) (currinf.pos = dvi_buffer),
  199.           DVI_BUFFER_LEN);
  200.       return currinf.end > dvi_buffer ? *(currinf.pos)++ : EOF;
  201.   }
  202. --- 202,208 ----
  203.           return EOP;
  204.       }
  205.       currinf.end = dvi_buffer +
  206. !         read(fileno(dvi_file), (char *) (currinf.pos = dvi_buffer),
  207.           DVI_BUFFER_LEN);
  208.       return currinf.end > dvi_buffer ? *(currinf.pos)++ : EOF;
  209.   }
  210. ***************
  211. *** 402,412 ****
  212.       }
  213.   }
  214.   
  215.   long
  216.   set_char(ch)
  217. !     ubyte ch;
  218.   {
  219.       register struct glyph *g;
  220.   
  221.       if (ch > maxchar) realloc_font(currinf.fontp, ch);
  222.       if ((g = &currinf.fontp->glyph[ch])->bitmap.bits == NULL) {
  223. --- 418,448 ----
  224.       }
  225.   }
  226.   
  227. + /*
  228. +  *    Routines to print characters.
  229. +  */
  230. + #ifndef    TEXXET
  231. + #define    ERRVAL    0L
  232. + #else
  233. + #define    ERRVAL
  234. + #endif
  235. + #ifndef    TEXXET
  236.   long
  237.   set_char(ch)
  238. ! #else
  239. ! void
  240. ! set_char(cmd, ch)
  241. !     ubyte    cmd;
  242. ! #endif
  243. !     ubyte    ch;
  244.   {
  245.       register struct glyph *g;
  246. + #ifdef    TEXXET
  247. +     long    dvi_h_sav;
  248. + #endif
  249.   
  250.       if (ch > maxchar) realloc_font(currinf.fontp, ch);
  251.       if ((g = &currinf.fontp->glyph[ch])->bitmap.bits == NULL) {
  252. ***************
  253. *** 415,423 ****
  254.               Fprintf(stderr, "Character %d not defined in font %s\n", ch,
  255.               currinf.fontp->fontname);
  256.           g->addr = -1;
  257. !         return 0L;
  258.           }
  259. !         if (g->addr == -1) return 0L; /* previously flagged missing char */
  260.           open_font_file(currinf.fontp);
  261.           Fseek(currinf.fontp->file, g->addr, 0);
  262.           (*currinf.fontp->read_char)(currinf.fontp, ch);
  263. --- 451,460 ----
  264.               Fprintf(stderr, "Character %d not defined in font %s\n", ch,
  265.               currinf.fontp->fontname);
  266.           g->addr = -1;
  267. !         return ERRVAL;
  268.           }
  269. !         if (g->addr == -1)
  270. !         return ERRVAL;    /* previously flagged missing char */
  271.           open_font_file(currinf.fontp);
  272.           Fseek(currinf.fontp->file, g->addr, 0);
  273.           (*currinf.fontp->read_char)(currinf.fontp, ch);
  274. ***************
  275. *** 425,463 ****
  276.           currinf.fontp->timestamp = ++current_timestamp;
  277.       }
  278.   
  279. !     if (shrink_factor == 1)
  280. !         put_bitmap(&g->bitmap, PXL_H - g->x, PXL_V - g->y);
  281. !     else {
  282. !         if (g->bitmap2.bits == NULL) {
  283. !         shrink_glyph(g);
  284.           }
  285. !         put_bitmap(&g->bitmap2, PXL_H - g->x2, PXL_V - g->y2);
  286. !     }
  287.       return g->dvi_adv;
  288.   }
  289.   
  290.   
  291. ! static    long
  292. ! set_first_font_char(ch)
  293. !     ubyte    ch;
  294. ! {
  295. !     currinf.fontp = currinf.fontp->first_font;
  296. !     if (currinf.fontp == NULL) oops("Non-existent font");
  297. !     if (!(currinf.fontp->flags & FONT_LOADED))
  298. !         load_font(currinf.fontp);
  299. !     maxchar = currinf.fontp->maxchar;
  300. !     currinf.set_char_p = currinf.fontp->set_char_p;
  301. !     return (*currinf.set_char_p)(ch);
  302. ! }
  303.   long
  304.   set_vf_char(ch)
  305.       ubyte    ch;
  306.   {
  307.       register struct macro *m;
  308.       struct drawinf    oldinfo;
  309.       static    ubyte    c;
  310.   
  311.       if (ch > maxchar) realloc_virtual_font(currinf.fontp, ch);
  312.       if ((m = &currinf.fontp->macro[ch])->pos == NULL) {
  313. --- 462,509 ----
  314.           currinf.fontp->timestamp = ++current_timestamp;
  315.       }
  316.   
  317. ! #ifdef    TEXXET
  318. !     dvi_h_sav = DVI_H;
  319. !     if (currinf.dir < 0) DVI_H -= g->dvi_adv;
  320. !     if (scan_frame == NULL) {
  321. ! #endif
  322. !         if (shrink_factor == 1)
  323. !         put_bitmap(&g->bitmap, PXL_H - g->x, PXL_V - g->y);
  324. !         else {
  325. !         if (g->bitmap2.bits == NULL) {
  326. !             shrink_glyph(g);
  327. !         }
  328. !         put_bitmap(&g->bitmap2, PXL_H - g->x2, PXL_V - g->y2);
  329.           }
  330. ! #ifndef    TEXXET
  331.       return g->dvi_adv;
  332. + #else
  333. +     }
  334. +     if (cmd == PUT1)
  335. +         DVI_H = dvi_h_sav;
  336. +     else
  337. +         if (currinf.dir > 0) DVI_H += g->dvi_adv;
  338. + #endif
  339.   }
  340.   
  341.   
  342. ! #ifndef    TEXXET
  343.   long
  344.   set_vf_char(ch)
  345. + #else
  346. + void
  347. + set_vf_char(cmd, ch)
  348. +     ubyte    cmd;
  349. + #endif
  350.       ubyte    ch;
  351.   {
  352.       register struct macro *m;
  353.       struct drawinf    oldinfo;
  354. +     ubyte    oldmaxchar;
  355.       static    ubyte    c;
  356. + #ifdef    TEXXET
  357. +     long    dvi_h_sav;
  358. + #endif
  359.   
  360.       if (ch > maxchar) realloc_virtual_font(currinf.fontp, ch);
  361.       if ((m = &currinf.fontp->macro[ch])->pos == NULL) {
  362. ***************
  363. *** 465,495 ****
  364.           Fprintf(stderr, "Character %d not defined in font %s\n", ch,
  365.               currinf.fontp->fontname);
  366.           m->pos = m->end = &c;
  367. !         return 0L;
  368.       }
  369. !     oldinfo = currinf;
  370. !     WW = XX = YY = ZZ = 0;
  371. !     currinf.tn_head = currinf.fontp->vf_chain;
  372. !     currinf.set_char_p = set_first_font_char;
  373. !     currinf.pos = m->pos;
  374. !     currinf.end = m->end;
  375. !     currinf.virtual = True;
  376. !     draw_part(current_frame, currinf.fontp->dimconv);
  377. !     if (currinf.pos != currinf.end + 1)
  378. !         oops("Virtual character macro does not end correctly.");
  379. !     currinf = oldinfo;
  380.       return m->dvi_adv;
  381.   }
  382.   
  383. ! /*ARGSUSED*/
  384. ! static    long
  385.   set_no_char(ch)
  386.       ubyte    ch;
  387.   {
  388.       oops("Dvi file or vf macro sets character of unknown font.");
  389.       /* NOTREACHED */
  390.   }
  391.   
  392.   /*
  393.    *    Set rule.  Arguments are coordinates of lower left corner.
  394.    */
  395. --- 511,577 ----
  396.           Fprintf(stderr, "Character %d not defined in font %s\n", ch,
  397.               currinf.fontp->fontname);
  398.           m->pos = m->end = &c;
  399. !         return ERRVAL;
  400.       }
  401. ! #ifdef    TEXXET
  402. !     dvi_h_sav = DVI_H;
  403. !     if (currinf.dir < 0) DVI_H -= m->dvi_adv;
  404. !     if (scan_frame == NULL) {
  405. ! #endif
  406. !         oldinfo = currinf;
  407. !         oldmaxchar = maxchar;
  408. !         WW = XX = YY = ZZ = 0;
  409. !         currinf.tn_head = currinf.fontp->vf_chain;
  410. !         currinf.pos = m->pos;
  411. !         currinf.end = m->end;
  412. !         currinf.virtual = True;
  413. !         draw_part(current_frame, currinf.fontp->dimconv);
  414. !         if (currinf.pos != currinf.end + 1)
  415. !         oops("Virtual character macro does not end correctly.");
  416. !         currinf = oldinfo;
  417. !         maxchar = oldmaxchar;
  418. ! #ifndef    TEXXET
  419.       return m->dvi_adv;
  420. + #else
  421. +     }
  422. +     if (cmd == PUT1)
  423. +         DVI_H = dvi_h_sav;
  424. +     else
  425. +         if (currinf.dir > 0) DVI_H += m->dvi_adv;
  426. + #endif
  427.   }
  428.   
  429. ! #ifndef    TEXXET
  430. ! long
  431.   set_no_char(ch)
  432. + #else
  433. + void
  434. + set_no_char(cmd, ch)
  435. +     ubyte    cmd;
  436. + #endif
  437.       ubyte    ch;
  438.   {
  439. +     if (currinf.virtual) {
  440. +         currinf.fontp = currinf.fontp->first_font;
  441. +         if (currinf.fontp != NULL) {
  442. +         if (!(currinf.fontp->flags & FONT_LOADED))
  443. +             load_font(currinf.fontp);
  444. +         maxchar = currinf.fontp->maxchar;
  445. +         currinf.set_char_p = currinf.fontp->set_char_p;
  446. + #ifndef    TEXXET
  447. +         return (*currinf.set_char_p)(ch);
  448. + #else
  449. +         (*currinf.set_char_p)(cmd, ch);
  450. +         return;
  451. + #endif
  452. +         }
  453. +     }
  454.       oops("Dvi file or vf macro sets character of unknown font.");
  455.       /* NOTREACHED */
  456.   }
  457.   
  458.   /*
  459.    *    Set rule.  Arguments are coordinates of lower left corner.
  460.    */
  461. ***************
  462. *** 498,504 ****
  463. --- 580,591 ----
  464.   set_rule(h, w)
  465.       int h, w;
  466.   {
  467. + #ifndef    TEXXET
  468.       put_rectangle(PXL_H, PXL_V - h + 1, w, h, False);
  469. + #else
  470. +     put_rectangle(PXL_H - (currinf.dir < 0 ? w - 1 : 0), PXL_V - h + 1,
  471. +         w, h, False);
  472. + #endif
  473.   }
  474.   
  475.   static    void
  476. ***************
  477. *** 549,574 ****
  478.       double        current_dimconv;
  479.   {
  480.       ubyte ch;
  481.   
  482.       for (;;) {
  483.           ch = xone();
  484.           if (debug & DBG_DVI)
  485.           print_dvi(ch);
  486. !         if (ch <= SETCHAR0 + 127) {
  487. !         long a = (*currinf.set_char_p)(ch);
  488. !         DVI_H += a;
  489. !         } else if (FNTNUM0 <= ch && ch <= FNTNUM0 + 63) {
  490.           change_font((unsigned long) (ch - FNTNUM0));
  491. !         } else {
  492.           long a, b;
  493. -         ubyte ch1;
  494.   
  495.           switch (ch) {
  496.               case SET1:
  497.               case PUT1:
  498. !             ch1 = xone();
  499. !             a = (*currinf.set_char_p)(ch1);
  500.               if (ch != PUT1) DVI_H += a;
  501.               break;
  502.   
  503.               case SETRULE:
  504. --- 636,678 ----
  505.       double        current_dimconv;
  506.   {
  507.       ubyte ch;
  508. + #ifdef    TEXXET
  509. +     struct drawinf    oldinfo;
  510. +     ubyte    oldmaxchar;
  511. +     long    file_pos;
  512. +     int    refl_count;
  513. + #endif
  514.   
  515. +     currinf.fontp = NULL;
  516. +     currinf.set_char_p = set_no_char;
  517. + #ifdef    TEXXET
  518. +     currinf.dir = 1;
  519. +     scan_frame = NULL;    /* indicates we're not scanning */
  520. + #endif
  521.       for (;;) {
  522.           ch = xone();
  523.           if (debug & DBG_DVI)
  524.           print_dvi(ch);
  525. !         if (ch <= SETCHAR0 + 127)
  526. ! #ifndef    TEXXET
  527. !         DVI_H += (*currinf.set_char_p)(ch);
  528. ! #else
  529. !         (*currinf.set_char_p)(ch, ch);
  530. ! #endif
  531. !         else if (FNTNUM0 <= ch && ch <= FNTNUM0 + 63)
  532.           change_font((unsigned long) (ch - FNTNUM0));
  533. !         else {
  534.           long a, b;
  535.   
  536.           switch (ch) {
  537.               case SET1:
  538.               case PUT1:
  539. ! #ifndef    TEXXET
  540. !             a = (*currinf.set_char_p)(xone());
  541.               if (ch != PUT1) DVI_H += a;
  542. + #else
  543. +             (*currinf.set_char_p)(ch, xone());
  544. + #endif
  545.               break;
  546.   
  547.               case SETRULE:
  548. ***************
  549. *** 577,592 ****
  550.                  SIGFPE here. */
  551.               a = xsfour();
  552.               b = xspell_conv(xsfour());
  553.               if (a > 0 && b > 0)
  554.                   set_rule(pixel_round(xspell_conv(a)),
  555.                   pixel_round(b));
  556. !             DVI_H += b;
  557.               break;
  558.   
  559.               case PUTRULE:
  560.               a = xspell_conv(xsfour());
  561.               b = xspell_conv(xsfour());
  562. !             if (a > 0  &&  b > 0)
  563.                   set_rule(pixel_round(a), pixel_round(b));
  564.               break;
  565.   
  566. --- 681,704 ----
  567.                  SIGFPE here. */
  568.               a = xsfour();
  569.               b = xspell_conv(xsfour());
  570. + #ifndef    TEXXET
  571.               if (a > 0 && b > 0)
  572. + #else
  573. +             if (a > 0 && b > 0 && scan_frame == NULL)
  574. + #endif
  575.                   set_rule(pixel_round(xspell_conv(a)),
  576.                   pixel_round(b));
  577. !             DVI_H += DIR * b;
  578.               break;
  579.   
  580.               case PUTRULE:
  581.               a = xspell_conv(xsfour());
  582.               b = xspell_conv(xsfour());
  583. ! #ifndef    TEXXET
  584. !             if (a > 0 && b > 0)
  585. ! #else
  586. !             if (a > 0 && b > 0 && scan_frame == NULL)
  587. ! #endif
  588.                   set_rule(pixel_round(a), pixel_round(b));
  589.               break;
  590.   
  591. ***************
  592. *** 625,637 ****
  593.               current_frame = current_frame->prev;
  594.               break;
  595.   
  596.               case RIGHT1:
  597.               case RIGHT2:
  598.               case RIGHT3:
  599.               case RIGHT4:
  600. !             DVI_H += xspell_conv(xsnum(ch - RIGHT1 + 1));
  601.               break;
  602.   
  603.               case X1:
  604.               case X2:
  605.               case X3:
  606. --- 737,826 ----
  607.               current_frame = current_frame->prev;
  608.               break;
  609.   
  610. + #ifdef    TEXXET
  611. +             case SREFL:
  612. +             if (scan_frame == NULL) {
  613. +                 /* we're not scanning:  save some info. */
  614. +                 oldinfo = currinf;
  615. +                 oldmaxchar = maxchar;
  616. +                 if (!currinf.virtual)
  617. +                 file_pos = tell(fileno(dvi_file)) -
  618. +                     (currinf.end - currinf.pos);
  619. +                 scan_frame = current_frame; /* now we're scanning */
  620. +                 refl_count = 0;
  621. +                 break;
  622. +             }
  623. +             /* we are scanning */
  624. +             if (current_frame == scan_frame) ++refl_count;
  625. +             break;
  626. +             case EREFL:
  627. +             if (scan_frame != NULL) {    /* if we're scanning */
  628. +                 if (current_frame == scan_frame && --refl_count < 0)
  629. +                 {
  630. +                 /* we've hit the end of our scan */
  631. +                 scan_frame = NULL;
  632. +                 /* first:  push */
  633. +                 if (current_frame->next == NULL) {
  634. +                     struct frame *newp = (struct frame *)
  635. +                     xmalloc(sizeof(struct frame),
  636. +                         "stack frame");
  637. +                     current_frame->next = newp;
  638. +                     newp->prev = current_frame;
  639. +                     newp->next = NULL;
  640. +                 }
  641. +                 current_frame = current_frame->next;
  642. +                 current_frame->data = currinf.data;
  643. +                 /* next:  restore old file position, XX, etc. */
  644. +                 if (!currinf.virtual) {
  645. +                     long bgn_pos = tell(fileno(dvi_file))
  646. +                      - (currinf.end - dvi_buffer);
  647. +                     if (file_pos >= bgn_pos) {
  648. +                     oldinfo.pos = dvi_buffer
  649. +                         + (file_pos - bgn_pos);
  650. +                     oldinfo.end = currinf.end;
  651. +                     }
  652. +                     else {
  653. +                     (void) lseek(fileno(dvi_file), file_pos,
  654. +                         SEEK_SET);
  655. +                     oldinfo.pos = oldinfo.end;
  656. +                     }
  657. +                 }
  658. +                 currinf = oldinfo;
  659. +                 maxchar = oldmaxchar;
  660. +                 /* and then:  recover position info. */
  661. +                 DVI_H = current_frame->data.dvi_h;
  662. +                 DVI_V = current_frame->data.dvi_v;
  663. +                 PXL_V = current_frame->data.pxl_v;
  664. +                 /* and finally, reverse direction */
  665. +                 currinf.dir = -currinf.dir;
  666. +                 }
  667. +                 break;
  668. +             }
  669. +             /* we're not scanning, */
  670. +             /* so just reverse direction and then pop */
  671. +             currinf.dir = -currinf.dir;
  672. +             currinf.data = current_frame->data;
  673. +             current_frame = current_frame->prev;
  674. +             break;
  675. + #endif    /* TEXXET */
  676.               case RIGHT1:
  677.               case RIGHT2:
  678.               case RIGHT3:
  679.               case RIGHT4:
  680. !             DVI_H += DIR * xspell_conv(xsnum(ch - RIGHT1 + 1));
  681.               break;
  682.   
  683. +             case W1:
  684. +             case W2:
  685. +             case W3:
  686. +             case W4:
  687. +             WW = xspell_conv(xsnum(ch - W0));
  688. +             case W0:
  689. +             DVI_H += DIR * WW;
  690. +             break;
  691.               case X1:
  692.               case X2:
  693.               case X3:
  694. ***************
  695. *** 638,653 ****
  696.               case X4:
  697.               XX = xspell_conv(xsnum(ch - X0));
  698.               case X0:
  699. !             DVI_H += XX;
  700.               break;
  701.   
  702. !             case W1:
  703. !             case W2:
  704. !             case W3:
  705. !             case W4:
  706. !             WW = xspell_conv(xsnum(ch - W0));
  707. !             case W0:
  708. !             DVI_H += WW;
  709.               break;
  710.   
  711.               case Y1:
  712. --- 827,841 ----
  713.               case X4:
  714.               XX = xspell_conv(xsnum(ch - X0));
  715.               case X0:
  716. !             DVI_H += DIR * XX;
  717.               break;
  718.   
  719. !             case DOWN1:
  720. !             case DOWN2:
  721. !             case DOWN3:
  722. !             case DOWN4:
  723. !             DVI_V += xspell_conv(xsnum(ch - DOWN1 + 1));
  724. !             PXL_V = pixel_conv(DVI_V);
  725.               break;
  726.   
  727.               case Y1:
  728. ***************
  729. *** 670,683 ****
  730.               PXL_V = pixel_conv(DVI_V);
  731.               break;
  732.   
  733. -             case DOWN1:
  734. -             case DOWN2:
  735. -             case DOWN3:
  736. -             case DOWN4:
  737. -             DVI_V += xspell_conv(xsnum(ch - DOWN1 + 1));
  738. -             PXL_V = pixel_conv(DVI_V);
  739. -             break;
  740.               case FNT1:
  741.               case FNT2:
  742.               case FNT3:
  743. --- 858,863 ----
  744. ***************
  745. *** 703,717 ****
  746.               break;
  747.   
  748.               case PRE:
  749. -             oops("Shouldn't happen: PRE encountered.");
  750. -             break;
  751.               case POST:
  752. -             oops("Shouldn't happen: POST encountered.");
  753. -             break;
  754.               case POSTPOST:
  755. !             oops("Unexpected POSTPOST encountered.");
  756.               break;
  757.   
  758.               default:
  759. --- 883,892 ----
  760.               break;
  761.   
  762.               case PRE:
  763.               case POST:
  764.               case POSTPOST:
  765. !             oops("Shouldn't happen: %s encountered.",
  766. !                 dvi_table2[ch - (FNTNUM0 + 64)]);
  767.               break;
  768.   
  769.               default:
  770. ***************
  771. *** 735,741 ****
  772.       (void) lseek(fileno(dvi_file), page_offset[current_page], SEEK_SET);
  773.   
  774.       bzero((char *) &currinf.data, sizeof(currinf.data));
  775. -     currinf.set_char_p = set_no_char;
  776.       currinf.tn_head = tn_head;
  777.       currinf.pos = currinf.end = dvi_buffer;
  778.       currinf.virtual = False;
  779. --- 910,915 ----
  780. diff -cr xdvi_old/dvi_init.c xdvi_new/dvi_init.c
  781. *** xdvi_old/dvi_init.c    Sat Feb 15 16:36:09 1992
  782. --- xdvi_new/dvi_init.c    Sat Mar 28 12:50:09 1992
  783. ***************
  784. *** 13,18 ****
  785. --- 13,19 ----
  786.    * 2/1989    Added tpic support    --Jeffrey Lee, U of Toronto
  787.    * 4/1989    Modified for System V by Donald Richardson, Clarkson Univ.
  788.    * 3/1990    Added VMS support    --Scott Allendorf, U of Iowa
  789. +  * 7/1990    Added reflection mode    --Michael Pak, Hebrew U of Jerusalem
  790.    *
  791.    *    Compilation options:
  792.    *    SYSV    compile for System V
  793. ***************
  794. *** 25,30 ****
  795. --- 26,32 ----
  796.    *    BMLONG    store bitmaps in longs instead of bytes
  797.    *    ALTFONT    default for -altfont option
  798.    *    A4    use European size paper
  799. +  *    TEXXET    support reflection dvi codes (right-to-left typesetting)
  800.    */
  801.   
  802.   #include "xdvi.h"
  803. ***************
  804. *** 39,45 ****
  805.   #include <stdlib.h>
  806.   #else
  807.   char    *realloc();
  808. - volatile void    exit();
  809.   #endif
  810.   #if    defined(macII) && !defined(__STDC__) /* stdlib.h doesn't define these */
  811.   char    *realloc();
  812. --- 41,46 ----
  813. ***************
  814. *** 102,112 ****
  815.       register struct glyph *g;
  816.   
  817.       for (f = font_head; f != NULL; f = f->next)
  818. !         for (g = f->glyph; g <= f->glyph + f->maxchar; ++g)
  819. !         if (g->bitmap2.bits) {
  820. !             free(g->bitmap2.bits);
  821. !             g->bitmap2.bits = NULL;
  822. !         }
  823.   }
  824.   
  825.   /*
  826. --- 103,114 ----
  827.       register struct glyph *g;
  828.   
  829.       for (f = font_head; f != NULL; f = f->next)
  830. !         if ((f->flags & FONT_LOADED) && !(f->flags & FONT_VIRTUAL))
  831. !         for (g = f->glyph; g <= f->glyph + f->maxchar; ++g)
  832. !             if (g->bitmap2.bits) {
  833. !             free(g->bitmap2.bits);
  834. !             g->bitmap2.bits = NULL;
  835. !             }
  836.   }
  837.   
  838.   /*
  839. diff -cr xdvi_old/font_open.c xdvi_new/font_open.c
  840. *** xdvi_old/font_open.c    Tue Feb 11 13:23:37 1992
  841. --- xdvi_new/font_open.c    Thu Mar 26 18:05:45 1992
  842. ***************
  843. *** 75,81 ****
  844.   
  845.   char    *xmalloc(), *getenv();
  846.   double    atof();
  847. - volatile void    exit();
  848.   
  849.   #ifdef    SEARCH_SUBDIRECTORIES
  850.   /* We will need some system include files to deal with directories.  */
  851. --- 75,80 ----
  852. ***************
  853. *** 398,410 ****
  854.   }
  855.   
  856.   static    FILE *
  857. ! formatted_open(path, font, gforpk, mag, name, count, tail)
  858.       _Xconst char    *path;
  859.       _Xconst char    *font;
  860.       _Xconst char    *gforpk;
  861.       int    mag;
  862.       char    **name;
  863. !     int    count;
  864.       _Xconst    char    *tail;
  865.   {
  866.       _Xconst char    *p = path;
  867. --- 397,409 ----
  868.   }
  869.   
  870.   static    FILE *
  871. ! formatted_open(path, font, gforpk, mag, name, first_try, tail)
  872.       _Xconst char    *path;
  873.       _Xconst char    *font;
  874.       _Xconst char    *gforpk;
  875.       int    mag;
  876.       char    **name;
  877. !     Boolean    first_try;
  878.       _Xconst    char    *tail;
  879.   {
  880.       _Xconst char    *p = path;
  881. ***************
  882. *** 458,464 ****
  883.           }
  884.           else *n++ = c;
  885.       }
  886. !     if (!p_used && count > 0) return NULL;
  887.       *n = '\0';
  888.       if (debug & DBG_OPEN) Printf("Trying font file %s\n", nm);
  889.       f = xfopen(nm);
  890. --- 457,463 ----
  891.           }
  892.           else *n++ = c;
  893.       }
  894. !     if (!p_used && first_try) return NULL;
  895.       *n = '\0';
  896.       if (debug & DBG_OPEN) Printf("Trying font file %s\n", nm);
  897.       f = xfopen(nm);
  898. ***************
  899. *** 492,499 ****
  900.       next_subdir = subdir_head;
  901.   #endif
  902.       for (;;) {
  903. -         int count = 0;
  904.           if (*p == PATH_SEP || *p == '\0') {
  905.           if (x_default_font_path != NULL &&
  906.               (f = try_size(font, pxlmag, name, x_default_font_path,
  907. --- 491,496 ----
  908. ***************
  909. *** 502,519 ****
  910.           if (*p == '\0') break;
  911.           }
  912.           else {
  913.   #ifdef    USE_PK
  914. !         if ((f = formatted_open(p, font, "pk", pkmag, name, count++,
  915.               DEFAULT_TAIL)) != NULL)
  916.               return f;
  917.   #endif
  918.   #ifdef    USE_GF
  919. !         if ((f = formatted_open(p, font, "gf", pkmag, name, count++,
  920.               DEFAULT_TAIL)) != NULL)
  921.               return f;
  922.   #endif
  923.   #ifdef    USE_PXL
  924. !         if ((f = formatted_open(p, font, "pxl", pxlmag, name, count++,
  925.               DEFAULT_TAIL)) != NULL)
  926.               return f;
  927.   #endif
  928. --- 499,521 ----
  929.           if (*p == '\0') break;
  930.           }
  931.           else {
  932. + #define    FIRST_TRY True
  933.   #ifdef    USE_PK
  934. !         if ((f = formatted_open(p, font, "pk", pkmag, name, FIRST_TRY,
  935.               DEFAULT_TAIL)) != NULL)
  936.               return f;
  937. + #undef    FIRST_TRY
  938. + #define    FIRST_TRY False
  939.   #endif
  940.   #ifdef    USE_GF
  941. !         if ((f = formatted_open(p, font, "gf", pkmag, name, FIRST_TRY,
  942.               DEFAULT_TAIL)) != NULL)
  943.               return f;
  944. + #undef    FIRST_TRY
  945. + #define    FIRST_TRY False
  946.   #endif
  947.   #ifdef    USE_PXL
  948. !         if ((f = formatted_open(p, font, "pxl", pxlmag, name, FIRST_TRY,
  949.               DEFAULT_TAIL)) != NULL)
  950.               return f;
  951.   #endif
  952. ***************
  953. *** 628,634 ****
  954.           return f;
  955.   
  956.       /* Now try at all the sizes. */
  957. !     for (p2 = sizes; p2 < sizend; ++p2) if (*p2 >= imag) break;
  958.       p1 = p2;
  959.       for (;;) {
  960.           /* find another magnification */
  961. --- 630,636 ----
  962.           return f;
  963.   
  964.       /* Now try at all the sizes. */
  965. !     for (p2 = sizes; p2 < sizend; ++p2) if (*p2 >= pxlmag) break;
  966.       p1 = p2;
  967.       for (;;) {
  968.           /* find another magnification */
  969. diff -cr xdvi_old/patchlevel.h xdvi_new/patchlevel.h
  970. *** xdvi_old/patchlevel.h    Sat Jan 18 16:24:29 1992
  971. --- xdvi_new/patchlevel.h    Sat Mar 28 00:22:24 1992
  972. ***************
  973. *** 1 ****
  974. ! #define PATCHLEVEL 12
  975. --- 1 ----
  976. ! #define PATCHLEVEL 13
  977. diff -cr xdvi_old/pxl.c xdvi_new/pxl.c
  978. *** xdvi_old/pxl.c    Sun Jan 19 14:24:23 1992
  979. --- xdvi_new/pxl.c    Mon Mar 23 19:03:00 1992
  980. ***************
  981. *** 65,86 ****
  982.   #ifndef    MSBITFIRST
  983.           *ptr = _reverse_byte[one(fp)];
  984.   #if    BYTES_PER_BMUNIT > 1
  985. !         *ptr |= _reverse_byte[one(fp)] << 8;
  986.   #endif
  987.   #ifdef    BMLONG
  988. !         *ptr |= _reverse_byte[one(fp)] << 16;
  989. !         *ptr |= _reverse_byte[one(fp)] << 24;
  990.   #endif
  991.   #else    /* MSBITFIRST */
  992.           *ptr = 0;
  993.   #ifdef    BMLONG
  994. !         *ptr |= one(fp) << 24;
  995. !         *ptr |= one(fp) << 16;
  996.   #endif
  997.   #if    BYTES_PER_BMUNIT > 1
  998. !         *ptr |= one(fp) << 8;
  999.   #endif
  1000. !         *ptr |= one(fp);
  1001.   #endif    /* MSBITFIRST */
  1002.           ++ptr;
  1003.           }
  1004. --- 65,86 ----
  1005.   #ifndef    MSBITFIRST
  1006.           *ptr = _reverse_byte[one(fp)];
  1007.   #if    BYTES_PER_BMUNIT > 1
  1008. !         *ptr |= (BMUNIT) _reverse_byte[one(fp)] << 8;
  1009.   #endif
  1010.   #ifdef    BMLONG
  1011. !         *ptr |= (BMUNIT) _reverse_byte[one(fp)] << 16;
  1012. !         *ptr |= (BMUNIT) _reverse_byte[one(fp)] << 24;
  1013.   #endif
  1014.   #else    /* MSBITFIRST */
  1015.           *ptr = 0;
  1016.   #ifdef    BMLONG
  1017. !         *ptr |= (BMUNIT) one(fp) << 24;
  1018. !         *ptr |= (BMUNIT) one(fp) << 16;
  1019.   #endif
  1020.   #if    BYTES_PER_BMUNIT > 1
  1021. !         *ptr |= (BMUNIT) one(fp) << 8;
  1022.   #endif
  1023. !         *ptr |= (BMUNIT) one(fp);
  1024.   #endif    /* MSBITFIRST */
  1025.           ++ptr;
  1026.           }
  1027. diff -cr xdvi_old/util.c xdvi_new/util.c
  1028. *** xdvi_old/util.c    Sat Feb  8 14:07:55 1992
  1029. --- xdvi_new/util.c    Sat Mar 28 12:50:28 1992
  1030. ***************
  1031. *** 13,18 ****
  1032. --- 13,19 ----
  1033.    * 2/1989    Added tpic support    --Jeffrey Lee, U of Toronto
  1034.    * 4/1989    Modified for System V by Donald Richardson, Clarkson Univ.
  1035.    * 3/1990    Added VMS support    --Scott Allendorf, U of Iowa
  1036. +  * 7/1990    Added reflection mode    --Michael Pak, Hebrew U of Jerusalem
  1037.    *
  1038.    *    Compilation options:
  1039.    *    SYSV    compile for System V
  1040. ***************
  1041. *** 25,30 ****
  1042. --- 26,32 ----
  1043.    *    BMLONG    store bitmaps in longs instead of bytes
  1044.    *    ALTFONT    default for -altfont option
  1045.    *    A4    use European size paper
  1046. +  *    TEXXET    support reflection dvi codes (right-to-left typesetting)
  1047.    */
  1048.   
  1049.   #include "xdvi.h"
  1050. ***************
  1051. *** 39,45 ****
  1052.   #include <stdlib.h>
  1053.   #else
  1054.   char    *malloc();
  1055. - volatile void    exit();
  1056.   #endif
  1057.   #if    defined(macII) && !defined(__STDC__) /* stdlib.h doesn't define these */
  1058.   char    *malloc();
  1059. --- 41,46 ----
  1060. ***************
  1061. *** 157,163 ****
  1062.       if (n_files_left == 0) close_a_file();
  1063.       f = fopen(filename, OPEN_MODE);
  1064.   #ifndef    VMS
  1065. !     if (f == NULL && errno == EMFILE)
  1066.   #else    /* VMS */
  1067.       if (f == NULL && errno == EVMSERR && vaxc$errno == RMS$_ACC)
  1068.   #endif    /* VMS */
  1069. --- 158,164 ----
  1070.       if (n_files_left == 0) close_a_file();
  1071.       f = fopen(filename, OPEN_MODE);
  1072.   #ifndef    VMS
  1073. !     if (f == NULL && (errno == EMFILE || errno == ENFILE))
  1074.   #else    /* VMS */
  1075.       if (f == NULL && errno == EVMSERR && vaxc$errno == RMS$_ACC)
  1076.   #endif    /* VMS */
  1077. diff -cr xdvi_old/vf.c xdvi_new/vf.c
  1078. *** xdvi_old/vf.c    Tue Feb 11 13:23:17 1992
  1079. --- xdvi_new/vf.c    Mon Mar 23 19:06:49 1992
  1080. ***************
  1081. *** 42,48 ****
  1082.       fontp->read_char = NULL;
  1083.       fontp->flags |= FONT_VIRTUAL;
  1084.       fontp->set_char_p = set_vf_char;
  1085. -     VF_file = fontp->file;
  1086.       if (debug & DBG_PK)
  1087.           Printf("Reading VF pixel file %s\n", fontp->filename);
  1088.   /*
  1089. --- 42,47 ----
  1090. diff -cr xdvi_old/xdvi.c xdvi_new/xdvi.c
  1091. *** xdvi_old/xdvi.c    Mon Feb 17 14:18:21 1992
  1092. --- xdvi_new/xdvi.c    Tue Mar 31 12:23:41 1992
  1093. ***************
  1094. *** 13,18 ****
  1095. --- 13,19 ----
  1096.    * 2/1989    Added tpic support    --Jeffrey Lee, U of Toronto
  1097.    * 4/1989    Modified for System V by Donald Richardson, Clarkson Univ.
  1098.    * 3/1990    Added VMS support    --Scott Allendorf, U of Iowa
  1099. +  * 7/1990    Added reflection mode    --Michael Pak, Hebrew U of Jerusalem
  1100.    *
  1101.    *    Compilation options:
  1102.    *    SYSV    compile for System V
  1103. ***************
  1104. *** 25,30 ****
  1105. --- 26,32 ----
  1106.    *    BMLONG    store bitmaps in longs instead of bytes
  1107.    *    ALTFONT    default for -altfont option
  1108.    *    A4    use European size paper
  1109. +  *    TEXXET    support reflection dvi codes (right-to-left typesetting)
  1110.    */
  1111.   
  1112.   #ifndef    ALTFONT
  1113. ***************
  1114. *** 344,351 ****
  1115.       {XtNcallback,    (XtArgVal) command_call},
  1116.   };
  1117.   
  1118.   #ifdef    NOQUERY
  1119. ! #define    drawWidgetClass    widgetClass;
  1120.   #else
  1121.   
  1122.   /* ARGSUSED */
  1123. --- 346,380 ----
  1124.       {XtNcallback,    (XtArgVal) command_call},
  1125.   };
  1126.   
  1127. + static    void
  1128. + create_buttons(h)
  1129. +     XtArgVal    h;
  1130. + {
  1131. +     int i;
  1132. +     line_args[2].value = h;
  1133. +     line_args[3].value = (XtArgVal) vport_widget;
  1134. +     line_widget = XtCreateManagedWidget("line", widgetClass, form_widget,
  1135. +         line_args, XtNumber(line_args));
  1136. +     right_args[0].value = (XtArgVal) line_widget;
  1137. +     right_args[2].value = h;
  1138. +     right_widget = XtCreateManagedWidget("right", compositeWidgetClass,
  1139. +         form_widget, right_args, XtNumber(right_args));
  1140. +     command_args[2].value = (XtArgVal) vport_widget;
  1141. +     for (i = 0; i < XtNumber(command_table); ++i) {
  1142. +         command_args[0].value = (XtArgVal) command_table[i].label;
  1143. +         command_args[2].value = (XtArgVal) command_table[i].y_pos;
  1144. +         command_call[0].closure = (caddr_t) command_table[i].closure;
  1145. +         (void) XtCreateManagedWidget(command_table[i].name,
  1146. +         commandWidgetClass, right_widget,
  1147. +         command_args, XtNumber(command_args));
  1148. +     }
  1149. + }
  1150. + #endif    /* BUTTONS */
  1151.   #ifdef    NOQUERY
  1152. ! #define    drawWidgetClass    widgetClass
  1153.   #else
  1154.   
  1155.   /* ARGSUSED */
  1156. ***************
  1157. *** 405,437 ****
  1158.   
  1159.   #endif    /* NOQUERY */
  1160.   
  1161. - static    void
  1162. - create_buttons(h)
  1163. -     XtArgVal    h;
  1164. - {
  1165. -     int i;
  1166. -     line_args[2].value = h;
  1167. -     line_args[3].value = (XtArgVal) vport_widget;
  1168. -     line_widget = XtCreateManagedWidget("line", widgetClass, form_widget,
  1169. -         line_args, XtNumber(line_args));
  1170. -     right_args[0].value = (XtArgVal) line_widget;
  1171. -     right_args[2].value = h;
  1172. -     right_widget = XtCreateManagedWidget("right", compositeWidgetClass,
  1173. -         form_widget, right_args, XtNumber(right_args));
  1174. -     command_args[2].value = (XtArgVal) vport_widget;
  1175. -     for (i = 0; i < XtNumber(command_table); ++i) {
  1176. -         command_args[0].value = (XtArgVal) command_table[i].label;
  1177. -         command_args[2].value = (XtArgVal) command_table[i].y_pos;
  1178. -         command_call[0].closure = (caddr_t) command_table[i].closure;
  1179. -         (void) XtCreateManagedWidget(command_table[i].name,
  1180. -         commandWidgetClass, right_widget,
  1181. -         command_args, XtNumber(command_args));
  1182. -     }
  1183. - }
  1184. - #endif    /* BUTTONS */
  1185.   #else    /* !TOOLKIT */
  1186.   #define    BAR_WID        12    /* width of darkened area */
  1187.   #define    BAR_THICK    15    /* gross amount removed */
  1188. --- 434,439 ----
  1189. ***************
  1190. *** 489,495 ****
  1191.   #endif
  1192.   
  1193.   extern    double    atof();
  1194. - extern    volatile void    exit();
  1195.   
  1196.   /********************************
  1197.    *      tpic routines        *
  1198. --- 491,496 ----
  1199. ***************
  1200. *** 725,745 ****
  1201.   home(scrl)
  1202.       Boolean    scrl;
  1203.   {
  1204. -     register int coord;
  1205.       if (!scrl) XUnmapWindow(DISP, WINDOW(mane));
  1206.       get_xy();
  1207. -     coord = 0;
  1208.       if (page_w > clip_w) {
  1209. !         coord = (page_w - clip_w) / 2;
  1210.           if (coord > home_x / mane.shrinkfactor)
  1211.           coord = home_x / mane.shrinkfactor;
  1212.           XtCallCallbacks(x_bar, XtNscrollProc,
  1213.           (XtPointer) (window_x + coord));
  1214.       }
  1215. -     coord = 0;
  1216.       if (page_h > clip_h) {
  1217. !         coord = (page_h - clip_h) / 2;
  1218.           if (coord > home_y / mane.shrinkfactor)
  1219.           coord = home_y / mane.shrinkfactor;
  1220.           XtCallCallbacks(y_bar, XtNscrollProc,
  1221. --- 726,742 ----
  1222.   home(scrl)
  1223.       Boolean    scrl;
  1224.   {
  1225.       if (!scrl) XUnmapWindow(DISP, WINDOW(mane));
  1226.       get_xy();
  1227.       if (page_w > clip_w) {
  1228. !         register int coord = (page_w - clip_w) / 2;
  1229.           if (coord > home_x / mane.shrinkfactor)
  1230.           coord = home_x / mane.shrinkfactor;
  1231.           XtCallCallbacks(x_bar, XtNscrollProc,
  1232.           (XtPointer) (window_x + coord));
  1233.       }
  1234.       if (page_h > clip_h) {
  1235. !         register int coord = (page_h - clip_h) / 2;
  1236.           if (coord > home_y / mane.shrinkfactor)
  1237.           coord = home_y / mane.shrinkfactor;
  1238.           XtCallCallbacks(y_bar, XtNscrollProc,
  1239. ***************
  1240. *** 799,808 ****
  1241.   /* The following callback routine should never be called. */
  1242.       /*ARGSUSED*/
  1243.   static    void
  1244. ! handle_key(widget, junk, event)
  1245.       Widget    widget;
  1246.       caddr_t    junk;
  1247.       XEvent    *event;
  1248.   {
  1249.       XBell(DISP, 20);
  1250.   }
  1251. --- 796,806 ----
  1252.   /* The following callback routine should never be called. */
  1253.       /*ARGSUSED*/
  1254.   static    void
  1255. ! handle_key(widget, junk, event, cont)
  1256.       Widget    widget;
  1257.       caddr_t    junk;
  1258.       XEvent    *event;
  1259. +     Boolean    *cont;        /* unused */
  1260.   {
  1261.       XBell(DISP, 20);
  1262.   }
  1263. ***************
  1264. *** 809,818 ****
  1265.   
  1266.       /*ARGSUSED*/
  1267.   static    void
  1268. ! handle_resize(widget, junk, event)
  1269.       Widget    widget;
  1270.       caddr_t    junk;
  1271.       XEvent    *event;
  1272.   {
  1273.       resized = True;
  1274.   }
  1275. --- 807,817 ----
  1276.   
  1277.       /*ARGSUSED*/
  1278.   static    void
  1279. ! handle_resize(widget, junk, event, cont)
  1280.       Widget    widget;
  1281.       caddr_t    junk;
  1282.       XEvent    *event;
  1283. +     Boolean    *cont;        /* unused */
  1284.   {
  1285.       resized = True;
  1286.   }
  1287. ***************
  1288. *** 1079,1094 ****
  1289.   #ifdef    TOOLKIT
  1290.       /*ARGSUSED*/
  1291.   static    void
  1292. ! handle_button(widget, junk, event)
  1293.       Widget    widget;
  1294.       caddr_t    junk;
  1295.   #else    /* !TOOLKIT */
  1296.   static    void
  1297.   handle_button(event)
  1298. - #endif    /* TOOLKIT */
  1299.       XButtonEvent *event;
  1300.   {
  1301. !     int x, y;
  1302.   #ifndef X10
  1303.       XSetWindowAttributes attr;
  1304.   
  1305. --- 1078,1096 ----
  1306.   #ifdef    TOOLKIT
  1307.       /*ARGSUSED*/
  1308.   static    void
  1309. ! handle_button(widget, junk, ev, cont)
  1310.       Widget    widget;
  1311.       caddr_t    junk;
  1312. +     XEvent *ev;
  1313. + #define    event    (&(ev->xbutton))
  1314. +     Boolean    *cont;        /* unused */
  1315.   #else    /* !TOOLKIT */
  1316.   static    void
  1317.   handle_button(event)
  1318.       XButtonEvent *event;
  1319. + #endif    /* TOOLKIT */
  1320.   {
  1321. !     int    x, y;
  1322.   #ifndef X10
  1323.       XSetWindowAttributes attr;
  1324.   
  1325. ***************
  1326. *** 1134,1145 ****
  1327.   }
  1328.   
  1329.   #ifdef    TOOLKIT
  1330.       /*ARGSUSED*/
  1331.   static    void
  1332. ! handle_motion(widget, junk, event)
  1333.       Widget    widget;
  1334.       caddr_t    junk;
  1335. !     XMotionEvent *event;
  1336.   {
  1337.       new_mag_x = event->x;
  1338.       main_x = event->x_root - new_mag_x;
  1339. --- 1136,1151 ----
  1340.   }
  1341.   
  1342.   #ifdef    TOOLKIT
  1343. + #undef    event
  1344.       /*ARGSUSED*/
  1345.   static    void
  1346. ! handle_motion(widget, junk, ev, cont)
  1347.       Widget    widget;
  1348.       caddr_t    junk;
  1349. !     XEvent *ev;
  1350. ! #define    event    (&(ev->xmotion))
  1351. !     Boolean    *cont;        /* unused */
  1352.   {
  1353.       new_mag_x = event->x;
  1354.       main_x = event->x_root - new_mag_x;
  1355. ***************
  1356. *** 1147,1152 ****
  1357. --- 1153,1160 ----
  1358.       main_y = event->y_root - new_mag_y;
  1359.       mag_moved = (new_mag_x != mag_x || new_mag_y != mag_y);
  1360.   }
  1361. + #undef    event
  1362.   #endif    /* TOOLKIT */
  1363.   
  1364.   static    void
  1365. ***************
  1366. *** 1167,1176 ****
  1367.   #ifdef    TOOLKIT
  1368.       /*ARGSUSED*/
  1369.   static    void
  1370. ! handle_release(widget, junk, event)
  1371.       Widget    widget;
  1372.       caddr_t    junk;
  1373. !     XButtonEvent *event;
  1374.   #else    /* !TOOLKIT */
  1375.   static    void
  1376.   handle_release()
  1377. --- 1175,1186 ----
  1378.   #ifdef    TOOLKIT
  1379.       /*ARGSUSED*/
  1380.   static    void
  1381. ! handle_release(widget, junk, ev, cont)
  1382.       Widget    widget;
  1383.       caddr_t    junk;
  1384. !     XEvent *ev;
  1385. ! #define    event    (&(ev->xbutton))
  1386. !     Boolean    *cont;        /* unused */
  1387.   #else    /* !TOOLKIT */
  1388.   static    void
  1389.   handle_release()
  1390. ***************
  1391. *** 1188,1204 ****
  1392.   }
  1393.   
  1394.   #ifdef    TOOLKIT
  1395.       /*ARGSUSED*/
  1396.   static    void
  1397. ! handle_exp(widget, windowrec, event)
  1398.       Widget    widget;
  1399.       struct WindowRec *windowrec;
  1400. !     register XExposeEvent *event;
  1401.   {
  1402.       if (windowrec == &alt)
  1403.           if (alt_stat < 0) {    /* destroy upon exposure */
  1404.           alt_stat = 0;
  1405. !         handle_release(widget, (caddr_t) NULL, (XButtonEvent *) event);
  1406.           return;
  1407.           }
  1408.           else
  1409. --- 1198,1219 ----
  1410.   }
  1411.   
  1412.   #ifdef    TOOLKIT
  1413. + #undef    event
  1414.       /*ARGSUSED*/
  1415.   static    void
  1416. ! handle_exp(widget, windowrec, ev, cont)
  1417.       Widget    widget;
  1418.       struct WindowRec *windowrec;
  1419. !     register XEvent *ev;
  1420. ! #define    event    (&(ev->xexpose))
  1421. !     Boolean    *cont;        /* unused */
  1422.   {
  1423.       if (windowrec == &alt)
  1424.           if (alt_stat < 0) {    /* destroy upon exposure */
  1425.           alt_stat = 0;
  1426. !         handle_release(widget, (caddr_t) NULL, (XButtonEvent *) event,
  1427. !             (Boolean *) NULL);
  1428.           return;
  1429.           }
  1430.           else
  1431. ***************
  1432. *** 1205,1210 ****
  1433. --- 1220,1227 ----
  1434.           alt_stat = 0;
  1435.       expose(windowrec, event->x, event->y, event->width, event->height);
  1436.   }
  1437. + #undef    event
  1438.   #endif    /* TOOLKIT */
  1439.   
  1440.   /* |||
  1441. ***************
  1442. *** 1441,1449 ****
  1443. --- 1458,1468 ----
  1444.       bad:  XBell(DISP, 10);
  1445.   }
  1446.   
  1447.   #ifndef X10
  1448.   #define    TRSIZE    100
  1449.   #endif    /* X10 */
  1450.   static    void
  1451.   read_events(wait)
  1452.       Boolean    wait;
  1453. ***************
  1454. *** 1478,1484 ****
  1455.           if (resized) get_geom();
  1456.           if (event.xany.window == WINDOW(alt) &&
  1457.               event.type == Expose) {
  1458. !         handle_exp((Widget) NULL, &alt, &event.xexpose);
  1459.           continue;
  1460.           }
  1461.           if (event.type != KeyPress) {
  1462. --- 1497,1503 ----
  1463.           if (resized) get_geom();
  1464.           if (event.xany.window == WINDOW(alt) &&
  1465.               event.type == Expose) {
  1466. !         handle_exp((Widget) NULL, &alt, &event.xexpose, (Boolean*)NULL);
  1467.           continue;
  1468.           }
  1469.           if (event.type != KeyPress) {
  1470. diff -cr xdvi_old/xdvi.h xdvi_new/xdvi.h
  1471. *** xdvi_old/xdvi.h    Mon Feb 17 14:18:07 1992
  1472. --- xdvi_new/xdvi.h    Fri Mar 27 18:15:28 1992
  1473. ***************
  1474. *** 162,171 ****
  1475.   };
  1476.   
  1477.   #if    NeedFunctionPrototypes
  1478. ! typedef    long    (*set_char_proc)(WIDEARG(ubyte,int));
  1479. ! #else
  1480.   typedef    long    (*set_char_proc)();
  1481. ! #endif
  1482.   
  1483.   struct drawinf {    /* this information is saved when using virtual fonts */
  1484.       struct framedata data;
  1485. --- 162,179 ----
  1486.   };
  1487.   
  1488.   #if    NeedFunctionPrototypes
  1489. ! #ifndef    TEXXET
  1490. ! typedef    long    (*set_char_proc)(WIDEARG(ubyte, int));
  1491. ! #else    /* TEXXET */
  1492. ! typedef    void    (*set_char_proc)(WIDEARG(ubyte, int), WIDEARG(ubyte, int));
  1493. ! #endif    /* TEXXET */
  1494. ! #else    /* NeedFunctionPrototypes */
  1495. ! #ifndef    TEXXET
  1496.   typedef    long    (*set_char_proc)();
  1497. ! #else    /* TEXXET */
  1498. ! typedef    void    (*set_char_proc)();
  1499. ! #endif    /* TEXXET */
  1500. ! #endif    /* NeedFunctionPrototypes */
  1501.   
  1502.   struct drawinf {    /* this information is saved when using virtual fonts */
  1503.       struct framedata data;
  1504. ***************
  1505. *** 174,179 ****
  1506. --- 182,190 ----
  1507.       struct tn    *tn_head;
  1508.       ubyte        *pos, *end;
  1509.       Boolean        virtual;
  1510. + #ifdef    TEXXET
  1511. +     int        dir;
  1512. + #endif
  1513.   };
  1514.   
  1515.   EXTERN    struct drawinf    currinf;
  1516. ***************
  1517. *** 262,268 ****
  1518.    */
  1519.   
  1520.   #if    NeedFunctionPrototypes
  1521. ! typedef    void (*read_char_proc)(struct font *, WIDEARG(ubyte,int));
  1522.   #else
  1523.   typedef    void (*read_char_proc)();
  1524.   #endif
  1525. --- 273,279 ----
  1526.    */
  1527.   
  1528.   #if    NeedFunctionPrototypes
  1529. ! typedef    void (*read_char_proc)(struct font *, WIDEARG(ubyte, int));
  1530.   #else
  1531.   typedef    void (*read_char_proc)();
  1532.   #endif
  1533. ***************
  1534. *** 379,386 ****
  1535. --- 390,402 ----
  1536.   extern    void    init_page(void);
  1537.   extern    void    open_dvi_file(void);
  1538.   extern    Boolean    check_dvi_file(void);
  1539. + #ifndef    TEXXET
  1540.   extern    long    set_char(WIDEARG(ubyte, int));
  1541.   extern    long    set_vf_char(WIDEARG(ubyte, int));
  1542. + #else
  1543. + extern    void    set_char(WIDEARG(ubyte, int), WIDEARG(ubyte, int));
  1544. + extern    void    set_vf_char(WIDEARG(ubyte, int), WIDEARG(ubyte, int));
  1545. + #endif
  1546.   extern    void    draw_page(void);
  1547.   extern    void    init_font_open(void);
  1548.   extern    FILE    *font_open(_Xconst char *, char **,
  1549. ***************
  1550. *** 413,420 ****
  1551. --- 429,441 ----
  1552.   extern    void    init_page();
  1553.   extern    void    open_dvi_file();
  1554.   extern    Boolean    check_dvi_file();
  1555. + #ifndef    TEXXET
  1556.   extern    long    set_char();
  1557.   extern    long    set_vf_char();
  1558. + #else
  1559. + extern    void    set_char();
  1560. + extern    void    set_vf_char();
  1561. + #endif
  1562.   extern    void    draw_page();
  1563.   extern    void    init_font_open();
  1564.   extern    FILE    *font_open();
  1565. -- 
  1566. --
  1567. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1568. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1569. Sunnyvale, California 94086            at&t: 408/522-9236
  1570.