Changeset cc94b0a in git for Singular/febase.inc


Ignore:
Timestamp:
Mar 31, 1998, 11:00:50 AM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
bc82d60fa171675a0c23a3e2051318500187aa39
Parents:
c9ea817ef59b4d9f8adaa507840ddb8ff4d4a945
Message:
Tue Mar 31 10:47:06 MET DST 1998 hannes
        * feread.cc: fixed handling of empty history
	* clapsing.cc: fixed gcd(0,..) and gcd(..,0) -> pOne()
	* febase.h/febase.inc: renaming of scanner variables
	  ( yy_blocklineno, yy_noeof)
	* febase.inc: increased speed in feReadLine
	* minor changes in scanner/grammar/iparith.cc (example)


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

Legend:

Unmodified
Added
Removed
  • Singular/febase.inc

    rc9ea817 rcc94b0a  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: febase.inc,v 1.4 1998-03-02 15:22:48 Singular Exp $ */
     4/* $Id: febase.inc,v 1.5 1998-03-31 09:00:42 Singular Exp $ */
    55/*
    66* ABSTRACT: handling of 'voices'
    77*/
    8 
    9 extern int noeof;
    10 int blocklineno;     // to get the lineno of the block start from scanner
     8#include <ctype.h>
     9
     10int    yy_noeof=0;     // the scanner "state"
     11int    yy_blocklineno; // to get the lineno of the block start from scanner
    1112Voice  *currentVoice = NULL;
    12 FILE *feFilePending; /*temp. storage for grammar.y */
     13FILE   *feFilePending; /*temp. storage for grammar.y */
    1314
    1415static char * BT_name[]={"BT_none","BT_break","BT_proc","BT_example",
     
    153154    case BT_if:
    154155    case BT_else:
    155                      yylineno = blocklineno;
     156                     yylineno = yy_blocklineno;
    156157                     break;
    157158    case BT_break:
    158                      yylineno = blocklineno-1;
     159                     yylineno = yy_blocklineno-1;
    159160                     break;
    160161    //case BT_file:
     
    320321    else
    321322    {
    322       currentVoice->prev->ifsw=BI_stdin;
     323      currentVoice->prev->ifsw=0;
    323324    }
    324325    if ((currentVoice->sw == BI_file)
     
    432433{
    433434  // try to read from the buffer:
    434   b[1] = '\0';
     435  // b[1] = '\0';
    435436  if ((currentVoice->buffer!=NULL)
    436437  && (currentVoice->buffer[currentVoice->fptr]!='\0'))
    437438  {
    438439NewBuff:
    439     b[0]=currentVoice->buffer[currentVoice->fptr];
     440    int i=0;
     441    int startfptr=currentVoice->fptr;
     442    l--;
     443    loop
     444    {
     445      char c=
     446      b[i]=currentVoice->buffer[currentVoice->fptr];
     447      i++;
     448      if ((c<' ')
     449      || (c==';')
     450      //|| (c=='(')
     451      || (c==')')
     452      || (c=='}')
     453      || (c=='"')
     454      || (c=='$')) break;
     455      if (i>=l) break;
     456      currentVoice->fptr++;
     457      if(currentVoice->buffer[currentVoice->fptr]=='\0') break;
     458    }
     459    //b[0]=currentVoice->buffer[currentVoice->fptr];
     460    b[i]='\0';
     461    //b[1]='\0';
    440462    if (currentVoice->sw==BI_buffer)
    441463    {
    442       if (currentVoice->fptr==0)
     464      //if (currentVoice->fptr==0)
     465      if (startfptr==0)
    443466      {
    444467        char *anf=currentVoice->buffer;
     
    453476        FreeL((ADDRESS)s);
    454477      }
    455       else if (/*(currentVoice->fptr>0) &&*/
    456       (currentVoice->buffer[currentVoice->fptr-1]=='\n'))
     478      //else if (/*(currentVoice->fptr>0) &&*/
     479      //(currentVoice->buffer[currentVoice->fptr-1]=='\n'))
     480      else if (/*(startfptr>0) &&*/
     481      (currentVoice->buffer[startfptr-1]=='\n'))
    457482      {
    458         char *anf=currentVoice->buffer+currentVoice->fptr;
     483        //char *anf=currentVoice->buffer+currentVoice->fptr;
     484        char *anf=currentVoice->buffer+startfptr;
    459485        char *ss=strchr(anf,'\n');
    460486        int len;
     
    470496    }
    471497    currentVoice->fptr++;
    472     return 1;
     498    return i;
     499    //return 1;
    473500  }
    474501  // no buffer there or e-o-buffer or eoln:
     
    514541  /* else if (s==NULL) */
    515542  {
    516     switch(noeof)
     543    switch(yy_noeof)
    517544    {
    518545      case 0:
Note: See TracChangeset for help on using the changeset viewer.