Re: Fixing gcc 3.3 compile failures -- fix for math/freefem

2003-07-20 Thread Simon Barner
Hi,

  -ifstream fin( path );
  +std::ifstream fin( path );

 A much smaller patch could be produced with
 
   using namespace std;
 
 as appropriate.
 
 Have you checked with the upstream author to see which approach is
 likely to be rolled into the distribution?

Actually, upgrading the port to the lastest freefem version would have
been enough *doh* :o) (patch attached)

To answer your question: the freefem authors decided not to use the
'using namespace std' approach.

Cheers,
 Simon
--- Makefile.orig   Thu Jun  5 01:41:14 2003
+++ MakefileMon Jul 21 00:42:53 2003
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=  freefem
-PORTVERSION=   3.5.4
+PORTVERSION=   3.5.7
 CATEGORIES=math cad
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=kfem
@@ -24,10 +24,6 @@
 MAN1=  freefem.1
 
 .include bsd.port.pre.mk
-
-.if ${OSVERSION} = 500113
-BROKEN= Does not compile (bad C++ code)
-.endif
 
 post-patch:
@${REINPLACE_CMD} -e 's|-O3 |\$$CXXFLAGS |g' ${WRKSRC}/configure
--- distinfo.orig   Tue Mar 26 17:04:16 2002
+++ distinfoMon Jul 21 00:38:13 2003
@@ -1 +1 @@
-MD5 (freefem-3.5.4.tar.gz) = 746fe6487085011493a805e23507ae30
+MD5 (freefem-3.5.7.tar.gz) = e8f22515ab56f8e79fb789a11f8d4bef


signature.asc
Description: Digital signature


Re: Fixing gcc 3.3 compile failures -- fix for math/freefem

2003-07-19 Thread Jacques A. Vidrine
On Sat, Jul 19, 2003 at 05:05:39AM +0200, Simon Barner wrote:
 --- freefem/fem/femDisk.cpp.orig  Sat Jul 19 04:09:32 2003
 +++ freefem/fem/femDisk.cpp   Sat Jul 19 04:13:43 2003
 @@ -95,7 +95,7 @@
  char *result = 0;
  int dummy;
  
 -ifstream fin( path );
 +std::ifstream fin( path );
  
  if ( fin.fail() )
{
[... 405 lines deleted ...]

A much smaller patch could be produced with

  using namespace std;

as appropriate.

Have you checked with the upstream author to see which approach is
likely to be rolled into the distribution?

Cheers,
-- 
Jacques Vidrine   . NTT/Verio SME  . FreeBSD UNIX   . Heimdal
[EMAIL PROTECTED] . [EMAIL PROTECTED] . [EMAIL PROTECTED] . [EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Fixing gcc 3.3 compile failures -- fix for math/freefem

2003-07-18 Thread Simon Barner
--- freefem/fem/femDisk.cpp.origSat Jul 19 04:09:32 2003
+++ freefem/fem/femDisk.cpp Sat Jul 19 04:13:43 2003
@@ -95,7 +95,7 @@
 char *result = 0;
 int dummy;
 
-ifstream fin( path );
+std::ifstream fin( path );
 
 if ( fin.fail() )
   {
@@ -198,7 +198,7 @@
 int i;
 char *result = NULL;
 
-ofstream fout( path );
+std::ofstream fout( path );
 
 if ( fout.fail() )
   {
@@ -210,11 +210,11 @@
  */
 if ((result = strstr (path,.amdba)) != NULL) /* amdba format */
   {
-   fout  t-getNumberOfPoints() t-getNumberOfCells()  endl;
+   fout  t-getNumberOfPoints() t-getNumberOfCells()  std::endl;
 
for (i = 0; i  t-getNumberOfPoints(); i++)
  {
-   fout  i+1 t-rp[i][0] t-rp[i][1] t-ng[i] 
 endl;
+   fout  i+1 t-rp[i][0] t-rp[i][1] t-ng[i] 
 std::endl;
  }
   
   
@@ -224,13 +224,13 @@
 t-tr[i][0]+1
 t-tr[i][1]+1
 t-tr[i][2]+1
-t-ngt[i]  endl;
+t-ngt[i]  std::endl;
  }
   }
 else if ((result = strstr (path,.am_fmt)) != NULL)/* am_fmt format */
   {
 #if 0
-   fout  t-getNumberOfPoints() t-getNumberOfCells()  endl;
+   fout  t-getNumberOfPoints() t-getNumberOfCells()  std::endl;
   
dummy = 0;
for (i = 0; i  t-getNumberOfCells(); i++)
@@ -238,39 +238,39 @@
fout  t-tr[i][0]+1
 t-tr[i][1]+1
 t-tr[i][2]+1
- endl;
+ std::endl;
END_OF_LINE(data, dummy, 1);
  }
if (dummy) fprintf(data,\n);
dummy = 0;
for (i = 0; i  t-getNumberOfPoints(); i++)
  {
-   fout  t-rp[i][0] t-rp[i][1]  endl;
+   fout  t-rp[i][0] t-rp[i][1]  std::endl;
END_OF_LINE (data, dummy, 1);
  }
if (dummy) fprintf(data,\n);
dummy = 0;
for (i = 0; i  t-getNumberOfCells(); i++)
  {
-   fout  t-ngt[i]  endl;
+   fout  t-ngt[i]  std::endl;
END_OF_LINE (data, dummy, 9);
  }
if (dummy) fprintf(data,\n);
dummy = 0;
for (i = 0; i  t-getNumberOfPoints(); i++)
  {
-   fout  t-ng[i]  endl;
+   fout  t-ng[i]  std::endl;
END_OF_LINE (data, dummy, 9);
  }
 #endif
   }
 else
   {
-   fout  t-getNumberOfPoints() t-getNumberOfCells()  endl;
+   fout  t-getNumberOfPoints() t-getNumberOfCells()  std::endl;
 
for (i = 0; i  t-getNumberOfPoints(); i++)
  {
-   fout  t-rp[i][0] t-rp[i][1] t-ng[i]  endl;
+   fout  t-rp[i][0] t-rp[i][1] t-ng[i]  std::endl;
  }
   
   
@@ -279,7 +279,7 @@
fout  t-tr[i][0]+1
 t-tr[i][1]+1
 t-tr[i][2]+1
-t-ngt[i]  endl;
+t-ngt[i]  std::endl;
  }
   }
 return 0;
@@ -317,9 +317,9 @@
   saveparam (fcts * param, femMesh * t, char *path, int N)
   {
 int k, ns = t-getNumberOfPoints();
-ofstream file (path);
+std::ofstream file (path);
 file.precision (8);
-file  nsN  endl;
+file  nsN  std::endl;
 for (k = 0; k  ns; k++)
   {
if (N == 1)
@@ -373,7 +373,7 @@
file  (param)-nuyy2[k]   ;
file ;
  }
-   file  endl;
+   file  std::endl;
   }
 file.close ();
 return 0;
@@ -383,9 +383,9 @@
   int 
   saveconst (creal f, char *path)
   {
-ofstream file (path, ios::out | ios::app);
-//  file.seekoff(0,ios::end,0);
-file  f  endl;
+std::ofstream file (path, std::ios::out | std::ios::app);
+//  file.seekoff(0,std::ios::end,0);
+file  f  std::endl;
 file.close ();
 return 0;
   }
--- freefem/fem/femGibbs.cpp.orig   Sat Jul 19 04:10:36 2003
+++ freefem/fem/femGibbs.cppSat Jul 19 04:19:02 2003
@@ -38,6 +38,7 @@
 #include math.h
 #include stdio.h
 #include stdlib.h
+#include string.h
 
 //
 // Freefem includes
@@ -1173,9 +1174,9 @@
  {
f = new femPoint[ns];
for (i = 0; i  ns; ++i)
-f[i] = rp[i];
+memcpy (f[i],  rp[i], sizeof (femPoint));
for (i = 0; i  ns; ++i)
-rp[r[i] - 1] = f[i];
+memcpy (rp[r[i] - 1], f[i], sizeof (femPoint));
 
for (j = 0; j  nt; ++j)
 for (i = 0; i  3; i++)
--- freefem/fem/femGraphicX11.cpp.orig  Sat Jul 19 04:10:02 2003
+++ freefem/fem/femGraphicX11.cpp   Sat Jul 19 04:12:31 2003
@@ -118,7 +118,7 @@
 void
 out_of_memory ()
 {
-  cerr  FreeFEM error: operator new failed; not enough memory  endl;
+  std::cerr  FreeFEM error: operator new failed; not enough memory  std::endl;
   exit (-1);
 }
 
--- freefem/fem/femMisc.cpp.origSat Jul 19 04:09:41 2003
+++ freefem/fem/femMisc.cpp Sat Jul 19