--- gfan0.7/src/app_librarytest.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/app_librarytest.cpp 2024-08-12 11:05:45.720320231 -0600 @@ -12,8 +12,8 @@ #include "setoper.h" #include "cdd.h" #else -#include "cdd/setoper.h" -#include "cdd/cdd.h" +#include "cddlib/setoper.h" +#include "cddlib/cdd.h" #endif #include #include --- gfan0.7/src/application.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/application.cpp 2024-08-12 11:05:45.720320231 -0600 @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include #include #include @@ -566,11 +568,11 @@ void Application::makeSymbolicLinks(cons if(all || p->includeInDefaultInstallation()) if(strlen(p->name())>0) { - char c[1024]; - sprintf(c,"ln -s %s%s %s%s%s\n",path,name,path,name,p->name()); - fprintf(stderr,"%s",c); - int err=system(c); - assert(err==0); + char c[PATH_MAX], d[PATH_MAX]; + snprintf(c,PATH_MAX,"%s%s",path,name); + snprintf(d,PATH_MAX,"%s%s%s",path,name,p->name()); + fprintf(stderr,"ln -s %s %s\n",c,d); + symlink(c,d); } p=p->next; } --- gfan0.7/src/app_test.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/app_test.cpp 2024-08-13 10:46:14.680617406 -0600 @@ -1,5 +1,8 @@ #include #include +#include +#include +#include #include "parser.h" #include "printer.h" #include "polynomial.h" @@ -813,7 +816,7 @@ int testGfanLib() int largest=10+2; vector halfOpenConesStatistics(largest+1); vector nonEmptyIntersectionsStatistics(largest+1); - for(int k=2/*largest/*2*/;k<=largest;k++) + for(int k=2/*largest/2*/;k<=largest;k++) { vector > f; vector > configurations=convertMatrixVectorT(MixedVolumeExamples::cyclic(k)); @@ -1333,11 +1336,7 @@ if(0) { { outputName=outputName+"New"; } - int err=0; - { - string t="rm -f "+outputName; - err|=system(t.c_str()); - } + int err=(unlink(outputName.c_str()) == 0 || errno == ENOENT) ? 0 : 1; string command3="cat <"+input+"|"+string(command2)+">"+outputName; cerr<<"Running command:\""< subFolderNames() { -#define tempName "GfAnTeMpTeStS" - char command[256]; - int err=system("rm " tempName); - err=0;//Having err!=0 above is probably not at mistake. Rather the file did not exist. - sprintf(command,"ls %s>" tempName ,testSuiteFolderOption.getValue()); - err|=system(command); - assert(err==0); - list ret; - FILE *f=fopen(tempName,"r"); - assert(f); - char name[256]; - while(fgets(name,255,f)) + DIR *dir = opendir(testSuiteFolderOption.getValue()); + struct dirent *dirent; + + assert(dir); + for (struct dirent *ent = readdir(dir); ent; ent = readdir(dir)) { - for(int i=0;i<255 && name[i];i++)if(name[i]=='\n'){name[i]=0;} - if(name[0]>='0' && name[0]<='9')ret.push_back(string(testSuiteFolderOption.getValue())+"/"+string(name)); + if (ent->d_name[0]>='0' && ent->d_name[0]<='9') + ret.push_back(string(testSuiteFolderOption.getValue())+"/"+string(ent->d_name)); } - fclose(f); + closedir(dir); return ret; } @@ -1379,7 +1371,7 @@ if(0) { // gfan::Matrix::readMatrix(cin,4); } - if(developerTestOption.getValue()!="testsuite") + if(strcmp(developerTestOption.getValue(),"testsuite") != 0) { // lpRationalFunctionTest(); // testRationalFunctionField(); --- gfan0.7/src/bergman.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/bergman.cpp 2024-08-12 11:05:45.721320218 -0600 @@ -327,7 +327,7 @@ log0 AsciiPrinter(Stderr).printPolynomia if(doesPermutationFixCone(*j))numFixed++; // fprintf(Stderr,"groupSize = %i, numFixed = %i\n",groupSize,numFixed); - return groupSize/numFixed; + return (numFixed>0) ? groupSize/numFixed : 0; } void markFacet(IntegerVector const &relIntRidgeVector) --- gfan0.7/src/breadthfirstsearch.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/breadthfirstsearch.cpp 2024-08-12 11:05:45.722320204 -0600 @@ -260,7 +260,7 @@ public: } log2 fprintf(Stderr,"numFixed = %i\n",numFixed); - return groupSize/numFixed; + return (numFixed>0) ? groupSize/numFixed : 0; } }; --- gfan0.7/src/bsptree.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/bsptree.cpp 2024-08-12 11:05:45.722320204 -0600 @@ -131,7 +131,8 @@ public: p=&(i->first); } } - normal=*p; + if (p) + normal=*p; } return normal; } --- gfan0.7/src/enumeration.h.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/enumeration.h 2024-08-12 11:05:45.722320204 -0600 @@ -36,7 +36,7 @@ class EnumerationFilePrinter: public Enu FILE *file; public: EnumerationFilePrinter(); - ~EnumerationFilePrinter(); + virtual ~EnumerationFilePrinter(); void open(std::string filename); void open(FILE *file); @@ -61,6 +61,7 @@ class EnumerationAlgorithm bool targetBasis(const PolynomialSet &groebnerBasis){bool ret=true;if(target)ret=target->basis(groebnerBasis);printProgress();return ret;} public: EnumerationAlgorithm(){target=0;progressCounter=0;} + virtual ~EnumerationAlgorithm(){} void setEnumerationTarget(EnumerationTarget *target){this->target=target;} virtual void enumerate(const PolynomialSet &groebnerBasis){} }; --- gfan0.7/src/field.h.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/field.h 2024-08-13 10:48:41.438830878 -0600 @@ -207,7 +207,7 @@ class FieldElementImplementation virtual int getIntegerRepresentation()const { fprintf(stderr,"*this is not in Z/pZ.\n"); - assert(0); + abort(); } virtual bool isInteger()const { @@ -222,7 +222,7 @@ class FieldElementImplementation Field& operator=(const Field& a) { - assert(0); + abort(); }//assignment }; @@ -270,7 +270,7 @@ class FieldImplementation virtual FieldElement zHomomorphism(int n)=0; virtual FieldElement random() { - assert(0); + abort(); } virtual int getCharacteristic()const=0; virtual const char *name()=0; --- gfan0.7/src/field_rationalfunctions2.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/field_rationalfunctions2.cpp 2024-08-13 10:49:15.909411259 -0600 @@ -509,7 +509,7 @@ class FieldElementRationalFunction2 : pu static string LaTeXTranslator(const string &s) { - assert(0);//not supported yet + abort();//not supported yet /* int startIndex=0; string sign; if(s[0]=='-') --- gfan0.7/src/field_rationals.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/field_rationals.cpp 2024-08-12 13:56:15.163561256 -0600 @@ -397,7 +397,7 @@ const char *FieldRationalsImplementation /*FieldRationals::FieldRationals(): Field(new FieldRationalsImplementation()) -{ +{*/ /* fprintf(Stderr,"Adding field rationals\n"); next=list; list=this; --- gfan0.7/src/gfanlib_matrix.h.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/gfanlib_matrix.h 2024-08-12 13:31:35.566692074 -0600 @@ -45,7 +45,7 @@ template class HasMemberType_##Type { private: -/* using Yes=char[2]; + using Yes=char[2]; using No=char[1]; struct Fallback {struct Type{};}; struct Derived:T,Fallback{}; --- gfan0.7/src/gfanlib_memoryresource.h.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/gfanlib_memoryresource.h 2024-08-12 13:31:08.231066021 -0600 @@ -34,7 +34,7 @@ void test() { // t.a=0; for(int i=0;i<100000;i++) { - std::experimental::pmr::vector A(100000,t/* ,&stackResource/); + std::experimental::pmr::vector A(100000,t,&stackResource); //A.resize(100000,MyInt{}); } } --- gfan0.7/src/gfanlib_symmetry.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/gfanlib_symmetry.cpp 2024-08-12 11:05:45.722320204 -0600 @@ -423,7 +423,7 @@ int SymmetryGroup::orbitSize(ZVector con if(doesFix)numFixed++; } } - return groupSize/numFixed; + return (numFixed>0) ? groupSize/numFixed : 0; } --- gfan0.7/src/gfanlib_tableau.h.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/gfanlib_tableau.h 2024-08-13 10:59:21.016045143 -0600 @@ -845,7 +845,7 @@ template class Tableau{ return true;//break; //If this is reached we are ok } } - assert(0); + abort(); } void checkInLexTriangulation() { @@ -3059,7 +3059,7 @@ static bool isSubsetOf(vector const // polymakeFile.writeCardinalProperty("DIM",getMaxDim()); polymakeFile.writeCardinalProperty("LINEALITY_DIM",linealitySpace.getHeight()); // if(flags&&FPF_boundedInfo)polymakeFile.writeMatrixProperty("RAYS",toZMatrix(vertices),true);//?????? - if(flags&&FPF_rays)polymakeFile.writeMatrixProperty("RAYS",toZMatrix(vertices),true); + if(flags&FPF_rays)polymakeFile.writeMatrixProperty("RAYS",toZMatrix(vertices),true); polymakeFile.writeCardinalProperty("N_RAYS",vertices.getHeight()); polymakeFile.writeMatrixProperty("LINEALITY_SPACE",toZMatrix(linealitySpace),ambientDimension); --- gfan0.7/src/gfanlib_zcone.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/gfanlib_zcone.cpp 2024-08-12 11:05:45.723320190 -0600 @@ -16,8 +16,8 @@ #include "setoper.h" #include "cdd.h" #else -#include "cdd/setoper.h" -#include "cdd/cdd.h" +#include "cddlib/setoper.h" +#include "cddlib/cdd.h" #endif //} @@ -52,8 +52,8 @@ namespace gfan{ "dd_free_global_constants()\n" "in your deinitialisation code (only available for cddlib version>=094d).\n" "This requires the header includes:\n" - "#include \"cdd/setoper.h\"\n" - "#include \"cdd/cdd.h\"\n" + "#include \"cddlib/setoper.h\"\n" + "#include \"cddlib/cdd.h\"\n" "\n" "Alternatively, you may call gfan:initializeCddlibIfRequired() and deinitializeCddlibIfRequired()\n" "if gfanlib is the only code using cddlib. If at some point cddlib is no longer required by gfanlib\n" --- gfan0.7/src/gfanlib_z.h.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/gfanlib_z.h 2024-08-12 13:53:41.429631248 -0600 @@ -218,17 +218,17 @@ namespace gfan{ { return !(((long int)(value->_mp_d))&1); } - void initSetInt32(std::int32_t v)//should only be used in constructor or after mpz_clear has been called + void initSetInt32(int32_t v)//should only be used in constructor or after mpz_clear has been called { value->_mp_alloc=v; - *((long int*)&(value->_mp_d))=1; + value->_mp_d=reinterpret_cast(1); } - void setInt32(std::int32_t v) + void setInt32(int32_t v) { assert(!hasLimbs()); value->_mp_alloc=v; } - std::int32_t getInt32()const + int32_t getInt32()const { assert(!hasLimbs()); return int32_t(value[0]._mp_alloc); --- gfan0.7/src/lp_cdd.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/lp_cdd.cpp 2024-08-12 11:05:45.724320177 -0600 @@ -5,9 +5,9 @@ #include "cdd.h" #include "cdd_f.h" #else -#include "cdd/setoper.h" -#include "cdd/cdd.h" -#include "cdd/cdd_f.h" +#include "cddlib/setoper.h" +#include "cddlib/cdd.h" +#include "cddlib/cdd_f.h" #endif //} #include "termorder.h" --- gfan0.7/src/lp.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/lp.cpp 2024-08-13 10:49:50.357991909 -0600 @@ -58,7 +58,7 @@ bool LpSolver::interiorPoint(const Integ bool LpSolver::hasInteriorPoint(const IntegerVectorList &g, bool strictlyPositive, IntegerVector const *equalitySet) { fprintf(stderr,"hasInteriorPoint method not supported in \"%s\" LP class\n",name()); - assert(0); + abort(); } @@ -118,7 +118,7 @@ void LpSolver::dual(int n, const Integer bool LpSolver::hasHomogeneousSolution(int n, const IntegerVectorList &inequalities, const IntegerVectorList &equations) { fprintf(stderr,"hasHomogeneousSolution method not supported in \"%s\" LP class\n",name()); - assert(0); + abort(); } static LpSolver *soplex,*soplexCddGmp,*huber,*cdd,*cddgmp,*default_; --- gfan0.7/src/lp_soplexcdd.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/lp_soplexcdd.cpp 2024-08-12 13:34:07.043619886 -0600 @@ -306,7 +306,7 @@ static bool isInfeasibilityCertificate(I return true; } /* for(IntegerVectorList::const_iterator j=g.begin();j!=g.end();j++) - { + {*/ /* double prod=0; for(int i=0;i0) + for(int i=0;(size_t)i0) { s << getRing().getVariableName(i); if(int(exponent[i]*sign)!=1) --- gfan0.7/src/nbody.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/nbody.cpp 2024-08-13 10:50:08.557770361 -0600 @@ -16,7 +16,7 @@ static int rIndex(int i, int j, int N, b if((I==i)&&(J==j))return r; r++; } - assert(0); + abort(); } static int sIndex(int i, int j, int N, bool withMasses) --- gfan0.7/src/packedmonomial.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/packedmonomial.cpp 2024-08-13 10:50:25.380565573 -0600 @@ -18,7 +18,7 @@ vector minimized(vector temp(generators); - assert(0); + abort(); // sort(temp.begin(),temp.end()); /* g->sort(polynomialOrder(LexicographicTermOrder())); --- gfan0.7/src/parser.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/parser.cpp 2024-08-13 10:50:41.716366715 -0600 @@ -637,7 +637,7 @@ Field CharacterBasedParser::parseField() } parserError("field",c); - assert(0); + abort(); } --- gfan0.7/src/polyhedralfan.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/polyhedralfan.cpp 2024-08-13 10:51:08.061046009 -0600 @@ -1671,7 +1671,7 @@ PolyhedralCone PolyhedralFan::coneContai for(PolyhedralConeList::const_iterator i=cones.begin();i!=cones.end();i++) if(i->contains(v))return i->faceContaining(v); debug<<"Vector "< readIntList(istream &s) { list ret; int c=s.peek(); - while((c>='0') && (c<='9')|| (c==' ')) + while((c>='0' && c<='9')|| c==' ') { // fprintf(Stderr,"?\n"); int r; --- gfan0.7/src/symmetry.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/symmetry.cpp 2024-08-12 11:05:45.724320177 -0600 @@ -580,7 +580,7 @@ int SymmetryGroup::orbitSize(IntegerVect if(doesFix)numFixed++; } } - return groupSize/numFixed; + return (numFixed>0) ? groupSize/numFixed : 0; } --- gfan0.7/src/vektor.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/vektor.cpp 2024-08-12 13:37:34.017788560 -0600 @@ -96,17 +96,17 @@ int gcdGFAN(int r, int s) int gcdOfVector(IntegerVector const &v) { int ret=0; - for(int i=0;i #include #include #include @@ -14,8 +15,6 @@ using namespace std; //typedef signed long int int64; typedef int64_t int64; -void outOfRange(int i, int n); - /* * TODO: in the process of making gfan a library to be used by POLYMAKE etc. * we need to: @@ -80,7 +79,7 @@ public: template explicit Vektor(const Vektor& c) :v(c.size()) { - for(int i=0;i=0 && n=0 && (size_t)nq[i])p1[i]=q[i];return p1;} - friend Vektor coordinatewiseProduct(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1(q.size());for(int i=0;iq[i])p1[i]=q[i];return p1;} + friend Vektor coordinatewiseProduct(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1(q.size());for(size_t i=0;i0)if(q.v[i]0)&&(q[t]>0)) return false; + size_t n=p.size(); + for(size_t t=0;t0)&&(q[t]>0)) return false; return true; } Vektor supportVector()const { Vektor r(v.size()); - for(int i=0;i=0); - assert(end<=size()); + assert((size_t)end<=size()); assert(end>=begin); Vektor ret(end-begin); for(int i=0;i const &subset)const // Inverse of the above, except that unknown entries are set to zero. { Vektor ret(subset.size()); - int i=0; - for(int j=0;j const &positions) { Vektor ret(newSize); assert(positions.size()==size()); - for(int i=0;i0)==true)&1); + for(size_t i=0;i0)==true)&1); } }; --- gfan0.7/src/wallideal.cpp.orig 2024-08-12 10:00:15.000000000 -0600 +++ gfan0.7/src/wallideal.cpp 2024-08-12 13:30:10.087861417 -0600 @@ -951,7 +951,7 @@ bool fastIsFacet(IntegerVectorList const } - +*/ /* IntegerVector maxAttained(n); IntegerVector minAttained(n); for(IntegerVectorList::const_iterator k=tempNormals.begin();k!=tempNormals.end();k++)