Redefining words

From: Gene LeFave <gene_at_tekdata.com>
Date: Wed, 17 Jan 2007 09:05:33 -0600

I find the following helpful as it allows redefining words in the precompiled
portion of the system:

: MAKE: ( -- ) ( Redefines given word with given def.)
  ' $E9 OVER +ORIGIN C! \ Patch with a JMP opcode
  1+ >R :NONAME \ Compile new def.
  R> SWAP OVER CELL+ - \ Compute delta
  SWAP +ORIGIN ! ; \ Store JMP Address

Example:

: test ." original" ;
MAKE: test ." redefined" ;

----------------------------------------------------------------------
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 Jan 17 2007 - 07:11:05 PST


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.