From df761d2b3cac3d347f4ef0f9f69e88d3bb66b2fa Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Wed, 27 Dec 2000 20:09:19 +0000 Subject: [PATCH 1/1] r316: c++ conversions to POL --- include/Makefile.am | 2 +- include/ctsupport.h | 3 +- include/hashtable.h | 87 +++ include/pol.h | 98 +-- libctgraphics/ezplot.cpp | 18 +- libctgraphics/ezset.cpp | 85 ++- libctgraphics/pol.cpp | 1458 +++++++++++++++++------------------- libctsupport/Makefile.am | 2 +- libctsupport/hashtable.cpp | 141 ++++ libctsupport/syserror.cpp | 5 +- msvc/ctsim/ctsim.plg | 53 +- 11 files changed, 1015 insertions(+), 937 deletions(-) create mode 100644 include/hashtable.h create mode 100644 libctsupport/hashtable.cpp diff --git a/include/Makefile.am b/include/Makefile.am index 97a27b5..bc6c111 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,4 +1,4 @@ -noinst_HEADERS=ct.h ezplot.h pol.h sgp.h array2d.h imagefile.h backprojectors.h mpiworld.h fnetorderstream.h phantom.h timer.h sstream_subst scanner.h projections.h ctsupport.h filter.h array2dfile.h trace.h transformmatrix.h procsignal.h reconstruct.h plotfile.h +noinst_HEADERS=ct.h ezplot.h pol.h sgp.h array2d.h imagefile.h backprojectors.h mpiworld.h fnetorderstream.h phantom.h timer.h sstream_subst scanner.h projections.h ctsupport.h filter.h array2dfile.h trace.h transformmatrix.h procsignal.h reconstruct.h plotfile.h hashtable.h diff --git a/include/ctsupport.h b/include/ctsupport.h index 460af41..55c25d5 100644 --- a/include/ctsupport.h +++ b/include/ctsupport.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctsupport.h,v 1.16 2000/12/21 03:40:58 kevin Exp $ +** $Id: ctsupport.h,v 1.17 2000/12/27 20:09:19 kevin Exp $ ** ** ** This program is free software; you can redistribute it and/or modify @@ -64,6 +64,7 @@ /*----------------------------------------------------------------------*/ +#define ERR_TRACE -1 #define ERR_WARNING 0 #define ERR_SEVERE 1 #define ERR_FATAL 2 diff --git a/include/hashtable.h b/include/hashtable.h new file mode 100644 index 0000000..0f97edf --- /dev/null +++ b/include/hashtable.h @@ -0,0 +1,87 @@ +/* FILE IDENTIFICATION +** +** File Name: hashtable.h +** Author: Kevin Rosenberg +** Purpose: Header file for hash table library +** Date Started: Dec. 2000 +** +** This is part of the CTSim program +** Copyright (C) 1983-2000 Kevin Rosenberg +** +** $Id: hashtable.h,v 1.1 2000/12/27 20:09:19 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 +** published by the Free Software Foundation. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +******************************************************************************/ + +#ifndef HASHTABLE_H +#define HASHTABLE_H + + +class KeywordCodeEntry +{ +private: + std::string m_strKeyword; + int m_iCode; + class KeywordCodeEntry *m_pNext; + + public: + + KeywordCodeEntry (const char* const pszKeyword, int iCode); + + const char* const getKeyword() const + { return m_strKeyword.c_str(); } + + bool matchesKeyword (const char* const pszMatch) const; + + int getCode () const + { return m_iCode; } + + void setCode (int iCode) + { m_iCode = iCode; } + + void setNext (KeywordCodeEntry* pNext) + { m_pNext = pNext; } + + KeywordCodeEntry* getNext () + { return m_pNext; } +}; + + +class KeywordCodeHashTable { +public: + enum { + HASHSIZE = 100, + }; + + KeywordCodeHashTable() + { initTable(); } + + ~KeywordCodeHashTable() + { freeTable(); } + + void installKeywordCode (const char* const pszKeyword, int iCode); + KeywordCodeEntry* lookup (const char* const pszKeyword); + +private: + KeywordCodeEntry* m_hashTable[HASHSIZE]; + + int hash (const char* s); + void initTable (); + void freeTable (); +}; + +#endif + + diff --git a/include/pol.h b/include/pol.h index 7ac7525..262cccb 100644 --- a/include/pol.h +++ b/include/pol.h @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: pol.h,v 1.7 2000/12/27 03:16:02 kevin Exp $ +** $Id: pol.h,v 1.8 2000/12/27 20:09:19 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 @@ -19,34 +19,36 @@ ******************************************************************************/ #ifndef __H_POL #define __H_POL - + +#include "hashtable.h" + class POL { public: - // codes for pol_usefile - enum { - P_USE_STR = 1, // use string as input source + // codes for pol_usefile + enum { + P_USE_STR = 1, // use string as input source P_USE_FILE, // use file as input source - }; + }; - POL(); + POL(); ~POL(); void init (); - void skpword (char *w); - void skpchar (char *s); - int installKeyword (char *str, int code); - int word (char *search, int nlet); - int usertok (char *str, int *code); - int string (char *str); - int integer (int *n, int typecode, int boundcode, int bb1, int bb2); - bool readfloat (double *n, double typecode, double boundcode, double bb1, double bb2); - int skip (); + void addSkipWord (const char const *w); + void addSkipChar (int c); + void addKeyword (const char* const str, int code); + bool readWord (char *search, int nlet); + bool readUserToken (char *str, int *code); + bool readString (char *str); + bool readInteger (int *n, int typecode, bool boundcode, int bb1, int bb2); + bool readFloat (double *n, double typecode, bool boundcode, double bb1, double bb2); + bool skipTokens (); void reader (); - void gettext (char *str, int lim); + bool readText (char *str, int lim); void usefile (int source, char *fn); void closefile (); int lookchar (); @@ -104,13 +106,6 @@ private: // typedef std::map KeywordCodeList; - struct symlist { - char *name; - int code; - struct symlist *next; - }; - typedef struct symlist SYMBOL; - struct token_st { int ready; // TRUE if token is ready // std::string tokstr; // token string @@ -121,17 +116,12 @@ private: int inum; // integer value of token }; typedef struct token_st TOKEN; - - struct token_st token; // current token - enum { - HASHSIZE = 100, - }; - + // Tables words stored with install() & found with lookup() - SYMBOL *skiptable[HASHSIZE]; // words to ignore and skip - SYMBOL *cmdtable[HASHSIZE]; // pol parameter commands - SYMBOL *usertable[HASHSIZE]; // user defined symbols + KeywordCodeHashTable skiptable; // words to ignore and skip + KeywordCodeHashTable cmdtable; // pol parameter commands + KeywordCodeHashTable usertable; // user defined symbols struct metachar { char eoc; /* end of command character */ @@ -146,14 +136,9 @@ private: } meta; - // current pol state - struct pol_st { - char skipchars[MAXSKIPCHAR]; // characters to skip - int nl_eoc; // TRUE if newline character ends a command - int trace; // TRUE if trace is on - }; - - struct pol_st pol; + char m_szSkipChars [MAXSKIPCHAR]; // characters to skip + bool m_bTrace; + bool m_bNewlineIsEOC; struct KeywordCodeList { char *keyword; @@ -161,7 +146,7 @@ private: }; static const struct KeywordCodeList cmdlist[]; - static const int NUMCMD; + static const unsigned int NUMCMD; // Internal codes for pol commands enum { @@ -199,27 +184,22 @@ private: int bp; // pointer to next free position int buf[BUFSIZE]; // pushed back input characters - int skiptok(char term[]); - int tok(struct token_st *token); - void dumptok(struct token_st *token); + bool skipSingleToken (char term[]); + int tok (struct token_st *token); + void dumptok (struct token_st *token); - int getpol_tok(struct token_st *token); - int getcmd(); + int getpol_tok (struct token_st *token); + int getcmd (); int gettok (TOKEN *tok); - void getblank(char *s, int toksiz); - int getalpha(char *s, int toksiz); - void getquote(char *qs, int toksiz); - void getescape(char *s, int delim, int toksiz); + void getblank (char *s, int toksiz); + int getalpha (char *s, int toksiz); + void getquote (char *qs, int toksiz); + void getescape (char *s, int delim, int toksiz); int getnumber (char str[], int strsize, double *fnum, int *inum); - void eatline(); - int type(int c); - void inittable(SYMBOL *table[]); - void freetable(SYMBOL *table[]); - int hash(char *s); - SYMBOL *lookup(SYMBOL *table[], char *s); - SYMBOL *install(SYMBOL *table[], char *s, int def); - int getch(FILE *fp); + void eatline (); + int type (int c); + int getch (FILE *fp); }; diff --git a/libctgraphics/ezplot.cpp b/libctgraphics/ezplot.cpp index 3831361..72f7e51 100644 --- a/libctgraphics/ezplot.cpp +++ b/libctgraphics/ezplot.cpp @@ -6,7 +6,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ezplot.cpp,v 1.24 2000/12/27 03:16:02 kevin Exp $ +** $Id: ezplot.cpp,v 1.25 2000/12/27 20:09:19 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 @@ -138,14 +138,14 @@ EZPlot::EZPlot (SGP& sgp) : rSGP (sgp) { initKeywords(); - m_pol.skpword ("please"); - m_pol.skpword ("use"); - m_pol.skpword ("are"); - m_pol.skpword ("and"); - m_pol.skpword ("is"); - m_pol.skpword ("the"); - m_pol.skpword ("equals"); - m_pol.skpchar ("="); + m_pol.addSkipWord ("please"); + m_pol.addSkipWord ("use"); + m_pol.addSkipWord ("are"); + m_pol.addSkipWord ("and"); + m_pol.addSkipWord ("is"); + m_pol.addSkipWord ("the"); + m_pol.addSkipWord ("equals"); + m_pol.addSkipChar ('='); m_pol.usefile (POL::P_USE_STR,""); m_pol.set_inputline ("!eoc ,"); diff --git a/libctgraphics/ezset.cpp b/libctgraphics/ezset.cpp index 6913144..718b250 100644 --- a/libctgraphics/ezset.cpp +++ b/libctgraphics/ezset.cpp @@ -6,7 +6,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ezset.cpp,v 1.13 2000/12/27 03:16:02 kevin Exp $ +** $Id: ezset.cpp,v 1.14 2000/12/27 20:09:19 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 @@ -49,7 +49,7 @@ EZPlot::ezcmd (const char* const comm) char str [POL::MAXTOK+1]; int code; bool retval = true; - if (! m_pol.usertok (str, &code)) { + if (! m_pol.readUserToken (str, &code)) { sys_error (ERR_WARNING, "Illegal EZSET command: %s", str); m_pol.reader(); retval = false; @@ -72,7 +72,7 @@ EZPlot::do_cmd (int lx) switch (lx) { case S_TEXTSIZE: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { if (f >= 0.0 && f <= 1.0) { v_textsize = f; s_textsize = TRUE; @@ -87,31 +87,31 @@ EZPlot::do_cmd (int lx) clearCurves (); break; case S_TITLE: - m_pol.gettext (strIn, sizeof(strIn)); + m_pol.readText (strIn, sizeof(strIn)); c_title = strIn; break; case S_LEGEND: - m_pol.gettext (strIn, sizeof(strIn)); + m_pol.readText (strIn, sizeof(strIn)); if (m_iCurrentCurve >= 0) setLegend (m_iCurrentCurve, strIn); break; case S_XLABEL: - m_pol.gettext (strIn, sizeof(strIn)); + m_pol.readText (strIn, sizeof(strIn)); c_xlabel = strIn; break; case S_YLABEL: - m_pol.gettext (strIn, sizeof(strIn)); + m_pol.readText (strIn, sizeof(strIn)); c_ylabel = strIn; break; case S_XCROSS: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { v_xcross = f; s_xcross = TRUE; } else s_xcross = FALSE; break; case S_YCROSS: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { v_ycross = f; s_ycross = TRUE; } else @@ -144,25 +144,25 @@ EZPlot::do_cmd (int lx) s_ymax = FALSE; break; case S_XMIN: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { v_xmin = f; s_xmin = TRUE; } break; case S_XMAX: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { v_xmax = f; s_xmax = TRUE; } break; case S_YMIN: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { v_ymin = f; s_ymin = TRUE; } break; case S_YMAX: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { v_ymax = f; s_ymax = TRUE; } @@ -173,7 +173,7 @@ EZPlot::do_cmd (int lx) case S_DASH: int ls; ls = SGP::LS_DASH1; - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { if (n == 1) ls = SGP::LS_DASH1; else if (n == 2) @@ -195,7 +195,7 @@ EZPlot::do_cmd (int lx) break; case S_PEN: case S_COLOR: - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { if (n >= 0) { if (m_iCurrentCurve < 0) @@ -219,47 +219,47 @@ EZPlot::do_cmd (int lx) o_grid = FALSE; break; case S_XLENGTH: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) if (f > 0.0 && f <= 1.0) o_xlength = f; break; case S_YLENGTH: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) if (f > 0.0 && f <= 1.0) o_ylength = f; break; case S_XPORIGIN: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) if (f >= 0.0 && f < 1.0) o_xporigin = f; break; case S_YPORIGIN: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) if (f >= 0.0 && f < 1.0) o_yporigin = f; break; case S_TAG: - if (m_pol.word("no", 2) == TRUE) + if (m_pol.readWord("no", 2) == TRUE) o_tag = FALSE; - else if (m_pol.word("off", 2) == TRUE) + else if (m_pol.readWord("off", 2) == TRUE) o_tag = FALSE; else o_tag = TRUE; break; case S_LEGENDBOX: - if (m_pol.word("inside", 2) == TRUE) + if (m_pol.readWord("inside", 2) == TRUE) o_legendbox = INSIDE; - else if (m_pol.word("outside", 3) == TRUE) + else if (m_pol.readWord("outside", 3) == TRUE) o_legendbox = OUTSIDE; - else if (m_pol.word("none",2) == TRUE) + else if (m_pol.readWord("none",2) == TRUE) o_legendbox = NOLEGEND; else { - m_pol.gettext (str, POL::MAXTOK); + m_pol.readText (str, POL::MAXTOK); bad_option(str); } break; case S_XLEGEND: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { if (f >= 0.0 && f < 1.0) { v_xlegend = f; @@ -270,7 +270,7 @@ EZPlot::do_cmd (int lx) } break; case S_YLEGEND: - if (m_pol.readfloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { if (f >= 0.0 && f < 1.0) { v_ylegend = f; @@ -281,7 +281,7 @@ EZPlot::do_cmd (int lx) } break; case S_SYMBOL: - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { if (n > 0 && n <= MAXSYMBOL) { if (m_iCurrentCurve < 0) o_symbol = n; @@ -289,8 +289,8 @@ EZPlot::do_cmd (int lx) setSymbol (m_iCurrentCurve, n); } } else { - if (m_pol.word("every",5) == TRUE) { - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { + if (m_pol.readWord("every",5) == TRUE) { + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { int sym = 1; if (n > 0) sym = n; @@ -299,22 +299,22 @@ EZPlot::do_cmd (int lx) else setSymbolFreq (m_iCurrentCurve, sym); } - } else if (m_pol.word ("none",4) == TRUE) { + } else if (m_pol.readWord ("none",4) == TRUE) { o_symbol = -1; } } break; case S_CURVE: - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { if (n > 0) m_iCurrentCurve = n - 1; } else { - if (m_pol.word ("all",3) == TRUE) + if (m_pol.readWord ("all",3) == TRUE) m_iCurrentCurve = -1; } break; case S_XTICKS: - if (m_pol.usertok(str,&lx) == FALSE) + if (m_pol.readUserToken(str,&lx) == FALSE) break; if (lx == S_ABOVE) o_xticks = ABOVE; @@ -325,16 +325,16 @@ EZPlot::do_cmd (int lx) else if (lx == S_LABEL) o_xtlabel = TRUE; else if (lx == S_MAJOR) { - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) if (n > 1 && n < 100) o_xmajortick = n; } else if (lx == S_MINOR) - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) if (n >= 0 && n < 100) o_xminortick = n; break; case S_YTICKS: - if (m_pol.usertok(str,&lx) == FALSE) + if (m_pol.readUserToken(str,&lx) == FALSE) break; if (lx == S_RIGHT) o_yticks = RIGHT; @@ -345,16 +345,16 @@ EZPlot::do_cmd (int lx) else if (lx == S_LABEL) o_ytlabel = TRUE; else if (lx == S_MAJOR) { - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) if (n > 1 && n < 100) o_ymajortick = n; } else if (lx == S_MINOR) - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) if (n >= 0 && n < 100) o_yminortick = n; break; case S_LXFRAC: - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { if (n >= 0) { v_lxfrac = n; s_lxfrac = TRUE; @@ -363,7 +363,7 @@ EZPlot::do_cmd (int lx) s_lxfrac = FALSE; break; case S_LYFRAC: - if (m_pol.integer (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { if (n >= 0) { v_lyfrac = n; s_lyfrac = TRUE; @@ -480,6 +480,5 @@ void EZPlot::initKeywords () { for (int i = 0; i < NKEYS; i++) - if (! m_pol.installKeyword (m_sKeywords[i].keyword, m_sKeywords [i].code)) - sys_error (ERR_SEVERE, "error installing ezset keywords [EZPlot::initKeywords]"); + m_pol.addKeyword (m_sKeywords[i].keyword, m_sKeywords [i].code); } diff --git a/libctgraphics/pol.cpp b/libctgraphics/pol.cpp index f3ef311..1d1a13a 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.6 2000/12/27 03:16:02 kevin Exp $ +** $Id: pol.cpp,v 1.7 2000/12/27 20:09:19 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 @@ -21,8 +21,6 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ******************************************************************************/ -/* */ -/*----------------------------------------------------------------------*/ #include "ct.h" #include @@ -32,9 +30,6 @@ #include "pol.h" - - - const struct POL::KeywordCodeList POL::cmdlist[] = { { "eoc", PC_EOC,}, { "str", PC_STR,}, @@ -45,7 +40,7 @@ const struct POL::KeywordCodeList POL::cmdlist[] = { { "out", PC_OUT,}, { "ter", PC_TER,}, { "inb", PC_INB,}, - + { "nl_eoc",PC_NL_EOC,}, { "nl_neoc", PC_NL_NEOC,}, { "tron", PC_TRON,}, @@ -54,13 +49,14 @@ const struct POL::KeywordCodeList POL::cmdlist[] = { { "dump", PC_DUMP,}, }; -const int POL::NUMCMD = (sizeof(POL::cmdlist) / sizeof (struct POL::KeywordCodeList)); +const unsigned int POL::NUMCMD = (sizeof(POL::cmdlist) / sizeof (struct POL::KeywordCodeList)); POL::POL() { bp = 0; - currentf = -1; + currentf = -1; + m_bTrace = false; init(); } @@ -71,52 +67,53 @@ POL::~POL() void POL::init () { - meta.eoc = SEMICOL; - meta.str = DQUOTE; - meta.com = SHARP; - meta.cmd = EXCLAM; - meta.prg = ATSIGN; - meta.con = AMPERSAND; - meta.out = DOLLAR; - meta.ter = PERCENT; - meta.inb = LBRACK; - - pol.nl_eoc = TRUE; - pol.skipchars[0] = EOS; - - inittable (cmdtable); /* initialize symbol tables */ - inittable (usertable); - inittable (skiptable); - - for (unsigned int i = 0; i < NUMCMD; i++) - install (cmdtable, cmdlist[i].keyword, cmdlist[i].code); - - token.ready = FALSE; /* no token read yet */ + meta.eoc = SEMICOL; + meta.str = DQUOTE; + meta.com = SHARP; + meta.cmd = EXCLAM; + meta.prg = ATSIGN; + meta.con = AMPERSAND; + meta.out = DOLLAR; + meta.ter = PERCENT; + meta.inb = LBRACK; + + m_bNewlineIsEOC = true; + m_szSkipChars[0] = EOS; + + + for (unsigned int i = 0; i < NUMCMD; i++) + cmdtable.installKeywordCode (cmdlist[i].keyword, cmdlist[i].code); + + token.ready = false; // no token read yet } + -/* skpword (w) - * - * char *w - word for pol to ignore and skip over in input - * - * tok() compares all tokens to words given to this routine. If it finds it, - * it will immediately read another token. - */ +/* addSkipWord (w) +* +* char *w - word for pol to ignore and skip over in input +* +* tok() compares all tokens to words given to this routine. If it finds it, +* it will immediately read another token. +*/ void -POL::skpword (char *w) +POL::addSkipWord (const char* const w) { - if (install (skiptable, w, 0) == NULL) - sys_error (ERR_SEVERE, "Too many skip words defined"); + skiptable.installKeywordCode (w, 0); } /* skpchar (s) - * - * skip all characters that appear in string s - */ +* +* skip all characters that appear in string s +*/ void -POL::skpchar (char *s) -{ - strncpy (pol.skipchars, s, MAXSKIPCHAR); +POL::addSkipChar (int c) +{ + int n = strlen (m_szSkipChars); + if (n < MAXSKIPCHAR) { + m_szSkipChars[n] = c; + m_szSkipChars[n+1] = 0; + } } // installKeyword (str, code) @@ -126,466 +123,460 @@ POL::skpchar (char *s) // // tok() looks for these user defined tokens. If it finds one, // it stores the tokens code in the token structure and returns TT_USERTOK -int -POL::installKeyword (char *str, int code) +void +POL::addKeyword (const char* const str, int code) { - if (install (usertable, str, code) == NULL) - { - sys_error (ERR_SEVERE, "Out of memory installing user tokens"); - return (FALSE); - } - - return(TRUE); + usertable.installKeywordCode (str, code); } /* get_word - matches tokens on a letter by letter basis - * - * char *search - string to search for - * int nlet - maximum number of chars to search for match - */ +* +* char *search - string to search for +* int nlet - maximum number of chars to search for match +*/ -int -POL::word (char *search, int nlet) +bool +POL::readWord (char *search, int nlet) { - tok (&token); - if (pol.trace == TRUE) - printf ("matching current token %s against word %s\n", token.tokstr, search); - - if (strncasecmp (search, token.tokstr, nlet) == 0) { - dumptok (&token); - return (TRUE); - } else - return (FALSE); + tok (&token); + if (m_bTrace) + sys_error (ERR_TRACE, "POL matching current token %s against word %s\n", token.tokstr, search); + + if (strncasecmp (search, token.tokstr, nlet) == 0) { + dumptok (&token); + return (true); + } else + return (false); } /* usertok (str,code) - * see if current token is a user defined token set with install() - * - * char *str - token string as read from input - * int *code - returned code for user defined symbol - * return value - TRUE if current token has been user defined - * FALSE if current token is not user defined - */ -int -POL::usertok (char *str, int *code) -{ - tok (&token); - - if (pol.trace == TRUE) - printf ("checking if current token '%s' is user defined\n", token.tokstr); - - if (token.type == TT_USERTOK) { - *code = token.code; - strcpy (str, token.tokstr); - dumptok (&token); - return (TRUE); - } else { - *code = 0; - return (FALSE); - } +* see if current token is a user defined token set with install() +* +* char *str - token string as read from input +* int *code - returned code for user defined symbol +* return value - true if current token has been user defined +* false if current token is not user defined +*/ +bool +POL::readUserToken (char *str, int *code) +{ + tok (&token); + + if (m_bTrace) + sys_error (ERR_TRACE, "POL checking if current token '%s' is user defined\n", token.tokstr); + + if (token.type == TT_USERTOK) { + *code = token.code; + strcpy (str, token.tokstr); + dumptok (&token); + return (true); + } else { + *code = 0; + return (false); + } } -/* isstring (s) - returns TRUE if current token is a string - * - * char *s - pointer to place to store token string +/* isstring (s) - returns true if current token is a string +* +* char *s - pointer to place to store token string */ - -int -POL::string (char *str) -{ - tok (&token); - if (token.type == TT_STRING) { - strcpy (str, token.tokstr); - dumptok (&token); - return (TRUE); - } else - return (FALSE); +bool +POL::readString (char *str) +{ + tok (&token); + + if (token.type == TT_STRING) { + strcpy (str, token.tokstr); + dumptok (&token); + return (true); + } else + return (false); } /* integer - test for an integer - * - * int *n: returned integer value - * int typecode = TT_INT if accept only integer values - * = TT_REAL if accept both real and integer values - * int boundcode= TRUE if force to lie between boundries - * = FALSE can take any value it likes - * int bb1: lower bound - * int bb2: upper bound +* +* int *n: returned integer value +* int typecode = TT_INT if accept only integer values +* = TT_REAL if accept both real and integer values +* int boundcode= true if force to lie between boundries +* = false can take any value it likes +* int bb1: lower bound +* int bb2: upper bound */ -int -POL::integer (int *n, int typecode, int boundcode, int bb1, int bb2) -{ - tok (&token); - - if (pol.trace == TRUE) - printf ("checking if current token %s is an integer\n", token.tokstr); - - if (token.type == TT_INT || token.type == TT_REAL) { - if (boundcode == TRUE) { - if (token.inum < bb1) - *n = bb1; - else if (token.inum > bb2) - *n = bb2; - else - *n = token.inum; +bool +POL::readInteger (int *n, int typecode, bool boundcode, int bb1, int bb2) +{ + tok (&token); + + if (m_bTrace) + sys_error (ERR_TRACE, "POL checking if current token %s is an integer\n", token.tokstr); + + if (token.type == TT_INT || token.type == TT_REAL) { + if (boundcode) { + if (token.inum < bb1) + *n = bb1; + else if (token.inum > bb2) + *n = bb2; + else + *n = token.inum; } else - *n = token.inum; - dumptok (&token); - return (TRUE); - } - *n = 0; - return (FALSE); + *n = token.inum; + dumptok (&token); + return (true); + } + *n = 0; + return (false); } bool -POL::readfloat (double *n, double typecode, double boundcode, double bb1, double bb2) -{ - tok (&token); - - if (pol.trace == TRUE) - printf ("checking if current token %s is an floating point number\n", token.tokstr); - - if (token.type == TT_INT || token.type == TT_REAL) { - if (boundcode == TRUE) { - if (token.fnum < bb1) - *n = bb1; - else if (token.fnum > bb2) - *n = bb2; - else - *n = token.fnum; +POL::readFloat (double *n, double typecode, bool boundcode, double bb1, double bb2) +{ + tok (&token); + + if (m_bTrace) + sys_error (ERR_TRACE, "POL checking if current token %s is an floating point number\n", token.tokstr); + + if (token.type == TT_INT || token.type == TT_REAL) { + if (boundcode) { + if (token.fnum < bb1) + *n = bb1; + else if (token.fnum > bb2) + *n = bb2; + else + *n = token.fnum; } else - *n = token.fnum; - dumptok (&token); - return (TRUE); - } - *n = 0.0; - return (FALSE); + *n = token.fnum; + dumptok (&token); + return (true); + } + *n = 0.0; + return (false); } /*----------------------------------------------------------------------*/ /* skip() - skip over any token except for end of command sequence */ /* */ -/* returns TRUE if succesful skip */ -/* returns FALSE if already at end of command or EOF */ +/* returns true if succesful skip */ +/* returns false if already at end of command or EOF */ /*----------------------------------------------------------------------*/ -int -POL::skip() +bool +POL::skipTokens() { - char term[5]; /* string of characters not to skip */ - - term[0] = meta.eoc; - if (pol.nl_eoc == TRUE) { - term[1] = NEWLINE; - term[2] = EOS; - } else - term[1] = EOS; - - return (skiptok (term)); + char term[5]; /* string of characters not to skip */ + + term[0] = meta.eoc; + if (m_bNewlineIsEOC) { + term[1] = NEWLINE; + term[2] = EOS; + } else + term[1] = EOS; + + return (skipSingleToken (term)); } void POL::reader() { - while (skip() == TRUE) - ; - - dumptok (&token); /* skip end of command token */ + while (skipTokens()) + ; + + dumptok (&token); /* skip end of command token */ } /* skiptok (term) - skip a token unless the first character of a token is - * in the string of terminators, term. - * char *term - string of termination characters, don't skip these characters - * skiptok() also does NOT skip TT_EOF - * returns (TRUE) if succesful skip of a token - * returns (FALSE) if didn't skip, read termination character or TT_EOF - */ - -int -POL::skiptok (char term[]) -{ - tok (&token); +* in the string of terminators, term. +* char *term - string of termination characters, don't skip these characters +* skiptok() also does NOT skip TT_EOF +* returns (true) if succesful skip of a token +* returns (false) if didn't skip, read termination character or TT_EOF +*/ - if (token.type == TT_EOF - || (token.type == TT_SPECLCHAR && strchr(term, token.tokstr[0]) != NULL)) - return (FALSE); - else { - dumptok (&token); - return (TRUE); - } +bool +POL::skipSingleToken (char term[]) +{ + tok (&token); + + if (token.type == TT_EOF + || (token.type == TT_SPECLCHAR && strchr(term, token.tokstr[0]) != NULL)) + return (false); + else { + dumptok (&token); + return (true); + } } int POL::tok (struct token_st *token) { - if (token->ready == FALSE) - getpol_tok(token); - else - if (token->type == TT_EOF && lookchar() != EOF) - getpol_tok(token); - return (token->type); + if (token->ready == false) + getpol_tok(token); + else + if (token->type == TT_EOF && lookchar() != EOF) + getpol_tok(token); + return (token->type); } void POL::dumptok (struct token_st *token) { - if (token->ready == FALSE) - getpol_tok(token); - token->ready = FALSE; + if (token->ready == false) + getpol_tok(token); + token->ready = false; } int POL::getpol_tok (struct token_st *token) { - SYMBOL *sym; - - token->ready = FALSE; + KeywordCodeEntry* sym; + + token->ready = false; nexttok: - gettok (token); - - if (token->type == TT_BLANK) - goto nexttok; - if (token->type == TT_SPECLCHAR) { - if (strchr(pol.skipchars, token->tokstr[0]) != NULL) - goto nexttok; - if (token->tokstr[0] == NEWLINE) - goto nexttok; - if (token->tokstr[0] == meta.cmd) { - getcmd(); - goto nexttok; - } - if (token->tokstr[0] == meta.com) { /* skip comment */ - eatline (); - goto nexttok; - } - if (token->tokstr[0] == meta.out) { - getescape(token->tokstr, meta.out, MAXTOK); - fputs (token->tokstr, stderr); - goto nexttok; - } - if (token->tokstr[0] == meta.con) { /* continuation across NEWLINE */ - while (lookchar() == BLANK || lookchar() == TAB) - inchar(); - if (lookchar() == NEWLINE) - inchar(); - } - if (token->tokstr[0] == meta.ter) { /* get input from terminal */ - usefile (P_USE_FILE, ""); - tok (token); - closefile(); - return (token->type); - } - } - - /* look for filler words */ - - if (lookup (skiptable, token->tokstr) != NULL) /* ignore words in skip table */ - goto nexttok; - - /* look for user defined symbols */ - - if ((sym = lookup (usertable, token->tokstr)) != NULL) { - token->type = TT_USERTOK; - token->code = sym->code; - } else - token->code = 0; - - if (pol.trace == TRUE) - printf ("Read token '%s', type = %d\n", token->tokstr, token->type); - - return (token->type); + gettok (token); + + if (token->type == TT_BLANK) + goto nexttok; + if (token->type == TT_SPECLCHAR) { + if (strchr(m_szSkipChars, token->tokstr[0]) != NULL) + goto nexttok; + if (token->tokstr[0] == NEWLINE) + goto nexttok; + if (token->tokstr[0] == meta.cmd) { + getcmd(); + goto nexttok; + } + if (token->tokstr[0] == meta.com) { /* skip comment */ + eatline (); + goto nexttok; + } + if (token->tokstr[0] == meta.out) { + getescape(token->tokstr, meta.out, MAXTOK); + fputs (token->tokstr, stderr); + goto nexttok; + } + if (token->tokstr[0] == meta.con) { /* continuation across NEWLINE */ + while (lookchar() == BLANK || lookchar() == TAB) + inchar(); + if (lookchar() == NEWLINE) + inchar(); + } + if (token->tokstr[0] == meta.ter) { /* get input from terminal */ + usefile (P_USE_FILE, ""); + tok (token); + closefile(); + return (token->type); + } + } + + /* look for filler words */ + + if (skiptable.lookup (token->tokstr) != NULL) /* ignore words in skip table */ + goto nexttok; + + /* look for user defined symbols */ + + if ((sym = usertable.lookup (token->tokstr)) != NULL) { + token->type = TT_USERTOK; + token->code = sym->getCode(); + } else + token->code = 0; + + if (m_bTrace) + sys_error (ERR_TRACE, "POL read token '%s', type = %d\n", token->tokstr, token->type); + + return (token->type); } int POL::getcmd() { - int tt, found; - char str[MAXTOK+1]; - SYMBOL *cmd; - TOKEN tok; - - tt = getalpha (str, MAXTOK); - if (tt == TT_ERROR) { - sys_error (ERR_WARNING, "Error in POL parameter command"); - reader(); - return(FALSE); - } - if ((cmd = lookup (cmdtable,str)) == NULL) { - sys_error (ERR_WARNING, "POL: Unrecognized command %s", cmd); - reader(); - return (FALSE); - } else { - found = FALSE; - switch (cmd->code) { - case PC_TRON: - pol.trace = TRUE; - found = TRUE; - break; - case PC_TROFF: - pol.trace = FALSE; - found = TRUE; - break; - case PC_FILE: - found = TRUE; - tt = gettok (&tok); - usefile (P_USE_FILE, tok.tokstr); - break; - case PC_NL_EOC: - found = TRUE; - pol.nl_eoc = TRUE; - break; - case PC_NL_NEOC: - found = TRUE; - pol.nl_eoc = FALSE; - break; - case PC_DUMP: - found = TRUE; - printf("eoc = %c str = %c com = %c cmd = %c prg = %c\n", - meta.eoc, meta.str, meta.com, meta.cmd, meta.prg); - printf("con = %c out = %c ter = %c inb = %c\n", - meta.con, meta.out, meta.ter, meta.inb); - break; - } - if (found == FALSE) { - tt = gettok (&tok); - if (tt != TT_SPECLCHAR) { - sys_error (ERR_SEVERE, "POL: Illegal command character"); - return (FALSE); - } - switch(cmd->code) { + int tt, found; + char str[MAXTOK+1]; + KeywordCodeEntry *cmd; + TOKEN tok; + + tt = getalpha (str, MAXTOK); + if (tt == TT_ERROR) { + sys_error (ERR_WARNING, "Error in POL parameter command"); + reader(); + return(false); + } + if ((cmd = cmdtable.lookup (str)) == NULL) { + sys_error (ERR_WARNING, "POL: Unrecognized command %s", cmd); + reader(); + return (false); + } else { + found = false; + switch (cmd->getCode()) { + case PC_TRON: + m_bTrace = true; + found = true; + break; + case PC_TROFF: + m_bTrace = false; + found = true; + break; + case PC_FILE: + found = true; + tt = gettok (&tok); + usefile (P_USE_FILE, tok.tokstr); + break; + case PC_NL_EOC: + found = true; + m_bNewlineIsEOC = true; + break; + case PC_NL_NEOC: + found = true; + m_bNewlineIsEOC = false; + break; + case PC_DUMP: + found = true; + printf("eoc = %c str = %c com = %c cmd = %c prg = %c\n", + meta.eoc, meta.str, meta.com, meta.cmd, meta.prg); + printf("con = %c out = %c ter = %c inb = %c\n", + meta.con, meta.out, meta.ter, meta.inb); + break; + } + if (found == false) { + tt = gettok (&tok); + if (tt != TT_SPECLCHAR) { + sys_error (ERR_SEVERE, "POL: Illegal command character"); + return (false); + } + switch(cmd->getCode()) { case PC_EOC: - meta.eoc = tok.tokstr[0]; - break; - case PC_STR: - meta.str = tok.tokstr[0]; - break; - case PC_COM: - meta.com = tok.tokstr[0]; - break; - case PC_CMD: - meta.cmd = tok.tokstr[0]; - break; - case PC_PRG: - meta.prg = tok.tokstr[0]; - break; - case PC_CON: - meta.con = tok.tokstr[0]; - break; - case PC_OUT: - meta.out = tok.tokstr[0]; - break; - case PC_TER: - meta.ter = tok.tokstr[0]; - break; - case PC_INB: - meta.inb = tok.tokstr[0]; - break; - default: - printf("command not implemented\n"); - break; - } /* switch (tok->type) */ - } /* if (found == FALSE) */ - reader(); /* clean up command */ - } /* if legal command */ - - return (TRUE); + meta.eoc = tok.tokstr[0]; + break; + case PC_STR: + meta.str = tok.tokstr[0]; + break; + case PC_COM: + meta.com = tok.tokstr[0]; + break; + case PC_CMD: + meta.cmd = tok.tokstr[0]; + break; + case PC_PRG: + meta.prg = tok.tokstr[0]; + break; + case PC_CON: + meta.con = tok.tokstr[0]; + break; + case PC_OUT: + meta.out = tok.tokstr[0]; + break; + case PC_TER: + meta.ter = tok.tokstr[0]; + break; + case PC_INB: + meta.inb = tok.tokstr[0]; + break; + default: + printf("command not implemented\n"); + break; + } /* switch (tok->type) */ + } /* if (found == false) */ + reader(); /* clean up command */ + } /* if legal command */ + + return (true); } int POL::gettok (TOKEN *tok) { - int c, toktype; - int inum; - double fnum; - int toksiz = MAXTOK; /* maximum length of token string */ - - while ((c = inchar()) == BLANK || c == TAB) - ; - ungetch (c); - - c = lookchar(); - toktype = type(c); - - fnum = 0.0; - inum = 0; - - if (c == BLANK || c == TAB) { /* skip white space */ - getblank(tok->tokstr, toksiz); - toktype = TT_BLANK; - } else if (toktype == LETTER) { - toktype = getalpha (tok->tokstr, toksiz); - } else if (c == meta.str) { /* quoted string */ - getquote (tok->tokstr, toksiz); - toktype = TT_STRING; - } else if (type(c) == DIGIT || c == PLUS || c == HYPHEN || c == PERIOD) { - toktype = getnumber (tok->tokstr, toksiz, &fnum, &inum); - } else if (c == EOF) { - tok->tokstr[0] = EOS; - toktype = TT_EOF; - } else { - c = inchar(); - tok->tokstr[0] = c; - tok->tokstr[1] = EOS; - toktype = TT_SPECLCHAR; - } - - tok->type = toktype; - tok->ready = TRUE; - if (tok->type == TT_REAL || tok->type == TT_INT) { - tok->fnum = fnum; - tok->inum = inum; - } else { - tok->fnum = 0.0; - tok->inum = 0; - } - - return (toktype); + int c, toktype; + int inum; + double fnum; + int toksiz = MAXTOK; /* maximum length of token string */ + + while ((c = inchar()) == BLANK || c == TAB) + ; + ungetch (c); + + c = lookchar(); + toktype = type(c); + + fnum = 0.0; + inum = 0; + + if (c == BLANK || c == TAB) { /* skip white space */ + getblank(tok->tokstr, toksiz); + toktype = TT_BLANK; + } else if (toktype == LETTER) { + toktype = getalpha (tok->tokstr, toksiz); + } else if (c == meta.str) { /* quoted string */ + getquote (tok->tokstr, toksiz); + toktype = TT_STRING; + } else if (type(c) == DIGIT || c == PLUS || c == HYPHEN || c == PERIOD) { + toktype = getnumber (tok->tokstr, toksiz, &fnum, &inum); + } else if (c == EOF) { + tok->tokstr[0] = EOS; + toktype = TT_EOF; + } else { + c = inchar(); + tok->tokstr[0] = c; + tok->tokstr[1] = EOS; + toktype = TT_SPECLCHAR; + } + + tok->type = toktype; + tok->ready = true; + if (tok->type == TT_REAL || tok->type == TT_INT) { + tok->fnum = fnum; + tok->inum = inum; + } else { + tok->fnum = 0.0; + tok->inum = 0; + } + + return (toktype); } void POL::getblank (char *s, int toksiz) { - int c; - - while ((c = inchar()) == BLANK || c == TAB) - ; - ungetch(c); - - s[0] = BLANK; - s[1] = EOS; + int c; + + while ((c = inchar()) == BLANK || c == TAB) + ; + ungetch(c); + + s[0] = BLANK; + s[1] = EOS; } int POL::getalpha (char *s, int toksiz) { - int i, chartype, alphatype; - - if (type(lookchar()) != LETTER) { - s[0] = EOS; - return (TT_ERROR); - } - - alphatype = TT_ALPHA; - for (i = 0; i < toksiz; i++) { /* get alphanumeric token */ - s[i] = inchar(); - chartype = type (s[i]); - if (chartype != LETTER && chartype != DIGIT) - break; - if (chartype == DIGIT) - alphatype = TT_ALPNUM; - } - ungetch(s[i]); - - if (i >= toksiz) - sys_error (ERR_SEVERE, "POL token too long."); - - s[i] = EOS; /* terminate token */ - return (alphatype); + int i, chartype, alphatype; + + if (type(lookchar()) != LETTER) { + s[0] = EOS; + return (TT_ERROR); + } + + alphatype = TT_ALPHA; + for (i = 0; i < toksiz; i++) { /* get alphanumeric token */ + s[i] = inchar(); + chartype = type (s[i]); + if (chartype != LETTER && chartype != DIGIT) + break; + if (chartype == DIGIT) + alphatype = TT_ALPNUM; + } + ungetch(s[i]); + + if (i >= toksiz) + sys_error (ERR_SEVERE, "POL token too long."); + + s[i] = EOS; /* terminate token */ + return (alphatype); } @@ -594,57 +585,64 @@ POL::getalpha (char *s, int toksiz) void POL::getquote (char *qs, int toksiz) { - int delim; - - delim = inchar(); /* char = delimiter */ - getescape(qs, delim, toksiz); + int delim; + + delim = inchar(); /* char = delimiter */ + getescape(qs, delim, toksiz); } void POL::getescape ( /* reads up to delim */ - char *s, - int delim, - int toksiz -) -{ - int i, c; - - for (i = 0; (c = inchar()) != delim; i++) { - if (c == NEWLINE) { - sys_error (ERR_WARNING, "Missing closing delimiter."); - break; - } - if (i >= toksiz) { - sys_error (ERR_SEVERE, "string too long."); - break; - } - if (c == EOF) { - ungetch(c); - sys_error (ERR_SEVERE, "end of file inside quotation"); - break; - } else if (c == BSLASH) { /* escape character */ - s[i++] = c; - c = inchar(); /* get escaped character */ - } - s[i] = c; - } - s[i] = EOS; + char *s, + int delim, + int toksiz + ) +{ + int i, c; + + for (i = 0; (c = inchar()) != delim; i++) { + if (c == NEWLINE) { + sys_error (ERR_WARNING, "Missing closing delimiter."); + break; + } + if (i >= toksiz) { + sys_error (ERR_SEVERE, "string too long."); + break; + } + if (c == EOF) { + ungetch(c); + sys_error (ERR_SEVERE, "end of file inside quotation"); + break; + } else if (c == BSLASH) { /* escape character */ + s[i++] = c; + c = inchar(); /* get escaped character */ + } + s[i] = c; + } + s[i] = EOS; } + -void -POL::gettext (char *str, int lim) -{ - int c, i; - - while ((c = inchar()) == BLANK || c == TAB) - ; - ungetch (c); - - for (i = 0; i < lim && (c = inchar()) != EOF && c != NEWLINE; i++) - str[i] = c; - ungetch (c); - str[i] = EOS; +bool +POL::readText (char *str, int lim) +{ + int c; + while ((c = inchar()) == BLANK || c == TAB) + ; + ungetch (c); + 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; + + return true; } //---------------------------------------------- @@ -654,257 +652,161 @@ POL::gettext (char *str, int lim) int POL::getnumber ( - char str[], /* string to return token in */ - int strsize, /* maximum length of token string */ - double *fnum, /* floating point value of number read */ - int *inum /* integer value of number read */ -) -{ - int c, sp, isSigned; - double sign, whole, frac, powerof10, exp, expsign; - - sp = 0; - sign = 1.0; - isSigned = FALSE; /* TRUE if number prefixed by '+' or '-' */ - *fnum = 0.0; - *inum = 0; - str[0] = EOS; - - c = inchar(); - if (c == HYPHEN) { - str[sp++] = c; - isSigned = TRUE; - sign = -1.0; - } else if (c == PLUS) { - str[sp++] = c; - isSigned = TRUE; - sign = 1.0; - } else if (c == PERIOD) { - if (type(lookchar()) != DIGIT) { - str[0] = PERIOD; - str[1] = EOS; - return (TT_SPECLCHAR); - } else - ungetch (PERIOD); - } else if (type(c) != DIGIT) { - ungetch (c); - return (TT_ERROR); - } else - ungetch (c); - - if (isSigned == TRUE) { - c = lookchar(); - if (c == PERIOD) { - inchar(); /* get period */ - c = lookchar(); /* look at character past period */ - ungetch (PERIOD); /* put back period */ - if (type(c) != DIGIT) { - str[sp] = EOS; - return (TT_SPECLCHAR); - } - } else if (type (c) != DIGIT) { - str[sp] = EOS; - return (TT_SPECLCHAR); - } - } - - whole = 0.0; - while (type(c = inchar()) == DIGIT) { - if (sp < strsize) - str[sp++] = c; - whole = 10.0 * whole + (c - '0'); - } - ungetch (c); /* put back non-numeric character */ - - if (c != PERIOD && tolower(c) != 'e') { - str[sp] = EOS; - *fnum = whole * sign; - if (*fnum < MIN_INT) - *inum = MIN_INT; - else if (*fnum > MAX_INT) - *inum = MAX_INT; - else - *inum = (int) *fnum; - return (TT_INT); - } - - if (lookchar() == PERIOD) { - inchar(); - if (sp < strsize) - str[sp++] = PERIOD; - } - - frac = 0.0; - powerof10 = 10.0; - - while (type(c = inchar()) == DIGIT) { - if (sp < strsize) - str[sp++] = c; - frac += (double) (c - '0') / powerof10; - powerof10 *= 10.0; - } - ungetch (c); - - exp = 0.0; - expsign = 1.0; - c = inchar(); - if (tolower(c) != 'e') - ungetch (c); - else { - if (sp < strsize) - str[sp++] = c; - if ((c = inchar()) == PLUS) { - if (sp < strsize) - str[sp++] = c; - expsign = 1.0; - } else if (c == HYPHEN) { - if (sp < strsize) - str[sp++] = c; - expsign = -1.0; - } else if (type(c) != DIGIT) { - --sp; /* erase 'e' */ - ungetch (c); - ungetch ('e'); - goto getnumexit; - } else - ungetch(c); - - exp = 0; - while (type(c = inchar()) == DIGIT) { - if (sp < strsize) - str[sp++] = c; - exp = 10 * exp + (c - '0'); - } - ungetch (c); - } - + char str[], /* string to return token in */ + int strsize, /* maximum length of token string */ + double *fnum, /* floating point value of number read */ + int *inum /* integer value of number read */ + ) +{ + int sp = 0; + double sign = 1.0; + bool isSigned = false; /* true if number prefixed by '+' or '-' */ + *fnum = 0.0; + *inum = 0; + str[0] = EOS; + + int c = inchar(); + if (c == HYPHEN) { + str[sp++] = c; + isSigned = true; + sign = -1.0; + } else if (c == PLUS) { + str[sp++] = c; + isSigned = true; + sign = 1.0; + } else if (c == PERIOD) { + if (type(lookchar()) != DIGIT) { + str[0] = PERIOD; + str[1] = EOS; + return (TT_SPECLCHAR); + } else + ungetch (PERIOD); + } else if (type(c) != DIGIT) { + ungetch (c); + return (TT_ERROR); + } else + ungetch (c); + + if (isSigned) { + c = lookchar(); + if (c == PERIOD) { + inchar(); /* get period */ + c = lookchar(); /* look at character past period */ + ungetch (PERIOD); /* put back period */ + if (type(c) != DIGIT) { + str[sp] = EOS; + return (TT_SPECLCHAR); + } + } else if (type (c) != DIGIT) { + str[sp] = EOS; + return (TT_SPECLCHAR); + } + } + + double whole = 0.0; + while (type(c = inchar()) == DIGIT) { + if (sp < strsize) + str[sp++] = c; + whole = 10.0 * whole + (c - '0'); + } + ungetch (c); /* put back non-numeric character */ + + if (c != PERIOD && tolower(c) != 'e') { + str[sp] = EOS; + *fnum = whole * sign; + if (*fnum < MIN_INT) + *inum = MIN_INT; + else if (*fnum > MAX_INT) + *inum = MAX_INT; + else + *inum = (int) *fnum; + return (TT_INT); + } + + if (lookchar() == PERIOD) { + inchar(); + if (sp < strsize) + str[sp++] = PERIOD; + } + + double frac = 0.0; + double powerof10 = 10.0; + + while (type(c = inchar()) == DIGIT) { + if (sp < strsize) + str[sp++] = c; + frac += (double) (c - '0') / powerof10; + powerof10 *= 10.0; + } + ungetch (c); + + double exp = 0.0; + double expsign = 1.0; + c = inchar(); + if (tolower(c) != 'e') + ungetch (c); + else { + if (sp < strsize) + str[sp++] = c; + if ((c = inchar()) == PLUS) { + if (sp < strsize) + str[sp++] = c; + expsign = 1.0; + } else if (c == HYPHEN) { + if (sp < strsize) + str[sp++] = c; + expsign = -1.0; + } else if (type(c) != DIGIT) { + --sp; /* erase 'e' */ + ungetch (c); + ungetch ('e'); + goto getnumexit; + } else + ungetch(c); + + exp = 0; + while (type(c = inchar()) == DIGIT) { + if (sp < strsize) + str[sp++] = c; + exp = 10 * exp + (c - '0'); + } + ungetch (c); + } + getnumexit: - str[sp] = EOS; - *fnum = sign * (whole + frac) * pow (10.0, expsign * exp); - if (*fnum < MIN_INT) - *inum = MIN_INT; - else if (*fnum > MAX_INT) - *inum = MAX_INT; - else - *inum = (int) *fnum; - return (TT_REAL); + str[sp] = EOS; + *fnum = sign * (whole + frac) * pow (10.0, expsign * exp); + if (*fnum < MIN_INT) + *inum = MIN_INT; + else if (*fnum > MAX_INT) + *inum = MAX_INT; + else + *inum = (int) *fnum; + return (TT_REAL); } void POL::eatline () { - char term [2]; - - term[0] = NEWLINE; - term[1] = EOS; - skiptok (term); + char term [2]; + + term[0] = NEWLINE; + term[1] = EOS; + skipSingleToken (term); } // return type of ASCII character int POL::type (int c) { - if (isalpha(c) || c == UNDERLIN) - return (LETTER); - else if (isdigit(c)) - return (DIGIT); - else - return (c); + if (isalpha(c) || c == UNDERLIN) + return (LETTER); + else if (isdigit(c)) + return (DIGIT); + else + return (c); } -/*----------------------------------------------------------------------*/ -/* */ -/* hash table routines. Kernighan & Ritchie */ -/* */ -/*----------------------------------------------------------------------*/ - -/* inittable (table) - * clear symbol table -*/ - -void -POL::inittable (SYMBOL *table[]) -{ - int i; - - for (i = 0; i < HASHSIZE; i++) - table[i] = NULL; -} - -/* freetable (table) - * free all memory allocated to table, then clear table - */ - -void -POL::freetable (SYMBOL *table[]) -{ - int i; - SYMBOL *p, *np; - - for (i = 0; i < HASHSIZE; i++) { - np = table[i]; - while (np != NULL) { - p = np->next; - free (np); - np = p; - } - } - inittable (table); -} - -// form hash value of string s -int -POL::hash (char *s) -{ - int hashval; - - for (hashval = 0; *s != EOS; ) - hashval += *s++; - return (hashval % HASHSIZE); -} - -/* Look for s in hash table */ -POL::SYMBOL * -POL::lookup ( SYMBOL *table[], char *s ) -{ - SYMBOL *np; - SYMBOL *found = NULL; - - for (np = table[hash(s)]; np != NULL; np = np->next) - if (strcasecmp(s, np->name) == 0) { - found = np; /* found it */ - break; - } - - return (found); -} - -POL::SYMBOL * -POL::install (SYMBOL *table[], char *name, int def) -{ - static char installerr[] = "install: out of memory"; - SYMBOL *np; - int hashval; - - if ((np = lookup (table, name)) == NULL) { /* not found */ - np = (SYMBOL *) malloc (sizeof(*np)); - if (np == NULL) { - sys_error (ERR_SEVERE, installerr); - return (NULL); - } - if ((np->name = strdup(name)) == NULL) { - sys_error (ERR_SEVERE, installerr); - return (NULL); - } - str_lower (np->name); - np->code = def; - hashval = hash(np->name); - np->next = table[hashval]; - table[hashval] = np; - } else /* already there */ - np->code = def; - return (np); -} //---------------------------------------------------------------------- // POL INPUT @@ -912,50 +814,50 @@ POL::install (SYMBOL *table[], char *name, int def) /* usefile - set source of POL input - * - * int source - source of input - * P_USE_STR - have POL use strings as input - * P_USE_FILE - use file. filename is in str - * +* +* int source - source of input +* P_USE_STR - have POL use strings as input +* P_USE_FILE - use file. filename is in str +* */ void POL::usefile (int source, char *fn) { - FILE *fp; - - ++currentf; - if (currentf >= MAXFILE) { - --currentf; - sys_error (ERR_SEVERE, "files nested too deeply"); - return; - } - - bp = 0; /* clear any pushed back input */ - - if (source == P_USE_STR) { - filep[currentf] = NULL; - } else if (source == P_USE_FILE) { - if (fn == NULL || strlen(fn) == 0) { - fp = stdin; - } else if ((fp = fopen(fn, "r")) == NULL) { - --currentf; - sys_error (ERR_SEVERE, "can't open file"); - return; - } - filep[currentf] = fp; - fname[currentf] = strdup (fn); - } + FILE *fp; + + ++currentf; + if (currentf >= MAXFILE) { + --currentf; + sys_error (ERR_SEVERE, "files nested too deeply"); + return; + } + + bp = 0; /* clear any pushed back input */ + + if (source == P_USE_STR) { + filep[currentf] = NULL; + } else if (source == P_USE_FILE) { + if (fn == NULL || strlen(fn) == 0) { + fp = stdin; + } else if ((fp = fopen(fn, "r")) == NULL) { + --currentf; + sys_error (ERR_SEVERE, "can't open file"); + return; + } + filep[currentf] = fp; + fname[currentf] = strdup (fn); + } } void POL::closefile() { - if (currentf >= 0) { - if (filep[currentf] != NULL) - fclose (filep[currentf]); - --currentf; - } + if (currentf >= 0) { + if (filep[currentf] != NULL) + fclose (filep[currentf]); + --currentf; + } } /*-----------------------------*/ @@ -966,25 +868,25 @@ POL::closefile() int POL::lookchar() { - int c; - - c = inchar(); - ungetch (c); - return (c); + int c; + + c = inchar(); + ungetch (c); + return (c); } int POL::inchar() { int c = 0; - + if (currentf < 0) return (EOF); - + while (currentf >= 0 && (c = getch(filep[currentf])) == EOF && filep[currentf] != NULL) { closefile (); } - + return (c); } @@ -996,50 +898,50 @@ POL::inchar() int POL::getch (FILE *fp) { - int c; - - if (bp > 0) - return (buf[--bp]); - - if (fp == NULL) { - if ((c = inputline[lineptr]) == EOS) - return (EOF); - else { - ++lineptr; - return (c); - } - } else - c = fgetc(fp); - - return (c); + int c; + + if (bp > 0) + return (buf[--bp]); + + if (fp == NULL) { + if ((c = inputline[lineptr]) == EOS) + return (EOF); + else { + ++lineptr; + return (c); + } + } else + c = fgetc(fp); + + return (c); } /* push character back on input */ void POL::ungetch (int c) { - if (bp > BUFSIZE) - sys_error (ERR_SEVERE, "too many characters pushed back [ungetch]"); - else - buf[bp++] = c; + if (bp > BUFSIZE) + sys_error (ERR_SEVERE, "too many characters pushed back [ungetch]"); + else + buf[bp++] = c; } int POL::get_inputline (FILE *fp) { - lineptr = 0; - bp = 0; - if (fgets (inputline, MAXLINE, fp) == NULL) - return (EOF); - else - return (OK); + lineptr = 0; + bp = 0; + if (fgets (inputline, MAXLINE, fp) == NULL) + return (EOF); + else + return (OK); } void POL::set_inputline (const char* const line) { - lineptr = 0; - bp = 0; - strncpy (inputline, line, MAXLINE); + lineptr = 0; + bp = 0; + strncpy (inputline, line, MAXLINE); } diff --git a/libctsupport/Makefile.am b/libctsupport/Makefile.am index c04f426..c133131 100644 --- a/libctsupport/Makefile.am +++ b/libctsupport/Makefile.am @@ -1,6 +1,6 @@ noinst_LIBRARIES = libctsupport.a INCLUDES=@my_includes@ -libctsupport_a_SOURCES= strfuncs.cpp syserror.cpp fnetorderstream.cpp consoleio.cpp mathfuncs.cpp xform.cpp clip.cpp plotfile.cpp +libctsupport_a_SOURCES= strfuncs.cpp syserror.cpp fnetorderstream.cpp consoleio.cpp mathfuncs.cpp xform.cpp clip.cpp plotfile.cpp hashtable.cpp EXTRA_DIST=Makefile.nt diff --git a/libctsupport/hashtable.cpp b/libctsupport/hashtable.cpp new file mode 100644 index 0000000..a4dd283 --- /dev/null +++ b/libctsupport/hashtable.cpp @@ -0,0 +1,141 @@ +/***************************************************************************** +** FILE IDENTIFICATION +** +** Hash Table Class +** +** This is part of the CTSim program +** Copyright (C) 1983-2000 Kevin Rosenberg +** +** $Id: hashtable.cpp,v 1.1 2000/12/27 20:09:19 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 +** published by the Free Software Foundation. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +******************************************************************************/ + +#include "ct.h" +#include +#include +#include +#include "ctsupport.h" +#include "pol.h" + + +KeywordCodeEntry::KeywordCodeEntry (const char* const pszKeyword, int iCode) + : m_iCode (iCode), m_pNext(NULL) +{ + int nLength = strlen (pszKeyword); + char* pszCopy = new char [ nLength + 1]; + for (int i = 0; i < nLength; i++) + pszCopy[i] = tolower (pszKeyword[i]); + pszCopy[nLength] = 0; + + m_strKeyword = pszCopy; + + delete pszCopy; +} + + +bool +KeywordCodeEntry::matchesKeyword (const char* const pszCompare) const +{ + int nLength = strlen (pszCompare); + char* pszCopy = new char [ nLength + 1]; + for (int i = 0; i < nLength; i++) + pszCopy[i] = tolower (pszCompare[i]); + pszCopy[nLength] = 0; + + bool bMatch = false; + if (m_strKeyword.compare (pszCompare) == 0) + bMatch = true; + + delete pszCopy; + + return bMatch; +} + + +// inittable (table) +// clear symbol table + +void +KeywordCodeHashTable::initTable () +{ + int i; + + for (i = 0; i < HASHSIZE; i++) + m_hashTable[i] = NULL; +} + +// freetable (table) +// free all memory allocated to table, then clear table + +void +KeywordCodeHashTable::freeTable () +{ + int i; + KeywordCodeEntry *p, *np; + + for (i = 0; i < HASHSIZE; i++) { + np = m_hashTable [i]; + while (np != NULL) { + p = np->getNext(); + delete np; + np = p; + } + } + initTable (); +} + + +// form hash value of string s +int +KeywordCodeHashTable::hash (const char* s) +{ + int hashval = 0; + + while (*s != EOS) { + hashval += tolower(*s); + s++; + } + + return (hashval % HASHSIZE); +} + + +/* Look for s in hash table */ +KeywordCodeEntry * +KeywordCodeHashTable::lookup (const char* const pszLookup) +{ + KeywordCodeEntry *found = NULL; + for (KeywordCodeEntry* np = m_hashTable[ hash( pszLookup ) ]; np != NULL; np = np->getNext()) + if (np->matchesKeyword (pszLookup)) { + found = np; // found it + break; + } + + return (found); +} + +void +KeywordCodeHashTable::installKeywordCode (const char* const pszKeyword, int iCode) +{ + KeywordCodeEntry *np = lookup (pszKeyword); + + if (np == NULL) { // not found + np = new KeywordCodeEntry (pszKeyword, iCode); + int hashval = hash (np->getKeyword()); + np->setNext (m_hashTable[ hashval ]); + m_hashTable[hashval] = np; + } else // already defined + np->setCode (iCode); +} diff --git a/libctsupport/syserror.cpp b/libctsupport/syserror.cpp index f606288..8721de2 100644 --- a/libctsupport/syserror.cpp +++ b/libctsupport/syserror.cpp @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: syserror.cpp,v 1.8 2000/12/17 23:30:48 kevin Exp $ +** $Id: syserror.cpp,v 1.9 2000/12/27 20:09:19 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 @@ -83,6 +83,9 @@ void sys_verror (int severity, const char *msg, va_list arg) break; case ERR_WARNING: std::cout << "WARNING ERROR: "; + break; + case ERR_TRACE: + std::cout << "Trace: "; break; default: std::cout << "Illegal error code #" << severity << ": "; diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index 4277633..d695bc3 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -6,26 +6,13 @@ --------------------Configuration: libctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP42.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7B.tmp" with contents [ /nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\..\..\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"C:\ctsim-2.0.6\libctsim\backprojectors.cpp" -"C:\ctsim-2.0.6\libctgraphics\ezplot.cpp" -"C:\ctsim-2.0.6\libctgraphics\ezset.cpp" -"C:\ctsim-2.0.6\libctgraphics\ezsupport.cpp" -"C:\ctsim-2.0.6\libctsim\filter.cpp" -"C:\ctsim-2.0.6\libctsim\imagefile.cpp" -"C:\ctsim-2.0.6\libctsim\phantom.cpp" -"C:\ctsim-2.0.6\libctsupport\plotfile.cpp" "C:\ctsim-2.0.6\libctgraphics\pol.cpp" -"C:\ctsim-2.0.6\libctsim\procsignal.cpp" -"C:\ctsim-2.0.6\libctsim\projections.cpp" -"C:\ctsim-2.0.6\libctsim\reconstruct.cpp" -"C:\ctsim-2.0.6\libctsim\scanner.cpp" -"C:\ctsim-2.0.6\libctsim\trace.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP42.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP43.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7B.tmp" +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7C.tmp" with contents [ /nologo /out:"Debug\libctsim.lib" ".\Debug\array2dfile.obj" @@ -54,41 +41,24 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP43.tmp" with content ".\Debug\trace.obj" ".\Debug\transformmatrix.obj" ".\Debug\xform.obj" +".\Debug\hashtable.obj" ] -Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP43.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7C.tmp"

Output Window

Compiling... -backprojectors.cpp -ezplot.cpp -ezset.cpp -ezsupport.cpp -filter.cpp -imagefile.cpp -phantom.cpp -plotfile.cpp pol.cpp -procsignal.cpp -projections.cpp -reconstruct.cpp -scanner.cpp -trace.cpp Creating library...

--------------------Configuration: ctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP44.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7D.tmp" with contents [ /nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "\wx2\include" /I "." /I "..\..\include" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\zlib" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"2.5.0\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"2.5.0\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c "C:\ctsim-2.0.6\src\ctsim.cpp" -"C:\ctsim-2.0.6\src\dialogs.cpp" -"C:\ctsim-2.0.6\src\dlgprojections.cpp" -"C:\ctsim-2.0.6\src\dlgreconstruct.cpp" -"C:\ctsim-2.0.6\src\docs.cpp" -"C:\ctsim-2.0.6\src\views.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP44.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP45.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7D.tmp" +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7E.tmp" with contents [ comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libctsim/Debug/libctsim.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\lpng108\msvc\win32\libpng\lib_dbg\libpng.lib ..\..\..\lpng108\msvc\win32\zlib\lib_dbg\zlib.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib ../../../wx2/lib/wxd.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrtd.lib" /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" ".\Debug\ctsim.obj" @@ -103,15 +73,10 @@ comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib w "\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib" "\wx2\lib\wxd.lib" ] -Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP45.tmp" +Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP7E.tmp"

Output Window

Compiling... ctsim.cpp -dialogs.cpp -dlgprojections.cpp -dlgreconstruct.cpp -docs.cpp -views.cpp Linking... Creating command line "bscmake.exe /nologo /o"Debug/ctsim.bsc" ".\Debug\ctsim.sbr" ".\Debug\dialogs.sbr" ".\Debug\dlgprojections.sbr" ".\Debug\dlgreconstruct.sbr" ".\Debug\docs.sbr" ".\Debug\views.sbr"" Creating browse info file... -- 2.34.1