Changeset 15ca85 in git for Singular/fevoices.cc


Ignore:
Timestamp:
Oct 26, 2017, 5:23:31 PM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
Children:
d779ed4fd5d9854632a2afc7075d8b0066c9402f
Parents:
71e2bd7ba0cdb5092b01012d7067e04d08d3b8ed
Message:
opt: simplification in feReadLine
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/fevoices.cc

    r71e2bd r15ca85  
    3838FILE *File_Profiling=NULL;
    3939
    40 // output/print buffer:
    41 #define INITIAL_PRINT_BUFFER 24*1024L
    4240// line buffer for reading:
    4341// minimal value for MAX_FILE_BUFFER: 4*4096 - see Tst/Long/gcd0_l.tst
    4442// this is an upper limit for the size of monomials/numbers read via the interpreter
    4543#define MAX_FILE_BUFFER 4*4096
    46 // static long feBufferLength=INITIAL_PRINT_BUFFER;
    47 //static char * feBuffer=(char *)omAlloc(INITIAL_PRINT_BUFFER);
    4844
    4945/**************************************************************************
     
    538534      if (currentVoice->sw==BI_buffer)
    539535      {
     536        BOOLEAN show_echo=FALSE;
     537        char *anf;
     538        long len;
    540539        if (startfptr==0)
    541540        {
    542           char *anf=currentVoice->buffer;
     541          anf=currentVoice->buffer;
    543542          const char *ss=strchr(anf,'\n');
    544           long len;
    545543          if (ss==NULL) len=strlen(anf);
    546544          else          len=ss-anf;
     545          show_echo=TRUE;
     546        }
     547        else if (/*(startfptr>0) &&*/
     548        (currentVoice->buffer[startfptr-1]=='\n'))
     549        {
     550          anf=currentVoice->buffer+startfptr;
     551          const char *ss=strchr(anf,'\n');
     552          if (ss==NULL) len=strlen(anf);
     553          else          len=ss-anf;
     554          show_echo=TRUE;
     555          yylineno++;
     556        }
     557        if (show_echo)
     558        {
    547559          char *s=(char *)omAlloc(len+2);
    548560          strncpy(s,anf,len+2);
    549561          s[len+1]='\0';
    550           fePrintEcho(s,b);
    551           omFree((ADDRESS)s);
    552         }
    553         else if (/*(startfptr>0) &&*/
    554         (currentVoice->buffer[startfptr-1]=='\n'))
    555         {
    556           char *anf=currentVoice->buffer+startfptr;
    557           const char *ss=strchr(anf,'\n');
    558           long len;
    559           if (ss==NULL) len=strlen(anf);
    560           else          len=ss-anf;
    561           char *s=(char *)omAlloc(len+2);
    562           strncpy(s,anf,len+2);
    563           s[len+1]='\0';
    564           yylineno++;
    565562          fePrintEcho(s,b);
    566563          omFree((ADDRESS)s);
Note: See TracChangeset for help on using the changeset viewer.