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