Changeset 1d77df in git for kernel/febase.cc


Ignore:
Timestamp:
Nov 20, 2009, 6:57:14 PM (14 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
Children:
894e1744dd6e6d675a7c9d8a10fe3f6051ca84b8
Parents:
e2e3ad8f623ca6b9cc80a9bab430038d51d0e8e7
Message:
*hannes: handle very long input lines better

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

Legend:

Unmodified
Added
Removed
  • kernel/febase.cc

    re2e3ad r1d77df  
    1818#include <ctype.h>
    1919#include <unistd.h>
    20 #ifdef NeXT
    21 #include <sys/file.h>
    22 #endif
    2320
    2421#ifdef HAVE_PWD_H
     
    3633char fe_promptstr[] ="  ";
    3734
     35// output/print buffer:
    3836#define INITIAL_PRINT_BUFFER 24*1024L
     37// line buffer for reading:
     38// minimal value for MAX_FILE_BUFFER: 4*4096 - see Tst/Long/gcd0_l.tst
     39// this is an upper limit for the size of monomials/numbers read via the interpreter
     40#define MAX_FILE_BUFFER 4*4096
    3941static long feBufferLength=INITIAL_PRINT_BUFFER;
    4042static char * feBuffer=(char *)omAlloc(INITIAL_PRINT_BUFFER);
     
    594596      if (currentVoice->buffer==NULL)
    595597      {
    596         currentVoice->buffer=(char *)omAlloc(4096-sizeof(ADDRESS));
     598        currentVoice->buffer=(char *)omAlloc(MAX_FILE_BUFFER-sizeof(ADDRESS));
    597599        omMarkAsStaticAddr(currentVoice->buffer);
    598600      }
     
    606608      s=fe_fgets_stdin(fe_promptstr,
    607609                       &(currentVoice->buffer[offset]),
    608                        (4096-1-sizeof(ADDRESS))-offset);
     610                       omSizeOfAddr(currentVoice->buffer)-1-offset);
    609611      int i=0;
    610612      if (s!=NULL)
    611         while((s[i]!='\0') && (i<4096)) {s[i] &= (char)127;i++;}
     613        while((s[i]!='\0') /*&& (i<MAX_FILE_BUFFER)*/) {s[i] &= (char)127;i++;}
    612614    }
    613615    else if (currentVoice->sw==BI_file)
    614616    {
    615 #ifdef DEFECT_SINGULAR
    616       feShowPrompt();
    617       s=fe_fgets_stdin(fe_promptstr,
    618                        &(currentVoice->buffer[offset]),
    619                        (4096-1-sizeof(ADDRESS))-offset);
    620       int i=0;
    621       if (s!=NULL)
    622         while((s[i]!='\0') && (i<4096)) {s[i] &= (char)127;i++;}
    623 #else
    624       s=fgets(currentVoice->buffer+offset,(4096-1-sizeof(ADDRESS))-offset,
     617      s=fgets(currentVoice->buffer+offset,(MAX_FILE_BUFFER-1-sizeof(ADDRESS))-offset,
    625618              currentVoice->files);
    626 #endif
    627619    }
    628620    //else /* BI_buffer */ s==NULL  => return 0
Note: See TracChangeset for help on using the changeset viewer.