Changeset d5f35ac in git
- Timestamp:
- Apr 27, 1998, 2:34:22 PM (25 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 52d073b058c2293d5f5aaa2eea8ff1478ba294b8
- Parents:
- 2e5cd04618ebbbd75f9a6282e19d900d77239f80
- Location:
- Singular
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ChangeLog
r2e5cd0 rd5f35ac 1 1998-04-27 Olaf Bachmann <obachman@mathematik.uni-kl.de> 2 3 * febase.cc (myfread): introduced myfread and myfopen which assure 4 that newlines in text files are always \n 5 1 6 Fri Apr 24 19:14:42 1998 Jens Schmidt <schmidt@mathematik.uni-kl.de> 2 7 … … 67 72 * fixed a minor but very nasty bug: nlSetMap was resetting npPrimeM 68 73 (longrat.cc) 74 75 1998-04-21 Olaf Bachmann <obachman@mathematik.uni-kl.de> 76 77 * mmprivat.h: Got rid off mmheap.cc, "inlined" mmPutMemory 78 79 * longalg.h: Exponents in parameter (polys) are typedef'ed to 80 EXPONENT_TYPE 81 82 1998-04-20 Olaf Bachmann <obachman@mathematik.uni-kl.de> 83 84 * mmallocb.c: Merged with mmheap.c. 69 85 70 86 1998-04-16 Olaf Bachmann <obachman@mathematik.uni-kl.de> -
Singular/extra.cc
r2e5cd0 rd5f35ac 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.4 0 1998-04-24 17:19:04 schmidtExp $ */4 /* $Id: extra.cc,v 1.41 1998-04-27 12:34:11 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 280 280 { 281 281 res->data = (void*) val; 282 if (( int) val > 1)282 if ((unsigned int) val > 1) 283 283 { 284 284 res->rtyp=STRING_CMD; … … 437 437 else 438 438 #endif 439 /*==================== writemat ==================================*/440 // if(strcmp((char*)(h->Data()),"writemat")==0)441 // {442 // if (h->next!=NULL)443 // {444 // leftv v=h->next;445 // if (v->Typ() == STRING_CMD)446 // {447 // char *filename = (char *)v->Data();448 // v = v->next;449 // if (v->Typ()==MATRIX_CMD)450 // {451 // FILE *outfile = fopen(filename,"a");452 // if (outfile==NULL)453 // {454 // Werror("cannot write to file %s",filename);455 // return TRUE;456 // }457 // matrix m=(matrix)v->Data();458 // fprintf(outfile,"%d\n%d\n",MATROWS(m),MATCOLS(m));459 // char *s = iiStringMatrix(m,2);460 // fprintf(outfile,"%s\n",s);461 // FreeL((ADDRESS)s);462 // fclose(outfile);463 // return FALSE;464 // }465 // else466 // {467 // WerrorS("matrix expected");468 // }469 // }470 // else471 // {472 // WerrorS("string expected");473 // }474 // }475 // else476 // WerrorS("matrix expected");477 // }478 // else479 439 #ifdef HAVE_FACTORY 480 440 /*==================== pdivide ====================*/ -
Singular/febase.cc
r2e5cd0 rd5f35ac 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: febase.cc,v 1.3 1 1998-04-23 18:52:48 SingularExp $ */4 /* $Id: febase.cc,v 1.32 1998-04-27 12:34:12 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: i/o system … … 23 23 #include "subexpr.h" 24 24 #include "ipshell.h" 25 25 26 26 27 #define fePutChar(c) fputc((uchar)(c),stdout) … … 211 212 FILE * feFopen(char *path, char *mode, char *where,int useWerror) 212 213 { 213 FILE * f= fopen(path,mode);214 FILE * f=myfopen(path,mode); 214 215 #ifdef macintosh 215 216 if (f!=NULL) … … 240 241 memcpy(res+ienv,path,ipath); 241 242 res[ienv+ipath]='\0'; 242 f= fopen(res,mode);243 f=myfopen(res,mode); 243 244 } 244 245 if ((f==NULL)&&(idat!=0)) … … 247 248 memcpy(res+idat,path,ipath); 248 249 res[idat+ipath]='\0'; 249 f= fopen(res,mode);250 f=myfopen(res,mode); 250 251 } 251 252 if (f==NULL) … … 283 284 if(!access(s, R_OK)) { found++; break; } 284 285 #else 285 f= fopen(s,mode);286 f=myfopen(s,mode); 286 287 if (f!=NULL) { found++; fclose(f); break; } 287 288 #endif … … 294 295 strcat(s, path); 295 296 } 296 f= fopen(s,mode);297 f=myfopen(s,mode); 297 298 if (f!=NULL) 298 299 { … … 304 305 { 305 306 if (where!=NULL) strcpy(s/*where*/,path); 306 f= fopen(path,mode);307 f=myfopen(path,mode); 307 308 } 308 309 if (where==NULL) FreeL((ADDRESS)s); … … 631 632 if ((s!=NULL) && (*s!='\0')) 632 633 { 633 feProtFile = fopen(s,"w");634 feProtFile = myfopen(s,"w"); 634 635 if (feProtFile==NULL) 635 636 { … … 667 668 } 668 669 670 #ifndef unix 671 // Make sure that mode contains binary option 672 FILE *myfopen(char *path, char *mode) 673 { 674 char mmode[4]; 675 int i; 676 BOOLEAN done = FALSE; 677 678 for (i=0;;i++) 679 { 680 mmode[i] = mode[i]; 681 if (mode[i] == '\0') break; 682 if (mode[i] == 'b') done = TRUE; 683 } 684 685 if (! done) 686 { 687 mmode[i] = 'b'; 688 mmode[i+1] = '\0'; 689 } 690 return fopen(path, mmode); 691 } 692 #endif 693 694 // replace "\r\n" by " \n" and "\r" by "\n" 695 696 size_t myfread(void *ptr, size_t size, size_t nmemb, FILE *stream) 697 { 698 size_t got = fread(ptr, size, nmemb, stream) * size; 699 size_t i; 700 701 for (i=0; i<got; i++) 702 { 703 if ( ((char*) ptr)[i] == '\r') 704 { 705 if (i+1 < got && ((char*) ptr)[i+1] == '\n') 706 ((char*) ptr)[i] = ' '; 707 else 708 ((char*) ptr)[i] = '\n'; 709 } 710 } 711 return got; 712 } 713 714 715 -
Singular/febase.h
r2e5cd0 rd5f35ac 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: febase.h,v 1.1 4 1998-04-23 18:52:49 SingularExp $ */6 /* $Id: febase.h,v 1.15 1998-04-27 12:34:13 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT … … 11 11 #include <string.h> 12 12 #include "structs.h" 13 14 15 // These are our versions of fopen and fread They are very similar to 16 // the usual fopen and fread, except that on reading, they always 17 // convert "\r\n" into " \n" and "\r" into "\n". 18 // 19 // IMPORTANT: do only use myfopen and myfread when reading text, 20 // do never use fopen and fread 21 #ifndef unix 22 extern FILE *myfopen(char *path, char *mode); 23 #else 24 #define myfopen fopen 25 #endif 26 extern size_t myfread(void *ptr, size_t size, size_t nmemb, FILE *stream); 13 27 14 28 extern char* feErrors; -
Singular/feread.cc
r2e5cd0 rd5f35ac 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: feread.cc,v 1. 9 1998-03-31 09:00:40 SingularExp $ */4 /* $Id: feread.cc,v 1.10 1998-04-27 12:34:14 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: input from ttys, simulating fgets … … 226 226 fe_stdout_is_tty=0; 227 227 #ifdef atarist 228 fe_echo = fopen( "/dev/tty", "w" );229 #else 230 fe_echo = fopen( ttyname(fileno(stdin)), "w" );228 fe_echo = myfopen( "/dev/tty", "w" ); 229 #else 230 fe_echo = myfopen( ttyname(fileno(stdin)), "w" ); 231 231 #endif 232 232 } … … 661 661 { 662 662 #ifdef atarist 663 rl_outstream = fopen( "/dev/tty", "w" );664 #else 665 rl_outstream = fopen( ttyname(fileno(stdin)), "w" );663 rl_outstream = myfopen( "/dev/tty", "w" ); 664 #else 665 rl_outstream = myfopen( ttyname(fileno(stdin)), "w" ); 666 666 #endif 667 667 } -
Singular/iparith.cc
r2e5cd0 rd5f35ac 4290 4290 void ttGen1() 4291 4291 { 4292 FILE *outfile = fopen("iparith.inc","w");4292 FILE *outfile = myfopen("iparith.inc","w"); 4293 4293 int i,j,l1=0,l2=0; 4294 4294 currRing=(ring)Alloc(sizeof(*currRing)); … … 4448 4448 void ttGen2() 4449 4449 { 4450 FILE *outfile = fopen("iparith.inc","a");4450 FILE *outfile = myfopen("iparith.inc","a"); 4451 4451 fprintf(outfile, 4452 4452 "/****************************************\n" … … 4576 4576 void ttGen3() 4577 4577 { 4578 FILE *outfile = fopen("mpsr_tok.inc","w");4578 FILE *outfile = myfopen("mpsr_tok.inc","w"); 4579 4579 fprintf(outfile, 4580 4580 "/****************************************\n" -
Singular/iplib.cc
r2e5cd0 rd5f35ac 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: iplib.cc,v 1. 19 1998-04-22 10:37:44 kruegerExp $ */4 /* $Id: iplib.cc,v 1.20 1998-04-27 12:34:16 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: interpreter: LIB and help … … 144 144 // pi->data.s.proc_start, procbuflen); 145 145 s = (char *)AllocL(procbuflen); 146 fread(s, procbuflen, 1, fp);146 myfread(s, procbuflen, 1, fp); 147 147 s[procbuflen] = '\0'; 148 148 return(s); … … 152 152 procbuflen = pi->data.s.def_end - pi->data.s.proc_start; 153 153 //fgets(buf, sizeof(buf), fp); 154 fread( buf, procbuflen, 1, fp);154 myfread( buf, procbuflen, 1, fp); 155 155 char ct; 156 156 char *e; … … 171 171 fseek(fp, pi->data.s.body_start, SEEK_SET); 172 172 strcpy(pi->data.s.body,argstr); 173 fread( pi->data.s.body+strlen(argstr), procbuflen, 1, fp);173 myfread( pi->data.s.body+strlen(argstr), procbuflen, 1, fp); 174 174 procbuflen+=strlen(argstr); 175 175 FreeL(argstr); … … 190 190 // pi->data.s.example_start, procbuflen); 191 191 s = (char *)AllocL(procbuflen+14); 192 fread(s, procbuflen, 1, fp);192 myfread(s, procbuflen, 1, fp); 193 193 s[procbuflen] = '\0'; 194 194 strcat(s+procbuflen-3, "\n;return();\n\n" ); -
Singular/libparse.l
r2e5cd0 rd5f35ac 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 /* $Id: libparse.l,v 1.1 1 1998-04-27 10:55:55 SingularExp $ */5 /* $Id: libparse.l,v 1.12 1998-04-27 12:34:18 obachman Exp $ */ 6 6 #include <stdio.h> 7 7 #include <string.h> … … 571 571 572 572 offset = ftell(f); 573 rc = fread( buf, 1, max_size, f );573 rc = myfread( buf, 1, max_size, f ); 574 574 #if YYLPDEBUG >2 575 575 printf("fread: %d of %d\n", rc, max_size); … … 634 634 text_buffer = (char *)AllocL(len+1); 635 635 text_buffer[len]='\0'; 636 fread(text_buffer, len, 1, yylpin);636 myfread(text_buffer, len, 1, yylpin); 637 637 fseek(yylpin, current_location, SEEK_SET); 638 638 } … … 663 663 ++argv, --argc; /* skip over program name */ 664 664 if ( argc > 0 ) 665 yyin = fopen( argv[0], "rb" );665 yyin = myfopen( argv[0], "rb" ); 666 666 else 667 667 yyin = stdin; -
Singular/mpsr_Tok.cc
r2e5cd0 rd5f35ac 3 3 ****************************************/ 4 4 5 /* $Id: mpsr_Tok.cc,v 1.1 1 1998-04-01 18:56:30 SingularExp $ */5 /* $Id: mpsr_Tok.cc,v 1.12 1998-04-27 12:34:19 obachman Exp $ */ 6 6 7 7 /*************************************************************** … … 514 514 515 515 // Generate the template file 516 outfile = fopen("mpsr_Tok.inc", "w");516 outfile = myfopen("mpsr_Tok.inc", "w"); 517 517 if (outfile == NULL) 518 518 { … … 582 582 system("touch mpsr_Tok.inc"); 583 583 #else 584 FILE fd = fopen("mpsr_Tok.inc", "w");584 FILE fd = myfopen("mpsr_Tok.inc", "w"); 585 585 close(fd); 586 586 #endif -
Singular/silink.cc
r2e5cd0 rd5f35ac 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: silink.cc,v 1.1 6 1998-04-07 18:35:27obachman Exp $ */4 /* $Id: silink.cc,v 1.17 1998-04-27 12:34:21 obachman Exp $ */ 5 5 6 6 /* … … 394 394 if (BVERBOSE(V_READING)) 395 395 Print("//Reading %d chars\n",len); 396 fread( buf, len, 1, fp);396 myfread( buf, len, 1, fp); 397 397 buf[len]='\0'; 398 398 } -
Singular/utils.cc
r2e5cd0 rd5f35ac 44 44 printpi(procinfov pi) 45 45 { 46 FILE *fp = fopen( pi->libname, "rb");46 FILE *fp = mfopen( pi->libname, "rb"); 47 47 char *buf, name[256]; 48 48 int len1, len2; … … 67 67 buf = (char *)malloc(len1 + len2 + 1); 68 68 fseek(fp, pi->data.s.proc_start, SEEK_SET); 69 fread( buf, len1, 1, fp);69 mfread( buf, len1, 1, fp); 70 70 *(buf+len1) = '\n'; 71 71 fseek(fp, pi->data.s.body_start, SEEK_SET); 72 fread( buf+len1+1, len2, 1, fp);72 mfread( buf+len1+1, len2, 1, fp); 73 73 *(buf+len1+len2+1)='\0'; 74 74 printf("##BODY:'%s'##\n", buf); … … 80 80 buf = (char *)malloc(len1+1); 81 81 fseek(fp, pi->data.s.proc_start, SEEK_SET); 82 fread( buf, len1, 1, fp);82 mfread( buf, len1, 1, fp); 83 83 *(buf+len1)='\0'; 84 84 printf("##HELP:'%s'##\n", buf);
Note: See TracChangeset
for help on using the changeset viewer.