Architecture specific change in rpms/freefem++.git
by githook-noreply@fedoraproject.org
The package rpms/freefem++.git has added or updated architecture specific content in its
spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/freefem++.git/commit/?id=5d67dc39....
Change:
+%ifarch ppc64le aarch64 s390x armv7hl
Thanks.
Full change:
============
commit 5d67dc394fd8600d582813210afa2d58fba55e20
Author: Ralf Corspius <corsepiu(a)fedoraproject.org>
Date: Thu Jan 24 06:29:31 2019 +0100
Update to 3.61.
Rebase patches.
Reflect upstream URL having changed.
Disable checks on arm7vl.
diff --git a/.gitignore b/.gitignore
index 069f88e..ebb59c3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-/freefem++-3.60.tar.gz
-/hpddm-20180330git91a98d4.zip
+/FreeFem-sources-3.61.tar.gz
+/hpddm-20180522git22ca769.zip
diff --git a/0001-Build-fixes.patch b/0001-Build-fixes.patch
index d2fb164..dc442fa 100644
--- a/0001-Build-fixes.patch
+++ b/0001-Build-fixes.patch
@@ -1,7 +1,7 @@
-From b7d1e1ab26668132f146a2316ac020acc2abf213 Mon Sep 17 00:00:00 2001
+From 9fcd7208aed7298de4663631309b5584cbb3c689 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
Date: Mon, 8 May 2017 08:47:31 +0200
-Subject: [PATCH 01/10] Build fixes.
+Subject: [PATCH 1/9] Build fixes.
---
Makefile.am | 10 +++++-----
@@ -12,7 +12,7 @@ Subject: [PATCH 01/10] Build fixes.
5 files changed, 21 insertions(+), 31 deletions(-)
diff --git a/Makefile.am b/Makefile.am
-index 0acb0fdf..e8a44057 100644
+index 2bb7f03b..475bb9c0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,7 +41,7 @@ examples++-load/load.link \
@@ -49,7 +49,7 @@ index 0acb0fdf..e8a44057 100644
find . -name '*.h*' -o -name '*.cpp' |egrep '[.]/examples++' >>$@
List-agl-dylib: src/nw/FreeFem++
diff --git a/configure.ac b/configure.ac
-index 31fa3b20..d6a9a3b4 100644
+index 69f1bcc0..19b8bd15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,7 +67,7 @@ m4_define([AC_FF_WHERELIB],
@@ -131,7 +131,7 @@ index db84354a..a4ec7418 100644
libfreefem++.dylib: lg.tab.o ../fflib/libff.a
g++ -bundle lg.tab.o ../fflib/libff.a $(UMFPACKLIB) $(ARPACKLIB) $(BLASLIB) $(LIBS) -o libfreefem++.dylib
diff --git a/src/medit/Makefile.am b/src/medit/Makefile.am
-index 039b8fdf..e3c49a9d 100644
+index a9fbda32..2b914c59 100644
--- a/src/medit/Makefile.am
+++ b/src/medit/Makefile.am
@@ -4,35 +4,17 @@
@@ -140,12 +140,12 @@ index 039b8fdf..e3c49a9d 100644
bin_PROGRAMS=$(MEDITPROG)
-EXTRA_DIST=picking.c
EXTRA_PROGRAMS=ffmedit
- ffmedit_SOURCES= animat.c cube.c image.c listnum.c mouse.c persp.c stream.c zaldy2.c bbfile.c dlists.c inmsh2.c \
- material.c normal.c tiles.c camera.c ellipse.c inout.c medit.c param.c psfile.c transform.c cenrad.c geometry.c \
- inout_morice.c menus.c parsar.c scene.c util.c clip.c gisfil.c inout_popenbinaire.c mesh.c parsop.c scissor.c vector.c \
- clipvol.c hash.c items.c mlists.c particle.c sftcpy.c view.c critip.c ilists.c keyboard.c morphing.c path.c status.c \
--zaldy1.c chrono.h extern.h image.h mesh.h eigenv.h grafic.h medit.h sproto.h
-+zaldy1.c chrono.h extern.h image.h mesh.h eigenv.h grafic.h medit.h sproto.h picking.c
+ ffmedit_SOURCES=animat.c cube.c image.c listnum.c mouse.c persp.c stream.c zaldy2.c bbfile.c dlists.c inmsh2.c \
+ material.c normal.c tiles.c camera.c ellipse.c inout.c medit.c param.c psfile.c transform.c cenrad.c geometry.c \
+ inout_morice.c menus.c parsar.c scene.c util.c clip.c gisfil.c inout_popenbinaire.c mesh.c parsop.c scissor.c vector.c \
+ clipvol.c hash.c items.c mlists.c particle.c sftcpy.c view.c critip.c ilists.c keyboard.c morphing.c path.c status.c \
+- zaldy1.c chrono.h extern.h image.h mesh.h eigenv.h grafic.h medit.h sproto.h
++ zaldy1.c chrono.h extern.h image.h mesh.h eigenv.h grafic.h medit.h sproto.h picking.c
-LDADD=picking.$(OBJEXT) ../libMesh/libMesh.a $(LIBSGLUT) -lm
@@ -163,15 +163,15 @@ index 039b8fdf..e3c49a9d 100644
-picking.$(OBJEXT):picking.c
- ${CC} -c $< $(CNOFLAGS) -o $@
-
--###pinking.no-optffmedit$(EXEEXT):picking.c
--### rm picking.$(OBJEXT)
--### $(MAKE) picking.o $(MEDITPROG) CFLAGS="$(CNOFLAGS)"
--### touch pinking.no-optffmedit$(EXEEXT)
--###pinking.no-opt:picking.c
--### touch pinking.no-opt
--###clean-local:
--### -rm pinking.no-opt pinking.no-optffmedit$(EXEEXT)
+-#pinking.no-optffmedit$(EXEEXT):picking.c
+-# rm picking.$(OBJEXT)
+-# $(MAKE) picking.o $(MEDITPROG) CFLAGS="$(CNOFLAGS)"
+-# touch pinking.no-optffmedit$(EXEEXT)
+-#pinking.no-opt:picking.c
+-# touch pinking.no-opt
+-#clean-local:
+-# -rm pinking.no-opt pinking.no-optffmedit$(EXEEXT)
-
--
-2.17.1
+2.19.2
diff --git a/0002-Eliminate-unused-vars.patch b/0002-Eliminate-unused-vars.patch
deleted file mode 100644
index e79acd3..0000000
--- a/0002-Eliminate-unused-vars.patch
+++ /dev/null
@@ -1,1724 +0,0 @@
-From 1b9f1e99e3c9388e32184eb3162d56f410225c75 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
-Date: Tue, 14 Mar 2017 10:59:31 +0100
-Subject: [PATCH 02/10] Eliminate unused vars
-
----
- examples++-load/BernadiRaugel.cpp | 2 +-
- examples++-load/Element_HCT.cpp | 6 ++--
- examples++-load/GeometryQA.cpp | 2 +-
- examples++-load/Morley.cpp | 2 +-
- examples++-load/SortedList.h | 5 +++-
- examples++-load/dfft.cpp | 2 +-
- examples++-load/distance.cpp | 6 ++--
- examples++-load/ff-NLopt.cpp | 8 +++---
- examples++-load/ff-cmaes.cpp | 2 +-
- examples++-load/fflapack.cpp | 10 +++----
- examples++-load/gmsh.cpp | 6 ++--
- examples++-load/iohdf5.cpp | 4 +--
- examples++-load/iovtk.cpp | 14 ++++-----
- examples++-load/lapack.cpp | 10 +++----
- examples++-load/medit.cpp | 18 ++++++------
- examples++-load/msh3.cpp | 47 +++++++++++++++++--------------
- examples++-load/splitmesh3.cpp | 2 +-
- examples++-load/splitmesh6.cpp | 2 +-
- examples++-load/tetgen.cpp | 14 ++++-----
- examples++-mpi/mpi-cmaes.cpp | 2 +-
- src/Eigen/eigenvalue.cpp | 2 +-
- src/Graphics/ffglut.cpp | 16 +++++------
- src/bamglib/Mesh2.cpp | 21 +++++++++-----
- src/bamglib/Mesh2.h | 2 ++
- src/bamglib/MeshGeom.cpp | 4 +++
- src/bamglib/MeshQuad.cpp | 2 ++
- src/femlib/BamgFreeFem.cpp | 10 +++----
- src/femlib/FESpace.cpp | 2 ++
- src/femlib/FESpacen.cpp | 4 +--
- src/femlib/GQuadTree.cpp | 4 ++-
- src/femlib/GenericMesh.hpp | 10 +++----
- src/femlib/MatriceCreuse_tpl.hpp | 4 +--
- src/femlib/Mesh3dn.cpp | 2 +-
- src/femlib/RNM.hpp | 2 +-
- src/femlib/RNM_op.hpp | 2 +-
- src/femlib/fem.cpp | 21 ++++++++------
- src/femlib/gibbs.cpp | 2 +-
- src/fflib/AFunction.cpp | 2 +-
- src/fflib/array_tlp.hpp | 8 +++---
- src/fflib/glumesh2D.cpp | 5 ++--
- src/fflib/lex.cpp | 9 ++----
- src/fflib/lgfem.cpp | 14 ++++-----
- src/fflib/lgmat.cpp | 4 +--
- src/fflib/lgmesh.cpp | 14 ++++-----
- src/fflib/lgsolver.hpp | 4 +--
- src/fflib/problem.cpp | 8 ++++--
- src/fflib/problem.hpp | 20 ++++++-------
- src/medit/inout_popenbinaire.c | 16 +++++------
- src/medit/medit.c | 6 ++--
- src/medit/stream.c | 4 +--
- 50 files changed, 211 insertions(+), 177 deletions(-)
-
-diff --git a/examples++-load/BernadiRaugel.cpp b/examples++-load/BernadiRaugel.cpp
-index 3a8d92cb..c422b90f 100644
---- a/examples++-load/BernadiRaugel.cpp
-+++ b/examples++-load/BernadiRaugel.cpp
-@@ -107,7 +107,7 @@ void TypeOfFE_P2BRLagrange::Pi_h_alpha(const baseFElement & K,KN_<double> & v) c
- {
- R2 A(K[0]), B(K[1]),C(K[2]);
- R l0=1-P.x-P.y,l1=P.x,l2=P.y;
-- R l4_0=(4*l0-1),l4_1=(4*l1-1),l4_2=(4*l2-1);
-+// R l4_0=(4*l0-1),l4_1=(4*l1-1),l4_2=(4*l2-1);
- // $int_e_1 l0*l0 = |e_1| /3 $ et $int_e_1 l0*l1 = |e_1| /6 $
- // pour avoir flux = 1
- //
-diff --git a/examples++-load/Element_HCT.cpp b/examples++-load/Element_HCT.cpp
-index 28f6eaee..25f100ff 100644
---- a/examples++-load/Element_HCT.cpp
-+++ b/examples++-load/Element_HCT.cpp
-@@ -26,8 +26,8 @@ namespace Fem2D {
- 6, // np point to build interpolation
- 0)
- {
-- const double gauss1=(1.-sqrt(1./3.))/2;
-- const double gauss2=1.-gauss1;
-+// const double gauss1=(1.-sqrt(1./3.))/2;
-+// const double gauss2=1.-gauss1;
-
- const R2 Pt[] = { R2(0,0),R2(1,0),R2(0,1),R2(0.5,0.5), R2(0,0.5),R2(0.5,0)};
- // for the 3 vertices 3 coef => 9 coef ..
-@@ -255,7 +255,7 @@ P3(li,li1,li2)} \
- // cout << idd[k] << " " << jdd[k] << " " << add[k] << endl;
- // cout << endl;
-
-- double i012[3]={1,0,0}, i112[3]={12,12,11};
-+// double i012[3]={1,0,0}, i112[3]={12,12,11};
-
- double AAA[12][10];
- set2zero(&AAA[0][0],120);
-diff --git a/examples++-load/GeometryQA.cpp b/examples++-load/GeometryQA.cpp
-index 784c5636..84e1ec8e 100644
---- a/examples++-load/GeometryQA.cpp
-+++ b/examples++-load/GeometryQA.cpp
-@@ -518,7 +518,7 @@ Fem2D::Mesh * Triangulation::export_to_Mesh() const
- }
- // generation des triangles
- FFT *tt= t;
-- int nberr=0;
-+// int nberr=0;
-
- Vertex const *triangle[3];
- for(int i=0; i<ne_oriented(); i++)
-diff --git a/examples++-load/Morley.cpp b/examples++-load/Morley.cpp
-index b8c79de3..9dd558b0 100644
---- a/examples++-load/Morley.cpp
-+++ b/examples++-load/Morley.cpp
-@@ -38,7 +38,7 @@ namespace Fem2D {
- 0)
- {
- const double gauss1=(1.-sqrt(1./3.))/2;
-- const double gauss2=1.-gauss1;
-+// const double gauss2=1.-gauss1;
-
- const R2 Pt[] = { R2(0,0),R2(1,0),R2(0,1),R2(0.5,0.5), R2(0,0.5),R2(0.5,0)};
- // for the 3 vertices 6 coef
-diff --git a/examples++-load/SortedList.h b/examples++-load/SortedList.h
-index f251f40a..84b3a9a5 100755
---- a/examples++-load/SortedList.h
-+++ b/examples++-load/SortedList.h
-@@ -49,7 +49,10 @@ public:
- TabElement & operator[](int pos){ //TabElement & Element(int pos)
- assert_msg(pos>=0,"Tab::Element Error : Negative index " << pos);
- if(pos >= cardMax){
-- const bool hasGrown = grow(); //contents of an assertion are not executed if NDEBUG
-+#ifndef NDEBUG
-+ const bool hasGrown =
-+#endif
-+ grow(); //contents of an assertion are not executed if NDEBUG
- assert_msg(hasGrown,"Tab::Element Error : Maximum array size excessed. "<< pos);
- return operator[](pos);}
- max_accessed_pos = max(pos, max_accessed_pos);
-diff --git a/examples++-load/dfft.cpp b/examples++-load/dfft.cpp
-index 8b7492d9..0240328d 100644
---- a/examples++-load/dfft.cpp
-+++ b/examples++-load/dfft.cpp
-@@ -212,7 +212,7 @@ AnyType Mapkk::operator()(Stack s) const
- ffassert( m* n == nn );
- long n2= (n+1)/2, m2=(m+1)/2;
- for(long j=0,kk=0;j < m; ++j)
-- for(long k=0,i=0;i < n; ++i)
-+ for(long /* k=0, */ i=0;i < n; ++i)
- {//
- int ii=i, jj=j;
- if( ii > n2) ii=i-n;
-diff --git a/examples++-load/distance.cpp b/examples++-load/distance.cpp
-index dd4e3cf7..2ffb50c7 100644
---- a/examples++-load/distance.cpp
-+++ b/examples++-load/distance.cpp
-@@ -508,7 +508,7 @@ int DistanceIso0(const Mesh3 &Th,int k,double *f,double *fv)
- template<class Mesh>
- AnyType Distance(Stack stack,const Mesh * pTh,Expression eff,KN<double> *pxx,double dmax)
- {
-- typedef typename Mesh::Element Elem;
-+// typedef typename Mesh::Element Elem;
- const int nbve=Mesh::Rd::d+1;
- debug =0;
- if(verbosity>99) debug =1;
-@@ -714,8 +714,8 @@ class Distance3d_P1: public OneOperator { public:
- static void finit()
- {
-
-- typedef const Mesh *pmesh;
-- typedef const Mesh3 *pmesh3;
-+// typedef const Mesh *pmesh;
-+// typedef const Mesh3 *pmesh3;
-
- Global.Add("distance","(",new Distance2d_P1);
- Global.Add("distance","(",new Distance3d_P1);
-diff --git a/examples++-load/ff-NLopt.cpp b/examples++-load/ff-NLopt.cpp
-index 4694dcbe..3977180d 100644
---- a/examples++-load/ff-NLopt.cpp
-+++ b/examples++-load/ff-NLopt.cpp
-@@ -506,7 +506,7 @@ template<nlopt::algorithm ALGO,bool SA=Info<ALGO>::SA> class OptimNLopt : public
- double cost = 1e100;
- WhereStackOfPtr2Free(stack)=new StackOfPtr2Free(stack);// FH mars 2005
- Rn &x = *GetAny<Rn *>((*X)(stack));
-- long n=x.N();
-+// long n=x.N();
-
- const bool gradient = nargs[0] ? dynamic_cast<const Polymorphic *>(nargs[0]) : 0,
- iconst = nargs[1] ? dynamic_cast<const Polymorphic *>(nargs[1]) : 0,
-@@ -514,7 +514,7 @@ template<nlopt::algorithm ALGO,bool SA=Info<ALGO>::SA> class OptimNLopt : public
- econst = nargs[3] ? dynamic_cast<const Polymorphic *>(nargs[3]) : 0,
- gradeconst = nargs[4] ? dynamic_cast<const Polymorphic *>(nargs[4]) : 0;
-
-- long iprint = verbosity;
-+// long iprint = verbosity;
- ffcalfunc<double> ffJ(stack,JJ,theparam);
-
- Optimizer<ALGO> optim(ffJ,x);
-@@ -684,7 +684,7 @@ template<nlopt::algorithm ALGO> class OptimNLopt<ALGO,true> : public OneOperator
- double cost = 1e100;
- WhereStackOfPtr2Free(stack)=new StackOfPtr2Free(stack);// FH mars 2005
- Rn &x = *GetAny<Rn *>((*X)(stack));
-- long n=x.N();
-+// long n=x.N();
-
- const bool gradient = nargs[0] ? dynamic_cast<const Polymorphic *>(nargs[0]) : 0,
- iconst = nargs[1] ? dynamic_cast<const Polymorphic *>(nargs[1]) : 0,
-@@ -693,7 +693,7 @@ template<nlopt::algorithm ALGO> class OptimNLopt<ALGO,true> : public OneOperator
- gradeconst = nargs[4] ? dynamic_cast<const Polymorphic *>(nargs[4]) : 0;
-
-
-- long iprint = verbosity;
-+// long iprint = verbosity;
- ffcalfunc<double> ffJ(stack,JJ,theparam);
-
- SAOptimizer<ALGO> optim(ffJ,x);
-diff --git a/examples++-load/ff-cmaes.cpp b/examples++-load/ff-cmaes.cpp
-index 9ba58bfe..0ab37b1d 100644
---- a/examples++-load/ff-cmaes.cpp
-+++ b/examples++-load/ff-cmaes.cpp
-@@ -230,7 +230,7 @@ class OptimCMA_ES : public OneOperator
- //long mu = arg(8,stack,popsize/2);
- string pipf = nargs[10] ? *GetAny<string*>((*nargs[10])(stack)) : string("") ;
-
-- long iprint = verbosity;
-+// long iprint = verbosity;
- ffcalfunc ffJ(stack,JJ,theparam);
-
- CMA_ES *optim=0;
-diff --git a/examples++-load/fflapack.cpp b/examples++-load/fflapack.cpp
-index 88fe7a41..c3db6560 100644
---- a/examples++-load/fflapack.cpp
-+++ b/examples++-load/fflapack.cpp
-@@ -203,7 +203,7 @@ long lapack_dgeev(KNM<double> *const &A,KN<Complex> *const &vp,KNM<Complex> *con
- // (computation of the eigenvalues and right eigenvectors of a complex nonsymmetric matrix)
- long lapack_zgeev(KNM<Complex> *const &A,KN<Complex> *const &vp,KNM<Complex> *const &vectp)
- {
-- intblas nvp =0,zero=0;
-+ intblas nvp =0 /* ,zero=0 */;
- intblas n= A->N();
- ffassert(A->M()==n);
- ffassert(vectp->M()>=n);
-@@ -227,7 +227,7 @@ long lapack_zgeev(KNM<Complex> *const &A,KN<Complex> *const &vp,KNM<Complex> *co
- cout << " info = " << info << endl;
- if(!info)
- {
-- int k=0;
-+// int k=0;
- for(int i=0;i<n;++i)
- {
- (*vp)[i]=w[i];
-@@ -254,7 +254,7 @@ long lapack_zgeev(KNM<Complex> *const &A,KN<Complex> *const &vp,KNM<Complex> *co
- // double real version
- long lapack_dggev(KNM<double> *const &A, KNM<double> *const &B, KN<Complex> *const &vpa, KN<double> *const &vpb, KNM<Complex> *const &vectp)
- {
-- intblas nvp =0,zero=0;
-+ intblas nvp =0 /* ,zero=0 */;
- intblas n=A->N();
- ffassert(A->M()==n);
- ffassert(B->M()==n);
-@@ -338,7 +338,7 @@ long lapack_zggev(KNM<Complex> *const &A, KNM<Complex> *const &B, KN<Complex> *c
- //16 double precision, dimension( * ) RWORK,
- //17 integer INFO)
-
-- intblas nvp=0,zero=0;
-+ intblas nvp=0 /* ,zero=0 */;
- intblas n=A->N();
- ffassert(A->M()==n);
- ffassert(B->M()==n);
-@@ -394,7 +394,7 @@ long lapack_zhegv(KNM<Complex> *const &A,KNM<Complex> *const &B,KN<double> *cons
- //12 double precision, dimension( * ) RWORK,
- //13 integer INFO)
-
-- intblas nvp=0,zero=0;
-+ intblas nvp=0 /* ,zero=0 */;
- intblas n=A->N();
- ffassert(A->M()==n);
- ffassert(B->M()==n);
-diff --git a/examples++-load/gmsh.cpp b/examples++-load/gmsh.cpp
-index 0fd72b8f..33ee7ced 100644
---- a/examples++-load/gmsh.cpp
-+++ b/examples++-load/gmsh.cpp
-@@ -160,10 +160,10 @@ Mesh * GMSH_Load(const string & filename)
- // local variables freefem++
- vff = new Mesh::Vertex[nv];
-
-- int minVertex = nv + 1, maxVertex = -1;
-+// int minVertex = nv + 1, maxVertex = -1;
- for(int i = 0; i < nv; i++) {
- int num;
-- double xyz[3], uv[2];
-+ double xyz[3] /*, uv[2] */;
-
- //if (!parametric){
- if(!binary){
-@@ -540,7 +540,7 @@ Mesh3 * GMSH_Load3(const string & filename)
- vff = new Vertex3[nv];
- //map<int,int> mapnumv;
-
-- int minVertex = nv + 1, maxVertex = -1;
-+// int minVertex = nv + 1, maxVertex = -1;
- for(int i = 0; i < nv; i++) {
- int num;
- double xyz[3], uv[2];
-diff --git a/examples++-load/iohdf5.cpp b/examples++-load/iohdf5.cpp
-index 9e1255d9..08fb64a5 100644
---- a/examples++-load/iohdf5.cpp
-+++ b/examples++-load/iohdf5.cpp
-@@ -719,8 +719,8 @@ static void Load_Init(){
- cout << " " << endl;
- cout << " ---------------------- " << endl;
-
-- typedef const Mesh *pmesh;
-- typedef const Mesh3 *pmesh3;
-+// typedef const Mesh *pmesh;
-+// typedef const Mesh3 *pmesh3;
-
- if (verbosity>2) cout << " load:popen.cpp " << endl;
-
-diff --git a/examples++-load/iovtk.cpp b/examples++-load/iovtk.cpp
-index 329ea6cc..1f434471 100644
---- a/examples++-load/iovtk.cpp
-+++ b/examples++-load/iovtk.cpp
-@@ -544,7 +544,7 @@ void VTU_WRITE_MESH( FILE *fp, const Mesh &Th, bool binary, int datasize, bool s
-
-
- void VTU_WRITE_MESH( FILE *fp, const Mesh3 &Th, bool binary, int datasize, bool surface, bool bigEndian){
-- int nc,nv,nconnex;
-+ int nc /* ,nv */ ,nconnex;
- if(surface) nc=Th.nt+Th.nbe;
- else nc=Th.nt;
-
-@@ -1465,7 +1465,7 @@ public:
- void writesolutionP0_double( FILE *fp, const Mesh &Th, Stack stack, bool surface) const {
- MeshPoint *mp3(MeshPointStack(stack));
- R2 Cdg_hat = R2(1./3.,1./3.);
-- unsigned char ElementChars[256];
-+// unsigned char ElementChars[256];
-
- for (int it=0;it<Th.nt;it++){
- const Mesh::Triangle & K(Th.t(it));
-@@ -2042,7 +2042,7 @@ void VTK_WRITE_MESH( const string &filename, FILE *fp, const Mesh &Th, bool bina
-
- fprintf(fp, "CELL_DATA %d\n", numElements);
- int cell_fd=1;
-- int cell_lab=1;
-+// int cell_lab=1;
- /*
- fprintf(fp, "COLOR_SCALARS Label 4\n");
- if(binary){
-@@ -2152,7 +2152,7 @@ void VTK_WRITE_MESH( const string &filename, FILE *fp, const Mesh &Th, bool bina
-
- for(int itab=0; itab<4; itab++){
- char newvalue[sizeof(int)];
-- int bid0= sprintf(newvalue,"%s", (char*)&tab[itab]);
-+ /* int bid0= */ sprintf(newvalue,"%s", (char*)&tab[itab]);
- fwrite( &newvalue, sizeof(unsigned char), 1, fp);
- }
-
-@@ -3619,7 +3619,7 @@ void VTK_WRITE_MESH3( const string &filename, FILE *fp, const Mesh3 &Th, bool bi
-
- fprintf(fp, "CELL_DATA %d\n", numElements);
- int cell_fd=1;
-- int cell_lab=1;
-+// int cell_lab=1;
- fprintf(fp, "Scalars Label int%d\n", cell_fd);
- fprintf(fp, "LOOKUP_TABLE FreeFempp_table\n");
- // Determination des labels
-@@ -3675,7 +3675,7 @@ void VTK_WRITE_MESH3( const string &filename, FILE *fp, const Mesh3 &Th, bool bi
-
- for(int itab=0; itab<4; itab++){
- char newvalue[sizeof(int)];
-- int bid0= sprintf(newvalue,"%s", (char*)&tab[itab]);
-+ /* int bid0= */ sprintf(newvalue,"%s", (char*)&tab[itab]);
- fwrite( &newvalue, sizeof(unsigned char), 1, fp);
- }
-
-@@ -3878,7 +3878,7 @@ AnyType VTK_WriteMesh3_Op::operator()(Stack stack) const
- }
- }
- else if(VTK_FILE == 2){
-- int nc,nv;
-+// int nc,nv;
-
-
-
-diff --git a/examples++-load/lapack.cpp b/examples++-load/lapack.cpp
-index 671fe8b9..cb533387 100644
---- a/examples++-load/lapack.cpp
-+++ b/examples++-load/lapack.cpp
-@@ -203,7 +203,7 @@ long lapack_dgeev(KNM<double> *const &A,KN<Complex> *const &vp,KNM<Complex> *con
- // (computation of the eigenvalues and right eigenvectors of a complex nonsymmetric matrix)
- long lapack_zgeev(KNM<Complex> *const &A,KN<Complex> *const &vp,KNM<Complex> *const &vectp)
- {
-- intblas nvp =0,zero=0;
-+ intblas nvp =0 /* ,zero=0 */;
- intblas n= A->N();
- ffassert(A->M()==n);
- ffassert(vectp->M()>=n);
-@@ -227,7 +227,7 @@ long lapack_zgeev(KNM<Complex> *const &A,KN<Complex> *const &vp,KNM<Complex> *co
- cout << " info = " << info << endl;
- if(!info)
- {
-- int k=0;
-+// int k=0;
- for(int i=0;i<n;++i)
- {
- (*vp)[i]=w[i];
-@@ -254,7 +254,7 @@ long lapack_zgeev(KNM<Complex> *const &A,KN<Complex> *const &vp,KNM<Complex> *co
- // double real version
- long lapack_dggev(KNM<double> *const &A, KNM<double> *const &B, KN<Complex> *const &vpa, KN<double> *const &vpb, KNM<Complex> *const &vectp)
- {
-- intblas nvp =0,zero=0;
-+ intblas nvp =0 /* ,zero=0 */;
- intblas n=A->N();
- ffassert(A->M()==n);
- ffassert(B->M()==n);
-@@ -338,7 +338,7 @@ long lapack_zggev(KNM<Complex> *const &A, KNM<Complex> *const &B, KN<Complex> *c
- //16 double precision, dimension( * ) RWORK,
- //17 integer INFO)
-
-- intblas nvp=0,zero=0;
-+ intblas nvp=0 /* ,zero=0 */;
- intblas n=A->N();
- ffassert(A->M()==n);
- ffassert(B->M()==n);
-@@ -394,7 +394,7 @@ long lapack_zhegv(KNM<Complex> *const &A,KNM<Complex> *const &B,KN<double> *cons
- //12 double precision, dimension( * ) RWORK,
- //13 integer INFO)
-
-- intblas nvp=0,zero=0;
-+ intblas nvp=0 /* ,zero=0 */;
- intblas n=A->N();
- ffassert(A->M()==n);
- ffassert(B->M()==n);
-diff --git a/examples++-load/medit.cpp b/examples++-load/medit.cpp
-index d47ac35d..693c8ba8 100644
---- a/examples++-load/medit.cpp
-+++ b/examples++-load/medit.cpp
-@@ -193,7 +193,7 @@ AnyType readsol_Op::operator()(Stack stack) const
- cout << "nbsol " << nbsol << " offset " << offset << " " << nsol << " "<< endl;
-
- float *buf =new float[offset];
-- double tmp;
-+// double tmp;
- double *bufd=new double[offset];
-
- KN<double> *ptabsol = new KN<double>(nbsol);
-@@ -582,7 +582,7 @@ AnyType datasolMesh3_Op<v_fes>::operator()(Stack stack) const
-
- int nt = Th.nt;
- int nv = Th.nv;
-- int nbe = Th.nbe;
-+// int nbe = Th.nbe;
- int nbtype=l.size();
- int nbsol;
- int solnbfloat;
-@@ -876,10 +876,10 @@ public:
- public:
- PopenMeditMesh_Op(const basicAC_F0 & args) : l( args.size()-1 )
- {
-- int nbofsol;
-+// int nbofsol;
- int ddim=2;
- int stsize=3;
-- char *tictac;
-+// char *tictac;
-
- args.SetNameParam(n_name_param,name_param,nargs);
-
-@@ -1085,8 +1085,8 @@ AnyType PopenMeditMesh_Op::operator()(Stack stack) const
-
- for(size_t i=0; i<l.size();i=i+offset){
- int nvtmp = iv;
-- int nttmp = it;
-- int nbetmp = ibe;
-+// int nttmp = it;
-+// int nbetmp = ibe;
-
- const Mesh &Thtmp =l[i].evalm(0,stack);
- for (int ii=0;ii<Thtmp.nv;ii++){
-@@ -1141,7 +1141,7 @@ AnyType PopenMeditMesh_Op::operator()(Stack stack) const
- if( nargs[2] ){
- boolsave= true;
- saveff = GetAny<string *>( (*nargs[2])(stack) );
-- int ddim = 2;
-+// int ddim = 2;
-
- for (size_t i=0;i<offset;i++){
- solnbfloat = solnbfloat + l[i].nbfloat;
-@@ -1581,7 +1581,7 @@ AnyType PopenMeditMesh_Op::operator()(Stack stack) const
- bool wait=TheWait;
- if (nargs[3]) wait= GetAny<bool>((*nargs[3])(stack));
-
-- bool plotting = true;
-+// bool plotting = true;
- // drawing part ------------------------------
-
- // suppression du no wait car plante sur mac
-@@ -1673,7 +1673,7 @@ public:
- public:
- PopenMeditMesh3_Op(const basicAC_F0 & args) : l( args.size()-1 )
- {
-- int nbofsol;
-+// int nbofsol;
- int ddim=3;
- int stsize=6;
-
-diff --git a/examples++-load/msh3.cpp b/examples++-load/msh3.cpp
-index 0290f2c8..1a5fb898 100644
---- a/examples++-load/msh3.cpp
-+++ b/examples++-load/msh3.cpp
-@@ -550,7 +550,9 @@ Mesh3 *TestElementMesh3_patch( const Mesh3 & Th3 )
- assert(nbv == nv_t);
-
- // determination des nouveaux tetrahedres
-- int nbt = 0;
-+#ifndef NDEBUG
-+ int nbt = 0;
-+#endif
- hseuil = hmin/10.;
- hseuil = hseuil/4.;
- for (int ii=0;ii<Th3.nt;ii++){
-@@ -567,7 +569,9 @@ Mesh3 *TestElementMesh3_patch( const Mesh3 & Th3 )
- assert(nbv == nv_t);
-
- // determination des nouveaux trianglesxs
-- int nbbe = 0;
-+#ifndef NDEBUG
-+ int nbbe = 0;
-+#endif
- hseuil = hmin/10.;
- hseuil = hseuil/4.;
- for (int ii=0;ii<Th3.nbe;ii++){
-@@ -1933,7 +1937,7 @@ public:
- args.SetNameParam(n_name_param,name_param,nargs);
- const E_Array * a1=0 ;
- if(nargs[0]) a1 = dynamic_cast<const E_Array *>(nargs[0]);
-- int err =0;
-+// int err =0;
- if( nargs[1] && nargs[7] )
- CompileError("uncompatible movemesh3 (Th, region= , reftet= ");
- if( nargs[2] && nargs[8] )
-@@ -1973,7 +1977,7 @@ AnyType Movemesh3D_Op::operator()(Stack stack) const
-
- ffassert(pTh);
- Mesh3 &Th=*pTh;
-- Mesh3 *m= pTh; // question a quoi sert *m ??
-+// Mesh3 *m= pTh; // question a quoi sert *m ??
- int nbv=Th.nv; // nombre de sommet
- int nbt=Th.nt; // nombre de triangles
- int nbe=Th.nbe; // nombre d'aretes fontiere
-@@ -2048,7 +2052,7 @@ AnyType Movemesh3D_Op::operator()(Stack stack) const
- iv[1]=Th.operator()(K[1]);
- iv[2]=Th.operator()(K[2]);
-
-- R coordx,coordy,coordz;
-+// R coordx,coordy,coordz;
- for(int jj=0; jj< 3; jj++){
- int i=iv[jj];
- if(takemesh[i]==0){
-@@ -2259,7 +2263,8 @@ AnyType SetMesh3D_Op::operator()(Stack stack) const
- for(int i=0;i<nbe;++i)
- {
- const Triangle3 & K = Th.be(i);
-- int l0,l1=ChangeLab3D(mapface, l0= K.lab) ;
-+ int l0;
-+ ChangeLab3D(mapface, l0= K.lab) ;
- nben++;
- }
-
-@@ -2422,7 +2427,7 @@ public:
-
- const E_Array * a1=0 ;
- if(nargs[0]) a1 = dynamic_cast<const E_Array *>(nargs[0]);
-- int err =0;
-+// int err =0;
- if( nargs[2] && nargs[5] )
- CompileError("uncompatible movemesh23 (Th, label= , refface= ");
- if(a1) {
-@@ -2492,7 +2497,7 @@ AnyType Movemesh2D_3D_surf_Op::operator()(Stack stack) const
- {
- KN<int> takemesh(nbv);
- takemesh=0;
-- const Mesh &rTh = Th;
-+// const Mesh &rTh = Th;
- for (int it=0; it<nbt; ++it){
- for( int iv=0; iv<3; ++iv){
- int i=Th(it,iv);
-@@ -3026,7 +3031,7 @@ Mesh3 * Transfo_Mesh3_surf(const double &precis_mesh, const Mesh3 & Th3, const d
- int* ind_nbe_t;
- int* label_nbe_t;
-
-- int i_som, i_elem, i_border;
-+ int i_som, /* i_elem, */ i_border;
-
- assert( Th3.nt == 0);
-
-@@ -3125,7 +3130,7 @@ void SamePointElement_surf( const double &precis_mesh, const double *tab_XX, con
- int &recollement_border, int &point_confondus_ok, int *Numero_Som,
- int *ind_nv_t, int *ind_nbe_t, int *label_nbe_t, int & nv_t,int & nbe_t ){
-
-- int Elem_ok, Border_ok;
-+ int /* Elem_ok, */ Border_ok;
- double hmin,hmin_elem,hmin_border;
- R3 bmin,bmax;
- //int recollement_element=1,recollement_border=1;
-@@ -3294,7 +3299,7 @@ Mesh3 * MoveMesh2_func( const double &precis_mesh, const Mesh & Th2, const doubl
- cout << "After movemesh::Vertex triangle2 border " << nv_t << " "<< nt_t << " " << nbe_t<< endl;
-
- Vertex3 *v=new Vertex3[nv_t];
-- Tet *t;
-+// Tet *t;
- Triangle3 *b=new Triangle3[nbe_t];
- Triangle3 *bb=b;
-
-@@ -3319,7 +3324,7 @@ Mesh3 * MoveMesh2_func( const double &precis_mesh, const Mesh & Th2, const doubl
- }
-
- for(int ibe=0; ibe < nbe_t; ibe++){
-- int lab;
-+// int lab;
- int iv[3];
- int ii=ind_nbe_t[ibe];
- // creation of elements
-@@ -3995,9 +4000,9 @@ void PointCommun_hcode( const int &dim, const int &NbPoints, const int &point_co
- void OrderVertexTransfo_hcode_nv_gtree( const int & tab_nv, const R3 &bmin, const R3 &bmax, const double &hmin,
- const double *tab_XX, const double *tab_YY, const double *tab_ZZ, int *Numero_Som, int * ind_nv_t, int & nv_t){
-
-- size_t i;
-- size_t j[3];
-- size_t k[3];
-+// size_t i;
-+// size_t j[3];
-+// size_t k[3];
-
- // parametre interne pour debugger le code
- int verifnumberofpoints;
-@@ -4509,7 +4514,7 @@ AnyType BuildLayeMesh_Op::operator()(Stack stack) const
- int nlayer = (int) GetAny<long>((*enmax)(stack));
- ffassert(pTh && nlayer>0);
- Mesh &Th=*pTh;
-- Mesh *m= pTh; // question a quoi sert *m ??
-+// Mesh *m= pTh; // question a quoi sert *m ??
- int nbv=Th.nv; // nombre de sommet
- int nbt=Th.nt; // nombre de triangles
- int neb=Th.neb; // nombre d'aretes fontiere
-@@ -4806,7 +4811,7 @@ AnyType DeplacementTab_Op::operator()(Stack stack) const
-
- ffassert(pTh);
- Mesh3 &Th=*pTh;
-- Mesh3 *m= pTh; // question a quoi sert *m ??
-+// Mesh3 *m= pTh; // question a quoi sert *m ??
- int nbv=Th.nv; // nombre de sommet
- int nbt=Th.nt; // nombre de triangles
- int nbe=Th.nbe; // nombre d'aretes fontiere
-@@ -4943,7 +4948,7 @@ void GetNumberBEManifold( Expression surf, int & mani_nbe)
- {
- if ( surf )
- {
-- int i,j;
-+// int i,j;
- if( verbosity>1)
- cout << " -- Manifoldal Condition to do" << endl;
- const E_Array * a= dynamic_cast<const E_Array *>(surf);
-@@ -5938,9 +5943,9 @@ AnyType ExtractMesh_Op::operator()(Stack stack) const
- Mesh3 *pTh= GetAny<Mesh3 *>((*eTh)(stack));
- Mesh3 &Th=*pTh;
-
-- int nbv=Th.nv; // nombre de sommet
-- int nbt=Th.nt; // nombre de triangles
-- int nbe=Th.nbe; // nombre d'aretes fontiere
-+// int nbv=Th.nv; // nombre de sommet
-+// int nbt=Th.nt; // nombre de triangles
-+// int nbe=Th.nbe; // nombre d'aretes fontiere
-
- KN<long> zzempty(0);
- KN<long> labelface (arg(0,2,stack,zzempty));
-diff --git a/examples++-load/splitmesh3.cpp b/examples++-load/splitmesh3.cpp
-index 494c534f..eb7aeaa3 100644
---- a/examples++-load/splitmesh3.cpp
-+++ b/examples++-load/splitmesh3.cpp
-@@ -54,7 +54,7 @@ Mesh const * SplitMesh3(Stack stack,Fem2D::Mesh const * const & pTh)
-
- // generation des triangles
- Triangle *tt= t;
-- int nberr=0;
-+// int nberr=0;
-
- for (int i=0;i<nbt;i++)
- {
-diff --git a/examples++-load/splitmesh6.cpp b/examples++-load/splitmesh6.cpp
-index 4c3f24a5..ff44dd7a 100644
---- a/examples++-load/splitmesh6.cpp
-+++ b/examples++-load/splitmesh6.cpp
-@@ -93,7 +93,7 @@ Mesh const * SplitMesh6(Stack stack,Fem2D::Mesh const * const & pTh)
-
- // generation des triangles
- Triangle *tt= t;
-- int nberr=0;
-+// int nberr=0;
-
- for (int i=0;i<nbt;i++)
- {
-diff --git a/examples++-load/tetgen.cpp b/examples++-load/tetgen.cpp
-index e92dd30d..253f5d5d 100644
---- a/examples++-load/tetgen.cpp
-+++ b/examples++-load/tetgen.cpp
-@@ -122,7 +122,7 @@ public:
- args.SetNameParam(n_name_param,name_param,nargs);
- const E_Array * a1=0 ;
- if(nargs[0]) a1 = dynamic_cast<const E_Array *>(nargs[0]);
-- int err =0;
-+// int err =0;
-
- if(a1) {
- if(a1->size() !=3)
-@@ -178,7 +178,7 @@ AnyType Build2D3D_Op::operator()(Stack stack) const
- Mesh * pTh= GetAny<Mesh *>((*eTh)(stack));
- ffassert( pTh );
- Mesh &Th=*pTh;
-- Mesh *m= pTh; // question a quoi sert *m ??
-+// Mesh *m= pTh; // question a quoi sert *m ??
- int nbv=Th.nv; // nombre de sommet
-
- int nbt=Th.nt; // nombre de triangles
-@@ -270,7 +270,7 @@ AnyType Build2D3D_Op::operator()(Stack stack) const
- for(int ii=0; ii<nbv; ii++)
- takemesh[ii]=0;
-
-- Mesh &rTh = Th;
-+// Mesh &rTh = Th;
- for (int it=0; it<nbt; ++it){
- for( int iv=0; iv<3; ++iv){
- int i=Th(it,iv);
-@@ -1466,7 +1466,7 @@ Mesh3 * ReconstructionRefine_tetgen(char *switch_tetgen,const Mesh3 & Th3,
- assert(Th3.nt != 0 );
- {
- size_t testr, testp;
-- int lenswitch;
-+// int lenswitch;
- const char* test_tetgen = switch_tetgen;
-
- testr = strcspn(test_tetgen,"r");
-@@ -1612,7 +1612,7 @@ Mesh3 * ReconstructionRefine_tetgen(char *switch_tetgen,const Mesh3 & Th3,
- assert(Th3.nt != 0 );
- {
- size_t testr, testp;
-- int lenswitch;
-+// int lenswitch;
- const char* test_tetgen = switch_tetgen;
-
- testr = strcspn(test_tetgen,"r");
-@@ -1858,7 +1858,7 @@ AnyType Remplissage_Op::operator()(Stack stack) const
- Mesh3 * pTh= GetAny<Mesh3 *>((*eTh)(stack));
- ffassert( pTh );
- Mesh3 &Th=*pTh;
-- Mesh3 *m= pTh; // question a quoi sert *m ??
-+// Mesh3 *m= pTh; // question a quoi sert *m ??
- int nbv=Th.nv; // nombre de sommet
- int nbt=Th.nt; // nombre de triangles
- int nbe=Th.nbe; // nombre d'aretes fontiere
-@@ -2104,7 +2104,7 @@ AnyType ReconstructionRefine_Op::operator()(Stack stack) const
-
- ffassert( pTh );
- Mesh3 &Th=*pTh;
-- Mesh3 *m= pTh; // question a quoi sert *m ??
-+// Mesh3 *m= pTh; // question a quoi sert *m ??
- int nbv=Th.nv; // nombre de sommet
- int nbt=Th.nt; // nombre de triangles
- int nbe=Th.nbe; // nombre d'aretes fontiere
-diff --git a/examples++-mpi/mpi-cmaes.cpp b/examples++-mpi/mpi-cmaes.cpp
-index 3970c1a7..5c621d07 100644
---- a/examples++-mpi/mpi-cmaes.cpp
-+++ b/examples++-mpi/mpi-cmaes.cpp
-@@ -309,7 +309,7 @@ class OptimCMA_ES : public OneOperator
- MPI_Comm * commworld= vcommworld ? (MPI_Comm *) vcommworld : & mpiCommWorld ;
- //long mu = arg(8,stack,popsize/2);
-
-- long iprint = verbosity;
-+// long iprint = verbosity;
- ffcalfunc ffJ(stack,JJ,theparam);
-
- //cout << endl << "ATTENTION : " << *commworld << endl;
-diff --git a/src/Eigen/eigenvalue.cpp b/src/Eigen/eigenvalue.cpp
-index 06c3b825..a15a16a3 100644
---- a/src/Eigen/eigenvalue.cpp
-+++ b/src/Eigen/eigenvalue.cpp
-@@ -557,7 +557,7 @@ AnyType EigenValue::E_EV::operator()(Stack stack) const
-
- if(evalue) nbev=Max( (long)evalue->N(),nbev);
-
-- const VirtualMatrice<K> * ptOP1=0, *ptB=0,*ptOP=0, *ptB1=0;
-+ const VirtualMatrice<K> * ptOP1=0, *ptB=0 /* ,*ptOP=0, *ptB1=0 */;
-
- if(pOP1)
- ptOP1= & (const VirtualMatrice<K>&)(pOP1->A);
-diff --git a/src/Graphics/ffglut.cpp b/src/Graphics/ffglut.cpp
-index 6beca5a2..de710e0f 100644
---- a/src/Graphics/ffglut.cpp
-+++ b/src/Graphics/ffglut.cpp
-@@ -133,7 +133,7 @@ int ReadOnePlot(FILE *fp)
- if(debug>2) cout << " Read entete " << version << endl;
- int c1 =getc(fp);//
- if(c1==13)
-- int c2 =getc(fp);//
-+ /* int c2 = */ getc(fp);//
-
-
- }
-@@ -389,7 +389,7 @@ void Plot(const Mesh & Th,bool fill,bool plotmesh,bool plotborder,ThePlot & plot
- R z2= plot.z0;
-
-
-- double r=0,g=0,b=0;
-+// double r=0,g=0,b=0;
- if((debug > 3)) cout<< " OnePlotMesh::Draw " << plotmesh << " " << plotborder << " " << Th.nbBrdElmts() << " " << z1 << " " << z2 << endl;
- // plot.SetColorTable(16) ;
- bool cc[3]= { plotborder , plotmesh && fill , plotmesh };
-@@ -436,7 +436,7 @@ void Plot(const Mesh & Th,bool fill,bool plotmesh,bool plotborder,ThePlot & plot
- plot.color(K.lab?1+abs(K.lab):0);
-
- //glColor3d(r,g,b);
-- int i0= Th(K[0]), i1= Th(K[1]), i2= Th(K[2]) ;
-+// int i0= Th(K[0]), i1= Th(K[1]), i2= Th(K[2]) ;
- glVertex3d(K[0].x,K[0].y,z2);
- glVertex3d(K[1].x,K[1].y,z2);
- glVertex3d(K[2].x,K[2].y,z2);
-@@ -460,7 +460,7 @@ void Plot(const Mesh & Th,bool fill,bool plotmesh,bool plotborder,ThePlot & plot
- {
- const typename Mesh::Element & K(Th[i]);
- plot.color(fill? 1 : 1+abs(K.lab));
-- int i0= Th(K[0]), i1= Th(K[1]), i2= Th(K[2]) ;
-+// int i0= Th(K[0]), i1= Th(K[1]), i2= Th(K[2]) ;
- glVertex3d(K[0].x,K[0].y,z1);
- glVertex3d(K[1].x,K[1].y,z1);
- glVertex3d(K[2].x,K[2].y,z1);
-@@ -492,7 +492,7 @@ void Plot(const Mesh3 & Th,bool fill,bool plotmesh,bool plotborder,ThePlot & plo
- R z1= plot.z0;
- R z2= plot.z0;
-
-- double r=0,g=0,b=0;
-+// double r=0,g=0,b=0;
-
- bool cc[3]= { plotborder , plotborder && fill , plotmesh && fill };
- double saturation =plotmesh ? 1 : 0.25;
-@@ -687,7 +687,7 @@ template<class Mesh>
-
- Psub.resize(nsubV);
- Ksub.resize(nsubT*3);
-- for(int i=0,j=0;i<nsubV;++i)
-+ for(int i=0 /* ,j=0 */;i<nsubV;++i)
- Psub[i]=SubInternalVertex(nsub,i);
-
- for(int sk=0,p=0;sk<nsubT;++sk)
-@@ -826,7 +826,7 @@ void OnePlotFE<Mesh>::Draw(OneWindow *win)
- R coef = plot.coeff;
- double xmin,xmax,ymin,ymax;
- win->getcadre(xmin,xmax,ymin,ymax);
-- double d= Max(ymax-ymin,xmax-xmin);
-+// double d= Max(ymax-ymin,xmax-xmin);
- R kk = 4*win->hpixel;
- if(plot.ArrowSize>0) kk=win->hpixel*max(win->width*plot.ArrowSize/100.,1.);
- R cc = win->hpixel*40;
-@@ -2807,7 +2807,7 @@ static void Key( unsigned char key, int x, int y )
- break;
- case 'I':
- {
-- R fmn,fmx,vmn,vmx;
-+// R fmn,fmx,vmn,vmx;
- win->theplot->SetDefIsoV(ni,na) ;
- win->changeiso=true;
- win->changearrow=true;
-diff --git a/src/bamglib/Mesh2.cpp b/src/bamglib/Mesh2.cpp
-index 273be4c1..3c495311 100644
---- a/src/bamglib/Mesh2.cpp
-+++ b/src/bamglib/Mesh2.cpp
-@@ -71,7 +71,7 @@ namespace bamg {
- }
-
- #else
-- static unsigned long myrand_next = 1;
-+// static unsigned long myrand_next = 1;
-
- /* RAND_MAX assumed to be 32767 */
- int myrand(void) {
-@@ -291,7 +291,7 @@ TriangleAdjacent CloseBoundaryEdge(I2 A,Triangle *t, double &a,double &b) {
- int k=(*t)(0) ? (( (*t)(1) ? ( (*t)(2) ? -1 : 2) : 1 )) : 0;
- int dir=0;
- assert(k>=0);
-- int kkk=0;
-+// int kkk=0;
- Icoor2 IJ_IA,IJ_AJ;
- TriangleAdjacent edge(t,OppositeEdge[k]);
- for (;;edge = dir >0 ? Next(Adj(Next(edge))) : Previous(Adj(Previous(edge))))
-@@ -448,7 +448,7 @@ TriangleAdjacent CloseBoundaryEdgeV2(I2 C,Triangle *t, double &a,double &b)
- t=er;
- TriangleAdjacent edge(er);
-
-- int kkk=0;
-+// int kkk=0;
- int linkp = t->link == 0;
-
- Triangle * tt=t=edge=Adj(Previous(edge));
-@@ -1105,7 +1105,7 @@ int ForceEdge(Vertex &a, Vertex & b,TriangleAdjacent & taret)
- #endif
- int NbSwap =0;
- assert(a.t && b.t); // the 2 vertex is in a mesh
-- int k=0;
-+// int k=0;
- taret=TriangleAdjacent(0,0); // erreur
-
- TriangleAdjacent tta(a.t,EdgesVertexTriangle[a.vint][0]);
-@@ -2905,7 +2905,7 @@ void Triangles::FindSubDomain(int OutSide=0)
- {
- GeometricalEdge &eg = *Gh.subdomains[i].edge;
- subdomains[i].ref = Gh.subdomains[i].ref;
-- int ssdlab = subdomains[i].ref;
-+// int ssdlab = subdomains[i].ref;
- // by carefull is not easy to find a edge create from a GeometricalEdge
- // see routine MakeGeometricalEdgeToEdge
- Edge &e = *GeometricalEdgetoEdge[Gh.Number(eg)];
-@@ -3475,7 +3475,7 @@ void Triangles::GeomToTriangles1(Int4 inbvx,int KeepBackVertices)
- iedge=bcurve[icurve]/2;
- int jedge=bcurve[icurve]%2;
- if( ! Gh.curves[icurve].master) continue; // we skip all equi curve
-- Edge & ei = BTh.edges[iedge];
-+// Edge & ei = BTh.edges[iedge];
- // warning: ei.on->Mark() can be change in
- // loop for(jedge=0;jedge<2;jedge++)
- // new curve
-@@ -4665,7 +4665,10 @@ Int4 Triangle::Optim(Int2 i,int koption)
- Vertex * s = ns[i];
- #endif
- Triangle *t = this;
-- int k=0,j =OppositeEdge[i];
-+#ifndef NDEBUG
-+ int k=0;
-+#endif
-+ int j =OppositeEdge[i];
- int jp = PreviousEdge[j];
- // initialise tp, jp the previous triangle & edge
- Triangle *tp= at[jp];
-@@ -4974,7 +4977,9 @@ int Triangles::CrackMesh()
- kk++;// number of cracked edge view
- }
- if ( tt->link ) { // if good triangles store the value
-+#ifndef NDEBUG
- int it = Number(tt);
-+#endif
- assert(it < nt);
- (*tt)(kv)= vv; // Change the vertex of triangle
- if(vv<vend) {*vv= v;vv->ReferenceNumber=iv;} // copy the vertex value + store the old vertex number in ref
-@@ -5182,7 +5187,9 @@ Triangle * Triangles::FindTriangleContening(const I2 & B,Icoor2 dete[3], Triangl
-
- }
- Icoor2 detop ;
-+#ifndef NDEBUG
- int kkkk =0; // number of test triangle
-+#endif
-
- while ( t->det < 0)
- { // the initial triangles is outside
-diff --git a/src/bamglib/Mesh2.h b/src/bamglib/Mesh2.h
-index 0cc0b42b..b3d7e6ca 100644
---- a/src/bamglib/Mesh2.h
-+++ b/src/bamglib/Mesh2.h
-@@ -1282,7 +1282,9 @@ inline Real4 qualite(const Vertex &va,const Vertex &vb,const Vertex &vc)
-
- inline Triangle::Triangle(Triangles *Th,Int4 i,Int4 j,Int4 k) {
- Vertex *v=Th->vertices;
-+#ifndef NDEBUG
- Int4 nbv = Th->nbv;
-+#endif
- assert(i >=0 && j >=0 && k >=0);
- assert(i < nbv && j < nbv && k < nbv);
- ns[0]=v+i;
-diff --git a/src/bamglib/MeshGeom.cpp b/src/bamglib/MeshGeom.cpp
-index f0cfb0b1..f424ceeb 100644
---- a/src/bamglib/MeshGeom.cpp
-+++ b/src/bamglib/MeshGeom.cpp
-@@ -353,7 +353,9 @@ void Triangles::ConsGeometry(Real8 cutoffradian,int *equiedges) // construct a g
- for (i=0;i<nbv;i++)
- if((j=colorV[i])>=0)
- {
-+#ifndef NDEBUG
- int k=Gh.vertices[j].cas;
-+#endif
- Gh.vertices[j].Set(vertices[i]);
- // Vertex & v = Gh.vertices[j];
- // v = vertices[i];
-@@ -556,7 +558,9 @@ GeometricalEdge* Geometry::Contening(const R2 P, GeometricalEdge * start) const
- GeometricalEdge* on =start,* pon=0;
- // walk with the cos on geometry
- // cout << P ;
-+#ifndef NDEBUG
- int k=0;
-+#endif
- while(pon != on)
- {
- pon = on;
-diff --git a/src/bamglib/MeshQuad.cpp b/src/bamglib/MeshQuad.cpp
-index 4d16e6de..eabe55d3 100644
---- a/src/bamglib/MeshQuad.cpp
-+++ b/src/bamglib/MeshQuad.cpp
-@@ -215,7 +215,9 @@ double QuadQuality(const Vertex & a,const Vertex &b,const Vertex &c,const Vertex
- R2 AB=B-A;
-
- Real8 cosE01AB = (( (R2) (*e)[1] - (R2) (*e)[0] ) , AB);
-+#ifndef NDEBUG
- int kkk=0;
-+#endif
- int sens = (cosE01AB>0) ? 1 : 0;
-
- // Real8 l=0; // length of the edge AB
-diff --git a/src/femlib/BamgFreeFem.cpp b/src/femlib/BamgFreeFem.cpp
-index a4ed1ef6..82670fca 100644
---- a/src/femlib/BamgFreeFem.cpp
-+++ b/src/femlib/BamgFreeFem.cpp
-@@ -746,14 +746,14 @@ const Fem2D::Mesh * BuildMesh(Stack stack, E_BorderN const * const & b,bool jus
- {
- if(on->abscisse <0) {
- bamg::GeometricalVertex * gv= on->gv;
-- int iold = Gh->Number(gv);
-+// int iold = Gh->Number(gv);
- }
- else {// erreur car un point est sur un arete en non un sommet
- bamg::GeometricalEdge * ge= on->ge;
-- int eold = Gh->Number(ge); //
-- int iold = Gh->Number( (*ge)[0] );
-- int jold = Gh->Number( (*ge)[1] );
-- int s = on->abscisse;
-+// int eold = Gh->Number(ge); //
-+// int iold = Gh->Number( (*ge)[0] );
-+// int jold = Gh->Number( (*ge)[1] );
-+// int s = on->abscisse;
-
- // cout << " error bizarre " << ge << endl;
- }
-diff --git a/src/femlib/FESpace.cpp b/src/femlib/FESpace.cpp
-index 9eba86a7..bb84f88a 100644
---- a/src/femlib/FESpace.cpp
-+++ b/src/femlib/FESpace.cpp
-@@ -685,9 +685,11 @@ int nb_dfv,const int *ndfv,int nb_dfe,const int *ndfe)
- assert(TFEs.constant());
- const TypeOfFE & TFE(*TFEs[0]);
- int nbdfe=TFE.NbDoF;
-+#ifndef NDEBUG
- int NbDfOnSommet=TFE.NbDfOnVertex;
- int NbDfOnEdge=TFE.NbDfOnEdge;
- int NbDfOnElement=TFE.NbDfOnElement;
-+#endif
- int NbNodeonVertex=0;
- int NbNodeonEdge=0;
- int NbNodeonElement=0;
-diff --git a/src/femlib/FESpacen.cpp b/src/femlib/FESpacen.cpp
-index 05505593..bfc2acd9 100644
---- a/src/femlib/FESpacen.cpp
-+++ b/src/femlib/FESpacen.cpp
-@@ -378,7 +378,7 @@ void GTypeOfFESum<Mesh>::Build()
- {
- bool debug=verbosity>5;;
- {
-- const KN< GTypeOfFE<Mesh> const *> & t=teb;
-+// const KN< GTypeOfFE<Mesh> const *> & t=teb;
- map<const GTypeOfFE<Mesh> *,int> m;
- int i=k,j;
- while(i--) // on va a l'envert pour avoir comp[i] <=i
-@@ -503,7 +503,7 @@ template<class Mesh> void GTypeOfFESum<Mesh>::set(const Mesh & Th,const Element
- {
- int op=0,oc=0,odof=oodf,ocoef=oocoef;
- assert(nnump==0);
-- for (int i=0,k=0;i<this->nb_sub_fem;i++)
-+ for (int i=0;i<this->nb_sub_fem;i++)
- {
- const GTypeOfFE<Mesh> &ti=*this->Sub_ToFE[i];
- if(!ti.invariantinterpolationMatrix)
-diff --git a/src/femlib/GQuadTree.cpp b/src/femlib/GQuadTree.cpp
-index faa6a508..1a647575 100644
---- a/src/femlib/GQuadTree.cpp
-+++ b/src/femlib/GQuadTree.cpp
-@@ -617,7 +617,9 @@ template<class Vertex> ostream& operator <<(ostream& f, const GTree<Vertex> & q
- const int d=Rd::d;
- R dP=DBL_MAX, nddd=0;
- Rd PPhat,Delta;
-+#ifndef NDEBUG
- int k=0;
-+#endif
- int nReStart = 0;
- int itstart[100],kstart=0;
- int it,j,it00;
-@@ -787,7 +789,7 @@ RESTART:
- else*/
- {
- int k= nReStart-1;
-- int i = (nReStart-2)/2;
-+// int i = (nReStart-2)/2;
-
- for(int i=0; i<Rd::d; ++i)
- Delta[i]= ((1<<i) & k) ? nddd : -nddd;
-diff --git a/src/femlib/GenericMesh.hpp b/src/femlib/GenericMesh.hpp
-index 19d05c38..d513051d 100644
---- a/src/femlib/GenericMesh.hpp
-+++ b/src/femlib/GenericMesh.hpp
-@@ -62,7 +62,7 @@ namespace Fem2D {
-
- inline int randwalk(int ncas)
- {
-- const long long a = 314125421, b =1, m= 777777;
-+ const long long a = 314125421, m= 777777;
- static long xn = 19999999%m;
- if(ncas <=0) xn=19999999%m;
- long long xxn = xn;
-@@ -105,13 +105,13 @@ const int TypeVolume =3;
-
- template<> inline int NumPerm1<3>(int *p) {
- // signe + depart*2
-- int k=0,i0=0,i1=1,i2=2,j[3];
-+ int k=0,i0=0,i1=1,i2=2;
- if(p[i0]> p[i1]) swap(i0,i1),k +=1;
- if(p[i1]> p[i2]) swap(i1,i2),k +=1;
- if(p[i0]> p[i1]) swap(i0,i1),k +=1;
- assert(p[i0] < p[i1] && p[i1] < p[i2]);
-- // j is inv of i1,i2,i3
-- j[i0]=0;j[i1]=1;j[i2]=2;
-+// // j is inv of i1,i2,i3
-+// j[i0]=0;j[i1]=1;j[i2]=2;
- return (k%2)+i0*2; // signe + depart*2
- }
-
-@@ -1271,7 +1271,7 @@ DataFENodeDF GenericMesh<T,B,V>::BuildDFNumbering(int ndfon[NbTypeItemElement],i
- const int nke= T::ne;
- const int nkt= T::nt;
- const int nbev= B::nv;
-- const int nbef= B::nf;
-+// const int nbef= B::nf;
- const int nbee= B::ne;
- const int nk[]={nkv,nke,nkf,nkt};
- int MaxNbNodePerElement=0;
-diff --git a/src/femlib/MatriceCreuse_tpl.hpp b/src/femlib/MatriceCreuse_tpl.hpp
-index 0059b540..5b123dba 100644
---- a/src/femlib/MatriceCreuse_tpl.hpp
-+++ b/src/femlib/MatriceCreuse_tpl.hpp
-@@ -37,7 +37,7 @@ template<class R> inline R blas_sdot(const int n,const R *sx,const int incx,cons
- else
- for (int k = 0; k< n; k++, sx += incx, sy += incy)
- s += *sx * *sy;
-- return s;
-+ return s;
- }
-
- template<class R> inline R blas_sdot( int n, R *sx, int incx, R *sy, int incy)
-@@ -1331,7 +1331,7 @@ template<class R>
- M.addMatTo(coef,mij,transpose,ii00,jj00,transpose&&cnj,0.0,sym);
- }
- }
-- int nbcoef=mij.size();
-+// int nbcoef=mij.size();
-
- // return new MatriceMorse<R>(n,m,mij,sym);
- return make_triplet(n,m,sym);
-diff --git a/src/femlib/Mesh3dn.cpp b/src/femlib/Mesh3dn.cpp
-index b1ca0d26..97c067a3 100644
---- a/src/femlib/Mesh3dn.cpp
-+++ b/src/femlib/Mesh3dn.cpp
-@@ -1219,7 +1219,7 @@ const string Gsbegin="Mesh3::GSave v0",Gsend="end";
- // new version ...
- int WalkInTetn(const Mesh3 & Th,int it, R3 & Phat,const R3 & U, R & dt, R3 & offset)
- {
-- int ncas=0 ;
-+// int ncas=0 ;
- const R eps = 1e-12;
- const R epsb = 1e-10;
- const R epsedge = 1e-9;
-diff --git a/src/femlib/RNM.hpp b/src/femlib/RNM.hpp
-index f7a9d0b4..3808a8e9 100644
---- a/src/femlib/RNM.hpp
-+++ b/src/femlib/RNM.hpp
-@@ -1270,7 +1270,7 @@ class KNM: public KNM_<R>{ public:
- void resize(long nn,long mm) {
- long kk=nn*mm;
-
-- long lso = this->size();
-+// long lso = this->size();
- long n = this->shapei.n;
- long m = this->shapej.n;
-
-diff --git a/src/femlib/RNM_op.hpp b/src/femlib/RNM_op.hpp
-index ee0e7d8c..aa0999a8 100644
---- a/src/femlib/RNM_op.hpp
-+++ b/src/femlib/RNM_op.hpp
-@@ -60,7 +60,7 @@ KNM_<R> & KNM_<R>::operator oper (const ConjKNM_<R> & u)
- for(int i=0;i<N();++i)
- for(int j=0;j<M();++j)
- KNM_<R>::operator () (i,j) oper RNM::conj( u(i,j));
-- return *this;
-+ return *this;
- }
-
-
-diff --git a/src/femlib/fem.cpp b/src/femlib/fem.cpp
-index 9505c093..dcc667b5 100644
---- a/src/femlib/fem.cpp
-+++ b/src/femlib/fem.cpp
-@@ -471,7 +471,7 @@ public:
- int gd=0; // gd = 0 => left side an gd=1 => right side
-
-
-- int kkkk=0;
-+// int kkkk=0;
- do { // for all
-
-
-@@ -1192,22 +1192,23 @@ PICHON: // Add dec 2010 ...
- npichon2d++;
- // Brute force .... bof bof ...
- double ddp=1e100;
-- int pk=-1;
-+// int pk=-1;
-
- for(int k=0;k<nt;++k)
- {
-- int n=0,nl[3];
-+ int n=0;
-+// int nl[3];
- Triangle & K=triangles[k];
- R2 & A(K[0]), & B(K[1]), & C(K[2]), G((A+B+C)/3.);
- R l[3]={0,0,0};
- R area2= K.area*2;
-- R eps = -area2*1e-6;
-+// R eps = -area2*1e-6;
- l[0] = Area2(P,B,C);
- l[1] = Area2(A,P,C);
- l[2] = area2-l[0]-l[1];
-- if (l[0] < eps) nl[n++]=0;
-- if (l[1] < eps) nl[n++]=1;
-- if (l[2] < eps) nl[n++]=2;
-+// if (l[0] < eps) nl[n++]=0;
-+// if (l[1] < eps) nl[n++]=1;
-+// if (l[2] < eps) nl[n++]=2;
- if (n==0)
- { // interior => return
- outside=false;
-@@ -1218,7 +1219,7 @@ PICHON: // Add dec 2010 ...
- double lgp2=(GP,GP);
- if(ddp > lgp2) {
- ddp=lgp2;
-- pk=k;
-+// pk=k;
-
- }
- }
-@@ -1577,7 +1578,9 @@ Mesh::Mesh(const Mesh & Th,int * split,bool WithMortar,int label)
-
- int nebmax=neb;
- int nebimax=nebi;
-+#ifndef NDEBUG
- int nbsddmax=nbsdd;
-+#endif
- for (int i=0;i<Th.nt;i++)
- if(split[i])
- nvmax += NbOfSubInternalVertices(split[i]) -3;
-@@ -1683,7 +1686,9 @@ Mesh::Mesh(const Mesh & Th,int * split,bool WithMortar,int label)
-
- BoundaryEdge * bbedges = bbe ? bedges : bedgesi;
- int & nneb = bbe ? neb : nebi;
-+#ifndef NDEBUG
- int nnebmax = bbe ? nebmax : nebimax;
-+#endif
- int offset= bbe ? 0 : nebmax;
- if (bbe || (!pbe && (ie0 < ie1) ) ) // arete interne ou frontiere
- {
-diff --git a/src/femlib/gibbs.cpp b/src/femlib/gibbs.cpp
-index 025bb846..338320f9 100644
---- a/src/femlib/gibbs.cpp
-+++ b/src/femlib/gibbs.cpp
-@@ -1104,7 +1104,7 @@ int FESpace::renum()
- if (cdef==0) return -2;
- if (cdef->NodesOfElement==0) return -2;
- int nv = NbOfNodes;
-- int nt = NbOfElements;// ;Th.nt;
-+// int nt = NbOfElements;// ;Th.nt;
- long pfold =0, pfnew=0;
- long* ptvois=NULL;
- long* vois=NULL;
-diff --git a/src/fflib/AFunction.cpp b/src/fflib/AFunction.cpp
-index 96e34d38..8196f3d0 100644
---- a/src/fflib/AFunction.cpp
-+++ b/src/fflib/AFunction.cpp
-@@ -1846,7 +1846,7 @@ C_F0 opVI::code2(const basicAC_F0 &args) const
- Expression p=args[1];
- if ( ! p->EvaluableWithOutStack() )
- {
-- bool bb=p->EvaluableWithOutStack();
-+// bool bb=p->EvaluableWithOutStack();
- //cout << bb << " " << * p << endl;
- CompileError(" [...][p], The p must be a constant , sorry");
- }
-diff --git a/src/fflib/array_tlp.hpp b/src/fflib/array_tlp.hpp
-index d6fdc4b8..03e50ebc 100644
---- a/src/fflib/array_tlp.hpp
-+++ b/src/fflib/array_tlp.hpp
-@@ -960,7 +960,7 @@ struct Op3_paca: public ternary_function<KN_<K>,K,KN_<K>,if_arth_KN_<K>*> {
- template<class K>
- struct Op3_pacc: public ternary_function<KN_<K>,K,K,if_arth_KN_<K>*> {
- static if_arth_KN_<K>* f(Stack s,const KN_<K> & a,const K & b,const K & c ) {
-- K cc(c),bb(b);
-+// K cc(c),bb(b);
- KN_<K> kc(new(NewAllocTmp(s,sizeof(c))) K(c),1,0),
- kb(new(NewAllocTmp(s,sizeof(b))) K(b),1,0);
- return new if_arth_KN_<K>(a,kb,kc);}
-@@ -1241,8 +1241,8 @@ void ArrayOperator()
-
- Dcl_Type< Resize<KN<K> > > ();
- Dcl_Type< Resize<KNM<K> > > ();
-- aType knrp = atype<KN<K> *>();
-- aType knr_ = atype<KN_<K> >();
-+// aType knrp = atype<KN<K> *>();
-+// aType knr_ = atype<KN_<K> >();
- //- typedef KN<Z> ZN;
-
- // add dec 2009. ne marche pas ( incompatible avec MatrixBlock) a comprendre ????? FH.
-@@ -1253,7 +1253,7 @@ void ArrayOperator()
- // map_type[typeid(KN_<K>).name()]->AddCast(new OneOperator_2KN_<K>);
- // fin add
- // ----
-- aType knlp= aaaa_knlp ;
-+// aType knlp= aaaa_knlp ;
-
- atype<KN<K>* >()->Add("[","",new OneOperator2_<K*,KN<K>*,Z >(get_elementp_<K,KN<K>*,Z>));
- atype<KN<K>* >()->Add("(","",new OneOperator2_<K*,KN<K>*,Z >(get_elementp_<K,KN<K>*,Z>));
-diff --git a/src/fflib/glumesh2D.cpp b/src/fflib/glumesh2D.cpp
-index b7391510..09926898 100755
---- a/src/fflib/glumesh2D.cpp
-+++ b/src/fflib/glumesh2D.cpp
-@@ -102,7 +102,7 @@ Mesh * GluMesh(listMesh const & lst)
- const Mesh &Th(**i);
- if(!*i) continue;
- if(verbosity>1) cout << " GluMesh + "<< Th.nv << " " << Th.nt << endl;
-- int nbv0 = nbv;
-+// int nbv0 = nbv;
-
- for (int ii=0;ii<Th.nv;ii++)
- {
-@@ -277,7 +277,8 @@ AnyType SetMesh_Op::operator()(Stack stack) const
- int nebn =0;
- for(int i=0;i<neb;++i)
- {
-- int l0,l1=ChangeLab(mape,l0=m->bedges[i].lab) ;
-+ int l0;
-+ /* l1= */ ChangeLab(mape,l0=m->bedges[i].lab) ;
- nebn++;
- }
-
-diff --git a/src/fflib/lex.cpp b/src/fflib/lex.cpp
-index b44a4277..eadff927 100644
---- a/src/fflib/lex.cpp
-+++ b/src/fflib/lex.cpp
-@@ -522,7 +522,6 @@ bool mylex::AddMacro(string m,string def)
- {
- bool ok=1;
- char *macroname=newcopy(m.c_str());
-- int nbparam =0;
- MacroData macroparm;
- macroparm.d.push_back(def);
- MapMacroDef & MacroDef =listMacroDef->back();
-@@ -578,12 +577,11 @@ bool mylex::SetMacro(int &ret)
-
- } while(1);
- }
-- int kmacro=0;
-
- macroparm.l = linenumber;// s
- macroparm.f = file(); //
- do {
-- int lk=0,nl=0;
-+ int nl=0;
- string item;
- int i = source().get();
- if (i == EOF) { cerr << "in macro " <<macroname << endl;
-@@ -693,12 +691,11 @@ bool mylex::IFMacro(int &ret)
- }
-
- if (rr!=')') {ErrorScan(" missing ')' after IFMACRO(macro) ");}
-- int kmacro=0;
- if(debugmacro) cout << " IFMacro:: " << id << endl;
- lgifm=linenumber;
- string def;
- do {
-- int lk=0,nl=0;
-+ int nl=0;
- string item;
- int i = source().get();
-
-@@ -787,7 +784,7 @@ bool mylex::CallMacro(int &ret)
- int kend=')';
- while (1) {
- cmm="";
-- int sep = EatCommentAndSpace(&cmm);
-+ /* int sep = */ EatCommentAndSpace(&cmm);
- p += cmm;
- int rr = scan1();// do macro expantion
- if(lvll && rr==')') lvll--; // if ( then we eat next )
-diff --git a/src/fflib/lgfem.cpp b/src/fflib/lgfem.cpp
-index 1b712371..8b9bb98a 100644
---- a/src/fflib/lgfem.cpp
-+++ b/src/fflib/lgfem.cpp
-@@ -875,7 +875,7 @@ class LinearGMRES : public OneOperator
- if (nargs[5]) verb=Abs(GetAny<long>((*nargs[5])(stack)));
- if (nargs[6]) stop= new E_StopGC<R>(stack,n,dynamic_cast<const Polymorphic *>(nargs[6]));
-
-- long gcverb=51L-Min(Abs(verb),50L);
-+// long gcverb=51L-Min(Abs(verb),50L);
-
-
- int ret;
-@@ -2966,7 +2966,7 @@ struct set_eqvect_fl: public binary_function<KN<K>*,const FormLinear *,KN<K>*>
- R r=0;
-
- SHOWVERB(cout << " int " << endl);
-- const vector<Expression> & what(di->what);
-+// const vector<Expression> & what(di->what);
- const int dim =di->d;
-
- const GQuadratureFormular<R1>& FIE = di->FIE(stack);
-@@ -3109,11 +3109,11 @@ struct set_eqvect_fl: public binary_function<KN<K>*,const FormLinear *,KN<K>*>
-
- if(di->islevelset())
- { // add FH mars 2014 compute int2d on phi < 0 ..
-- double llevelset = 0;
-+// double llevelset = 0;
- double uset = HUGE_VAL;
-- R2 Q[3];
-+// R2 Q[3];
- KN<double> phi(Th.nv);phi=uset;
-- double f[3],umx,umn;
-+ double f[3] /* ,umx,umn */;
- for(int t=0; t< Th.nt;++t)
- {
- if (all || setoflab.find(Th[t].lab) != setoflab.end())
-@@ -3540,7 +3540,7 @@ int Send3d(PlotStream & theplot,Plot::ListWhat &lli,map<const typename v_fes::FE
- int cmp[3]={-1,-1,-1};
- int err=1;
- long what=lli.what;
-- int lg,nsb;
-+// int lg,nsb;
- if (what%10==6)
- {
- int lg,nsb;
-@@ -4319,7 +4319,7 @@ AnyType Plot::operator()(Stack s) const{
- if (l[i].e[2]) { z.set(l[i].evalt(2,s));}
- if (l[i].e[3]) { v.set(l[i].evalt(3,s));}
- long k= Min(x.N(),y.N());
-- bool colored= (v.N()==k);
-+// bool colored= (v.N()==k);
- // if(colored)
- NewSetColorTable(Viso.N()+4,colors,nbcolors,hsv);
- // cout << " a faire " << endl;
-diff --git a/src/fflib/lgmat.cpp b/src/fflib/lgmat.cpp
-index c3faeb0d..0d54ed85 100644
---- a/src/fflib/lgmat.cpp
-+++ b/src/fflib/lgmat.cpp
-@@ -420,7 +420,7 @@ AnyType SetRestrict(Stack stack,Expression einj,Expression erest)
- long neC = VCh.NbOfElements ;
- long neF = VFh.NbOfElements ;
- long ndfC = VCh.NbOfDF ;
-- long ndfF = VFh.NbOfDF ;
-+// long ndfF = VFh.NbOfDF ;
-
- KN_<long> nc2f= ncf;
- if(INIT==0)
-@@ -3185,7 +3185,7 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
- int* lg = new int[n + 1];
- int* cl;
- T* val;
-- T* b;
-+// T* b;
- if(rhs && pOut->n != n) pOut->resize(n);
-
- std::vector<signed int> tmpVec;
-diff --git a/src/fflib/lgmesh.cpp b/src/fflib/lgmesh.cpp
-index 75d8d4c7..96a1c651 100644
---- a/src/fflib/lgmesh.cpp
-+++ b/src/fflib/lgmesh.cpp
-@@ -860,8 +860,8 @@ AnyType Adaptation::operator()(Stack stack) const
- // a faire F Hecht .
-
- Metric Mhmax(hmax);
-- double ch2=2/(hmax*hmax);
-- double cH2=2/(hmin*hmin);
-+// double ch2=2/(hmax*hmax);
-+// double cH2=2/(hmin*hmin);
-
- for ( iv=0;iv<Th.nbv;iv++)
- Th[iv].m = Mhmax;
-@@ -1243,8 +1243,8 @@ Mesh * Carre_(int nx,int ny,Expression fx,Expression fy,Stack stack,int flags,KN
-
- if(verbosity>1&& !direct) cout << " -- square : all triangles are reversed" << endl;
-
-- int p[2]={1,0};
-- if(direct) {p[0]=0,p[1]=1;}
-+// int p[2]={1,0};
-+// if(direct) {p[0]=0,p[1]=1;}
- for (int j=0;j<ny;j++)
- for (int i=0;i<nx;i++)
- {
-@@ -1752,13 +1752,13 @@ AnyType CheckMoveMesh::operator()(Stack stack) const
-
- bool SameMesh(const Mesh * const & pTh1,const Mesh * const & pTh2)
- {
-- typedef Mesh::Element Element;
-+// typedef Mesh::Element Element;
- if( !pTh1) return 0;
- if( !pTh2) return 0;
- if( pTh1 == pTh2) return 1;
- if( pTh1->nv != pTh2->nv) return 0;
- if( pTh1->nt != pTh2->nt) return 0;
-- const Mesh & Th1=*pTh1, & Th2 = *pTh2;
-+// const Mesh & Th1=*pTh1, & Th2 = *pTh2;
- ffassert(0); // a faire..
-
- return 1;
-@@ -1825,7 +1825,7 @@ double arealevelset(Mesh const * const & pTh,KN<double> * const & pphi,const do
- if( !where || (*where)[k] )
- {
- const Triangle & K(Th[k]);
-- const Vertex & A(K[0]), &B(K[1]),&C(K[2]);
-+// const Vertex & A(K[0]), &B(K[1]),&C(K[2]);
- int iK[3]={Th(k,0),Th(k,1),Th(k,2)};
- R fk[3]={phi[iK[0]]-phi0,phi[iK[1]]-phi0,phi[iK[2]]-phi0 };
- int i0 = 0, i1 = 1, i2 =2;
-diff --git a/src/fflib/lgsolver.hpp b/src/fflib/lgsolver.hpp
-index 1c91fc2b..26b7d6a3 100644
---- a/src/fflib/lgsolver.hpp
-+++ b/src/fflib/lgsolver.hpp
-@@ -170,7 +170,7 @@ class SolveGCPrecon : public MatriceMorse<R>::VirtualSolver , public VirtualMa
- precon = to<KN_<R> >(C_F0(code_del,*C));// 2 undelete pointer
-
- throwassert(precon);
-- R aii;
-+// R aii;
- A.getdiag(D1);
- double tgv=Fem2D::norm(D1.linfty() ) ;
- if( Fem2D::norm(tgv) < 1e10) tgv=1e100;
-@@ -247,7 +247,7 @@ class SolveGMRESPrecon : public MatriceMorse<R>::VirtualSolver , public Virtua
-
- throwassert(precon);
-
-- R aii;
-+// R aii;
- A.getdiag(D1);
- double tgv = D1.linfty();
- if( tgv < 1e5) tgv = 1e100; // if no tgv remove ..
-diff --git a/src/fflib/problem.cpp b/src/fflib/problem.cpp
-index 1fb37d10..bff9fa92 100644
---- a/src/fflib/problem.cpp
-+++ b/src/fflib/problem.cpp
-@@ -1967,7 +1967,9 @@ void Check(const Opera &Op,int N,int M)
- Fem2D::MeshPoint & mp (*Fem2D::MeshPointStack(stack)), mps = mp;
-
- const CDomainOfIntegration & di= *b->di;
-+#ifndef NDEBUG
- const Mesh3 * pThdi = GetAny<pmesh3>( (* di.Th)(stack));
-+#endif
- SHOWVERB(cout << " FormBilinear () " << endl);
- //MatriceElementaireSymetrique<R> *mates =0;
- // MatriceElementairePleine<R> *matep =0;
-@@ -2112,7 +2114,7 @@ void Check(const Opera &Op,int N,int M)
- {
- if(di.islevelset()) // may 2014 FH ...
- { // int3d levelset < 0
-- double llevelset = 0;
-+// double llevelset = 0;
- const double uset = std::numeric_limits<double>::max();
- // cout << " uset ="<<uset << endl;
- R3 Q[3][4];
-@@ -2128,7 +2130,7 @@ void Check(const Opera &Op,int N,int M)
- if (all || setoflab.find(Th[t].lab) != setoflab.end())
-
- {
-- double umx=std::numeric_limits<double>::min(),umn=std::numeric_limits<double>::max();
-+// double umx=std::numeric_limits<double>::min(),umn=std::numeric_limits<double>::max();
- for(int i=0;i<4;++i)
- {
- int j= Th(t,i);
-@@ -3993,7 +3995,9 @@ void Check(const Opera &Op,int N,int M)
- // const QuadratureFormular1d & FI = QF_GaussLegendre2;
- long npi;
- long i,nv=Kv.NbDoF(),N=Kv.N;
-+#ifndef NDEBUG
- long nnv=KKv.NbDoF();
-+#endif
- assert(nv==nnv);
- // bool show = Kv.Vh.Th(T)==0;
- // char * xxx[] ={" u"," v,"," p"," q"," r"};
-diff --git a/src/fflib/problem.hpp b/src/fflib/problem.hpp
-index 81dbcbba..941ec5a7 100644
---- a/src/fflib/problem.hpp
-+++ b/src/fflib/problem.hpp
-@@ -1056,12 +1056,12 @@ AnyType OpArraytoLinearForm<R,v_fes>::Op::operator()(Stack stack) const
- {
- typedef v_fes *pfes;
- typedef typename v_fes::FESpace FESpace;
-- typedef typename FESpace::Mesh Mesh;
-- typedef typename FESpace::FElement FElement;
-- typedef typename Mesh::Element Element;
-- typedef typename Mesh::Vertex Vertex;
-- typedef typename Mesh::RdHat RdHat;
-- typedef typename Mesh::Rd Rd;
-+// typedef typename FESpace::Mesh Mesh;
-+// typedef typename FESpace::FElement FElement;
-+// typedef typename Mesh::Element Element;
-+// typedef typename Mesh::Vertex Vertex;
-+// typedef typename Mesh::RdHat RdHat;
-+// typedef typename Mesh::Rd Rd;
-
- pfes & pp= *GetAny<pfes * >((*l->ppfes)(stack));
- FESpace * pVh = *pp ;
-@@ -1192,10 +1192,10 @@ AnyType OpMatrixtoBilinearForm<R,v_fes>::Op::operator()(Stack stack) const
- typedef typename v_fes::FESpace FESpace;
- typedef typename FESpace::Mesh Mesh;
- typedef typename FESpace::FElement FElement;
-- typedef typename Mesh::Element Element;
-- typedef typename Mesh::Vertex Vertex;
-- typedef typename Mesh::RdHat RdHat;
-- typedef typename Mesh::Rd Rd;
-+// typedef typename Mesh::Element Element;
-+// typedef typename Mesh::Vertex Vertex;
-+// typedef typename Mesh::RdHat RdHat;
-+// typedef typename Mesh::Rd Rd;
-
- assert(b && b->nargs);// *GetAny<pfes * >
- pfes * pUh= GetAny<pfes *>((*b->euh)(stack));
-diff --git a/src/medit/inout_popenbinaire.c b/src/medit/inout_popenbinaire.c
-index 3520152e..763d86aa 100644
---- a/src/medit/inout_popenbinaire.c
-+++ b/src/medit/inout_popenbinaire.c
-@@ -78,8 +78,8 @@ void getline_bin_double_noref(int ddim, double *v){
-
- void read_TypeSizeTyptab_bin(int *type,int *size,int *typtab){
-
-- char data[256];
-- char *tictac;
-+// char data[256];
-+// char *tictac;
- int i;
- int tmptype;
- int tmpsize;
-@@ -110,7 +110,7 @@ int loadMesh_popen_bin(pMesh mesh) {
- int i,ia,ib,inm,ref,is,k,disc,nn,nt,nq;
- char *ptr,data[256];
- /* Rajout popen*/
-- char *tictac;
-+// char *tictac;
- char *natureread;
- int loopdebug;
- int vatn[2];
-@@ -121,9 +121,9 @@ int loadMesh_popen_bin(pMesh mesh) {
- int cod;
- int KwdCod;
- int NulPos;
-- int NextKwdPos;
-+// int NextKwdPos;
- /* rajout */
-- float ftab[3];
-+// float ftab[3];
- #ifdef WIN32
- _setmode(fileno(stdin),O_BINARY);
- #endif
-@@ -800,9 +800,9 @@ int loadSol_popen_bin(pMesh mesh,char *filename,int numsol) {
- pSolution sol;
- double dbuf[ GmfMaxTyp ];
- float fbuf[ GmfMaxTyp ];
-- double m[6],lambda[3],eigv[3][3],vp[2][2];
-- int inm,k,i,key,nel,size,type,iord,off,typtab[GmfMaxTyp],ver,dim;
-- char *ptr,data[128];
-+// double m[6],lambda[3],eigv[3][3],vp[2][2];
-+ int inm, /* k,i, */ key,nel,size,type, /* iord, off, */ typtab[GmfMaxTyp],ver,dim;
-+// char *ptr,data[128];
-
- // rajout pour popen
- int NumberofSolAT;
-diff --git a/src/medit/medit.c b/src/medit/medit.c
-index 64a566dd..e4876125 100644
---- a/src/medit/medit.c
-+++ b/src/medit/medit.c
-@@ -188,8 +188,8 @@ int medit0() {
-
- int medit0_popen() {
- pMesh mesh;
-- char data[128],*name;
-- int k,l,ret;
-+ char data[128] /* ,*name */;
-+ int k /* ,l*/ ,ret;
- clock_t ct;
-
- /* default */
-@@ -304,9 +304,9 @@ int medit1() {
-
- int main(int argc,char *argv[]) {
- int type;
-+#ifdef ppc
- char pwd[1024];
-
--#ifdef ppc
- if ( !getwd(pwd) ) exit(2);
- #endif
-
-diff --git a/src/medit/stream.c b/src/medit/stream.c
-index 64acb3fe..76103ef1 100644
---- a/src/medit/stream.c
-+++ b/src/medit/stream.c
-@@ -168,8 +168,8 @@ int inSubTetra(pPoint pt[4],float *p,double *cb) {
-
- int locateHexa(pMesh mesh,int nsdep,int base,float *p,double *cb,pPoint pt[4]) {
- pHexa ph;
-- double bx,by,bz,cx,cy,cz,dx,dy,dz,vx,vy,vz,apx,apy,apz;
-- double epsra,vol1,vol2,vol3,vol4,dd;
-+// double bx,by,bz,cx,cy,cz,dx,dy,dz,vx,vy,vz,apx,apy,apz;
-+// double epsra,vol1,vol2,vol3,vol4,dd;
- int *adj,iadr,it,nsfin,in;
-
- it = 0;
---
-2.17.1
-
diff --git a/0002-Fix-formating-buffers.patch b/0002-Fix-formating-buffers.patch
new file mode 100644
index 0000000..dc6f252
--- /dev/null
+++ b/0002-Fix-formating-buffers.patch
@@ -0,0 +1,41 @@
+From a179d870788bd75640dae947e662249114751b70 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
+Date: Mon, 8 May 2017 08:50:01 +0200
+Subject: [PATCH 2/9] Fix formating/buffers
+
+---
+ src/libMesh/memory.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/libMesh/memory.c b/src/libMesh/memory.c
+index 77ca49a0..75274329 100644
+--- a/src/libMesh/memory.c
++++ b/src/libMesh/memory.c
+@@ -222,18 +222,18 @@ void M_free(void *ptr) {
+
+ /* dump memory requirements */
+ void primem(int np) {
+- int memsize;
++ size_t memsize;
+
+ memsize = M_memSize();
+ if ( memsize ) {
+ fprintf(stdout,"\n -- MEMORY REQUIREMENTS\n");
+ if (memsize > 1024*1024)
+- fprintf(stdout," Total size : %10zd Mbytes",
+- (long int)(memsize/(1024.*1024.)));
++ fprintf(stdout," Total size : %10Zd Mbytes",
++ (memsize/(1024*1024)));
+ else if (memsize > 1024)
+- fprintf(stdout," Total size : %10zd Kbytes",(long int)(memsize/1024.));
++ fprintf(stdout," Total size : %10Zd Kbytes",(memsize/1024));
+ else
+- fprintf(stdout," Total size : %10zd bytes ",(long int)memsize);
+- fprintf(stdout," (i.e. %d bytes/point)\n",memsize / np);
++ fprintf(stdout," Total size : %10Zd bytes ",memsize);
++ fprintf(stdout," (i.e. %zd bytes/point)\n",memsize / np);
+ }
+ }
+--
+2.19.2
+
diff --git a/0003-Fix-formating-buffers.patch b/0003-Fix-formating-buffers.patch
deleted file mode 100644
index 87ad3ec..0000000
--- a/0003-Fix-formating-buffers.patch
+++ /dev/null
@@ -1,227 +0,0 @@
-From d666577fc856a88dc4ed38b7f6b69aa9ad7242be Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
-Date: Mon, 8 May 2017 08:50:01 +0200
-Subject: [PATCH 03/10] Fix formating/buffers
-
----
- examples++-load/iovtk.cpp | 12 ++++++------
- src/libMesh/memory.c | 10 +++++-----
- src/medit/animat.c | 2 +-
- src/medit/gisfil.c | 2 +-
- src/medit/inout_morice.c | 2 +-
- src/medit/scene.c | 2 +-
- src/medit/sftcpy.c | 4 ++--
- src/medit/stream.c | 16 ++++++++--------
- 8 files changed, 25 insertions(+), 25 deletions(-)
-
-diff --git a/examples++-load/iovtk.cpp b/examples++-load/iovtk.cpp
-index 1f434471..54a1c76b 100644
---- a/examples++-load/iovtk.cpp
-+++ b/examples++-load/iovtk.cpp
-@@ -1761,7 +1761,7 @@ public:
- l[jj][0]=to<double>( args[i] );
-
- char number[16];
-- sprintf(number,"%li",jj+1);
-+ sprintf(number,"%zu",jj+1);
- l[jj].name=scas;
- l[jj].name+=number;
- sca++;
-@@ -1783,7 +1783,7 @@ public:
- }
-
- char number[16];
-- sprintf(number,"%li",jj+1);
-+ sprintf(number,"%zu",jj+1);
- l[jj].name=vecs;
- l[jj].name+=number;
- vec++;
-@@ -1796,7 +1796,7 @@ public:
- l[jj][j] = to<double>( (*a0)[j]);
- }
- char number[16];
-- sprintf(number,"%li",jj+1);
-+ sprintf(number,"%zu",jj+1);
- l[jj].name=tens;
- l[jj].name+=number;
- ten++;
-@@ -3344,7 +3344,7 @@ public:
- l[jj][0]=to<double>( args[i] );
-
- char number[16];
-- sprintf(number,"%li",jj+1);
-+ sprintf(number,"%zu",jj+1);
- l[jj].name=scas;
- l[jj].name+=number;
- sca++;
-@@ -3365,7 +3365,7 @@ public:
- l[jj][j] = to<double>( (*a0)[j]);
- }
- char number[16];
-- sprintf(number,"%li",jj+1);
-+ sprintf(number,"%zu",jj+1);
- l[jj].name=vecs;
- l[jj].name+=number;
- vec++;
-@@ -3379,7 +3379,7 @@ public:
- l[jj][j] = to<double>( (*a0)[j]);
- }
- char number[16];
-- sprintf(number,"%li",jj+1);
-+ sprintf(number,"%zu",jj+1);
- l[jj].name=tens;
- l[jj].name+=number;
- ten++;
-diff --git a/src/libMesh/memory.c b/src/libMesh/memory.c
-index 3a2859e3..e76b0c95 100644
---- a/src/libMesh/memory.c
-+++ b/src/libMesh/memory.c
-@@ -222,18 +222,18 @@ void M_free(void *ptr) {
-
- /* dump memory requirements */
- void primem(int np) {
-- int memsize;
-+ size_t memsize;
-
- memsize = M_memSize();
- if ( memsize ) {
- fprintf(stdout,"\n -- MEMORY REQUIREMENTS\n");
- if (memsize > 1024*1024)
- fprintf(stdout," Total size : %10Zd Mbytes",
-- (long int)(memsize/(1024.*1024.)));
-+ (memsize/(1024*1024)));
- else if (memsize > 1024)
-- fprintf(stdout," Total size : %10Zd Kbytes",(long int)(memsize/1024.));
-+ fprintf(stdout," Total size : %10Zd Kbytes",(memsize/1024));
- else
-- fprintf(stdout," Total size : %10Zd bytes ",(long int)memsize);
-- fprintf(stdout," (i.e. %d bytes/point)\n",memsize / np);
-+ fprintf(stdout," Total size : %10Zd bytes ",memsize);
-+ fprintf(stdout," (i.e. %zd bytes/point)\n",memsize / np);
- }
- }
-diff --git a/src/medit/animat.c b/src/medit/animat.c
-index d4aa6df4..fd2002d9 100644
---- a/src/medit/animat.c
-+++ b/src/medit/animat.c
-@@ -116,7 +116,7 @@ int loadNextMesh(pMesh mesh,int k,int parse) {
-
- int playAnim(pScene sc,pMesh mesh,int deb,int fin) {
- int k;
-- char *ptr,data[256],base[256];
-+ char *ptr,data[274],base[256];
-
- /* get basename */
- sprintf(data,".%d",deb);
-diff --git a/src/medit/gisfil.c b/src/medit/gisfil.c
-index f48de08d..91c18fb1 100644
---- a/src/medit/gisfil.c
-+++ b/src/medit/gisfil.c
-@@ -102,7 +102,7 @@ int loadGIS(pMesh mesh) {
- for (i=1; i<=sx; i++) {
- k = (j-1)*sx + i;
- ppt = &mesh->point[k];
-- fscanf(fp,"%f",&ppt->c[2]);
-+ fscanf(fp,"%lf",&ppt->c[2]);
- ppt->c[0] = (float)(ggx*(xxm + i-1));
- ppt->c[1] = (float)(ggy*(yym + j-1));
- ppt->c[2] = (float)(hhz*ppt->c[2]);
-diff --git a/src/medit/inout_morice.c b/src/medit/inout_morice.c
-index 2fdb8236..1d858ff1 100755
---- a/src/medit/inout_morice.c
-+++ b/src/medit/inout_morice.c
-@@ -1309,7 +1309,7 @@ int loadSol_popen(pMesh mesh,char *filename,int numsol) {
-
- while( !feof(stdin) ){
- //fprintf(stdout,"data= %s\n",data);
-- fgets(data,256,stdin);
-+ fgets(data,sizeof(data),stdin);
- tictac = strtok(data," \n");
- if(tictac == NULL) continue;
- //fprintf(stdout,"data= %s, tictac= %s\n",data,tictac);
-diff --git a/src/medit/scene.c b/src/medit/scene.c
-index 67acb7f6..2d64abba 100644
---- a/src/medit/scene.c
-+++ b/src/medit/scene.c
-@@ -807,7 +807,7 @@ void initGrafix(pScene sc,pMesh mesh) {
- /* new scene */
- int createScene(pScene sc,int idmesh) {
- pMesh mesh;
-- char data[128];
-+ char data[274];
-
- /* default */
- mesh = cv.mesh[idmesh];
-diff --git a/src/medit/sftcpy.c b/src/medit/sftcpy.c
-index fcfa3e3b..16c5d26b 100644
---- a/src/medit/sftcpy.c
-+++ b/src/medit/sftcpy.c
-@@ -137,7 +137,7 @@ int coreps(FILE *file,GLsizei size,GLfloat *buffer) {
- }
-
- if ( ddebug )
-- printf("size = %d ptr = %p buffer = %p -> size = %d\n",
-+ printf("size = %d ptr = %p buffer = %p -> size = %td\n",
- size,ptr,buffer,ptr-buffer);
-
- /* allocate mem to store tokens */
-@@ -185,7 +185,7 @@ int coreps(FILE *file,GLsizei size,GLfloat *buffer) {
- /* Sort the primitives according to depth */
- if ( sc->mode == WIRE || sc->mode == WIRE+S_MATERIAL )
- sorting = FALSE;
-- if ( ddebug ) printf("prim = %d size = %d, %d\n",nit,ptr-buffer-1,size);
-+ if ( ddebug ) printf("prim = %d size = %td, %d\n",nit,ptr-buffer-1,size);
-
- if ( sorting == TRUE ) {
- if ( ddebug ) printf("start sorting %d tokens...\n",nit);
-diff --git a/src/medit/stream.c b/src/medit/stream.c
-index 76103ef1..962caadc 100644
---- a/src/medit/stream.c
-+++ b/src/medit/stream.c
-@@ -1126,8 +1126,8 @@ printf("depart = %d\n",depart);
- if ( !squiet && !ddebug ) {
- fprintf(stdout,": %d (%d, %.2f) / %d lines",
- nbar,nbp,(float)nbp/nbar,k/3);
-- ct = difftime(clock(),ct);
-- fprintf(stdout," %6.2f sec.\n",ct);
-+ double dt = ((double)(clock() - ct)) / ((double) CLOCKS_PER_SEC);
-+ fprintf(stdout," %6.2f sec.\n",dt);
- }
- if ( sc->par.maxtime < FLT_MAX ) {
- fprintf(out,"%8.2f %f %f %f\n",
-@@ -1200,8 +1200,8 @@ printf("depart = %d\n",depart);
- if ( !squiet && !ddebug ) {
- if ( nbar )
- fprintf(stdout,": %d (%d, %.2f) / %d lines",nbar,nbp,(float)nbp/nbar,k/3);
-- ct = difftime(clock(),ct);
-- fprintf(stdout," %6.2f sec.\n",ct);
-+ double dt = ((double)(clock() - ct)) / ((double) CLOCKS_PER_SEC);
-+ fprintf(stdout," %6.2f sec.\n",dt);
- }
-
- return(1);
-@@ -1576,8 +1576,8 @@ int listTriaStream(pScene sc,pMesh mesh,float *pp) {
- glLineWidth(1.0);
- glEndList();
- fprintf(stdout,": %d (%d, %.2f) / %d lines",nbar,nbp,(float)nbp/nbar,k/3);
-- ct = difftime(clock(),ct);
-- fprintf(stdout," %6.2f sec.\n",ct);
-+ double dt = ((double)(clock() - ct)) / ((double) CLOCKS_PER_SEC);
-+ fprintf(stdout," %6.2f sec.\n",dt);
- if ( sc->par.maxtime < FLT_MAX ) {
- fprintf(out,"%8.2f %f %f\n",
- sc->par.cumtim,p[0]+mesh->xtra,p[1]+mesh->ytra);
-@@ -1647,8 +1647,8 @@ int listTriaStream(pScene sc,pMesh mesh,float *pp) {
- /*if ( ddebug ) */
- if ( nbar )
- fprintf(stdout,": %d (%d, %.2f) / %d lines",nbar,nbp,(float)nbp/nbar,k/3);
-- ct = difftime(clock(),ct);
-- fprintf(stdout," %6.2f sec.\n",ct);
-+ double dt = ((double)(clock() - ct)) / ((double) CLOCKS_PER_SEC);
-+ fprintf(stdout," %6.2f sec.\n",dt);
-
- return(1);
- }
---
-2.17.1
-
diff --git a/0003-Wsign-compare.patch b/0003-Wsign-compare.patch
new file mode 100644
index 0000000..9df4992
--- /dev/null
+++ b/0003-Wsign-compare.patch
@@ -0,0 +1,367 @@
+From 2f5a05e84f3dcf07d27d8bb10f7e85e600bdbe96 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
+Date: Mon, 8 May 2017 08:50:45 +0200
+Subject: [PATCH 3/9] Wsign-compare
+
+---
+ src/Graphics/ffglut.cpp | 4 ++--
+ src/femlib/RNM.hpp | 4 ++++
+ src/fflib/AFunction.hpp | 18 +++++++++---------
+ src/fflib/AFunction2.cpp | 6 +++---
+ src/fflib/AddNewFE.h | 2 +-
+ src/fflib/PlotStream.hpp | 2 +-
+ src/fflib/global.cpp | 2 +-
+ src/fflib/lgfem.cpp | 4 ++--
+ src/fflib/lgfem.hpp | 8 ++++----
+ src/fflib/lgmat.cpp | 22 +++++++++++-----------
+ src/fflib/lgmesh.cpp | 4 ++--
+ src/fflib/lgmesh3.cpp | 2 +-
+ 12 files changed, 41 insertions(+), 37 deletions(-)
+
+diff --git a/src/Graphics/ffglut.cpp b/src/Graphics/ffglut.cpp
+index 6beca5a2..37818005 100644
+--- a/src/Graphics/ffglut.cpp
++++ b/src/Graphics/ffglut.cpp
+@@ -1089,13 +1089,13 @@ void OnePlotBorder::Draw(OneWindow *win)
+ plot.SetColorTable(16) ;
+
+ // vector<vector<pair<long,R2> > > data;
+- for(int i=0;i<data.size() ;++i)
++ for(size_t i=0;i<data.size() ;++i)
+ {
+ vector<pair<long,R2> > & v=data[i];
+ ShowGlerror("end OnePlotBorder::Draw 1");
+
+
+- for(int j=1;j<v.size();++j)
++ for(size_t j=1;j<v.size();++j)
+ {
+ // cout <<v[j].first << endl;
+ plot.color(2+v[j].first);
+diff --git a/src/femlib/RNM.hpp b/src/femlib/RNM.hpp
+index 25701e32..3f08d42a 100644
+--- a/src/femlib/RNM.hpp
++++ b/src/femlib/RNM.hpp
+@@ -399,6 +399,8 @@ public:
+
+ KN_ operator()(const SubArray & sa) const { return KN_(*this,sa);} // sub array
+
++ R & operator[](size_t i) const {return v[index(i)];}
++ R & operator()(size_t i) const {return v[index(i)];}
+ R & operator[](long i) const {return v[index(i)];}
+ R & operator()(long i) const {return v[index(i)];}
+ R & operator[](int i) const {return v[index(i)];}
+@@ -653,6 +655,8 @@ class KNM_: public KN_<R> {
+ { return this->index(shapei.index(i)+shapej.index(j));}
+ R & operator()(long i,long j) const
+ { return this->v[indexij(i,j)];}
++ R & operator()(size_t i,size_t j) const
++ { return this->v[indexij(i,j)];}
+ R & operator()(int i,int j) const
+ { return this->v[indexij(i,j)];}
+
+diff --git a/src/fflib/AFunction.hpp b/src/fflib/AFunction.hpp
+index 9d0c60d1..4f02ccb7 100644
+--- a/src/fflib/AFunction.hpp
++++ b/src/fflib/AFunction.hpp
+@@ -1527,7 +1527,7 @@ class basicAC_F0 {
+ friend class E_Array; // for mapping fonction
+ protected:
+ typedef const C_F0 const_C_F0;
+- int nb;
++ size_t nb;
+ C_F0 *a;
+ public:
+ typedef map<const char *,C_F0,Keyless> maptype ;
+@@ -1538,7 +1538,7 @@ class basicAC_F0 {
+ basicAC_F0 & operator=(C_F0 & c) {named_parameter=0;nb=1;a=&c;return *this;}
+ basicAC_F0 & operator=(pair<int,C_F0*> p) {named_parameter=0;nb=p.first;a=p.second;return *this;}
+ const C_F0 & operator [] (int i) const {throwassert(a && i<nb);return a[i];}
+- int size() const {return nb;}
++ size_t size() const {return nb;}
+ C_F0 * ptr() const {return a;}
+ C_F0 find(const char * k) const {
+ assert(k);
+@@ -1560,7 +1560,7 @@ class basicAC_F0 {
+ class AC_F0: public basicAC_F0 { // a Array of [[C_F0]]
+ // tableau d'un parametres max 1024 parametres
+ // avec allocation
+- const static int MaxSize;
++ const static size_t MaxSize;
+ // no constructor in this class (this class is in a union )
+ public:
+ AC_F0 & operator=(pair<const char *,const C_F0> p) {
+@@ -1579,8 +1579,8 @@ class AC_F0: public basicAC_F0 { // a Array of [[C_F0]]
+ if(i==named_parameter->end()) named_parameter->insert(make_pair(nm,c));
+ else {cerr << " the named in the list already exists "<< nm <<endl; CompileError();}
+ return *this;}
+- int size() const {return nb;}
+- const C_F0 & operator [] (int i) const {
++ size_t size() const {return nb;}
++ const C_F0 & operator [] (size_t i) const {
+ if( !(a && i<nb))
+ { cout << " AC_F0 bug " << a << " " <<i<<endl;
+ ffassert(a && i<nb);}
+@@ -1618,7 +1618,7 @@ class basicAC_F0_wa : public basicAC_F0 { public:
+ nb=1+b.size();
+ a= new C_F0[nb];
+ a[0]=e;
+- for (int i=1;i<nb;i++) a[i]=b[i-1];}
++ for (size_t i=1;i<nb;i++) a[i]=b[i-1];}
+ ~basicAC_F0_wa(){delete [] a;
+ a=0;
+ delete named_parameter;
+@@ -1630,7 +1630,7 @@ class basicAC_F0_wa : public basicAC_F0 { public:
+ if (b.named_parameter) named_parameter = new maptype(*b.named_parameter);
+ nb=b.size();
+ a= new C_F0[nb];
+- for (int i=0;i<nb;i++) a[i]=b[i];}
++ for (size_t i=0;i<nb;i++) a[i]=b[i];}
+
+ private:
+ void operator=(const basicAC_F0 & b);
+@@ -1649,10 +1649,10 @@ class E_Array :public E_F0 { public:
+ int size() const {return v->size();}
+ size_t nbitem() const {return v->size();}
+ void map(C_F0 (*mapping)(const C_F0 & )) const
+- { for (int i=0;i<v->size();i++)
++ { for (size_t i=0;i<v->size();i++)
+ v->a[i]=(*mapping)(v->a[i]);}
+ virtual bool MeshIndependent() const {
+- for (int i=0;i<v->size();i++)
++ for (size_t i=0;i<v->size();i++)
+ if (v->a[i].MeshIndependent()) return false;
+ return false;
+
+diff --git a/src/fflib/AFunction2.cpp b/src/fflib/AFunction2.cpp
+index 32a07d05..c9dc3340 100644
+--- a/src/fflib/AFunction2.cpp
++++ b/src/fflib/AFunction2.cpp
+@@ -743,7 +743,7 @@ E_Routine::E_Routine(const Routine * routine,const basicAC_F0 & args)
+ name(routine->name)
+ {
+ assert(routine->ins);
+- for (int i=0;i<args.size();i++) // bug pb copie des string dec 2007 FH ???????????????
++ for (size_t i=0;i<args.size();i++) // bug pb copie des string dec 2007 FH ???????????????
+ {
+ if(verbosity>10000) cout << "E_Routine " << *routine->param[i].r << " <- " << *args[i].left() << endl;
+ param[i]=routine->param[i].r->CastTo(args[i]);
+@@ -938,7 +938,7 @@ void ShowDebugStack()
+ else
+ cerr << " current line = " << TheCurrentLine << endl;
+ if(debugstack)
+- for (int i=0; i<debugstack->size(); ++i)
++ for (size_t i=0; i<debugstack->size(); ++i)
+ {
+
+ cerr << " call " << debugstack->at(i).first->name<< " at line "
+@@ -1093,7 +1093,7 @@ void lgerror (const char* s)
+ AC_F0 args;
+ args=0; // reset
+ args+=m;
+- for(int j=0,i=id->size(); j<id->size() ; ++j)
++ for(size_t j=0,i=id->size(); j<id->size() ; ++j)
+ {
+ --i;
+ C_F0 ci=cb->NewVar<LocalVariable>((*id)[i].id,tt[i]);
+diff --git a/src/fflib/AddNewFE.h b/src/fflib/AddNewFE.h
+index c1bb78cb..5a6fccac 100644
+--- a/src/fflib/AddNewFE.h
++++ b/src/fflib/AddNewFE.h
+@@ -30,7 +30,7 @@ class EConstantTypeOfFE :public E_F0
+ {
+ // using namespace Fem2D;
+ Fem2D::TypeOfFE * v;
+- size_t N;
++ int N;
+ bool isconst;
+ public:
+ AnyType operator()(Stack ) const { /*cout << " ()" << v << endl*/;return SetAny<Fem2D::TypeOfFE*>(v);}
+diff --git a/src/fflib/PlotStream.hpp b/src/fflib/PlotStream.hpp
+index 047eabce..e24315ca 100644
+--- a/src/fflib/PlotStream.hpp
++++ b/src/fflib/PlotStream.hpp
+@@ -112,7 +112,7 @@ public:
+
+ void read( void *data,size_t l) {
+ char * p= (char*)data;
+- for(int i=0;i<l;++i)
++ for(size_t i=0;i<l;++i)
+ *p++ = (char) getc(TheStream);
+ // fread( p++,1,1,TheStream);
+ // read(data,l);
+diff --git a/src/fflib/global.cpp b/src/fflib/global.cpp
+index a90f1d2b..f74bfd7a 100644
+--- a/src/fflib/global.cpp
++++ b/src/fflib/global.cpp
+@@ -165,7 +165,7 @@ TableOfIdentifier Global;
+ typedef list<TableOfIdentifier *> ListOfTOfId;
+ ListOfTOfId tables_of_identifier;
+
+-const int AC_F0::MaxSize=1024; // maximal number of parameters
++const size_t AC_F0::MaxSize=1024; // maximal number of parameters
+
+
+
+diff --git a/src/fflib/lgfem.cpp b/src/fflib/lgfem.cpp
+index c28bb239..74c1ae36 100644
+--- a/src/fflib/lgfem.cpp
++++ b/src/fflib/lgfem.cpp
+@@ -6342,7 +6342,7 @@ size_t dimFESpaceImage(const basicAC_F0 &args)
+ aType t_a= atype<E_Array>();
+ size_t dim23=0;
+
+- for (int i=0;i<args.size();i++)
++ for (size_t i=0;i<args.size();i++)
+ if (args[i].left() == t_tfe || args[i].left() == t_tfe3 )
+ dim23 += args[i].LeftValue()->nbitem();
+ else if (args[i].left() == t_a)
+@@ -6369,7 +6369,7 @@ aType typeFESpace(const basicAC_F0 &args)
+ //aType t_a= atype<E_Array>();
+ size_t d=0;
+ // 20 avril 2009 add brak
+- for (int i=0;i<args.size();i++)
++ for (size_t i=0;i<args.size();i++)
+
+ if (args[i].left() == t_tfe || args[i].left() == t_m2)
+ { ffassert(d==0 || d==2) ;d=2;break;}
+diff --git a/src/fflib/lgfem.hpp b/src/fflib/lgfem.hpp
+index 2532ef96..1a1f774f 100644
+--- a/src/fflib/lgfem.hpp
++++ b/src/fflib/lgfem.hpp
+@@ -433,15 +433,15 @@ public:
+ if(xx != 0 && i > 0 && i != this->N) {
+ FEbase<K,v_fes>** yy = new FEbase<K,v_fes>*[i];
+ if(i > this->N) {
+- for(unsigned int j = 0; j < std::max(this->N, 1); ++j)
++ for(int j = 0; j < std::max(this->N, 1); ++j)
+ yy[j] = xx[j];
+- for(unsigned int j = std::max(this->N, 1); j < i; ++j)
++ for(int j = std::max(this->N, 1); j < i; ++j)
+ yy[j] = new FEbase<K,v_fes>(xx[0]->pVh);
+ }
+ else {
+- for(unsigned int j = 0; j < i; ++j)
++ for(int j = 0; j < i; ++j)
+ yy[j] = xx[j];
+- for(unsigned int j = i; j < this->N; ++j)
++ for(int j = i; j < this->N; ++j)
+ xx[j]->destroy();
+ }
+ FEbase<K,v_fes> **oldXx = this->xx;
+diff --git a/src/fflib/lgmat.cpp b/src/fflib/lgmat.cpp
+index c3faeb0d..d817e4da 100644
+--- a/src/fflib/lgmat.cpp
++++ b/src/fflib/lgmat.cpp
+@@ -3232,13 +3232,13 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
+ }
+ else {
+ std::vector<std::vector<std::pair<unsigned int, T> > > tmp(n);
+- for(unsigned int i = 0; i < n; ++i)
++ for(int i = 0; i < n; ++i)
+ tmp[i].reserve(mA->lg[mR->cl[i] + 1] - mA->lg[mR->cl[i]]);
+
+ unsigned int nnz = 0;
+- for(unsigned int i = 0; i < n; ++i) {
+- for(unsigned int j = mA->lg[mR->cl[i]]; j < mA->lg[mR->cl[i] + 1]; ++j) {
+- unsigned int col = tmpVec[mA->cl[j]];
++ for(int i = 0; i < n; ++i) {
++ for(int j = mA->lg[mR->cl[i]]; j < mA->lg[mR->cl[i] + 1]; ++j) {
++ int col = tmpVec[mA->cl[j]];
+ if(col != 0 && abs(mA->a[j]) > EPS) {
+ if(i < col - 1)
+ tmp[col - 1].push_back(make_pair(i, mA->a[j]));
+@@ -3255,7 +3255,7 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
+ val = new T[nnz];
+ nnz = 0;
+ lg[0] = 0;
+- for(unsigned int i = 0; i < n; ++i) {
++ for(int i = 0; i < n; ++i) {
+ std::sort(tmp[i].begin(), tmp[i].end(),cmp<T>);
+ // c++11, [](const std::pair<unsigned int, T>& lhs, const std::pair<unsigned int, T>& rhs) { return lhs.first < rhs.first; });
+ for(typename std::vector<std::pair<unsigned int, T> >::const_iterator it = tmp[i].begin(); it != tmp[i].end(); ++it) {
+@@ -3280,7 +3280,7 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
+ else {
+ tmpVec.reserve(mA->n);
+ unsigned int i = 0, j = 1;
+- for(unsigned int k = 0; k < mA->n; ++k) {
++ for(int k = 0; k < mA->n; ++k) {
+ if(k == *(*condensation + i)) {
+ ++i;
+ tmpVec.push_back(i);
+@@ -3301,10 +3301,10 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
+ tmpInteraction.reserve(mA->nbcoef);
+
+ lg[0] = 0;
+- for(unsigned int i = 0; i < mA->n; ++i) {
++ for(int i = 0; i < mA->n; ++i) {
+ int row = tmpVec[i];
+ if(row < 0) {
+- for(unsigned int j = mA->lg[i]; j < mA->lg[i + 1]; ++j) {
++ for(int j = mA->lg[i]; j < mA->lg[i + 1]; ++j) {
+ int col = tmpVec[mA->cl[j]];
+ if(col < 0)
+ tmpInterior.push_back(make_pair(-col - 1, mA->a[j]));
+@@ -3314,7 +3314,7 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
+
+ }
+ else {
+- for(unsigned int j = mA->lg[i]; j < mA->lg[i + 1]; ++j) {
++ for(int j = mA->lg[i]; j < mA->lg[i + 1]; ++j) {
+ int col = tmpVec[mA->cl[j]];
+ if(col > 0)
+ tmpBoundary.push_back(make_pair(col - 1, mA->a[j]));
+@@ -3342,13 +3342,13 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
+ {
+ MatriceMorse<T> *mR = static_cast<MatriceMorse<T>*>(&(*pR->A));
+
+- unsigned int n = mR->nbcoef;
++ int n = mR->nbcoef;
+
+ if(pOut->n != n) pOut->resize(n);
+
+
+
+- for(unsigned int i = 0; i < n; ++i) {
++ for(int i = 0; i < n; ++i) {
+ *(*pOut + i) = *(*pX + mR->cl[i]);
+ }
+
+diff --git a/src/fflib/lgmesh.cpp b/src/fflib/lgmesh.cpp
+index 06df28d2..71fc2a41 100644
+--- a/src/fflib/lgmesh.cpp
++++ b/src/fflib/lgmesh.cpp
+@@ -256,7 +256,7 @@ class MoveMesh : public E_F0mps { public:
+ U=to<double>( (*a)[0]);
+ V=to<double>( (*a)[1]);
+
+- for (int i=2;i<args.size();i++)
++ for (size_t i=2;i<args.size();i++)
+ sol[i-2]=to<double>(args[i]);
+ }
+ static ArrayOfaType typeargs() { return ArrayOfaType(atype<pmesh>(),atype<E_Array>(),true);}
+@@ -1701,7 +1701,7 @@ class CheckMoveMesh : public E_F0mps { public:
+ U=to<double>( (*a)[0]);
+ V=to<double>( (*a)[1]);
+
+- for (int i=2;i<args.size();i++)
++ for (size_t i=2;i<args.size();i++)
+ sol[i-2]=to<double>(args[i]);
+ }
+ static ArrayOfaType typeargs() { return ArrayOfaType(atype<pmesh>(),atype<E_Array>(),false);}
+diff --git a/src/fflib/lgmesh3.cpp b/src/fflib/lgmesh3.cpp
+index 719d7ef4..68338055 100644
+--- a/src/fflib/lgmesh3.cpp
++++ b/src/fflib/lgmesh3.cpp
+@@ -581,7 +581,7 @@ class MoveMesh3 : public E_F0mps { public:
+ U=to<double>( (*a)[0]);
+ V=to<double>( (*a)[1]);
+
+- for (int i=2;i<args.size();i++)
++ for (size_t i=2;i<args.size();i++)
+ sol[i-2]=to<double>(args[i]);
+ }
+ static ArrayOfaType typeargs() { return ArrayOfaType(atype<pmesh>(),atype<E_Array>(),true);}
+--
+2.19.2
+
diff --git a/0004-Wimplicit-function-declaration.patch b/0004-Wimplicit-function-declaration.patch
new file mode 100644
index 0000000..45a00e8
--- /dev/null
+++ b/0004-Wimplicit-function-declaration.patch
@@ -0,0 +1,251 @@
+From e4a78a8cdbfb272d6eb76158a207f031af89b210 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
+Date: Sat, 6 May 2017 09:42:37 +0200
+Subject: [PATCH 4/9] Wimplicit-function-declaration
+
+---
+ src/medit/bbfile.c | 1 +
+ src/medit/sproto.h | 83 +++++++++++++++++++++++++++++++---------------
+ 2 files changed, 58 insertions(+), 26 deletions(-)
+
+diff --git a/src/medit/bbfile.c b/src/medit/bbfile.c
+index dad28b21..a8429599 100644
+--- a/src/medit/bbfile.c
++++ b/src/medit/bbfile.c
+@@ -24,6 +24,7 @@
+ #include "medit.h"
+ #include "extern.h"
+ #include "sproto.h"
++#include <eigenv.h>
+
+ int EatLine (FILE *in) {
+ int k, c;
+diff --git a/src/medit/sproto.h b/src/medit/sproto.h
+index 87e7a817..954dec9a 100644
+--- a/src/medit/sproto.h
++++ b/src/medit/sproto.h
+@@ -26,6 +26,11 @@ int loadNextMesh(pMesh, int, int);
+ int animat ();
+ int playAnim(pScene, pMesh, int, int);
+ void glutIdle (void);
++int advectParticle(pScene sc, pMesh mesh);
++int animParticle(pScene sc, pMesh mesh);
++
++/* bbfile.c */
++int EatSpace(FILE *in);
+
+ /* camera.c */
+ double Azimuth(pCamera);
+@@ -34,6 +39,9 @@ void updateSun(pScene, pCamera);
+ void updateCamera(pScene, pCamera, double, double);
+ pCamera initCamera(pScene, int);
+
++/* cenrad.c */
++int cenrad(pMesh mesh,int iel,double *c,double *rad);
++
+ /* clip.c */
+ void updateClip(pClip, pMesh);
+ void clipVertices(pMesh, pScene, pClip);
+@@ -43,6 +51,7 @@ void copyClip(pClip);
+ int pasteClip(pClip);
+ void resetClip(pScene, pClip, pMesh);
+ pClip createClip(pScene, pMesh);
++void tiltClip(pScene sc,pClip clip);
+ void updateCube(pCube, pMesh);
+ pCube createCube(pScene, pMesh);
+
+@@ -54,14 +63,21 @@ GLuint capTetraIso(pMesh);
+ /* critip.c */
+ GLuint listCritPoint(pScene, pMesh);
+
++/* cube.c */
++void dumpCube(pScene sc,pMesh mesh,pCube cube);
++void resetCube(pScene sc,pCube cube,pMesh mesh);
++
+ /* dlists.c */
+ GLuint listTria(pScene, pMesh);
+ GLuint listQuad(pScene, pMesh);
+ GLuint listTetra(pScene, pMesh, ubyte);
+ GLuint listHexa(pScene, pMesh, ubyte);
+
+-/* eigenv.c */
+-int eigenv (int sym, double mat[6], double lambda[3], double v[3][3]);
++/* ellipse.c */
++void circumSphere(pScene sc,pMesh mesh,int typel,int k);
++void drawEllipse(pScene sc,pMesh mesh,int typel,int k);
++void drawEllipsoid(pScene sc,pMesh mesh,int typel,int k);
++GLuint drawAllEllipse(pScene sc,pMesh mesh);
+
+ /* geometry.c */
+ GLuint geomList(pScene, pMesh);
+@@ -72,6 +88,7 @@ int loadGIS(pMesh);
+ /* hash.c */
+ int hashTria(pMesh);
+ int hashTetra(pMesh);
++int hashHexa(pMesh mesh);
+
+ /* image.c */
+ PPMimage*loadPPM (const char *imgname, int *type);
+@@ -80,18 +97,22 @@ void saveEPS (pScene sc, const char *imgname, pPPMimage pixels);
+ int imgHard (pScene sc, char *data, char key);
+
+ /* input/output */
+-int EatLine(FILE * in);
+-int inmsh2 (pMesh mesh);
++int EatLine(FILE *in);
++int inmsh2(pMesh mesh);
+ int bbfile(pMesh);
+-int loadMesh(pMesh);
+ int saveMesh(pScene, pMesh, char *, ubyte);
+-int loadSol (pMesh mesh, char *filename, int numsol);
+-int loadMesh_popen(pMesh); // pour popen
++int loadSol(pMesh mesh, char *filename, int numsol);
++int loadSol_popen(pMesh mesh,char *filename,int numsol);
++int loadSol_popen_bin(pMesh mesh,char *filename,int numsol);
++int loadMesh(pMesh);
++int loadMesh_popen(pMesh); //pour popen
++int loadMesh_popen_bin(pMesh mesh);
+
+ /* ilists.c */
+ GLuint listTriaIso(pScene, pMesh);
+ GLuint listQuadIso(pScene, pMesh);
+ GLuint listTetraIso(pScene, pMesh);
++int tetraIsoPOVray(pScene sc, pMesh mesh);
+
+ /* items.c */
+ void drawAxis(pScene, int);
+@@ -128,9 +149,9 @@ int medit0 ();
+ int medit1 ();
+
+ /* menus.c */
+-void doLists(pScene, pMesh);
+-void doMapLists(pScene, pMesh, int);
+-void doIsoLists(pScene, pMesh, int);
++void doLists (pScene, pMesh);
++void doMapLists (pScene, pMesh, int);
++void doIsoLists (pScene, pMesh, int);
+ void keyFile (unsigned char, int, int);
+ void menuFile (int);
+ void keyItem (unsigned char, int, int);
+@@ -141,19 +162,20 @@ void keyTrajet (unsigned char, int, int);
+ void menuTrajet (int);
+ void keyMode (unsigned char, int, int);
+ void menuMode (int);
+-void menuScene (int);
++void menuScene (int);
+ void keyView (unsigned char, int, int);
+ void menuView (int);
+ void keyColor (unsigned char, int, int);
+ void menuColor (int);
+-void keyClip (unsigned char, int, int);
++void keyClip (unsigned char,int, int);
+ void menuClip (int);
+ void keyFeature (unsigned char, int, int);
+ void menuFeature (int);
+ void menuImage (int);
+ void keyMetric (unsigned char key, int x, int y);
+-int createMenus(pScene, pMesh);
++int createMenus (pScene, pMesh);
+ GLuint pickingScene (pScene sc, int x, int y, int ident);
++void keyCube (unsigned char key, int x, int y);
+
+ /* mesh.c */
+ void meshInfo(pMesh);
+@@ -191,6 +213,9 @@ GLuint drawNormals (pMesh mesh, pScene sc);
+ /* outmsh.c */
+ int outmsh(pScene, pMesh, char *name, ubyte clipon);
+
++/* param.c */
++void parEdit(pScene sc);
++
+ /* parsar.c */
+ int parsar (int argc, char *argv []);
+
+@@ -201,6 +226,7 @@ int parsop(pScene, pMesh);
+
+ /* particle.c */
+ int createParticle(pScene, pMesh);
++int displayParticle(pScene sc,pMesh mesh);
+
+ /* path.c */
+ int pathAdd(pScene, int, int);
+@@ -245,6 +271,9 @@ void streamIdle ();
+ /* scissor.c */
+ void scissorScene ();
+
++/* sftcpy.c */
++int sftcpy(pScene sc,pMesh mesh);
++
+ /* status.c */
+ void reshapeStatusBar (pScene sc, int width, int height);
+ void redrawStatusBar (pScene sc);
+@@ -253,27 +282,27 @@ void mouseStatus (int button, int state, int x, int y);
+ /* stream.c */
+ double sizeTetra(pMesh, int);
+ double sizeHexa(pMesh, int);
++double sizeQuad(pMesh mesh, int k);
+ double sizeTria(pMesh, int);
+ int locateTria (pMesh mesh, int nsdep, int base, float *p, double *cb);
+ int locateTetra (pMesh mesh, int nsdep, int base, float *p, double *cb);
++int inTetra(pMesh mesh, int nsdep, float *p, double *cb);
+ int inTria(pMesh, int, float *, double *);
+-int listTetraStream(pScene, pMesh, float *, int);
+-int listHexaStream(pScene, pMesh, float *, int);
++int listTetraStream(pScene, pMesh, float *,int);
++int listHexaStream(pScene, pMesh, float *,int);
+ int listTriaStream(pScene, pMesh, float *);
+ pStream createStream(pScene, pMesh);
+ int streamRefTria (pScene sc, pMesh mesh);
+ int streamRefQuad (pScene sc, pMesh mesh);
+ int streamRefPoint (pScene sc, pMesh mesh);
+-int listSaddleStream (pScene sc, pMesh mesh, int depart,
+- float *pp, float *vv, double lambda);
++int streamIsoPoint (pScene sc, pMesh mesh);
++int listSaddleStream(pScene sc, pMesh mesh, int depart,
++ float *pp, float *vv, double lambda);
+ int nxtPoint3D (pMesh mesh, int nsdep, float *p, float step, double *v);
+ int nxtPoint2D (pMesh mesh, int nsdep, float *p, float step, double *v);
+ double field2DInterp (pMesh mesh, int iel, double *cb, double *v);
+ double vector3DInterp (pMesh mesh, pPoint pt[4], double *cb, double *v);
+ double field3DInterp (pMesh mesh, int iel, double *cb, double *v);
+-double sizeTria (pMesh mesh, int k);
+-double sizeQuad (pMesh mesh, int k);
+-double sizeTetra (pMesh mesh, int k);
+
+ /* tensor.c */
+ GLuint listPointVector(pMesh, ubyte);
+@@ -289,16 +318,17 @@ void resetTransform(pTransform);
+ pTransform createTransform ();
+
+ /* util.c */
+-void setFont (char *name, int size);
+-void drwstr (GLuint x, GLuint y, char *format, ...);
+-void output2 (GLfloat x, GLfloat y, char *format, ...);
+-void output3 (GLfloat x, GLfloat y, GLfloat z, char *format, ...);
++void setFont (char* name, int size);
++void drwstr (GLuint x, GLuint y, char* format, ...);
++void output2 (GLfloat x, GLfloat y, char *format,...);
++void output3 (GLfloat x, GLfloat y, GLfloat z, char *format,...);
+ void hsvrgb (double *hsv, double *rgb);
+ void transformPoint (double u[4], float v[4], float m[16]);
+ void transformPointd (double u[4], double v[4], double m[16]);
+-void transformVector (float u[4], float v[4], float m[16]);
++void transformPoint2 (double u[4], float v[4], float m[16]);
++void transformVector (float u[4], float v[4], float m[16]);
+ void multMatrix (GLfloat *p, GLfloat *a, GLfloat *b);
+-void rotateMatrix (GLfloat angle, GLfloat x, GLfloat y, GLfloat z, GLfloat rm[16]);
++void rotateMatrix (GLfloat angle,GLfloat x,GLfloat y,GLfloat z,GLfloat rm[16]);
+ int invertMatrix (float src[16], float inverse[16]);
+ int filnum (char *data, int numdep, char *ext);
+
+@@ -307,6 +337,7 @@ void drawVector2D (float p[2], double u[2], double scal);
+ void drawVector3D (float p[3], double u[3], double scal);
+ GLuint listTria2dVector (pMesh mesh);
+ GLuint listTria3dVector (pMesh mesh);
++GLuint listQuad2dVector (pMesh mesh);
+ GLuint listClipTetraVector (pMesh mesh);
+ GLuint listClipHexaVector (pMesh mesh);
+
+--
+2.19.2
+
diff --git a/0004-Wsign-compare.patch b/0004-Wsign-compare.patch
deleted file mode 100644
index e3edfbb..0000000
--- a/0004-Wsign-compare.patch
+++ /dev/null
@@ -1,912 +0,0 @@
-From e7bac86a1379658af4974dd611da69a15432bf54 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
-Date: Mon, 8 May 2017 08:50:45 +0200
-Subject: [PATCH 04/10] Wsign-compare
-
----
- examples++-load/DxWriter.cpp | 10 +++++-----
- examples++-load/MetricPk.cpp | 4 ++--
- examples++-load/VTK_writer.cpp | 2 +-
- examples++-load/VTK_writer_3d.cpp | 2 +-
- examples++-load/ff-NLopt.cpp | 30 +++++++++++++++---------------
- examples++-load/gsl.cpp | 4 ++--
- examples++-load/iovtk.cpp | 30 ++++++++++++++++--------------
- examples++-load/isoline.cpp | 20 ++++++++++----------
- examples++-load/medit.cpp | 14 +++++++-------
- examples++-load/msh3.cpp | 10 +++++-----
- examples++-load/symmetrizeCSR.cpp | 6 +++---
- src/Graphics/ffglut.cpp | 4 ++--
- src/femlib/RNM.hpp | 4 ++++
- src/fflib/AFunction.hpp | 18 +++++++++---------
- src/fflib/AFunction2.cpp | 6 +++---
- src/fflib/AddNewFE.h | 2 +-
- src/fflib/PlotStream.hpp | 2 +-
- src/fflib/global.cpp | 2 +-
- src/fflib/lgfem.cpp | 4 ++--
- src/fflib/lgfem.hpp | 8 ++++----
- src/fflib/lgmat.cpp | 22 +++++++++++-----------
- src/fflib/lgmesh.cpp | 4 ++--
- src/fflib/lgmesh3.cpp | 2 +-
- 23 files changed, 108 insertions(+), 102 deletions(-)
-
-diff --git a/examples++-load/DxWriter.cpp b/examples++-load/DxWriter.cpp
-index 28a36b15..395aa673 100644
---- a/examples++-load/DxWriter.cpp
-+++ b/examples++-load/DxWriter.cpp
-@@ -61,9 +61,9 @@ void save_header(){
- std::string s=_nameoffile;
- s.append(".dx");
- _ofts.open(s.c_str(), std::ios_base::out);
-- for(int i=0;i<_vecofts.size();++i){
-+ for(size_t i=0;i<_vecofts.size();++i){
- _ofts<<"object \""<<_vecofts[i].name<<"\" class series"<<std::endl;
-- for(int j=0;j<_vecofts[i].vecistant.size();++j){
-+ for(size_t j=0;j<_vecofts[i].vecistant.size();++j){
- _ofts<<"member "<<j<<" value file \""<<_nameofdatafile<<"\",\""<<_vecofts[i].name<<"_"<<j<<"\" position "<<_vecofts[i].vecistant[j]<<std::endl;
- }
- _ofts<<std::endl;
-@@ -81,7 +81,7 @@ public:
- std::cout<<tmp<<" ";
- _ofdata.open(tmp.c_str(), std::ios_base::out);
- _nameofdatafile="";
-- for(int i=0;i<tmp.length();++i){
-+ for(size_t i=0;i<tmp.length();++i){
- if(tmp.at(i)=='\\')
- _nameofdatafile.append(1,'\\');
- _nameofdatafile.append(1,tmp.at(i));
-@@ -124,7 +124,7 @@ public:
- /*!Add an instant to a time series name*/
- void addistant2ts(const string& nameofts, const double t, const KN<double>&val){
- int jj=-1;
-- for(int i=0;i<_vecofts.size();++i){
-+ for(size_t i=0;i<_vecofts.size();++i){
- if(_vecofts[i].name==nameofts)jj=i;
- }
- _vecofts[jj].vecistant.push_back(t);
-@@ -169,7 +169,7 @@ public:
-
- /*!Get the mesh associated with the series nameofts*/
- const Fem2D::Mesh* getmeshts(const string& nameofts){
-- for(int i=0;i<_vecofts.size();++i){
-+ for(size_t i=0;i<_vecofts.size();++i){
- if(_vecofts[i].name==nameofts)return _vecmesh[_vecofts[i].imesh];
- }
- return NULL;
-diff --git a/examples++-load/MetricPk.cpp b/examples++-load/MetricPk.cpp
-index 9b4b9f62..1bc2e8aa 100644
---- a/examples++-load/MetricPk.cpp
-+++ b/examples++-load/MetricPk.cpp
-@@ -254,7 +254,7 @@ AnyType MetricPk:: operator()(Stack stack) const
- if(nextv[w]==-1 && computed.insert(w).second==true) dist.push_back(pair<int,int>(w,0));
- }
-
-- for(int i=0; i<dist.size(); ++i){ //Dijkstra's algorithm.
-+ for(size_t i=0; i<dist.size(); ++i){ //Dijkstra's algorithm.
- const int u=dist[i].first; const int du=dist[i].second;
- computed.insert(u);
- const pair<multimap<int,int>::iterator, multimap<int,int>::iterator> ret = connectivity.equal_range(u);
-@@ -266,7 +266,7 @@ AnyType MetricPk:: operator()(Stack stack) const
-
- map<int,int> dist_sorted; dist_sorted.insert(dist.begin(), dist.end());
-
-- for(int i=0; i<dist.size(); ++i){
-+ for(size_t i=0; i<dist.size(); ++i){
- const int u=dist[i].first; const int du=dist[i].second;
- if(du==0) continue;
- const pair<multimap<int,int>::iterator, multimap<int,int>::iterator> neighbors = connectivity.equal_range(u);
-diff --git a/examples++-load/VTK_writer.cpp b/examples++-load/VTK_writer.cpp
-index d1750e9d..040abf7a 100644
---- a/examples++-load/VTK_writer.cpp
-+++ b/examples++-load/VTK_writer.cpp
-@@ -45,7 +45,7 @@ public:
- std::cout<<tmp<<" ";
- _ofdata.open(tmp.c_str(), std::ios_base::out);
- _nameofdatafile="";
-- for(int i=0;i<tmp.length();++i)
-+ for(size_t i=0;i<tmp.length();++i)
- {
- if(tmp.at(i)=='\\')
- _nameofdatafile.append(1,'\\');
-diff --git a/examples++-load/VTK_writer_3d.cpp b/examples++-load/VTK_writer_3d.cpp
-index 1e407e92..0b51aa98 100644
---- a/examples++-load/VTK_writer_3d.cpp
-+++ b/examples++-load/VTK_writer_3d.cpp
-@@ -48,7 +48,7 @@ public:
- std::cout<<tmp<<" ";
- _ofdata.open(tmp.c_str(), std::ios_base::out);
- _nameofdatafile="";
-- for(int i=0;i<tmp.length();++i)
-+ for(size_t i=0;i<tmp.length();++i)
- {
- if(tmp.at(i)=='\\')
- _nameofdatafile.append(1,'\\');
-diff --git a/examples++-load/ff-NLopt.cpp b/examples++-load/ff-NLopt.cpp
-index 3977180d..93fdd4f0 100644
---- a/examples++-load/ff-NLopt.cpp
-+++ b/examples++-load/ff-NLopt.cpp
-@@ -142,7 +142,7 @@ typedef KNM<R> Rnm;
- template<class T> inline std::vector<T> KnToStdVect(const KN_<T> &V)
- {
- std::vector<T> v(V.n);
-- for(int i=0;i<v.size();++i) v[i] = V[i];
-+ for(size_t i=0;i<v.size();++i) v[i] = V[i];
- return v;
- }
-
-@@ -204,9 +204,9 @@ class GenericOptimizer
- {
- double minf;
- vector<double> vv(x->n);
-- for(int i=0;i<vv.size();++i) vv[i] = (*x)[i];
-+ for(size_t i=0;i<vv.size();++i) vv[i] = (*x)[i];
- opt.optimize(vv,minf);
-- for(int i=0;i<vv.size();++i) (*x)[i] = vv[i];
-+ for(size_t i=0;i<vv.size();++i) (*x)[i] = vv[i];
- return minf;
- }
-
-@@ -280,25 +280,25 @@ class GenericOptimizer
- if(pthis->equaconst)
- {
- Rn X(n);
-- for(int k=0;k<n;++k) X[k] = xx[k];
-+ for(size_t k=0;k<n;++k) X[k] = xx[k];
- Rn Y=pthis->equaconst->J(X);
- assert(Y.n==m);
-- for(int i=0;i<m;++i) result[i] = Y[i];
-+ for(size_t i=0;i<m;++i) result[i] = Y[i];
- if(grad)
- {
- assert(pthis->d_equaconst);
- Rnm dconst=pthis->d_equaconst->J(X);
- assert(dconst.N()==m && dconst.M()==n);
-- for(int i=0;i<m;++i)
-- for(int j=0;j<n;++j) grad[i*n + j] = dconst(i,j);
-+ for(unsigned i=0;i<m;++i)
-+ for(size_t j=0;j<n;++j) grad[i*n + j] = dconst(i,j);
- }
- }
- else
- {
-- for(int i=0;i<m;++i)
-+ for(unsigned i=0;i<m;++i)
- {
- result[i] = 0;
-- if(grad) for(int j=0;j<n;++j) grad[i*n+j]=0;
-+ if(grad) for(unsigned j=0;j<n;++j) grad[i*n+j]=0;
- }
- }
- }
-@@ -308,25 +308,25 @@ class GenericOptimizer
- if(pthis->ineqconst)
- {
- Rn X(n);
-- for(int k=0;k<n;++k) X[k] = xx[k];
-+ for(size_t k=0;k<n;++k) X[k] = xx[k];
- Rn Y=pthis->ineqconst->J(X);
- assert(Y.N()==m);
-- for(int i=0;i<m;++i) result[i] = Y[i];
-+ for(size_t i=0;i<m;++i) result[i] = Y[i];
- if(grad)
- {
- assert(pthis->d_ineqconst);
- Rnm dconst=pthis->d_ineqconst->J(X);
- assert(dconst.N()==m && dconst.M()==n);
-- for(int i=0;i<m;++i)
-- for(int j=0;j<n;++j) grad[i*n + j] = dconst(i,j);
-+ for(unsigned i=0;i<m;++i)
-+ for(size_t j=0;j<n;++j) grad[i*n + j] = dconst(i,j);
- }
- }
- else
- {
-- for(int i=0;i<m;++i)
-+ for(unsigned i=0;i<m;++i)
- {
- result[i] = 0;
-- if(grad) for(int j=0;j<n;++j) grad[i*n+j]=0;
-+ if(grad) for(unsigned j=0;j<n;++j) grad[i*n+j]=0;
- }
- }
- }
-diff --git a/examples++-load/gsl.cpp b/examples++-load/gsl.cpp
-index 4a10da2e..086c3f63 100644
---- a/examples++-load/gsl.cpp
-+++ b/examples++-load/gsl.cpp
-@@ -72,7 +72,7 @@ struct GSLInterpolation {
- splinetype=interp[cas];
- xy= new double[n*2];
-
-- for(long k=0;k<n;++k)
-+ for(size_t k=0;k<n;++k)
- {
- xy[k]=x[k];
- xy[k+n] = f[k];
-@@ -91,7 +91,7 @@ struct GSLInterpolation {
-
- xy= new double[n*2];
- splinetype=g->splinetype;
-- for(int i=0; i< 2*n; ++i)
-+ for(size_t i=0; i< 2*n; ++i)
- xy[i]= g->xy[i];
- spline = gsl_spline_alloc (splinetype, n);
- gsl_spline_init (spline, xy,xy+n,n);
-diff --git a/examples++-load/iovtk.cpp b/examples++-load/iovtk.cpp
-index 54a1c76b..15b39f1c 100644
---- a/examples++-load/iovtk.cpp
-+++ b/examples++-load/iovtk.cpp
-@@ -1099,8 +1099,9 @@ Mesh * VTK_Load(const string & filename, bool bigEndian)
- }
-
- // read mesh elements
-- int numElements, numElements2, totalNumInt;
-- if(fscanf(fp, "%s %d %d\n", buffer, &numElements, &totalNumInt) != 3){ cout << "error in reading vtk files" << endl; ExecError("error in reading vtk file"); }
-+ size_t numElements;
-+ int numElements2, totalNumInt;
-+ if(fscanf(fp, "%s %zd %d\n", buffer, &numElements, &totalNumInt) != 3){ cout << "error in reading vtk files" << endl; ExecError("error in reading vtk file"); }
- if(strcmp(buffer, "CELLS") || !numElements){
- cout << "No cells in dataset" << endl;
- ExecError("error in reading vtk file");
-@@ -1112,7 +1113,7 @@ Mesh * VTK_Load(const string & filename, bool bigEndian)
- int *TypeCells = new int[numElements];
- int numIntCells = 0;
-
-- for(unsigned int i = 0; i < numElements; i++){
-+ for(size_t i = 0; i < numElements; i++){
- int numVerts, n[100];
- for(int ii = 0; ii < 100; ii++) n[ii]=-1;
- if(binary){
-@@ -1165,7 +1166,7 @@ Mesh * VTK_Load(const string & filename, bool bigEndian)
-
- // 2D
-
-- for(unsigned int i = 0; i < numElements; i++){
-+ for(size_t i = 0; i < numElements; i++){
- int type;
- if(binary){
- if(fread(&type, sizeof(int), 1, fp) != 1){
-@@ -1213,7 +1214,7 @@ Mesh * VTK_Load(const string & filename, bool bigEndian)
- Mesh::BorderElement *bff;
- if(nbe>0) bff= new Mesh::BorderElement[nbe];
- Mesh::BorderElement *bbff = bff;
-- for(unsigned int i = 0; i < numElements; i++){
-+ for(size_t i = 0; i < numElements; i++){
- int type=TypeCells[i];
- int iv[3];
- int label=1;
-@@ -1843,7 +1844,7 @@ void VTK_WRITE_MESH( const string &filename, FILE *fp, const Mesh &Th, bool bina
- if(datasize == sizeof(float))
- {
- fprintf(fp, "POINTS %d float\n", Th.nv);
-- for(unsigned int i = 0; i < Th.nv; i++){
-+ for(int i = 0; i < Th.nv; i++){
- const Mesh::Vertex & P = Th.vertices[i];
- float f[3];
- f[0]=P.x;
-@@ -1860,7 +1861,7 @@ void VTK_WRITE_MESH( const string &filename, FILE *fp, const Mesh &Th, bool bina
- }
- else if(datasize == sizeof(double)){
- fprintf(fp, "POINTS %d double\n", Th.nv);
-- for(unsigned int i = 0; i < Th.nv; i++){
-+ for(int i = 0; i < Th.nv; i++){
- const Mesh::Vertex & P = Th.vertices[i];
- double f[3];
- f[0]=P.x;
-@@ -2602,12 +2603,13 @@ Mesh3 * VTK_Load3(const string & filename, bool bigEndian)
- }
-
- // read mesh elements
-- int numElements, numElements2, totalNumInt;
-- if(fscanf(fp, "%s %d %d\n", buffer, &numElements, &totalNumInt) != 3){
-+ size_t numElements;
-+ int numElements2, totalNumInt;
-+ if(fscanf(fp, "%s %zd %d\n", buffer, &numElements, &totalNumInt) != 3){
- cout << "error in reading vtk files" << endl;
- ExecError("error in reading vtk file"); }
- if(verbosity>3)
-- printf("reading parameter %s %d %d\n", buffer, numElements, totalNumInt);
-+ printf("reading parameter %s %zd %d\n", buffer, numElements, totalNumInt);
- if(strncmp(buffer, "CELLS",5) || !numElements){
- cout << "No cells in dataset" << endl;
- ExecError("error in reading vtk file");
-@@ -2620,7 +2622,7 @@ Mesh3 * VTK_Load3(const string & filename, bool bigEndian)
- int *TypeCells = new int[numElements];
- int numIntCells = 0;
-
-- for(unsigned int i = 0; i < numElements; i++){
-+ for(size_t i = 0; i < numElements; i++){
- int numVerts, n[100];
- if(verbosity>9)
- cout << "i=" << i << " " << numElements << endl;
-@@ -2728,7 +2730,7 @@ Mesh3 * VTK_Load3(const string & filename, bool bigEndian)
- Triangle3 *bff = new Triangle3[nbe];
- Triangle3 *bbff = bff;
-
-- for(unsigned int i = 0; i < numElements; i++){
-+ for(size_t i = 0; i < numElements; i++){
- int type=TypeCells[i];
- int ivb[3],ivt[4];
- int label=1;
-@@ -3423,7 +3425,7 @@ void VTK_WRITE_MESH3( const string &filename, FILE *fp, const Mesh3 &Th, bool bi
- if(datasize == sizeof(double)) fprintf(fp, "POINTS %d double\n", Th.nv);
-
- if(datasize == sizeof(float)) {
-- for(unsigned int i = 0; i < Th.nv; i++){
-+ for(int i = 0; i < Th.nv; i++){
- const Vertex3 & P = Th.vertices[i];
- float f[3];
- f[0]=P.x;
-@@ -3439,7 +3441,7 @@ void VTK_WRITE_MESH3( const string &filename, FILE *fp, const Mesh3 &Th, bool bi
- }
- }
- else if(datasize == sizeof(double)){
-- for(unsigned int i = 0; i < Th.nv; i++){
-+ for(int i = 0; i < Th.nv; i++){
- const Vertex3 & P = Th.vertices[i];
- double f[3];
- f[0]=P.x;
-diff --git a/examples++-load/isoline.cpp b/examples++-load/isoline.cpp
-index 8ee752ba..c79c8c1d 100644
---- a/examples++-load/isoline.cpp
-+++ b/examples++-load/isoline.cpp
-@@ -639,7 +639,7 @@ AnyType ISOLINE_P1_Op::operator()(Stack stack) const
- if(verbosity>99)
- { // dump the data base
- cout << " IsolineP1 " << endl;
-- for(int i=0;i<P.size();++i)
-+ for(size_t i=0;i<P.size();++i)
- cout << "\t" <<i << " : " << P[i].P << " -> " << P[i].nx << endl;
- cout<< " multmap for execption " << endl;
- for( multimap<int,int>::const_iterator i= L.begin(); i!= L.end();++i)
-@@ -658,7 +658,7 @@ AnyType ISOLINE_P1_Op::operator()(Stack stack) const
- if( nx>=0) start[nx]=i;
- }
- vector<int> starting;
-- int iss=0;
-+ size_t iss=0;
- for( multimap<int,int>::const_iterator i= L.begin(); i!= L.end();++i)
- {
- starting.push_back(i->first);
-@@ -735,14 +735,14 @@ AnyType ISOLINE_P1_Op::operator()(Stack stack) const
- if(iQ.size()>2)
- {
- vector< pair<int , pair<int,int> > > sQ(iQ.size()/2);
-- for(int i=0,j=0; i<iQ.size();i+=2,++j)
-+ for(size_t i=0,j=0; i<iQ.size();i+=2,++j)
- {
- int i0=iQ[i];
- int i1=iQ[i+1];
- sQ[j] = make_pair(i0-i1,make_pair(i0,i1));
- }
- std::sort(sQ.begin(), sQ.end());
-- for(int i=0,j=0; i<iQ.size();i+=2,++j)
-+ for(size_t i=0,j=0; i<iQ.size();i+=2,++j)
- {
- iQ[i] =sQ[j].second.first;
- iQ[i+1] =sQ[j].second.second;
-@@ -751,7 +751,7 @@ AnyType ISOLINE_P1_Op::operator()(Stack stack) const
- if(smoothing>0)
- {
- KN<R2> P1(QQ.size()),P2(QQ.size());
-- for(int i=0;i<QQ.size();++i)
-+ for(size_t i=0;i<QQ.size();++i)
- P1[i]= P[QQ[i]].P ;
-
-
-@@ -761,7 +761,7 @@ AnyType ISOLINE_P1_Op::operator()(Stack stack) const
- c0/=ct;
-
-
-- for(int i=0; i<iQ.size();)
-+ for(size_t i=0; i<iQ.size();)
- {
- int i0=iQ[i++];
- int i1=iQ[i++]-1;
-@@ -784,7 +784,7 @@ AnyType ISOLINE_P1_Op::operator()(Stack stack) const
- }
- }
-
-- for(int i=0;i<QQ.size();++i)
-+ for(size_t i=0;i<QQ.size();++i)
- P[QQ[i]].P=P1[i] ;
-
- }
-@@ -792,7 +792,7 @@ AnyType ISOLINE_P1_Op::operator()(Stack stack) const
- if(pbeginend)
- {
- pbeginend->resize(iQ.size());
-- for(int i=0; i<iQ.size();++i)
-+ for(size_t i=0; i<iQ.size();++i)
- (*pbeginend)[i]=iQ[i];
- }
-
-@@ -800,7 +800,7 @@ AnyType ISOLINE_P1_Op::operator()(Stack stack) const
- {
- pxx->resize(QQ.size());
- pyy->resize(QQ.size());
-- for(int i=0;i<QQ.size();++i)
-+ for(size_t i=0;i<QQ.size();++i)
- {
- int j=QQ[i];
- (*pxx)[i]= P[j].P.x ;
-@@ -813,7 +813,7 @@ AnyType ISOLINE_P1_Op::operator()(Stack stack) const
- pxy->resize(3,QQ.size());
-
-
-- for(int k=0; k<iQ.size();k+=2)
-+ for(size_t k=0; k<iQ.size();k+=2)
- {
- int i0=iQ[k],i1=iQ[k+1];
- double lg=0;
-diff --git a/examples++-load/medit.cpp b/examples++-load/medit.cpp
-index 693c8ba8..1e1e34ed 100644
---- a/examples++-load/medit.cpp
-+++ b/examples++-load/medit.cpp
-@@ -272,7 +272,7 @@ public:
-
- struct Expression2 {
- long what; // 1 scalar, 2 vector, 3 symtensor
-- long nbfloat; // 1 scalar, 2 vector (3D), 3 symtensor(3D)
-+ unsigned long nbfloat; // 1 scalar, 2 vector (3D), 3 symtensor(3D)
- string *dataname;
- Expression e[3];
- Expression2() {e[0]=0; e[1]=0; e[2]=0; what=0; nbfloat=0;};
-@@ -487,7 +487,7 @@ public:
-
- struct Expression2 {
- long what; // 1 scalar, 2 vector, 3 symtensor
-- long nbfloat; // 1 scalar, 3 vector (3D), 6 symtensor(3D)
-+ unsigned long nbfloat; // 1 scalar, 3 vector (3D), 6 symtensor(3D)
- Expression e[6];
- Expression2() {e[0]=0; e[1]=0; e[2]=0; e[3]=0; e[4]=0; e[5]=0; what=0; nbfloat=0;};
- Expression &operator[](int i){return e[i];}
-@@ -848,11 +848,11 @@ public:
- typedef long Result;
- Expression eTh;
- Expression filename;
-- long offset;
-+ unsigned long offset;
- long nbTh;
- struct Expression2 {
- long what; // 0 mesh, 1 scalar, 2 vector, 3 symtensor
-- long nbfloat; // 1 scalar, 2 vector (2D), 3 symtensor(2D)
-+ unsigned long nbfloat; // 1 scalar, 2 vector (2D), 3 symtensor(2D)
- Expression e[3];
- Expression2() {e[0]=0; e[1]=0; e[2]=0; what=0; nbfloat=0;};
- Expression &operator[](int i){return e[i];}
-@@ -1645,11 +1645,11 @@ public:
- typedef long Result;
- Expression eTh;
- Expression filename;
-- long offset;
-+ unsigned long offset;
- long nbTh;
- struct Expression2 {
- long what; // 0 mesh, 1 scalar, 2 vector, 3 symtensor
-- long nbfloat; // 0 mesh(3D), 1 scalar, 2 vector (3D), 3 symtensor(3D)
-+ unsigned long nbfloat; // 0 mesh(3D), 1 scalar, 2 vector (3D), 3 symtensor(3D)
- Expression e[6];
- Expression2() {e[0]=0; e[1]=0; e[2]=0; e[3]=0; e[4]=0; e[5]=0; what=0; nbfloat=0;};
- Expression &operator[](int i){return e[i];}
-@@ -1726,7 +1726,7 @@ public:
- }
- // determination of the number of solutions.
- size_t lastTh=0;
-- long offset1;
-+ unsigned long offset1;
- offset=0;
- nbTh=0;
- for(size_t jj=0; jj<l.size(); jj++){
-diff --git a/examples++-load/msh3.cpp b/examples++-load/msh3.cpp
-index 1a5fb898..59a3cbb7 100644
---- a/examples++-load/msh3.cpp
-+++ b/examples++-load/msh3.cpp
-@@ -3762,7 +3762,7 @@ void OrderVertexTransfo_hcode_nv( const int &tab_nv, const double *tab_XX, const
-
-
- /* initialisation des codes */
-- for(int ii=0; ii< NbCode; ii++){
-+ for(size_t ii=0; ii< NbCode; ii++){
- tcode[ii] = -1;
- }
-
-@@ -3793,7 +3793,7 @@ void OrderVertexTransfo_hcode_nv( const int &tab_nv, const double *tab_XX, const
- if(verbosity >1) cout << " determinations des points confondus et numerotation " << endl;
-
- nv_t=0;
-- for(int icode =0; icode < NbCode; icode++){
-+ for(size_t icode =0; icode < NbCode; icode++){
- //int ii,jj;
- double dist;
-
-@@ -3879,7 +3879,7 @@ void PointCommun_hcode( const int &dim, const int &NbPoints, const int &point_co
- if(verbosity >1) cout << "NbCode=" << NbCode << endl;
- tcode = new int[NbCode];
- /* initialisation des codes */
-- for(int ii=0; ii< NbCode; ii++){
-+ for(size_t ii=0; ii< NbCode; ii++){
- tcode[ii] = -1;
- }
-
-@@ -3917,7 +3917,7 @@ void PointCommun_hcode( const int &dim, const int &NbPoints, const int &point_co
-
- case 0:
- np=0;
-- for(int icode =0; icode < NbCode; icode++){
-+ for(size_t icode =0; icode < NbCode; icode++){
- //int ii,jj;
- double dist;
-
-@@ -3951,7 +3951,7 @@ void PointCommun_hcode( const int &dim, const int &NbPoints, const int &point_co
- case 1:
- int point_multiple;
- np=0;
-- for(int icode =0; icode < NbCode; icode++){
-+ for(unsigned icode =0; icode < NbCode; icode++){
- //int ii,jj;
- double dist;
-
-diff --git a/examples++-load/symmetrizeCSR.cpp b/examples++-load/symmetrizeCSR.cpp
-index 0eeb366a..782806ba 100644
---- a/examples++-load/symmetrizeCSR.cpp
-+++ b/examples++-load/symmetrizeCSR.cpp
-@@ -35,9 +35,9 @@ long symmetrizeCSR(Matrice_Creuse<T>* const &A) {
- std::vector<T> a;
- a.reserve(mA->nbcoef);
- cl.reserve(mA->nbcoef);
-- unsigned int save = mA->lg[0];
-- for(unsigned int i = 0; i < mA->n; ++i) {
-- for(unsigned int j = save; j < mA->lg[i + 1]; ++j) {
-+ int save = mA->lg[0];
-+ for(int i = 0; i < mA->n; ++i) {
-+ for(int j = save; j < mA->lg[i + 1]; ++j) {
- int col = mA->cl[j];
- if(col <= i) {
- T val = mA->a[j];
-diff --git a/src/Graphics/ffglut.cpp b/src/Graphics/ffglut.cpp
-index de710e0f..7111371e 100644
---- a/src/Graphics/ffglut.cpp
-+++ b/src/Graphics/ffglut.cpp
-@@ -1089,13 +1089,13 @@ void OnePlotBorder::Draw(OneWindow *win)
- plot.SetColorTable(16) ;
-
- // vector<vector<pair<long,R2> > > data;
-- for(int i=0;i<data.size() ;++i)
-+ for(size_t i=0;i<data.size() ;++i)
- {
- vector<pair<long,R2> > & v=data[i];
- ShowGlerror("end OnePlotBorder::Draw 1");
-
-
-- for(int j=1;j<v.size();++j)
-+ for(size_t j=1;j<v.size();++j)
- {
- // cout <<v[j].first << endl;
- plot.color(2+v[j].first);
-diff --git a/src/femlib/RNM.hpp b/src/femlib/RNM.hpp
-index 3808a8e9..9aa804c5 100644
---- a/src/femlib/RNM.hpp
-+++ b/src/femlib/RNM.hpp
-@@ -399,6 +399,8 @@ public:
-
- KN_ operator()(const SubArray & sa) const { return KN_(*this,sa);} // sub array
-
-+ R & operator[](size_t i) const {return v[index(i)];}
-+ R & operator()(size_t i) const {return v[index(i)];}
- R & operator[](long i) const {return v[index(i)];}
- R & operator()(long i) const {return v[index(i)];}
- R & operator[](int i) const {return v[index(i)];}
-@@ -653,6 +655,8 @@ class KNM_: public KN_<R> {
- { return this->index(shapei.index(i)+shapej.index(j));}
- R & operator()(long i,long j) const
- { return this->v[indexij(i,j)];}
-+ R & operator()(size_t i,size_t j) const
-+ { return this->v[indexij(i,j)];}
- R & operator()(int i,int j) const
- { return this->v[indexij(i,j)];}
-
-diff --git a/src/fflib/AFunction.hpp b/src/fflib/AFunction.hpp
-index 98094d80..6def7c51 100644
---- a/src/fflib/AFunction.hpp
-+++ b/src/fflib/AFunction.hpp
-@@ -1521,7 +1521,7 @@ class basicAC_F0 {
- friend class E_Array; // for mapping fonction
- protected:
- typedef const C_F0 const_C_F0;
-- int nb;
-+ size_t nb;
- C_F0 *a;
- public:
- typedef map<const char *,C_F0,Keyless> maptype ;
-@@ -1532,7 +1532,7 @@ class basicAC_F0 {
- basicAC_F0 & operator=(C_F0 & c) {named_parameter=0;nb=1;a=&c;return *this;}
- basicAC_F0 & operator=(pair<int,C_F0*> p) {named_parameter=0;nb=p.first;a=p.second;return *this;}
- const C_F0 & operator [] (int i) const {throwassert(a && i<nb);return a[i];}
-- int size() const {return nb;}
-+ size_t size() const {return nb;}
- C_F0 * ptr() const {return a;}
- C_F0 find(const char * k) const {
- assert(k);
-@@ -1554,7 +1554,7 @@ class basicAC_F0 {
- class AC_F0: public basicAC_F0 { // a Array of [[C_F0]]
- // tableau d'un parametres max 1024 parametres
- // avec allocation
-- const static int MaxSize;
-+ const static size_t MaxSize;
- // no constructor in this class (this class is in a union )
- public:
- AC_F0 & operator=(pair<const char *,const C_F0> p) {
-@@ -1573,8 +1573,8 @@ class AC_F0: public basicAC_F0 { // a Array of [[C_F0]]
- if(i==named_parameter->end()) named_parameter->insert(make_pair(nm,c));
- else {cerr << " the named in the list already exists "<< nm <<endl; CompileError();}
- return *this;}
-- int size() const {return nb;}
-- const C_F0 & operator [] (int i) const {
-+ size_t size() const {return nb;}
-+ const C_F0 & operator [] (size_t i) const {
- if( !(a && i<nb))
- { cout << " AC_F0 bug " << a << " " <<i<<endl;
- ffassert(a && i<nb);}
-@@ -1612,7 +1612,7 @@ class basicAC_F0_wa : public basicAC_F0 { public:
- nb=1+b.size();
- a= new C_F0[nb];
- a[0]=e;
-- for (int i=1;i<nb;i++) a[i]=b[i-1];}
-+ for (size_t i=1;i<nb;i++) a[i]=b[i-1];}
- ~basicAC_F0_wa(){delete [] a;
- a=0;
- delete named_parameter;
-@@ -1624,7 +1624,7 @@ class basicAC_F0_wa : public basicAC_F0 { public:
- if (b.named_parameter) named_parameter = new maptype(*b.named_parameter);
- nb=b.size();
- a= new C_F0[nb];
-- for (int i=0;i<nb;i++) a[i]=b[i];}
-+ for (size_t i=0;i<nb;i++) a[i]=b[i];}
-
- private:
- void operator=(const basicAC_F0 & b);
-@@ -1643,10 +1643,10 @@ class E_Array :public E_F0 { public:
- int size() const {return v->size();}
- size_t nbitem() const {return v->size();}
- void map(C_F0 (*mapping)(const C_F0 & )) const
-- { for (int i=0;i<v->size();i++)
-+ { for (size_t i=0;i<v->size();i++)
- v->a[i]=(*mapping)(v->a[i]);}
- virtual bool MeshIndependent() const {
-- for (int i=0;i<v->size();i++)
-+ for (size_t i=0;i<v->size();i++)
- if (v->a[i].MeshIndependent()) return false;
- return false;
-
-diff --git a/src/fflib/AFunction2.cpp b/src/fflib/AFunction2.cpp
-index a48a2ff1..cb4b558e 100644
---- a/src/fflib/AFunction2.cpp
-+++ b/src/fflib/AFunction2.cpp
-@@ -743,7 +743,7 @@ E_Routine::E_Routine(const Routine * routine,const basicAC_F0 & args)
- name(routine->name)
- {
- assert(routine->ins);
-- for (int i=0;i<args.size();i++) // bug pb copie des string dec 2007 FH ???????????????
-+ for (size_t i=0;i<args.size();i++) // bug pb copie des string dec 2007 FH ???????????????
- {
- if(verbosity>10000) cout << "E_Routine " << *routine->param[i].r << " <- " << *args[i].left() << endl;
- param[i]=routine->param[i].r->CastTo(args[i]);
-@@ -938,7 +938,7 @@ void ShowDebugStack()
- else
- cerr << " current line = " << TheCurrentLine << endl;
- if(debugstack)
-- for (int i=0; i<debugstack->size(); ++i)
-+ for (size_t i=0; i<debugstack->size(); ++i)
- {
-
- cerr << " call " << debugstack->at(i).first->name<< " at line "
-@@ -1093,7 +1093,7 @@ void lgerror (const char* s)
- AC_F0 args;
- args=0; // reset
- args+=m;
-- for(int j=0,i=id->size(); j<id->size() ; ++j)
-+ for(size_t j=0,i=id->size(); j<id->size() ; ++j)
- {
- --i;
- C_F0 ci=cb->NewVar<LocalVariable>((*id)[i].id,tt[i]);
-diff --git a/src/fflib/AddNewFE.h b/src/fflib/AddNewFE.h
-index c1bb78cb..5a6fccac 100644
---- a/src/fflib/AddNewFE.h
-+++ b/src/fflib/AddNewFE.h
-@@ -30,7 +30,7 @@ class EConstantTypeOfFE :public E_F0
- {
- // using namespace Fem2D;
- Fem2D::TypeOfFE * v;
-- size_t N;
-+ int N;
- bool isconst;
- public:
- AnyType operator()(Stack ) const { /*cout << " ()" << v << endl*/;return SetAny<Fem2D::TypeOfFE*>(v);}
-diff --git a/src/fflib/PlotStream.hpp b/src/fflib/PlotStream.hpp
-index 047eabce..e24315ca 100644
---- a/src/fflib/PlotStream.hpp
-+++ b/src/fflib/PlotStream.hpp
-@@ -112,7 +112,7 @@ public:
-
- void read( void *data,size_t l) {
- char * p= (char*)data;
-- for(int i=0;i<l;++i)
-+ for(size_t i=0;i<l;++i)
- *p++ = (char) getc(TheStream);
- // fread( p++,1,1,TheStream);
- // read(data,l);
-diff --git a/src/fflib/global.cpp b/src/fflib/global.cpp
-index a90f1d2b..f74bfd7a 100644
---- a/src/fflib/global.cpp
-+++ b/src/fflib/global.cpp
-@@ -165,7 +165,7 @@ TableOfIdentifier Global;
- typedef list<TableOfIdentifier *> ListOfTOfId;
- ListOfTOfId tables_of_identifier;
-
--const int AC_F0::MaxSize=1024; // maximal number of parameters
-+const size_t AC_F0::MaxSize=1024; // maximal number of parameters
-
-
-
-diff --git a/src/fflib/lgfem.cpp b/src/fflib/lgfem.cpp
-index 8b9bb98a..7461db1f 100644
---- a/src/fflib/lgfem.cpp
-+++ b/src/fflib/lgfem.cpp
-@@ -6336,7 +6336,7 @@ size_t dimFESpaceImage(const basicAC_F0 &args)
- aType t_a= atype<E_Array>();
- size_t dim23=0;
-
-- for (int i=0;i<args.size();i++)
-+ for (size_t i=0;i<args.size();i++)
- if (args[i].left() == t_tfe || args[i].left() == t_tfe3 )
- dim23 += args[i].LeftValue()->nbitem();
- else if (args[i].left() == t_a)
-@@ -6363,7 +6363,7 @@ aType typeFESpace(const basicAC_F0 &args)
- //aType t_a= atype<E_Array>();
- size_t d=0;
- // 20 avril 2009 add brak
-- for (int i=0;i<args.size();i++)
-+ for (size_t i=0;i<args.size();i++)
-
- if (args[i].left() == t_tfe || args[i].left() == t_m2)
- { ffassert(d==0 || d==2) ;d=2;break;}
-diff --git a/src/fflib/lgfem.hpp b/src/fflib/lgfem.hpp
-index 2532ef96..1a1f774f 100644
---- a/src/fflib/lgfem.hpp
-+++ b/src/fflib/lgfem.hpp
-@@ -433,15 +433,15 @@ public:
- if(xx != 0 && i > 0 && i != this->N) {
- FEbase<K,v_fes>** yy = new FEbase<K,v_fes>*[i];
- if(i > this->N) {
-- for(unsigned int j = 0; j < std::max(this->N, 1); ++j)
-+ for(int j = 0; j < std::max(this->N, 1); ++j)
- yy[j] = xx[j];
-- for(unsigned int j = std::max(this->N, 1); j < i; ++j)
-+ for(int j = std::max(this->N, 1); j < i; ++j)
- yy[j] = new FEbase<K,v_fes>(xx[0]->pVh);
- }
- else {
-- for(unsigned int j = 0; j < i; ++j)
-+ for(int j = 0; j < i; ++j)
- yy[j] = xx[j];
-- for(unsigned int j = i; j < this->N; ++j)
-+ for(int j = i; j < this->N; ++j)
- xx[j]->destroy();
- }
- FEbase<K,v_fes> **oldXx = this->xx;
-diff --git a/src/fflib/lgmat.cpp b/src/fflib/lgmat.cpp
-index 0d54ed85..1e9d6360 100644
---- a/src/fflib/lgmat.cpp
-+++ b/src/fflib/lgmat.cpp
-@@ -3232,13 +3232,13 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
- }
- else {
- std::vector<std::vector<std::pair<unsigned int, T> > > tmp(n);
-- for(unsigned int i = 0; i < n; ++i)
-+ for(int i = 0; i < n; ++i)
- tmp[i].reserve(mA->lg[mR->cl[i] + 1] - mA->lg[mR->cl[i]]);
-
- unsigned int nnz = 0;
-- for(unsigned int i = 0; i < n; ++i) {
-- for(unsigned int j = mA->lg[mR->cl[i]]; j < mA->lg[mR->cl[i] + 1]; ++j) {
-- unsigned int col = tmpVec[mA->cl[j]];
-+ for(int i = 0; i < n; ++i) {
-+ for(int j = mA->lg[mR->cl[i]]; j < mA->lg[mR->cl[i] + 1]; ++j) {
-+ int col = tmpVec[mA->cl[j]];
- if(col != 0 && abs(mA->a[j]) > EPS) {
- if(i < col - 1)
- tmp[col - 1].push_back(make_pair(i, mA->a[j]));
-@@ -3255,7 +3255,7 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
- val = new T[nnz];
- nnz = 0;
- lg[0] = 0;
-- for(unsigned int i = 0; i < n; ++i) {
-+ for(int i = 0; i < n; ++i) {
- std::sort(tmp[i].begin(), tmp[i].end(),cmp<T>);
- // c++11, [](const std::pair<unsigned int, T>& lhs, const std::pair<unsigned int, T>& rhs) { return lhs.first < rhs.first; });
- for(typename std::vector<std::pair<unsigned int, T> >::const_iterator it = tmp[i].begin(); it != tmp[i].end(); ++it) {
-@@ -3280,7 +3280,7 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
- else {
- tmpVec.reserve(mA->n);
- unsigned int i = 0, j = 1;
-- for(unsigned int k = 0; k < mA->n; ++k) {
-+ for(int k = 0; k < mA->n; ++k) {
- if(k == *(*condensation + i)) {
- ++i;
- tmpVec.push_back(i);
-@@ -3301,10 +3301,10 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
- tmpInteraction.reserve(mA->nbcoef);
-
- lg[0] = 0;
-- for(unsigned int i = 0; i < mA->n; ++i) {
-+ for(int i = 0; i < mA->n; ++i) {
- int row = tmpVec[i];
- if(row < 0) {
-- for(unsigned int j = mA->lg[i]; j < mA->lg[i + 1]; ++j) {
-+ for(int j = mA->lg[i]; j < mA->lg[i + 1]; ++j) {
- int col = tmpVec[mA->cl[j]];
- if(col < 0)
- tmpInterior.push_back(make_pair(-col - 1, mA->a[j]));
-@@ -3314,7 +3314,7 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
-
- }
- else {
-- for(unsigned int j = mA->lg[i]; j < mA->lg[i + 1]; ++j) {
-+ for(int j = mA->lg[i]; j < mA->lg[i + 1]; ++j) {
- int col = tmpVec[mA->cl[j]];
- if(col > 0)
- tmpBoundary.push_back(make_pair(col - 1, mA->a[j]));
-@@ -3342,13 +3342,13 @@ AnyType removeDOF_Op<T>::operator()(Stack stack) const {
- {
- MatriceMorse<T> *mR = static_cast<MatriceMorse<T>*>(&(*pR->A));
-
-- unsigned int n = mR->nbcoef;
-+ int n = mR->nbcoef;
-
- if(pOut->n != n) pOut->resize(n);
-
-
-
-- for(unsigned int i = 0; i < n; ++i) {
-+ for(int i = 0; i < n; ++i) {
- *(*pOut + i) = *(*pX + mR->cl[i]);
- }
-
-diff --git a/src/fflib/lgmesh.cpp b/src/fflib/lgmesh.cpp
-index 96a1c651..d5d6c0e3 100644
---- a/src/fflib/lgmesh.cpp
-+++ b/src/fflib/lgmesh.cpp
-@@ -256,7 +256,7 @@ class MoveMesh : public E_F0mps { public:
- U=to<double>( (*a)[0]);
- V=to<double>( (*a)[1]);
-
-- for (int i=2;i<args.size();i++)
-+ for (size_t i=2;i<args.size();i++)
- sol[i-2]=to<double>(args[i]);
- }
- static ArrayOfaType typeargs() { return ArrayOfaType(atype<pmesh>(),atype<E_Array>(),true);}
-@@ -1701,7 +1701,7 @@ class CheckMoveMesh : public E_F0mps { public:
- U=to<double>( (*a)[0]);
- V=to<double>( (*a)[1]);
-
-- for (int i=2;i<args.size();i++)
-+ for (size_t i=2;i<args.size();i++)
- sol[i-2]=to<double>(args[i]);
- }
- static ArrayOfaType typeargs() { return ArrayOfaType(atype<pmesh>(),atype<E_Array>(),false);}
-diff --git a/src/fflib/lgmesh3.cpp b/src/fflib/lgmesh3.cpp
-index f5578cf6..ee21e719 100644
---- a/src/fflib/lgmesh3.cpp
-+++ b/src/fflib/lgmesh3.cpp
-@@ -581,7 +581,7 @@ class MoveMesh3 : public E_F0mps { public:
- U=to<double>( (*a)[0]);
- V=to<double>( (*a)[1]);
-
-- for (int i=2;i<args.size();i++)
-+ for (size_t i=2;i<args.size();i++)
- sol[i-2]=to<double>(args[i]);
- }
- static ArrayOfaType typeargs() { return ArrayOfaType(atype<pmesh>(),atype<E_Array>(),true);}
---
-2.17.1
-
diff --git a/0005-Wimplicit-function-declaration.patch b/0005-Wimplicit-function-declaration.patch
deleted file mode 100644
index d599d39..0000000
--- a/0005-Wimplicit-function-declaration.patch
+++ /dev/null
@@ -1,333 +0,0 @@
-From 39431d0d2b6001e346461368fc4e342a668c2845 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
-Date: Sat, 6 May 2017 09:42:37 +0200
-Subject: [PATCH 05/10] Wimplicit-function-declaration
-
----
- src/medit/Makefile.am | 2 +-
- src/medit/bbfile.c | 1 +
- src/medit/chrono.h | 32 -----------------------
- src/medit/eigenv.h | 2 --
- src/medit/ellipse.c | 3 +--
- src/medit/inout.c | 2 +-
- src/medit/inout_morice.c | 2 ++
- src/medit/inout_popenbinaire.c | 4 ++-
- src/medit/sproto.h | 46 ++++++++++++++++++++++++++++------
- 9 files changed, 47 insertions(+), 47 deletions(-)
- delete mode 100644 src/medit/chrono.h
- delete mode 100644 src/medit/eigenv.h
-
-diff --git a/src/medit/Makefile.am b/src/medit/Makefile.am
-index e3c49a9d..8000ba65 100644
---- a/src/medit/Makefile.am
-+++ b/src/medit/Makefile.am
-@@ -9,7 +9,7 @@ ffmedit_SOURCES= animat.c cube.c image.c listnum.c mouse.c persp.c stream.c zald
- material.c normal.c tiles.c camera.c ellipse.c inout.c medit.c param.c psfile.c transform.c cenrad.c geometry.c \
- inout_morice.c menus.c parsar.c scene.c util.c clip.c gisfil.c inout_popenbinaire.c mesh.c parsop.c scissor.c vector.c \
- clipvol.c hash.c items.c mlists.c particle.c sftcpy.c view.c critip.c ilists.c keyboard.c morphing.c path.c status.c \
--zaldy1.c chrono.h extern.h image.h mesh.h eigenv.h grafic.h medit.h sproto.h picking.c
-+zaldy1.c extern.h image.h mesh.h grafic.h medit.h sproto.h picking.c
-
-
- LDADD=../libMesh/libMesh.a $(LIBSGLUT) -lm
-diff --git a/src/medit/bbfile.c b/src/medit/bbfile.c
-index 2841b872..c5e74693 100644
---- a/src/medit/bbfile.c
-+++ b/src/medit/bbfile.c
-@@ -1,6 +1,7 @@
- #include "medit.h"
- #include "extern.h"
- #include "sproto.h"
-+#include <eigenv.h>
-
- int EatLine(FILE *in) {
- int k,c;
-diff --git a/src/medit/chrono.h b/src/medit/chrono.h
-deleted file mode 100644
-index fac808a2..00000000
---- a/src/medit/chrono.h
-+++ /dev/null
-@@ -1,32 +0,0 @@
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--#include <time.h>
--
--#ifndef ON
--#define RESET 0
--#define ON 1
--#define OFF 2
--#endif
--
--#define TIMEMAX 16
--#define MAXCLK ( 1073741823. / (double)CLOCKS_PER_SEC )
--
--
--typedef struct mytime {
-- double ctim,dtim;
-- time_t ptim;
-- short call;
--} mytime;
--
--
--/* prototypes */
--void chrono(int cmode,mytime *ptt);
--double gttime(mytime t);
--void tminit(mytime *t,int maxtim);
--
--
--#ifdef __cplusplus
--}
--#endif
-diff --git a/src/medit/eigenv.h b/src/medit/eigenv.h
-deleted file mode 100644
-index 996cbe8b..00000000
---- a/src/medit/eigenv.h
-+++ /dev/null
-@@ -1,2 +0,0 @@
--int eigenv(int symmat,double *mat,double lambda[3],double v[3][3]);
--int eigen2(double *mm,double *lambda,double vp[2][2]);
-diff --git a/src/medit/ellipse.c b/src/medit/ellipse.c
-index 20c89570..f9d03027 100644
---- a/src/medit/ellipse.c
-+++ b/src/medit/ellipse.c
-@@ -1,14 +1,13 @@
- #include "medit.h"
- #include "extern.h"
- #include "sproto.h"
--#include "eigenv.h"
-+#include <eigenv.h>
-
- #ifndef M_PI2
- #define M_PI2 (2.0*M_PI)
- #endif
-
- extern int refmat;
--extern int eigen2(double m[3],double lambda[2],double vp[2][2]);
-
- static GLfloat IdMatrix[16] = {
- 1.0, 0.0, 0.0, 0.0,
-diff --git a/src/medit/inout.c b/src/medit/inout.c
-index f929a20b..97fe525a 100755
---- a/src/medit/inout.c
-+++ b/src/medit/inout.c
-@@ -1,7 +1,7 @@
- #include "medit.h"
- #include "libmesh5.h"
- #include "extern.h"
--
-+#include <eigenv.h>
-
- int loadMesh(pMesh mesh) {
- pPoint ppt;
-diff --git a/src/medit/inout_morice.c b/src/medit/inout_morice.c
-index 1d858ff1..3b804220 100755
---- a/src/medit/inout_morice.c
-+++ b/src/medit/inout_morice.c
-@@ -2,6 +2,8 @@
- #include "libmesh5.h"
- #include "extern.h"
- #include "string.h"
-+#include <eigenv.h>
-+
- static int debug=0;
- void getline_number(char *nature, int *nb){
- char data[256];
-diff --git a/src/medit/inout_popenbinaire.c b/src/medit/inout_popenbinaire.c
-index 763d86aa..1c19d0dd 100644
---- a/src/medit/inout_popenbinaire.c
-+++ b/src/medit/inout_popenbinaire.c
-@@ -2,6 +2,8 @@
- #include "libmesh5.h"
- #include "extern.h"
- #include "string.h"
-+#include <eigenv.h>
-+
- #ifdef WIN32
- #include <fcntl.h>
- #endif
-@@ -874,7 +876,7 @@ int loadSol_popen_bin(pMesh mesh,char *filename,int numsol) {
- natureread = "SolAtTriangles";
- fread( (unsigned char *)&NulPos ,WrdSiz, 1, stdin);
- fread( (unsigned char *)&nel ,WrdSiz, 1, stdin);
-- if(debug) printf(stdout,"SolAtTriangles : nel %d, mesh->nt %d \n",nel,mesh->nt);
-+ if(debug) fprintf(stdout,"SolAtTriangles : nel %d, mesh->nt %d \n",nel,mesh->nt);
- if ( nel && nel != mesh->nt ) {
- fprintf(stderr," %%%% Wrong number %d.\n",nel);
- retcode=0;
-diff --git a/src/medit/sproto.h b/src/medit/sproto.h
-index 920b25c3..ca40cd11 100644
---- a/src/medit/sproto.h
-+++ b/src/medit/sproto.h
-@@ -3,6 +3,11 @@ int loadNextMesh(pMesh ,int ,int );
- int animat();
- int playAnim(pScene ,pMesh ,int ,int );
- void glutIdle(void);
-+int advectParticle(pScene sc,pMesh mesh);
-+int animParticle(pScene sc,pMesh mesh);
-+
-+/* bbfile.c */
-+int EatSpace(FILE *in);
-
- /* camera.c */
- double Azimuth(pCamera );
-@@ -11,6 +16,9 @@ void updateSun(pScene ,pCamera );
- void updateCamera(pScene ,pCamera ,double ,double );
- pCamera initCamera(pScene ,int );
-
-+/* cenrad.c */
-+int cenrad(pMesh mesh,int iel,double *c,double *rad);
-+
- /* clip.c */
- void updateClip(pClip ,pMesh );
- void clipVertices(pMesh ,pScene ,pClip );
-@@ -20,6 +28,7 @@ void copyClip(pClip );
- int pasteClip(pClip );
- void resetClip(pScene ,pClip ,pMesh );
- pClip createClip(pScene ,pMesh );
-+void tiltClip(pScene sc,pClip clip);
-
- void updateCube(pCube ,pMesh );
- pCube createCube(pScene ,pMesh );
-@@ -32,14 +41,21 @@ GLuint capTetraIso(pMesh );
- /* critip.c */
- GLuint listCritPoint(pScene ,pMesh );
-
-+/* cube.c */
-+void dumpCube(pScene sc,pMesh mesh,pCube cube);
-+void resetCube(pScene sc,pCube cube,pMesh mesh);
-+
- /* dlists.c */
- GLuint listTria(pScene ,pMesh );
- GLuint listQuad(pScene ,pMesh );
- GLuint listTetra(pScene ,pMesh ,ubyte );
- GLuint listHexa(pScene ,pMesh ,ubyte );
-
--/* eigenv.c */
--int eigenv(int sym,double mat[6],double lambda[3],double v[3][3]);
-+/* ellipse.c */
-+void circumSphere(pScene sc,pMesh mesh,int typel,int k);
-+void drawEllipse(pScene sc,pMesh mesh,int typel,int k);
-+void drawEllipsoid(pScene sc,pMesh mesh,int typel,int k);
-+GLuint drawAllEllipse(pScene sc,pMesh mesh);
-
- /* geometry.c */
- GLuint geomList(pScene ,pMesh );
-@@ -50,6 +66,7 @@ int loadGIS(pMesh );
- /* hash.c */
- int hashTria(pMesh );
- int hashTetra(pMesh );
-+int hashHexa(pMesh mesh);
-
- /* image.c */
- PPMimage *loadPPM(const char *imgname,int *type);
-@@ -61,15 +78,19 @@ int imgHard(pScene sc,char *data,char key);
- int EatLine(FILE *in);
- int inmsh2(pMesh mesh);
- int bbfile(pMesh );
--int loadMesh(pMesh );
- int saveMesh(pScene ,pMesh ,char *,ubyte );
- int loadSol(pMesh mesh,char *filename,int numsol);
-+int loadSol_popen(pMesh mesh,char *filename,int numsol);
-+int loadSol_popen_bin(pMesh mesh,char *filename,int numsol);
-+int loadMesh(pMesh );
- int loadMesh_popen(pMesh); //pour popen
-+int loadMesh_popen_bin(pMesh mesh);
-
- /* ilists.c */
- GLuint listTriaIso(pScene ,pMesh );
- GLuint listQuadIso(pScene ,pMesh );
- GLuint listTetraIso(pScene ,pMesh );
-+int tetraIsoPOVray(pScene sc,pMesh mesh);
-
- /* items.c */
- void drawAxis(pScene ,int );
-@@ -132,7 +153,8 @@ void menuImage(int );
- void keyMetric(unsigned char key,int x,int y);
- int createMenus(pScene ,pMesh );
- GLuint pickingScene(pScene sc,int x,int y,int ident);
--
-+void keyCube(unsigned char key,int x,int y);
-+
- /* mesh.c */
- void meshInfo(pMesh );
- int meshSurf(pMesh );
-@@ -169,6 +191,9 @@ GLuint drawNormals(pMesh mesh,pScene sc);
- /* outmsh.c */
- int outmsh(pScene ,pMesh ,char *name,ubyte clipon);
-
-+/* param.c */
-+void parEdit(pScene sc);
-+
- /* parsar.c */
- int parsar(int argc,char *argv[]);
-
-@@ -179,6 +204,7 @@ int parsop(pScene ,pMesh );
-
- /* particle.c */
- int createParticle(pScene ,pMesh );
-+int displayParticle(pScene sc,pMesh mesh);
-
- /* path.c */
- int pathAdd(pScene ,int, int);
-@@ -223,6 +249,9 @@ void streamIdle();
- /* scissor.c */
- void scissorScene();
-
-+/* sftcpy.c */
-+int sftcpy(pScene sc,pMesh mesh);
-+
- /* status.c */
- void reshapeStatusBar(pScene sc,int width,int height);
- void redrawStatusBar(pScene sc);
-@@ -231,9 +260,11 @@ void mouseStatus(int button,int state,int x,int y);
- /* stream.c */
- double sizeTetra(pMesh ,int );
- double sizeHexa(pMesh ,int );
-+double sizeQuad(pMesh mesh,int k);
- double sizeTria(pMesh ,int );
- int locateTria(pMesh mesh,int nsdep,int base,float *p,double *cb);
- int locateTetra(pMesh mesh,int nsdep,int base,float *p,double *cb);
-+int inTetra(pMesh mesh,int nsdep,float *p,double *cb);
- int inTria(pMesh ,int ,float *,double *);
- int listTetraStream(pScene ,pMesh ,float *,int );
- int listHexaStream(pScene ,pMesh ,float *,int );
-@@ -242,6 +273,7 @@ pStream createStream(pScene ,pMesh );
- int streamRefTria(pScene sc,pMesh mesh);
- int streamRefQuad(pScene sc,pMesh mesh);
- int streamRefPoint(pScene sc,pMesh mesh);
-+int streamIsoPoint(pScene sc,pMesh mesh);
- int listSaddleStream(pScene sc,pMesh mesh,int depart,
- float *pp,float *vv,double lambda);
- int nxtPoint3D(pMesh mesh,int nsdep,float *p,float step,double *v);
-@@ -249,10 +281,6 @@ int nxtPoint2D(pMesh mesh,int nsdep,float *p,float step,double *v);
- double field2DInterp(pMesh mesh,int iel,double *cb,double *v);
- double vector3DInterp(pMesh mesh,pPoint pt[4],double *cb,double *v);
- double field3DInterp(pMesh mesh,int iel,double *cb,double *v);
--double sizeTria(pMesh mesh,int k);
--double sizeQuad(pMesh mesh,int k);
--double sizeTetra(pMesh mesh,int k);
--
-
- /* tensor.c */
- GLuint listPointVector(pMesh ,ubyte );
-@@ -275,6 +303,7 @@ void output3(GLfloat x,GLfloat y,GLfloat z,char *format,...);
- void hsvrgb(double *hsv,double *rgb);
- void transformPoint(double u[4],float v[4],float m[16]);
- void transformPointd(double u[4],double v[4],double m[16]);
-+void transformPoint2(double u[4],float v[4],float m[16]);
- void transformVector(float u[4],float v[4],float m[16]);
- void multMatrix(GLfloat *p,GLfloat *a,GLfloat *b);
- void rotateMatrix(GLfloat angle,GLfloat x,GLfloat y,GLfloat z,GLfloat rm[16]);
-@@ -286,6 +315,7 @@ void drawVector2D(float p[2],double u[2],double scal);
- void drawVector3D(float p[3],double u[3],double scal);
- GLuint listTria2dVector(pMesh mesh);
- GLuint listTria3dVector(pMesh mesh);
-+GLuint listQuad2dVector(pMesh mesh);
- GLuint listClipTetraVector(pMesh mesh);
- GLuint listClipHexaVector(pMesh mesh);
-
---
-2.17.1
-
diff --git a/0005-Wreorder.patch b/0005-Wreorder.patch
new file mode 100644
index 0000000..450feb2
--- /dev/null
+++ b/0005-Wreorder.patch
@@ -0,0 +1,330 @@
+From 634635f639bd7682bd520020960d7734a2a52987 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
+Date: Mon, 8 May 2017 06:01:46 +0200
+Subject: [PATCH 5/9] Wreorder
+
+---
+ examples++-load/BasicMath.h | 2 +-
+ examples++-load/Geometry.hpp | 4 ++--
+ examples++-load/ff-NLopt.cpp | 8 ++++----
+ examples++-load/ff-cmaes.cpp | 2 +-
+ examples++-load/fflapack.cpp | 8 ++++----
+ examples++-load/gsl.cpp | 2 +-
+ examples++-load/lapack.cpp | 8 ++++----
+ examples++-mpi/mpi-cmaes.cpp | 6 +++---
+ src/Graphics/ffglut.cpp | 12 +++++++-----
+ src/femlib/FQuadTree.cpp | 6 +++---
+ src/femlib/MatriceCreuse.hpp | 6 +++---
+ src/femlib/RNM.hpp | 3 ++-
+ src/fflib/AFunction.hpp | 2 +-
+ src/fflib/AFunction2.cpp | 2 +-
+ src/fflib/problem.cpp | 6 +++---
+ 15 files changed, 40 insertions(+), 37 deletions(-)
+
+diff --git a/examples++-load/BasicMath.h b/examples++-load/BasicMath.h
+index 1f957df8..773f5ac5 100644
+--- a/examples++-load/BasicMath.h
++++ b/examples++-load/BasicMath.h
+@@ -67,7 +67,7 @@ class ostream_math {// This class only contains a reference to an ostream, and a
+ public:
+ Format_Math format;
+ ostream &os;
+- ostream_math (ostream &OS, Format_Math Format): os(OS), format(Format) {}
++ ostream_math (ostream &OS, Format_Math Format): format(Format), os(OS) {}
+ };
+
+ inline ostream_math operator << (ostream &f, Format_Math Format) {return ostream_math(f, Format);}
+diff --git a/examples++-load/Geometry.hpp b/examples++-load/Geometry.hpp
+index 204b99d7..66a1d105 100644
+--- a/examples++-load/Geometry.hpp
++++ b/examples++-load/Geometry.hpp
+@@ -31,8 +31,8 @@ using namespace std;
+
+ /**************** Vertex ******************/
+ class Vertex: public R2 { // heritage is perhaps not totally justified here, but...
+- sym2 m;
+ int gen;
++ sym2 m;
+ // friend int main(int argc, const char * argv[]); //for Debug purposes
+
+ public:
+@@ -77,7 +77,7 @@ class Edge {// edges are oriented. t is on the left.
+ Edge (): u(NULL), v(NULL), next(NULL), sister(NULL) {};
+
+ #ifdef _FLAGGED_BOUNDARY_
+- Edge (Vertex const *U, Vertex const *V, Edge *S, Edge *N, int OnBoundary_ = 0): u(U), v(V), sister(S), next(N), onBoundary_(OnBoundary_) {};
++ Edge (Vertex const *U, Vertex const *V, Edge *S, Edge *N, int OnBoundary_ = 0): u(U), v(V), next(N), sister(S), onBoundary_(OnBoundary_) {};
+ int onBoundary () const {return onBoundary_;} // {if(sister!=NULL) return 0; if(onBoundary_>0) return onBoundary_; return 10;}
+
+ #else
+diff --git a/examples++-load/ff-NLopt.cpp b/examples++-load/ff-NLopt.cpp
+index 8952854f..b3252e76 100644
+--- a/examples++-load/ff-NLopt.cpp
++++ b/examples++-load/ff-NLopt.cpp
+@@ -160,12 +160,12 @@ class GenericOptimizer
+ /*GenericOptimizer(nlopt::algorithm ALGO) : opt(ALGO,0),x(0),econsttol(0),iconsttol(0),econstrained(false),iconstrained(false),fit(0),d_fit(0),equaconst(0),
+ * d_equaconst(0),ineqconst(0),d_ineqconst(0),subopt(0)
+ * {}*/
+- GenericOptimizer (nlopt::algorithm ALGO, int dim = 0): opt(ALGO, dim), x(0), econsttol(0), iconsttol(0), econstrained(false), iconstrained(false), fit(0), d_fit(0), equaconst(0),
+- d_equaconst(0), ineqconst(0), d_ineqconst(0), subopt(0)
++ GenericOptimizer (nlopt::algorithm ALGO, int dim = 0): opt(ALGO, dim), subopt(0), x(0), econsttol(0), iconsttol(0), econstrained(false), iconstrained(false), fit(0), d_fit(0), equaconst(0),
++ d_equaconst(0), ineqconst(0), d_ineqconst(0)
+ {}
+
+- GenericOptimizer (nlopt::algorithm ALGO, const ffcalfunc<R> &_ff, Rn &xstart): opt(ALGO, xstart.n), x(&xstart), econsttol(0), iconsttol(0), econstrained(false), iconstrained(false),
+- fit(new ffcalfunc<R>(_ff)), d_fit(0), equaconst(0), d_equaconst(0), ineqconst(0), d_ineqconst(0), subopt(0) {
++ GenericOptimizer (nlopt::algorithm ALGO, const ffcalfunc<R> &_ff, Rn &xstart): opt(ALGO, xstart.n), subopt(0), x(&xstart), econsttol(0), iconsttol(0), econstrained(false), iconstrained(false),
++ fit(new ffcalfunc<R>(_ff)), d_fit(0), equaconst(0), d_equaconst(0), ineqconst(0), d_ineqconst(0) {
+ opt.set_min_objective(NLoptFunc, static_cast<void *>(this));
+ }
+
+diff --git a/examples++-load/ff-cmaes.cpp b/examples++-load/ff-cmaes.cpp
+index a81da97e..a18e0815 100644
+--- a/examples++-load/ff-cmaes.cpp
++++ b/examples++-load/ff-cmaes.cpp
+@@ -196,8 +196,8 @@ class OptimCMA_ES: public OneOperator
+ double *operator () () {return *x = Rn(x->n, CMAES::operator () ());}
+
+ private:
+- ffcalfunc *fit;
+ Rn *x;
++ ffcalfunc *fit;
+ };
+
+ class E_CMA_ES: public E_F0mps
+diff --git a/examples++-load/fflapack.cpp b/examples++-load/fflapack.cpp
+index a84329dc..24af2ebd 100644
+--- a/examples++-load/fflapack.cpp
++++ b/examples++-load/fflapack.cpp
+@@ -860,17 +860,17 @@ class Mult {
+ T b;
+ bool tb;
+ Mult (T aa, T bb)
+- : a(aa), b(bb), ta(0), tb(0) {}
++ : a(aa), ta(0), b(bb), tb(0) {}
+
+ // Transpose<
+ Mult (Transpose<T> aa, T bb)
+- : a(aa), b(bb), ta(1), tb(0) {}
++ : a(aa), ta(1), b(bb), tb(0) {}
+
+ Mult (Transpose<T> aa, Transpose<T> bb)
+- : a(aa), b(bb), ta(1), tb(1) {}
++ : a(aa), ta(1), b(bb), tb(1) {}
+
+ Mult (T aa, Transpose<T> bb)
+- : a(aa), b(bb), ta(1), tb(1) {}
++ : a(aa), ta(1), b(bb), tb(1) {}
+ };
+
+ template<class K>
+diff --git a/examples++-load/gsl.cpp b/examples++-load/gsl.cpp
+index 27008c26..274bcf24 100644
+--- a/examples++-load/gsl.cpp
++++ b/examples++-load/gsl.cpp
+@@ -76,8 +76,8 @@
+ struct GSLInterpolation {
+ gsl_interp_accel *acc;
+ gsl_spline *spline;
+- double *xy;
+ size_t n;
++ double *xy;
+ const gsl_interp_type *splinetype;
+ void init () {spline = 0; acc = 0; n = 0, xy = 0;}
+
+diff --git a/examples++-load/lapack.cpp b/examples++-load/lapack.cpp
+index 5238f26e..4959a6dd 100644
+--- a/examples++-load/lapack.cpp
++++ b/examples++-load/lapack.cpp
+@@ -914,17 +914,17 @@ class Mult {
+ T b;
+ bool tb;
+ Mult (T aa, T bb)
+- : a(aa), b(bb), ta(0), tb(0) {}
++ : a(aa), ta(0), b(bb), tb(0) {}
+
+ // Transpose<
+ Mult (Transpose<T> aa, T bb)
+- : a(aa), b(bb), ta(1), tb(0) {}
++ : a(aa), ta(1), b(bb), tb(0) {}
+
+ Mult (Transpose<T> aa, Transpose<T> bb)
+- : a(aa), b(bb), ta(1), tb(1) {}
++ : a(aa), ta(1), b(bb), tb(1) {}
+
+ Mult (T aa, Transpose<T> bb)
+- : a(aa), b(bb), ta(1), tb(1) {}
++ : a(aa), ta(1), b(bb), tb(1) {}
+ };
+
+ template<class K>
+diff --git a/examples++-mpi/mpi-cmaes.cpp b/examples++-mpi/mpi-cmaes.cpp
+index 3970c1a7..5beeef23 100644
+--- a/examples++-mpi/mpi-cmaes.cpp
++++ b/examples++-mpi/mpi-cmaes.cpp
+@@ -175,7 +175,7 @@ class OptimCMA_ES : public OneOperator
+ : CMAES(d,xstart.n ? xstart:0,stddev,seed,lambda,"non"),x(&xstart),fit(&_ff) {}*/
+
+ CMA_ES_MPI(ffcalfunc &_ff,Rn &xstart,const Rn &stddev,long seed,int lambda,MPI_Comm *_com)
+- : CMAES(),x(0),fit(&_ff),com(_com),myid(0),nproc(1),my_number_of_fitness_eval(0),index(0)
++ : CMAES(),x(0),fit(&_ff),com(_com),nproc(1),myid(0),my_number_of_fitness_eval(0),index(0)
+ {
+ MPI_Comm_size(*com,&nproc);
+ MPI_Comm_rank(*com,&myid);
+@@ -191,7 +191,7 @@ class OptimCMA_ES : public OneOperator
+ if(myid==0) cout << SayHello() << endl;
+ }
+ CMA_ES_MPI(ffcalfunc &_ff,Rn &xstart,const Rn &stddev,long seed,int lambda,MPI_Comm *_com,const char *ifname)
+- : CMAES(),x(0),fit(&_ff),com(_com),myid(0),nproc(1),my_number_of_fitness_eval(0),index(0)
++ : CMAES(),x(0),fit(&_ff),com(_com),nproc(1),myid(0),my_number_of_fitness_eval(0),index(0)
+ {
+ MPI_Comm_size(*com,&nproc);
+ MPI_Comm_rank(*com,&myid);
+@@ -242,8 +242,8 @@ class OptimCMA_ES : public OneOperator
+ private:
+ CMA_ES_MPI(const CMA_ES_MPI &);
+ CMA_ES_MPI& operator=(const CMA_ES_MPI &);
+- ffcalfunc *fit;
+ Rn *x;
++ ffcalfunc *fit;
+ MPI_Comm *com;
+ int nproc,myid,my_number_of_fitness_eval;
+ int * index;
+diff --git a/src/Graphics/ffglut.cpp b/src/Graphics/ffglut.cpp
+index 37818005..dbd3454f 100644
+--- a/src/Graphics/ffglut.cpp
++++ b/src/Graphics/ffglut.cpp
+@@ -1139,11 +1139,12 @@ void OnePlotBorder::Draw(OneWindow *win)
+
+ OneWindow::OneWindow(int h,int w,ThePlot *p)
+ :
++ theplot(0),
+ icurrentPlot(lplots.begin()),
+ lplotssize(0),
+- height(h),width(w),theplot(0),hpixel(1),
+- Bmin(0,0),Bmax(1,1),oBmin(Bmin),oBmax(Bmax),zmin(0),zmax(1),
+- windowdump(false),help(false), rapz0(-1.),rapz(1),withlight(false),
++ height(h),width(w),
++ Bmin(0,0),Bmax(1,1),oBmin(Bmin),oBmax(Bmax),zmin(0),zmax(1),hpixel(1),
++ windowdump(false),help(false),rapz(1),rapz0(-1.),withlight(false),
+ changearrow(true),changeiso(true), keepPV(false),init(false)
+ {
+
+@@ -1752,8 +1753,9 @@ void ThePlot::SetColorTable(int nb)
+
+ ThePlot::ThePlot(PlotStream & fin,ThePlot *old,int kcount)
+ : count(kcount), state(0),
+- changeViso(true),changeVarrow(true),changeColor(true),
+- changeBorder(true),changeFill(true), withiso(false),witharrow(false),
++ withiso(false),witharrow(false),
++ changeViso(true),changeVarrow(true),
++ changeColor(true),changeBorder(true),changeFill(true),
+ plotdim(2),theta(30.*M_PI/180.),phi(20.*M_PI/180.),dcoef(1),focal(20.*M_PI/180.),
+ datadim(1), winnum(0)
+
+diff --git a/src/femlib/FQuadTree.cpp b/src/femlib/FQuadTree.cpp
+index 787330b0..8da766e4 100644
+--- a/src/femlib/FQuadTree.cpp
++++ b/src/femlib/FQuadTree.cpp
+@@ -366,12 +366,12 @@ void FQuadTree::Add( Vertex & w)
+
+ FQuadTree::FQuadTree(Vertex * v,R2 Pmin,R2 Pmax,long nbv)
+ :
+- th(0),
+ lenStorageQuadTreeBox(Max(abs(nbv),1000L)),
+- NbQuadTreeBox(0),
+- NbVertices(0),
++ th(0),
+ NbQuadTreeBoxSearch(0),
+ NbVerticesSearch(0),
++ NbQuadTreeBox(0),
++ NbVertices(0),
+ cMin(Pmin-(Pmax-Pmin)/2),
+ cMax(Pmax+(Pmax-Pmin)/2),
+ coef( MaxISize/Norme_infty(cMax-cMin))
+diff --git a/src/femlib/MatriceCreuse.hpp b/src/femlib/MatriceCreuse.hpp
+index 3df9299e..80885c54 100644
+--- a/src/femlib/MatriceCreuse.hpp
++++ b/src/femlib/MatriceCreuse.hpp
+@@ -973,14 +973,14 @@ struct Data_Sparse_Solver {
+ :
+ initmat(1),
+ typemat(0),
++ epsilon(1e-6),
++ precon(0),
++ NbSpace(50),
+ strategy(0),
+ tgv(ff_tgv),
+ factorize(0),
+- epsilon(1e-6),
+- precon(0),
+ tol_pivot(-1),
+ tol_pivot_sym(-1),
+- NbSpace(50),
+ itmax(0),
+ // lparams(0,0),
+ // dparams(0,0),
+diff --git a/src/femlib/RNM.hpp b/src/femlib/RNM.hpp
+index 3f08d42a..256be320 100644
+--- a/src/femlib/RNM.hpp
++++ b/src/femlib/RNM.hpp
+@@ -372,8 +372,9 @@ template<class R> istream & operator>>(istream & f, KN<R> & v);
+
+ template<class R>
+ class SetArray { public:
+- R o,step;
++ R o;
+ long n;
++ R step;
+ explicit SetArray(long nn,R oo=R(),R sstep=R(1)): o(oo),n(nn),step(sstep) {}
+ template<class K> SetArray(SetArray<K> sa): o(sa.o),n(sa.n),step(sa.step) {}
+
+diff --git a/src/fflib/AFunction.hpp b/src/fflib/AFunction.hpp
+index 4f02ccb7..c81300f7 100644
+--- a/src/fflib/AFunction.hpp
++++ b/src/fflib/AFunction.hpp
+@@ -1685,7 +1685,7 @@ class E_BorderN :public E_F0mps { public:
+ }
+ E_BorderN(const E_Border * bb, C_F0 nn,const E_BorderN * nx=0) ;
+ E_BorderN(const E_BorderN & bb,const E_BorderN * nx)
+- : b(bb.b),n(bb.n),cas(bb.cas),next(nx)
++ : b(bb.b),cas(bb.cas),n(bb.n),next(nx)
+ {
+ int kk=1;
+ if(bb.next) {// modif FH. 13/02/2008
+diff --git a/src/fflib/AFunction2.cpp b/src/fflib/AFunction2.cpp
+index c9dc3340..4957297b 100644
+--- a/src/fflib/AFunction2.cpp
++++ b/src/fflib/AFunction2.cpp
+@@ -467,8 +467,8 @@ basicForEachType::basicForEachType(const type_info & k,
+ un_ptr_type(rr?rr:this),
+ casting(0), // no casting to
+ un_ptr(p),
+- InitExp(iv),
+ DoOnReturn(dreturn),
++ InitExp(iv),
+ //funct_type(0),
+ destroy(id) {}
+ void basicForEachType::SetArgs(const ListOfId *lid) const
+diff --git a/src/fflib/problem.cpp b/src/fflib/problem.cpp
+index 4202c87a..4222ad17 100644
+--- a/src/fflib/problem.cpp
++++ b/src/fflib/problem.cpp
+@@ -6350,11 +6350,11 @@ bool FieldOfForm( list<C_F0> & largs ,bool complextype) // true => complex prob
+
+
+ Problem::Problem(const C_args * ca,const ListOfId &l,size_t & top) :
++ dim(dimProblem(l)),
+ op(new C_args(*ca)),
+ var(l.size()),
+- VF(false),
+- offset(align8(top)),
+- dim(dimProblem(l))
++ VF(false),
++ offset(align8(top))
+ {
+ // cout << "Problem : -----------------------------" << top << " dim = " << dim<< endl;
+ top = offset + max(sizeof(Data<FESpace>),sizeof(Data<FESpace>));
+--
+2.19.2
+
diff --git a/0006-Unbundle-pstream.patch b/0006-Unbundle-pstream.patch
new file mode 100644
index 0000000..692c43d
--- /dev/null
+++ b/0006-Unbundle-pstream.patch
@@ -0,0 +1,2205 @@
+From a306423ef05b1b4e28f386d640c638a20dfd5c9e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
+Date: Wed, 24 May 2017 06:21:24 +0200
+Subject: [PATCH 6/9] Unbundle pstream
+
+---
+ examples++-load/Makefile.am | 2 +-
+ examples++-load/pipe.cpp | 2 +-
+ examples++-load/pstream.h | 2158 -----------------------------------
+ 3 files changed, 2 insertions(+), 2160 deletions(-)
+ delete mode 100644 examples++-load/pstream.h
+
+diff --git a/examples++-load/Makefile.am b/examples++-load/Makefile.am
+index bcb46310..8de25fc7 100644
+--- a/examples++-load/Makefile.am
++++ b/examples++-load/Makefile.am
+@@ -47,7 +47,7 @@ ff-get-dep.in ff-get-dep.awk ff-pkg-download.in load.link.in include.tar.gz \
+ MUMPS.cpp \
+ ff-Ipopt.cpp \
+ scotch.cpp shell.cpp \
+- pipe.cpp pstream.h \
++ pipe.cpp \
+ symmetrizeCSR.cpp \
+ dmatrix.hpp PARDISO.cpp \
+ ch.pts BEC.cpp bfstream.cpp iohdf5.cpp \
+diff --git a/examples++-load/pipe.cpp b/examples++-load/pipe.cpp
+index 47079dbe..790c2a79 100644
+--- a/examples++-load/pipe.cpp
++++ b/examples++-load/pipe.cpp
+@@ -48,7 +48,7 @@ long ffusleep (long s) {return usleep(s);}
+
+ // #if __clang_major__ > 4
+ #ifndef _WIN32
+-#include "pstream.h"
++#include <pstreams/pstream.h>
+
+ struct pstream {
+ redi::basic_pstream<char> *fb;
+diff --git a/examples++-load/pstream.h b/examples++-load/pstream.h
+deleted file mode 100644
+index 4ea67a79..00000000
+--- a/examples++-load/pstream.h
++++ /dev/null
+@@ -1,2158 +0,0 @@
+-/****************************************************************************/
+-/* This file is part of FreeFem++. */
+-/* */
+-/* FreeFem++ is free software: you can redistribute it and/or modify */
+-/* it under the terms of the GNU Lesser General Public License as */
+-/* published by the Free Software Foundation, either version 3 of */
+-/* the License, or (at your option) any later version. */
+-/* */
+-/* FreeFem++ is distributed in the hope that it will be useful, */
+-/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+-/* GNU Lesser General Public License for more details. */
+-/* */
+-/* You should have received a copy of the GNU Lesser General Public License */
+-/* along with FreeFem++. If not, see <http://www.gnu.org/licenses/>. */
+-/****************************************************************************/
+-// SUMMARY : ...
+-// LICENSE : LGPLv3
+-// ORG : LJLL Universite Pierre et Marie Curie, Paris, FRANCE
+-// AUTHORS : ...
+-// E-MAIL : ...
+-
+-/*
+- * PStreams - POSIX Process I/O for C++
+- * Copyright (C) 2001-2013 Jonathan Wakely
+- *
+- * This file is part of PStreams.
+- *
+- * PStreams is free software; you can redistribute it and/or modify
+- * it under the terms of the GNU Lesser General Public License as published by
+- * the Free Software Foundation; either version 3 of the License, or
+- * (at your option) any later version.
+- *
+- * PStreams is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU Lesser General Public License for more details.
+- *
+- * You should have received a copy of the GNU Lesser General Public License
+- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+- */
+-
+-/**
+- * @file pstream.h
+- * @brief Declares all PStreams classes.
+- * @author Jonathan Wakely
+- *
+- * Defines classes redi::ipstream, redi::opstream, redi::pstream
+- * and redi::rpstream.
+- */
+-
+-#ifndef REDI_PSTREAM_H_SEEN
+-#define REDI_PSTREAM_H_SEEN
+-
+-#include <ios>
+-#include <streambuf>
+-#include <istream>
+-#include <ostream>
+-#include <string>
+-#include <vector>
+-#include <algorithm>// for min()
+-#include <cerrno> // for errno
+-#include <cstddef> // for size_t, NULL
+-#include <cstdlib> // for exit()
+-#include <sys/types.h> // for pid_t
+-#include <sys/wait.h> // for waitpid()
+-#include <sys/ioctl.h> // for ioctl() and FIONREAD
+-#if defined (__sun)
+-# include <sys/filio.h> // for FIONREAD on Solaris 2.5
+-#endif
+-#include <unistd.h> // for pipe() fork() exec() and filedes functions
+-#include <signal.h> // for kill()
+-#include <fcntl.h> // for fcntl()
+-#if REDI_EVISCERATE_PSTREAMS
+-# include <stdio.h> // for FILE, fdopen()
+-#endif
+-
+-/// The library version.
+-#define PSTREAMS_VERSION 0x0080 // 0.8.0
+-
+-/**
+- * @namespace redi
+- * @brief All PStreams classes are declared in namespace redi.
+- *
+- * Like the standard iostreams, PStreams is a set of class templates,
+- * taking a character type and traits type. As with the standard streams
+- * they are most likely to be used with @c char and the default
+- * traits type, so typedefs for this most common case are provided.
+- *
+- * The @c pstream_common class template is not intended to be used directly,
+- * it is used internally to provide the common functionality for the
+- * other stream classes.
+- */
+-namespace redi
+-{
+- /// Common base class providing constants and typenames.
+- struct pstreams
+- {
+- /// Type used to specify how to connect to the process.
+- typedef std::ios_base::openmode pmode;
+-
+- /// Type used to hold the arguments for a command.
+- typedef std::vector<std::string> argv_type;
+-
+- /// Type used for file descriptors.
+- typedef int fd_type;
+-
+- static const pmode pstdin = std::ios_base::out; ///< Write to stdin
+- static const pmode pstdout = std::ios_base::in; ///< Read from stdout
+- static const pmode pstderr = std::ios_base::app;///< Read from stderr
+-
+- protected:
+- enum {bufsz = 32}; ///< Size of pstreambuf buffers.
+- enum {pbsz = 2}; ///< Number of putback characters kept.
+- };
+-
+- /// Class template for stream buffer.
+- template<typename CharT, typename Traits = std::char_traits<CharT> >
+- class basic_pstreambuf
+- : public std::basic_streambuf<CharT, Traits>
+- , public pstreams
+- {
+- public:
+- // Type definitions for dependent types
+- typedef CharT char_type;
+- typedef Traits traits_type;
+- typedef typename traits_type::int_type int_type;
+- typedef typename traits_type::off_type off_type;
+- typedef typename traits_type::pos_type pos_type;
+- /** @deprecated use pstreams::fd_type instead. */
+- typedef fd_type fd_t;
+-
+- /// Default constructor.
+- basic_pstreambuf ();
+-
+- /// Constructor that initialises the buffer with @a command.
+- basic_pstreambuf (const std::string &command, pmode mode);
+-
+- /// Constructor that initialises the buffer with @a file and @a argv.
+- basic_pstreambuf (const std::string &file,
+- const argv_type &argv,
+- pmode mode);
+-
+- /// Destructor.
+- ~basic_pstreambuf ();
+-
+- /// Initialise the stream buffer with @a command.
+- basic_pstreambuf *
+- open (const std::string &command, pmode mode);
+-
+- /// Initialise the stream buffer with @a file and @a argv.
+- basic_pstreambuf *
+- open (const std::string &file, const argv_type &argv, pmode mode);
+-
+- /// Close the stream buffer and wait for the process to exit.
+- basic_pstreambuf *
+- close ();
+-
+- /// Send a signal to the process.
+- basic_pstreambuf *
+- kill (int signal = SIGTERM);
+-
+- /// Send a signal to the process' process group.
+- basic_pstreambuf *
+- killpg (int signal = SIGTERM);
+-
+- /// Close the pipe connected to the process' stdin.
+- void
+- peof ();
+-
+- /// Change active input source.
+- bool
+- read_err (bool readerr = true);
+-
+- /// Report whether the stream buffer has been initialised.
+- bool
+- is_open () const;
+-
+- /// Report whether the process has exited.
+- bool
+- exited ();
+-
+-#if REDI_EVISCERATE_PSTREAMS
+- /// Obtain FILE pointers for each of the process' standard streams.
+- std::size_t
+- fopen(FILE * &in, FILE *&out, FILE *&err);
+-#endif
+-
+- /// Return the exit status of the process.
+- int
+- status () const;
+-
+- /// Return the error number (errno) for the most recent failed operation.
+- int
+- error () const;
+-
+- protected:
+- /// Transfer characters to the pipe when character buffer overflows.
+- int_type
+- overflow (int_type c);
+-
+- /// Transfer characters from the pipe when the character buffer is empty.
+- int_type
+- underflow ();
+-
+- /// Make a character available to be returned by the next extraction.
+- int_type
+- pbackfail (int_type c = traits_type::eof());
+-
+- /// Write any buffered characters to the stream.
+- int
+- sync ();
+-
+- /// Insert multiple characters into the pipe.
+- std::streamsize
+- xsputn (const char_type *s, std::streamsize n);
+-
+- /// Insert a sequence of characters into the pipe.
+- std::streamsize
+- write (const char_type *s, std::streamsize n);
+-
+- /// Extract a sequence of characters from the pipe.
+- std::streamsize
+- read (char_type *s, std::streamsize n);
+-
+- /// Report how many characters can be read from active input without blocking.
+- std::streamsize
+- showmanyc ();
+-
+- protected:
+- /// Enumerated type to indicate whether stdout or stderr is to be read.
+- enum buf_read_src {rsrc_out = 0, rsrc_err = 1};
+-
+- /// Initialise pipes and fork process.
+- pid_t
+- fork (pmode mode);
+-
+- /// Wait for the child process to exit.
+- int
+- wait (bool nohang = false);
+-
+- /// Return the file descriptor for the output pipe.
+- fd_type &
+- wpipe ();
+-
+- /// Return the file descriptor for the active input pipe.
+- fd_type &
+- rpipe ();
+-
+- /// Return the file descriptor for the specified input pipe.
+- fd_type &
+- rpipe (buf_read_src which);
+-
+- void
+- create_buffers (pmode mode);
+-
+- void
+- destroy_buffers (pmode mode);
+-
+- /// Writes buffered characters to the process' stdin pipe.
+- bool
+- empty_buffer ();
+-
+- bool
+- fill_buffer (bool non_blocking = false);
+-
+- /// Return the active input buffer.
+- char_type *
+- rbuffer ();
+- buf_read_src
+- switch_read_buffer(buf_read_src);
+-
+- private:
+- basic_pstreambuf (const basic_pstreambuf &);
+- basic_pstreambuf &operator = (const basic_pstreambuf &);
+-
+- void
+- init_rbuffers ();
+-
+- pid_t ppid_;// pid of process
+- fd_type wpipe_; // pipe used to write to process' stdin
+- fd_type rpipe_[2]; // two pipes to read from, stdout and stderr
+- char_type *wbuffer_;
+- char_type *rbuffer_[2];
+- char_type *rbufstate_[3];
+- /// Index into rpipe_[] to indicate active source for read operations.
+- buf_read_src rsrc_;
+- int status_;// hold exit status of child process
+- int error_; // hold errno if fork() or exec() fails
+- };
+-
+- /// Class template for common base class.
+- template<typename CharT, typename Traits = std::char_traits<CharT> >
+- class pstream_common
+- : virtual public std::basic_ios<CharT, Traits>
+- , virtual public pstreams
+- {
+- protected:
+- typedef basic_pstreambuf<CharT, Traits> streambuf_type;
+- typedef pstreams::pmode pmode;
+- typedef pstreams::argv_type argv_type;
+-
+- /// Default constructor.
+- pstream_common ();
+-
+- /// Constructor that initialises the stream by starting a process.
+- pstream_common (const std::string &command, pmode mode);
+-
+- /// Constructor that initialises the stream by starting a process.
+- pstream_common (const std::string &file, const argv_type &argv, pmode mode);
+-
+- /// Pure virtual destructor.
+- virtual
+- ~pstream_common () = 0;
+-
+- /// Start a process.
+- void
+- do_open (const std::string &command, pmode mode);
+-
+- /// Start a process.
+- void
+- do_open (const std::string &file, const argv_type &argv, pmode mode);
+-
+- public:
+- /// Close the pipe.
+- void
+- close ();
+-
+- /// Report whether the stream's buffer has been initialised.
+- bool
+- is_open () const;
+-
+- /// Return the command used to initialise the stream.
+- const std::string &
+- command () const;
+-
+- /// Return a pointer to the stream buffer.
+- streambuf_type *
+- rdbuf () const;
+-
+-#if REDI_EVISCERATE_PSTREAMS
+- /// Obtain FILE pointers for each of the process' standard streams.
+- std::size_t
+- fopen(FILE * &in, FILE *&out, FILE *&err);
+-#endif
+-
+- protected:
+- std::string command_; ///< The command used to start the process.
+- streambuf_type buf_;///< The stream buffer.
+- };
+-
+- /**
+- * @class basic_ipstream
+- * @brief Class template for Input PStreams.
+- *
+- * Reading from an ipstream reads the command's standard output and/or
+- * standard error (depending on how the ipstream is opened)
+- * and the command's standard input is the same as that of the process
+- * that created the object, unless altered by the command itself.
+- */
+-
+- template<typename CharT, typename Traits = std::char_traits<CharT> >
+- class basic_ipstream
+- : public std::basic_istream<CharT, Traits>
+- , public pstream_common<CharT, Traits>
+- , virtual public pstreams
+- {
+- typedef std::basic_istream<CharT, Traits> istream_type;
+- typedef pstream_common<CharT, Traits> pbase_type;
+-
+- using pbase_type::buf_; // declare name in this scope
+-
+- pmode readable (pmode mode) {
+- if (!(mode & (pstdout | pstderr))) {
+- mode |= pstdout;
+- }
+-
+- return mode;
+- }
+-
+- public:
+- /// Type used to specify how to connect to the process.
+- typedef typename pbase_type::pmode pmode;
+-
+- /// Type used to hold the arguments for a command.
+- typedef typename pbase_type::argv_type argv_type;
+-
+- /// Default constructor, creates an uninitialised stream.
+- basic_ipstream ()
+- : istream_type(NULL), pbase_type()
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling do_open() with the supplied
+- * arguments.
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, pmode)
+- */
+- basic_ipstream (const std::string &command, pmode mode = pstdout)
+- : istream_type(NULL), pbase_type(command, readable(mode))
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling do_open() with the supplied
+- * arguments.
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- basic_ipstream (const std::string &file,
+- const argv_type &argv,
+- pmode mode = pstdout)
+- : istream_type(NULL), pbase_type(file, argv, readable(mode))
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling
+- * @c do_open(argv[0],argv,mode|pstdout)
+- *
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- basic_ipstream (const argv_type &argv, pmode mode = pstdout)
+- : istream_type(NULL), pbase_type(argv.at(0), argv, mode | pstdout)
+- {}
+-
+- /**
+- * @brief Destructor.
+- *
+- * Closes the stream and waits for the child to exit.
+- */
+- ~basic_ipstream ()
+- {}
+-
+- /**
+- * @brief Start a process.
+- *
+- * Calls do_open( @a %command , @a mode|pstdout ).
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, pmode)
+- */
+- void
+- open (const std::string &command, pmode mode = pstdout) {
+- this->do_open(command, readable(mode));
+- }
+-
+- /**
+- * @brief Start a process.
+- *
+- * Calls do_open( @a file , @a argv , @a mode|pstdout ).
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- void
+- open (const std::string &file,
+- const argv_type &argv,
+- pmode mode = pstdout) {
+- this->do_open(file, argv, readable(mode));
+- }
+-
+- /**
+- * @brief Set streambuf to read from process' @c stdout.
+- * @return @c *this
+- */
+- basic_ipstream &
+- out () {
+- this->buf_.read_err(false);
+- return *this;
+- }
+-
+- /**
+- * @brief Set streambuf to read from process' @c stderr.
+- * @return @c *this
+- */
+- basic_ipstream &
+- err () {
+- this->buf_.read_err(true);
+- return *this;
+- }
+- };
+-
+- /**
+- * @class basic_opstream
+- * @brief Class template for Output PStreams.
+- *
+- * Writing to an open opstream writes to the standard input of the command;
+- * the command's standard output is the same as that of the process that
+- * created the pstream object, unless altered by the command itself.
+- */
+-
+- template<typename CharT, typename Traits = std::char_traits<CharT> >
+- class basic_opstream
+- : public std::basic_ostream<CharT, Traits>
+- , public pstream_common<CharT, Traits>
+- , virtual public pstreams
+- {
+- typedef std::basic_ostream<CharT, Traits> ostream_type;
+- typedef pstream_common<CharT, Traits> pbase_type;
+-
+- using pbase_type::buf_; // declare name in this scope
+-
+- public:
+- /// Type used to specify how to connect to the process.
+- typedef typename pbase_type::pmode pmode;
+-
+- /// Type used to hold the arguments for a command.
+- typedef typename pbase_type::argv_type argv_type;
+-
+- /// Default constructor, creates an uninitialised stream.
+- basic_opstream ()
+- : ostream_type(NULL), pbase_type()
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling do_open() with the supplied
+- * arguments.
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, pmode)
+- */
+- basic_opstream (const std::string &command, pmode mode = pstdin)
+- : ostream_type(NULL), pbase_type(command, mode | pstdin)
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling do_open() with the supplied
+- * arguments.
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- basic_opstream (const std::string &file,
+- const argv_type &argv,
+- pmode mode = pstdin)
+- : ostream_type(NULL), pbase_type(file, argv, mode | pstdin)
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling
+- * @c do_open(argv[0],argv,mode|pstdin)
+- *
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- basic_opstream (const argv_type &argv, pmode mode = pstdin)
+- : ostream_type(NULL), pbase_type(argv.at(0), argv, mode | pstdin)
+- {}
+-
+- /**
+- * @brief Destructor
+- *
+- * Closes the stream and waits for the child to exit.
+- */
+- ~basic_opstream () {}
+-
+- /**
+- * @brief Start a process.
+- *
+- * Calls do_open( @a %command , @a mode|pstdin ).
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, pmode)
+- */
+- void
+- open (const std::string &command, pmode mode = pstdin) {
+- this->do_open(command, mode | pstdin);
+- }
+-
+- /**
+- * @brief Start a process.
+- *
+- * Calls do_open( @a file , @a argv , @a mode|pstdin ).
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- void
+- open (const std::string &file,
+- const argv_type &argv,
+- pmode mode = pstdin) {
+- this->do_open(file, argv, mode | pstdin);
+- }
+- };
+-
+- /**
+- * @class basic_pstream
+- * @brief Class template for Bidirectional PStreams.
+- *
+- * Writing to a pstream opened with @c pmode @c pstdin writes to the
+- * standard input of the command.
+- * Reading from a pstream opened with @c pmode @c pstdout and/or @c pstderr
+- * reads the command's standard output and/or standard error.
+- * Any of the process' @c stdin, @c stdout or @c stderr that is not
+- * connected to the pstream (as specified by the @c pmode)
+- * will be the same as the process that created the pstream object,
+- * unless altered by the command itself.
+- */
+- template<typename CharT, typename Traits = std::char_traits<CharT> >
+- class basic_pstream
+- : public std::basic_iostream<CharT, Traits>
+- , public pstream_common<CharT, Traits>
+- , virtual public pstreams
+- {
+- typedef std::basic_iostream<CharT, Traits> iostream_type;
+- typedef pstream_common<CharT, Traits> pbase_type;
+-
+- using pbase_type::buf_; // declare name in this scope
+-
+- public:
+- /// Type used to specify how to connect to the process.
+- typedef typename pbase_type::pmode pmode;
+-
+- /// Type used to hold the arguments for a command.
+- typedef typename pbase_type::argv_type argv_type;
+-
+- /// Default constructor, creates an uninitialised stream.
+- basic_pstream ()
+- : iostream_type(NULL), pbase_type()
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling do_open() with the supplied
+- * arguments.
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, pmode)
+- */
+- basic_pstream (const std::string &command, pmode mode = pstdout | pstdin)
+- : iostream_type(NULL), pbase_type(command, mode)
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling do_open() with the supplied
+- * arguments.
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- basic_pstream (const std::string &file,
+- const argv_type &argv,
+- pmode mode = pstdout | pstdin)
+- : iostream_type(NULL), pbase_type(file, argv, mode)
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling
+- * @c do_open(argv[0],argv,mode)
+- *
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- basic_pstream (const argv_type &argv, pmode mode = pstdout | pstdin)
+- : iostream_type(NULL), pbase_type(argv.at(0), argv, mode)
+- {}
+-
+- /**
+- * @brief Destructor
+- *
+- * Closes the stream and waits for the child to exit.
+- */
+- ~basic_pstream () {}
+-
+- /**
+- * @brief Start a process.
+- *
+- * Calls do_open( @a %command , @a mode ).
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, pmode)
+- */
+- void
+- open (const std::string &command, pmode mode = pstdout | pstdin) {
+- this->do_open(command, mode);
+- }
+-
+- /**
+- * @brief Start a process.
+- *
+- * Calls do_open( @a file , @a argv , @a mode ).
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- void
+- open (const std::string &file,
+- const argv_type &argv,
+- pmode mode = pstdout | pstdin) {
+- this->do_open(file, argv, mode);
+- }
+-
+- /**
+- * @brief Set streambuf to read from process' @c stdout.
+- * @return @c *this
+- */
+- basic_pstream &
+- out () {
+- this->buf_.read_err(false);
+- return *this;
+- }
+-
+- /**
+- * @brief Set streambuf to read from process' @c stderr.
+- * @return @c *this
+- */
+- basic_pstream &
+- err () {
+- this->buf_.read_err(true);
+- return *this;
+- }
+- };
+-
+- /**
+- * @class basic_rpstream
+- * @brief Class template for Restricted PStreams.
+- *
+- * Writing to an rpstream opened with @c pmode @c pstdin writes to the
+- * standard input of the command.
+- * It is not possible to read directly from an rpstream object, to use
+- * an rpstream as in istream you must call either basic_rpstream::out()
+- * or basic_rpstream::err(). This is to prevent accidental reads from
+- * the wrong input source. If the rpstream was not opened with @c pmode
+- * @c pstderr then the class cannot read the process' @c stderr, and
+- * basic_rpstream::err() will return an istream that reads from the
+- * process' @c stdout, and vice versa.
+- * Reading from an rpstream opened with @c pmode @c pstdout and/or
+- * @c pstderr reads the command's standard output and/or standard error.
+- * Any of the process' @c stdin, @c stdout or @c stderr that is not
+- * connected to the pstream (as specified by the @c pmode)
+- * will be the same as the process that created the pstream object,
+- * unless altered by the command itself.
+- */
+-
+- template<typename CharT, typename Traits = std::char_traits<CharT> >
+- class basic_rpstream
+- : public std::basic_ostream<CharT, Traits>
+- , private std::basic_istream<CharT, Traits>
+- , private pstream_common<CharT, Traits>
+- , virtual public pstreams
+- {
+- typedef std::basic_ostream<CharT, Traits> ostream_type;
+- typedef std::basic_istream<CharT, Traits> istream_type;
+- typedef pstream_common<CharT, Traits> pbase_type;
+-
+- using pbase_type::buf_; // declare name in this scope
+-
+- public:
+- /// Type used to specify how to connect to the process.
+- typedef typename pbase_type::pmode pmode;
+-
+- /// Type used to hold the arguments for a command.
+- typedef typename pbase_type::argv_type argv_type;
+-
+- /// Default constructor, creates an uninitialised stream.
+- basic_rpstream ()
+- : ostream_type(NULL), istream_type(NULL), pbase_type()
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling do_open() with the supplied
+- * arguments.
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, pmode)
+- */
+- basic_rpstream (const std::string &command, pmode mode = pstdout | pstdin)
+- : ostream_type(NULL), istream_type(NULL), pbase_type(command, mode)
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling do_open() with the supplied
+- * arguments.
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- basic_rpstream (const std::string &file,
+- const argv_type &argv,
+- pmode mode = pstdout | pstdin)
+- : ostream_type(NULL), istream_type(NULL), pbase_type(file, argv, mode)
+- {}
+-
+- /**
+- * @brief Constructor that initialises the stream by starting a process.
+- *
+- * Initialises the stream buffer by calling
+- * @c do_open(argv[0],argv,mode)
+- *
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- basic_rpstream (const argv_type &argv, pmode mode = pstdout | pstdin)
+- : ostream_type(NULL), istream_type(NULL),
+- pbase_type(argv.at(0), argv, mode)
+- {}
+-
+- /// Destructor
+- ~basic_rpstream () {}
+-
+- /**
+- * @brief Start a process.
+- *
+- * Calls do_open( @a %command , @a mode ).
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, pmode)
+- */
+- void
+- open (const std::string &command, pmode mode = pstdout | pstdin) {
+- this->do_open(command, mode);
+- }
+-
+- /**
+- * @brief Start a process.
+- *
+- * Calls do_open( @a file , @a argv , @a mode ).
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- void
+- open (const std::string &file,
+- const argv_type &argv,
+- pmode mode = pstdout | pstdin) {
+- this->do_open(file, argv, mode);
+- }
+-
+- /**
+- * @brief Obtain a reference to the istream that reads
+- * the process' @c stdout.
+- * @return @c *this
+- */
+- istream_type &
+- out () {
+- this->buf_.read_err(false);
+- return *this;
+- }
+-
+- /**
+- * @brief Obtain a reference to the istream that reads
+- * the process' @c stderr.
+- * @return @c *this
+- */
+- istream_type &
+- err () {
+- this->buf_.read_err(true);
+- return *this;
+- }
+- };
+-
+- /// Type definition for common template specialisation.
+- typedef basic_pstreambuf<char> pstreambuf;
+- /// Type definition for common template specialisation.
+- typedef basic_ipstream<char> ipstream;
+- /// Type definition for common template specialisation.
+- typedef basic_opstream<char> opstream;
+- /// Type definition for common template specialisation.
+- typedef basic_pstream<char> pstream;
+- /// Type definition for common template specialisation.
+- typedef basic_rpstream<char> rpstream;
+-
+- /**
+- * When inserted into an output pstream the manipulator calls
+- * basic_pstreambuf<C,T>::peof() to close the output pipe,
+- * causing the child process to receive the end-of-file indicator
+- * on subsequent reads from its @c stdin stream.
+- *
+- * @brief Manipulator to close the pipe connected to the process' stdin.
+- * @param s An output PStream class.
+- * @return The stream object the manipulator was invoked on.
+- * @see basic_pstreambuf<C,T>::peof()
+- * @relates basic_opstream basic_pstream basic_rpstream
+- */
+- template<typename C, typename T>
+- inline std::basic_ostream<C, T> &
+- peof (std::basic_ostream<C, T> &s) {
+- typedef basic_pstreambuf<C, T> pstreambuf;
+- if (pstreambuf *p = dynamic_cast<pstreambuf *>(s.rdbuf())) {
+- p->peof();
+- }
+-
+- return s;
+- }
+-
+- /*
+- * member definitions for pstreambuf
+- */
+-
+- /**
+- * @class basic_pstreambuf
+- * Provides underlying streambuf functionality for the PStreams classes.
+- */
+-
+- /** Creates an uninitialised stream buffer. */
+- template<typename C, typename T>
+- inline
+- basic_pstreambuf<C, T>::basic_pstreambuf ()
+- : ppid_(-1) // initialise to -1 to indicate no process run yet.
+- , wpipe_(-1)
+- , wbuffer_(NULL)
+- , rsrc_(rsrc_out)
+- , status_(-1)
+- , error_(0) {
+- init_rbuffers();
+- }
+-
+- /**
+- * Initialises the stream buffer by calling open() with the supplied
+- * arguments.
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see open()
+- */
+- template<typename C, typename T>
+- inline
+- basic_pstreambuf<C, T>::basic_pstreambuf (const std::string &command, pmode mode)
+- : ppid_(-1) // initialise to -1 to indicate no process run yet.
+- , wpipe_(-1)
+- , wbuffer_(NULL)
+- , rsrc_(rsrc_out)
+- , status_(-1)
+- , error_(0) {
+- init_rbuffers();
+- open(command, mode);
+- }
+-
+- /**
+- * Initialises the stream buffer by calling open() with the supplied
+- * arguments.
+- *
+- * @param file a string containing the name of a program to execute.
+- * @param argv a vector of argument strings passsed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see open()
+- */
+- template<typename C, typename T>
+- inline
+- basic_pstreambuf<C, T>::basic_pstreambuf (const std::string &file,
+- const argv_type &argv,
+- pmode mode)
+- : ppid_(-1) // initialise to -1 to indicate no process run yet.
+- , wpipe_(-1)
+- , wbuffer_(NULL)
+- , rsrc_(rsrc_out)
+- , status_(-1)
+- , error_(0) {
+- init_rbuffers();
+- open(file, argv, mode);
+- }
+-
+- /**
+- * Closes the stream by calling close().
+- * @see close()
+- */
+- template<typename C, typename T>
+- inline
+- basic_pstreambuf<C, T>::~basic_pstreambuf () {
+- close();
+- }
+-
+- /**
+- * Starts a new process by passing @a command to the shell (/bin/sh)
+- * and opens pipes to the process with the specified @a mode.
+- *
+- * If @a mode contains @c pstdout the initial read source will be
+- * the child process' stdout, otherwise if @a mode contains @c pstderr
+- * the initial read source will be the child's stderr.
+- *
+- * Will duplicate the actions of the shell in searching for an
+- * executable file if the specified file name does not contain a slash (/)
+- * character.
+- *
+- * @warning
+- * There is no way to tell whether the shell command succeeded, this
+- * function will always succeed unless resource limits (such as
+- * memory usage, or number of processes or open files) are exceeded.
+- * This means is_open() will return true even if @a command cannot
+- * be executed.
+- * Use pstreambuf::open(const std::string&, const argv_type&, pmode)
+- * if you need to know whether the command failed to execute.
+- *
+- * @param command a string containing a shell command.
+- * @param mode a bitwise OR of one or more of @c out, @c in, @c err.
+- * @return NULL if the shell could not be started or the
+- * pipes could not be opened, @c this otherwise.
+- * @see <b>execl</b>(3)
+- */
+- template<typename C, typename T>
+- basic_pstreambuf<C, T> *
+- basic_pstreambuf<C, T>::open (const std::string &command, pmode mode) {
+- const char *shell_path = "/bin/sh";
+-
+-#if 0
+- const std::string argv [] = {"sh", "-c", command};
+- return this->open(shell_path, argv_type(argv, argv + 3), mode);
+-#else
+- basic_pstreambuf<C, T> *ret = NULL;
+-
+- if (!is_open()) {
+- switch (fork(mode)) {
+- case 0:
+- // this is the new process, exec command
+- ::execl(shell_path, "sh", "-c", command.c_str(), (char *)NULL);
+-
+- // can only reach this point if exec() failed
+-
+- // parent can get exit code from waitpid()
+- ::_exit(errno);
+- // using std::exit() would make static dtors run twice
+-
+- case -1:
+- // couldn't fork, error already handled in pstreambuf::fork()
+- break;
+-
+- default:
+- // this is the parent process
+- // activate buffers
+- create_buffers(mode);
+- ret = this;
+- }
+- }
+-
+- return ret;
+-#endif
+- }
+-
+- /**
+- * @brief Helper function to close a file descriptor.
+- *
+- * Inspects @a fd and calls <b>close</b>(3) if it has a non-negative value.
+- *
+- * @param fd a file descriptor.
+- * @relates basic_pstreambuf
+- */
+- inline void
+- close_fd (pstreams::fd_type &fd) {
+- if (fd >= 0 && ::close(fd) == 0) {
+- fd = -1;
+- }
+- }
+-
+- /**
+- * @brief Helper function to close an array of file descriptors.
+- *
+- * Calls @c close_fd() on each member of the array.
+- * The length of the array is determined automatically by
+- * template argument deduction to avoid errors.
+- *
+- * @param fds an array of file descriptors.
+- * @relates basic_pstreambuf
+- */
+- template<int N>
+- inline void
+- close_fd_array (pstreams::fd_type(&fds)[N]) {
+- for (std::size_t i = 0; i < N; ++i) {
+- close_fd(fds[i]);
+- }
+- }
+-
+- /**
+- * Starts a new process by executing @a file with the arguments in
+- * @a argv and opens pipes to the process with the specified @a mode.
+- *
+- * By convention @c argv[0] should be the file name of the file being
+- * executed.
+- *
+- * If @a mode contains @c pstdout the initial read source will be
+- * the child process' stdout, otherwise if @a mode contains @c pstderr
+- * the initial read source will be the child's stderr.
+- *
+- * Will duplicate the actions of the shell in searching for an
+- * executable file if the specified file name does not contain a slash (/)
+- * character.
+- *
+- * Iff @a file is successfully executed then is_open() will return true.
+- * Otherwise, pstreambuf::error() can be used to obtain the value of
+- * @c errno that was set by <b>execvp</b>(3) in the child process.
+- *
+- * The exit status of the new process will be returned by
+- * pstreambuf::status() after pstreambuf::exited() returns true.
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode a bitwise OR of one or more of @c out, @c in and @c err.
+- * @return NULL if a pipe could not be opened or if the program could
+- * not be executed, @c this otherwise.
+- * @see <b>execvp</b>(3)
+- */
+- template<typename C, typename T>
+- basic_pstreambuf<C, T> *
+- basic_pstreambuf<C, T>::open (const std::string &file,
+- const argv_type &argv,
+- pmode mode) {
+- basic_pstreambuf<C, T> *ret = NULL;
+-
+- if (!is_open()) {
+- // constants for read/write ends of pipe
+- enum {RD, WR};
+-
+- // open another pipe and set close-on-exec
+- fd_type ck_exec [] = {-1, -1};
+- if (-1 == ::pipe(ck_exec)
+- || -1 == ::fcntl(ck_exec[RD], F_SETFD, FD_CLOEXEC)
+- || -1 == ::fcntl(ck_exec[WR], F_SETFD, FD_CLOEXEC)) {
+- error_ = errno;
+- close_fd_array(ck_exec);
+- } else {
+- switch (fork(mode)) {
+- case 0:
+- // this is the new process, exec command
+- {
+- char **arg_v = new char *[argv.size() + 1];
+-
+- for (std::size_t i = 0; i < argv.size(); ++i) {
+- const std::string &src = argv[i];
+- char * &dest = arg_v[i];
+- dest = new char[src.size() + 1];
+- dest[src.copy(dest, src.size())] = '\0';
+- }
+-
+- arg_v[argv.size()] = NULL;
+-
+- ::execvp(file.c_str(), arg_v);
+-
+- // can only reach this point if exec() failed
+-
+- // parent can get error code from ck_exec pipe
+- error_ = errno;
+-
+- while (::write(ck_exec[WR], &error_, sizeof(error_)) == -1
+- && errno == EINTR)
+- {}
+-
+- ::close(ck_exec[WR]);
+- ::close(ck_exec[RD]);
+-
+- ::_exit(error_);
+- // using std::exit() would make static dtors run twice
+- }
+-
+- case -1:
+- // couldn't fork, error already handled in pstreambuf::fork()
+- close_fd_array(ck_exec);
+- break;
+-
+- default:
+- // this is the parent process
+-
+- // check child called exec() successfully
+- ::close(ck_exec[WR]);
+-
+- switch (::read(ck_exec[RD], &error_, sizeof(error_))) {
+- case 0:
+- // activate buffers
+- create_buffers(mode);
+- ret = this;
+- break;
+- case -1:
+- error_ = errno;
+- break;
+- default:
+- // error_ contains error code from child
+- // call wait() to clean up and set ppid_ to 0
+- this->wait();
+- break;
+- }
+-
+- ::close(ck_exec[RD]);
+- }
+- }
+- }
+-
+- return ret;
+- }
+-
+- /**
+- * Creates pipes as specified by @a mode and calls @c fork() to create
+- * a new process. If the fork is successful the parent process stores
+- * the child's PID and the opened pipes and the child process replaces
+- * its standard streams with the opened pipes.
+- *
+- * If an error occurs the error code will be set to one of the possible
+- * errors for @c pipe() or @c fork().
+- * See your system's documentation for these error codes.
+- *
+- * @param mode an OR of pmodes specifying which of the child's
+- * standard streams to connect to.
+- * @return On success the PID of the child is returned in the parent's
+- * context and zero is returned in the child's context.
+- * On error -1 is returned and the error code is set appropriately.
+- */
+- template<typename C, typename T>
+- pid_t
+- basic_pstreambuf<C, T>::fork (pmode mode) {
+- pid_t pid = -1;
+-
+- // Three pairs of file descriptors, for pipes connected to the
+- // process' stdin, stdout and stderr
+- // (stored in a single array so close_fd_array() can close all at once)
+- fd_type fd [] = {-1, -1, -1, -1, -1, -1};
+- fd_type *const pin = fd;
+- fd_type *const pout = fd + 2;
+- fd_type *const perr = fd + 4;
+-
+- // constants for read/write ends of pipe
+- enum {RD, WR};
+-
+- // N.B.
+- // For the pstreambuf pin is an output stream and
+- // pout and perr are input streams.
+-
+- if (!error_ && mode & pstdin && ::pipe(pin)) {
+- error_ = errno;
+- }
+-
+- if (!error_ && mode & pstdout && ::pipe(pout)) {
+- error_ = errno;
+- }
+-
+- if (!error_ && mode & pstderr && ::pipe(perr)) {
+- error_ = errno;
+- }
+-
+- if (!error_) {
+- pid = ::fork();
+-
+- switch (pid) {
+- case 0:
+- {
+- // this is the new process
+-
+- // for each open pipe close one end and redirect the
+- // respective standard stream to the other end
+-
+- if (*pin >= 0) {
+- ::close(pin[WR]);
+- ::dup2(pin[RD], STDIN_FILENO);
+- ::close(pin[RD]);
+- }
+-
+- if (*pout >= 0) {
+- ::close(pout[RD]);
+- ::dup2(pout[WR], STDOUT_FILENO);
+- ::close(pout[WR]);
+- }
+-
+- if (*perr >= 0) {
+- ::close(perr[RD]);
+- ::dup2(perr[WR], STDERR_FILENO);
+- ::close(perr[WR]);
+- }
+-
+-#ifdef _POSIX_JOB_CONTROL
+- // Change to a new process group
+- ::setpgid(0, 0);
+-#endif
+-
+- break;
+- }
+- case -1:
+- {
+- // couldn't fork for some reason
+- error_ = errno;
+- // close any open pipes
+- close_fd_array(fd);
+- break;
+- }
+- default:
+- {
+- // this is the parent process, store process' pid
+- ppid_ = pid;
+-
+- // store one end of open pipes and close other end
+- if (*pin >= 0) {
+- wpipe_ = pin[WR];
+- ::close(pin[RD]);
+- }
+-
+- if (*pout >= 0) {
+- rpipe_[rsrc_out] = pout[RD];
+- ::close(pout[WR]);
+- }
+-
+- if (*perr >= 0) {
+- rpipe_[rsrc_err] = perr[RD];
+- ::close(perr[WR]);
+- }
+- }
+- }
+- } else {
+- // close any pipes we opened before failure
+- close_fd_array(fd);
+- }
+-
+- return pid;
+- }
+-
+- /**
+- * Closes all pipes and calls wait() to wait for the process to finish.
+- * If an error occurs the error code will be set to one of the possible
+- * errors for @c waitpid().
+- * See your system's documentation for these errors.
+- *
+- * @return @c this on successful close or @c NULL if there is no
+- * process to close or if an error occurs.
+- */
+- template<typename C, typename T>
+- basic_pstreambuf<C, T> *
+- basic_pstreambuf<C, T>::close () {
+- const bool running = is_open();
+-
+- sync(); // this might call wait() and reap the child process
+-
+- // rather than trying to work out whether or not we need to clean up
+- // just do it anyway, all cleanup functions are safe to call twice.
+-
+- destroy_buffers(pstdin | pstdout | pstderr);
+-
+- // close pipes before wait() so child gets EOF/SIGPIPE
+- close_fd(wpipe_);
+- close_fd_array(rpipe_);
+-
+- do {
+- error_ = 0;
+- } while (wait() == -1 && error() == EINTR);
+-
+- return running ? this : NULL;
+- }
+-
+- /**
+- * Called on construction to initialise the arrays used for reading.
+- */
+- template<typename C, typename T>
+- inline void
+- basic_pstreambuf<C, T>::init_rbuffers () {
+- rpipe_[rsrc_out] = rpipe_[rsrc_err] = -1;
+- rbuffer_[rsrc_out] = rbuffer_[rsrc_err] = NULL;
+- rbufstate_[0] = rbufstate_[1] = rbufstate_[2] = NULL;
+- }
+-
+- template<typename C, typename T>
+- void
+- basic_pstreambuf<C, T>::create_buffers (pmode mode) {
+- if (mode & pstdin) {
+- delete [] wbuffer_;
+- wbuffer_ = new char_type[bufsz];
+- this->setp(wbuffer_, wbuffer_ + bufsz);
+- }
+-
+- if (mode & pstdout) {
+- delete [] rbuffer_[rsrc_out];
+- rbuffer_[rsrc_out] = new char_type[bufsz];
+- rsrc_ = rsrc_out;
+- this->setg(rbuffer_[rsrc_out] + pbsz, rbuffer_[rsrc_out] + pbsz,
+- rbuffer_[rsrc_out] + pbsz);
+- }
+-
+- if (mode & pstderr) {
+- delete [] rbuffer_[rsrc_err];
+- rbuffer_[rsrc_err] = new char_type[bufsz];
+- if (!(mode & pstdout)) {
+- rsrc_ = rsrc_err;
+- this->setg(rbuffer_[rsrc_err] + pbsz, rbuffer_[rsrc_err] + pbsz,
+- rbuffer_[rsrc_err] + pbsz);
+- }
+- }
+- }
+-
+- template<typename C, typename T>
+- void
+- basic_pstreambuf<C, T>::destroy_buffers (pmode mode) {
+- if (mode & pstdin) {
+- this->setp(NULL, NULL);
+- delete [] wbuffer_;
+- wbuffer_ = NULL;
+- }
+-
+- if (mode & pstdout) {
+- if (rsrc_ == rsrc_out) {
+- this->setg(NULL, NULL, NULL);
+- }
+-
+- delete [] rbuffer_[rsrc_out];
+- rbuffer_[rsrc_out] = NULL;
+- }
+-
+- if (mode & pstderr) {
+- if (rsrc_ == rsrc_err) {
+- this->setg(NULL, NULL, NULL);
+- }
+-
+- delete [] rbuffer_[rsrc_err];
+- rbuffer_[rsrc_err] = NULL;
+- }
+- }
+-
+- template<typename C, typename T>
+- typename basic_pstreambuf<C, T>::buf_read_src
+- basic_pstreambuf<C, T>::switch_read_buffer (buf_read_src src) {
+- if (rsrc_ != src) {
+- char_type *tmpbufstate [] = {this->eback(), this->gptr(), this->egptr()};
+- this->setg(rbufstate_[0], rbufstate_[1], rbufstate_[2]);
+-
+- for (std::size_t i = 0; i < 3; ++i) {
+- rbufstate_[i] = tmpbufstate[i];
+- }
+-
+- rsrc_ = src;
+- }
+-
+- return rsrc_;
+- }
+-
+- /**
+- * Suspends execution and waits for the associated process to exit, or
+- * until a signal is delivered whose action is to terminate the current
+- * process or to call a signal handling function. If the process has
+- * already exited (i.e. it is a "zombie" process) then wait() returns
+- * immediately. Waiting for the child process causes all its system
+- * resources to be freed.
+- *
+- * error() will return EINTR if wait() is interrupted by a signal.
+- *
+- * @param nohang true to return immediately if the process has not exited.
+- * @return 1 if the process has exited and wait() has not yet been called.
+- * 0 if @a nohang is true and the process has not exited yet.
+- * -1 if no process has been started or if an error occurs,
+- * in which case the error can be found using error().
+- */
+- template<typename C, typename T>
+- int
+- basic_pstreambuf<C, T>::wait (bool nohang) {
+- int exited = -1;
+-
+- if (is_open()) {
+- int status;
+-
+- switch (::waitpid(ppid_, &status, nohang ? WNOHANG : 0)) {
+- case 0:
+- // nohang was true and process has not exited
+- exited = 0;
+- break;
+- case -1:
+- error_ = errno;
+- break;
+- default:
+- // process has exited
+- ppid_ = 0;
+- status_ = status;
+- exited = 1;
+- // Close wpipe, would get SIGPIPE if we used it.
+- destroy_buffers(pstdin);
+- close_fd(wpipe_);
+- // Must free read buffers and pipes on destruction
+- // or next call to open()/close()
+- break;
+- }
+- }
+-
+- return exited;
+- }
+-
+- /**
+- * Sends the specified signal to the process. A signal can be used to
+- * terminate a child process that would not exit otherwise.
+- *
+- * If an error occurs the error code will be set to one of the possible
+- * errors for @c kill(). See your system's documentation for these errors.
+- *
+- * @param signal A signal to send to the child process.
+- * @return @c this or @c NULL if @c kill() fails.
+- */
+- template<typename C, typename T>
+- inline basic_pstreambuf<C, T> *
+- basic_pstreambuf<C, T>::kill (int signal) {
+- basic_pstreambuf<C, T> *ret = NULL;
+- if (is_open()) {
+- if (::kill(ppid_, signal)) {
+- error_ = errno;
+- } else {
+-#if 0
+- // TODO call exited() to check for exit and clean up? leave to user?
+- if (signal == SIGTERM || signal == SIGKILL) {
+- this->exited();
+- }
+-
+-#endif
+- ret = this;
+- }
+- }
+-
+- return ret;
+- }
+-
+- /**
+- * Sends the specified signal to the process group of the child process.
+- * A signal can be used to terminate a child process that would not exit
+- * otherwise, or to kill the process and its own children.
+- *
+- * If an error occurs the error code will be set to one of the possible
+- * errors for @c getpgid() or @c kill(). See your system's documentation
+- * for these errors. If the child is in the current process group then
+- * NULL will be returned and the error code set to EPERM.
+- *
+- * @param signal A signal to send to the child process.
+- * @return @c this on success or @c NULL on failure.
+- */
+- template<typename C, typename T>
+- inline basic_pstreambuf<C, T> *
+- basic_pstreambuf<C, T>::killpg (int signal) {
+- basic_pstreambuf<C, T> *ret = NULL;
+-#ifdef _POSIX_JOB_CONTROL
+- if (is_open()) {
+- pid_t pgid = ::getpgid(ppid_);
+- if (pgid == -1) {
+- error_ = errno;
+- } else if (pgid == ::getpgrp()) {
+- error_ = EPERM; // Don't commit suicide
+- } else if (::killpg(pgid, signal)) {
+- error_ = errno;
+- } else {
+- ret = this;
+- }
+- }
+-
+-#endif
+- return ret;
+- }
+-
+- /**
+- * This function can call pstreambuf::wait() and so may change the
+- * object's state if the child process has already exited.
+- *
+- * @return True if the associated process has exited, false otherwise.
+- * @see basic_pstreambuf<C,T>::wait()
+- */
+- template<typename C, typename T>
+- inline bool
+- basic_pstreambuf<C, T>::exited () {
+- return ppid_ == 0 || wait(true) == 1;
+- }
+-
+- /**
+- * @return The exit status of the child process, or -1 if wait()
+- * has not yet been called to wait for the child to exit.
+- * @see basic_pstreambuf<C,T>::wait()
+- */
+- template<typename C, typename T>
+- inline int
+- basic_pstreambuf<C, T>::status () const {
+- return status_;
+- }
+-
+- /**
+- * @return The error code of the most recently failed operation, or zero.
+- */
+- template<typename C, typename T>
+- inline int
+- basic_pstreambuf<C, T>::error () const {
+- return error_;
+- }
+-
+- /**
+- * Closes the output pipe, causing the child process to receive the
+- * end-of-file indicator on subsequent reads from its @c stdin stream.
+- */
+- template<typename C, typename T>
+- inline void
+- basic_pstreambuf<C, T>::peof () {
+- sync();
+- destroy_buffers(pstdin);
+- close_fd(wpipe_);
+- }
+-
+- /**
+- * Unlike pstreambuf::exited(), this function will not call wait() and
+- * so will not change the object's state. This means that once a child
+- * process is executed successfully this function will continue to
+- * return true even after the process exits (until wait() is called.)
+- *
+- * @return true if a previous call to open() succeeded and wait() has
+- * not been called and determined that the process has exited,
+- * false otherwise.
+- */
+- template<typename C, typename T>
+- inline bool
+- basic_pstreambuf<C, T>::is_open () const {
+- return ppid_ > 0;
+- }
+-
+- /**
+- * Toggle the stream used for reading. If @a readerr is @c true then the
+- * process' @c stderr output will be used for subsequent extractions, if
+- * @a readerr is false the the process' stdout will be used.
+- * @param readerr @c true to read @c stderr, @c false to read @c stdout.
+- * @return @c true if the requested stream is open and will be used for
+- * subsequent extractions, @c false otherwise.
+- */
+- template<typename C, typename T>
+- inline bool
+- basic_pstreambuf<C, T>::read_err (bool readerr) {
+- buf_read_src src = readerr ? rsrc_err : rsrc_out;
+-
+- if (rpipe_[src] >= 0) {
+- switch_read_buffer(src);
+- return true;
+- }
+-
+- return false;
+- }
+-
+- /**
+- * Called when the internal character buffer is not present or is full,
+- * to transfer the buffer contents to the pipe.
+- *
+- * @param c a character to be written to the pipe.
+- * @return @c traits_type::eof() if an error occurs, otherwise if @a c
+- * is not equal to @c traits_type::eof() it will be buffered and
+- * a value other than @c traits_type::eof() returned to indicate
+- * success.
+- */
+- template<typename C, typename T>
+- typename basic_pstreambuf<C, T>::int_type
+- basic_pstreambuf<C, T>::overflow (int_type c) {
+- if (!empty_buffer()) {
+- return traits_type::eof();
+- } else if (!traits_type::eq_int_type(c, traits_type::eof())) {
+- return this->sputc(c);
+- } else {
+- return traits_type::not_eof(c);
+- }
+- }
+-
+- template<typename C, typename T>
+- int
+- basic_pstreambuf<C, T>::sync () {
+- return !exited() && empty_buffer() ? 0 : -1;
+- }
+-
+- /**
+- * @param s character buffer.
+- * @param n buffer length.
+- * @return the number of characters written.
+- */
+- template<typename C, typename T>
+- std::streamsize
+- basic_pstreambuf<C, T>::xsputn (const char_type *s, std::streamsize n) {
+- std::streamsize done = 0;
+-
+- while (done < n) {
+- if (std::streamsize nbuf = this->epptr() - this->pptr()) {
+- nbuf = std::min(nbuf, n - done);
+- traits_type::copy(this->pptr(), s + done, nbuf);
+- this->pbump(nbuf);
+- done += nbuf;
+- } else if (!empty_buffer()) {
+- break;
+- }
+- }
+-
+- return done;
+- }
+-
+- /**
+- * @return true if the buffer was emptied, false otherwise.
+- */
+- template<typename C, typename T>
+- bool
+- basic_pstreambuf<C, T>::empty_buffer () {
+- const std::streamsize count = this->pptr() - this->pbase();
+-
+- if (count > 0) {
+- const std::streamsize written = this->write(this->wbuffer_, count);
+- if (written > 0) {
+- if (const std::streamsize unwritten = count - written) {
+- traits_type::move(this->pbase(), this->pbase() + written, unwritten);
+- }
+-
+- this->pbump(-written);
+- return true;
+- }
+- }
+-
+- return false;
+- }
+-
+- /**
+- * Called when the internal character buffer is is empty, to re-fill it
+- * from the pipe.
+- *
+- * @return The first available character in the buffer,
+- * or @c traits_type::eof() in case of failure.
+- */
+- template<typename C, typename T>
+- typename basic_pstreambuf<C, T>::int_type
+- basic_pstreambuf<C, T>::underflow () {
+- if (this->gptr() < this->egptr() || fill_buffer()) {
+- return traits_type::to_int_type(*this->gptr());
+- } else {
+- return traits_type::eof();
+- }
+- }
+-
+- /**
+- * Attempts to make @a c available as the next character to be read by
+- * @c sgetc().
+- *
+- * @param c a character to make available for extraction.
+- * @return @a c if the character can be made available,
+- * @c traits_type::eof() otherwise.
+- */
+- template<typename C, typename T>
+- typename basic_pstreambuf<C, T>::int_type
+- basic_pstreambuf<C, T>::pbackfail (int_type c) {
+- if (this->gptr() != this->eback()) {
+- this->gbump(-1);
+- if (!traits_type::eq_int_type(c, traits_type::eof())) {
+- *this->gptr() = traits_type::to_char_type(c);
+- }
+-
+- return traits_type::not_eof(c);
+- } else {
+- return traits_type::eof();
+- }
+- }
+-
+- template<typename C, typename T>
+- std::streamsize
+- basic_pstreambuf<C, T>::showmanyc () {
+- int avail = 0;
+-
+- if (sizeof(char_type) == 1) {
+- avail = fill_buffer(true) ? this->egptr() - this->gptr() : -1;
+- }
+-
+-#ifdef FIONREAD
+- else {
+- if (::ioctl(rpipe(), FIONREAD, &avail) == -1) {
+- avail = -1;
+- } else if (avail) {
+- avail /= sizeof(char_type);
+- }
+- }
+-#endif
+- return std::streamsize(avail);
+- }
+-
+- /**
+- * @return true if the buffer was filled, false otherwise.
+- */
+- template<typename C, typename T>
+- bool
+- basic_pstreambuf<C, T>::fill_buffer (bool non_blocking) {
+- const std::streamsize pb1 = this->gptr() - this->eback();
+- const std::streamsize pb2 = pbsz;
+- const std::streamsize npb = std::min(pb1, pb2);
+- char_type *const rbuf = rbuffer();
+-
+- traits_type::move(rbuf + pbsz - npb, this->gptr() - npb, npb);
+-
+- std::streamsize rc = -1;
+-
+- if (non_blocking) {
+- const int flags = ::fcntl(rpipe(), F_GETFL);
+- if (flags != -1) {
+- const bool blocking = !(flags & O_NONBLOCK);
+- if (blocking) {
+- ::fcntl(rpipe(), F_SETFL, flags | O_NONBLOCK); // set non-blocking
+- }
+-
+- error_ = 0;
+- rc = read(rbuf + pbsz, bufsz - pbsz);
+-
+- if (rc == -1 && error_ == EAGAIN) { // nothing available
+- rc = 0;
+- } else if (rc == 0) { // EOF
+- rc = -1;
+- }
+-
+- if (blocking) {
+- ::fcntl(rpipe(), F_SETFL, flags); // restore
+- }
+- }
+- } else {
+- rc = read(rbuf + pbsz, bufsz - pbsz);
+- }
+-
+- if (rc > 0 || (rc == 0 && non_blocking)) {
+- this->setg(rbuf + pbsz - npb,
+- rbuf + pbsz,
+- rbuf + pbsz + rc);
+- return true;
+- } else {
+- this->setg(NULL, NULL, NULL);
+- return false;
+- }
+- }
+-
+- /**
+- * Writes up to @a n characters to the pipe from the buffer @a s.
+- *
+- * @param s character buffer.
+- * @param n buffer length.
+- * @return the number of characters written.
+- */
+- template<typename C, typename T>
+- inline std::streamsize
+- basic_pstreambuf<C, T>::write (const char_type *s, std::streamsize n) {
+- std::streamsize nwritten = 0;
+-
+- if (wpipe() >= 0) {
+- nwritten = ::write(wpipe(), s, n * sizeof(char_type));
+- if (nwritten == -1) {
+- error_ = errno;
+- } else {
+- nwritten /= sizeof(char_type);
+- }
+- }
+-
+- return nwritten;
+- }
+-
+- /**
+- * Reads up to @a n characters from the pipe to the buffer @a s.
+- *
+- * @param s character buffer.
+- * @param n buffer length.
+- * @return the number of characters read.
+- */
+- template<typename C, typename T>
+- inline std::streamsize
+- basic_pstreambuf<C, T>::read (char_type *s, std::streamsize n) {
+- std::streamsize nread = 0;
+-
+- if (rpipe() >= 0) {
+- nread = ::read(rpipe(), s, n * sizeof(char_type));
+- if (nread == -1) {
+- error_ = errno;
+- } else {
+- nread /= sizeof(char_type);
+- }
+- }
+-
+- return nread;
+- }
+-
+- /** @return a reference to the output file descriptor */
+- template<typename C, typename T>
+- inline pstreams::fd_type &
+- basic_pstreambuf<C, T>::wpipe () {
+- return wpipe_;
+- }
+-
+- /** @return a reference to the active input file descriptor */
+- template<typename C, typename T>
+- inline pstreams::fd_type &
+- basic_pstreambuf<C, T>::rpipe () {
+- return rpipe_[rsrc_];
+- }
+-
+- /** @return a reference to the specified input file descriptor */
+- template<typename C, typename T>
+- inline pstreams::fd_type &
+- basic_pstreambuf<C, T>::rpipe (buf_read_src which) {
+- return rpipe_[which];
+- }
+-
+- /** @return a pointer to the start of the active input buffer area. */
+- template<typename C, typename T>
+- inline typename basic_pstreambuf<C, T>::char_type *
+- basic_pstreambuf<C, T>::rbuffer () {
+- return rbuffer_[rsrc_];
+- }
+-
+- /*
+- * member definitions for pstream_common
+- */
+-
+- /**
+- * @class pstream_common
+- * Abstract Base Class providing common functionality for basic_ipstream,
+- * basic_opstream and basic_pstream.
+- * pstream_common manages the basic_pstreambuf stream buffer that is used
+- * by the derived classes to initialise an iostream class.
+- */
+-
+- /** Creates an uninitialised stream. */
+- template<typename C, typename T>
+- inline
+- pstream_common<C, T>::pstream_common ()
+- : std::basic_ios<C, T>(NULL)
+- , command_()
+- , buf_() {
+- this->std::basic_ios<C, T>::rdbuf(&buf_);
+- }
+-
+- /**
+- * Initialises the stream buffer by calling
+- * do_open( @a command , @a mode )
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, pmode)
+- */
+- template<typename C, typename T>
+- inline
+- pstream_common<C, T>::pstream_common (const std::string &command, pmode mode)
+- : std::basic_ios<C, T>(NULL)
+- , command_(command)
+- , buf_() {
+- this->std::basic_ios<C, T>::rdbuf(&buf_);
+- do_open(command, mode);
+- }
+-
+- /**
+- * Initialises the stream buffer by calling
+- * do_open( @a file , @a argv , @a mode )
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see do_open(const std::string&, const argv_type&, pmode)
+- */
+- template<typename C, typename T>
+- inline
+- pstream_common<C, T>::pstream_common (const std::string &file,
+- const argv_type &argv,
+- pmode mode)
+- : std::basic_ios<C, T>(NULL)
+- , command_(file)
+- , buf_() {
+- this->std::basic_ios<C, T>::rdbuf(&buf_);
+- do_open(file, argv, mode);
+- }
+-
+- /**
+- * This is a pure virtual function to make @c pstream_common abstract.
+- * Because it is the destructor it will be called by derived classes
+- * and so must be defined. It is also protected, to discourage use of
+- * the PStreams classes through pointers or references to the base class.
+- *
+- * @sa If defining a pure virtual seems odd you should read
+- * http://www.gotw.ca/gotw/031.htm (and the rest of the site as well!)
+- */
+- template<typename C, typename T>
+- inline
+- pstream_common<C, T>::~pstream_common ()
+- {}
+-
+- /**
+- * Calls rdbuf()->open( @a command , @a mode )
+- * and sets @c failbit on error.
+- *
+- * @param command a string containing a shell command.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see basic_pstreambuf::open(const std::string&, pmode)
+- */
+- template<typename C, typename T>
+- inline void
+- pstream_common<C, T>::do_open (const std::string &command, pmode mode) {
+- if (!buf_.open((command_ = command), mode)) {
+- this->setstate(std::ios_base::failbit);
+- }
+- }
+-
+- /**
+- * Calls rdbuf()->open( @a file, @a argv, @a mode )
+- * and sets @c failbit on error.
+- *
+- * @param file a string containing the pathname of a program to execute.
+- * @param argv a vector of argument strings passed to the new program.
+- * @param mode the I/O mode to use when opening the pipe.
+- * @see basic_pstreambuf::open(const std::string&, const argv_type&, pmode)
+- */
+- template<typename C, typename T>
+- inline void
+- pstream_common<C, T>::do_open (const std::string &file,
+- const argv_type &argv,
+- pmode mode) {
+- if (!buf_.open((command_ = file), argv, mode)) {
+- this->setstate(std::ios_base::failbit);
+- }
+- }
+-
+- /** Calls rdbuf->close() and sets @c failbit on error. */
+- template<typename C, typename T>
+- inline void
+- pstream_common<C, T>::close () {
+- if (!buf_.close()) {
+- this->setstate(std::ios_base::failbit);
+- }
+- }
+-
+- /**
+- * @return rdbuf()->is_open().
+- * @see basic_pstreambuf::is_open()
+- */
+- template<typename C, typename T>
+- inline bool
+- pstream_common<C, T>::is_open () const {
+- return buf_.is_open();
+- }
+-
+- /** @return a string containing the command used to initialise the stream. */
+- template<typename C, typename T>
+- inline const std::string &
+- pstream_common<C, T>::command () const {
+- return command_;
+- }
+-
+- /** @return a pointer to the private stream buffer member. */
+- // TODO document behaviour if buffer replaced.
+- template<typename C, typename T>
+- inline typename pstream_common<C, T>::streambuf_type *
+- pstream_common<C, T>::rdbuf () const {
+- return const_cast<streambuf_type *>(&buf_);
+- }
+-
+-#if REDI_EVISCERATE_PSTREAMS
+- /**
+- * @def REDI_EVISCERATE_PSTREAMS
+- * If this macro has a non-zero value then certain internals of the
+- * @c basic_pstreambuf template class are exposed. In general this is
+- * a Bad Thing, as the internal implementation is largely undocumented
+- * and may be subject to change at any time, so this feature is only
+- * provided because it might make PStreams useful in situations where
+- * it is necessary to do Bad Things.
+- */
+-
+- /**
+- * @warning This function exposes the internals of the stream buffer and
+- * should be used with caution. It is the caller's responsibility
+- * to flush streams etc. in order to clear any buffered data.
+- * The POSIX.1 function <b>fdopen</b>(3) is used to obtain the
+- * @c FILE pointers from the streambuf's private file descriptor
+- * members so consult your system's documentation for
+- * <b>fdopen</b>(3).
+- *
+- * @param in A FILE* that will refer to the process' stdin.
+- * @param out A FILE* that will refer to the process' stdout.
+- * @param err A FILE* that will refer to the process' stderr.
+- * @return An OR of zero or more of @c pstdin, @c pstdout, @c pstderr.
+- *
+- * For each open stream shared with the child process a @c FILE* is
+- * obtained and assigned to the corresponding parameter. For closed
+- * streams @c NULL is assigned to the parameter.
+- * The return value can be tested to see which parameters should be
+- * @c !NULL by masking with the corresponding @c pmode value.
+- *
+- * @see <b>fdopen</b>(3)
+- */
+- template<typename C, typename T>
+- std::size_t
+- basic_pstreambuf<C, T>::fopen (FILE * &in, FILE * &out, FILE * &err) {
+- in = out = err = NULL;
+- std::size_t open_files = 0;
+- if (wpipe() > -1) {
+- if ((in = ::fdopen(wpipe(), "w"))) {
+- open_files |= pstdin;
+- }
+- }
+-
+- if (rpipe(rsrc_out) > -1) {
+- if ((out = ::fdopen(rpipe(rsrc_out), "r"))) {
+- open_files |= pstdout;
+- }
+- }
+-
+- if (rpipe(rsrc_err) > -1) {
+- if ((err = ::fdopen(rpipe(rsrc_err), "r"))) {
+- open_files |= pstderr;
+- }
+- }
+-
+- return open_files;
+- }
+-
+- /**
+- * @warning This function exposes the internals of the stream buffer and
+- * should be used with caution.
+- *
+- * @param in A FILE* that will refer to the process' stdin.
+- * @param out A FILE* that will refer to the process' stdout.
+- * @param err A FILE* that will refer to the process' stderr.
+- * @return A bitwise-or of zero or more of @c pstdin, @c pstdout, @c pstderr.
+- * @see basic_pstreambuf::fopen()
+- */
+- template<typename C, typename T>
+- inline std::size_t
+- pstream_common<C, T>::fopen (FILE * &fin, FILE * &fout, FILE * &ferr) {
+- return buf_.fopen(fin, fout, ferr);
+- }
+-
+-#endif // REDI_EVISCERATE_PSTREAMS
+-} // namespace redi
+-
+-/**
+- * @mainpage PStreams Reference
+- * @htmlinclude mainpage.html
+- */
+-
+-#endif // REDI_PSTREAM_H_SEEN
+-
+-// vim: ts=2 sw=2 expandtab
+-
+--
+2.19.2
+
diff --git a/0006-Wreorder.patch b/0006-Wreorder.patch
deleted file mode 100644
index 7a42cc2..0000000
--- a/0006-Wreorder.patch
+++ /dev/null
@@ -1,419 +0,0 @@
-From 7c095a6ac3e98ab2197a9121e6a9b12b9e5a9137 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
-Date: Mon, 8 May 2017 06:01:46 +0200
-Subject: [PATCH 06/10] Wreorder
-
----
- examples++-load/BasicMath.h | 2 +-
- examples++-load/ClosePoints.cpp | 4 ++--
- examples++-load/Element_Mixte.cpp | 2 +-
- examples++-load/Geometry.hpp | 4 ++--
- examples++-load/SortedList.h | 2 +-
- examples++-load/SuperLu.cpp | 6 +++---
- examples++-load/TensorK.hpp | 2 +-
- examples++-load/ff-NLopt.cpp | 14 +++++++++-----
- examples++-load/ff-cmaes.cpp | 2 +-
- examples++-load/fflapack.cpp | 8 ++++----
- examples++-load/gsl.cpp | 2 +-
- examples++-load/lapack.cpp | 11 ++++++-----
- examples++-mpi/mpi-cmaes.cpp | 6 +++---
- src/Graphics/ffglut.cpp | 12 +++++++-----
- src/femlib/FQuadTree.cpp | 6 +++---
- src/femlib/MatriceCreuse.hpp | 6 +++---
- src/femlib/RNM.hpp | 3 ++-
- src/fflib/AFunction.hpp | 2 +-
- src/fflib/AFunction2.cpp | 2 +-
- src/fflib/problem.cpp | 6 +++---
- 20 files changed, 55 insertions(+), 47 deletions(-)
-
-diff --git a/examples++-load/BasicMath.h b/examples++-load/BasicMath.h
-index 083ba8b1..2dc9e4af 100755
---- a/examples++-load/BasicMath.h
-+++ b/examples++-load/BasicMath.h
-@@ -44,7 +44,7 @@ class ostream_math { //This class only contains a reference to an ostream, and a
- public:
- Format_Math format;
- ostream & os;
-- ostream_math(ostream & OS, Format_Math Format) : os(OS), format(Format){}
-+ ostream_math(ostream & OS, Format_Math Format) : format(Format), os(OS){}
- };
-
- inline ostream_math operator << (ostream & f, Format_Math Format){return ostream_math(f,Format);}
-diff --git a/examples++-load/ClosePoints.cpp b/examples++-load/ClosePoints.cpp
-index 6d1e18a0..6c3a64a2 100644
---- a/examples++-load/ClosePoints.cpp
-+++ b/examples++-load/ClosePoints.cpp
-@@ -15,9 +15,9 @@ public:
- Point *P;
- const double EPSILON;
- double x0,y0,x1,y1, coef;// boundin box
-- R2close() :data(0), n(0), nx(1000000), P(new Point[nx]),EPSILON(1e-6),offset(0) {InitialiserListe();}
-+ R2close() :data(0), n(0), nx(1000000), offset(0), P(new Point[nx]),EPSILON(1e-6) {InitialiserListe();}
- R2close(double *dd,int mx,double eps=1e-6,int offsett=1) :
-- data(dd), n(0), nx(mx), P(new Point[nx]),EPSILON(eps),offset(offsett)
-+ data(dd), n(0), nx(mx), offset(offsett), P(new Point[nx]),EPSILON(eps)
- {InitialiserListe();}
- Point operator[](int i) const { return P[i];}
-
-diff --git a/examples++-load/Element_Mixte.cpp b/examples++-load/Element_Mixte.cpp
-index c4c8461c..f1b770e4 100644
---- a/examples++-load/Element_Mixte.cpp
-+++ b/examples++-load/Element_Mixte.cpp
-@@ -1237,8 +1237,8 @@ namespace Fem2D {
- public:
- static int Data[];
- static double Pi_h_coef[];
-- bool Ortho;
- const QuadratureFormular1d & QFE;
-+ bool Ortho;
- TypeOfFE_BDM1_2d(bool ortho)
- :
- TypeOfFE(6,2,Data,1,1,
-diff --git a/examples++-load/Geometry.hpp b/examples++-load/Geometry.hpp
-index b254a573..7f875497 100644
---- a/examples++-load/Geometry.hpp
-+++ b/examples++-load/Geometry.hpp
-@@ -16,8 +16,8 @@ using namespace std;
-
- /**************** Vertex ******************/
- class Vertex : public R2 { //heritage is perhaps not totally justified here, but...
-- sym2 m;
- int gen;
-+ sym2 m;
- //friend int main(int argc, const char * argv[]); //for Debug purposes
- public:
- Vertex():R2(),m(){};
-@@ -55,7 +55,7 @@ public:
- Edge():u(NULL),v(NULL),next(NULL),sister(NULL){};
-
- #ifdef _FLAGGED_BOUNDARY_
-- Edge(Vertex const *U, Vertex const *V, Edge *S, Edge *N, int OnBoundary_=0):u(U),v(V),sister(S),next(N),onBoundary_(OnBoundary_){};
-+ Edge(Vertex const *U, Vertex const *V, Edge *S, Edge *N, int OnBoundary_=0):u(U),v(V),next(N),sister(S),onBoundary_(OnBoundary_){};
- int onBoundary() const {return onBoundary_;} //{if(sister!=NULL) return 0; if(onBoundary_>0) return onBoundary_; return 10;}
- #else
- Edge(Vertex const *U, Vertex const *V, Edge *S, Edge *N):u(U),v(V),next(N),sister(S){};
-diff --git a/examples++-load/SortedList.h b/examples++-load/SortedList.h
-index 84b3a9a5..f8fc25d0 100755
---- a/examples++-load/SortedList.h
-+++ b/examples++-load/SortedList.h
-@@ -36,7 +36,7 @@ template <class TreeLabel> class RBTree;
- template <class TabElement>
- class Tab {
- public:
-- Tab():cardMax(startCard), growIndex(0), max_accessed_pos(-1){
-+ Tab():max_accessed_pos(-1), cardMax(startCard),growIndex(0){
- elements[growIndex++].resize(startCard);
- };
- Tab(const Tab<TabElement> & tab):max_accessed_pos(tab.max_accessed_pos) {
-diff --git a/examples++-load/SuperLu.cpp b/examples++-load/SuperLu.cpp
-index b0f87541..7183338c 100644
---- a/examples++-load/SuperLu.cpp
-+++ b/examples++-load/SuperLu.cpp
-@@ -488,9 +488,9 @@ public:
- KN<long> pperm_c ) :
- eps(epsilon),epsr(0),
- tgv(ttgv),
-- etree(0),string_option(param_char),perm_r(pperm_r), perm_c(pperm_c),
-- RR(0), CC(0),
-- tol_pivot_sym(pivot_sym),tol_pivot(pivot)
-+ tol_pivot_sym(pivot_sym),tol_pivot(pivot),
-+ perm_c(pperm_c), perm_r(pperm_r),string_option(param_char),etree(0),
-+ RR(0), CC(0)
- {
- SuperMatrix B, X;
- SuperLUStat_t stat;
-diff --git a/examples++-load/TensorK.hpp b/examples++-load/TensorK.hpp
-index 490b82a6..1a7f4cd8 100755
---- a/examples++-load/TensorK.hpp
-+++ b/examples++-load/TensorK.hpp
-@@ -88,8 +88,8 @@ private: //debugging
- // **************** Constructor ********************
-
- TensorK::TensorK(int m_deg_, int r_deg_, triangulation_type ttype_=Graded, which_matrix wmat_=M1_alone, double p_exp_=2):
--m_deg(m_deg_), r_deg(r_deg_), ttype(ttype_), wmat(wmat_), p_exp(p_exp_),
- t_deg((ttype_==Quasi_Acute_Proved) ? 2*(m_deg_-r_deg_) :m_deg_),
-+m_deg(m_deg_), r_deg(r_deg_), ttype(ttype_), p_exp(p_exp_), wmat(wmat_),
- gamma_exp(-1./((m_deg_-r_deg_)*p_exp_+d_dim)),
- homog_exp(1./((m_deg_-r_deg_)*(ttype_==Quasi_Acute_Proved ? 2. : 1.)) ),
- is_valid(m_deg_>=2 && m_deg_<=5 && r_deg_>=0 && r_deg_<=m_deg_-1 && ttype_>=0 && ttype_ <=3 && wmat_>=0 && wmat_ <=2 && p_exp_ >=0)
-diff --git a/examples++-load/ff-NLopt.cpp b/examples++-load/ff-NLopt.cpp
-index 93fdd4f0..843b1f8d 100644
---- a/examples++-load/ff-NLopt.cpp
-+++ b/examples++-load/ff-NLopt.cpp
-@@ -179,11 +179,15 @@ class GenericOptimizer
- /*GenericOptimizer(nlopt::algorithm ALGO) : opt(ALGO,0),x(0),econsttol(0),iconsttol(0),econstrained(false),iconstrained(false),fit(0),d_fit(0),equaconst(0),
- d_equaconst(0),ineqconst(0),d_ineqconst(0),subopt(0)
- {}*/
-- GenericOptimizer(nlopt::algorithm ALGO,int dim=0) : opt(ALGO,dim),x(0),econsttol(0),iconsttol(0),econstrained(false),iconstrained(false),fit(0),d_fit(0),equaconst(0),
-- d_equaconst(0),ineqconst(0),d_ineqconst(0),subopt(0)
-+ GenericOptimizer(nlopt::algorithm ALGO,int dim=0) : opt(ALGO,dim),subopt(0),x(0),econsttol(0),iconsttol(0),econstrained(false),iconstrained(false),
-+ fit(0),d_fit(0),
-+ equaconst(0),ineqconst(0),
-+ d_equaconst(0),d_ineqconst(0)
- {}
-- GenericOptimizer(nlopt::algorithm ALGO,const ffcalfunc<R> &_ff,Rn &xstart) : opt(ALGO,xstart.n),x(&xstart),econsttol(0),iconsttol(0),econstrained(false),iconstrained(false),
-- fit(new ffcalfunc<R>(_ff)),d_fit(0),equaconst(0),d_equaconst(0),ineqconst(0),d_ineqconst(0),subopt(0)
-+ GenericOptimizer(nlopt::algorithm ALGO,const ffcalfunc<R> &_ff,Rn &xstart) : opt(ALGO,xstart.n),subopt(0),x(&xstart),econsttol(0),iconsttol(0),econstrained(false),iconstrained(false),
-+ fit(new ffcalfunc<R>(_ff)),d_fit(0),
-+ equaconst(0),ineqconst(0),
-+ d_equaconst(0),d_ineqconst(0)
- {
- opt.set_min_objective(NLoptFunc, static_cast<void*>(this));
- }
-@@ -336,7 +340,7 @@ class GenericOptimizer
-
- nlopt::opt opt,*subopt;
- Rn *x,econsttol,iconsttol;
-- bool iconstrained,econstrained;
-+ bool econstrained,iconstrained;
- ScalarFunc fit;
- VectorFunc d_fit,equaconst,ineqconst;
- MatrixFunc d_equaconst,d_ineqconst;
-diff --git a/examples++-load/ff-cmaes.cpp b/examples++-load/ff-cmaes.cpp
-index 0ab37b1d..29f83264 100644
---- a/examples++-load/ff-cmaes.cpp
-+++ b/examples++-load/ff-cmaes.cpp
-@@ -170,8 +170,8 @@ class OptimCMA_ES : public OneOperator
- void PopEval() {for(int i=0;i<popsize();++i) {Rn_ popi(pop[i],dimension()); fitvals[i] = fit->J(popi);}}
- double * operator() () {return *x = Rn(x->n,CMAES::operator()());}
- private:
-- ffcalfunc *fit;
- Rn *x;
-+ ffcalfunc *fit;
- };
-
-
-diff --git a/examples++-load/fflapack.cpp b/examples++-load/fflapack.cpp
-index c3db6560..411820ef 100644
---- a/examples++-load/fflapack.cpp
-+++ b/examples++-load/fflapack.cpp
-@@ -841,14 +841,14 @@ public:
- bool ta;
- T b; bool tb;
- Mult( T aa,T bb)
-- : a(aa),b(bb),ta(0),tb(0) {}
-+ : a(aa),ta(0),b(bb),tb(0) {}
- // Transpose<
- Mult( Transpose<T> aa,T bb)
-- : a(aa),b(bb),ta(1),tb(0) {}
-+ : a(aa),ta(1),b(bb),tb(0) {}
- Mult( Transpose<T> aa,Transpose<T> bb)
-- : a(aa),b(bb),ta(1),tb(1) {}
-+ : a(aa),ta(1),b(bb),tb(1) {}
- Mult( T aa,Transpose<T> bb)
-- : a(aa),b(bb),ta(1),tb(1) {}
-+ : a(aa),ta(1),b(bb),tb(1) {}
- };
-
- template<class K>
-diff --git a/examples++-load/gsl.cpp b/examples++-load/gsl.cpp
-index 086c3f63..45468ec0 100644
---- a/examples++-load/gsl.cpp
-+++ b/examples++-load/gsl.cpp
-@@ -53,8 +53,8 @@ struct GSLInterpolation {
-
- gsl_interp_accel *acc;
- gsl_spline * spline ;
-- double *xy;
- size_t n;
-+ double *xy;
- const gsl_interp_type *splinetype;
- void init() {spline=0;acc=0;n=0,xy=0;}
- GSLInterpolation() :acc(0),spline(0),n(0),xy(0) {}
-diff --git a/examples++-load/lapack.cpp b/examples++-load/lapack.cpp
-index cb533387..c3a36a69 100644
---- a/examples++-load/lapack.cpp
-+++ b/examples++-load/lapack.cpp
-@@ -890,16 +890,17 @@ class Mult{
- public:
- T a;
- bool ta;
-- T b; bool tb;
-+ T b;
-+ bool tb;
- Mult( T aa,T bb)
-- : a(aa),b(bb),ta(0),tb(0) {}
-+ : a(aa),ta(0),b(bb),tb(0) {}
- // Transpose<
- Mult( Transpose<T> aa,T bb)
-- : a(aa),b(bb),ta(1),tb(0) {}
-+ : a(aa),ta(1),b(bb),tb(0) {}
- Mult( Transpose<T> aa,Transpose<T> bb)
-- : a(aa),b(bb),ta(1),tb(1) {}
-+ : a(aa),ta(1),b(bb),tb(1) {}
- Mult( T aa,Transpose<T> bb)
-- : a(aa),b(bb),ta(1),tb(1) {}
-+ : a(aa),ta(1),b(bb),tb(1) {}
- };
-
- template<class K>
-diff --git a/examples++-mpi/mpi-cmaes.cpp b/examples++-mpi/mpi-cmaes.cpp
-index 5c621d07..8e9add31 100644
---- a/examples++-mpi/mpi-cmaes.cpp
-+++ b/examples++-mpi/mpi-cmaes.cpp
-@@ -175,7 +175,7 @@ class OptimCMA_ES : public OneOperator
- : CMAES(d,xstart.n ? xstart:0,stddev,seed,lambda,"non"),x(&xstart),fit(&_ff) {}*/
-
- CMA_ES_MPI(ffcalfunc &_ff,Rn &xstart,const Rn &stddev,long seed,int lambda,MPI_Comm *_com)
-- : CMAES(),x(0),fit(&_ff),com(_com),myid(0),nproc(1),my_number_of_fitness_eval(0),index(0)
-+ : CMAES(),x(0),fit(&_ff),com(_com),nproc(1),myid(0),my_number_of_fitness_eval(0),index(0)
- {
- MPI_Comm_size(*com,&nproc);
- MPI_Comm_rank(*com,&myid);
-@@ -191,7 +191,7 @@ class OptimCMA_ES : public OneOperator
- if(myid==0) cout << SayHello() << endl;
- }
- CMA_ES_MPI(ffcalfunc &_ff,Rn &xstart,const Rn &stddev,long seed,int lambda,MPI_Comm *_com,const char *ifname)
-- : CMAES(),x(0),fit(&_ff),com(_com),myid(0),nproc(1),my_number_of_fitness_eval(0),index(0)
-+ : CMAES(),x(0),fit(&_ff),com(_com),nproc(1),myid(0),my_number_of_fitness_eval(0),index(0)
- {
- MPI_Comm_size(*com,&nproc);
- MPI_Comm_rank(*com,&myid);
-@@ -242,8 +242,8 @@ class OptimCMA_ES : public OneOperator
- private:
- CMA_ES_MPI(const CMA_ES_MPI &);
- CMA_ES_MPI& operator=(const CMA_ES_MPI &);
-- ffcalfunc *fit;
- Rn *x;
-+ ffcalfunc *fit;
- MPI_Comm *com;
- int nproc,myid,my_number_of_fitness_eval;
- int * index;
-diff --git a/src/Graphics/ffglut.cpp b/src/Graphics/ffglut.cpp
-index 7111371e..fd38782c 100644
---- a/src/Graphics/ffglut.cpp
-+++ b/src/Graphics/ffglut.cpp
-@@ -1139,11 +1139,12 @@ void OnePlotBorder::Draw(OneWindow *win)
-
- OneWindow::OneWindow(int h,int w,ThePlot *p)
- :
-+ theplot(0),
- icurrentPlot(lplots.begin()),
- lplotssize(0),
-- height(h),width(w),theplot(0),hpixel(1),
-- Bmin(0,0),Bmax(1,1),oBmin(Bmin),oBmax(Bmax),zmin(0),zmax(1),
-- windowdump(false),help(false), rapz0(-1.),rapz(1),withlight(false),
-+ height(h),width(w),
-+ Bmin(0,0),Bmax(1,1),oBmin(Bmin),oBmax(Bmax),zmin(0),zmax(1),hpixel(1),
-+ windowdump(false),help(false),rapz(1),rapz0(-1.),withlight(false),
- changearrow(true),changeiso(true), keepPV(false),init(false)
- {
-
-@@ -1752,8 +1753,9 @@ void ThePlot::SetColorTable(int nb)
-
- ThePlot::ThePlot(PlotStream & fin,ThePlot *old,int kcount)
- : count(kcount), state(0),
-- changeViso(true),changeVarrow(true),changeColor(true),
-- changeBorder(true),changeFill(true), withiso(false),witharrow(false),
-+ withiso(false),witharrow(false),
-+ changeViso(true),changeVarrow(true),
-+ changeColor(true),changeBorder(true),changeFill(true),
- plotdim(2),theta(30.*M_PI/180.),phi(20.*M_PI/180.),dcoef(1),focal(20.*M_PI/180.),
- datadim(1), winnum(0)
-
-diff --git a/src/femlib/FQuadTree.cpp b/src/femlib/FQuadTree.cpp
-index 828094ac..55590a33 100644
---- a/src/femlib/FQuadTree.cpp
-+++ b/src/femlib/FQuadTree.cpp
-@@ -358,12 +358,12 @@ void FQuadTree::Add( Vertex & w)
-
- FQuadTree::FQuadTree(Vertex * v,R2 Pmin,R2 Pmax,long nbv)
- :
-- th(0),
- lenStorageQuadTreeBox(Max(abs(nbv),1000L)),
-- NbQuadTreeBox(0),
-- NbVertices(0),
-+ th(0),
- NbQuadTreeBoxSearch(0),
- NbVerticesSearch(0),
-+ NbQuadTreeBox(0),
-+ NbVertices(0),
- cMin(Pmin-(Pmax-Pmin)/2),
- cMax(Pmax+(Pmax-Pmin)/2),
- coef( MaxISize/Norme_infty(cMax-cMin))
-diff --git a/src/femlib/MatriceCreuse.hpp b/src/femlib/MatriceCreuse.hpp
-index 40122195..f533d662 100644
---- a/src/femlib/MatriceCreuse.hpp
-+++ b/src/femlib/MatriceCreuse.hpp
-@@ -939,14 +939,14 @@ struct Data_Sparse_Solver {
- :
- initmat(1),
- typemat(0),
-+ epsilon(1e-6),
-+ precon(0),
-+ NbSpace(50),
- strategy(0),
- tgv(ff_tgv),
- factorize(0),
-- epsilon(1e-6),
-- precon(0),
- tol_pivot(-1),
- tol_pivot_sym(-1),
-- NbSpace(50),
- itmax(0),
- // lparams(0,0),
- // dparams(0,0),
-diff --git a/src/femlib/RNM.hpp b/src/femlib/RNM.hpp
-index 9aa804c5..d13c2a17 100644
---- a/src/femlib/RNM.hpp
-+++ b/src/femlib/RNM.hpp
-@@ -372,8 +372,9 @@ template<class R> istream & operator>>(istream & f, KN<R> & v);
-
- template<class R>
- class SetArray { public:
-- R o,step;
-+ R o;
- long n;
-+ R step;
- explicit SetArray(long nn,R oo=R(),R sstep=R(1)): o(oo),n(nn),step(sstep) {}
- template<class K> SetArray(SetArray<K> sa): o(sa.o),n(sa.n),step(sa.step) {}
-
-diff --git a/src/fflib/AFunction.hpp b/src/fflib/AFunction.hpp
-index 6def7c51..a641550c 100644
---- a/src/fflib/AFunction.hpp
-+++ b/src/fflib/AFunction.hpp
-@@ -1679,7 +1679,7 @@ class E_BorderN :public E_F0mps { public:
- }
- E_BorderN(const E_Border * bb, C_F0 nn,const E_BorderN * nx=0) ;
- E_BorderN(const E_BorderN & bb,const E_BorderN * nx)
-- : b(bb.b),n(bb.n),cas(bb.cas),next(nx)
-+ : b(bb.b),cas(bb.cas),n(bb.n),next(nx)
- {
- int kk=1;
- if(bb.next) {// modif FH. 13/02/2008
-diff --git a/src/fflib/AFunction2.cpp b/src/fflib/AFunction2.cpp
-index cb4b558e..13b879e2 100644
---- a/src/fflib/AFunction2.cpp
-+++ b/src/fflib/AFunction2.cpp
-@@ -467,8 +467,8 @@ basicForEachType::basicForEachType(const type_info & k,
- un_ptr_type(rr?rr:this),
- casting(0), // no casting to
- un_ptr(p),
-- InitExp(iv),
- DoOnReturn(dreturn),
-+ InitExp(iv),
- //funct_type(0),
- destroy(id) {}
- void basicForEachType::SetArgs(const ListOfId *lid) const
-diff --git a/src/fflib/problem.cpp b/src/fflib/problem.cpp
-index bff9fa92..19f8d349 100644
---- a/src/fflib/problem.cpp
-+++ b/src/fflib/problem.cpp
-@@ -6327,11 +6327,11 @@ bool FieldOfForm( list<C_F0> & largs ,bool complextype) // true => complex prob
-
-
- Problem::Problem(const C_args * ca,const ListOfId &l,size_t & top) :
-+ dim(dimProblem(l)),
- op(new C_args(*ca)),
- var(l.size()),
-- VF(false),
-- offset(align8(top)),
-- dim(dimProblem(l))
-+ VF(false),
-+ offset(align8(top))
- {
- // cout << "Problem : -----------------------------" << top << " dim = " << dim<< endl;
- top = offset + max(sizeof(Data<FESpace>),sizeof(Data<FESpace>));
---
-2.17.1
-
diff --git a/0007-Unbundle-pstream.patch b/0007-Unbundle-pstream.patch
deleted file mode 100644
index 581ee9a..0000000
--- a/0007-Unbundle-pstream.patch
+++ /dev/null
@@ -1,2246 +0,0 @@
-From b8eb195bafaeac0a4ffb66c041bfe00b2a0f40a6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
-Date: Wed, 24 May 2017 06:21:24 +0200
-Subject: [PATCH 07/10] Unbundle pstream
-
----
- examples++-load/Makefile.am | 2 +-
- examples++-load/pipe.cpp | 2 +-
- examples++-load/pstream.h | 2199 -----------------------------------
- 3 files changed, 2 insertions(+), 2201 deletions(-)
- delete mode 100644 examples++-load/pstream.h
-
-diff --git a/examples++-load/Makefile.am b/examples++-load/Makefile.am
-index 3922f0f1..dc237e65 100644
---- a/examples++-load/Makefile.am
-+++ b/examples++-load/Makefile.am
-@@ -47,7 +47,7 @@ ff-get-dep.in ff-get-dep.awk ff-pkg-download.in load.link.in include.tar.gz \
- MUMPS.cpp \
- ff-Ipopt.cpp \
- scotch.cpp shell.cpp \
-- pipe.cpp pstream.h \
-+ pipe.cpp \
- symmetrizeCSR.cpp \
- dmatrix.hpp PARDISO.cpp \
- ch.pts BEC.cpp bfstream.cpp iohdf5.cpp \
-diff --git a/examples++-load/pipe.cpp b/examples++-load/pipe.cpp
-index 2dd34120..f36485a2 100644
---- a/examples++-load/pipe.cpp
-+++ b/examples++-load/pipe.cpp
-@@ -18,7 +18,7 @@ long ffusleep(long s) { return usleep(s);}
-
- //#if __clang_major__ > 4
- #ifndef _WIN32
--#include "pstream.h"
-+#include <pstreams/pstream.h>
-
- struct pstream {
- redi::basic_pstream<char> * fb;
-diff --git a/examples++-load/pstream.h b/examples++-load/pstream.h
-deleted file mode 100644
-index 72ae04f0..00000000
---- a/examples++-load/pstream.h
-+++ /dev/null
-@@ -1,2199 +0,0 @@
--/*
--PStreams - POSIX Process I/O for C++
--Copyright (C) 2001-2013 Jonathan Wakely
--
--This file is part of PStreams.
--
--PStreams is free software; you can redistribute it and/or modify
--it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3 of the License, or
--(at your option) any later version.
--
--PStreams is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--GNU Lesser General Public License for more details.
--
--You should have received a copy of the GNU Lesser General Public License
--along with this program. If not, see <http://www.gnu.org/licenses/>.
--*/
--
--/**
-- * @file pstream.h
-- * @brief Declares all PStreams classes.
-- * @author Jonathan Wakely
-- *
-- * Defines classes redi::ipstream, redi::opstream, redi::pstream
-- * and redi::rpstream.
-- */
--
--#ifndef REDI_PSTREAM_H_SEEN
--#define REDI_PSTREAM_H_SEEN
--
--#include <ios>
--#include <streambuf>
--#include <istream>
--#include <ostream>
--#include <string>
--#include <vector>
--#include <algorithm> // for min()
--#include <cerrno> // for errno
--#include <cstddef> // for size_t, NULL
--#include <cstdlib> // for exit()
--#include <sys/types.h> // for pid_t
--#include <sys/wait.h> // for waitpid()
--#include <sys/ioctl.h> // for ioctl() and FIONREAD
--#if defined(__sun)
--# include <sys/filio.h> // for FIONREAD on Solaris 2.5
--#endif
--#include <unistd.h> // for pipe() fork() exec() and filedes functions
--#include <signal.h> // for kill()
--#include <fcntl.h> // for fcntl()
--#if REDI_EVISCERATE_PSTREAMS
--# include <stdio.h> // for FILE, fdopen()
--#endif
--
--
--/// The library version.
--#define PSTREAMS_VERSION 0x0080 // 0.8.0
--
--/**
-- * @namespace redi
-- * @brief All PStreams classes are declared in namespace redi.
-- *
-- * Like the standard iostreams, PStreams is a set of class templates,
-- * taking a character type and traits type. As with the standard streams
-- * they are most likely to be used with @c char and the default
-- * traits type, so typedefs for this most common case are provided.
-- *
-- * The @c pstream_common class template is not intended to be used directly,
-- * it is used internally to provide the common functionality for the
-- * other stream classes.
-- */
--namespace redi
--{
-- /// Common base class providing constants and typenames.
-- struct pstreams
-- {
-- /// Type used to specify how to connect to the process.
-- typedef std::ios_base::openmode pmode;
--
-- /// Type used to hold the arguments for a command.
-- typedef std::vector<std::string> argv_type;
--
-- /// Type used for file descriptors.
-- typedef int fd_type;
--
-- static const pmode pstdin = std::ios_base::out; ///< Write to stdin
-- static const pmode pstdout = std::ios_base::in; ///< Read from stdout
-- static const pmode pstderr = std::ios_base::app; ///< Read from stderr
--
-- protected:
-- enum { bufsz = 32 }; ///< Size of pstreambuf buffers.
-- enum { pbsz = 2 }; ///< Number of putback characters kept.
-- };
--
-- /// Class template for stream buffer.
-- template <typename CharT, typename Traits = std::char_traits<CharT> >
-- class basic_pstreambuf
-- : public std::basic_streambuf<CharT, Traits>
-- , public pstreams
-- {
-- public:
-- // Type definitions for dependent types
-- typedef CharT char_type;
-- typedef Traits traits_type;
-- typedef typename traits_type::int_type int_type;
-- typedef typename traits_type::off_type off_type;
-- typedef typename traits_type::pos_type pos_type;
-- /** @deprecated use pstreams::fd_type instead. */
-- typedef fd_type fd_t;
--
-- /// Default constructor.
-- basic_pstreambuf();
--
-- /// Constructor that initialises the buffer with @a command.
-- basic_pstreambuf(const std::string& command, pmode mode);
--
-- /// Constructor that initialises the buffer with @a file and @a argv.
-- basic_pstreambuf( const std::string& file,
-- const argv_type& argv,
-- pmode mode );
--
-- /// Destructor.
-- ~basic_pstreambuf();
--
-- /// Initialise the stream buffer with @a command.
-- basic_pstreambuf*
-- open(const std::string& command, pmode mode);
--
-- /// Initialise the stream buffer with @a file and @a argv.
-- basic_pstreambuf*
-- open(const std::string& file, const argv_type& argv, pmode mode);
--
-- /// Close the stream buffer and wait for the process to exit.
-- basic_pstreambuf*
-- close();
--
-- /// Send a signal to the process.
-- basic_pstreambuf*
-- kill(int signal = SIGTERM);
--
-- /// Send a signal to the process' process group.
-- basic_pstreambuf*
-- killpg(int signal = SIGTERM);
--
-- /// Close the pipe connected to the process' stdin.
-- void
-- peof();
--
-- /// Change active input source.
-- bool
-- read_err(bool readerr = true);
--
-- /// Report whether the stream buffer has been initialised.
-- bool
-- is_open() const;
--
-- /// Report whether the process has exited.
-- bool
-- exited();
--
--#if REDI_EVISCERATE_PSTREAMS
-- /// Obtain FILE pointers for each of the process' standard streams.
-- std::size_t
-- fopen(FILE*& in, FILE*& out, FILE*& err);
--#endif
--
-- /// Return the exit status of the process.
-- int
-- status() const;
--
-- /// Return the error number (errno) for the most recent failed operation.
-- int
-- error() const;
--
-- protected:
-- /// Transfer characters to the pipe when character buffer overflows.
-- int_type
-- overflow(int_type c);
--
-- /// Transfer characters from the pipe when the character buffer is empty.
-- int_type
-- underflow();
--
-- /// Make a character available to be returned by the next extraction.
-- int_type
-- pbackfail(int_type c = traits_type::eof());
--
-- /// Write any buffered characters to the stream.
-- int
-- sync();
--
-- /// Insert multiple characters into the pipe.
-- std::streamsize
-- xsputn(const char_type* s, std::streamsize n);
--
-- /// Insert a sequence of characters into the pipe.
-- std::streamsize
-- write(const char_type* s, std::streamsize n);
--
-- /// Extract a sequence of characters from the pipe.
-- std::streamsize
-- read(char_type* s, std::streamsize n);
--
-- /// Report how many characters can be read from active input without blocking.
-- std::streamsize
-- showmanyc();
--
-- protected:
-- /// Enumerated type to indicate whether stdout or stderr is to be read.
-- enum buf_read_src { rsrc_out = 0, rsrc_err = 1 };
--
-- /// Initialise pipes and fork process.
-- pid_t
-- fork(pmode mode);
--
-- /// Wait for the child process to exit.
-- int
-- wait(bool nohang = false);
--
-- /// Return the file descriptor for the output pipe.
-- fd_type&
-- wpipe();
--
-- /// Return the file descriptor for the active input pipe.
-- fd_type&
-- rpipe();
--
-- /// Return the file descriptor for the specified input pipe.
-- fd_type&
-- rpipe(buf_read_src which);
--
-- void
-- create_buffers(pmode mode);
--
-- void
-- destroy_buffers(pmode mode);
--
-- /// Writes buffered characters to the process' stdin pipe.
-- bool
-- empty_buffer();
--
-- bool
-- fill_buffer(bool non_blocking = false);
--
-- /// Return the active input buffer.
-- char_type*
-- rbuffer();
--
-- buf_read_src
-- switch_read_buffer(buf_read_src);
--
-- private:
-- basic_pstreambuf(const basic_pstreambuf&);
-- basic_pstreambuf& operator=(const basic_pstreambuf&);
--
-- void
-- init_rbuffers();
--
-- pid_t ppid_; // pid of process
-- fd_type wpipe_; // pipe used to write to process' stdin
-- fd_type rpipe_[2]; // two pipes to read from, stdout and stderr
-- char_type* wbuffer_;
-- char_type* rbuffer_[2];
-- char_type* rbufstate_[3];
-- /// Index into rpipe_[] to indicate active source for read operations.
-- buf_read_src rsrc_;
-- int status_; // hold exit status of child process
-- int error_; // hold errno if fork() or exec() fails
-- };
--
-- /// Class template for common base class.
-- template <typename CharT, typename Traits = std::char_traits<CharT> >
-- class pstream_common
-- : virtual public std::basic_ios<CharT, Traits>
-- , virtual public pstreams
-- {
-- protected:
-- typedef basic_pstreambuf<CharT, Traits> streambuf_type;
--
-- typedef pstreams::pmode pmode;
-- typedef pstreams::argv_type argv_type;
--
-- /// Default constructor.
-- pstream_common();
--
-- /// Constructor that initialises the stream by starting a process.
-- pstream_common(const std::string& command, pmode mode);
--
-- /// Constructor that initialises the stream by starting a process.
-- pstream_common(const std::string& file, const argv_type& argv, pmode mode);
--
-- /// Pure virtual destructor.
-- virtual
-- ~pstream_common() = 0;
--
-- /// Start a process.
-- void
-- do_open(const std::string& command, pmode mode);
--
-- /// Start a process.
-- void
-- do_open(const std::string& file, const argv_type& argv, pmode mode);
--
-- public:
-- /// Close the pipe.
-- void
-- close();
--
-- /// Report whether the stream's buffer has been initialised.
-- bool
-- is_open() const;
--
-- /// Return the command used to initialise the stream.
-- const std::string&
-- command() const;
--
-- /// Return a pointer to the stream buffer.
-- streambuf_type*
-- rdbuf() const;
--
--#if REDI_EVISCERATE_PSTREAMS
-- /// Obtain FILE pointers for each of the process' standard streams.
-- std::size_t
-- fopen(FILE*& in, FILE*& out, FILE*& err);
--#endif
--
-- protected:
-- std::string command_; ///< The command used to start the process.
-- streambuf_type buf_; ///< The stream buffer.
-- };
--
--
-- /**
-- * @class basic_ipstream
-- * @brief Class template for Input PStreams.
-- *
-- * Reading from an ipstream reads the command's standard output and/or
-- * standard error (depending on how the ipstream is opened)
-- * and the command's standard input is the same as that of the process
-- * that created the object, unless altered by the command itself.
-- */
--
-- template <typename CharT, typename Traits = std::char_traits<CharT> >
-- class basic_ipstream
-- : public std::basic_istream<CharT, Traits>
-- , public pstream_common<CharT, Traits>
-- , virtual public pstreams
-- {
-- typedef std::basic_istream<CharT, Traits> istream_type;
-- typedef pstream_common<CharT, Traits> pbase_type;
--
-- using pbase_type::buf_; // declare name in this scope
--
-- pmode readable(pmode mode)
-- {
-- if (!(mode & (pstdout|pstderr)))
-- mode |= pstdout;
-- return mode;
-- }
--
-- public:
-- /// Type used to specify how to connect to the process.
-- typedef typename pbase_type::pmode pmode;
--
-- /// Type used to hold the arguments for a command.
-- typedef typename pbase_type::argv_type argv_type;
--
-- /// Default constructor, creates an uninitialised stream.
-- basic_ipstream()
-- : istream_type(NULL), pbase_type()
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling do_open() with the supplied
-- * arguments.
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, pmode)
-- */
-- basic_ipstream(const std::string& command, pmode mode = pstdout)
-- : istream_type(NULL), pbase_type(command, readable(mode))
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling do_open() with the supplied
-- * arguments.
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- basic_ipstream( const std::string& file,
-- const argv_type& argv,
-- pmode mode = pstdout )
-- : istream_type(NULL), pbase_type(file, argv, readable(mode))
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling
-- * @c do_open(argv[0],argv,mode|pstdout)
-- *
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- basic_ipstream(const argv_type& argv, pmode mode = pstdout)
-- : istream_type(NULL), pbase_type(argv.at(0), argv, mode|pstdout)
-- { }
--
-- /**
-- * @brief Destructor.
-- *
-- * Closes the stream and waits for the child to exit.
-- */
-- ~basic_ipstream()
-- { }
--
-- /**
-- * @brief Start a process.
-- *
-- * Calls do_open( @a %command , @a mode|pstdout ).
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, pmode)
-- */
-- void
-- open(const std::string& command, pmode mode = pstdout)
-- {
-- this->do_open(command, readable(mode));
-- }
--
-- /**
-- * @brief Start a process.
-- *
-- * Calls do_open( @a file , @a argv , @a mode|pstdout ).
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- void
-- open( const std::string& file,
-- const argv_type& argv,
-- pmode mode = pstdout )
-- {
-- this->do_open(file, argv, readable(mode));
-- }
--
-- /**
-- * @brief Set streambuf to read from process' @c stdout.
-- * @return @c *this
-- */
-- basic_ipstream&
-- out()
-- {
-- this->buf_.read_err(false);
-- return *this;
-- }
--
-- /**
-- * @brief Set streambuf to read from process' @c stderr.
-- * @return @c *this
-- */
-- basic_ipstream&
-- err()
-- {
-- this->buf_.read_err(true);
-- return *this;
-- }
-- };
--
--
-- /**
-- * @class basic_opstream
-- * @brief Class template for Output PStreams.
-- *
-- * Writing to an open opstream writes to the standard input of the command;
-- * the command's standard output is the same as that of the process that
-- * created the pstream object, unless altered by the command itself.
-- */
--
-- template <typename CharT, typename Traits = std::char_traits<CharT> >
-- class basic_opstream
-- : public std::basic_ostream<CharT, Traits>
-- , public pstream_common<CharT, Traits>
-- , virtual public pstreams
-- {
-- typedef std::basic_ostream<CharT, Traits> ostream_type;
-- typedef pstream_common<CharT, Traits> pbase_type;
--
-- using pbase_type::buf_; // declare name in this scope
--
-- public:
-- /// Type used to specify how to connect to the process.
-- typedef typename pbase_type::pmode pmode;
--
-- /// Type used to hold the arguments for a command.
-- typedef typename pbase_type::argv_type argv_type;
--
-- /// Default constructor, creates an uninitialised stream.
-- basic_opstream()
-- : ostream_type(NULL), pbase_type()
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling do_open() with the supplied
-- * arguments.
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, pmode)
-- */
-- basic_opstream(const std::string& command, pmode mode = pstdin)
-- : ostream_type(NULL), pbase_type(command, mode|pstdin)
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling do_open() with the supplied
-- * arguments.
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- basic_opstream( const std::string& file,
-- const argv_type& argv,
-- pmode mode = pstdin )
-- : ostream_type(NULL), pbase_type(file, argv, mode|pstdin)
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling
-- * @c do_open(argv[0],argv,mode|pstdin)
-- *
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- basic_opstream(const argv_type& argv, pmode mode = pstdin)
-- : ostream_type(NULL), pbase_type(argv.at(0), argv, mode|pstdin)
-- { }
--
-- /**
-- * @brief Destructor
-- *
-- * Closes the stream and waits for the child to exit.
-- */
-- ~basic_opstream() { }
--
-- /**
-- * @brief Start a process.
-- *
-- * Calls do_open( @a %command , @a mode|pstdin ).
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, pmode)
-- */
-- void
-- open(const std::string& command, pmode mode = pstdin)
-- {
-- this->do_open(command, mode|pstdin);
-- }
--
-- /**
-- * @brief Start a process.
-- *
-- * Calls do_open( @a file , @a argv , @a mode|pstdin ).
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- void
-- open( const std::string& file,
-- const argv_type& argv,
-- pmode mode = pstdin)
-- {
-- this->do_open(file, argv, mode|pstdin);
-- }
-- };
--
--
-- /**
-- * @class basic_pstream
-- * @brief Class template for Bidirectional PStreams.
-- *
-- * Writing to a pstream opened with @c pmode @c pstdin writes to the
-- * standard input of the command.
-- * Reading from a pstream opened with @c pmode @c pstdout and/or @c pstderr
-- * reads the command's standard output and/or standard error.
-- * Any of the process' @c stdin, @c stdout or @c stderr that is not
-- * connected to the pstream (as specified by the @c pmode)
-- * will be the same as the process that created the pstream object,
-- * unless altered by the command itself.
-- */
-- template <typename CharT, typename Traits = std::char_traits<CharT> >
-- class basic_pstream
-- : public std::basic_iostream<CharT, Traits>
-- , public pstream_common<CharT, Traits>
-- , virtual public pstreams
-- {
-- typedef std::basic_iostream<CharT, Traits> iostream_type;
-- typedef pstream_common<CharT, Traits> pbase_type;
--
-- using pbase_type::buf_; // declare name in this scope
--
-- public:
-- /// Type used to specify how to connect to the process.
-- typedef typename pbase_type::pmode pmode;
--
-- /// Type used to hold the arguments for a command.
-- typedef typename pbase_type::argv_type argv_type;
--
-- /// Default constructor, creates an uninitialised stream.
-- basic_pstream()
-- : iostream_type(NULL), pbase_type()
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling do_open() with the supplied
-- * arguments.
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, pmode)
-- */
-- basic_pstream(const std::string& command, pmode mode = pstdout|pstdin)
-- : iostream_type(NULL), pbase_type(command, mode)
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling do_open() with the supplied
-- * arguments.
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- basic_pstream( const std::string& file,
-- const argv_type& argv,
-- pmode mode = pstdout|pstdin )
-- : iostream_type(NULL), pbase_type(file, argv, mode)
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling
-- * @c do_open(argv[0],argv,mode)
-- *
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- basic_pstream(const argv_type& argv, pmode mode = pstdout|pstdin)
-- : iostream_type(NULL), pbase_type(argv.at(0), argv, mode)
-- { }
--
-- /**
-- * @brief Destructor
-- *
-- * Closes the stream and waits for the child to exit.
-- */
-- ~basic_pstream() { }
--
-- /**
-- * @brief Start a process.
-- *
-- * Calls do_open( @a %command , @a mode ).
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, pmode)
-- */
-- void
-- open(const std::string& command, pmode mode = pstdout|pstdin)
-- {
-- this->do_open(command, mode);
-- }
--
-- /**
-- * @brief Start a process.
-- *
-- * Calls do_open( @a file , @a argv , @a mode ).
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- void
-- open( const std::string& file,
-- const argv_type& argv,
-- pmode mode = pstdout|pstdin )
-- {
-- this->do_open(file, argv, mode);
-- }
--
-- /**
-- * @brief Set streambuf to read from process' @c stdout.
-- * @return @c *this
-- */
-- basic_pstream&
-- out()
-- {
-- this->buf_.read_err(false);
-- return *this;
-- }
--
-- /**
-- * @brief Set streambuf to read from process' @c stderr.
-- * @return @c *this
-- */
-- basic_pstream&
-- err()
-- {
-- this->buf_.read_err(true);
-- return *this;
-- }
-- };
--
--
-- /**
-- * @class basic_rpstream
-- * @brief Class template for Restricted PStreams.
-- *
-- * Writing to an rpstream opened with @c pmode @c pstdin writes to the
-- * standard input of the command.
-- * It is not possible to read directly from an rpstream object, to use
-- * an rpstream as in istream you must call either basic_rpstream::out()
-- * or basic_rpstream::err(). This is to prevent accidental reads from
-- * the wrong input source. If the rpstream was not opened with @c pmode
-- * @c pstderr then the class cannot read the process' @c stderr, and
-- * basic_rpstream::err() will return an istream that reads from the
-- * process' @c stdout, and vice versa.
-- * Reading from an rpstream opened with @c pmode @c pstdout and/or
-- * @c pstderr reads the command's standard output and/or standard error.
-- * Any of the process' @c stdin, @c stdout or @c stderr that is not
-- * connected to the pstream (as specified by the @c pmode)
-- * will be the same as the process that created the pstream object,
-- * unless altered by the command itself.
-- */
--
-- template <typename CharT, typename Traits = std::char_traits<CharT> >
-- class basic_rpstream
-- : public std::basic_ostream<CharT, Traits>
-- , private std::basic_istream<CharT, Traits>
-- , private pstream_common<CharT, Traits>
-- , virtual public pstreams
-- {
-- typedef std::basic_ostream<CharT, Traits> ostream_type;
-- typedef std::basic_istream<CharT, Traits> istream_type;
-- typedef pstream_common<CharT, Traits> pbase_type;
--
-- using pbase_type::buf_; // declare name in this scope
--
-- public:
-- /// Type used to specify how to connect to the process.
-- typedef typename pbase_type::pmode pmode;
--
-- /// Type used to hold the arguments for a command.
-- typedef typename pbase_type::argv_type argv_type;
--
-- /// Default constructor, creates an uninitialised stream.
-- basic_rpstream()
-- : ostream_type(NULL), istream_type(NULL), pbase_type()
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling do_open() with the supplied
-- * arguments.
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, pmode)
-- */
-- basic_rpstream(const std::string& command, pmode mode = pstdout|pstdin)
-- : ostream_type(NULL) , istream_type(NULL) , pbase_type(command, mode)
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling do_open() with the supplied
-- * arguments.
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- basic_rpstream( const std::string& file,
-- const argv_type& argv,
-- pmode mode = pstdout|pstdin )
-- : ostream_type(NULL), istream_type(NULL), pbase_type(file, argv, mode)
-- { }
--
-- /**
-- * @brief Constructor that initialises the stream by starting a process.
-- *
-- * Initialises the stream buffer by calling
-- * @c do_open(argv[0],argv,mode)
-- *
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- basic_rpstream(const argv_type& argv, pmode mode = pstdout|pstdin)
-- : ostream_type(NULL), istream_type(NULL),
-- pbase_type(argv.at(0), argv, mode)
-- { }
--
-- /// Destructor
-- ~basic_rpstream() { }
--
-- /**
-- * @brief Start a process.
-- *
-- * Calls do_open( @a %command , @a mode ).
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, pmode)
-- */
-- void
-- open(const std::string& command, pmode mode = pstdout|pstdin)
-- {
-- this->do_open(command, mode);
-- }
--
-- /**
-- * @brief Start a process.
-- *
-- * Calls do_open( @a file , @a argv , @a mode ).
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- void
-- open( const std::string& file,
-- const argv_type& argv,
-- pmode mode = pstdout|pstdin )
-- {
-- this->do_open(file, argv, mode);
-- }
--
-- /**
-- * @brief Obtain a reference to the istream that reads
-- * the process' @c stdout.
-- * @return @c *this
-- */
-- istream_type&
-- out()
-- {
-- this->buf_.read_err(false);
-- return *this;
-- }
--
-- /**
-- * @brief Obtain a reference to the istream that reads
-- * the process' @c stderr.
-- * @return @c *this
-- */
-- istream_type&
-- err()
-- {
-- this->buf_.read_err(true);
-- return *this;
-- }
-- };
--
--
-- /// Type definition for common template specialisation.
-- typedef basic_pstreambuf<char> pstreambuf;
-- /// Type definition for common template specialisation.
-- typedef basic_ipstream<char> ipstream;
-- /// Type definition for common template specialisation.
-- typedef basic_opstream<char> opstream;
-- /// Type definition for common template specialisation.
-- typedef basic_pstream<char> pstream;
-- /// Type definition for common template specialisation.
-- typedef basic_rpstream<char> rpstream;
--
--
-- /**
-- * When inserted into an output pstream the manipulator calls
-- * basic_pstreambuf<C,T>::peof() to close the output pipe,
-- * causing the child process to receive the end-of-file indicator
-- * on subsequent reads from its @c stdin stream.
-- *
-- * @brief Manipulator to close the pipe connected to the process' stdin.
-- * @param s An output PStream class.
-- * @return The stream object the manipulator was invoked on.
-- * @see basic_pstreambuf<C,T>::peof()
-- * @relates basic_opstream basic_pstream basic_rpstream
-- */
-- template <typename C, typename T>
-- inline std::basic_ostream<C,T>&
-- peof(std::basic_ostream<C,T>& s)
-- {
-- typedef basic_pstreambuf<C,T> pstreambuf;
-- if (pstreambuf* p = dynamic_cast<pstreambuf*>(s.rdbuf()))
-- p->peof();
-- return s;
-- }
--
--
-- /*
-- * member definitions for pstreambuf
-- */
--
--
-- /**
-- * @class basic_pstreambuf
-- * Provides underlying streambuf functionality for the PStreams classes.
-- */
--
-- /** Creates an uninitialised stream buffer. */
-- template <typename C, typename T>
-- inline
-- basic_pstreambuf<C,T>::basic_pstreambuf()
-- : ppid_(-1) // initialise to -1 to indicate no process run yet.
-- , wpipe_(-1)
-- , wbuffer_(NULL)
-- , rsrc_(rsrc_out)
-- , status_(-1)
-- , error_(0)
-- {
-- init_rbuffers();
-- }
--
-- /**
-- * Initialises the stream buffer by calling open() with the supplied
-- * arguments.
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see open()
-- */
-- template <typename C, typename T>
-- inline
-- basic_pstreambuf<C,T>::basic_pstreambuf(const std::string& command, pmode mode)
-- : ppid_(-1) // initialise to -1 to indicate no process run yet.
-- , wpipe_(-1)
-- , wbuffer_(NULL)
-- , rsrc_(rsrc_out)
-- , status_(-1)
-- , error_(0)
-- {
-- init_rbuffers();
-- open(command, mode);
-- }
--
-- /**
-- * Initialises the stream buffer by calling open() with the supplied
-- * arguments.
-- *
-- * @param file a string containing the name of a program to execute.
-- * @param argv a vector of argument strings passsed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see open()
-- */
-- template <typename C, typename T>
-- inline
-- basic_pstreambuf<C,T>::basic_pstreambuf( const std::string& file,
-- const argv_type& argv,
-- pmode mode )
-- : ppid_(-1) // initialise to -1 to indicate no process run yet.
-- , wpipe_(-1)
-- , wbuffer_(NULL)
-- , rsrc_(rsrc_out)
-- , status_(-1)
-- , error_(0)
-- {
-- init_rbuffers();
-- open(file, argv, mode);
-- }
--
-- /**
-- * Closes the stream by calling close().
-- * @see close()
-- */
-- template <typename C, typename T>
-- inline
-- basic_pstreambuf<C,T>::~basic_pstreambuf()
-- {
-- close();
-- }
--
-- /**
-- * Starts a new process by passing @a command to the shell (/bin/sh)
-- * and opens pipes to the process with the specified @a mode.
-- *
-- * If @a mode contains @c pstdout the initial read source will be
-- * the child process' stdout, otherwise if @a mode contains @c pstderr
-- * the initial read source will be the child's stderr.
-- *
-- * Will duplicate the actions of the shell in searching for an
-- * executable file if the specified file name does not contain a slash (/)
-- * character.
-- *
-- * @warning
-- * There is no way to tell whether the shell command succeeded, this
-- * function will always succeed unless resource limits (such as
-- * memory usage, or number of processes or open files) are exceeded.
-- * This means is_open() will return true even if @a command cannot
-- * be executed.
-- * Use pstreambuf::open(const std::string&, const argv_type&, pmode)
-- * if you need to know whether the command failed to execute.
-- *
-- * @param command a string containing a shell command.
-- * @param mode a bitwise OR of one or more of @c out, @c in, @c err.
-- * @return NULL if the shell could not be started or the
-- * pipes could not be opened, @c this otherwise.
-- * @see <b>execl</b>(3)
-- */
-- template <typename C, typename T>
-- basic_pstreambuf<C,T>*
-- basic_pstreambuf<C,T>::open(const std::string& command, pmode mode)
-- {
-- const char * shell_path = "/bin/sh";
--#if 0
-- const std::string argv[] = { "sh", "-c", command };
-- return this->open(shell_path, argv_type(argv, argv+3), mode);
--#else
-- basic_pstreambuf<C,T>* ret = NULL;
--
-- if (!is_open())
-- {
-- switch(fork(mode))
-- {
-- case 0 :
-- // this is the new process, exec command
-- ::execl(shell_path, "sh", "-c", command.c_str(), (char*)NULL);
--
-- // can only reach this point if exec() failed
--
-- // parent can get exit code from waitpid()
-- ::_exit(errno);
-- // using std::exit() would make static dtors run twice
--
-- case -1 :
-- // couldn't fork, error already handled in pstreambuf::fork()
-- break;
--
-- default :
-- // this is the parent process
-- // activate buffers
-- create_buffers(mode);
-- ret = this;
-- }
-- }
-- return ret;
--#endif
-- }
--
-- /**
-- * @brief Helper function to close a file descriptor.
-- *
-- * Inspects @a fd and calls <b>close</b>(3) if it has a non-negative value.
-- *
-- * @param fd a file descriptor.
-- * @relates basic_pstreambuf
-- */
-- inline void
-- close_fd(pstreams::fd_type& fd)
-- {
-- if (fd >= 0 && ::close(fd) == 0)
-- fd = -1;
-- }
--
-- /**
-- * @brief Helper function to close an array of file descriptors.
-- *
-- * Calls @c close_fd() on each member of the array.
-- * The length of the array is determined automatically by
-- * template argument deduction to avoid errors.
-- *
-- * @param fds an array of file descriptors.
-- * @relates basic_pstreambuf
-- */
-- template <int N>
-- inline void
-- close_fd_array(pstreams::fd_type (&fds)[N])
-- {
-- for (std::size_t i = 0; i < N; ++i)
-- close_fd(fds[i]);
-- }
--
-- /**
-- * Starts a new process by executing @a file with the arguments in
-- * @a argv and opens pipes to the process with the specified @a mode.
-- *
-- * By convention @c argv[0] should be the file name of the file being
-- * executed.
-- *
-- * If @a mode contains @c pstdout the initial read source will be
-- * the child process' stdout, otherwise if @a mode contains @c pstderr
-- * the initial read source will be the child's stderr.
-- *
-- * Will duplicate the actions of the shell in searching for an
-- * executable file if the specified file name does not contain a slash (/)
-- * character.
-- *
-- * Iff @a file is successfully executed then is_open() will return true.
-- * Otherwise, pstreambuf::error() can be used to obtain the value of
-- * @c errno that was set by <b>execvp</b>(3) in the child process.
-- *
-- * The exit status of the new process will be returned by
-- * pstreambuf::status() after pstreambuf::exited() returns true.
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode a bitwise OR of one or more of @c out, @c in and @c err.
-- * @return NULL if a pipe could not be opened or if the program could
-- * not be executed, @c this otherwise.
-- * @see <b>execvp</b>(3)
-- */
-- template <typename C, typename T>
-- basic_pstreambuf<C,T>*
-- basic_pstreambuf<C,T>::open( const std::string& file,
-- const argv_type& argv,
-- pmode mode )
-- {
-- basic_pstreambuf<C,T>* ret = NULL;
--
-- if (!is_open())
-- {
-- // constants for read/write ends of pipe
-- enum { RD, WR };
--
-- // open another pipe and set close-on-exec
-- fd_type ck_exec[] = { -1, -1 };
-- if (-1 == ::pipe(ck_exec)
-- || -1 == ::fcntl(ck_exec[RD], F_SETFD, FD_CLOEXEC)
-- || -1 == ::fcntl(ck_exec[WR], F_SETFD, FD_CLOEXEC))
-- {
-- error_ = errno;
-- close_fd_array(ck_exec);
-- }
-- else
-- {
-- switch(fork(mode))
-- {
-- case 0 :
-- // this is the new process, exec command
-- {
-- char** arg_v = new char*[argv.size()+1];
-- for (std::size_t i = 0; i < argv.size(); ++i)
-- {
-- const std::string& src = argv[i];
-- char*& dest = arg_v[i];
-- dest = new char[src.size()+1];
-- dest[ src.copy(dest, src.size()) ] = '\0';
-- }
-- arg_v[argv.size()] = NULL;
--
-- ::execvp(file.c_str(), arg_v);
--
-- // can only reach this point if exec() failed
--
-- // parent can get error code from ck_exec pipe
-- error_ = errno;
--
-- while (::write(ck_exec[WR], &error_, sizeof(error_)) == -1
-- && errno == EINTR)
-- { }
--
-- ::close(ck_exec[WR]);
-- ::close(ck_exec[RD]);
--
-- ::_exit(error_);
-- // using std::exit() would make static dtors run twice
-- }
--
-- case -1 :
-- // couldn't fork, error already handled in pstreambuf::fork()
-- close_fd_array(ck_exec);
-- break;
--
-- default :
-- // this is the parent process
--
-- // check child called exec() successfully
-- ::close(ck_exec[WR]);
-- switch (::read(ck_exec[RD], &error_, sizeof(error_)))
-- {
-- case 0:
-- // activate buffers
-- create_buffers(mode);
-- ret = this;
-- break;
-- case -1:
-- error_ = errno;
-- break;
-- default:
-- // error_ contains error code from child
-- // call wait() to clean up and set ppid_ to 0
-- this->wait();
-- break;
-- }
-- ::close(ck_exec[RD]);
-- }
-- }
-- }
-- return ret;
-- }
--
-- /**
-- * Creates pipes as specified by @a mode and calls @c fork() to create
-- * a new process. If the fork is successful the parent process stores
-- * the child's PID and the opened pipes and the child process replaces
-- * its standard streams with the opened pipes.
-- *
-- * If an error occurs the error code will be set to one of the possible
-- * errors for @c pipe() or @c fork().
-- * See your system's documentation for these error codes.
-- *
-- * @param mode an OR of pmodes specifying which of the child's
-- * standard streams to connect to.
-- * @return On success the PID of the child is returned in the parent's
-- * context and zero is returned in the child's context.
-- * On error -1 is returned and the error code is set appropriately.
-- */
-- template <typename C, typename T>
-- pid_t
-- basic_pstreambuf<C,T>::fork(pmode mode)
-- {
-- pid_t pid = -1;
--
-- // Three pairs of file descriptors, for pipes connected to the
-- // process' stdin, stdout and stderr
-- // (stored in a single array so close_fd_array() can close all at once)
-- fd_type fd[] = { -1, -1, -1, -1, -1, -1 };
-- fd_type* const pin = fd;
-- fd_type* const pout = fd+2;
-- fd_type* const perr = fd+4;
--
-- // constants for read/write ends of pipe
-- enum { RD, WR };
--
-- // N.B.
-- // For the pstreambuf pin is an output stream and
-- // pout and perr are input streams.
--
-- if (!error_ && mode&pstdin && ::pipe(pin))
-- error_ = errno;
--
-- if (!error_ && mode&pstdout && ::pipe(pout))
-- error_ = errno;
--
-- if (!error_ && mode&pstderr && ::pipe(perr))
-- error_ = errno;
--
-- if (!error_)
-- {
-- pid = ::fork();
-- switch (pid)
-- {
-- case 0 :
-- {
-- // this is the new process
--
-- // for each open pipe close one end and redirect the
-- // respective standard stream to the other end
--
-- if (*pin >= 0)
-- {
-- ::close(pin[WR]);
-- ::dup2(pin[RD], STDIN_FILENO);
-- ::close(pin[RD]);
-- }
-- if (*pout >= 0)
-- {
-- ::close(pout[RD]);
-- ::dup2(pout[WR], STDOUT_FILENO);
-- ::close(pout[WR]);
-- }
-- if (*perr >= 0)
-- {
-- ::close(perr[RD]);
-- ::dup2(perr[WR], STDERR_FILENO);
-- ::close(perr[WR]);
-- }
--
--#ifdef _POSIX_JOB_CONTROL
-- // Change to a new process group
-- ::setpgid(0, 0);
--#endif
--
-- break;
-- }
-- case -1 :
-- {
-- // couldn't fork for some reason
-- error_ = errno;
-- // close any open pipes
-- close_fd_array(fd);
-- break;
-- }
-- default :
-- {
-- // this is the parent process, store process' pid
-- ppid_ = pid;
--
-- // store one end of open pipes and close other end
-- if (*pin >= 0)
-- {
-- wpipe_ = pin[WR];
-- ::close(pin[RD]);
-- }
-- if (*pout >= 0)
-- {
-- rpipe_[rsrc_out] = pout[RD];
-- ::close(pout[WR]);
-- }
-- if (*perr >= 0)
-- {
-- rpipe_[rsrc_err] = perr[RD];
-- ::close(perr[WR]);
-- }
-- }
-- }
-- }
-- else
-- {
-- // close any pipes we opened before failure
-- close_fd_array(fd);
-- }
-- return pid;
-- }
--
-- /**
-- * Closes all pipes and calls wait() to wait for the process to finish.
-- * If an error occurs the error code will be set to one of the possible
-- * errors for @c waitpid().
-- * See your system's documentation for these errors.
-- *
-- * @return @c this on successful close or @c NULL if there is no
-- * process to close or if an error occurs.
-- */
-- template <typename C, typename T>
-- basic_pstreambuf<C,T>*
-- basic_pstreambuf<C,T>::close()
-- {
-- const bool running = is_open();
--
-- sync(); // this might call wait() and reap the child process
--
-- // rather than trying to work out whether or not we need to clean up
-- // just do it anyway, all cleanup functions are safe to call twice.
--
-- destroy_buffers(pstdin|pstdout|pstderr);
--
-- // close pipes before wait() so child gets EOF/SIGPIPE
-- close_fd(wpipe_);
-- close_fd_array(rpipe_);
--
-- do
-- {
-- error_ = 0;
-- } while (wait() == -1 && error() == EINTR);
--
-- return running ? this : NULL;
-- }
--
-- /**
-- * Called on construction to initialise the arrays used for reading.
-- */
-- template <typename C, typename T>
-- inline void
-- basic_pstreambuf<C,T>::init_rbuffers()
-- {
-- rpipe_[rsrc_out] = rpipe_[rsrc_err] = -1;
-- rbuffer_[rsrc_out] = rbuffer_[rsrc_err] = NULL;
-- rbufstate_[0] = rbufstate_[1] = rbufstate_[2] = NULL;
-- }
--
-- template <typename C, typename T>
-- void
-- basic_pstreambuf<C,T>::create_buffers(pmode mode)
-- {
-- if (mode & pstdin)
-- {
-- delete[] wbuffer_;
-- wbuffer_ = new char_type[bufsz];
-- this->setp(wbuffer_, wbuffer_ + bufsz);
-- }
-- if (mode & pstdout)
-- {
-- delete[] rbuffer_[rsrc_out];
-- rbuffer_[rsrc_out] = new char_type[bufsz];
-- rsrc_ = rsrc_out;
-- this->setg(rbuffer_[rsrc_out] + pbsz, rbuffer_[rsrc_out] + pbsz,
-- rbuffer_[rsrc_out] + pbsz);
-- }
-- if (mode & pstderr)
-- {
-- delete[] rbuffer_[rsrc_err];
-- rbuffer_[rsrc_err] = new char_type[bufsz];
-- if (!(mode & pstdout))
-- {
-- rsrc_ = rsrc_err;
-- this->setg(rbuffer_[rsrc_err] + pbsz, rbuffer_[rsrc_err] + pbsz,
-- rbuffer_[rsrc_err] + pbsz);
-- }
-- }
-- }
--
-- template <typename C, typename T>
-- void
-- basic_pstreambuf<C,T>::destroy_buffers(pmode mode)
-- {
-- if (mode & pstdin)
-- {
-- this->setp(NULL, NULL);
-- delete[] wbuffer_;
-- wbuffer_ = NULL;
-- }
-- if (mode & pstdout)
-- {
-- if (rsrc_ == rsrc_out)
-- this->setg(NULL, NULL, NULL);
-- delete[] rbuffer_[rsrc_out];
-- rbuffer_[rsrc_out] = NULL;
-- }
-- if (mode & pstderr)
-- {
-- if (rsrc_ == rsrc_err)
-- this->setg(NULL, NULL, NULL);
-- delete[] rbuffer_[rsrc_err];
-- rbuffer_[rsrc_err] = NULL;
-- }
-- }
--
-- template <typename C, typename T>
-- typename basic_pstreambuf<C,T>::buf_read_src
-- basic_pstreambuf<C,T>::switch_read_buffer(buf_read_src src)
-- {
-- if (rsrc_ != src)
-- {
-- char_type* tmpbufstate[] = {this->eback(), this->gptr(), this->egptr()};
-- this->setg(rbufstate_[0], rbufstate_[1], rbufstate_[2]);
-- for (std::size_t i = 0; i < 3; ++i)
-- rbufstate_[i] = tmpbufstate[i];
-- rsrc_ = src;
-- }
-- return rsrc_;
-- }
--
-- /**
-- * Suspends execution and waits for the associated process to exit, or
-- * until a signal is delivered whose action is to terminate the current
-- * process or to call a signal handling function. If the process has
-- * already exited (i.e. it is a "zombie" process) then wait() returns
-- * immediately. Waiting for the child process causes all its system
-- * resources to be freed.
-- *
-- * error() will return EINTR if wait() is interrupted by a signal.
-- *
-- * @param nohang true to return immediately if the process has not exited.
-- * @return 1 if the process has exited and wait() has not yet been called.
-- * 0 if @a nohang is true and the process has not exited yet.
-- * -1 if no process has been started or if an error occurs,
-- * in which case the error can be found using error().
-- */
-- template <typename C, typename T>
-- int
-- basic_pstreambuf<C,T>::wait(bool nohang)
-- {
-- int exited = -1;
-- if (is_open())
-- {
-- int status;
-- switch(::waitpid(ppid_, &status, nohang ? WNOHANG : 0))
-- {
-- case 0 :
-- // nohang was true and process has not exited
-- exited = 0;
-- break;
-- case -1 :
-- error_ = errno;
-- break;
-- default :
-- // process has exited
-- ppid_ = 0;
-- status_ = status;
-- exited = 1;
-- // Close wpipe, would get SIGPIPE if we used it.
-- destroy_buffers(pstdin);
-- close_fd(wpipe_);
-- // Must free read buffers and pipes on destruction
-- // or next call to open()/close()
-- break;
-- }
-- }
-- return exited;
-- }
--
-- /**
-- * Sends the specified signal to the process. A signal can be used to
-- * terminate a child process that would not exit otherwise.
-- *
-- * If an error occurs the error code will be set to one of the possible
-- * errors for @c kill(). See your system's documentation for these errors.
-- *
-- * @param signal A signal to send to the child process.
-- * @return @c this or @c NULL if @c kill() fails.
-- */
-- template <typename C, typename T>
-- inline basic_pstreambuf<C,T>*
-- basic_pstreambuf<C,T>::kill(int signal)
-- {
-- basic_pstreambuf<C,T>* ret = NULL;
-- if (is_open())
-- {
-- if (::kill(ppid_, signal))
-- error_ = errno;
-- else
-- {
--#if 0
-- // TODO call exited() to check for exit and clean up? leave to user?
-- if (signal==SIGTERM || signal==SIGKILL)
-- this->exited();
--#endif
-- ret = this;
-- }
-- }
-- return ret;
-- }
--
-- /**
-- * Sends the specified signal to the process group of the child process.
-- * A signal can be used to terminate a child process that would not exit
-- * otherwise, or to kill the process and its own children.
-- *
-- * If an error occurs the error code will be set to one of the possible
-- * errors for @c getpgid() or @c kill(). See your system's documentation
-- * for these errors. If the child is in the current process group then
-- * NULL will be returned and the error code set to EPERM.
-- *
-- * @param signal A signal to send to the child process.
-- * @return @c this on success or @c NULL on failure.
-- */
-- template <typename C, typename T>
-- inline basic_pstreambuf<C,T>*
-- basic_pstreambuf<C,T>::killpg(int signal)
-- {
-- basic_pstreambuf<C,T>* ret = NULL;
--#ifdef _POSIX_JOB_CONTROL
-- if (is_open())
-- {
-- pid_t pgid = ::getpgid(ppid_);
-- if (pgid == -1)
-- error_ = errno;
-- else if (pgid == ::getpgrp())
-- error_ = EPERM; // Don't commit suicide
-- else if (::killpg(pgid, signal))
-- error_ = errno;
-- else
-- ret = this;
-- }
--#endif
-- return ret;
-- }
--
-- /**
-- * This function can call pstreambuf::wait() and so may change the
-- * object's state if the child process has already exited.
-- *
-- * @return True if the associated process has exited, false otherwise.
-- * @see basic_pstreambuf<C,T>::wait()
-- */
-- template <typename C, typename T>
-- inline bool
-- basic_pstreambuf<C,T>::exited()
-- {
-- return ppid_ == 0 || wait(true)==1;
-- }
--
--
-- /**
-- * @return The exit status of the child process, or -1 if wait()
-- * has not yet been called to wait for the child to exit.
-- * @see basic_pstreambuf<C,T>::wait()
-- */
-- template <typename C, typename T>
-- inline int
-- basic_pstreambuf<C,T>::status() const
-- {
-- return status_;
-- }
--
-- /**
-- * @return The error code of the most recently failed operation, or zero.
-- */
-- template <typename C, typename T>
-- inline int
-- basic_pstreambuf<C,T>::error() const
-- {
-- return error_;
-- }
--
-- /**
-- * Closes the output pipe, causing the child process to receive the
-- * end-of-file indicator on subsequent reads from its @c stdin stream.
-- */
-- template <typename C, typename T>
-- inline void
-- basic_pstreambuf<C,T>::peof()
-- {
-- sync();
-- destroy_buffers(pstdin);
-- close_fd(wpipe_);
-- }
--
-- /**
-- * Unlike pstreambuf::exited(), this function will not call wait() and
-- * so will not change the object's state. This means that once a child
-- * process is executed successfully this function will continue to
-- * return true even after the process exits (until wait() is called.)
-- *
-- * @return true if a previous call to open() succeeded and wait() has
-- * not been called and determined that the process has exited,
-- * false otherwise.
-- */
-- template <typename C, typename T>
-- inline bool
-- basic_pstreambuf<C,T>::is_open() const
-- {
-- return ppid_ > 0;
-- }
--
-- /**
-- * Toggle the stream used for reading. If @a readerr is @c true then the
-- * process' @c stderr output will be used for subsequent extractions, if
-- * @a readerr is false the the process' stdout will be used.
-- * @param readerr @c true to read @c stderr, @c false to read @c stdout.
-- * @return @c true if the requested stream is open and will be used for
-- * subsequent extractions, @c false otherwise.
-- */
-- template <typename C, typename T>
-- inline bool
-- basic_pstreambuf<C,T>::read_err(bool readerr)
-- {
-- buf_read_src src = readerr ? rsrc_err : rsrc_out;
-- if (rpipe_[src]>=0)
-- {
-- switch_read_buffer(src);
-- return true;
-- }
-- return false;
-- }
--
-- /**
-- * Called when the internal character buffer is not present or is full,
-- * to transfer the buffer contents to the pipe.
-- *
-- * @param c a character to be written to the pipe.
-- * @return @c traits_type::eof() if an error occurs, otherwise if @a c
-- * is not equal to @c traits_type::eof() it will be buffered and
-- * a value other than @c traits_type::eof() returned to indicate
-- * success.
-- */
-- template <typename C, typename T>
-- typename basic_pstreambuf<C,T>::int_type
-- basic_pstreambuf<C,T>::overflow(int_type c)
-- {
-- if (!empty_buffer())
-- return traits_type::eof();
-- else if (!traits_type::eq_int_type(c, traits_type::eof()))
-- return this->sputc(c);
-- else
-- return traits_type::not_eof(c);
-- }
--
--
-- template <typename C, typename T>
-- int
-- basic_pstreambuf<C,T>::sync()
-- {
-- return !exited() && empty_buffer() ? 0 : -1;
-- }
--
-- /**
-- * @param s character buffer.
-- * @param n buffer length.
-- * @return the number of characters written.
-- */
-- template <typename C, typename T>
-- std::streamsize
-- basic_pstreambuf<C,T>::xsputn(const char_type* s, std::streamsize n)
-- {
-- std::streamsize done = 0;
-- while (done < n)
-- {
-- if (std::streamsize nbuf = this->epptr() - this->pptr())
-- {
-- nbuf = std::min(nbuf, n - done);
-- traits_type::copy(this->pptr(), s + done, nbuf);
-- this->pbump(nbuf);
-- done += nbuf;
-- }
-- else if (!empty_buffer())
-- break;
-- }
-- return done;
-- }
--
-- /**
-- * @return true if the buffer was emptied, false otherwise.
-- */
-- template <typename C, typename T>
-- bool
-- basic_pstreambuf<C,T>::empty_buffer()
-- {
-- const std::streamsize count = this->pptr() - this->pbase();
-- if (count > 0)
-- {
-- const std::streamsize written = this->write(this->wbuffer_, count);
-- if (written > 0)
-- {
-- if (const std::streamsize unwritten = count - written)
-- traits_type::move(this->pbase(), this->pbase()+written, unwritten);
-- this->pbump(-written);
-- return true;
-- }
-- }
-- return false;
-- }
--
-- /**
-- * Called when the internal character buffer is is empty, to re-fill it
-- * from the pipe.
-- *
-- * @return The first available character in the buffer,
-- * or @c traits_type::eof() in case of failure.
-- */
-- template <typename C, typename T>
-- typename basic_pstreambuf<C,T>::int_type
-- basic_pstreambuf<C,T>::underflow()
-- {
-- if (this->gptr() < this->egptr() || fill_buffer())
-- return traits_type::to_int_type(*this->gptr());
-- else
-- return traits_type::eof();
-- }
--
-- /**
-- * Attempts to make @a c available as the next character to be read by
-- * @c sgetc().
-- *
-- * @param c a character to make available for extraction.
-- * @return @a c if the character can be made available,
-- * @c traits_type::eof() otherwise.
-- */
-- template <typename C, typename T>
-- typename basic_pstreambuf<C,T>::int_type
-- basic_pstreambuf<C,T>::pbackfail(int_type c)
-- {
-- if (this->gptr() != this->eback())
-- {
-- this->gbump(-1);
-- if (!traits_type::eq_int_type(c, traits_type::eof()))
-- *this->gptr() = traits_type::to_char_type(c);
-- return traits_type::not_eof(c);
-- }
-- else
-- return traits_type::eof();
-- }
--
-- template <typename C, typename T>
-- std::streamsize
-- basic_pstreambuf<C,T>::showmanyc()
-- {
-- int avail = 0;
-- if (sizeof(char_type) == 1)
-- avail = fill_buffer(true) ? this->egptr() - this->gptr() : -1;
--#ifdef FIONREAD
-- else
-- {
-- if (::ioctl(rpipe(), FIONREAD, &avail) == -1)
-- avail = -1;
-- else if (avail)
-- avail /= sizeof(char_type);
-- }
--#endif
-- return std::streamsize(avail);
-- }
--
-- /**
-- * @return true if the buffer was filled, false otherwise.
-- */
-- template <typename C, typename T>
-- bool
-- basic_pstreambuf<C,T>::fill_buffer(bool non_blocking)
-- {
-- const std::streamsize pb1 = this->gptr() - this->eback();
-- const std::streamsize pb2 = pbsz;
-- const std::streamsize npb = std::min(pb1, pb2);
--
-- char_type* const rbuf = rbuffer();
--
-- traits_type::move(rbuf + pbsz - npb, this->gptr() - npb, npb);
--
-- std::streamsize rc = -1;
--
-- if (non_blocking)
-- {
-- const int flags = ::fcntl(rpipe(), F_GETFL);
-- if (flags != -1)
-- {
-- const bool blocking = !(flags & O_NONBLOCK);
-- if (blocking)
-- ::fcntl(rpipe(), F_SETFL, flags | O_NONBLOCK); // set non-blocking
--
-- error_ = 0;
-- rc = read(rbuf + pbsz, bufsz - pbsz);
--
-- if (rc == -1 && error_ == EAGAIN) // nothing available
-- rc = 0;
-- else if (rc == 0) // EOF
-- rc = -1;
--
-- if (blocking)
-- ::fcntl(rpipe(), F_SETFL, flags); // restore
-- }
-- }
-- else
-- rc = read(rbuf + pbsz, bufsz - pbsz);
--
-- if (rc > 0 || (rc == 0 && non_blocking))
-- {
-- this->setg( rbuf + pbsz - npb,
-- rbuf + pbsz,
-- rbuf + pbsz + rc );
-- return true;
-- }
-- else
-- {
-- this->setg(NULL, NULL, NULL);
-- return false;
-- }
-- }
--
-- /**
-- * Writes up to @a n characters to the pipe from the buffer @a s.
-- *
-- * @param s character buffer.
-- * @param n buffer length.
-- * @return the number of characters written.
-- */
-- template <typename C, typename T>
-- inline std::streamsize
-- basic_pstreambuf<C,T>::write(const char_type* s, std::streamsize n)
-- {
-- std::streamsize nwritten = 0;
-- if (wpipe() >= 0)
-- {
-- nwritten = ::write(wpipe(), s, n * sizeof(char_type));
-- if (nwritten == -1)
-- error_ = errno;
-- else
-- nwritten /= sizeof(char_type);
-- }
-- return nwritten;
-- }
--
-- /**
-- * Reads up to @a n characters from the pipe to the buffer @a s.
-- *
-- * @param s character buffer.
-- * @param n buffer length.
-- * @return the number of characters read.
-- */
-- template <typename C, typename T>
-- inline std::streamsize
-- basic_pstreambuf<C,T>::read(char_type* s, std::streamsize n)
-- {
-- std::streamsize nread = 0;
-- if (rpipe() >= 0)
-- {
-- nread = ::read(rpipe(), s, n * sizeof(char_type));
-- if (nread == -1)
-- error_ = errno;
-- else
-- nread /= sizeof(char_type);
-- }
-- return nread;
-- }
--
-- /** @return a reference to the output file descriptor */
-- template <typename C, typename T>
-- inline pstreams::fd_type&
-- basic_pstreambuf<C,T>::wpipe()
-- {
-- return wpipe_;
-- }
--
-- /** @return a reference to the active input file descriptor */
-- template <typename C, typename T>
-- inline pstreams::fd_type&
-- basic_pstreambuf<C,T>::rpipe()
-- {
-- return rpipe_[rsrc_];
-- }
--
-- /** @return a reference to the specified input file descriptor */
-- template <typename C, typename T>
-- inline pstreams::fd_type&
-- basic_pstreambuf<C,T>::rpipe(buf_read_src which)
-- {
-- return rpipe_[which];
-- }
--
-- /** @return a pointer to the start of the active input buffer area. */
-- template <typename C, typename T>
-- inline typename basic_pstreambuf<C,T>::char_type*
-- basic_pstreambuf<C,T>::rbuffer()
-- {
-- return rbuffer_[rsrc_];
-- }
--
--
-- /*
-- * member definitions for pstream_common
-- */
--
-- /**
-- * @class pstream_common
-- * Abstract Base Class providing common functionality for basic_ipstream,
-- * basic_opstream and basic_pstream.
-- * pstream_common manages the basic_pstreambuf stream buffer that is used
-- * by the derived classes to initialise an iostream class.
-- */
--
-- /** Creates an uninitialised stream. */
-- template <typename C, typename T>
-- inline
-- pstream_common<C,T>::pstream_common()
-- : std::basic_ios<C,T>(NULL)
-- , command_()
-- , buf_()
-- {
-- this->std::basic_ios<C,T>::rdbuf(&buf_);
-- }
--
-- /**
-- * Initialises the stream buffer by calling
-- * do_open( @a command , @a mode )
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, pmode)
-- */
-- template <typename C, typename T>
-- inline
-- pstream_common<C,T>::pstream_common(const std::string& command, pmode mode)
-- : std::basic_ios<C,T>(NULL)
-- , command_(command)
-- , buf_()
-- {
-- this->std::basic_ios<C,T>::rdbuf(&buf_);
-- do_open(command, mode);
-- }
--
-- /**
-- * Initialises the stream buffer by calling
-- * do_open( @a file , @a argv , @a mode )
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see do_open(const std::string&, const argv_type&, pmode)
-- */
-- template <typename C, typename T>
-- inline
-- pstream_common<C,T>::pstream_common( const std::string& file,
-- const argv_type& argv,
-- pmode mode )
-- : std::basic_ios<C,T>(NULL)
-- , command_(file)
-- , buf_()
-- {
-- this->std::basic_ios<C,T>::rdbuf(&buf_);
-- do_open(file, argv, mode);
-- }
--
-- /**
-- * This is a pure virtual function to make @c pstream_common abstract.
-- * Because it is the destructor it will be called by derived classes
-- * and so must be defined. It is also protected, to discourage use of
-- * the PStreams classes through pointers or references to the base class.
-- *
-- * @sa If defining a pure virtual seems odd you should read
-- * http://www.gotw.ca/gotw/031.htm (and the rest of the site as well!)
-- */
-- template <typename C, typename T>
-- inline
-- pstream_common<C,T>::~pstream_common()
-- {
-- }
--
-- /**
-- * Calls rdbuf()->open( @a command , @a mode )
-- * and sets @c failbit on error.
-- *
-- * @param command a string containing a shell command.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see basic_pstreambuf::open(const std::string&, pmode)
-- */
-- template <typename C, typename T>
-- inline void
-- pstream_common<C,T>::do_open(const std::string& command, pmode mode)
-- {
-- if (!buf_.open((command_=command), mode))
-- this->setstate(std::ios_base::failbit);
-- }
--
-- /**
-- * Calls rdbuf()->open( @a file, @a argv, @a mode )
-- * and sets @c failbit on error.
-- *
-- * @param file a string containing the pathname of a program to execute.
-- * @param argv a vector of argument strings passed to the new program.
-- * @param mode the I/O mode to use when opening the pipe.
-- * @see basic_pstreambuf::open(const std::string&, const argv_type&, pmode)
-- */
-- template <typename C, typename T>
-- inline void
-- pstream_common<C,T>::do_open( const std::string& file,
-- const argv_type& argv,
-- pmode mode )
-- {
-- if (!buf_.open((command_=file), argv, mode))
-- this->setstate(std::ios_base::failbit);
-- }
--
-- /** Calls rdbuf->close() and sets @c failbit on error. */
-- template <typename C, typename T>
-- inline void
-- pstream_common<C,T>::close()
-- {
-- if (!buf_.close())
-- this->setstate(std::ios_base::failbit);
-- }
--
-- /**
-- * @return rdbuf()->is_open().
-- * @see basic_pstreambuf::is_open()
-- */
-- template <typename C, typename T>
-- inline bool
-- pstream_common<C,T>::is_open() const
-- {
-- return buf_.is_open();
-- }
--
-- /** @return a string containing the command used to initialise the stream. */
-- template <typename C, typename T>
-- inline const std::string&
-- pstream_common<C,T>::command() const
-- {
-- return command_;
-- }
--
-- /** @return a pointer to the private stream buffer member. */
-- // TODO document behaviour if buffer replaced.
-- template <typename C, typename T>
-- inline typename pstream_common<C,T>::streambuf_type*
-- pstream_common<C,T>::rdbuf() const
-- {
-- return const_cast<streambuf_type*>(&buf_);
-- }
--
--
--#if REDI_EVISCERATE_PSTREAMS
-- /**
-- * @def REDI_EVISCERATE_PSTREAMS
-- * If this macro has a non-zero value then certain internals of the
-- * @c basic_pstreambuf template class are exposed. In general this is
-- * a Bad Thing, as the internal implementation is largely undocumented
-- * and may be subject to change at any time, so this feature is only
-- * provided because it might make PStreams useful in situations where
-- * it is necessary to do Bad Things.
-- */
--
-- /**
-- * @warning This function exposes the internals of the stream buffer and
-- * should be used with caution. It is the caller's responsibility
-- * to flush streams etc. in order to clear any buffered data.
-- * The POSIX.1 function <b>fdopen</b>(3) is used to obtain the
-- * @c FILE pointers from the streambuf's private file descriptor
-- * members so consult your system's documentation for
-- * <b>fdopen</b>(3).
-- *
-- * @param in A FILE* that will refer to the process' stdin.
-- * @param out A FILE* that will refer to the process' stdout.
-- * @param err A FILE* that will refer to the process' stderr.
-- * @return An OR of zero or more of @c pstdin, @c pstdout, @c pstderr.
-- *
-- * For each open stream shared with the child process a @c FILE* is
-- * obtained and assigned to the corresponding parameter. For closed
-- * streams @c NULL is assigned to the parameter.
-- * The return value can be tested to see which parameters should be
-- * @c !NULL by masking with the corresponding @c pmode value.
-- *
-- * @see <b>fdopen</b>(3)
-- */
-- template <typename C, typename T>
-- std::size_t
-- basic_pstreambuf<C,T>::fopen(FILE*& in, FILE*& out, FILE*& err)
-- {
-- in = out = err = NULL;
-- std::size_t open_files = 0;
-- if (wpipe() > -1)
-- {
-- if ((in = ::fdopen(wpipe(), "w")))
-- {
-- open_files |= pstdin;
-- }
-- }
-- if (rpipe(rsrc_out) > -1)
-- {
-- if ((out = ::fdopen(rpipe(rsrc_out), "r")))
-- {
-- open_files |= pstdout;
-- }
-- }
-- if (rpipe(rsrc_err) > -1)
-- {
-- if ((err = ::fdopen(rpipe(rsrc_err), "r")))
-- {
-- open_files |= pstderr;
-- }
-- }
-- return open_files;
-- }
--
-- /**
-- * @warning This function exposes the internals of the stream buffer and
-- * should be used with caution.
-- *
-- * @param in A FILE* that will refer to the process' stdin.
-- * @param out A FILE* that will refer to the process' stdout.
-- * @param err A FILE* that will refer to the process' stderr.
-- * @return A bitwise-or of zero or more of @c pstdin, @c pstdout, @c pstderr.
-- * @see basic_pstreambuf::fopen()
-- */
-- template <typename C, typename T>
-- inline std::size_t
-- pstream_common<C,T>::fopen(FILE*& fin, FILE*& fout, FILE*& ferr)
-- {
-- return buf_.fopen(fin, fout, ferr);
-- }
--
--#endif // REDI_EVISCERATE_PSTREAMS
--
--
--} // namespace redi
--
--/**
-- * @mainpage PStreams Reference
-- * @htmlinclude mainpage.html
-- */
--
--#endif // REDI_PSTREAM_H_SEEN
--
--// vim: ts=2 sw=2 expandtab
--
---
-2.17.1
-
diff --git a/0007-Wdelete-non-virtual-dtor.patch b/0007-Wdelete-non-virtual-dtor.patch
new file mode 100644
index 0000000..2f8857b
--- /dev/null
+++ b/0007-Wdelete-non-virtual-dtor.patch
@@ -0,0 +1,38 @@
+From 020ec40ff3b77d2ecf3b46205c646f6e8c35a30c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
+Date: Wed, 31 May 2017 11:54:05 +0200
+Subject: [PATCH 7/9] Wdelete-non-virtual-dtor
+
+---
+ src/fflib/lgfem.cpp | 2 +-
+ src/fflib/lgfem.hpp | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/fflib/lgfem.cpp b/src/fflib/lgfem.cpp
+index 74c1ae36..55214d66 100644
+--- a/src/fflib/lgfem.cpp
++++ b/src/fflib/lgfem.cpp
+@@ -607,7 +607,7 @@ public:
+ {
+
+ }
+- ~E_StopGC()
++ virtual ~E_StopGC()
+ {// a verifier ???? FH....
+ delete (E_F0 *) cxx; // ???
+ delete (E_F0 *) cgg; // ???
+diff --git a/src/fflib/lgfem.hpp b/src/fflib/lgfem.hpp
+index 1a1f774f..c3fc760f 100644
+--- a/src/fflib/lgfem.hpp
++++ b/src/fflib/lgfem.hpp
+@@ -402,6 +402,7 @@ class FEbaseArrayKn { public:// for eigen value
+ virtual void set(int i,KN_<K> ) =0;
+ virtual KN<K>* get (int i) const = 0; // for P. Jolivet
+ virtual void resize(int i) = 0; // for P. Jolivet
++ virtual ~FEbaseArrayKn () {};
+ };
+
+ template<class K,class v_fes>
+--
+2.19.2
+
diff --git a/0008-Use-INSTALL_DATA-to-install-idps.patch b/0008-Use-INSTALL_DATA-to-install-idps.patch
new file mode 100644
index 0000000..8ea6f25
--- /dev/null
+++ b/0008-Use-INSTALL_DATA-to-install-idps.patch
@@ -0,0 +1,67 @@
+From 8998f545ad67910a2b8507e3797514b6996aca55 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
+Date: Fri, 23 Feb 2018 16:31:31 +0100
+Subject: [PATCH 8/9] Use INSTALL_DATA to install idps
+
+---
+ examples++-3d/Makefile.am | 2 +-
+ examples++-hpddm/Makefile.am | 2 +-
+ examples++-mpi/Makefile.am | 2 +-
+ examples++-tutorial/Makefile.am | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/examples++-3d/Makefile.am b/examples++-3d/Makefile.am
+index aa9f9271..d1fbada3 100644
+--- a/examples++-3d/Makefile.am
++++ b/examples++-3d/Makefile.am
+@@ -36,7 +36,7 @@ freefem++.pref:
+ 3d-Leman.edp:freefem++.pref
+ install-exec-local::
+ $(mkinstalldirs) -m 755 $(DESTDIR)$(ff_prefix_dir)/idp
+- $(INSTALL) -m 555 $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
++ $(INSTALL_DATA) $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
+
+
+
+diff --git a/examples++-hpddm/Makefile.am b/examples++-hpddm/Makefile.am
+index 54c868bf..163a05d1 100644
+--- a/examples++-hpddm/Makefile.am
++++ b/examples++-hpddm/Makefile.am
+@@ -72,7 +72,7 @@ install-exec-local::
+ $(mkinstalldirs) -m 755 $(DESTDIR)$(ff_prefix_dir)/etc
+ -for i in $(LIST_COMPILE); do \
+ if [ -f $$i ] ; then $(INSTALL) -m 555 $$i $(DESTDIR)$(ff_prefix_dir)/lib/mpi; fi; done
+- $(INSTALL) -m 555 $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
++ $(INSTALL_DATA) $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
+
+
+ freefem++.pref:Makefile
+diff --git a/examples++-mpi/Makefile.am b/examples++-mpi/Makefile.am
+index 3227bd46..f3ce1095 100644
+--- a/examples++-mpi/Makefile.am
++++ b/examples++-mpi/Makefile.am
+@@ -91,7 +91,7 @@ install-exec-local::
+ $(mkinstalldirs) -m 755 $(DESTDIR)$(ff_prefix_dir)/idp
+ -for i in $(LIST_COMPILE); do \
+ if [ -f $$i ] ; then $(INSTALL) -m 555 $$i $(DESTDIR)$(ff_prefix_dir)/lib/mpi; fi; done
+- $(INSTALL) -m 555 $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
++ $(INSTALL_DATA) $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
+
+
+ freefem++.pref:Makefile
+diff --git a/examples++-tutorial/Makefile.am b/examples++-tutorial/Makefile.am
+index 2cb8b21b..aa97b4b4 100644
+--- a/examples++-tutorial/Makefile.am
++++ b/examples++-tutorial/Makefile.am
+@@ -26,7 +26,7 @@ Ref: makeref.edp freefem++.pref
+ ../src/nw/FreeFem++-nw makeref.edp
+ install-exec-local::
+ $(mkinstalldirs) -m 755 $(DESTDIR)$(ff_prefix_dir)/idp
+- $(INSTALL) -m 555 $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
++ $(INSTALL_DATA) $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
+
+
+ makeref.edp: regtests.m4 ../regtests.m4
+--
+2.19.2
+
diff --git a/0008-Wdelete-non-virtual-dtor.patch b/0008-Wdelete-non-virtual-dtor.patch
deleted file mode 100644
index b87b94e..0000000
--- a/0008-Wdelete-non-virtual-dtor.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 93418c8aa12d97dff58277b587211483d002fe41 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
-Date: Wed, 31 May 2017 11:54:05 +0200
-Subject: [PATCH 08/10] Wdelete-non-virtual-dtor
-
----
- src/fflib/lgfem.cpp | 2 +-
- src/fflib/lgfem.hpp | 1 +
- 2 files changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/fflib/lgfem.cpp b/src/fflib/lgfem.cpp
-index 7461db1f..315cb722 100644
---- a/src/fflib/lgfem.cpp
-+++ b/src/fflib/lgfem.cpp
-@@ -607,7 +607,7 @@ public:
- {
-
- }
-- ~E_StopGC()
-+ virtual ~E_StopGC()
- {// a verifier ???? FH....
- delete (E_F0 *) cxx; // ???
- delete (E_F0 *) cgg; // ???
-diff --git a/src/fflib/lgfem.hpp b/src/fflib/lgfem.hpp
-index 1a1f774f..c3fc760f 100644
---- a/src/fflib/lgfem.hpp
-+++ b/src/fflib/lgfem.hpp
-@@ -402,6 +402,7 @@ class FEbaseArrayKn { public:// for eigen value
- virtual void set(int i,KN_<K> ) =0;
- virtual KN<K>* get (int i) const = 0; // for P. Jolivet
- virtual void resize(int i) = 0; // for P. Jolivet
-+ virtual ~FEbaseArrayKn () {};
- };
-
- template<class K,class v_fes>
---
-2.17.1
-
diff --git a/0009-Tweak-build-ffmaster.patch b/0009-Tweak-build-ffmaster.patch
new file mode 100644
index 0000000..0144482
--- /dev/null
+++ b/0009-Tweak-build-ffmaster.patch
@@ -0,0 +1,29 @@
+From 5c7d7213c99a5181c3a7a01e851eb3ee7eda3158 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
+Date: Thu, 23 Aug 2018 07:47:11 +0200
+Subject: [PATCH 9/9] Tweak build ffmaster
+
+---
+ examples++-load/Makefile.am | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/examples++-load/Makefile.am b/examples++-load/Makefile.am
+index 8de25fc7..69cedc4c 100644
+--- a/examples++-load/Makefile.am
++++ b/examples++-load/Makefile.am
+@@ -251,9 +251,9 @@ install-exec-local:: load_compile WHERE_LIBRARY
+ done ; \
+ fi
+
+-ffmaster: libff-mmap-semaphore.o ffmaster.c libff-mmap-semaphore.h
+- $(CC) $(CFLAGS) ffmaster.c libff-mmap-semaphore.o -o ffmaster $(LIBSPTHREAD)
+-libff-mmap-semaphore.o ff-mmap-semaphore.$(DYLIB_SUFFIX):include.done ff-mmap-semaphore.cpp libff-mmap-semaphore.c libff-mmap-semaphore.h ff-c++
++ffmaster$(EXEEXT): libff-mmap-semaphore.o ffmaster.c libff-mmap-semaphore.h
++ $(CC) $(CFLAGS) ffmaster.c libff-mmap-semaphore.$(OBJEXT) -o ffmaster$(EXEEXT) $(LIBSPTHREAD)
++libff-mmap-semaphore.$(OBJEXT) ff-mmap-semaphore.$(DYLIB_SUFFIX):include.done ff-mmap-semaphore.cpp libff-mmap-semaphore.c libff-mmap-semaphore.h ff-c++
+ ./ff-c++ -auto ff-mmap-semaphore.cpp
+
+ clean-local::
+--
+2.19.2
+
diff --git a/0009-Use-INSTALL_DATA-to-install-idps.patch b/0009-Use-INSTALL_DATA-to-install-idps.patch
deleted file mode 100644
index 952e8ec..0000000
--- a/0009-Use-INSTALL_DATA-to-install-idps.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From b51c50c27590741b4132672b88b8e10efa7eead4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
-Date: Fri, 23 Feb 2018 16:31:31 +0100
-Subject: [PATCH 09/10] Use INSTALL_DATA to install idps
-
----
- examples++-3d/Makefile.am | 2 +-
- examples++-hpddm/Makefile.am | 2 +-
- examples++-mpi/Makefile.am | 2 +-
- examples++-tutorial/Makefile.am | 2 +-
- 4 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/examples++-3d/Makefile.am b/examples++-3d/Makefile.am
-index aa9f9271..d1fbada3 100644
---- a/examples++-3d/Makefile.am
-+++ b/examples++-3d/Makefile.am
-@@ -36,7 +36,7 @@ freefem++.pref:
- 3d-Leman.edp:freefem++.pref
- install-exec-local::
- $(mkinstalldirs) -m 755 $(DESTDIR)$(ff_prefix_dir)/idp
-- $(INSTALL) -m 555 $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
-+ $(INSTALL_DATA) $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
-
-
-
-diff --git a/examples++-hpddm/Makefile.am b/examples++-hpddm/Makefile.am
-index 54c868bf..163a05d1 100644
---- a/examples++-hpddm/Makefile.am
-+++ b/examples++-hpddm/Makefile.am
-@@ -72,7 +72,7 @@ install-exec-local::
- $(mkinstalldirs) -m 755 $(DESTDIR)$(ff_prefix_dir)/etc
- -for i in $(LIST_COMPILE); do \
- if [ -f $$i ] ; then $(INSTALL) -m 555 $$i $(DESTDIR)$(ff_prefix_dir)/lib/mpi; fi; done
-- $(INSTALL) -m 555 $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
-+ $(INSTALL_DATA) $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
-
-
- freefem++.pref:Makefile
-diff --git a/examples++-mpi/Makefile.am b/examples++-mpi/Makefile.am
-index 3227bd46..f3ce1095 100644
---- a/examples++-mpi/Makefile.am
-+++ b/examples++-mpi/Makefile.am
-@@ -91,7 +91,7 @@ install-exec-local::
- $(mkinstalldirs) -m 755 $(DESTDIR)$(ff_prefix_dir)/idp
- -for i in $(LIST_COMPILE); do \
- if [ -f $$i ] ; then $(INSTALL) -m 555 $$i $(DESTDIR)$(ff_prefix_dir)/lib/mpi; fi; done
-- $(INSTALL) -m 555 $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
-+ $(INSTALL_DATA) $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
-
-
- freefem++.pref:Makefile
-diff --git a/examples++-tutorial/Makefile.am b/examples++-tutorial/Makefile.am
-index 2cb8b21b..aa97b4b4 100644
---- a/examples++-tutorial/Makefile.am
-+++ b/examples++-tutorial/Makefile.am
-@@ -26,7 +26,7 @@ Ref: makeref.edp freefem++.pref
- ../src/nw/FreeFem++-nw makeref.edp
- install-exec-local::
- $(mkinstalldirs) -m 755 $(DESTDIR)$(ff_prefix_dir)/idp
-- $(INSTALL) -m 555 $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
-+ $(INSTALL_DATA) $(LIST_IDP) $(DESTDIR)$(ff_prefix_dir)/idp
-
-
- makeref.edp: regtests.m4 ../regtests.m4
---
-2.17.1
-
diff --git a/0010-Remove-src-medit-eigenv.h.patch b/0010-Remove-src-medit-eigenv.h.patch
new file mode 100644
index 0000000..1e3a478
--- /dev/null
+++ b/0010-Remove-src-medit-eigenv.h.patch
@@ -0,0 +1,99 @@
+From 65ac006eae44734c8da82328299282c8759a5aa7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
+Date: Mon, 10 Dec 2018 07:38:30 +0100
+Subject: [PATCH 10/10] Remove src/medit/eigenv.h
+
+---
+ src/medit/Makefile.am | 2 +-
+ src/medit/eigenv.h | 25 -------------------------
+ src/medit/inout.c | 1 +
+ src/medit/inout_morice.c | 2 ++
+ src/medit/inout_popenbinaire.c | 2 ++
+ 5 files changed, 6 insertions(+), 26 deletions(-)
+ delete mode 100644 src/medit/eigenv.h
+
+diff --git a/src/medit/Makefile.am b/src/medit/Makefile.am
+index 2b914c59..e76d3a75 100644
+--- a/src/medit/Makefile.am
++++ b/src/medit/Makefile.am
+@@ -9,7 +9,7 @@ ffmedit_SOURCES=animat.c cube.c image.c listnum.c mouse.c persp.c stream.c zaldy
+ material.c normal.c tiles.c camera.c ellipse.c inout.c medit.c param.c psfile.c transform.c cenrad.c geometry.c \
+ inout_morice.c menus.c parsar.c scene.c util.c clip.c gisfil.c inout_popenbinaire.c mesh.c parsop.c scissor.c vector.c \
+ clipvol.c hash.c items.c mlists.c particle.c sftcpy.c view.c critip.c ilists.c keyboard.c morphing.c path.c status.c \
+- zaldy1.c chrono.h extern.h image.h mesh.h eigenv.h grafic.h medit.h sproto.h picking.c
++ zaldy1.c chrono.h extern.h image.h mesh.h grafic.h medit.h sproto.h picking.c
+
+
+ LDADD=../libMesh/libMesh.a $(LIBSGLUT) -lm
+diff --git a/src/medit/eigenv.h b/src/medit/eigenv.h
+deleted file mode 100644
+index 5384d493..00000000
+--- a/src/medit/eigenv.h
++++ /dev/null
+@@ -1,25 +0,0 @@
+-/****************************************************************************/
+-/* This file is part of FreeFem++. */
+-/* */
+-/* FreeFem++ is free software: you can redistribute it and/or modify */
+-/* it under the terms of the GNU Lesser General Public License as */
+-/* published by the Free Software Foundation, either version 3 of */
+-/* the License, or (at your option) any later version. */
+-/* */
+-/* FreeFem++ is distributed in the hope that it will be useful, */
+-/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+-/* GNU Lesser General Public License for more details. */
+-/* */
+-/* You should have received a copy of the GNU Lesser General Public License */
+-/* along with FreeFem++. If not, see <http://www.gnu.org/licenses/>. */
+-/****************************************************************************/
+-/* SUMMARY : ...
+-/* LICENSE : LGPLv3
+-/* ORG : LJLL Universite Pierre et Marie Curie, Paris, FRANCE
+-/* AUTHORS : Pascal Frey
+-/* E-MAIL : pascal.frey(a)sorbonne-universite.fr
+- */
+-
+-int eigenv (int symmat, double *mat, double lambda[3], double v[3][3]);
+-int eigen2 (double *mm, double *lambda, double vp[2][2]);
+diff --git a/src/medit/inout.c b/src/medit/inout.c
+index 76cd1bb4..fe1d90d1 100644
+--- a/src/medit/inout.c
++++ b/src/medit/inout.c
+@@ -24,6 +24,7 @@
+ #include "medit.h"
+ #include "libmesh5.h"
+ #include "extern.h"
++#include <eigenv.h>
+
+ int loadMesh (pMesh mesh) {
+ pPoint ppt;
+diff --git a/src/medit/inout_morice.c b/src/medit/inout_morice.c
+index 141aa5fe..0e7be324 100644
+--- a/src/medit/inout_morice.c
++++ b/src/medit/inout_morice.c
+@@ -25,6 +25,8 @@
+ #include "libmesh5.h"
+ #include "extern.h"
+ #include "string.h"
++#include <eigenv.h>
++
+ static int debug = 0;
+ void getline_number (char *nature, int *nb) {
+ char data[256];
+diff --git a/src/medit/inout_popenbinaire.c b/src/medit/inout_popenbinaire.c
+index 546f118e..a105b81e 100644
+--- a/src/medit/inout_popenbinaire.c
++++ b/src/medit/inout_popenbinaire.c
+@@ -25,6 +25,8 @@
+ #include "libmesh5.h"
+ #include "extern.h"
+ #include "string.h"
++#include <eigenv.h>
++
+ #ifdef WIN32
+ #include <fcntl.h>
+ #endif
+--
+2.19.2
+
diff --git a/0010-Tweak-build-ffmaster.patch b/0010-Tweak-build-ffmaster.patch
deleted file mode 100644
index 21d6221..0000000
--- a/0010-Tweak-build-ffmaster.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 342c2baa179776336064b19e43b8d92517812076 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
-Date: Thu, 23 Aug 2018 07:47:11 +0200
-Subject: [PATCH 10/10] Tweak build ffmaster
-
----
- examples++-load/Makefile.am | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/examples++-load/Makefile.am b/examples++-load/Makefile.am
-index dc237e65..b678db54 100644
---- a/examples++-load/Makefile.am
-+++ b/examples++-load/Makefile.am
-@@ -251,9 +251,9 @@ install-exec-local:: load_compile WHERE_LIBRARY
- done ; \
- fi
-
--ffmaster: libff-mmap-semaphore.o ffmaster.c libff-mmap-semaphore.h
-- $(CC) $(CFLAGS) ffmaster.c libff-mmap-semaphore.o -o ffmaster $(LIBSPTHREAD)
--libff-mmap-semaphore.o ff-mmap-semaphore.$(DYLIB_SUFFIX):include.done ff-mmap-semaphore.cpp libff-mmap-semaphore.c libff-mmap-semaphore.h ff-c++
-+ffmaster$(EXEEXT): libff-mmap-semaphore.o ffmaster.c libff-mmap-semaphore.h
-+ $(CC) $(CFLAGS) ffmaster.c libff-mmap-semaphore.$(OBJEXT) -o ffmaster$(EXEEXT) $(LIBSPTHREAD)
-+libff-mmap-semaphore.$(OBJEXT) ff-mmap-semaphore.$(DYLIB_SUFFIX):include.done ff-mmap-semaphore.cpp libff-mmap-semaphore.c libff-mmap-semaphore.h ff-c++
- ./ff-c++ -auto ff-mmap-semaphore.cpp
-
- clean-local::
---
-2.17.1
-
diff --git a/0011-Wformat-overflow.patch b/0011-Wformat-overflow.patch
new file mode 100644
index 0000000..fc12cfc
--- /dev/null
+++ b/0011-Wformat-overflow.patch
@@ -0,0 +1,39 @@
+From 65f28c74decaa88b1b3e2ad39803f71f2a0ba95c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu(a)fedoraproject.org>
+Date: Tue, 11 Dec 2018 06:58:17 +0100
+Subject: [PATCH 11/11] Wformat-overflow
+
+---
+ src/medit/bbfile.c | 2 +-
+ src/medit/status.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/medit/bbfile.c b/src/medit/bbfile.c
+index a8429599..2785113e 100644
+--- a/src/medit/bbfile.c
++++ b/src/medit/bbfile.c
+@@ -63,7 +63,7 @@ int bbfile (pMesh mesh) {
+ double a, b, c, lambda[3], eigv[3][3], m[6], vp[2][2];
+ float dummy;
+ int j, k, l, dim, np, nf, i1, i2, i3, err, iord;
+- char *ptr, data[128], tmp[128];
++ char *ptr, data[128+4], tmp[128];
+ ubyte bigbb;
+
+ /* default */
+diff --git a/src/medit/status.c b/src/medit/status.c
+index d8452eab..3f1e4203 100644
+--- a/src/medit/status.c
++++ b/src/medit/status.c
+@@ -142,7 +142,7 @@ void redrawStatusBar (pScene sc) {
+ /* clip eqn */
+ if (clip->active & C_ON && !(clip->active & C_HIDE)) {
+ double dd;
+- char buf[128], tmpbuf[128];
++ char buf[128+10], tmpbuf[128];
+
+ sprintf(buf, "Eqn: ");
+ strcpy(tmpbuf, buf);
+--
+2.19.2
+
diff --git a/freefem++.spec b/freefem++.spec
index df1a4b8..60951c4 100644
--- a/freefem++.spec
+++ b/freefem++.spec
@@ -1,4 +1,5 @@
-%global tarvers 3.60
+%global tarname FreeFem-sources
+%global tarvers 3.61
# Allow disabling building with/against openmpi
# Build with --without openmpi to not build openmpi
@@ -12,7 +13,7 @@
# They fail/hang for yet undetermined causes.
# Build with --with checks to force building them.
# Build with --without checks to skip building them.
-%ifarch ppc64le aarch64 s390x
+%ifarch ppc64le aarch64 s390x armv7hl
%bcond_with checks
%else
%bcond_without checks
@@ -22,34 +23,27 @@ Summary: PDE solving tool
Name: freefem++
Version: %{expand:%(echo %tarvers | tr - .)}
Release: 1%{?dist}
-URL: http://www.freefem.org/ff++/index.htm
-Source0: http://www.freefem.org/ff++/ftp/%{name}-%{tarvers}.tar.gz
+URL: https://freefem.org
+Source0: https://github.com/FreeFem/FreeFem-sources/archive/%{tarvers}.tar.gz#/%{t...
Patch01: 0001-Build-fixes.patch
-Patch02: 0002-Eliminate-unused-vars.patch
-Patch03: 0003-Fix-formating-buffers.patch
-Patch04: 0004-Wsign-compare.patch
-Patch05: 0005-Wimplicit-function-declaration.patch
-Patch06: 0006-Wreorder.patch
-Patch07: 0007-Unbundle-pstream.patch
-Patch08: 0008-Wdelete-non-virtual-dtor.patch
-Patch09: 0009-Use-INSTALL_DATA-to-install-idps.patch
-Patch10: 0010-Tweak-build-ffmaster.patch
+Patch02: 0002-Fix-formating-buffers.patch
+Patch03: 0003-Wsign-compare.patch
+Patch04: 0004-Wimplicit-function-declaration.patch
+Patch05: 0005-Wreorder.patch
+Patch06: 0006-Unbundle-pstream.patch
+Patch07: 0007-Wdelete-non-virtual-dtor.patch
+Patch08: 0008-Use-INSTALL_DATA-to-install-idps.patch
+Patch09: 0009-Tweak-build-ffmaster.patch
+Patch10: 0010-Remove-src-medit-eigenv.h.patch
+Patch11: 0011-Wformat-overflow.patch
# --disable-download doesn't work
# Bundle hpddm.zip to prevent downloading during builds.
# cf. hpddm in download/getall
-%if "%{tarvers}" == "3.60"
-%global hpddm_gitcommit 91a98d4
-%global hpddm_gitdate 20180330
-%endif
-%if "%{tarvers}" == "3.59"
-%global hpddm_gitcommit e04605a
-%global hpddm_gitdate 20180129
-%endif
-%if "%{tarvers}" == "3.58"
-%global hpddm_gitcommit 35120ab
-%global hpddm_gitdate 20171024
+%if "%{tarvers}" == "3.61"
+%global hpddm_gitcommit 22ca769
+%global hpddm_gitdate 20180522
%endif
Source1: https://github.com/hpddm/hpddm/archive/%{hpddm_gitcommit}/master.zip#/hpd...
@@ -152,18 +146,19 @@ This package contains the MPICH version of FreeFem++.
%prep
%setup -q -c -T -a 0
-mv %{name}-%{tarvers} serial
+mv %{tarname}-%{tarvers} serial
pushd serial
-%patch1 -p1
-#% patch2 -p1
-%patch3 -p1
-%patch4 -p1
-%patch5 -p1
-%patch6 -p1
-%patch7 -p1
-%patch8 -p1
-%patch9 -p1
+%patch01 -p1
+%patch02 -p1
+%patch03 -p1
+%patch04 -p1
+%patch05 -p1
+%patch06 -p1
+%patch07 -p1
+%patch08 -p1
+%patch09 -p1
%patch10 -p1
+%patch11 -p1
# Remove bundled lib
rm -r download/blas/
@@ -272,7 +267,7 @@ chmod 644 %{buildroot}%{_libdir}/ff++/lib/WHERE*
install -d %{buildroot}%{_mandir}/man1/
pushd %{buildroot}%{_datadir}/freefem++
rm -r download
-rm BUGS COPYRIGHT HISTORY* INNOVATION INSTALL{,-MacOSX} README{,_MAC,_WINDOWS} TODO mode-mi-edp.zip
+rm BUGS COPYRIGHT HISTORY* INNOVATION INSTALL{,-MacOSX} README*.md TODO mode-mi-edp.zip
popd
rm %{buildroot}{%{_bindir},%{_libdir}/ff++/bin}/ff-pkg-download
# the binary with no suffix should be the generic X11 one according to README
@@ -308,9 +303,7 @@ popd
%{_bindir}/cvmsh2
%{_bindir}/ffglut
%{_bindir}/ffmedit
-%if "%{version}" >= "3.59"
%{_bindir}/ffmaster
-%endif
%{_libdir}/ff++
%{_bindir}/ff-c++
%{_bindir}/ff-get-dep
@@ -331,6 +324,12 @@ popd
%endif
%changelog
+* Thu Jan 24 2019 Ralf Corspius <corsepiu(a)fedoraproject.org> - 3.61-1
+- Update to 3.61.
+- Rebase patches.
+- Reflect upstream URL having changed.
+- Disable checks on arm7vl.
+
* Thu Aug 23 2018 Ralf Corspius <corsepiu(a)fedoraproject.org> - 3.60-1
- Update to 3.60.
- Rebase patches.
diff --git a/sources b/sources
index 5ba51ef..ea13445 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-SHA512 (freefem++-3.60.tar.gz) = c73f72858070ab734501d0dae0ed1c13caf5d5d6101df1abea569647e41a4bbfd0d835547e77d3ca2e8f849dc9cb84a0e7d786cd7c68ad096a33ad47073e5608
-SHA512 (hpddm-20180330git91a98d4.zip) = 1653b364d74d44ad6223ce8f58cbe16fee4d02f5b7e546a4e270b0177fe2d5e39901e3196a262979e6fc4e4080b59e006a4f7b72d6a4e04743caa8a3a8d58b37
+SHA512 (FreeFem-sources-3.61.tar.gz) = 7f89f8f85d6d35c8f565f57ebf86d08132a4637c5a2704ab79175e9715421c6834f14b1a2cbc074aeac655cdff9dd3276e60c7537981b451823743e0d934d1b7
+SHA512 (hpddm-20180522git22ca769.zip) = c375f938567ea1ae5875f0b6c5aedf70b696df4da6fdc7c8f47eb67534277e080743904bd91f3a0293c34fca5c171e00dfcc85e1afbf1690ed2e3a448de49604