home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-src.tgz / tar.out / contrib / unixtex / xdvik / xdvi.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  17KB  |  680 lines

  1. /*
  2.  *    Written by Eric C. Cooper, CMU
  3.  */
  4.  
  5. /********************************
  6.  *    The C environment    *
  7.  *******************************/
  8.  
  9. /* Avoid name clashes with kpathsea.  */
  10. #define xmalloc xdvi_xmalloc
  11. #define xfopen xdvi_xfopen
  12.  
  13. /* For wchar_t et al., that the X files might want. */
  14. #include <kpathsea/systypes.h>
  15.  
  16. /* See kpathsea/INSTALL for the purpose of the FOIL...  */
  17. #ifdef FOIL_X_WCHAR_T
  18. #define wchar_t foil_x_defining_wchar_t
  19. #define X_WCHAR
  20. #endif
  21.  
  22. #include <X11/Xlib.h>    /* include Xfuncs.h, if available */
  23. #include <X11/Xutil.h>    /* needed for XDestroyImage */
  24. #include <X11/Xos.h>
  25. #undef wchar_t
  26.  
  27. #ifndef    XlibSpecificationRelease
  28. #define    XlibSpecificationRelease 0
  29. #endif
  30.  
  31. #if    XlibSpecificationRelease >= 5
  32. #include <X11/Xfuncs.h>
  33. #endif
  34.  
  35. #ifndef    NOTOOL
  36. #include <X11/Intrinsic.h>
  37. #define    TOOLKIT
  38. #else
  39. #define    XtNumber(arr)    (sizeof(arr)/sizeof(arr[0]))
  40. typedef    unsigned long    Pixel;
  41. typedef    char        Boolean;
  42. typedef    unsigned int    Dimension;
  43. #undef    TOOLKIT
  44. #undef    BUTTONS
  45. #endif
  46.  
  47. #define    True    1
  48. #define    False    0
  49.  
  50. #ifdef    VMS
  51. #include <string.h>
  52. #define    index    strchr
  53. #define    rindex    strrchr
  54. #define    bzero(a, b)    (void) memset ((void *) (a), 0, (size_t) (b))
  55. #define bcopy(a, b, c)  (void) memmove ((void *) (b), (void *) (a), (size_t) (c))
  56. #endif
  57.  
  58. #if    defined(_SVR4) || defined(_SVR4_SOURCE) || defined(_SYSTYPE_SVR4)
  59. #undef    SVR4
  60. #define    SVR4
  61. #endif
  62.  
  63. #if    defined(SVR3) || defined(SVR4)
  64. #undef    SYSV
  65. #define    SYSV
  66. #endif
  67.  
  68. #ifndef    BSD
  69. #if    defined(SYSV) || defined(VMS) || defined(linux)
  70. #define    BSD    0
  71. #else
  72. #define    BSD    1
  73. #endif
  74. #endif
  75.  
  76. #ifndef    OPEN_MODE
  77. #define OPEN_MODE FOPEN_R_MODE
  78. #endif    /* OPEN_MODE */
  79.  
  80. #ifndef    VMS
  81. #define    OPEN_MODE_ARGS    _Xconst char *
  82. #else
  83. #define    OPEN_MODE_ARGS    _Xconst char *, _Xconst char *
  84. #endif
  85.  
  86.  
  87. #ifndef    NeedFunctionPrototypes
  88. #ifdef    __STDC__
  89. #define    NeedFunctionPrototypes    1
  90. #else    /* STDC */
  91. #define    NeedFunctionPrototypes    0
  92. #endif    /* STDC */
  93. #endif    /* NeedFunctionPrototypes */
  94.  
  95. #if    NeedFunctionPrototypes
  96. #define    ARGS(x)    x
  97. #else
  98. #define    ARGS(x)    ()
  99. #endif
  100.  
  101. #ifndef    NeedWidePrototypes
  102. #define    NeedWidePrototypes    NeedFunctionPrototypes
  103. #endif
  104.  
  105. #ifndef    NeedVarargsPrototypes
  106. #define    NeedVarargsPrototypes    NeedFunctionPrototypes
  107. #endif
  108.  
  109. #ifndef    _XFUNCPROTOBEGIN
  110. #define    _XFUNCPROTOBEGIN
  111. #define    _XFUNCPROTOEND
  112. #endif
  113.  
  114. #ifndef    _Xconst
  115. #ifdef    __STDC__
  116. #define    _Xconst    const
  117. #else    /* STDC */
  118. #define    _Xconst
  119. #endif    /* STDC */
  120. #endif    /* _Xconst */
  121.  
  122. #ifndef    VOLATILE
  123. #if    defined(__STDC__) || (defined(__stdc__) && defined(__convex__))
  124. #define    VOLATILE    volatile
  125. #else
  126. #define    VOLATILE    /* nothing */
  127. #endif
  128. #endif
  129.  
  130. #ifndef    NORETURN
  131. #ifdef    __GNUC__
  132. #define    NORETURN    volatile
  133. #else
  134. #define    NORETURN    /* nothing */
  135. #endif
  136. #endif
  137.  
  138. #define    Printf    (void) printf
  139. #define    Puts    (void) puts
  140. #define    Fprintf    (void) fprintf
  141. #define    Sprintf    (void) sprintf
  142. #define    Fseek    (void) fseek
  143. #define    Fread    (void) fread
  144. #define    Fputs    (void) fputs
  145. #define    Putc    (void) putc
  146. #define    Putchar    (void) putchar
  147. #define    Fclose    (void) fclose
  148. #define    Fflush    (void) fflush
  149. #define    Strcpy    (void) strcpy
  150.  
  151. /********************************
  152.  *     Types and data        *
  153.  *******************************/
  154.  
  155. #ifndef    EXTERN
  156. #define    EXTERN    extern
  157. #define    INIT(x)
  158. #endif
  159.  
  160. #define    MAXDIM        32767
  161.  
  162. typedef    unsigned char ubyte;
  163.  
  164. #if    NeedWidePrototypes
  165. typedef    unsigned int    wide_ubyte;
  166. typedef    int        wide_bool;
  167. #define    WIDENINT    (int)
  168. #else
  169. typedef    ubyte        wide_ubyte;
  170. typedef    Boolean        wide_bool;
  171. #define    WIDENINT
  172. #endif
  173.  
  174. /*
  175.  *    pixel_conv is currently used only for converting absolute positions
  176.  *    to pixel values; although normally it should be
  177.  *        ((int) ((x) / shrink_factor + (1 << 15) >> 16)),
  178.  *    the rounding is achieved instead by moving the constant 1 << 15 to
  179.  *    PAGE_OFFSET in dvi_draw.c.
  180.  */
  181. #define    pixel_conv(x)        ((int) ((x) / shrink_factor >> 16))
  182. #define    pixel_round(x)        ((int) ROUNDUP(x, shrink_factor << 16))
  183. #define    spell_conv0(n, f)    ((long) (n * f))
  184. #define    spell_conv(n)        spell_conv0(n, dimconv)
  185.  
  186. #ifdef    BMBYTE
  187. #define    BMUNIT            unsigned char
  188. #define    BITS_PER_BMUNIT        8
  189. #define    BYTES_PER_BMUNIT    1
  190. #else    /* !BMBYTE */
  191. #ifdef    BMSHORT
  192. #define    BMUNIT            unsigned short
  193. #define    BITS_PER_BMUNIT        16
  194. #define    BYTES_PER_BMUNIT    2
  195. #else    /* !BMSHORT */
  196. #define    BMLONG
  197. #ifdef    __alpha
  198. #define    BMUNIT            unsigned int
  199. #else
  200. #define    BMUNIT            unsigned long
  201. #endif    /* if __alpha */
  202. #define    BITS_PER_BMUNIT        32
  203. #define    BYTES_PER_BMUNIT    4
  204. #endif    /* !BMSHORT */
  205. #endif    /* !BMBYTE */
  206.  
  207. #define    ADD(a, b)    ((BMUNIT *) (((char *) a) + b))
  208. #define    SUB(a, b)    ((BMUNIT *) (((char *) a) - b))
  209.  
  210. extern    BMUNIT    bit_masks[BITS_PER_BMUNIT + 1];
  211.  
  212. struct frame {
  213.     struct framedata {
  214.         long dvi_h, dvi_v, w, x, y, z;
  215.         int pxl_v;
  216.     } data;
  217.     struct frame *next, *prev;
  218. };
  219.  
  220. #if    NeedFunctionPrototypes
  221. #ifndef    TEXXET
  222. typedef    long    (*set_char_proc)(wide_ubyte);
  223. #else    /* TEXXET */
  224. typedef    void    (*set_char_proc)(wide_ubyte, wide_ubyte);
  225. #endif    /* TEXXET */
  226. #else    /* NeedFunctionPrototypes */
  227. #ifndef    TEXXET
  228. typedef    long    (*set_char_proc)();
  229. #else    /* TEXXET */
  230. typedef    void    (*set_char_proc)();
  231. #endif    /* TEXXET */
  232. #endif    /* NeedFunctionPrototypes */
  233.  
  234. struct drawinf {    /* this information is saved when using virtual fonts */
  235.     struct framedata data;
  236.     struct font    *fontp;
  237.     set_char_proc    set_char_p;
  238.     int        tn_table_len;
  239.     struct font    **tn_table;
  240.     struct tn    *tn_head;
  241.     ubyte        *pos, *end;
  242.     struct font    *virtual;
  243. #ifdef    TEXXET
  244.     int        dir;
  245. #endif
  246. };
  247.  
  248. EXTERN    struct drawinf    currinf;
  249.  
  250. /* entries below with the characters 'dvi' in them are actually stored in
  251.    scaled pixel units */
  252.  
  253. #define DVI_H   currinf.data.dvi_h
  254. #define PXL_H   pixel_conv(currinf.data.dvi_h)
  255. #define DVI_V   currinf.data.dvi_v
  256. #define PXL_V   currinf.data.pxl_v
  257. #define WW      currinf.data.w
  258. #define XX      currinf.data.x
  259. #define YY      currinf.data.y
  260. #define ZZ      currinf.data.z
  261. #define ROUNDUP(x,y) (((x)+(y)-1)/(y))
  262.  
  263. EXTERN    int    current_page;
  264. EXTERN    int    total_pages;
  265. EXTERN    long    magnification;
  266. EXTERN    double    dimconv;
  267. EXTERN    double    tpic_conv;
  268. EXTERN    int    n_files_left;    /* for LRU closing of fonts */
  269. EXTERN    time_t    dvi_time;        /* last mod. time for dvi file */
  270. EXTERN    unsigned int    page_w, page_h;
  271.  
  272. #if    defined(PS_DPS) || defined(PS_NEWS) || defined(PS_GS)
  273. #define    PS    1
  274. #else
  275. #define    PS    0
  276. #endif
  277.  
  278. /*
  279.  * Table of page offsets in DVI file, indexed by page number - 1.
  280.  * Initialized in prepare_pages().
  281.  */
  282. EXTERN    long    *page_offset;
  283.  
  284. /*
  285.  * Mechanism for reducing repeated warning about specials, lost characters, etc.
  286.  */
  287. EXTERN    Boolean    hush_spec_now;
  288.  
  289.  
  290. /*
  291.  * Bitmap structure for raster ops.
  292.  */
  293. struct bitmap {
  294.     unsigned short    w, h;        /* width and height in pixels */
  295.     short        bytes_wide;    /* scan-line width in bytes */
  296.     char        *bits;        /* pointer to the bits */
  297. };
  298.  
  299. /*
  300.  * Per-character information.
  301.  * There is one of these for each character in a font (raster fonts only).
  302.  * All fields are filled in at font definition time,
  303.  * except for the bitmap, which is "faulted in"
  304.  * when the character is first referenced.
  305.  */
  306. struct glyph {
  307.     long addr;        /* address of bitmap in font file */
  308.     long dvi_adv;        /* DVI units to move reference point */
  309.     short x, y;        /* x and y offset in pixels */
  310.     struct bitmap bitmap;    /* bitmap for character */
  311.     short x2, y2;        /* x and y offset in pixels (shrunken bitmap) */
  312. #ifdef    GREY
  313.     XImage *image2;
  314.     char *pixmap2;
  315. #endif
  316.     struct bitmap bitmap2;    /* shrunken bitmap for character */
  317. };
  318.  
  319. /*
  320.  * Per character information for virtual fonts
  321.  */
  322. struct macro {
  323.     ubyte    *pos;        /* address of first byte of macro */
  324.     ubyte    *end;        /* address of last+1 byte */
  325.     long    dvi_adv;    /* DVI units to move reference point */
  326.     Boolean    free_me;    /* if free(pos) should be called when */
  327.                 /* freeing space */
  328. };
  329.  
  330. /*
  331.  * The layout of a font information block.
  332.  * There is one of these for every loaded font or magnification thereof.
  333.  * Duplicates are eliminated:  this is necessary because of possible recursion
  334.  * in virtual fonts.
  335.  *
  336.  * Also note the strange units.  The design size is in 1/2^20 point
  337.  * units (also called micro-points), and the individual character widths
  338.  * are in the TFM file in 1/2^20 ems units, i.e., relative to the design size.
  339.  *
  340.  * We then change the sizes to SPELL units (unshrunk pixel / 2^16).
  341.  */
  342.  
  343. #define    NOMAGSTP (-29999)
  344.  
  345. #if    NeedFunctionPrototypes
  346. typedef    void (*read_char_proc)(register struct font *, wide_ubyte);
  347. #else
  348. typedef    void (*read_char_proc)();
  349. #endif
  350.  
  351. struct font {
  352.     struct font *next;        /* link to next font info block */
  353.     char *fontname;            /* name of font */
  354.     float fsize;            /* size information (dots per inch) */
  355.     int magstepval;            /* magstep number * two, or NOMAGSTP */
  356.     FILE *file;            /* open font file or NULL */
  357.     char *filename;            /* name of font file */
  358.     long checksum;            /* checksum */
  359.     unsigned short timestamp;    /* for LRU management of fonts */
  360.     ubyte flags;            /* flags byte (see values below) */
  361.     ubyte maxchar;            /* largest character code */
  362.     double dimconv;            /* size conversion factor */
  363.     set_char_proc set_char_p;    /* proc used to set char */
  364.         /* these fields are used by (loaded) raster fonts */
  365.     read_char_proc read_char;    /* function to read bitmap */
  366.     struct glyph *glyph;
  367.         /* these fields are used by (loaded) virtual fonts */
  368.     struct font **vf_table;        /* list of fonts used by this vf */
  369.     struct tn *vf_chain;        /* ditto, if TeXnumber >= VFTABLELEN */
  370.     struct font *first_font;    /* first font defined */
  371.     struct macro *macro;
  372.         /* I suppose the above could be put into a union, but we */
  373.         /* wouldn't save all that much space. */
  374. };
  375.  
  376. #define    FONT_IN_USE    1    /* used for housekeeping */
  377. #define    FONT_LOADED    2    /* if font file has been read */
  378. #define    FONT_VIRTUAL    4    /* if font is virtual */
  379.  
  380. #define    TNTABLELEN    30    /* length of TeXnumber array (dvi file) */
  381. #define    VFTABLELEN    5    /* length of TeXnumber array (virtual fonts) */
  382.  
  383. struct tn {
  384.     struct tn *next;        /* link to next TeXnumber info block */
  385.     int TeXnumber;            /* font number (in DVI file) */
  386.     struct font *fontp;        /* pointer to the rest of the info */
  387. };
  388.  
  389. EXTERN    struct font    *tn_table[TNTABLELEN];
  390. EXTERN    struct font    *font_head    INIT(NULL);
  391. EXTERN    struct tn    *tn_head    INIT(NULL);
  392. EXTERN    ubyte        maxchar;
  393. EXTERN    unsigned short    current_timestamp INIT(0);
  394.  
  395. /*
  396.  *    Command line flags.
  397.  */
  398.  
  399. extern    struct _resource {
  400.     char    *debug_arg;
  401. #ifdef    TOOLKIT
  402.     int    shrinkfactor;
  403. #endif
  404.     int    _density;
  405. #ifdef    GREY
  406.     float    _gamma;
  407. #endif
  408.     int    _pixels_per_inch;
  409.     char    *sidemargin;
  410.     char    *topmargin;
  411.     char    *xoffset;
  412.     char    *yoffset;
  413.     _Xconst char    *paper;
  414.     char    *_alt_font;
  415.     Boolean    _list_fonts;
  416.     Boolean    reverse;
  417.     Boolean    _hush_spec;
  418.     Boolean    _hush_chars;
  419.     Boolean    _hush_chk;
  420.     char    *fore_color;
  421.     char    *back_color;
  422.     char    *brdr_color;
  423.     char    *high_color;
  424.     char    *curs_color;
  425.     Pixel    _fore_Pixel;
  426.     Pixel    _back_Pixel;
  427. #ifdef    TOOLKIT
  428.     Pixel    _brdr_Pixel;
  429.     Pixel    _hl_Pixel;
  430.     Pixel    _cr_Pixel;
  431. #endif
  432.     char    *icon_geometry;
  433.     Boolean    keep_flag;
  434. #ifdef    TOOLKIT
  435.     char    *copy_arg;
  436. #endif
  437.     Boolean    copy;
  438.     Boolean    thorough;
  439. #if    PS
  440.     /* default is to use DPS, then NEWS, then GhostScript;
  441.      * we will figure out later on which one we will use */
  442.     Boolean    _postscript;
  443. #ifdef    PS_DPS
  444.     Boolean    useDPS;
  445. #endif
  446. #ifdef    PS_NEWS
  447.     Boolean    useNeWS;
  448. #endif
  449. #ifdef    PS_GS
  450.     Boolean    useGS;
  451. #endif
  452. #endif    /* PS */
  453.     Boolean    version_flag;
  454. #ifdef    BUTTONS
  455.     Boolean    expert;
  456. #endif
  457.     char    *mg_arg[5];
  458. #ifdef    GREY
  459.     Boolean    _use_grey;
  460. #endif
  461.     Boolean _use_makepk;
  462.     char    *_mf_mode;
  463. } resource;
  464.  
  465. /* As a convenience, we define the field names without leading underscores
  466.  * to point to the field of the above record.  Here are the global ones;
  467.  * the local ones are defined in each module.  */
  468.  
  469. #define    density        resource._density
  470. #define    pixels_per_inch    resource._pixels_per_inch
  471. #define    alt_font    resource._alt_font
  472. #define    list_fonts    resource._list_fonts
  473. #define    hush_spec    resource._hush_spec
  474. #define    hush_chars    resource._hush_chars
  475. #define    hush_chk    resource._hush_chk
  476. #ifdef  GREY
  477. #define    use_grey    resource._use_grey
  478. #endif
  479. #define    use_makepk    resource._use_makepk
  480. #define    mf_mode        resource._mf_mode
  481.  
  482. #ifndef    TOOLKIT
  483. EXTERN    Pixel        brdr_Pixel;
  484. #endif
  485.  
  486. extern    struct    mg_size_rec {
  487.     int    w;
  488.     int    h;
  489. }
  490.     mg_size[5];
  491.  
  492. EXTERN    int    debug    INIT(0);
  493.  
  494. #define    DBG_BITMAP    0x1
  495. #define    DBG_DVI        0x2
  496. #define    DBG_PK        0x4
  497. #define    DBG_BATCH    0x8
  498. #define    DBG_EVENT    0x10    /* 16 */
  499. #define    DBG_OPEN    0x20    /* 32 */
  500. #define    DBG_PS        0x40    /* 64 */
  501. #define    DBG_STAT    0x80    /* 128 */
  502. #define    DBG_HASH    0x100    /* 256 */
  503. #define    DBG_PATHS    0x200    /* 512 */
  504. #define    DBG_EXPAND    0x400    /* 1024 */
  505. #define    DBG_SEARCH    0x800    /* 2048 */
  506. #define    DBG_ALL        (0xffff & ~DBG_BATCH)
  507.  
  508. #ifndef    BDPI
  509. #define    BDPI    300
  510. #endif
  511.  
  512. EXTERN    int        offset_x, offset_y;
  513. EXTERN    unsigned int    unshrunk_paper_w, unshrunk_paper_h;
  514. EXTERN    unsigned int    unshrunk_page_w, unshrunk_page_h;
  515.  
  516. EXTERN    char    *dvi_name    INIT(NULL);
  517. EXTERN    FILE    *dvi_file;            /* user's file */
  518. EXTERN    char    *prog;
  519. EXTERN    int    bak_shrink;            /* last shrink factor != 1 */
  520. EXTERN    Dimension    window_w, window_h;
  521. EXTERN    XImage    *image;
  522. EXTERN    int    backing_store;
  523. EXTERN    int    home_x, home_y;
  524.  
  525. EXTERN    Display    *DISP;
  526. EXTERN    Screen    *SCRN;
  527. EXTERN    GC    ruleGC;
  528. EXTERN    GC    foreGC, highGC;
  529. EXTERN    GC    foreGC2;
  530.  
  531. EXTERN    Cursor    redraw_cursor, ready_cursor;
  532.  
  533. #ifdef    GREY
  534. EXTERN    unsigned long    palette[17];
  535. EXTERN    unsigned long    *pixeltbl;
  536. #endif    /* GREY */
  537.  
  538. EXTERN    Boolean    canit        INIT(False);
  539. EXTERN    jmp_buf    canit_env;
  540. EXTERN    VOLATILE short    event_counter    INIT(0);
  541.  
  542. #if    PS
  543. EXTERN    Boolean    allow_can    INIT(True);
  544. #else
  545. #define    allow_can        0xff
  546. #endif
  547.  
  548. struct    WindowRec {
  549.     Window        win;
  550.     int        shrinkfactor;
  551.     int        base_x, base_y;
  552.     unsigned int    width, height;
  553.     int    min_x, max_x, min_y, max_y;    /* for pending expose events */
  554. };
  555.  
  556. extern    struct WindowRec mane, alt, currwin;
  557. EXTERN    int        min_x, max_x, min_y, max_y;
  558.  
  559. #define    shrink_factor    currwin.shrinkfactor
  560.  
  561. #ifdef    TOOLKIT
  562. EXTERN    Widget    top_level, vport_widget, draw_widget, clip_widget;
  563. #ifdef    BUTTONS
  564. #define    XTRA_WID    79
  565. EXTERN    Widget    form_widget;
  566. #endif
  567. #else    /* !TOOLKIT */
  568. EXTERN    Window    top_level;
  569.  
  570. #define    BAR_WID        12    /* width of darkened area */
  571. #define    BAR_THICK    15    /* gross amount removed */
  572. #endif    /* TOOLKIT */
  573.  
  574. EXTERN    jmp_buf    dvi_env;    /* mechanism to communicate dvi file errors */
  575. EXTERN    char    *dvi_oops_msg;    /* error message */
  576.  
  577. #if    PS
  578. extern    struct psprocs    {
  579.     
  580.     void    (*toggle) ARGS((void));
  581.     void    (*destroy) ARGS((void));
  582.     void    (*interrupt) ARGS((void));
  583.     void    (*endpage) ARGS((void));
  584.     void    (*drawbegin) ARGS((int, int, char *));
  585.     void    (*drawraw) ARGS((char *));
  586.     void    (*drawfile) ARGS((char *));
  587.     void    (*drawend) ARGS((char *));
  588. }    psp, no_ps_procs;
  589.  
  590. #endif    /* PS */
  591.  
  592. /********************************
  593.  *       Procedures        *
  594.  *******************************/
  595.  
  596. _XFUNCPROTOBEGIN
  597. #ifdef    BUTTONS
  598. extern    void    create_buttons ARGS((XtArgVal));
  599. #endif
  600. #ifdef    GREY
  601. extern    void    init_pix ARGS((wide_bool));
  602. #endif
  603. extern    void    reconfig ARGS((void));
  604. #ifdef    TOOLKIT
  605. extern    void    handle_key ARGS((Widget, XtPointer, XEvent *, Boolean *));
  606. extern    void    handle_resize ARGS((Widget, XtPointer, XEvent *, Boolean *));
  607. extern    void    handle_button ARGS((Widget, XtPointer, XEvent *, Boolean *));
  608. extern    void    handle_motion ARGS((Widget, XtPointer, XEvent *, Boolean *));
  609. extern    void    handle_release ARGS((Widget, XtPointer, XEvent *, Boolean *));
  610. extern    void    handle_exp ARGS((Widget, XtPointer, XEvent *, Boolean *));
  611. #endif
  612. extern    void    read_events ARGS((wide_bool));
  613. extern    void    redraw_page ARGS((void));
  614. extern    void    do_pages ARGS((void));
  615. extern    void    reset_fonts ARGS((void));
  616. extern    void    realloc_font ARGS((struct font *, wide_ubyte));
  617. extern    void    realloc_virtual_font ARGS((struct font *, wide_ubyte));
  618. extern    Boolean    load_font ARGS((struct font *));
  619. extern    struct font    *define_font ARGS((FILE *, wide_ubyte,
  620.             struct font *, struct font **, unsigned int,
  621.             struct tn **));
  622. extern    void    init_page ARGS((void));
  623. extern    void    open_dvi_file ARGS((void));
  624. extern    Boolean    check_dvi_file ARGS((void));
  625. extern    void    put_border ARGS((int, int, unsigned int, unsigned int, GC));
  626. #ifndef    TEXXET
  627. extern    long    set_char ARGS((wide_ubyte));
  628. extern    long    load_n_set_char ARGS((wide_ubyte));
  629. extern    long    set_vf_char ARGS((wide_ubyte));
  630. #else
  631. extern    void    set_char ARGS((wide_ubyte, wide_ubyte));
  632. extern    void    load_n_set_char ARGS((wide_ubyte, wide_ubyte));
  633. extern    void    set_vf_char ARGS((wide_ubyte, wide_ubyte));
  634. #endif
  635. extern    void    draw_page ARGS((void));
  636. extern    void    init_font_open ARGS((void));
  637. extern    FILE    *font_open ARGS((_Xconst char *, char **, double, int *, int,
  638.             char **));
  639. extern    void    applicationDoSpecial ARGS((char *));
  640. #if    NeedVarargsPrototypes
  641. extern    NORETURN void    oops(_Xconst char *, ...);
  642. #else
  643. extern    NORETURN void    oops();
  644. #endif
  645. extern    char    *xmalloc ARGS((unsigned, _Xconst char *));
  646. extern    void    alloc_bitmap ARGS((struct bitmap *));
  647. extern    FILE    *xfopen ARGS((_Xconst char *, OPEN_MODE_ARGS));
  648. #ifdef    PS_GS
  649. extern    int    xpipe ARGS((int *));
  650. #endif
  651. extern    unsigned long    num ARGS((FILE *, int));
  652. extern    long    snum ARGS((FILE *, int));
  653. extern    void    read_PK_index ARGS((struct font *, wide_bool));
  654. extern    void    read_GF_index ARGS((struct font *, wide_bool));
  655. extern    void    read_VF_index ARGS((struct font *, wide_bool));
  656.  
  657. #if    PS
  658. extern    void    drawbegin_none ARGS((int, int, char *));
  659. extern    void    draw_bbox ARGS((void));
  660. extern    void    NullProc ARGS((void));
  661. #ifdef    PS_DPS
  662. extern    Boolean    initDPS ARGS((void));
  663. #endif
  664. #ifdef    PS_NEWS
  665. extern    Boolean    initNeWS ARGS((void));
  666. #endif
  667. #ifdef    PS_GS
  668. extern    Boolean    initGS ARGS((void));
  669. #endif
  670. #endif    /* PS */
  671.  
  672. _XFUNCPROTOEND
  673.  
  674. #define one(fp)        ((unsigned char) getc(fp))
  675. #define sone(fp)    ((long) one(fp))
  676. #define two(fp)        num (fp, 2)
  677. #define stwo(fp)    snum(fp, 2)
  678. #define four(fp)    num (fp, 4)
  679. #define sfour(fp)    snum(fp, 4)
  680.