** 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.2 2000/07/31 14:48:35 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
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)
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)
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);
}
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;
return;
}
filep[currentf] = fp;
- linect[currentf] = 1;
fname[currentf] = strdup (fn);
}
}
}
-/* 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)
{