[SCM] an open source computer algebra system branch, cleanedupstream, updated. 6125e540ca6d66c307958938a9d53b245507c323
Bernhard R. Link
brlink at debian.org
Tue Apr 24 15:53:17 UTC 2012
The following commit has been merged in the cleanedupstream branch:
commit da8f5ccd691d94c68eff976ff0282362487520ec
Author: Martin Lee <martinlee84 at web.de>
Date: Thu Feb 9 15:40:46 2012 +0100
chg: enable setting of gftables location by program
courtesy of "Grayson, Daniel R." <dan at math.uiuc.edu>
diff --git a/factory/gfops.cc b/factory/gfops.cc
index f6b83a9..dbc974b 100644
--- a/factory/gfops.cc
+++ b/factory/gfops.cc
@@ -61,6 +61,13 @@ static CanonicalForm intVec2CF ( int degree, int * coeffs, int level )
return result;
}
+static char *gftable_dir;
+extern "C" {
+ void set_gftable_dir(char *d){
+ gftable_dir = d;
+ }
+}
+
static void gf_get_table ( int p, int n )
{
char buffer[gf_maxbuffer];
@@ -91,14 +98,34 @@ static void gf_get_table ( int p, int n )
#endif
// try to open file
+ char *gffilename;
+ FILE * inputfile;
+ if (gftable_dir)
+ {
+ sprintf( buffer, "/gftable.%d.%d", p, n );
+ gffilename = (char *)malloc(strlen(gftable_dir) + strlen(buffer) + 1);
+ STICKYASSERT(gffilename,"out of memory");
+ strcpy(gffilename,gftable_dir);
+ strcat(gffilename,buffer);
+ inputfile = fopen( gffilename, "r" );
+ }
+ else
+ {
#ifndef SINGULAR
- sprintf( buffer, GFTABLEDIR "/gftable.%d.%d", p, n );
- FILE * inputfile = fopen( buffer, "r" );
+ sprintf( buffer, GFTABLEDIR "/gftable.%d.%d", p, n );
+ gffilename = buffer;
+ inputfile = fopen( buffer, "r" );
#else
- sprintf( buffer, "gftables/%d", q );
- FILE * inputfile = feFopen( buffer, "r" );
+ sprintf( buffer, "gftables/%d", q );
+ gffilename = buffer;
+ inputfile = feFopen( buffer, "r" );
#endif
- STICKYASSERT( inputfile, "can not open GF(q) table" );
+ }
+ if (!inputfile)
+ {
+ fprintf(stderr,"can not open GF(q) addition table: %s\n",gffilename);
+ STICKYASSERT(inputfile, "can not open GF(q) table");
+ }
// read ID
char * bufptr;
--
an open source computer algebra system
More information about the debian-science-commits
mailing list