\ This trick is not ISO/ANS, but it works in Swiftforth...
: [MYNAME] ( -- ) \ compile only
LAST CELL+ CELL+ @ CODE> >NAME POSTPONE LITERAL ; IMMEDIATE
: A_Strange_Word ." I_Am_" [MYNAME] COUNT TYPE ;
Charles
-----Message d'origine-----
De : sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com] De la part de
Roger
Envoyé : mercredi 9 juillet 2008 15:45
À : sftalk
Objet : [sftalk] obtaining a function name from within the function
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
-- Dr. Roger Dube President/Chief Scientist Digital Authentication Technologies, Inc. 561.392.7404 (office) 561.892.2474 (eFax) RogerDube_at_datHQ.com 690 Yamato Road Suite 4 - #210 Boca Raton, FL 33431 ---------------------------------------------------------------------- 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 ---------------------------------------------------------------------- ---------------------------------------------------------------------- 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:15:42 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.