Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.forth    |    Forth programmers eat a lot of Bratwurst    |    117,927 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 117,740 of 117,927    |
|    Paul Rubin to Anton Ertl    |
|    Re: Idiomatic way to read a word of text    |
|    18 Nov 25 18:02:24    |
      From: no.email@nospam.invalid              anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:       > Why not? For something like Roff (or TeX or Markdown etc.) the whole       > input file easily fits into RAM, so a line would fit, too. The       > question is if the Forth system supports long lines in REFILL.              The target processor might not have that much ram. Back in school I       used a version of Roff written for CP/M, which I ported to Turbo C for a       PC-XT clone. On the other hand, none of my input files had very long       lines. I was thinking of accomodating modern wysiwyg editors which       don't have line breaks except at the end of paragraphs. Maybe that's       not worthwhile.              One obvious approach is to use READ-LINE, but this unfortunately seems       to throw away the newline at the end of the line read, so it's hard to       tell if a complete line has been read, or if the buffer has simply       gotten full. Testing with gforth, if the buffer size is exactly the       line length, then FILE-POSITION points to just after the line, and the       next call to READ-LINE returns 0 chars. No idea about other Forths.              > And here's the signficance of REFILLing. You could pass everything to       > the text interpreter, and install the following recognizer sequence:       > First one that recognizes things like ".i\n", and second one that       > recognizes everything and then processes the line as ordinary words.              I'll see if I can figure out how to do that, though the target Forth       might not have recognizers. What I wanted is a loop like        LOOP        READ a line;        IF line begins with ".", then pass the line to the text interpreter;        ELSE loop through the words on the line, copying them to the output        buffer or maybe to the output device        END LOOP              Getting words from the line should preferably use Forth's built-in       parser.              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca