Re: obtaining a function name from within the function

From: Rick VanNorman <rick_at_neverslow.com>
Date: Wed, 9 Jul 2008 09:13:52 -0500

Try this:

: TESTING ( -- )
   10 0 DO [ LAST @ ] LITERAL COUNT TYPE CR LOOP ;

It won't work if you save your image as a DLL, but will work in all
other contexts that I can think of.

rick

On Wed, Jul 9, 2008 at 8:45 AM, Roger <rogerdube_at_dathq.com> wrote:
> Is there a way to get the name of a Forth word from within the word
> itself?
>
> For example, I have a forth word called test:
>
> : test ( -- n )
> \ need counted string of the word "test" from within here
> 0
> 10 0 do I + loop ;
>
> I need to get the counted string of the calling word (in this case
> "test") from within the word where indicated.
>
> If I am not being clear, let me know and I will get another coffee and
> try again.
>
> - Roger
>

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Wed Jul 09 2008 - 07:14:40 PDT


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.