Changeset adc0a4 in git


Ignore:
Timestamp:
Jun 19, 2013, 3:43:25 PM (11 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
10b169a45a513bb611a4166d85796ae81990344d
Parents:
593701c3d9a3d7851247b1e1603c209005e89f8e
Message:
chg: moved type_of_LIB for Singular/mod_lib.*
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • Singular/Makefile.am

    r593701 radc0a4  
    7878   minpoly.cc\
    7979   misc_ip.cc\
     80   mod_lib.cc\
    8081   links/ndbm.cc\
    8182   newstruct.cc\
     
    136137   misc_ip.h \
    137138   mmalloc.h \
     139   mod_lib.h \
    138140   omSingularConfig.h \
    139141   links/ndbm.h \
  • Singular/iparith.cc

    r593701 radc0a4  
    3131#include <polys/coeffrings.h>
    3232#include <polys/sparsmat.h>
    33 #include <polys/mod_raw.h>
     33#include <Singular/mod_lib.h>
    3434#include <polys/weight.h>
    3535
  • Singular/iplib.cc

    r593701 radc0a4  
    6060                         short nToktype, short nPos);
    6161
    62 #include <polys/mod_raw.h>
     62#include <Singular/mod_lib.h>
    6363
    6464#ifdef HAVE_LIBPARSER
  • libpolys/polys/mod_raw.cc

    r593701 radc0a4  
    3636#endif
    3737/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
    38 #define BYTES_TO_CHECK 7
    39 
    40 #define SI_BUILTIN_LIBSTR(name) (char*) #name ".so",
    41 
    42 char* si_builtin_libs[]={ SI_FOREACH_BUILTIN(SI_BUILTIN_LIBSTR)  NULL };
    43 
    44 #undef SI_BUILTIN_LIBSTR
    45 
    46 lib_types type_of_LIB(char *newlib, char *libnamebuf)
    47 {
    48   const unsigned char mach_o[]={0xfe,0xed,0xfa,0xce,0};
    49   const unsigned char mach_O[]={0xce,0xfa,0xed,0xfe,0};
    50 
    51   const unsigned char mach_o64[]={0xfe,0xed,0xfa,0xcf,0};
    52   const unsigned char mach_O64[]={0xcf,0xfa,0xed,0xfe,0};
    53 
    54   int i=0;
    55   while(si_builtin_libs[i]!=NULL)
    56   {
    57     if (strcmp(newlib,si_builtin_libs[i])==0)
    58     {
    59       if(libnamebuf!=NULL) strcpy(libnamebuf,newlib);
    60       return LT_BUILTIN;
    61     }
    62     i++;
    63   }
    64   char        buf[BYTES_TO_CHECK+1];        /* one extra for terminating '\0' */
    65   struct stat sb;
    66   int nbytes = 0;
    67   int ret;
    68   lib_types LT=LT_NONE;
    69 
    70   FILE * fp = feFopen( newlib, "r", libnamebuf, FALSE );
    71 
    72   do
    73   {
    74     ret = stat(libnamebuf, &sb);
    75   } while((ret < 0) and (errno == EINTR));
    76 
    77   if (fp==NULL)
    78   {
    79     return LT_NOTFOUND;
    80   }
    81   if((sb.st_mode & S_IFMT) != S_IFREG)
    82   {
    83     goto lib_type_end;
    84   }
    85   if ((nbytes = fread((char *)buf, sizeof(char), BYTES_TO_CHECK, fp)) == -1)
    86   {
    87     goto lib_type_end;
    88     /*NOTREACHED*/
    89   }
    90   if (nbytes == 0)
    91     goto lib_type_end;
    92   else
    93   {
    94     buf[nbytes++] = '\0';        /* null-terminate it */
    95   }
    96   if( (strncmp(buf, "\177ELF", 4)==0)) /* generic ELF */
    97   {
    98     LT = LT_ELF;
    99     //omFree(newlib);
    100     //newlib = omStrDup(libnamebuf);
    101     goto lib_type_end;
    102   }
    103 
    104   if( (strncmp(buf, (const char *)mach_o, 4)==0) || (strncmp(buf, (const char *)mach_O, 4)==0)) /* generic Mach-O module */
    105   {
    106     LT = LT_MACH_O;
    107     //omFree(newlib);
    108     //newlib = omStrDup(libnamebuf);
    109     goto lib_type_end;
    110   }
    111 
    112   if( (strncmp(buf, (const char *)mach_o64, 4)==0) || (strncmp(buf, (const char *)mach_O64, 4)==0)) /* generic Mach-O 64-bit module */
    113   {
    114     LT = LT_MACH_O;
    115     //omFree(newlib);
    116     //newlib = omStrDup(libnamebuf);
    117     goto lib_type_end;
    118   }
    119 
    120 
    121   if( (strncmp(buf, "\02\020\01\016\05\022@", 7)==0))
    122   {
    123     LT = LT_HPUX;
    124     //omFree(newlib);
    125     //newlib = omStrDup(libnamebuf);
    126     goto lib_type_end;
    127   }
    128   if(isprint(buf[0]) || buf[0]=='\n')
    129   { LT = LT_SINGULAR; goto lib_type_end; }
    130 
    131   lib_type_end:
    132   fclose(fp);
    133   return LT;
    134 }
    135 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
    13638#if defined(HAVE_DL)
    13739
  • libpolys/polys/mod_raw.h

    r593701 radc0a4  
    1 
    21#ifndef MOD_RAW_H
    32#define MOD_RAW_H
     
    1716typedef enum { LT_NONE, LT_NOTFOUND, LT_SINGULAR, LT_ELF, LT_HPUX, LT_MACH_O, LT_BUILTIN} lib_types;
    1817
    19 lib_types type_of_LIB(char *newlib, char *fullname);
    2018
    2119#if defined(HAVE_DL)
     
    4442
    4543
    46 #ifdef EMBED_PYTHON
    47 #define SI_BUILTIN_PYOBJECT(add) add(pyobject)
    48 #else
    49 #define SI_BUILTIN_PYOBJECT(add)
    50 #endif
    51 
    52 /// Data for @c type_of_LIB to determine built-in modules,
    53 /// use @c add(name) to add built-in library to macro
    54 #define SI_FOREACH_BUILTIN(add)\
    55   add(staticdemo)\
    56   SI_BUILTIN_PYOBJECT(add)
    57 
    58 #define SI_MOD_INIT(name) name##_mod_init
    59 
    6044#endif /* MOD_RAW_H */
Note: See TracChangeset for help on using the changeset viewer.