gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] Redirecting interpreter output to a counted string


From: Sam Putman
Subject: Re: [gforth] Redirecting interpreter output to a counted string
Date: Sun, 12 Jan 2014 12:23:55 -0800

Thank you, that looks like it will work well. Suitably low-level for my purposes..

One question: >buffer-execute doesn't appear to be implemented:

ag -Q ">buffer-execute" ->

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.



On Sun, Jan 12, 2014 at 12:13 PM, Bernd Paysan <address@hidden> wrote:
Am Sonntag, 12. Januar 2014, 11:37:36 schrieb Sam Putman:
> 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.

The current development version (e.g. the last snapshot) has words for that,
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/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]