Changeset 854405 in git
- Timestamp:
- Mar 26, 2012, 1:54:25 PM (11 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 131ab788024317fd3dc0c6dc15caa89df0976ad4
- Parents:
- a10fdfe4d442bc04f32d34fcfb152911e9097218
- Files:
-
- 1 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/fevoices.cc
ra10fdf r854405 27 27 #include <omalloc/omalloc.h> 28 28 #include <reporter/reporter.h> 29 #include <resources/feFopen.h>30 29 #include <misc/options.h> 31 30 -
Singular/mpsr_sl.cc
ra10fdf r854405 294 294 l->data = (void *) link; 295 295 fe_fgets_stdin=fe_fgets_dummy; 296 WerrorS_callback=WerrorS_batch; 296 297 singular_in_batchmode=TRUE; 297 298 //myynest=0; -
Singular/ssiLink.cc
ra10fdf r854405 784 784 //myynest=0; 785 785 fe_fgets_stdin=fe_fgets_dummy; 786 WerrorS_callback=WerrorS_batch; 786 787 if ((u!=NULL)&&(u->rtyp==IDHDL)) 787 788 { -
findexec/Makefile.am
ra10fdf r854405 16 16 INCLUDES = -I${top_srcdir} -I${top_builddir} 17 17 18 SOURCES = omFindExec.c feResource.cc 18 SOURCES = omFindExec.c feResource.cc feFopen.cc 19 19 libfindexec_la_SOURCES = $(SOURCES) 20 20 libfindexec_g_la_SOURCES = $(SOURCES) … … 22 22 libfindexec_includedir =$(includedir)/singular/findexec/ 23 23 24 libfindexec_include_HEADERS = omFindExec.h feResource.h 24 libfindexec_include_HEADERS = omFindExec.h feResource.h feFopen.h 25 25 26 26 -
kernel/febase.cc
ra10fdf r854405 27 27 #include <omalloc/omalloc.h> 28 28 #include <reporter/reporter.h> 29 #include <resources/feFopen.h>30 29 #include <misc/options.h> 31 30 -
kernel/febase.h
ra10fdf r854405 10 10 #include <reporter/reporter.h> 11 11 12 #include <resources/feFopen.h>13 12 #include <findexec/feResource.h> 14 13 -
kernel/feread.cc
ra10fdf r854405 27 27 #ifdef HAVE_STATIC 28 28 #undef HAVE_DYN_RL 29 #endif30 31 #ifdef ix86_Linux32 #undef HAVE_FEREAD33 // not compatible with glibc234 29 #endif 35 30 -
libpolys/coeffs/ffields.cc
ra10fdf r854405 15 15 16 16 #include <reporter/reporter.h> 17 #include <resources/feFopen.h>18 17 19 18 #include <coeffs/coeffs.h> -
libpolys/coeffs/gnumpc.cc
ra10fdf r854405 17 17 18 18 #include <reporter/reporter.h> 19 #include <resources/feFopen.h>20 19 21 20 #include <coeffs/coeffs.h> -
libpolys/polys/mod_raw.cc
ra10fdf r854405 25 25 26 26 #include <findexec/feResource.h> 27 #include <resources/feFopen.h>28 27 29 28 #include "mod_raw.h" -
libpolys/reporter/reporter.cc
ra10fdf r854405 22 22 #include <reporter/reporter.h> 23 23 #include <findexec/feResource.h> 24 #include <findexec/feFopen.h> 24 25 #include <omalloc/omalloc.h> 25 26 //#include "options.h" … … 37 38 static char * feBuffer=(char *)omAlloc(INITIAL_PRINT_BUFFER); 38 39 39 BOOLEAN errorreported = FALSE;40 40 char * feErrors=NULL; 41 41 int feErrorsLen=0; … … 43 43 BOOLEAN feOut = TRUE; 44 44 45 void (*WerrorS_callback)(const char *s) = NULL;45 //void (*WerrorS_callback)(const char *s) = NULL; 46 46 47 47 const char feNotImplemented[]="not implemented"; … … 147 147 #endif 148 148 149 extern "C" { 150 void WerrorS(const char *s) 151 { 152 #ifdef HAVE_MPSR 153 if (fe_fgets_stdin==fe_fgets_dummy) 154 { 155 if (feErrors==NULL) 156 { 157 feErrors=(char *)omAlloc(256); 158 feErrorsLen=256; 159 *feErrors = '\0'; 160 } 161 else 162 { 163 if (((int)(strlen((char *)s)+ 20 +strlen(feErrors)))>=feErrorsLen) 164 { 165 feErrors=(char *)omReallocSize(feErrors,feErrorsLen,feErrorsLen+256); 166 feErrorsLen+=256; 167 } 168 } 169 strcat(feErrors, "Singular error: "); 170 strcat(feErrors, (char *)s); 149 void WerrorS_batch(const char *s) 150 { 151 if (feErrors==NULL) 152 { 153 feErrors=(char *)omAlloc(256); 154 feErrorsLen=256; 155 *feErrors = '\0'; 171 156 } 172 157 else 173 #endif 174 { 175 #ifdef HAVE_TCL 176 if (tclmode) 177 { 178 PrintTCLS('E',(char *)s); 179 PrintTCLS('E',"\n"); 180 } 181 else 182 #endif 183 { 184 if (WerrorS_callback == NULL) 185 { 186 fwrite(" ? ",1,5,stderr); 187 fwrite((char *)s,1,strlen((char *)s),stderr); 188 fwrite("\n",1,1,stderr); 189 fflush(stderr); 190 } 191 else 192 { 193 WerrorS_callback(s); 194 } 195 if (feProt&PROT_O) 196 { 197 fwrite(" ? ",1,5,feProtFile); 198 fwrite((char *)s,1,strlen((char *)s),feProtFile); 199 fwrite("\n",1,1,feProtFile); 200 } 201 } 202 } 158 { 159 if (((int)(strlen((char *)s)+ 20 +strlen(feErrors)))>=feErrorsLen) 160 { 161 feErrors=(char *)omReallocSize(feErrors,feErrorsLen,feErrorsLen+256); 162 feErrorsLen+=256; 163 } 164 } 165 strcat(feErrors, "Singular error: "); 166 strcat(feErrors, (char *)s); 203 167 errorreported = TRUE; 204 #ifdef HAVE_FACTORY205 #ifdef HAVE_LIBFAC206 // libfac:207 extern int libfac_interruptflag;208 libfac_interruptflag=1;209 #endif210 #endif211 168 } 212 169 … … 248 205 } 249 206 } 250 } /* end extern "C" */251 207 252 208 void Warn(const char *fmt, ...) -
libpolys/reporter/reporter.h
ra10fdf r854405 10 10 #include <string.h> 11 11 #include <misc/auxiliary.h> 12 #include <findexec/feFopen.h> 12 13 13 14 extern char* feErrors; … … 18 19 extern int yy_noeof; 19 20 extern const char feNotImplemented[]; 20 extern BOOLEAN errorreported;21 21 extern int feProt; 22 22 extern BOOLEAN feWarn; … … 44 44 45 45 void Werror(const char *fmt, ...) __attribute__((format(printf,1,2))); 46 void WerrorS (const char *s);46 void WerrorS_batch(const char *s); 47 47 void WarnS(const char *s); 48 48 void Print(const char* fmt, ...) __attribute__((format(printf,1,2))); … … 81 81 { 82 82 #endif 83 extern void (*WerrorS_callback)(const char *s);84 83 extern int dReportError(const char* fmt, ...); 85 84 #define dReportBug(s) \ -
libpolys/resources/Makefile.am
ra10fdf r854405 16 16 INCLUDES = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/.. 17 17 18 SOURCES = feFopen.cc18 SOURCES = 19 19 libresources_la_SOURCES = $(SOURCES) 20 20 libresources_g_la_SOURCES = $(SOURCES) … … 22 22 libresources_includedir =$(includedir)/singular/resources 23 23 24 libresources_include_HEADERS = feFopen.h24 libresources_include_HEADERS = 25 25 26 26 -
libpolys/resources/feFopen.cc
ra10fdf r854405 1 #include <stdio.h>2 #include <stdlib.h>3 #include <string.h>4 #include <sys/types.h>5 #include <sys/stat.h>6 #include <unistd.h>7 8 #include "config.h"9 #include <misc/auxiliary.h>10 11 #include <reporter/reporter.h>12 13 #include "feFopen.h"14 #include <findexec/feResource.h>15 16 17 18 /*****************************************************************19 *20 * File handling21 *22 *****************************************************************/23 24 FILE * feFopen(const char *path, const char *mode, char *where,25 BOOLEAN useWerror, BOOLEAN path_only)26 {27 char longpath[MAXPATHLEN];28 if (path[0]=='~')29 {30 if (path[1] == DIR_SEP)31 {32 const char* home = getenv("HOME");33 #ifdef ix86_Win34 if ((home==NULL)||(!access(home,X_OK)))35 home = getenv("SINGHOME");36 #endif37 if (home != NULL)38 {39 strcpy(longpath, home);40 strcat(longpath, &(path[1]));41 path = longpath;42 }43 }44 #if defined(HAVE_PWD_H) && defined(HAVE_GETPWNAM)45 else46 {47 char* dir_sep;48 struct passwd *pw_entry;49 strcpy (longpath, path);50 dir_sep = strchr(longpath, DIR_SEP);51 if (dir_sep==NULL)52 {53 Werror(" illegal ~ in filename >>%s<<",longpath);54 return NULL;55 }56 *dir_sep = '\0';57 pw_entry = getpwnam(&longpath[1]);58 if (pw_entry != NULL)59 {60 strcpy(longpath, pw_entry->pw_dir);61 dir_sep = strchr((char *)path, DIR_SEP);62 strcat(longpath, dir_sep);63 path = longpath;64 }65 }66 #endif67 }68 FILE * f=NULL;69 if (! path_only)70 {71 struct stat statbuf;72 if ((stat(path,&statbuf)==0)73 && (S_ISREG(statbuf.st_mode)))74 f = myfopen(path,mode);75 }76 if (where!=NULL) strcpy(where,path);77 if ((*mode=='r') &&78 (path[0]!=DIR_SEP) &&79 ! (path[0] == '.' && path[1] == DIR_SEP) &&80 (f==NULL))81 {82 char found = 0;83 char* spath = feResource('s');84 char *s;85 86 if (where==NULL) s=(char *)malloc(1024);87 else s=where;88 89 if (spath!=NULL)90 {91 char *p,*q;92 p = spath;93 while( (q=strchr(p, fePathSep)) != NULL)94 {95 *q = '\0';96 strcpy(s,p);97 *q = fePathSep;98 strcat(s, DIR_SEPP);99 strcat(s, path);100 if(!access(s, R_OK)) { found++; break; }101 p = q+1;102 }103 if(!found)104 {105 strcpy(s,p);106 strcat(s, DIR_SEPP);107 strcat(s, path);108 }109 f=myfopen(s,mode);110 if (f!=NULL)111 {112 if (where==NULL) free((ADDRESS)s);113 return f;114 }115 }116 else117 {118 if (where!=NULL) strcpy(s/*where*/,path);119 f=myfopen(path,mode);120 }121 if (where==NULL) free((ADDRESS)s);122 }123 if ((f==NULL)&&(useWerror))124 Werror("cannot open `%s`",path);125 return f;126 }127 128 FILE * feFopen(const char *path, const char *mode)129 {130 return feFopen (path, mode, 0,0,0);131 }132 133 // Make sure that mode contains binary option134 FILE* myfopen(const char *path, const char *mode)135 {136 #if (defined(CYGWIN) || defined(ix86_Win))137 char mmode[4];138 int i;139 int done = 0;140 141 for (i=0;;i++)142 {143 mmode[i] = mode[i];144 if (mode[i] == '\0') break;145 if (mode[i] == 'w') done = 1;146 if (mode[i] == 'a') done = 1;147 if (mode[i] == 'b') done = 1;148 }149 150 if (! done)151 {152 mmode[i] = 'b';153 mmode[i+1] = '\0';154 }155 return fopen(path, mmode);156 #else157 return fopen(path, mode);158 #endif159 }160 // replace "\r\n" by " \n" and "\r" by "\n"161 162 size_t myfread(void *ptr, size_t size, size_t nmemb, FILE *stream)163 {164 size_t got = fread(ptr, size, nmemb, stream) * size;165 size_t i;166 167 for (i=0; i<got; i++)168 {169 if ( ((char*) ptr)[i] == '\r')170 {171 if (i+1 < got && ((char*) ptr)[i+1] == '\n')172 ((char*) ptr)[i] = ' ';173 else174 ((char*) ptr)[i] = '\n';175 }176 }177 return got;178 }
Note: See TracChangeset
for help on using the changeset viewer.