X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctgraphics%2Fpol.cpp;h=035f323a106b39d3e3c716e65ff4e982a5760945;hp=9db01ce1c7b7797403882c6fe5e91eaadc81f2e0;hb=01ee1e0085970643368d65c38b09008927e24cd5;hpb=081b06d3a3372e5db56755c1fe5b2af9f8c189f3 diff --git a/libctgraphics/pol.cpp b/libctgraphics/pol.cpp index 9db01ce..035f323 100644 --- a/libctgraphics/pol.cpp +++ b/libctgraphics/pol.cpp @@ -6,7 +6,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: pol.cpp,v 1.1 2000/07/30 15:58:18 kevin Exp $ +** $Id: pol.cpp,v 1.3 2000/12/04 05:36:57 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -24,6 +24,7 @@ /* */ /*----------------------------------------------------------------------*/ +#include "ct.h" #include #include #include @@ -125,13 +126,8 @@ static void freetable(SYMBOL *table[]); static int hash(char *s); static SYMBOL *lookup(SYMBOL *table[], char *s); static SYMBOL *install(SYMBOL *table[], char *s, int def); -static void outch(int c); -static void inc_line(void); -static int getlinect(void); -static void setlinect(int n); static void synerr(char *msg); static int pol_getch(FILE *fp); -static void ungets(char *s); void pol_init (void) @@ -171,7 +167,7 @@ void pol_skpword (char *w) { if (install (skiptable, w, 0) == NULL) - synerr ("Too many skip words defined"); + sys_error (ERR_SEVERE, "Too many skip words defined"); } /* pol_skpchar (s) @@ -979,42 +975,14 @@ install (SYMBOL *table[], char *name, int def) static int currentf = -1; /* pointer to current fp */ static FILE *filep[MAXFILE]; /* == NULL for string input */ static char *fname[MAXFILE]; /* pointer to filename */ -static int linect[MAXFILE]; /* line count in file */ static char inputline[MAXLINE]; /* current input line */ static int lineptr; /* current position in inputline */ -static void -outch (int c) -{ - putchar (c); -} - - -static void inc_line(void) -{ - if (currentf >= 0) - ++linect[currentf]; -} - -static int getlinect(void) -{ - return (linect[currentf]); -} - -static void -setlinect (int n) -{ - if (currentf >= 0) - linect[currentf] = n; -} - static void synerr (char *msg) { fputs (fname[currentf], stderr); - fprintf(stderr, "%d", linect[currentf]); - fputc (COLON, stderr); fputs (msg, stderr); fputc (NEWLINE, stderr); } @@ -1051,7 +1019,6 @@ pol_usefile (int source, char *fn) if (source == P_USE_STR) { filep[currentf] = NULL; - linect[currentf] = 1; } else if (source == P_USE_FILE) { if (fn == NULL || strlen(fn) == 0) { fp = stdin; @@ -1061,7 +1028,6 @@ pol_usefile (int source, char *fn) return; } filep[currentf] = fp; - linect[currentf] = 1; fname[currentf] = strdup (fn); } } @@ -1140,16 +1106,6 @@ pol_ungetch (int c) } -/* push back string onto input */ -static void -ungets (char *s) -{ - int i; - - for (i = strlen(s) - 1; i >= 0; i--) - pol_ungetch (s[i]); -} - int get_inputline (FILE *fp) {