|
From: pito <pi...@vo...> - 2010-07-05 16:30:15
|
Correction: 2. it finds the address of the next "word" (the next olderer in the word list) and replaces its header with a JUMP to the address in ADDR_LAST; n1++ ----- PŮVODNÍ ZPRÁVA ----- Od: "pito" <pi...@vo...> Komu: amf...@li... Předmět: Help with word definition- redef Datum: 5.7.2010 - 18:19:43 > Hi dear friends, > as I am a newbie in forth I would kindly ask you for > a minor help with > a definition of a new word - "redef" > > : redef ( string"word" -- n1 ) > > 1. n1 = 0, it finds the address ADDR_LAST of "word" > (from the newest > side - lefthandside)and memorise it; if not n1=-1 and > exit > 2. it finds the address of the next "word" (the next > olderer in the word > list) and replaces its address with the address in > ADDR_LAST; n1++ > 3. repeats till the end of the wordlist (to the very > righthandside word) > > ; > > Example: > > words > redef sqrt power voltage current sqrt current sqrt > power sqrt ....... > > sqrt redef > 3 ok > > words > redef sqrt power voltage current SQRT current SQRT > power SQRT ....... > > where the SQRT (capitals for clarity only) will have > a JUMP to sqrt in > their header. So any call to sqrt, even from old instances > in any other > older words (which are using sqrt) will point to sqrt. > So at the end of day the newest sqrt (very lefthanside) > will be used > only. > Any help would be appreciated. Pito. > > > > |