wdvi

network DVI viewer
Log | Files | Refs

commit fd39d9399c28dae3f14dbccd6aa38942e2e7147a
parent 9f1d501e1b83ea7aaa950cbcd30796ddc34b4e82
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Thu,  9 Mar 2023 22:49:24 +0000

untypedef ubyte and wide_ubyte

Diffstat:
Mdvi-draw.c | 60++++++++++++++++++++++++++++++------------------------------
Mdvi-init.c | 18+++++++++---------
Mft.c | 2+-
Mpk.c | 2+-
Mvf.c | 4++--
Mxdvi.h | 3---
6 files changed, 43 insertions(+), 46 deletions(-)

diff --git a/dvi-draw.c b/dvi-draw.c @@ -44,7 +44,7 @@ NOTE: static struct frame frame0; /* dummy head of list */ #define DVI_BUFFER_LEN 512 -static ubyte dvi_buffer[DVI_BUFFER_LEN]; +static unsigned char dvi_buffer[DVI_BUFFER_LEN]; static struct frame *current_frame; /* Points to drawinf record containing current dvi file location (for update by @@ -176,7 +176,7 @@ put_image(struct glyph *g, int x, int y) * Byte reading routines for dvi file. */ -static ubyte +static unsigned char xxone() { if (currinf.virtual) { @@ -192,7 +192,7 @@ xxone() #define xone() (currinf.pos < currinf.end ? *(currinf.pos)++ : xxone()) static unsigned long -xnum(ubyte size) +xnum(unsigned char size) { long x = 0; @@ -201,7 +201,7 @@ xnum(ubyte size) } static long -xsnum(ubyte size) +xsnum(unsigned char size) { long x; @@ -269,7 +269,7 @@ print_bitmap(struct bitmap *bitmap) } static void -print_char(ubyte ch, struct glyph *g) +print_char(unsigned char ch, struct glyph *g) { printf("char %d", ch); if (isprint(ch)) @@ -293,12 +293,12 @@ static const char *dvi_table2[] = { "SREFL", "EREFL", NULL, NULL, NULL, NULL}; static void -print_dvi(ubyte ch) +print_dvi(unsigned char ch) { const char *s; printf("%4d %4d ", PXL_H, PXL_V); - if (ch <= (ubyte) (SETCHAR0 + 127)) { + if (ch <= (unsigned char) (SETCHAR0 + 127)) { printf("SETCHAR%-3d", ch - SETCHAR0); if (isprint(ch)) printf(" (%c)", ch); @@ -307,7 +307,7 @@ print_dvi(ubyte ch) } else if (ch < FNTNUM0) s = dvi_table1[ch - 128]; - else if (ch <= (ubyte) (FNTNUM0 + 63)) { + else if (ch <= (unsigned char) (FNTNUM0 + 63)) { printf("FNTNUM%d\n", ch - FNTNUM0); return; } @@ -563,7 +563,7 @@ read_special(long nbytes) #define M5 251 #define MM 251 -static ubyte scantable[256] = { +static unsigned char scantable[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* chars 0 - 127 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -596,8 +596,8 @@ static ubyte scantable[256] = { static void spcl_scan(void (*spcl_proc)(char *)) { - ubyte ch; - ubyte n; + unsigned char ch; + unsigned char n; long a; for (;;) { @@ -685,7 +685,7 @@ prescan(void) */ long -set_char(wide_ubyte ch) +set_char(unsigned char ch) { struct glyph *g; @@ -707,7 +707,7 @@ set_char(wide_ubyte ch) err(1, "fseek"); } (*currinf.fontp->read_char)(currinf.fontp, ch); - if (debug & DBG_BITMAP) print_char((ubyte) ch, g); + if (debug & DBG_BITMAP) print_char((unsigned char) ch, g); currinf.fontp->timestamp = ++current_timestamp; } @@ -727,14 +727,14 @@ set_char(wide_ubyte ch) static long -set_empty_char(wide_ubyte ch) +set_empty_char(unsigned char ch) { return 0; } long -load_n_set_char(wide_ubyte ch) +load_n_set_char(unsigned char ch) { if (!load_font(currinf.fontp)) { /* if not found */ warnx("Character(s) will be left blank."); @@ -748,12 +748,12 @@ load_n_set_char(wide_ubyte ch) long -set_vf_char(wide_ubyte ch) +set_vf_char(unsigned char ch) { struct macro *m; struct drawinf oldinfo; - ubyte oldmaxchar; - static ubyte c; + unsigned char oldmaxchar; + static unsigned char c; if (ch > maxchar) realloc_virtual_font(currinf.fontp, ch); if ((m = &currinf.fontp->macro[ch])->pos == NULL) { @@ -847,7 +847,7 @@ do_load_freetype_font(void) } long -set_ft_char(wide_ubyte ch) +set_ft_char(unsigned char ch) { do_load_freetype_font(); @@ -857,7 +857,7 @@ set_ft_char(wide_ubyte ch) static long -set_no_char(wide_ubyte ch) +set_no_char(unsigned char ch) { if (currinf.virtual) { currinf.fontp = currinf.virtual->first_font; @@ -892,7 +892,7 @@ set_rule(int h, int w) static void draw_part(struct frame *minframe, double current_dimconv) { - ubyte ch; + unsigned char ch; currinf.fontp = NULL; currinf.set_char_p = set_no_char; @@ -900,9 +900,9 @@ draw_part(struct frame *minframe, double current_dimconv) ch = xone(); if (debug & DBG_DVI) print_dvi(ch); - if (ch <= (ubyte) (SETCHAR0 + 127)) + if (ch <= (unsigned char) (SETCHAR0 + 127)) DVI_H += (*currinf.set_char_p)(ch); - else if (FNTNUM0 <= ch && ch <= (ubyte) (FNTNUM0 + 63)) + else if (FNTNUM0 <= ch && ch <= (unsigned char) (FNTNUM0 + 63)) change_font((unsigned long) (ch - FNTNUM0)); else { long a, b; @@ -1158,7 +1158,7 @@ static void geom_scan_part(struct geom_info *, static long geom_do_char(g_info, ch) struct geom_info *g_info; - wide_ubyte ch; + unsigned char ch; { if (currinf.set_char_p == set_no_char) { if (currinf.virtual == NULL @@ -1206,7 +1206,7 @@ geom_do_char(g_info, ch) err(1, "fseek"); } (*currinf.fontp->read_char)(currinf.fontp, ch); - if (debug & DBG_BITMAP) print_char((ubyte) ch, g); + if (debug & DBG_BITMAP) print_char((unsigned char) ch, g); currinf.fontp->timestamp = ++current_timestamp; } x = G_PXL_H - g->x; @@ -1219,7 +1219,7 @@ geom_do_char(g_info, ch) else if (currinf.set_char_p == set_vf_char) { struct macro *m; struct drawinf oldinfo; - ubyte oldmaxchar; + unsigned char oldmaxchar; if (ch > maxchar) return 0; /* catch the error later */ @@ -1279,15 +1279,15 @@ geom_scan_part(g_info, minframe, current_dimconv) struct frame *minframe; double current_dimconv; { - ubyte ch; + unsigned char ch; currinf.fontp = NULL; currinf.set_char_p = set_no_char; for (;;) { ch = xone(); - if (ch <= (ubyte) (SETCHAR0 + 127)) + if (ch <= (unsigned char) (SETCHAR0 + 127)) DVI_H += geom_do_char(g_info, ch); - else if (FNTNUM0 <= ch && ch <= (ubyte) (FNTNUM0 + 63)) + else if (FNTNUM0 <= ch && ch <= (unsigned char) (FNTNUM0 + 63)) change_font((unsigned long) (ch - FNTNUM0)); else { long a, b; @@ -1456,7 +1456,7 @@ geom_scan(g_info) { off_t pos_save; struct drawinf currinf_save; - ubyte maxchar_save; + unsigned char maxchar_save; if (dvi_pointer_frame != NULL) pos_save = ftell(dvi_file) - diff --git a/dvi-init.c b/dvi-init.c @@ -180,7 +180,7 @@ full_reset_colors(void) */ void -realloc_font(struct font *fontp, wide_ubyte newsize) +realloc_font(struct font *fontp, unsigned char newsize) { struct glyph *glyph; @@ -198,7 +198,7 @@ realloc_font(struct font *fontp, wide_ubyte newsize) */ void -realloc_virtual_font(struct font *fontp, wide_ubyte newsize) +realloc_virtual_font(struct font *fontp, unsigned char newsize) { struct macro *macro; @@ -355,7 +355,7 @@ reuse_font(struct font *fontp) * tn_headpp; addr of head of list of TeXnumbers */ struct font * -define_font(FILE *file, wide_ubyte cmnd, struct font *vfparent, +define_font(FILE *file, unsigned char cmnd, struct font *vfparent, struct font **tntable, unsigned int tn_table_len, struct tn **tn_headpp) { @@ -478,7 +478,7 @@ dvi_magic_ok(FILE *dvi) static Boolean process_preamble(void) { - ubyte k; + unsigned char k; if (dvi_magic_ok(dvi_file) == False) return False; @@ -505,10 +505,10 @@ static Boolean find_postamble(void) { long pos; - ubyte temp[TMPSIZ]; - ubyte *p; - ubyte *p1; - ubyte byte; + unsigned char temp[TMPSIZ]; + unsigned char *p; + unsigned char *p1; + unsigned char byte; if (fseek(dvi_file, 0, SEEK_END) != 0) err(1, "fseek"); @@ -555,7 +555,7 @@ find_postamble(void) static Boolean read_postamble(void) { - ubyte cmnd; + unsigned char cmnd; struct font *fontp; struct font **fontpp; diff --git a/ft.c b/ft.c @@ -110,7 +110,7 @@ xdvi_stream_close(stream) */ static void -read_ft_char(struct font *fontp, wide_ubyte ch) +read_ft_char(struct font *fontp, unsigned char ch) { struct glyph *g; FT_Face face; diff --git a/pk.c b/pk.c @@ -139,7 +139,7 @@ PK_skip_specials(fontp) */ static void -read_PK_char(struct font *fontp, wide_ubyte ch) +read_PK_char(struct font *fontp, unsigned char ch) { int i, j; int n; diff --git a/vf.c b/vf.c @@ -58,8 +58,8 @@ void read_VF_index(struct font *fontp, Boolean hushcs) { FILE *VF_file = fontp->file; - ubyte cmnd; - ubyte *avail, *availend; /* available space for macros */ + unsigned char cmnd; + unsigned char *avail, *availend; /* available space for macros */ long checksum; fontp->read_char = NULL; diff --git a/xdvi.h b/xdvi.h @@ -51,9 +51,6 @@ static const char addr_default[] = "https://www.0x30.net/index.dvi"; #define MAXDIM 32767 -typedef unsigned char ubyte; -typedef ubyte wide_ubyte; - int current_page; int total_pages; int pageno_correct = 1;