msvc_compile_fix
author Michael Goffioul <michael.goffioul@gmail.com>
Fri Jun 20 12:41:23 2008 +0200 (2008-06-20)
changeset 8 a15e56860500
child 16 dee7d0e2ff50
permissions -rw-r--r--
MSVC compile fixes.
michael@8
     1
Various compilation fixes for MSVC.
michael@8
     2
michael@8
     3
diff -r 7683fa6c06a2 ChangeLog
michael@8
     4
--- a/ChangeLog	Mon Feb 11 10:11:56 2008 +0100
michael@8
     5
+++ b/ChangeLog	Fri Jun 20 12:40:26 2008 +0200
michael@8
     6
@@ -1,3 +1,8 @@
michael@8
     7
+2008-06-20  Michael Goffioul <michael.goffioul@gmail.com>
michael@8
     8
+
michael@8
     9
+	* Makeconf.in: Add GRAPHICS_CFLAGS substitution.
michael@8
    10
+	* configure.in: Add checks for hypotf and _hypotf.
michael@8
    11
+
michael@8
    12
 2008-06-12  Jaroslav Hajek <highegg@gmail.com>
michael@8
    13
 
michael@8
    14
 	* configure.in: Move LIBS and CXXFLAGS restoration into
michael@8
    15
diff -r 7683fa6c06a2 Makeconf.in
michael@8
    16
--- a/Makeconf.in	Mon Feb 11 10:11:56 2008 +0100
michael@8
    17
+++ b/Makeconf.in	Fri Jun 20 12:40:26 2008 +0200
michael@8
    18
@@ -170,6 +170,8 @@
michael@8
    19
 ifeq ($(INCLUDE_DEPS),false)
michael@8
    20
   omit_deps = true;
michael@8
    21
 endif
michael@8
    22
+
michael@8
    23
+GRAPHICS_CFLAGS = @GRAPHICS_CFLAGS@
michael@8
    24
 
michael@8
    25
 CXX = @CXX@
michael@8
    26
 CXX_VERSION = @CXX_VERSION@
michael@8
    27
diff -r 7683fa6c06a2 configure.in
michael@8
    28
--- a/configure.in	Mon Feb 11 10:11:56 2008 +0100
michael@8
    29
+++ b/configure.in	Fri Jun 20 12:40:26 2008 +0200
michael@8
    30
@@ -1644,6 +1644,7 @@
michael@8
    31
 ### Check for nonstandard but common math functions that we need.
michael@8
    32
 
michael@8
    33
 AC_CHECK_FUNCS(acosh acoshf asinh asinhf atanh atanhf erf erff erfc erfcf exp2 exp2f log2 log2f)
michael@8
    34
+AC_CHECK_FUNCS(hypotf _hypotf)
michael@8
    35
 
michael@8
    36
 ### Checks for OS specific cruft.
michael@8
    37
 
michael@8
    38
diff -r 7683fa6c06a2 liboctave/ChangeLog
michael@8
    39
--- a/liboctave/ChangeLog	Mon Feb 11 10:11:56 2008 +0100
michael@8
    40
+++ b/liboctave/ChangeLog	Fri Jun 20 12:40:27 2008 +0200
michael@8
    41
@@ -1,3 +1,8 @@
michael@8
    42
+2008-06-20  Michael Goffioul  <michael.goffioul@gmail.com>
michael@8
    43
+
michael@8
    44
+	* lo-specfun.h: Fix typo in erff/erfcf declaration.
michael@8
    45
+	* lo-specfun.cc: Ditto. Add atanhf implementation.
michael@8
    46
+
michael@8
    47
 2008-06-13  Michael Goffioul  <michael.goffioul@gmail.com>
michael@8
    48
 
michael@8
    49
 	* lo-mappers.cc (arg): Remove ambiguity about atan2(float,float) usage.
michael@8
    50
diff -r 7683fa6c06a2 liboctave/lo-specfun.cc
michael@8
    51
--- a/liboctave/lo-specfun.cc	Mon Feb 11 10:11:56 2008 +0100
michael@8
    52
+++ b/liboctave/lo-specfun.cc	Fri Jun 20 12:40:27 2008 +0200
michael@8
    53
@@ -224,6 +224,16 @@
michael@8
    54
 }
michael@8
    55
 #endif
michael@8
    56
 
michael@8
    57
+#if !defined (HAVE_ATANHF)
michael@8
    58
+float
michael@8
    59
+atanhf (float x)
michael@8
    60
+{
michael@8
    61
+  float retval;
michael@8
    62
+  F77_XFCN (xatanh, XATANH, (x, retval));
michael@8
    63
+  return retval;
michael@8
    64
+}
michael@8
    65
+#endif
michael@8
    66
+
michael@8
    67
 #if !defined (HAVE_ERF)
michael@8
    68
 double
michael@8
    69
 erf (double x)
michael@8
    70
@@ -236,7 +246,7 @@
michael@8
    71
 
michael@8
    72
 #if !defined (HAVE_ERFF)
michael@8
    73
 float
michael@8
    74
-erf (float x)
michael@8
    75
+erff (float x)
michael@8
    76
 {
michael@8
    77
   float retval;
michael@8
    78
   F77_XFCN (xerf, XERF, (x, retval));
michael@8
    79
@@ -256,7 +266,7 @@
michael@8
    80
 
michael@8
    81
 #if !defined (HAVE_ERFCF)
michael@8
    82
 float
michael@8
    83
-erfc (float x)
michael@8
    84
+erfcf (float x)
michael@8
    85
 {
michael@8
    86
   float retval;
michael@8
    87
   F77_XFCN (xerfc, XERFC, (x, retval));
michael@8
    88
diff -r 7683fa6c06a2 liboctave/lo-specfun.h
michael@8
    89
--- a/liboctave/lo-specfun.h	Mon Feb 11 10:11:56 2008 +0100
michael@8
    90
+++ b/liboctave/lo-specfun.h	Fri Jun 20 12:40:27 2008 +0200
michael@8
    91
@@ -76,11 +76,11 @@
michael@8
    92
 #endif
michael@8
    93
 
michael@8
    94
 #if !defined (HAVE_ERFF)
michael@8
    95
-extern OCTAVE_API float erf (float);
michael@8
    96
+extern OCTAVE_API float erff (float);
michael@8
    97
 #endif
michael@8
    98
 
michael@8
    99
 #if !defined (HAVE_ERFCF)
michael@8
   100
-extern OCTAVE_API float erfc (float);
michael@8
   101
+extern OCTAVE_API float erfcf (float);
michael@8
   102
 #endif
michael@8
   103
 
michael@8
   104
 #if !defined (HAVE_EXPM1)
michael@8
   105
diff -r 7683fa6c06a2 src/ChangeLog
michael@8
   106
--- a/src/ChangeLog	Mon Feb 11 10:11:56 2008 +0100
michael@8
   107
+++ b/src/ChangeLog	Fri Jun 20 12:40:27 2008 +0200
michael@8
   108
@@ -1,3 +1,13 @@
michael@8
   109
+2008-06-20  Michael Goffioul  <michael.goffioul@gmail.com>
michael@8
   110
+
michael@8
   111
+	* Makefile.in: Add OPENGL_LIBS to liboctinterp link command. Add
michael@8
   112
+	GRAPHICS_CFLAGS to fltk_backend.cc compilation command.
michael@8
   113
+	* data.cc: Define hypotf to _hypotf when not present.
michael@8
   114
+	* gl-render.h: Replace OCTGRAPHICS_API with OCTINTERP_API.
michael@8
   115
+	* gl-render.cc: Get rid of Array2<vertex_data>.
michael@8
   116
+	* OPERATORS/op-int.h: Force the use of "pow" on double when invoked
michael@8
   117
+	with float arguments.
michael@8
   118
+
michael@8
   119
 2008-06-17  John W. Eaton  <jwe@octave.org>
michael@8
   120
 
michael@8
   121
 	* toplev.h, toplev.cc (class octave_call_stack):
michael@8
   122
diff -r 7683fa6c06a2 src/Makefile.in
michael@8
   123
--- a/src/Makefile.in	Mon Feb 11 10:11:56 2008 +0100
michael@8
   124
+++ b/src/Makefile.in	Fri Jun 20 12:40:27 2008 +0200
michael@8
   125
@@ -275,7 +275,8 @@
michael@8
   126
 endif
michael@8
   127
 
michael@8
   128
 OCTINTERP_LINK_DEPS = \
michael@8
   129
-  -L../liboctave $(LIBOCTAVE) -L../libcruft $(LIBCRUFT) $(LIBS) $(FLIBS)
michael@8
   130
+  -L../liboctave $(LIBOCTAVE) -L../libcruft $(LIBCRUFT) $(LIBS) $(FLIBS) \
michael@8
   131
+  $(OPENGL_LIBS)
michael@8
   132
 
michael@8
   133
 OCT_LINK_DEPS = \
michael@8
   134
   -L../libcruft $(LIBCRUFT) -L../liboctave $(LIBOCTAVE) \
michael@8
   135
@@ -302,6 +303,9 @@
michael@8
   136
 
michael@8
   137
 $(DLD_PICOBJ): \
michael@8
   138
 	ALL_CXXFLAGS := $(filter-out $(DLL_CXXDEFS), $(ALL_CXXFLAGS))
michael@8
   139
+
michael@8
   140
+fltk_backend.o pic/fltk_backend.o: \
michael@8
   141
+	ALL_CXXFLAGS := $(filter-out $(DLL_CXXDEFS), $(ALL_CXXFLAGS) $(GRAPHICS_CFLAGS))
michael@8
   142
 
michael@8
   143
 XERBLA = ../libcruft/blas-xtra/xerbla.o
michael@8
   144
 ifdef FPICFLAG
michael@8
   145
diff -r 7683fa6c06a2 src/OPERATORS/op-int.h
michael@8
   146
--- a/src/OPERATORS/op-int.h	Mon Feb 11 10:11:56 2008 +0100
michael@8
   147
+++ b/src/OPERATORS/op-int.h	Fri Jun 20 12:40:27 2008 +0200
michael@8
   148
@@ -227,13 +227,13 @@
michael@8
   149
   octave_value \
michael@8
   150
   xpow (const octave_ ## T1& a, float b) \
michael@8
   151
   { \
michael@8
   152
-    return pow (a, b); \
michael@8
   153
+    return pow (a, static_cast<double> (b)); \
michael@8
   154
   } \
michael@8
   155
  \
michael@8
   156
   octave_value \
michael@8
   157
   xpow (float a, const octave_ ## T1& b) \
michael@8
   158
   { \
michael@8
   159
-    return pow (a, b); \
michael@8
   160
+    return pow (static_cast<double> (a), b); \
michael@8
   161
   }
michael@8
   162
 
michael@8
   163
 #define OCTAVE_SS_INT_OPS(TYPE) \
michael@8
   164
@@ -360,7 +360,7 @@
michael@8
   165
     for (int i = 0; i < b.length (); i++) \
michael@8
   166
       { \
michael@8
   167
 	OCTAVE_QUIT; \
michael@8
   168
-	result (i) = pow (a, b(i)); \
michael@8
   169
+	result (i) = pow (a, static_cast<double> (b(i))); \
michael@8
   170
       } \
michael@8
   171
     return octave_value (result); \
michael@8
   172
   } \
michael@8
   173
@@ -372,7 +372,7 @@
michael@8
   174
     for (int i = 0; i < b.length (); i++) \
michael@8
   175
       { \
michael@8
   176
 	OCTAVE_QUIT; \
michael@8
   177
-	result (i) = pow (a, b(i)); \
michael@8
   178
+	result (i) = pow (static_cast<double> (a), b(i)); \
michael@8
   179
       } \
michael@8
   180
     return octave_value (result); \
michael@8
   181
   }
michael@8
   182
@@ -512,7 +512,7 @@
michael@8
   183
   for (int i = 0; i < a.length (); i++) \
michael@8
   184
     { \
michael@8
   185
       OCTAVE_QUIT; \
michael@8
   186
-      result (i) = pow (a(i), b);		\
michael@8
   187
+      result (i) = pow (a(i), static_cast<double> (b));		\
michael@8
   188
     } \
michael@8
   189
   return octave_value (result); \
michael@8
   190
 } \
michael@8
   191
@@ -523,7 +523,7 @@
michael@8
   192
   for (int i = 0; i < a.length (); i++) \
michael@8
   193
     { \
michael@8
   194
       OCTAVE_QUIT; \
michael@8
   195
-      result (i) = pow (a(i), b);		\
michael@8
   196
+      result (i) = pow (static_cast<double> (a(i)), b);		\
michael@8
   197
     } \
michael@8
   198
   return octave_value (result); \
michael@8
   199
 }
michael@8
   200
@@ -690,7 +690,7 @@
michael@8
   201
     for (int i = 0; i < a.length (); i++) \
michael@8
   202
       { \
michael@8
   203
 	OCTAVE_QUIT; \
michael@8
   204
-	result (i) = pow (a(i), b(i)); \
michael@8
   205
+	result (i) = pow (a(i), static_cast<double> (b(i))); \
michael@8
   206
       } \
michael@8
   207
     return octave_value (result); \
michael@8
   208
   } \
michael@8
   209
@@ -709,7 +709,7 @@
michael@8
   210
     for (int i = 0; i < a.length (); i++) \
michael@8
   211
       { \
michael@8
   212
 	OCTAVE_QUIT; \
michael@8
   213
-	result (i) = pow (a(i), b(i)); \
michael@8
   214
+	result (i) = pow (static_cast<double> (a(i)), b(i)); \
michael@8
   215
       } \
michael@8
   216
     return octave_value (result); \
michael@8
   217
   }
michael@8
   218
diff -r 7683fa6c06a2 src/data.cc
michael@8
   219
--- a/src/data.cc	Mon Feb 11 10:11:56 2008 +0100
michael@8
   220
+++ b/src/data.cc	Fri Jun 20 12:40:27 2008 +0200
michael@8
   221
@@ -62,6 +62,11 @@
michael@8
   222
 #include "utils.h"
michael@8
   223
 #include "variables.h"
michael@8
   224
 #include "pager.h"
michael@8
   225
+
michael@8
   226
+#if ! defined (HAVE_HYPOTF) && defined (HAVE__HYPOTF)
michael@8
   227
+#define hypotf _hypotf
michael@8
   228
+#define HAVE_HYPOTF 1
michael@8
   229
+#endif
michael@8
   230
 
michael@8
   231
 #define ANY_ALL(FCN) \
michael@8
   232
  \
michael@8
   233
diff -r 7683fa6c06a2 src/gl-render.cc
michael@8
   234
--- a/src/gl-render.cc	Mon Feb 11 10:11:56 2008 +0100
michael@8
   235
+++ b/src/gl-render.cc	Fri Jun 20 12:40:27 2008 +0200
michael@8
   236
@@ -380,8 +380,6 @@
michael@8
   237
 
michael@8
   238
   vertex_data_rep *get_rep (void) const { return rep; }
michael@8
   239
 };
michael@8
   240
-
michael@8
   241
-#include <Array.cc>
michael@8
   242
 
michael@8
   243
 class
michael@8
   244
 opengl_renderer::patch_tesselator : public opengl_tesselator
michael@8
   245
@@ -2283,7 +2281,8 @@
michael@8
   246
       has_facealpha = ((a.numel () > 0) && (a.rows () == f.rows ()));
michael@8
   247
     }
michael@8
   248
 
michael@8
   249
-  Array2<vertex_data> vdata (f.dims ());
michael@8
   250
+  octave_idx_type fr = f.rows (), fc = f.columns ();
michael@8
   251
+  std::vector<vertex_data> vdata (f.numel ());
michael@8
   252
 
michael@8
   253
   for (int i = 0; i < nf; i++)
michael@8
   254
     for (int j = 0; j < count_f(i); j++)
michael@8
   255
@@ -2316,7 +2315,7 @@
michael@8
   256
 	      aa = a(idx);
michael@8
   257
 	  }
michael@8
   258
 
michael@8
   259
-	vdata(i,j) =
michael@8
   260
+	vdata[i+j*fr] =
michael@8
   261
 	    vertex_data (vv, cc, nn, aa, as, ds, ss, se);
michael@8
   262
       }
michael@8
   263
 
michael@8
   264
@@ -2366,7 +2365,7 @@
michael@8
   265
 
michael@8
   266
 	      for (int j = 0; j < count_f(i); j++)
michael@8
   267
 		{
michael@8
   268
-		  vertex_data::vertex_data_rep *vv = vdata(i,j).get_rep ();
michael@8
   269
+		  vertex_data::vertex_data_rep *vv = vdata[i+j*fr].get_rep ();
michael@8
   270
 	
michael@8
   271
 		  tess.add_vertex (vv->coords.fortran_vec (), vv);
michael@8
   272
 		}
michael@8
   273
@@ -2426,7 +2425,7 @@
michael@8
   274
 
michael@8
   275
 	      for (int j = 0; j < count_f(i); j++)
michael@8
   276
 		{
michael@8
   277
-		  vertex_data::vertex_data_rep *vv = vdata(i,j).get_rep ();
michael@8
   278
+		  vertex_data::vertex_data_rep *vv = vdata[i+j*fr].get_rep ();
michael@8
   279
 	
michael@8
   280
 		  tess.add_vertex (vv->coords.fortran_vec (), vv);
michael@8
   281
 		}
michael@8
   282
@@ -2481,10 +2480,10 @@
michael@8
   283
 	      continue;
michael@8
   284
 
michael@8
   285
 	    Matrix lc = (do_edge ? (mecolor.numel () == 0 ?
michael@8
   286
-				    vdata(i,j).get_rep ()->color : mecolor)
michael@8
   287
+				    vdata[i+j*fr].get_rep ()->color : mecolor)
michael@8
   288
 			 : Matrix ());
michael@8
   289
 	    Matrix fc = (do_face ? (mfcolor.numel () == 0 ?
michael@8
   290
-				    vdata(i,j).get_rep ()->color : mfcolor)
michael@8
   291
+				    vdata[i+j*fr].get_rep ()->color : mfcolor)
michael@8
   292
 			 : Matrix ());
michael@8
   293
 
michael@8
   294
 	    draw_marker (v(idx,0), v(idx,1), (has_z ? v(idx,2) : 0), lc, fc);
michael@8
   295
diff -r 7683fa6c06a2 src/gl-render.h
michael@8
   296
--- a/src/gl-render.h	Mon Feb 11 10:11:56 2008 +0100
michael@8
   297
+++ b/src/gl-render.h	Fri Jun 20 12:40:27 2008 +0200
michael@8
   298
@@ -35,7 +35,7 @@
michael@8
   299
 #include "graphics.h"
michael@8
   300
 
michael@8
   301
 class
michael@8
   302
-OCTGRAPHICS_API
michael@8
   303
+OCTINTERP_API
michael@8
   304
 opengl_renderer
michael@8
   305
 {
michael@8
   306
 public: