--- gforth/prims2x.fs 2001/02/27 21:17:10 1.86 +++ gforth/prims2x.fs 2001/03/11 21:47:27 1.90 @@ -60,8 +60,8 @@ warnings off \ different directory with the wordlibraries) include ./search.fs include ./extend.fs -[THEN] include ./stuff.fs +[THEN] [IFUNDEF] environment? include ./environ.fs @@ -670,7 +670,7 @@ s" IP" save-mem w s" error don't use # o : output-profile ( -- ) \ generate code for postprocessing the VM block profile stuff - ." if (*ip == VM_INST(" function-number @ 0 .r ." )) {" cr + ." if (VM_IS_INST(*ip, " function-number @ 0 .r ." )) {" cr ." add_inst(b, " quote prim prim-name 2@ type quote ." );" cr ." ip += " inst-stream stack-in @ 1+ 0 .r ." ;" cr prim prim-c-code 2@ s" SET_IP" search nip nip @@ -1013,6 +1013,15 @@ s" IP" save-mem w s" error don't use # o combined prim-c-name 2@ type ." */" cr ; +: output-forth-peephole ( -- ) + combined-prims num-combined @ 1- cells combinations search-wordlist + s" the prefix for this combination must be defined earlier" ?print-error + execute prim-num @ 5 .r + combined-prims num-combined @ 1- th @ prim-num @ 5 .r + combined prim-num @ 5 .r ." prim, \ " + combined prim-c-name 2@ type + cr ; + \ the parser @@ -1167,7 +1176,7 @@ Variable c-flag )) <- simple-primitive ( -- ) (( {{ init-combined }} - ` = (( white ++ {{ start }} forth-ident {{ end add-prim }} )) ++ + ` = white ** (( {{ start }} forth-ident {{ end add-prim }} white ** )) ++ nleof {{ process-combined }} )) <- combined-primitive