In article <87o6oyrc7i.fsf@nightsong.com>,   
   Paul Rubin wrote:   
   >peter writes:   
   >> As Anton has already noted lxf uses this internally for parsing source files   
   >> Mapping the file uses memory regions outside the current process.   
   >> It is like first allocating memory and then reading in the entire file   
   >   
   >Yes mmap is a virtual memory thing though. My current thought is to use   
   >READ-LINE with some fixed buffer size, but have two contiguous buffers   
   >and call READ-LINE twice, to handle the case where a word is split   
   >across two buffers. Then process all words (whitespace terminated)   
   >until the last whitespace is found. Anything left gets copied back   
   >to the beginning of the double buffer, before calling READ-LINE again.   
   >It's not worth bothering with true double buffering.   
      
   The ciforth approach is more sensible. The terminal input buffer is   
   filled from the input stream. It is large say 16K.   
   Now you carve lines out of the buffer, and use a parse pointer,   
   maybe >IN. As soon as you find that there are no more line endings   
   in the remaining buffer, you copy the remainder to the start of   
   the buffer and fill the buffer to the brim.   
   In this case you will not copy more than is necessary.   
      
   Groetjes Albert   
   --   
   The Chinese government is satisfied with its military superiority over USA.   
   The next 5 year plan has as primary goal to advance life expectancy   
   over 80 years, like Western Europe.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|