Changeset e5db0a in git for Singular/extra.cc


Ignore:
Timestamp:
Sep 3, 2010, 11:21:59 AM (14 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
e128fda56ac773be45f4a851d82371ff728c25a9
Parents:
5e016e27b98b70a42edca584335f57145f3a8dc0
Message:
extra command "GNUmpLoad" to load bigint from file with digits to the base 10

git-svn-id: file:///usr/local/Singular/svn/trunk@13155 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/extra.cc

    r5e016e re5db0a  
    1515#include <signal.h>
    1616#include <Singular/mod2.h>
     17#include <misc_ip.h>
    1718
    1819#ifdef TIME_WITH_SYS_TIME
     
    606607        return FALSE;
    607608      }
     609  /*==================== mpz_t loader ======================*/
     610      if(strcmp(sys_cmd, "GNUmpLoad")==0)
     611      {
     612        if ((h != NULL) && (h->Typ() == STRING_CMD))
     613        {
     614          char* filename = (char*)h->Data();
     615          FILE* f = fopen(filename, "r");                         printf("check 1\n");
     616          if (f == NULL)
     617          {
     618            Werror( "invalid file name (in paths use '/')");
     619            return FALSE;
     620          }                                                       printf("check 2\n");
     621          mpz_t m; mpz_init(m);                                   printf("check 3\n");
     622          mpz_inp_str(m, f, 10);                                  printf("check 4\n");
     623          fclose(f);                                              printf("check 5\n");
     624          number n = mpz2number(m);                               printf("check 6\n");
     625          res->rtyp = BIGINT_CMD;
     626          res->data = (void*)n;
     627          return FALSE;
     628        }
     629        else
     630        {
     631          Werror( "expected valid file name as a string");
     632          return FALSE;
     633        }
     634      }
    608635  /*==================== neworder =============================*/
    609636  // should go below
Note: See TracChangeset for help on using the changeset viewer.