r248: msvc changes
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 6 Dec 2000 15:17:51 +0000 (15:17 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 6 Dec 2000 15:17:51 +0000 (15:17 +0000)
include/array2dfile.h
include/ct.h
include/ctsupport.h
include/ezplot.h
include/sgp.h
libctgraphics/ezset.cpp
libctsim/array2dfile.cpp
libctsim/backprojectors.cpp
libctsupport/clip.cpp

index 9af82a70d8c7949f8c7310d65e8cc5dc4fda7b86..512772d3111418239702bdd59e8ece22dcb623a5 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: array2dfile.h,v 1.8 2000/12/04 04:15:48 kevin Exp $
+**  $Id: array2dfile.h,v 1.9 2000/12/06 15:17:51 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
 **
 **  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
@@ -33,7 +33,7 @@
 #endif
 
 #include <sys/types.h>
 #endif
 
 #include <sys/types.h>
-#include <string.h>
+#include <cstring>
 #include <string>
 #include <fstream>
 #include <iostream>
 #include <string>
 #include <fstream>
 #include <iostream>
index 0928b91f8807dcc25d3cb986ba13e68248f2bf21..84e139f8f892f86b65a0906ffc01500aefbec697 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ct.h,v 1.41 2000/12/04 05:36:57 kevin Exp $
+**  $Id: ct.h,v 1.42 2000/12/06 15:17:51 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
 **
 **  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
 #define CT_H
 
 #ifdef MSVC
 #define CT_H
 
 #ifdef MSVC
-  extern "C" {int strcasecmp(const char*, const char*);}
// extern "C" {int strcasecmp(const char*, const char*);}
   typedef long off_t;
   typedef long off_t;
-  #define HAVE_STRING_H 1
-  #include <fcntl.h>
-  #define strcasecmp stricmp
-  #define strncasecmp strnicmp
+  #define HAVE_STRING_H 1\r
+  #include <fcntl.h>\r
+  #define strdup _strdup
+  #define strcasecmp _stricmp
+  #define strncasecmp _strnicmp
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
 #include <cstdarg>
 #include <cstdlib>
 using namespace std;
 #include <cstdarg>
 #include <cstdlib>
 using namespace std;
-
+\r
+#if defined(MSVC) || HAVE_SSTREAM\r
 #include <sstream>
 #include <sstream>
+#else\r
+#include <sstream_subst>\r
+#endif\r
+\r
 #include <fstream>
 #include <iostream>
 #include <string>
 #include <fstream>
 #include <iostream>
 #include <string>
index 60a6c2c40adb2fd6acc476895b2aae76e6b48abb..ac3ffe0732ccdbfbd4f675d0770c626df206e40c 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsupport.h,v 1.8 2000/12/06 01:46:43 kevin Exp $
+**  $Id: ctsupport.h,v 1.9 2000/12/06 15:17:51 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -252,10 +252,10 @@ inline void minmax_array (const T* array, const int n, T& min, T& max)
 
 // clip.cpp 
 bool clip_rect (double& x1, double& y1, double& x2, double& y2, const double rect[4]);
 
 // clip.cpp 
 bool clip_rect (double& x1, double& y1, double& x2, double& y2, const double rect[4]);
-int clip_segment (double& x1, double& y1, double& x2, double& y2, const double u, const double v);
-int clip_sector (double& x1, double& y1, double& x2, double& y2, const double u, const double v);
-int clip_circle (double& x1, double& y1, double& x2, double& y2, const double cx, const double cy, const double radius, double t1, double t2);
-int clip_triangle (double& x1, double& y1, double& x2, double& y2, const double u, const double v, const int clip_xaxis);
+bool clip_segment (double& x1, double& y1, double& x2, double& y2, const double u, const double v);
+bool clip_sector (double& x1, double& y1, double& x2, double& y2, const double u, const double v);
+bool clip_circle (double& x1, double& y1, double& x2, double& y2, const double cx, const double cy, const double radius, double t1, double t2);
+bool clip_triangle (double& x1, double& y1, double& x2, double& y2, const double u, const double v, const int clip_xaxis);
 
 
 // xform.cpp 
 
 
 // xform.cpp 
index 11f95ba4f4bebdec4343b2d8b372d6d57be150bf..c15428b20dc1675a4c9df69d4dfd4fdb1a707191 100644 (file)
@@ -7,7 +7,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezplot.h,v 1.16 2000/12/06 01:46:43 kevin Exp $
+**  $Id: ezplot.h,v 1.17 2000/12/06 15:17:51 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
 **
 **  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
@@ -208,7 +208,7 @@ class EZPlot {
     void clearCurves ();
 
     bool ezcmd (char *comm);
     void clearCurves ();
 
     bool ezcmd (char *comm);
-    int do_cmd(int lx);
+    bool do_cmd(int lx);
     void bad_option(char *opt);
     void initPlotSettings();
 
     void bad_option(char *opt);
     void initPlotSettings();
 
index f30f582e3df2762114744de2b698a86ca596c29d..174d83b00486b602156e6f60c2b5213103571450 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: sgp.h,v 1.20 2000/12/06 01:46:43 kevin Exp $
+**  $Id: sgp.h,v 1.21 2000/12/06 15:17:51 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
 **
 **  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
@@ -86,10 +86,10 @@ public:
     { return m_sWindowTitle; }
 
   bool isWX () const
     { return m_sWindowTitle; }
 
   bool isWX () const
-    { return (m_idDriver & SGPDRIVER_WXWINDOWS); }
+  { return (m_idDriver & SGPDRIVER_WXWINDOWS ? true : false); }
 
   bool isG2 () const
 
   bool isG2 () const
-    { return (m_idDriver & SGPDRIVER_G2); }
+  { return (m_idDriver & SGPDRIVER_G2 ? true : false); }
 
   int idG2 () const
     { return m_idG2; }
 
   int idG2 () const
     { return m_idG2; }
index e4f6abfee43a4fd7586cffd5f086501ce4301c78..4e68671507c01eb752204459930e1340460931ac 100644 (file)
@@ -6,7 +6,7 @@
  **  This is part of the CTSim program
  **  Copyright (C) 1983-2000 Kevin Rosenberg
  **
  **  This is part of the CTSim program
  **  Copyright (C) 1983-2000 Kevin Rosenberg
  **
- **  $Id: ezset.cpp,v 1.8 2000/12/06 01:46:43 kevin Exp $
+ **  $Id: ezset.cpp,v 1.9 2000/12/06 15:17:51 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
  **
  **  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
@@ -74,7 +74,7 @@ EZPlot::ezcmd (char *comm)
 }
 
 
 }
 
 
-int 
+bool
 EZPlot::do_cmd (int lx)
 {
   char str [1024];
 EZPlot::do_cmd (int lx)
 {
   char str [1024];
@@ -368,7 +368,7 @@ EZPlot::do_cmd (int lx)
   }
 
   pol_reader ();
   }
 
   pol_reader ();
-  return (TRUE);
+  return (true);
 }
 
 
 }
 
 
index b16c7d3b7810db59fd734e8cca62c24fe73e1201..e35a14982056cbb5f414b8fb73402ebe58a1c4a8 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: array2dfile.cpp,v 1.15 2000/12/06 01:46:43 kevin Exp $
+**  $Id: array2dfile.cpp,v 1.16 2000/12/06 15:17:51 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
 **
 **  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
 ******************************************************************************/
 
 #include "array2dfile.h"
 ******************************************************************************/
 
 #include "array2dfile.h"
-#include <ctime>
-#include <sstream>
-
+#include <ctime>\r
+#ifdef MSVC\r
+typedef long off_t;\r
+#endif
 
 using namespace std;
 
 
 using namespace std;
 
@@ -108,9 +109,10 @@ Array2dFileLabel::getDateTime (int& year, int& month, int& day, int& hour, int&
 const string& 
 Array2dFileLabel::getDateString (void) const
 {
 const string& 
 Array2dFileLabel::getDateString (void) const
 {
-  ostringstream oss;
-  oss <<  static_cast<int>(m_month + 1) <<"/"<< static_cast<int>(m_day) <<"/"<< static_cast<int>(m_year + 1900) << " " << static_cast<int>(m_hour) <<":"<<  static_cast<int>(m_minute) <<":"<< static_cast<int>(m_second);
-  m_strDate = oss.str();
+  char szDate [128];\r
+  snprintf (szDate, sizeof(szDate), "%2d/%02d/%4d %02d:%02d:%02d",\r
+         m_month + 1, m_day, m_year + 1900, m_hour, m_minute, m_second);
+  m_strDate = szDate;
   return m_strDate;
 }
 
   return m_strDate;
 }
 
index ecdc3fdcf753bbe9c41dbc620b170500c375bf16..0d3cd804892ec01ed3b8e5299122fbfd9781b6de 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: backprojectors.cpp,v 1.17 2000/12/06 01:46:43 kevin Exp $
+**  $Id: backprojectors.cpp,v 1.18 2000/12/06 15:17:51 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
 **
 **  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
@@ -299,7 +299,8 @@ void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, doubl
 }
 
 void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double L, int iDetPos)
 }
 
 void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double L, int iDetPos)
-{
+{\r
+#if 1
   ostringstream os;
   os << "ix=" << ix << ", iy=" << iy << ", theta=" << theta << ", L=" << L << ", detinc=" << detInc << "\n";
   os << "ndet=" << nDet << ", detInc=" << detInc << ", iDetCenter=" << iDetCenter << "\n";
   ostringstream os;
   os << "ix=" << ix << ", iy=" << iy << ", theta=" << theta << ", L=" << L << ", detinc=" << detInc << "\n";
   os << "ndet=" << nDet << ", detInc=" << detInc << ", iDetCenter=" << iDetCenter << "\n";
@@ -307,7 +308,8 @@ void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, doubl
   os << "yMin=" << yMin << ", yMax=" << yMax << ", yInc=" << yInc << "\n";
   os << "iDetPos index outside bounds: " << iDetPos << " [backprojector]";;
 
   os << "yMin=" << yMin << ", yMax=" << yMax << ", yInc=" << yInc << "\n";
   os << "iDetPos index outside bounds: " << iDetPos << " [backprojector]";;
 
-  sys_error (ERR_WARNING, os.str().c_str());
+  sys_error (ERR_WARNING, os.str().c_str());\r
+#endif
 }
 
 
 }
 
 
index 2123c29f0fe6b9b6a63d141b3cb52efaa685e057..3ff8b0874c4f59ceda261dc5aef59fefc0144fec 100644 (file)
@@ -14,7 +14,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: clip.cpp,v 1.5 2000/12/06 01:46:43 kevin Exp $
+**  $Id: clip.cpp,v 1.6 2000/12/06 15:17:51 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
 **
 **  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
@@ -42,7 +42,7 @@
  *    double u,v               Dimensions of segment
  */
 
  *    double u,v               Dimensions of segment
  */
 
-int 
+bool
 clip_segment (double& x1, double& y1, double& x2, double& y2, const double u, const double v)
 {
   double xc1 = x1 * u;
 clip_segment (double& x1, double& y1, double& x2, double& y2, const double u, const double v)
 {
   double xc1 = x1 * u;
@@ -88,7 +88,7 @@ clip_segment (double& x1, double& y1, double& x2, double& y2, const double u, co
  *    double u,v               Size of sector
  */
 
  *    double u,v               Size of sector
  */
 
-int 
+bool 
 clip_sector (double& x1, double& y1, double& x2, double& y2, const double u, const double v)
 {
   double xc1 = x1 * u;
 clip_sector (double& x1, double& y1, double& x2, double& y2, const double u, const double v)
 {
   double xc1 = x1 * u;
@@ -124,7 +124,7 @@ clip_sector (double& x1, double& y1, double& x2, double& y2, const double u, con
  *    double t1,t2             Starting & stopping angles of clipping
  */
 
  *    double t1,t2             Starting & stopping angles of clipping
  */
 
-int 
+bool 
 clip_circle (double& x1, double& y1, double& x2, double& y2, const double cx, const double cy, const double radius, double t1, double t2)
 {
   double xc1 = x1;
 clip_circle (double& x1, double& y1, double& x2, double& y2, const double cx, const double cy, const double radius, double t1, double t2)
 {
   double xc1 = x1;
@@ -241,7 +241,7 @@ clip_circle (double& x1, double& y1, double& x2, double& y2, const double cx, co
 
 static int tcode (const double x, const double y, const double m, const double b, const int clip_xaxis);
 
 
 static int tcode (const double x, const double y, const double m, const double b, const int clip_xaxis);
 
-int 
+bool 
 clip_triangle (double& x1, double& y1, double& x2, double& y2, const double u, const double v, const int clip_xaxis)
 {
   double m = v / u;     // slope of triangle lines
 clip_triangle (double& x1, double& y1, double& x2, double& y2, const double u, const double v, const int clip_xaxis)
 {
   double m = v / u;     // slope of triangle lines