Changeset 6d3ffec in git for Singular/febase.cc


Ignore:
Timestamp:
Apr 30, 1997, 5:25:34 PM (27 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
30637f47193073ce6445ef3c06828b2ec3d7d019
Parents:
01a20e5ae23d2ee1d178accd9cc46711ec2e30d1
Message:
* hannes: added Makefile to "touch -r mod2.h ...."


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

Legend:

Unmodified
Added
Removed
  • Singular/febase.cc

    r01a20e r6d3ffec  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: febase.cc,v 1.11 1997-04-29 19:54:48 obachman Exp $ */
     4/* $Id: febase.cc,v 1.12 1997-04-30 15:25:27 Singular Exp $ */
    55/*
    66* ABSTRACT: i/o system, handling of 'voices'
     
    3737class Voices
    3838{
    39   private:
    40     void Init()
    41     {
    42       memset(this,0,sizeof(*this));
    43       v_lineno = 1;
    44     }
    4539  public:
    4640    int    v_lineno;        // lineno, to restore in recursion
     
    5650
    5751  void Next();
    58   Voices() { Init(); }
     52  Voices() { v_lineno = 1; }
    5953  Voices * VFile(char* fname);
    6054  Voices * Buffer(char* buf, int t);
     
    7266int     levmax       = START_LEVMAX;
    7367Voices *currentVoice = NULL;
    74 Voices *FileAttribs  =(Voices *)Alloc(START_LEVMAX*sizeof(Voices));
     68Voices *FileAttribs  =(Voices *)Alloc0(START_LEVMAX*sizeof(Voices));
    7569short  *ifswitch     =(short *)Alloc0(START_LEVMAX*sizeof(short));
    7670        /*1 ifswitch==0: no if statement, else is invalid
     
    277271  v_echo     = si_echo;
    278272  fileVoice  = voice;
    279   yylineno   = 1;
     273  yylineno   = v_lineno   = 1;
    280274  if (files==NULL)
    281275  {
     
    299293                          levmax*sizeof(Voices),
    300294                          (levmax+16)*sizeof(Voices));
     295    memset(&FileAttribs[levmax],0,16*sizeof(Voices));
    301296    ifswitch=(short *)ReAlloc(ifswitch,
    302297                          levmax*sizeof(short),
     
    318313
    319314  currentVoice = &FileAttribs[voice];
    320   currentVoice->Init();
    321315}
    322316
     
    461455int exitFile()
    462456{
    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  }
    482471}
    483472
     
    598587void I_FEbase(void)
    599588{
    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];
    604594}
    605595
Note: See TracChangeset for help on using the changeset viewer.