Changeset 30637f in git for Singular/febase.cc


Ignore:
Timestamp:
Apr 30, 1997, 7:08:40 PM (27 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
22d79069af63dd10b93e136d82bb339faa6c28d9
Parents:
6d3ffecde9449bcf2b3a7cceb254992ea1ef9e43
Message:
* hannes: feFopen search list: ., SINGULARPATH, SINGULARDATADIR


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

Legend:

Unmodified
Added
Removed
  • Singular/febase.cc

    r6d3ffec r30637f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: febase.cc,v 1.12 1997-04-30 15:25:27 Singular Exp $ */
     4/* $Id: febase.cc,v 1.13 1997-04-30 17:08:40 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    }
    3945  public:
    4046    int    v_lineno;        // lineno, to restore in recursion
     
    5056
    5157  void Next();
    52   Voices() { v_lineno = 1; }
     58  Voices() { Init(); }
    5359  Voices * VFile(char* fname);
    5460  Voices * Buffer(char* buf, int t);
     
    113119*/
    114120
    115 /*2 fopen, but use 'SINGULARPATH' from environment and SINGULARDATADIR
     121/*2
     122* fopen, but use 'SINGULARPATH' from environment and SINGULARDATADIR
    116123* as set by configure
    117 *  */
     124*/
    118125#ifdef macintosh
    119126#  define  FS_SEP ','
     
    141148{
    142149  if (where!=NULL) strcpy(where,path);
    143   if ((*mode=='a') ||(*mode=='w') || (path[0]==DIR_SEP)||(path[0]=='.'))
    144     return fopen(path,mode);
     150  FILE * f=fopen(path,mode);
     151  if ((*mode=='a') ||(*mode=='w') || (path[0]==DIR_SEP)||(path[0]=='.')
     152  ||(f!=NULL))
     153    return f;
    145154  char found = 0;
    146   FILE * f=NULL;
    147155#ifdef MSDOS
    148156  char *env=getenv("SPATH");
     
    189197    if (where!=NULL) strcpy(s/*where*/,path);
    190198    f=fopen(path,mode);
    191   }
     199  } 
    192200#ifndef macintosh
    193201  if (f==NULL)
     
    207215    }
    208216    strcpy(ss,SINGULAR_DATADIR);
    209     strcat(ss, DIR_SEPP);
     217    strcat(s, DIR_SEPP);
    210218    strcat(ss,path);
    211219    f=fopen(ss,mode);
     
    271279  v_echo     = si_echo;
    272280  fileVoice  = voice;
    273   yylineno   = v_lineno   = 1;
     281  yylineno   = 1;
    274282  if (files==NULL)
    275283  {
     
    313321
    314322  currentVoice = &FileAttribs[voice];
     323  currentVoice->Init();
    315324}
    316325
     
    455464int exitFile()
    456465{
    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   }
     466  int oldswitch;
     467
     468  while ((voice > 0) && (inputswitch > 0))
     469  {
     470    exitVoice();
     471  }
     472  // now we have left all if-, else-, while-, for-, proc-levels
     473  // inside this file;
     474  // if the file is the terminal (inputswitch == 0) and
     475  // voice >0, so return 1 else return 0
     476  // (used for EXIT_CMD in CNTRLC-C-handling)
     477  oldswitch = inputswitch;
     478  exitVoice();
     479  #ifdef SIC
     480  return 1;
     481  #else
     482  if ((oldswitch)||(myynest<0)) return 0;
     483  else return 1;
     484  #endif
    471485}
    472486
     
    587601void I_FEbase(void)
    588602{
    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];
     603  currentVoice = FileAttribs[0].VFile("STDIN");
    594604}
    595605
Note: See TracChangeset for help on using the changeset viewer.