|
From: | Sam Putman |
Subject: | Re: [gforth] Redirecting interpreter output to a counted string |
Date: | Sun, 12 Jan 2014 12:23:55 -0800 |
66:\ >buffer-execute ( ... c-addr u1 xt -- ... u2 ) execute xt while the
82:\ pad 0 ['] foo >buffer-execute >r drop ( throw away result of FOO )
84:\ r@ allocate throw r> 2dup 2>r ['] foo >buffer-execute drop 2r>
These are all comments. Is this word also available? I would prefer not to dynamically allocate for this use.
cheers,
-Sam.
Am Sonntag, 12. Januar 2014, 11:37:36 schrieb Sam Putman:
The current development version (e.g. the last snapshot) has words for that,> Hi,
>
> I am curious how to redirect the output of the `evaluate` word into a
> counted string.
>
> That is, I'd like something like this:
> : innerloop
>
> eval-pad cols accept
> eval-pad swap evaluate
> recurse ;
>
> To break it down to its essence, I want each `evaluate` call to return a
> counted string to the stack, rather than to output to the current cursor
> position.
>
> I'm new to gforth, and couldn't find this in the manual or glossary.
> Apologies if I've overlooked an obvious word.
0.7.x doesn't. But you can load str-exec.fs from the development branch into
0.7.3 without problems.
https://github.com/forthy42/gforth/blob/master/str-exec.fs
There are other ways to achieve what you want (of course), but this is
probably the easiest one.
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/
[Prev in Thread] | Current Thread | [Next in Thread] |