Hello Matthias,

Having given further thought to r1404 and your recent comments I think
that we need to revert to the wlscope former interface to utilize this
new mechanism to its fullest. Example follows and here's the kernel
patch: http://pastebin.com/aSWRMU3V

Regards, Enoch.

\ wlscope, "wordlist scope" ( addr len -- addr' len' wid ), is a deferred word
\ which enables the AmForth application to choose the wordlist ( wid ) for the
\ new voc entry based on the input ( addr len ) string. The name of the new voc
\ entry ( addr' len' ) may be different from the input string. Note that *all*
\ created voc entry types pass through the wlscope mechanism. The default
\ wlscope action passes the input string to the output without modification and
\ uses get-current to select the wid.

\ The following example shows how to create a library of words under a special
\ wordlist (can_lib). This example also shows how to chain scope calls safely.

wordlist constant can_lib

get-order 1+ can_lib swap set-order     \ can_lib would be searched first

: can_scope  ( addr len -- addr' len' wid )
   2dup
   4 >  if                              \ name length check
      s" can_" tuck icompare  if        \ name prefix check
         4 - swap 4 + swap              \ drop prefix from created word
         can_lib exit
      then
   else
      drop
   then
   [ ' wlscope defer@ ] literal execute
;

' can_scope is wlscope



------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to