wdvi

network DVI viewer
Log | Files | Refs

commit 07d0080174120b6c61f7220396de3eee97669766
parent 9f5c2c92fbdb5e2dd965fddccbc796535e000170
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Wed,  8 Sep 2021 18:54:21 +0000

create and populate header files

Create header files for most source files and put data and function
declarations in them.

moves lots of code out of xdvi.h.

Diffstat:
Adata.h | 26++++++++++++++++++++++++++
Mdvi-draw.c | 7++++++-
Advi-draw.h | 2++
Mdvi-init.c | 47++++++-----------------------------------------
Advi-init.h | 9+++++++++
Mevents.c | 47++++++++++++++++++++++++++---------------------
Aevents.h | 114+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mfilefind.c | 10+++-------
Mfont-open.c | 10++++++++--
Afont-open.h | 1+
Afont.h | 230+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mft.c | 1+
Aft.h | 2++
Mhttp.c | 8++++----
Mpk.c | 1+
Mpopups.c | 34++++++++++++++++++----------------
Apopups.h | 24++++++++++++++++++++++++
Mspecial.c | 9++++++---
Aspecial.h | 46++++++++++++++++++++++++++++++++++++++++++++++
Mutil.c | 2++
Mutil.h | 13+++++++++++--
Mvf.c | 1+
Mxdvi.c | 13+++++++------
Mxdvi.h | 473++-----------------------------------------------------------------------------
24 files changed, 565 insertions(+), 565 deletions(-)

diff --git a/data.h b/data.h @@ -0,0 +1,26 @@ +#ifndef DATA_H +#define DATA_H + +struct rgb { + unsigned short r, g, b; +}; + +#define BMUNIT unsigned int +#define BMBYTES 4 /* sizeof(unsigned BMUNIT) */ +#define BMBITS (8 * BMBYTES) + +#define ADD(a, b) ((BMUNIT *) (((char *) a) + b)) +#define SUB(a, b) ((BMUNIT *) (((char *) a) - b)) + +extern BMUNIT bit_masks[BMBITS + 1]; + +/* + * Bitmap structure for raster ops. + */ +struct bitmap { + unsigned short w, h; /* width and height in pixels */ + short bytes_wide; /* scan-line width in bytes */ + char *bits; /* pointer to the bits */ +}; + +#endif diff --git a/dvi-draw.c b/dvi-draw.c @@ -35,6 +35,11 @@ NOTE: #include <X11/XKBlib.h> #define XBell(dpy, percent) XkbBell(dpy, mane.win, percent, (Atom) None) +#include "dvi-init.h" /* check_dvi_file() */ +#include "events.h" /* read_events(), do_color_change(), set_timer(), ... */ +#include "font.h" /* load_ft_font() XXX more */ +#include "popups.h" /* simple_popdown(), simple_popup() */ +#include "special.h" /* scan_special(), ... */ #include "util.h" /* xfopen(), snum() */ #include "xdvi.h" #include "dvi.h" @@ -780,7 +785,7 @@ show_status(arg) void -prescan() +prescan(void) { int nextreportpage; char scanmsg[40]; diff --git a/dvi-draw.h b/dvi-draw.h @@ -0,0 +1,2 @@ +void draw_page(void); +void prescan(void); diff --git a/dvi-init.c b/dvi-init.c @@ -27,14 +27,16 @@ NOTE: \*========================================================================*/ +#include <X11/Shell.h> /* defines XtNtitle and XtNiconName */ + +#include "dvi-init.h" +#include "events.h" /* mane */ +#include "font.h" +#include "special.h" /* init_prescan() */ #include "xdvi.h" #include "dvi.h" #include "util.h" /* xmalloc() */ -# include <ft2build.h> -# include FT_SIZES_H - -# include <X11/Shell.h> /* defines XtNtitle and XtNiconName */ #define PK_PRE 247 #define PK_ID 89 @@ -698,43 +700,6 @@ init_page() page_h = ROUNDUP(unshrunk_page_h, mane.shrinkfactor) + 2; } -/** - ** form_dvi_property forms the property used to exhibit the dvi file name - ** used as a window property (used for source specials). - **/ - -void -form_dvi_property(inode) - ino_t inode; -{ - size_t len; - char *p; - unsigned long ino; - int i; - - if (dvi_file == NULL) - return; - - if (dvi_property != NULL) - free(dvi_property); - - p = rindex(dvi_name, '/'); - if (p != NULL) ++p; else p = dvi_name; - len = strlen(p); - - dvi_property_length = len + 8; - dvi_property = xmalloc(dvi_property_length); - - /* Do it this way because different copies of xdvi might be running on - machines with different endiannesses. */ - ino = dvi_inode = inode; - for (i = 0; i < 8; ++i) { - dvi_property[i] = ino; - ino >>= 8; - } - memcpy(dvi_property + 8, p, len); -} - /* For non-toolkit compiles, this code appears in xdvi.c. */ static void diff --git a/dvi-init.h b/dvi-init.h @@ -0,0 +1,9 @@ +#include <X11/Intrinsic.h> /* Boolean */ + +Boolean check_dvi_file(void); +void full_reset_colors(void); +void init_dvi_file(void); +void init_page(void); +void reload_dvi_file(void); +void reset_colors(void); +void reset_fonts(void); diff --git a/events.c b/events.c @@ -27,8 +27,13 @@ NOTE: \*========================================================================*/ -#include "xdvi.h" +#include <sys/wait.h> /* waitpid, WNOHANG */ + #include <ctype.h> +#include <errno.h> +#include <limits.h> /* abs() */ +#include <signal.h> +#include <stdlib.h> /* free(), atoi(), atof(), exit(), abs() */ /* Xlib and Xutil are already included */ #include <X11/Xatom.h> @@ -36,30 +41,24 @@ NOTE: #include <X11/Shell.h> /* needed for def. of XtNiconX */ #include <X11/cursorfont.h> #include <X11/IntrinsicI.h> /* _XtComputeLateBindings */ - #include <X11/Xaw/Viewport.h> - - #include <X11/XKBlib.h> #define XBell(dpy, percent) XkbBell(dpy, mane.win, percent, (Atom) None) -#include <signal.h> -#include <sys/wait.h> /* waitpid, WNOHANG */ - +#include "dvi-init.h" /* init_page(), full_reset_colors(), reset_colors() */ +#include "dvi-draw.h" /* prescan(), draw_page() */ +#include "events.h" #include "http.h" +#include "popups.h" /* WARN, Act_print() */ +#include "special.h" /* page_colors */ #include "util.h" /* prep_fd() */ +#include "xdvi.h" + #ifndef SIGPOLL #define SIGPOLL SIGIO #endif -#include <poll.h> -#include <errno.h> - -#ifndef X11HEIGHT -#define X11HEIGHT 8 /* Height of server default font */ -#endif - #define MAGBORD 1 /* border size for magnifier */ /* @@ -80,8 +79,16 @@ static Boolean dragcurs = False; static sigset_t all_signals; +typedef void (*home_proc)(Boolean); +typedef void (*mouse_proc)(XEvent *); + +void null_mouse(XEvent *); static void xdvi_normal_exit(); +mouse_proc mouse_motion = null_mouse; +mouse_proc mouse_release = null_mouse; + + /* * The cursor shape in the magnifying glass is determined by which * window received the button press event. Under XAW, that is a parent @@ -89,11 +96,10 @@ static void xdvi_normal_exit(); * of mane.win in that case. */ -# define CURSORWIN XtWindow(form_widget) +#define CURSORWIN XtWindow(form_widget) static XColor bg_Color; - #define ACTION_DECL(name) \ void name(Widget, XEvent *, String *, Cardinal *) @@ -101,7 +107,6 @@ static XColor bg_Color; void name(Widget w, XEvent *event, \ String *params, Cardinal *num_params) - /* ARGSUSED */ void null_mouse(XEvent *event) @@ -434,7 +439,7 @@ static int shift1_r, shift1_g, shift1_b; static int shift2_r, shift2_g, shift2_b; static Boolean shifts_good = False; -Pixel +static Pixel alloc_color(colorp, fallback_pixel) const struct rgb *colorp; Pixel fallback_pixel; @@ -883,7 +888,7 @@ static Arg arg_xy[] = { -void +static void home(Boolean scrl) { if (!scrl) XUnmapWindow(DISP, mane.win); @@ -1000,7 +1005,7 @@ handle_resize(widget, junk, event, cont) } -void +static void reconfig() { XdviResizeWidget(draw_widget, page_w, page_h); @@ -1016,7 +1021,7 @@ reconfig() static home_proc home_action = home; -void +static void goto_page(n, proc) int n; home_proc proc; diff --git a/events.h b/events.h @@ -0,0 +1,114 @@ +#include <sys/time.h> /* struct timeval */ + +#include <X11/Intrinsic.h> + +#include <poll.h> /* struct pollfd */ + + +struct xdvi_action { + struct xdvi_action *next; + XtActionProc proc; + Cardinal num_params; + String param; +}; + +struct wheel_acts { + struct wheel_acts *next; + Modifiers mask; + Modifiers value; + struct _LateBindings *late_bindings; + unsigned int button; + struct xdvi_action *action; +}; + +struct wheel_acts *wheel_actions; + +struct xtimer { + struct xtimer *next; /* link to next in chain */ + struct timeval when; /* when to call the routine */ + void (*proc)(struct xtimer *); /* procedure to call */ +}; +#define TIMER_INIT(proc) {NULL, {0, 0}, proc} + +struct xio { + struct xio *next; /* link to next in list */ + int fd; /* file descriptor */ + int xio_events; /* same as in struct pollfd (can't call + it events because poll.h on AIX + defines events to something else) */ + struct pollfd *pfd; + void (*read_proc)(void); /* call to read */ + void (*write_proc)(void); /* call to write */ +}; + +struct xchild { + struct xchild *next; /* link to next in list */ + pid_t pid; /* pid of process, or 0 */ + Boolean killable; /* if can be killed with SIGKILL */ + void (*proc)(int); /* procedure to call */ +}; + +struct WindowRec { + Window win; + int shrinkfactor; + int base_x, base_y; + unsigned int width, height; + int min_x, max_x, min_y, max_y; /* for pending expose events */ +}; + +extern struct WindowRec mane, alt, currwin; +#define shrink_factor currwin.shrinkfactor + +/* + * Flag values and masks for event_flags + */ + +#define EV_IDLE (1<<0) /* non-event */ +#define EV_CURSOR (1<<1) /* cursor needs to revert back to ready */ +#define EV_EXPOSE (1<<2) /* expose occurred somewhere */ +#define EV_MAG_MOVE (1<<3) /* magnifier moved */ +#define EV_MAG_GONE (1<<4) /* magnifier gone while being drawn */ +#define EV_ACK (1<<5) /* used internally */ +#define EV_NEWPAGE (1<<7) /* new page requested */ +#define EV_PS_TOGGLE (1<<8) /* PostScript toggled on or off */ +#define EV_NEWDOC (1<<9) /* new dvi file requested */ +#define EV_TERM (1<<10) /* quit */ +#define EV_MAXPLUS1 (1<<11) + +#define EV_GE_IDLE (EV_MAXPLUS1 - EV_IDLE) +#define EV_GT_IDLE (EV_MAXPLUS1 - EV_CURSOR) +#define EV_GE_CURSOR (EV_MAXPLUS1 - EV_CURSOR) +#define EV_GE_EXPOSE (EV_MAXPLUS1 - EV_EXPOSE) +#define EV_GE_MAG_MOVE (EV_MAXPLUS1 - EV_MAG_MOVE) +#define EV_GE_MAG_GONE (EV_MAXPLUS1 - EV_MAG_GONE) +#define EV_GE_ACK (EV_MAXPLUS1 - EV_ACK) +#define EV_GE_NEWPAGE (EV_MAXPLUS1 - EV_NEWPAGE) +#define EV_GE_PS_TOGGLE (EV_MAXPLUS1 - EV_PS_TOGGLE) +#define EV_GE_NEWDOC (EV_MAXPLUS1 - EV_NEWDOC) +#define EV_GE_TERM (EV_MAXPLUS1 - EV_TERM) + +#define EV_NOWAIT EV_GE_IDLE + +unsigned int ev_flags = EV_IDLE; +volatile int event_counter = 0; + + +Bool compile_action(const char *, struct xdvi_action **); +void expose(struct WindowRec *, int, int, unsigned int, unsigned int); +void do_color_change(void); +void do_pages(void) __attribute__((__noreturn__)); +void enable_intr(void); +void handle_expose(Widget, XtPointer, XEvent *, Boolean *); +void handle_resize(Widget, XtPointer, XEvent *, Boolean *); +void handle_messages(Widget, XtPointer, XEvent *, Boolean *); +void init_plane_masks(void); +unsigned int read_events(unsigned int); + +void set_timer(struct xtimer *, int); +void cancel_timer(struct xtimer *); + +void set_io(struct xio *); +void clear_io(struct xio *); + +void set_chld(struct xchild *); +void clear_chld(struct xchild *); diff --git a/filefind.c b/filefind.c @@ -38,6 +38,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * <pwd.h> */ +#include <setjmp.h> /* jmp_buf, longjmp(), setjmp() */ +#include <stdlib.h> /* getenv() */ + #include "filf-app.h" /* application-related declarations & defs */ #include "filefind.h" #include "util.h" /* xfopen(), expandline(), ff_getpw() */ @@ -47,10 +50,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define DEFAULT_TEXMF_PATH "/usr/local/share/texmf-dist" -#ifndef XtNumber -#define XtNumber(array) (sizeof(array) / sizeof(*array)) -#endif - #if !defined(S_ISREG) && defined(S_IFREG) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif @@ -67,9 +66,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define ST_NLINK_TRICK 1 #endif /* !defined(ST_NLINK_TRICK) */ -extern char *xstrdup(const char *); -extern char *xmemdup(const char *, size_t); - /* These are defined so that the editor can match braces properly. */ #define LBRACE '{' #define RBRACE '}' diff --git a/font-open.c b/font-open.c @@ -27,12 +27,18 @@ NOTE: \*========================================================================*/ +#include <errno.h> +#include <signal.h> + +#include <X11/Xos.h> + +#include "events.h" /* read_events(), ... */ +#include "font.h" #include "filf-app.h" /* application-related defs, etc. */ #include "filefind.h" +#include "popups.h" /* WARN1 */ #include "util.h" /* prep_fd(), xfopen(), xpipe(), xputenv(), ... */ -#include <errno.h> -#include <signal.h> /* * If you think you have to change DEFAULT_TAIL, then you haven't read the diff --git a/font-open.h b/font-open.h @@ -0,0 +1 @@ +void init_font_open(void); diff --git a/font.h b/font.h @@ -0,0 +1,230 @@ +#include <stdio.h> /* FILE */ + +#include <X11/Intrinsic.h> /* Boolean */ +#include <X11/Xlib.h> /* XImage */ + +#include <ft2build.h> +#include FT_SIZES_H /* FT_Size */ + +#include "data.h" /* struct bitmap */ + + +#define TEXXET 1 /* Define to enable right-to-left typesetting. */ + +struct frame { + struct framedata { + long dvi_h, dvi_v, w, x, y, z; + int pxl_v; + } data; + struct frame *next, *prev; +}; + +#ifndef TEXXET +typedef long (*set_char_proc)(unsigned char); +#else +typedef void (*set_char_proc)(unsigned char, unsigned char); +#endif + +struct drawinf { /* this information is saved when using virtual fonts */ + struct framedata data; + struct font *fontp; + set_char_proc set_char_p; + int tn_table_len; + struct font **tn_table; + struct tn *tn_head; + unsigned char *pos, *end; + struct font *virtual; +#ifdef TEXXET + int dir; +#endif +}; + +struct drawinf currinf; + +/* entries below with the characters 'dvi' in them are actually stored in + scaled pixel units */ + +#define DVI_H currinf.data.dvi_h +#define PXL_H pixel_conv(currinf.data.dvi_h) +#define DVI_V currinf.data.dvi_v +#define PXL_V currinf.data.pxl_v +#define WW currinf.data.w +#define XX currinf.data.x +#define YY currinf.data.y +#define ZZ currinf.data.z + + +/* + * Per-character information for virtual fonts + */ +struct macro { + unsigned char *pos; /* address of first byte of macro */ + unsigned char *end; /* address of last+1 byte */ + long dvi_adv; /* DVI units to move reference point */ + Boolean free_me; /* if free(pos) should be called when */ + /* freeing space */ +}; + +/* + * Per-character information. + * There is one of these for each character in a font (raster fonts only). + * All fields are filled in at font definition time, + * except for the bitmap, which is "faulted in" + * when the character is first referenced. + */ +struct glyph { + long addr; /* address of bitmap in font file */ + long dvi_adv; /* DVI units to move reference point */ + short x, y; /* x and y offset in pixels */ + struct bitmap bitmap; /* bitmap for character */ + short x2, y2; /* x and y offset in pixels (shrunken bitmap) */ + struct fgrec *fg; /* fgrec for which these pixmaps are valid */ + XImage *image2; + char *pixmap2; + char *pixmap2_t; + struct bitmap bitmap2; /* shrunken bitmap for character */ +}; + +/* + * The layout of a font information block. + * There is one of these for every loaded font or magnification thereof. + * Duplicates are eliminated: this is necessary because of possible recursion + * in virtual fonts. + * + * Also note the strange units. The design size is in 1/2^20 point + * units (also called micro-points), and the individual character widths + * are in the TFM file in 1/2^20 ems units, i.e., relative to the design size. + * + * We then change the sizes to SPELL units (unshrunk pixel / 2^16). + */ + +#define NOMAGSTP (-29999) + +struct font; + +typedef void (*read_char_proc)(struct font *, unsigned char); + +struct font { + struct font *next; /* link to next font info block */ + char *fontname; /* name of font */ + float fsize; /* size information (dots per inch) */ + int magstepval; /* magstep number * two, or NOMAGSTP */ + FILE *file; /* open font file or NULL */ + const char *filename; /* name of font file */ + long checksum; /* checksum */ + unsigned short timestamp; /* for LRU management of fonts */ + unsigned char flags; /* flags byte (see values below) */ + unsigned char maxchar; /* largest character code */ + double dimconv; /* size conversion factor */ + set_char_proc set_char_p; /* proc used to set char */ + /* these fields are used by (loaded) non-virtual fonts */ + read_char_proc read_char; /* function to read bitmap */ + struct glyph *glyph; + /* these fields are used by (loaded) virtual fonts */ + struct font **vf_table; /* list of fonts used by this vf */ + struct tn *vf_chain; /* ditto, if TeXnumber >= VFTABLELEN */ + struct font *first_font; /* first font defined */ + struct macro *macro; + /* these fields are used by (loaded) FreeType fonts */ + struct ftfont *ft; /* master record for font (all sizes) */ + double spsize; /* scaled size of font in spell units */ + FT_Size size; + struct font *next_size; /* next font from same face */ + /* I suppose the above could be put into a union, but we */ + /* wouldn't save all that much space. */ +}; + +#define FONT_IN_USE 1 /* used for housekeeping */ +#define FONT_LOADED 2 /* if font file has been read */ +#define FONT_VIRTUAL 4 /* if font is virtual */ + +#define TNTABLELEN 30 /* length of TeXnumber array (dvi file) */ +#define VFTABLELEN 5 /* length of TeXnumber array (virtual fonts) */ + +struct tn { + struct tn *next; /* link to next TeXnumber info block */ + int TeXnumber; /* font number (in DVI file) */ + struct font *fontp; /* pointer to the rest of the info */ +}; + +struct font *tn_table[TNTABLELEN]; +struct font *font_head = NULL; +struct tn *tn_head = NULL; +unsigned char maxchar; +unsigned short current_timestamp = 0; + +/* + * AVL tree structures. + */ + +#define AVL_COMMON \ + const char *key; /* key */ \ + int key_len; /* length of key */ \ + int bal; /* AVL balancing information */ \ + struct avl *left; \ + struct avl *right + +struct avl { /* generic data structure */ + AVL_COMMON; +}; + + /* Data structure for Type 1 fonts -- contents of psfonts.map */ +struct avl_t1 { + AVL_COMMON; + const char *psname; /* PS name of font */ + const char *fontfile; /* (short) name of pfa/pfb file */ + const char *encname; /* (short) name of encoding file */ + const char *addinfo; /* additional PS instructions */ + Boolean bad; /* if later found to be unloadable */ + struct ftfont *ft; /* pointer to FreeType record */ +}; + + + +struct ftfont { /* info for FreeType font (Type 1 or TrueType) */ + FT_Face face; /* NULL means not loaded yet */ + struct font *first_size; + struct avl_t1 *t1; + /* struct avl_tt *tt; */ + struct FT_StreamRec_ stream; + struct avl_enc *enc; /* pointer to encoding record */ + double expn; /* expansion factor */ +}; + + +struct avl_enc { + AVL_COMMON; + Boolean valid; + const char *vec[256]; +}; + + + +Boolean font_open(struct font *, char **, int *); +Boolean load_ft_font(struct font *); +void read_PK_index(struct font *, Boolean); +void read_VF_index(struct font *, Boolean); + +struct font *define_font(FILE *, unsigned char, + struct font *, struct font **, unsigned int, + struct tn **); + +FILE *open_t1_font(struct avl_t1 *, const char **); + +void realloc_font(struct font *, unsigned char); +void realloc_virtual_font(struct font *, unsigned char); +Boolean load_font(struct font *); +void open_font_file(struct font *); +void read_encoding(struct avl_enc *); + +#ifndef TEXXET +long set_char(unsigned char); +long load_n_set_char(unsigned char); +long set_vf_char(unsigned char); +long set_ft_char(unsigned char); +#else +void set_char(unsigned char, unsigned char); +void load_n_set_char(unsigned char, unsigned char); +void set_vf_char(unsigned char, unsigned char); +void set_ft_char(unsigned char, unsigned char); +#endif diff --git a/ft.c b/ft.c @@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Public routines are load_ft_font and read_ft_char. */ +#include "font.h" /* struct font */ #include "xdvi.h" #include "util.h" /* oops() */ diff --git a/ft.h b/ft.h @@ -0,0 +1,2 @@ +#include "font.h" /* struct font */ + diff --git a/http.c b/http.c @@ -22,13 +22,14 @@ #include <assert.h> #include <err.h> /* err() */ #include <stdlib.h> /* strtonum() */ +#include <string.h> /* strtok() */ #include <unistd.h> /* close() */ #include <openssl/err.h> /* ERR_load_crypto_strings() */ #include <openssl/evp.h> /* OpenSSL_add_all_algorithms() */ #include <openssl/ssl.h> -#include "xdvi.h" /* warning_popup_long() */ +#include "popups.h" /* warning_popup_long() */ #include "util.h" /* xmalloc() */ @@ -353,7 +354,6 @@ parse_headers(char *buf, int bytes_read) return res; } - static FILE * read_response(SSL *tls, struct url *url) { @@ -382,7 +382,7 @@ read_response(SSL *tls, struct url *url) goto free_response; } - /* XDvi does all it's processing with FILE streams. */ + /* XDvi does all its processing with FILE streams. */ if ((dvi_file = fmemopen(NULL, response->content_len, "r+")) == NULL) err(1, "fmemopen"); @@ -423,7 +423,7 @@ free_buf: /* * Gets the dest_url[] using a tls connection to the host, then writes the - * returned dvi document into a temporary file, which it returns. + * returned dvi document into a memory FILE, which it returns. * * Returns a FILE * pointer on success or NULL pointer on failure. */ diff --git a/pk.c b/pk.c @@ -30,6 +30,7 @@ NOTE: * Public routines are read_PK_index and read_PK_char. */ +#include "font.h" /* struct font, struct glyph */ #include "xdvi.h" #include "util.h" /* xmalloc() */ diff --git a/popups.c b/popups.c @@ -27,29 +27,31 @@ IN THE SOFTWARE. * Code for popup windows. */ -#include "xdvi.h" -#include "util.h" /* prep_fd(), xfopen(), xputenv() */ +#include <sys/stat.h> +#include <sys/wait.h> + #include <ctype.h> #include <errno.h> #include <signal.h> -#include <sys/stat.h> - -/* Xlib and Xutil are already included */ +#include <stdarg.h> +#include <stdlib.h> /* free(), atoi(), getenv() */ #include <X11/Xatom.h> +#include <X11/Xos.h> #include <X11/StringDefs.h> +#include <X11/Shell.h> +#include <X11/Xaw/Form.h> +#include <X11/Xaw/Label.h> +#include <X11/Xaw/Command.h> +#include <X11/Xaw/Toggle.h> +#include <X11/Xaw/AsciiText.h> +#include <X11/Xaw/Viewport.h> + +#include "events.h" /* struct xtimer, TIMER_INIT, set_timer(), ... */ +#include "popups.h" +#include "xdvi.h" +#include "util.h" /* prep_fd(), xfopen(), xputenv() */ -# include <X11/Shell.h> -# include <X11/Xaw/Form.h> -# include <X11/Xaw/Label.h> -# include <X11/Xaw/Command.h> -# include <X11/Xaw/Toggle.h> -# include <X11/Xaw/AsciiText.h> -# include <X11/Xaw/Viewport.h> - -#include <stdarg.h> - -#include <sys/wait.h> #ifdef EWOULDBLOCK # ifdef EAGAIN diff --git a/popups.h b/popups.h @@ -0,0 +1,24 @@ +#include <X11/Intrinsic.h> + +/* + * Structure to use for status popups. + */ + +struct status_popup { + Widget shell; + Widget label; + int expected_type; + Boolean popped; + Boolean spurious; +}; + +void Act_print(Widget, XEvent *, String *, Cardinal *); +void do_popup(Widget); +void simple_popdown(struct status_popup *); +void simple_popup(struct status_popup *, const char *, XtCallbackProc); +Widget warning_popup(const char *, const char *, XtCallbackProc); +Widget warning_popup_long(const char *, const char *, XtCallbackProc, ...); + +#define WARN(t, s) (void) warning_popup(s, "OK", NULL) +#define WARN1(t, s, s1) (void) warning_popup_long(s, "OK", NULL, s1) +#define WARN2(t, s, s1, s2) (void) warning_popup_long(s, "OK", NULL, s1, s2) diff --git a/special.c b/special.c @@ -53,12 +53,15 @@ NOTE: * it's worth it. */ -#include "xdvi.h" -#include "util.h" /* xmalloc(), memicmp() */ - #include <math.h> #include <ctype.h> +#include "font.h" +#include "events.h" /* do_color_change() */ +#include "special.h" +#include "xdvi.h" +#include "util.h" /* xmalloc(), memicmp() */ + #define rint(x) floor((x) + 0.5) diff --git a/special.h b/special.h @@ -0,0 +1,46 @@ +#include <setjmp.h> + +#include "data.h" /* struct rgb */ + +jmp_buf canit_env; + +/* + * Used by the geometry-scanning routines. + * It passes pointers to routines to be called at certain + * points in the dvi file, and other information. + */ + +struct geom_info { + void (*geom_box) (struct geom_info *, long, long, long, long); + void (*geom_special) (struct geom_info *, const char *); + jmp_buf done_env; + void *geom_data; +}; + +/* + * Per-page data in DVI file, indexed by page number - 1. + * Offset is initialized in prepare_pages(). + * Page size is initialized while prescanning. + */ +struct per_page { + long offset; + unsigned int pw, ph; /* page size */ + unsigned int ww, wh; /* window size */ +}; +struct per_page *page_info; + +struct pagecolor { + struct rgb bg; + unsigned int stacksize; + const struct rgb *colorstack; +}; + +/* Information on background color and initial color stack for each page. */ +struct pagecolor *page_colors = NULL; + +void applicationDoSpecial(char *); +void geom_do_special(struct geom_info *, char *, double); +void init_prescan(void); +void scan_color_eop(void); +void scan_special(char *); +void set_fg_color(const struct rgb *); diff --git a/util.c b/util.c @@ -33,7 +33,9 @@ NOTE: #include <errno.h> #include <pwd.h> #include <stdarg.h> +#include <unistd.h> +#include "font.h" /* struct font */ #include "xdvi.h" #include "util.h" diff --git a/util.h b/util.h @@ -1,6 +1,14 @@ #include <dirent.h> #include <stdio.h> +#include "data.h" /* struct bitmap */ + +#define ROUNDUP(x,y) (((x)+(y)-1)/(y)) + + +void alloc_bitmap(struct bitmap *); +struct avl *avladd(const char *, size_t, struct avl **, size_t); + void expandline(size_t); const struct passwd *ff_getpw(const char **, const char *); int memicmp(const char *, const char *, size_t); @@ -18,8 +26,9 @@ void *xrealloc(void *, unsigned); char *xstrdup(const char *); char *xmemdup(const char *, size_t); -unsigned long num(FILE *, int); -long snum(FILE *, int); +unsigned long num(FILE *, int); +long snum(FILE *, int); + #define one(fp) ((unsigned char) getc(fp)) #define sone(fp) ((long) one(fp)) #define two(fp) num (fp, 2) diff --git a/vf.c b/vf.c @@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * faulting in characters as needed. */ +#include "font.h" /* struct font */ #include "xdvi.h" #include "dvi.h" #include "util.h" /* xmalloc() */ diff --git a/xdvi.c b/xdvi.c @@ -64,6 +64,7 @@ NOTE: #include <ctype.h> #include <math.h> /* sometimes includes atof() */ #include <stdarg.h> +#include <stdlib.h> /* exit(), atof(), atoi(), free() */ /* Xlib and Xutil are already included */ #include <X11/cursorfont.h> @@ -77,6 +78,12 @@ NOTE: #include <X11/Xaw/AsciiText.h> #include <X11/Xaw/Command.h> +#include "dvi-init.h" /* init_dvi_file(), init_page() */ +#include "dvi-draw.h" /* prescan() */ +#include "events.h" /* enable_intr(), compile_action(), ... */ +#include "font-open.h" +#include "popups.h" /* do_popup() */ +#include "special.h" /* page_info */ #include "util.h" /* xmalloc(), memicmp() */ #include "version.h" #include "xdvi.h" @@ -164,9 +171,6 @@ struct WindowRec alt = {(Window) 0, 1, 0, 0, 0, 0, MAXDIM, 0, MAXDIM, 0}; /* currwin is temporary storage except for within redraw() */ struct WindowRec currwin= {(Window) 0, 1, 0, 0, 0, 0, MAXDIM, 0, MAXDIM, 0}; -static char * atom_names[] = {"XDVI WINDOWS", "DVI NAME", "SRC GOTO", - "WM_DELETE_WINDOW", "WM_PROTOCOLS", }; - /* * Data for options processing */ @@ -1185,9 +1189,6 @@ or invalid argument:\n\t\"%s\", \"%s\".", debug = isdigit(*resource.debug_arg) ? atoi(resource.debug_arg) : DBG_ALL; - /* Check early for whether to pass off to a different xdvi process - * (-sourceposition argument for reverse source special lookup). */ - if (!XInternAtoms(DISP, atom_names, XtNumber(atom_names), False, atoms)) oops("XInternAtoms failed."); diff --git a/xdvi.h b/xdvi.h @@ -32,23 +32,16 @@ NOTE: #ifndef XDVI_H #define XDVI_H -#include <stddef.h> #include <stdio.h> -#include <setjmp.h> -#include <stdlib.h> -#include <unistd.h> - -#include <X11/X.h> -#include <X11/Xosdefs.h> -#include <X11/Xlib.h> /* include Xfuncs.h, if available */ -#include <X11/Xutil.h> /* needed for XDestroyImage */ -#include <X11/Xos.h> -#include <X11/Xfuncs.h> + #include <X11/Intrinsic.h> -#include <ft2build.h> -#include FT_FREETYPE_H +#include "data.h" /* struct rgb */ + +#ifndef __BYTE_ORDER__ +#error "Compiler does not have __BYTE_ORDER__ predefined macro" +#endif #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #define WORDS_BIGENDIAN 1 @@ -82,7 +75,6 @@ static const char addr_default[] = "www.0x30.net/resume.dvi"; #define MAXDIM 32767 typedef unsigned char ubyte; - typedef ubyte wide_ubyte; #define True 1 @@ -106,60 +98,6 @@ typedef char Bool3; /* Yes/No/Maybe */ #define spell_conv0(n, f) ((long) (n * f)) #define spell_conv(n) spell_conv0(n, dimconv) -#define BMUNIT unsigned int -#define BMBYTES 4 /* sizeof(unsigned BMUNIT) */ -#define BMBITS (8 * BMBYTES) - -#define ADD(a, b) ((BMUNIT *) (((char *) a) + b)) -#define SUB(a, b) ((BMUNIT *) (((char *) a) - b)) - -extern BMUNIT bit_masks[BMBITS + 1]; - -struct frame { - struct framedata { - long dvi_h, dvi_v, w, x, y, z; - int pxl_v; - } data; - struct frame *next, *prev; -}; - -#ifndef TEXXET -typedef long (*set_char_proc)(wide_ubyte); -#else -typedef void (*set_char_proc)(wide_ubyte, wide_ubyte); -#endif - -typedef void (*home_proc)(Boolean); - -struct drawinf { /* this information is saved when using virtual fonts */ - struct framedata data; - struct font *fontp; - set_char_proc set_char_p; - int tn_table_len; - struct font **tn_table; - struct tn *tn_head; - ubyte *pos, *end; - struct font *virtual; -#ifdef TEXXET - int dir; -#endif -}; - -struct drawinf currinf; - -/* entries below with the characters 'dvi' in them are actually stored in - scaled pixel units */ - -#define DVI_H currinf.data.dvi_h -#define PXL_H pixel_conv(currinf.data.dvi_h) -#define DVI_V currinf.data.dvi_v -#define PXL_V currinf.data.pxl_v -#define WW currinf.data.w -#define XX currinf.data.x -#define YY currinf.data.y -#define ZZ currinf.data.z -#define ROUNDUP(x,y) (((x)+(y)-1)/(y)) - int current_page; int total_pages; int pageno_correct = 1; @@ -174,19 +112,6 @@ int scanned_page_color; /* last page scanned for color spcls */ int scanned_page_reset; /* number to reset the above to */ /* - * Per-page data in DVI file, indexed by page number - 1. - * Offset is initialized in prepare_pages(). - * Page size is initialized while prescanning. - */ -struct per_page { - long offset; - unsigned int pw, ph; /* page size */ - unsigned int ww, wh; /* window size */ -}; - -struct per_page *page_info; - -/* * Set if the -paper option overrides papersize specials. */ Boolean ignore_papersize_specials = False; @@ -207,110 +132,14 @@ Boolean psfig_begun = False; int source_fwd_box_page = -1; /* -1 means no box */ /* - * Bitmap structure for raster ops. + * Used for window manager delete protocol (toolkit only). */ -struct bitmap { - unsigned short w, h; /* width and height in pixels */ - short bytes_wide; /* scan-line width in bytes */ - char *bits; /* pointer to the bits */ -}; +Atom atoms[2]; +#define XA_WM_DELETE_WINDOW (atoms[0]) +#define XA_WM_PROTOCOLS (atoms[1]) -/* - * Per-character information. - * There is one of these for each character in a font (raster fonts only). - * All fields are filled in at font definition time, - * except for the bitmap, which is "faulted in" - * when the character is first referenced. - */ -struct glyph { - long addr; /* address of bitmap in font file */ - long dvi_adv; /* DVI units to move reference point */ - short x, y; /* x and y offset in pixels */ - struct bitmap bitmap; /* bitmap for character */ - short x2, y2; /* x and y offset in pixels (shrunken bitmap) */ - struct fgrec *fg; /* fgrec for which these pixmaps are valid */ - XImage *image2; - char *pixmap2; - char *pixmap2_t; - struct bitmap bitmap2; /* shrunken bitmap for character */ -}; +static char *atom_names[] = { "WM_DELETE_WINDOW", "WM_PROTOCOLS" }; -/* - * Per-character information for virtual fonts - */ -struct macro { - ubyte *pos; /* address of first byte of macro */ - ubyte *end; /* address of last+1 byte */ - long dvi_adv; /* DVI units to move reference point */ - Boolean free_me; /* if free(pos) should be called when */ - /* freeing space */ -}; - -/* - * The layout of a font information block. - * There is one of these for every loaded font or magnification thereof. - * Duplicates are eliminated: this is necessary because of possible recursion - * in virtual fonts. - * - * Also note the strange units. The design size is in 1/2^20 point - * units (also called micro-points), and the individual character widths - * are in the TFM file in 1/2^20 ems units, i.e., relative to the design size. - * - * We then change the sizes to SPELL units (unshrunk pixel / 2^16). - */ - -#define NOMAGSTP (-29999) - -typedef void (*read_char_proc)(struct font *, wide_ubyte); - -struct font { - struct font *next; /* link to next font info block */ - char *fontname; /* name of font */ - float fsize; /* size information (dots per inch) */ - int magstepval; /* magstep number * two, or NOMAGSTP */ - FILE *file; /* open font file or NULL */ - const char *filename; /* name of font file */ - long checksum; /* checksum */ - unsigned short timestamp; /* for LRU management of fonts */ - ubyte flags; /* flags byte (see values below) */ - ubyte maxchar; /* largest character code */ - double dimconv; /* size conversion factor */ - set_char_proc set_char_p; /* proc used to set char */ - /* these fields are used by (loaded) non-virtual fonts */ - read_char_proc read_char; /* function to read bitmap */ - struct glyph *glyph; - /* these fields are used by (loaded) virtual fonts */ - struct font **vf_table; /* list of fonts used by this vf */ - struct tn *vf_chain; /* ditto, if TeXnumber >= VFTABLELEN */ - struct font *first_font; /* first font defined */ - struct macro *macro; - /* these fields are used by (loaded) FreeType fonts */ - struct ftfont *ft; /* master record for font (all sizes) */ - double spsize; /* scaled size of font in spell units */ - FT_Size size; - struct font *next_size; /* next font from same face */ - /* I suppose the above could be put into a union, but we */ - /* wouldn't save all that much space. */ -}; - -#define FONT_IN_USE 1 /* used for housekeeping */ -#define FONT_LOADED 2 /* if font file has been read */ -#define FONT_VIRTUAL 4 /* if font is virtual */ - -#define TNTABLELEN 30 /* length of TeXnumber array (dvi file) */ -#define VFTABLELEN 5 /* length of TeXnumber array (virtual fonts) */ - -struct tn { - struct tn *next; /* link to next TeXnumber info block */ - int TeXnumber; /* font number (in DVI file) */ - struct font *fontp; /* pointer to the rest of the info */ -}; - -struct font *tn_table[TNTABLELEN]; -struct font *font_head = NULL; -struct tn *tn_head = NULL; -ubyte maxchar; -unsigned short current_timestamp = 0; /* * Command line flags. @@ -384,19 +213,6 @@ XColor color_data[2]; #define back_color_data color_data[1] -struct rgb { - unsigned short r, g, b; -}; - -struct pagecolor { - struct rgb bg; - unsigned int stacksize; - const struct rgb *colorstack; -}; - -/* Information on background color and initial color stack for each page. */ -struct pagecolor *page_colors = NULL; - /* The initial color stack is gotten from the pagecolor record for a page. */ const struct rgb *color_bottom; unsigned int color_bot_size; /* number of entries */ @@ -475,9 +291,6 @@ char *dvi_name = NULL; /* dvi file name */ FILE *dvi_file; /* user's file */ Boolean dvi_file_ready = False; /* done with font generation and prescanning */ -ino_t dvi_inode; /* used for source specials */ -unsigned char *dvi_property; /* for setting in window */ -size_t dvi_property_length; Boolean titles_are_stale = True; /* replace icon/window titles */ const char *prog; @@ -503,114 +316,16 @@ Boolean copy; Cursor redraw_cursor, ready_cursor, drag_cursor[3]; -struct xdvi_action { - struct xdvi_action *next; - XtActionProc proc; - Cardinal num_params; - String param; -}; - -struct wheel_acts { - struct wheel_acts *next; - Modifiers mask; - Modifiers value; - struct _LateBindings *late_bindings; - unsigned int button; - struct xdvi_action *action; -}; - -struct wheel_acts *wheel_actions; - - Pixel *pixeltbl; Pixel *pixeltbl_t; -/* - * Flag values and masks for event_flags - */ - -#define EV_IDLE (1<<0) /* non-event */ -#define EV_CURSOR (1<<1) /* cursor needs to revert back to ready */ -#define EV_EXPOSE (1<<2) /* expose occurred somewhere */ -#define EV_MAG_MOVE (1<<3) /* magnifier moved */ -#define EV_MAG_GONE (1<<4) /* magnifier gone while being drawn */ -#define EV_ACK (1<<5) /* used internally */ -#define EV_NEWPAGE (1<<7) /* new page requested */ -#define EV_PS_TOGGLE (1<<8) /* PostScript toggled on or off */ -#define EV_NEWDOC (1<<9) /* new dvi file requested */ -#define EV_TERM (1<<10) /* quit */ -#define EV_MAXPLUS1 (1<<11) - -#define EV_GE_IDLE (EV_MAXPLUS1 - EV_IDLE) -#define EV_GT_IDLE (EV_MAXPLUS1 - EV_CURSOR) -#define EV_GE_CURSOR (EV_MAXPLUS1 - EV_CURSOR) -#define EV_GE_EXPOSE (EV_MAXPLUS1 - EV_EXPOSE) -#define EV_GE_MAG_MOVE (EV_MAXPLUS1 - EV_MAG_MOVE) -#define EV_GE_MAG_GONE (EV_MAXPLUS1 - EV_MAG_GONE) -#define EV_GE_ACK (EV_MAXPLUS1 - EV_ACK) -#define EV_GE_NEWPAGE (EV_MAXPLUS1 - EV_NEWPAGE) -#define EV_GE_PS_TOGGLE (EV_MAXPLUS1 - EV_PS_TOGGLE) -#define EV_GE_NEWDOC (EV_MAXPLUS1 - EV_NEWDOC) -#define EV_GE_TERM (EV_MAXPLUS1 - EV_TERM) - -#define EV_NOWAIT EV_GE_IDLE - -unsigned int ev_flags = EV_IDLE; -volatile int event_counter = 0; -jmp_buf canit_env; - -struct xchild { - struct xchild *next; /* link to next in list */ - pid_t pid; /* pid of process, or 0 */ - Boolean killable; /* if can be killed with SIGKILL */ - void (*proc)(int); /* procedure to call */ -}; - -struct xio { - struct xio *next; /* link to next in list */ - int fd; /* file descriptor */ - int xio_events; /* same as in struct pollfd (can't call - it events because poll.h on AIX - defines events to something else) */ - struct pollfd *pfd; - void (*read_proc)(void); /* call to read */ - void (*write_proc)(void); /* call to write */ -}; - -struct xtimer { - struct xtimer *next; /* link to next in chain */ - struct timeval when; /* when to call the routine */ - void (*proc)(struct xtimer *); /* procedure to call */ -#if MOTIF_TIMERS - XtTimerCallbackProc xt_proc; /* additional data for Xm */ - XtPointer closure; -#endif -}; - -# define TIMER_INIT(proc) {NULL, {0, 0}, proc} - -struct WindowRec { - Window win; - int shrinkfactor; - int base_x, base_y; - unsigned int width, height; - int min_x, max_x, min_y, max_y; /* for pending expose events */ -}; - -extern struct WindowRec mane, alt, currwin; int min_x, max_x, min_y, max_y; Boolean drawing_mag = False; -#define shrink_factor currwin.shrinkfactor - Widget top_level = 0; Widget vport_widget, draw_widget, clip_widget; Widget addr_widget, form_widget; -#define WARN(t, s) (void) warning_popup(s, "OK", NULL) -#define WARN1(t, s, s1) (void) warning_popup_long(s, "OK", NULL, s1) -#define WARN2(t, s, s1, s2) (void) warning_popup_long(s, "OK", NULL, s1, s2) - /* * If a popup is popped up before the main window, then the main window is * likely to cover it. So we have to postpone popping them up until after @@ -623,179 +338,13 @@ size_t n_init_popups = 0; Widget *init_popups; size_t alloc_init_popups = 0; -/* - * Structure to use for status popups. - */ - -struct status_popup { - Widget shell; - Widget label; - int expected_type; - Boolean popped; - Boolean spurious; -}; - char *ffline = NULL; /* an array used by filefind to store */ /* the file name being formed. */ /* It expands as needed. */ /* Also used elsewhere. */ size_t ffline_len = 0; /* current length of ffline[] */ -/* - * AVL tree structures. - */ - -#define AVL_COMMON \ - const char *key; /* key */ \ - int key_len; /* length of key */ \ - int bal; /* AVL balancing information */ \ - struct avl *left; \ - struct avl *right - -struct avl { /* generic data structure */ - AVL_COMMON; -}; - - /* Data structure for Type 1 fonts -- contents of psfonts.map */ -struct avl_t1 { - AVL_COMMON; - const char *psname; /* PS name of font */ - const char *fontfile; /* (short) name of pfa/pfb file */ - const char *encname; /* (short) name of encoding file */ - const char *addinfo; /* additional PS instructions */ - Boolean bad; /* if later found to be unloadable */ - struct ftfont *ft; /* pointer to FreeType record */ -}; - - - -struct ftfont { /* info for FreeType font (Type 1 or TrueType) */ - FT_Face face; /* NULL means not loaded yet */ - struct font *first_size; - struct avl_t1 *t1; - /* struct avl_tt *tt; */ - struct FT_StreamRec_ stream; - struct avl_enc *enc; /* pointer to encoding record */ - double expn; /* expansion factor */ -}; - - -struct avl_enc { - AVL_COMMON; - Boolean valid; - const char *vec[256]; -}; - - - -/* - * Used by the geometry-scanning routines. - * It passes pointers to routines to be called at certain - * points in the dvi file, and other information. - */ - -struct geom_info { - void (*geom_box) (struct geom_info *, long, long, long, long); - void (*geom_special) (struct geom_info *, const char *); - jmp_buf done_env; - void *geom_data; -}; - -typedef void (*mouse_proc) (XEvent *); -extern void null_mouse (XEvent *); - -mouse_proc mouse_motion = null_mouse; -mouse_proc mouse_release = null_mouse; - -/* Used for source special lookup (forward search) and for window manager - delete protocol (toolkit only). */ - -Atom atoms[5]; - -#define XA_WM_DELETE_WINDOW (atoms[3]) -#define XA_WM_PROTOCOLS (atoms[4]) - -/******************************** - * Procedures * - *******************************/ - -_XFUNCPROTOBEGIN extern int atopix(const char *, Boolean); -extern Bool compile_action(const char *, struct xdvi_action **); -extern void init_plane_masks(void); -extern Pixel alloc_color(const struct rgb *, Pixel); -extern void do_color_change(void); -extern void expose(struct WindowRec *, int, int, unsigned int, - unsigned int); -extern void home(Boolean); -extern void reconfig(void); -extern void handle_resize(Widget, XtPointer, XEvent *, Boolean *); -extern void handle_expose(Widget, XtPointer, XEvent *, Boolean *); -extern void handle_messages(Widget, XtPointer, XEvent *, Boolean *); -extern void goto_page(int, home_proc); -extern void set_chld(struct xchild *); -extern void clear_chld(struct xchild *); -extern void set_io(struct xio *); -extern void clear_io(struct xio *); -extern void set_timer(struct xtimer *, int); -extern void cancel_timer(struct xtimer *); -extern unsigned int read_events(unsigned int); -extern void enable_intr(void); -extern void do_pages(void) NORETURN; -extern void simple_popup(struct status_popup *, const char *, - XtCallbackProc); -extern void simple_popdown(struct status_popup *); -extern void do_popup(Widget); -extern Widget warning_popup(const char *, const char *, XtCallbackProc); -extern Widget warning_popup_long(const char *, const char *, - XtCallbackProc, ...); -extern void Act_print(Widget, XEvent *, String *, Cardinal *); -extern void reset_fonts(void); -extern void reset_colors(void); -extern void full_reset_colors(void); -extern void realloc_font(struct font *, wide_ubyte); -extern void realloc_virtual_font(struct font *, wide_ubyte); -extern Boolean load_font(struct font *); -extern struct font *define_font(FILE *, wide_ubyte, - struct font *, struct font **, unsigned int, - struct tn **); -extern void init_page(void); -extern void form_dvi_property(ino_t); -extern void init_dvi_file(void); -extern Boolean check_dvi_file(void); -extern void reload_dvi_file(void); -#ifndef TEXXET -extern long set_char(wide_ubyte); -extern long load_n_set_char(wide_ubyte); -extern long set_vf_char(wide_ubyte); -extern long set_ft_char(wide_ubyte); -#else -extern void set_char(wide_ubyte, wide_ubyte); -extern void load_n_set_char(wide_ubyte, wide_ubyte); -extern void set_vf_char(wide_ubyte, wide_ubyte); -extern void set_ft_char(wide_ubyte, wide_ubyte); -#endif -extern void open_font_file(struct font *); -extern void prescan(void); -extern void draw_page(void); -extern FILE *open_t1_font(struct avl_t1 *, const char **); -extern void read_encoding(struct avl_enc *); -extern void init_font_open(void); -extern Boolean font_open(struct font *, char **, int *); -extern void init_prescan(void); -extern void scan_color_eop(void); -extern void set_fg_color(const struct rgb *); -extern void applicationDoSpecial(char *); -extern void scan_special(char *); -extern void geom_do_special(struct geom_info *, char *, double); -extern void alloc_bitmap(struct bitmap *); -extern struct avl *avladd(const char *, size_t, struct avl **, size_t); -extern void read_PK_index(struct font *, Boolean); -extern void read_GF_index(struct font *, Boolean); -extern void read_VF_index(struct font *, Boolean); -extern Boolean load_ft_font(struct font *); - -_XFUNCPROTOEND #endif /* XDVI_H */