X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctgraphics%2Fpol.cpp;h=22741e3938df85c0de739eabe38460ea2d40e402;hp=9c0e4278b61b951e7490d9c9e0981eaddcaccfed;hb=c00c639073653fac7463a88f2b000f263236550d;hpb=23b7ef994fc5d95fcca6d4ae69abbd5971101262 diff --git a/libctgraphics/pol.cpp b/libctgraphics/pol.cpp index 9c0e427..22741e3 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.8 2000/12/29 15:45:06 kevin Exp $ +** $Id: pol.cpp,v 1.9 2001/01/02 16:02:13 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 @@ -22,7 +22,7 @@ ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ******************************************************************************/ -#include "ct.h" +#include "ct.h" #include #include #include @@ -50,11 +50,11 @@ const struct POL::KeywordCodeList POL::cmdlist[] = { }; const unsigned int POL::NUMCMD = (sizeof(POL::cmdlist) / sizeof (struct POL::KeywordCodeList)); - + POL::POL() { - currentf = -1; + currentf = -1; m_bTrace = false; init(); } @@ -76,7 +76,7 @@ POL::init () meta.ter = PERCENT; meta.inb = LBRACK; - m_bNewlineIsEOC = true; + m_bNewlineIsEOC = true; m_szSkipChars[0] = EOS; @@ -85,7 +85,7 @@ POL::init () token.ready = false; // no token read yet } - + /* addSkipWord (w) * @@ -107,11 +107,11 @@ POL::addSkipWord (const char* const w) */ void POL::addSkipChar (int c) -{ - int n = strlen (m_szSkipChars); - if (n < MAXSKIPCHAR) { - m_szSkipChars[n] = c; - m_szSkipChars[n+1] = 0; +{ + int n = strlen (m_szSkipChars); + if (n < MAXSKIPCHAR) { + m_szSkipChars[n] = c; + m_szSkipChars[n+1] = 0; } } @@ -122,7 +122,7 @@ POL::addSkipChar (int c) // // tok() looks for these user defined tokens. If it finds one, // it stores the tokens code in the token structure and returns TT_USERTOK -void +void POL::addKeyword (const char* const str, int code) { usertable.installKeywordCode (str, code); @@ -228,7 +228,7 @@ POL::readInteger (int *n, int typecode, bool boundcode, int bb1, int bb2) return (false); } -bool +bool POL::readFloat (double *n, double typecode, bool boundcode, double bb1, double bb2) { tok (&token); @@ -275,7 +275,7 @@ POL::skipTokens() return (skipSingleToken (term)); } -void +void POL::reader() { while (skipTokens()) @@ -621,7 +621,7 @@ POL::getescape ( /* reads up to delim */ } s[i] = EOS; } - + bool POL::readText (char *str, int lim) @@ -630,17 +630,17 @@ POL::readText (char *str, int lim) while ((c = inchar()) == BLANK || c == TAB) ; ungetch (c); - if (c == EOF) { - str[0] = 0; - return false; - } - + if (c == EOF) { + str[0] = 0; + return false; + } + int i; for (i = 0; i < lim && (c = inchar()) != EOF && c != NEWLINE; i++) str[i] = c; ungetch (c); - str[i] = 0; - + str[i] = 0; + return true; } @@ -831,9 +831,9 @@ POL::usefile (int source, char *fn) sys_error (ERR_SEVERE, "files nested too deeply"); return; } - - while (! m_stackPushBackInput.empty()) - m_stackPushBackInput.pop(); + + while (! m_stackPushBackInput.empty()) + m_stackPushBackInput.pop(); if (source == P_USE_STR) { filep[currentf] = NULL; @@ -898,12 +898,12 @@ POL::inchar() int POL::getch (FILE *fp) { - int c; - if (m_stackPushBackInput.size() > 0) { - c = m_stackPushBackInput.top(); - m_stackPushBackInput.pop(); - return c; - } + int c; + if (m_stackPushBackInput.size() > 0) { + c = m_stackPushBackInput.top(); + m_stackPushBackInput.pop(); + return c; + } if (fp == NULL) { if ((c = inputline[lineptr]) == EOS) @@ -922,17 +922,17 @@ POL::getch (FILE *fp) void POL::ungetch (int c) { - m_stackPushBackInput.push (c); + m_stackPushBackInput.push (c); } int POL::get_inputline (FILE *fp) { - while (! m_stackPushBackInput.empty()) - m_stackPushBackInput.pop(); - - lineptr = 0; + while (! m_stackPushBackInput.empty()) + m_stackPushBackInput.pop(); + + lineptr = 0; if (fgets (inputline, MAXLINE, fp) == NULL) return (EOF); else @@ -942,9 +942,9 @@ POL::get_inputline (FILE *fp) void POL::set_inputline (const char* const line) { - while (! m_stackPushBackInput.empty()) - m_stackPushBackInput.pop(); - + while (! m_stackPushBackInput.empty()) + m_stackPushBackInput.pop(); + strncpy (inputline, line, MAXLINE); - lineptr = 0; + lineptr = 0; }