wdvi

network DVI viewer
Log | Files | Refs

commit 716dad659bfa8a2177e9697737365c87b8577f6e
parent 247c998c799f9380ca46d140cb801cec8d7fad67
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Sat, 18 Sep 2021 20:40:07 +0000

whitespace fixes

Diffstat:
Mspecial.c | 88++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mspecial.h | 1+
2 files changed, 46 insertions(+), 43 deletions(-)

diff --git a/special.c b/special.c @@ -53,11 +53,12 @@ NOTE: * it's worth it. */ +#include <ctype.h> #include <err.h> #include <limits.h> /* abs() */ -#include <math.h> -#include <ctype.h> +#include <math.h> /* sqrt(), sin(), cos() */ #include <stdlib.h> /* abs() */ +#include <string.h> /* memcmp() */ #include "dvi-init.h" /* page_info */ #include "dvi-draw.h" /* PXL_V, PXL_H */ @@ -1120,54 +1121,56 @@ void applicationDoSpecial(char *cp) { if (debug & DBG_DVI) - printf(" `%s'\n", cp); + printf(" `%s'\n", cp); /* Skip white space */ while (isspace(*cp)) ++cp; /* Ignore initial "xdvi:" */ if (memcmp(cp, "xdvi:", 5) == 0) { - cp += 5; - while (isspace(*cp)) ++cp; + cp += 5; + while (isspace(*cp)) + ++cp; } if (memicmp(cp, "color ", 6) == 0) { - color_special(cp + 6); - return; + color_special(cp + 6); + return; } /* these should have been scanned */ - if (*cp == '!' - || (memicmp(cp, "header", 6) == 0 && endofcommand(cp + 6) != NULL)) { - return; + if (*cp == '!' || + (memicmp(cp, "header", 6) == 0 && endofcommand(cp + 6) != NULL)) { + return; } if (memicmp(cp, "background ", 11) == 0) { - if (resource._use_color && scanned_page_reset >= 0) { - /* turn on scanning and redraw the page */ - scanned_page = - scanned_page_color = scanned_page_reset = -1; - ev_flags |= EV_NEWPAGE; /* force a redraw */ - } - return; + if (resource._use_color && scanned_page_reset >= 0) { + /* turn on scanning and redraw the page */ + scanned_page = scanned_page_color = + scanned_page_reset = -1; + ev_flags |= EV_NEWPAGE; /* force a redraw */ + } + return; } if (memcmp(cp, "papersize", 9) == 0 && endofcommand(cp + 9) != NULL) { - if (scanned_page_reset >= 0) { - /* turn on scanning and redraw the page */ - scanned_page = - scanned_page_color = - scanned_page_reset = -1; - ev_flags |= EV_NEWPAGE; /* force a redraw */ - } - return; + if (scanned_page_reset >= 0) { + /* turn on scanning and redraw the page */ + scanned_page = scanned_page_color = + scanned_page_reset = -1; + ev_flags |= EV_NEWPAGE; /* force a redraw */ + } + return; } /* tpic specials */ if (*cp >= 'a' && *cp <= 'z' && cp[1] >= 'a' && cp[1] <= 'z' && (isspace(cp[2]) || cp[2] == '\0')) { + +#define CMD(x, y) ((x) << 8 | (y)) switch (CMD(*cp, cp[1])) { case CMD('p','n'): set_pen_size(cp + 2); return; case CMD('f','p'): flush_path(); return; @@ -1183,48 +1186,47 @@ applicationDoSpecial(char *cp) case CMD('i','p'): /* throw away the path -- jansteen */ path_len = 0; return; } +#undef CMD } - if (warn_spec_now && memcmp(cp, "src:", 4) != 0) + /* We support hypertex */ + if (memicmp(cp, "html: ", 5) == 0) + return; + + if (warn_spec_now) warnx("special '%s' not implemented", cp); } -#undef CMD - void -scan_special(cp) - char *cp; +scan_special(char *cp) { char *p; if (debug & DBG_PS) - printf("Scanning special `%s'.\n", cp); + printf("Scanning special `%s'.\n", cp); /* Skip white space */ while (isspace(*cp)) ++cp; /* Ignore initial "xdvi:" */ if (memcmp(cp, "xdvi:", 5) == 0) { - cp += 5; - while (isspace(*cp)) ++cp; + cp += 5; + while (isspace(*cp)) ++cp; } - - { - if (memicmp(cp, "background ", 11) == 0) { + if (memicmp(cp, "background ", 11) == 0) { scan_bg_color(cp); return; - } - else if (memicmp(cp, "color ", 6) == 0) { + } + else if (memicmp(cp, "color ", 6) == 0) { scan_color(cp); return; - } } - if (memcmp(cp, "papersize", 9) == 0 - && (p = endofcommand(cp + 9)) != NULL) { - scan_papersize(p); - return; + if (memcmp(cp, "papersize", 9) == 0 && + (p = endofcommand(cp + 9)) != NULL) { + scan_papersize(p); + return; } } diff --git a/special.h b/special.h @@ -1,5 +1,6 @@ #include "data.h" /* struct rgb */ + struct pagecolor { struct rgb bg; unsigned int stacksize;