Changeset 6d3ffec in git for Singular/febase.cc
- Timestamp:
- Apr 30, 1997, 5:25:34 PM (27 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 30637f47193073ce6445ef3c06828b2ec3d7d019
- Parents:
- 01a20e5ae23d2ee1d178accd9cc46711ec2e30d1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/febase.cc
r01a20e r6d3ffec 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: febase.cc,v 1.1 1 1997-04-29 19:54:48 obachmanExp $ */4 /* $Id: febase.cc,v 1.12 1997-04-30 15:25:27 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: i/o system, handling of 'voices' … … 37 37 class Voices 38 38 { 39 private:40 void Init()41 {42 memset(this,0,sizeof(*this));43 v_lineno = 1;44 }45 39 public: 46 40 int v_lineno; // lineno, to restore in recursion … … 56 50 57 51 void Next(); 58 Voices() { Init(); }52 Voices() { v_lineno = 1; } 59 53 Voices * VFile(char* fname); 60 54 Voices * Buffer(char* buf, int t); … … 72 66 int levmax = START_LEVMAX; 73 67 Voices *currentVoice = NULL; 74 Voices *FileAttribs =(Voices *)Alloc (START_LEVMAX*sizeof(Voices));68 Voices *FileAttribs =(Voices *)Alloc0(START_LEVMAX*sizeof(Voices)); 75 69 short *ifswitch =(short *)Alloc0(START_LEVMAX*sizeof(short)); 76 70 /*1 ifswitch==0: no if statement, else is invalid … … 277 271 v_echo = si_echo; 278 272 fileVoice = voice; 279 yylineno = 1;273 yylineno = v_lineno = 1; 280 274 if (files==NULL) 281 275 { … … 299 293 levmax*sizeof(Voices), 300 294 (levmax+16)*sizeof(Voices)); 295 memset(&FileAttribs[levmax],0,16*sizeof(Voices)); 301 296 ifswitch=(short *)ReAlloc(ifswitch, 302 297 levmax*sizeof(short), … … 318 313 319 314 currentVoice = &FileAttribs[voice]; 320 currentVoice->Init();321 315 } 322 316 … … 461 455 int exitFile() 462 456 { 463 int oldswitch; 464 465 while ((voice > 0) && (inputswitch > 0)) 466 { 467 exitVoice(); 468 } 469 // now we have left all if-, else-, while-, for-, proc-levels 470 // inside this file; 471 // if the file is the terminal (inputswitch == 0) and 472 // voice >0, so return 1 else return 0 473 // (used for EXIT_CMD in CNTRLC-C-handling) 474 oldswitch = inputswitch; 475 exitVoice(); 476 #ifdef SIC 477 return 1; 478 #else 479 if ((oldswitch)||(myynest<0)) return 0; 480 else return 1; 481 #endif 457 /*4 first check for valid buffer type*/ 458 for (int i=voice; i>0; i--) 459 { 460 if (FileAttribs[i].typ == 0) break; 461 if (FileAttribs[i].typ == BT_file) 462 { 463 while ((BT_file != currentVoice->typ) 464 && (voice > 0)) 465 { 466 exitVoice(); 467 } 468 exitVoice(); 469 } 470 } 482 471 } 483 472 … … 598 587 void I_FEbase(void) 599 588 { 600 FileAttribs[0].files = yyin = stdin; 601 FileAttribs[0].filename = mstrdup("STDIN"); 602 yylineno = 1; 603 currentVoice = &FileAttribs[0]; 589 currentVoice=FileAttribs[0].VFile("STDIN"); 590 //FileAttribs[0].files = yyin = stdin; 591 //FileAttribs[0].filename = mstrdup("STDIN"); 592 //yylineno = 1; 593 //currentVoice = &FileAttribs[0]; 604 594 } 605 595
Note: See TracChangeset
for help on using the changeset viewer.