Changeset 83976e in git


Ignore:
Timestamp:
Feb 10, 2012, 2:20:06 PM (11 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
26acab557e4ad73e2c8ba02fa1ad998773365fff
Parents:
66e25f2bbb3969a1769c9710fee12d7ca6262dd7
git-author:
Martin Lee <martinlee84@web.de>2012-02-10 14:20:06+01:00
git-committer:
Martin Lee <martinlee84@web.de>2012-02-17 15:45:14+01:00
Message:
chg: enable setting of gftables location by program

courtesy of "Grayson, Daniel R." <dan@math.uiuc.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/gfops.cc

    r66e25f r83976e  
    6464}
    6565
     66static char *gftable_dir;
     67extern "C" {
     68  void set_gftable_dir(char *d){
     69    gftable_dir = d;
     70  }
     71}
     72
    6673static void gf_get_table ( int p, int n )
    6774{
     
    94101
    95102    // try to open file
     103    char *gffilename;
     104    FILE * inputfile;
     105    if (gftable_dir)
     106    {
     107      sprintf( buffer, "/gftable.%d.%d", p, n );
     108      gffilename = (char *)malloc(strlen(gftable_dir) + strlen(buffer) + 1);
     109      STICKYASSERT(gffilename,"out of memory");
     110      strcpy(gffilename,gftable_dir);
     111      strcat(gffilename,buffer);
     112      inputfile = fopen( gffilename, "r" );
     113    }
     114    else
     115    {
    96116#ifndef SINGULAR
    97     sprintf( buffer, GFTABLEDIR "/%d", q);
    98     FILE * inputfile = fopen( buffer, "r" );
     117      sprintf( buffer, GFTABLEDIR "/gftable.%d.%d", p, n );
     118      gffilename = buffer;
     119      inputfile = fopen( buffer, "r" );
    99120#else
    100     int check= sprintf( buffer, "gftables/%d", q );
    101     FILE * inputfile = feFopen( buffer, "r" );
     121      sprintf( buffer, "gftables/%d", q );
     122      gffilename = buffer;
     123      inputfile = feFopen( buffer, "r" );
    102124#endif
    103     STICKYASSERT( inputfile, "can not open GF(q) table" );
     125    }
     126    if (!inputfile)
     127    {
     128      fprintf(stderr,"can not open GF(q) addition table: %s\n",gffilename);
     129      STICKYASSERT(inputfile, "can not open GF(q) table");
     130    }
    104131
    105132    // read ID
Note: See TracChangeset for help on using the changeset viewer.