MSVC compile fixes.
authorMichael Goffioul <michael.goffioul@gmail.com>
Fri Jun 20 12:41:23 2008 +0200 (20 months ago)
changeset 8a15e56860500
parent 7ba09dc8495f3
child 9c07d1b2ea194
MSVC compile fixes.
msvc_compile_fix
series
       1 --- a/series	Sat Jun 14 12:22:58 2008 +0200
       2 +++ b/series	Fri Jun 20 12:41:23 2008 +0200
       3 @@ -1,2 +1,3 @@
       4  mkoctfile_cpp
       5  mkoctfile_cpp_cleanup_o_files
       6 +msvc_compile_fix
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/msvc_compile_fix	Fri Jun 20 12:41:23 2008 +0200
     1.3 @@ -0,0 +1,306 @@
     1.4 +Various compilation fixes for MSVC.
     1.5 +
     1.6 +diff -r 7683fa6c06a2 ChangeLog
     1.7 +--- a/ChangeLog	Mon Feb 11 10:11:56 2008 +0100
     1.8 ++++ b/ChangeLog	Fri Jun 20 12:40:26 2008 +0200
     1.9 +@@ -1,3 +1,8 @@
    1.10 ++2008-06-20  Michael Goffioul <michael.goffioul@gmail.com>
    1.11 ++
    1.12 ++	* Makeconf.in: Add GRAPHICS_CFLAGS substitution.
    1.13 ++	* configure.in: Add checks for hypotf and _hypotf.
    1.14 ++
    1.15 + 2008-06-12  Jaroslav Hajek <highegg@gmail.com>
    1.16 + 
    1.17 + 	* configure.in: Move LIBS and CXXFLAGS restoration into
    1.18 +diff -r 7683fa6c06a2 Makeconf.in
    1.19 +--- a/Makeconf.in	Mon Feb 11 10:11:56 2008 +0100
    1.20 ++++ b/Makeconf.in	Fri Jun 20 12:40:26 2008 +0200
    1.21 +@@ -170,6 +170,8 @@
    1.22 + ifeq ($(INCLUDE_DEPS),false)
    1.23 +   omit_deps = true;
    1.24 + endif
    1.25 ++
    1.26 ++GRAPHICS_CFLAGS = @GRAPHICS_CFLAGS@
    1.27 + 
    1.28 + CXX = @CXX@
    1.29 + CXX_VERSION = @CXX_VERSION@
    1.30 +diff -r 7683fa6c06a2 configure.in
    1.31 +--- a/configure.in	Mon Feb 11 10:11:56 2008 +0100
    1.32 ++++ b/configure.in	Fri Jun 20 12:40:26 2008 +0200
    1.33 +@@ -1644,6 +1644,7 @@
    1.34 + ### Check for nonstandard but common math functions that we need.
    1.35 + 
    1.36 + AC_CHECK_FUNCS(acosh acoshf asinh asinhf atanh atanhf erf erff erfc erfcf exp2 exp2f log2 log2f)
    1.37 ++AC_CHECK_FUNCS(hypotf _hypotf)
    1.38 + 
    1.39 + ### Checks for OS specific cruft.
    1.40 + 
    1.41 +diff -r 7683fa6c06a2 liboctave/ChangeLog
    1.42 +--- a/liboctave/ChangeLog	Mon Feb 11 10:11:56 2008 +0100
    1.43 ++++ b/liboctave/ChangeLog	Fri Jun 20 12:40:27 2008 +0200
    1.44 +@@ -1,3 +1,8 @@
    1.45 ++2008-06-20  Michael Goffioul  <michael.goffioul@gmail.com>
    1.46 ++
    1.47 ++	* lo-specfun.h: Fix typo in erff/erfcf declaration.
    1.48 ++	* lo-specfun.cc: Ditto. Add atanhf implementation.
    1.49 ++
    1.50 + 2008-06-13  Michael Goffioul  <michael.goffioul@gmail.com>
    1.51 + 
    1.52 + 	* lo-mappers.cc (arg): Remove ambiguity about atan2(float,float) usage.
    1.53 +diff -r 7683fa6c06a2 liboctave/lo-specfun.cc
    1.54 +--- a/liboctave/lo-specfun.cc	Mon Feb 11 10:11:56 2008 +0100
    1.55 ++++ b/liboctave/lo-specfun.cc	Fri Jun 20 12:40:27 2008 +0200
    1.56 +@@ -224,6 +224,16 @@
    1.57 + }
    1.58 + #endif
    1.59 + 
    1.60 ++#if !defined (HAVE_ATANHF)
    1.61 ++float
    1.62 ++atanhf (float x)
    1.63 ++{
    1.64 ++  float retval;
    1.65 ++  F77_XFCN (xatanh, XATANH, (x, retval));
    1.66 ++  return retval;
    1.67 ++}
    1.68 ++#endif
    1.69 ++
    1.70 + #if !defined (HAVE_ERF)
    1.71 + double
    1.72 + erf (double x)
    1.73 +@@ -236,7 +246,7 @@
    1.74 + 
    1.75 + #if !defined (HAVE_ERFF)
    1.76 + float
    1.77 +-erf (float x)
    1.78 ++erff (float x)
    1.79 + {
    1.80 +   float retval;
    1.81 +   F77_XFCN (xerf, XERF, (x, retval));
    1.82 +@@ -256,7 +266,7 @@
    1.83 + 
    1.84 + #if !defined (HAVE_ERFCF)
    1.85 + float
    1.86 +-erfc (float x)
    1.87 ++erfcf (float x)
    1.88 + {
    1.89 +   float retval;
    1.90 +   F77_XFCN (xerfc, XERFC, (x, retval));
    1.91 +diff -r 7683fa6c06a2 liboctave/lo-specfun.h
    1.92 +--- a/liboctave/lo-specfun.h	Mon Feb 11 10:11:56 2008 +0100
    1.93 ++++ b/liboctave/lo-specfun.h	Fri Jun 20 12:40:27 2008 +0200
    1.94 +@@ -76,11 +76,11 @@
    1.95 + #endif
    1.96 + 
    1.97 + #if !defined (HAVE_ERFF)
    1.98 +-extern OCTAVE_API float erf (float);
    1.99 ++extern OCTAVE_API float erff (float);
   1.100 + #endif
   1.101 + 
   1.102 + #if !defined (HAVE_ERFCF)
   1.103 +-extern OCTAVE_API float erfc (float);
   1.104 ++extern OCTAVE_API float erfcf (float);
   1.105 + #endif
   1.106 + 
   1.107 + #if !defined (HAVE_EXPM1)
   1.108 +diff -r 7683fa6c06a2 src/ChangeLog
   1.109 +--- a/src/ChangeLog	Mon Feb 11 10:11:56 2008 +0100
   1.110 ++++ b/src/ChangeLog	Fri Jun 20 12:40:27 2008 +0200
   1.111 +@@ -1,3 +1,13 @@
   1.112 ++2008-06-20  Michael Goffioul  <michael.goffioul@gmail.com>
   1.113 ++
   1.114 ++	* Makefile.in: Add OPENGL_LIBS to liboctinterp link command. Add
   1.115 ++	GRAPHICS_CFLAGS to fltk_backend.cc compilation command.
   1.116 ++	* data.cc: Define hypotf to _hypotf when not present.
   1.117 ++	* gl-render.h: Replace OCTGRAPHICS_API with OCTINTERP_API.
   1.118 ++	* gl-render.cc: Get rid of Array2<vertex_data>.
   1.119 ++	* OPERATORS/op-int.h: Force the use of "pow" on double when invoked
   1.120 ++	with float arguments.
   1.121 ++
   1.122 + 2008-06-17  John W. Eaton  <jwe@octave.org>
   1.123 + 
   1.124 + 	* toplev.h, toplev.cc (class octave_call_stack):
   1.125 +diff -r 7683fa6c06a2 src/Makefile.in
   1.126 +--- a/src/Makefile.in	Mon Feb 11 10:11:56 2008 +0100
   1.127 ++++ b/src/Makefile.in	Fri Jun 20 12:40:27 2008 +0200
   1.128 +@@ -275,7 +275,8 @@
   1.129 + endif
   1.130 + 
   1.131 + OCTINTERP_LINK_DEPS = \
   1.132 +-  -L../liboctave $(LIBOCTAVE) -L../libcruft $(LIBCRUFT) $(LIBS) $(FLIBS)
   1.133 ++  -L../liboctave $(LIBOCTAVE) -L../libcruft $(LIBCRUFT) $(LIBS) $(FLIBS) \
   1.134 ++  $(OPENGL_LIBS)
   1.135 + 
   1.136 + OCT_LINK_DEPS = \
   1.137 +   -L../libcruft $(LIBCRUFT) -L../liboctave $(LIBOCTAVE) \
   1.138 +@@ -302,6 +303,9 @@
   1.139 + 
   1.140 + $(DLD_PICOBJ): \
   1.141 + 	ALL_CXXFLAGS := $(filter-out $(DLL_CXXDEFS), $(ALL_CXXFLAGS))
   1.142 ++
   1.143 ++fltk_backend.o pic/fltk_backend.o: \
   1.144 ++	ALL_CXXFLAGS := $(filter-out $(DLL_CXXDEFS), $(ALL_CXXFLAGS) $(GRAPHICS_CFLAGS))
   1.145 + 
   1.146 + XERBLA = ../libcruft/blas-xtra/xerbla.o
   1.147 + ifdef FPICFLAG
   1.148 +diff -r 7683fa6c06a2 src/OPERATORS/op-int.h
   1.149 +--- a/src/OPERATORS/op-int.h	Mon Feb 11 10:11:56 2008 +0100
   1.150 ++++ b/src/OPERATORS/op-int.h	Fri Jun 20 12:40:27 2008 +0200
   1.151 +@@ -227,13 +227,13 @@
   1.152 +   octave_value \
   1.153 +   xpow (const octave_ ## T1& a, float b) \
   1.154 +   { \
   1.155 +-    return pow (a, b); \
   1.156 ++    return pow (a, static_cast<double> (b)); \
   1.157 +   } \
   1.158 +  \
   1.159 +   octave_value \
   1.160 +   xpow (float a, const octave_ ## T1& b) \
   1.161 +   { \
   1.162 +-    return pow (a, b); \
   1.163 ++    return pow (static_cast<double> (a), b); \
   1.164 +   }
   1.165 + 
   1.166 + #define OCTAVE_SS_INT_OPS(TYPE) \
   1.167 +@@ -360,7 +360,7 @@
   1.168 +     for (int i = 0; i < b.length (); i++) \
   1.169 +       { \
   1.170 + 	OCTAVE_QUIT; \
   1.171 +-	result (i) = pow (a, b(i)); \
   1.172 ++	result (i) = pow (a, static_cast<double> (b(i))); \
   1.173 +       } \
   1.174 +     return octave_value (result); \
   1.175 +   } \
   1.176 +@@ -372,7 +372,7 @@
   1.177 +     for (int i = 0; i < b.length (); i++) \
   1.178 +       { \
   1.179 + 	OCTAVE_QUIT; \
   1.180 +-	result (i) = pow (a, b(i)); \
   1.181 ++	result (i) = pow (static_cast<double> (a), b(i)); \
   1.182 +       } \
   1.183 +     return octave_value (result); \
   1.184 +   }
   1.185 +@@ -512,7 +512,7 @@
   1.186 +   for (int i = 0; i < a.length (); i++) \
   1.187 +     { \
   1.188 +       OCTAVE_QUIT; \
   1.189 +-      result (i) = pow (a(i), b);		\
   1.190 ++      result (i) = pow (a(i), static_cast<double> (b));		\
   1.191 +     } \
   1.192 +   return octave_value (result); \
   1.193 + } \
   1.194 +@@ -523,7 +523,7 @@
   1.195 +   for (int i = 0; i < a.length (); i++) \
   1.196 +     { \
   1.197 +       OCTAVE_QUIT; \
   1.198 +-      result (i) = pow (a(i), b);		\
   1.199 ++      result (i) = pow (static_cast<double> (a(i)), b);		\
   1.200 +     } \
   1.201 +   return octave_value (result); \
   1.202 + }
   1.203 +@@ -690,7 +690,7 @@
   1.204 +     for (int i = 0; i < a.length (); i++) \
   1.205 +       { \
   1.206 + 	OCTAVE_QUIT; \
   1.207 +-	result (i) = pow (a(i), b(i)); \
   1.208 ++	result (i) = pow (a(i), static_cast<double> (b(i))); \
   1.209 +       } \
   1.210 +     return octave_value (result); \
   1.211 +   } \
   1.212 +@@ -709,7 +709,7 @@
   1.213 +     for (int i = 0; i < a.length (); i++) \
   1.214 +       { \
   1.215 + 	OCTAVE_QUIT; \
   1.216 +-	result (i) = pow (a(i), b(i)); \
   1.217 ++	result (i) = pow (static_cast<double> (a(i)), b(i)); \
   1.218 +       } \
   1.219 +     return octave_value (result); \
   1.220 +   }
   1.221 +diff -r 7683fa6c06a2 src/data.cc
   1.222 +--- a/src/data.cc	Mon Feb 11 10:11:56 2008 +0100
   1.223 ++++ b/src/data.cc	Fri Jun 20 12:40:27 2008 +0200
   1.224 +@@ -62,6 +62,11 @@
   1.225 + #include "utils.h"
   1.226 + #include "variables.h"
   1.227 + #include "pager.h"
   1.228 ++
   1.229 ++#if ! defined (HAVE_HYPOTF) && defined (HAVE__HYPOTF)
   1.230 ++#define hypotf _hypotf
   1.231 ++#define HAVE_HYPOTF 1
   1.232 ++#endif
   1.233 + 
   1.234 + #define ANY_ALL(FCN) \
   1.235 +  \
   1.236 +diff -r 7683fa6c06a2 src/gl-render.cc
   1.237 +--- a/src/gl-render.cc	Mon Feb 11 10:11:56 2008 +0100
   1.238 ++++ b/src/gl-render.cc	Fri Jun 20 12:40:27 2008 +0200
   1.239 +@@ -380,8 +380,6 @@
   1.240 + 
   1.241 +   vertex_data_rep *get_rep (void) const { return rep; }
   1.242 + };
   1.243 +-
   1.244 +-#include <Array.cc>
   1.245 + 
   1.246 + class
   1.247 + opengl_renderer::patch_tesselator : public opengl_tesselator
   1.248 +@@ -2283,7 +2281,8 @@
   1.249 +       has_facealpha = ((a.numel () > 0) && (a.rows () == f.rows ()));
   1.250 +     }
   1.251 + 
   1.252 +-  Array2<vertex_data> vdata (f.dims ());
   1.253 ++  octave_idx_type fr = f.rows (), fc = f.columns ();
   1.254 ++  std::vector<vertex_data> vdata (f.numel ());
   1.255 + 
   1.256 +   for (int i = 0; i < nf; i++)
   1.257 +     for (int j = 0; j < count_f(i); j++)
   1.258 +@@ -2316,7 +2315,7 @@
   1.259 + 	      aa = a(idx);
   1.260 + 	  }
   1.261 + 
   1.262 +-	vdata(i,j) =
   1.263 ++	vdata[i+j*fr] =
   1.264 + 	    vertex_data (vv, cc, nn, aa, as, ds, ss, se);
   1.265 +       }
   1.266 + 
   1.267 +@@ -2366,7 +2365,7 @@
   1.268 + 
   1.269 + 	      for (int j = 0; j < count_f(i); j++)
   1.270 + 		{
   1.271 +-		  vertex_data::vertex_data_rep *vv = vdata(i,j).get_rep ();
   1.272 ++		  vertex_data::vertex_data_rep *vv = vdata[i+j*fr].get_rep ();
   1.273 + 	
   1.274 + 		  tess.add_vertex (vv->coords.fortran_vec (), vv);
   1.275 + 		}
   1.276 +@@ -2426,7 +2425,7 @@
   1.277 + 
   1.278 + 	      for (int j = 0; j < count_f(i); j++)
   1.279 + 		{
   1.280 +-		  vertex_data::vertex_data_rep *vv = vdata(i,j).get_rep ();
   1.281 ++		  vertex_data::vertex_data_rep *vv = vdata[i+j*fr].get_rep ();
   1.282 + 	
   1.283 + 		  tess.add_vertex (vv->coords.fortran_vec (), vv);
   1.284 + 		}
   1.285 +@@ -2481,10 +2480,10 @@
   1.286 + 	      continue;
   1.287 + 
   1.288 + 	    Matrix lc = (do_edge ? (mecolor.numel () == 0 ?
   1.289 +-				    vdata(i,j).get_rep ()->color : mecolor)
   1.290 ++				    vdata[i+j*fr].get_rep ()->color : mecolor)
   1.291 + 			 : Matrix ());
   1.292 + 	    Matrix fc = (do_face ? (mfcolor.numel () == 0 ?
   1.293 +-				    vdata(i,j).get_rep ()->color : mfcolor)
   1.294 ++				    vdata[i+j*fr].get_rep ()->color : mfcolor)
   1.295 + 			 : Matrix ());
   1.296 + 
   1.297 + 	    draw_marker (v(idx,0), v(idx,1), (has_z ? v(idx,2) : 0), lc, fc);
   1.298 +diff -r 7683fa6c06a2 src/gl-render.h
   1.299 +--- a/src/gl-render.h	Mon Feb 11 10:11:56 2008 +0100
   1.300 ++++ b/src/gl-render.h	Fri Jun 20 12:40:27 2008 +0200
   1.301 +@@ -35,7 +35,7 @@
   1.302 + #include "graphics.h"
   1.303 + 
   1.304 + class
   1.305 +-OCTGRAPHICS_API
   1.306 ++OCTINTERP_API
   1.307 + opengl_renderer
   1.308 + {
   1.309 + public: