--- gforth/prims2x.fs 2002/06/02 15:46:16 1.106 +++ gforth/prims2x.fs 2002/08/09 09:42:35 1.108 @@ -625,15 +625,25 @@ stack inst-stream IP Cell endif 2drop ; -: output-c-tail ( -- ) - \ the final part of the generated C code +: output-c-tail1 ( -- ) + \ the final part of the generated C code except LABEL2 and NEXT_P2 output-super-end print-debug-results ." NEXT_P1;" cr stores - fill-tos + fill-tos ; + +: output-c-tail ( -- ) + \ the final part of the generated C code, without LABEL2 + output-c-tail1 ." NEXT_P2;" ; +: output-c-tail2 ( -- ) + \ the final part of the generated C code, including LABEL2 + output-c-tail1 + ." LABEL2(" prim prim-c-name 2@ type ." )" cr + ." NEXT_P2;" cr ; + : type-c-code ( c-addr u xt -- ) \ like TYPE, but replaces "TAIL;" with tail code produced by xt { xt } @@ -666,19 +676,18 @@ stack inst-stream IP Cell ." #line " c-line @ . quote c-filename 2@ type quote cr prim prim-c-code 2@ ['] output-c-tail type-c-code ." }" cr - output-c-tail + output-c-tail2 ." }" cr cr ; : disasm-arg { item -- } item item-stack @ inst-stream = if - ." fputc(' ', vm_out); " - \ !! change this to first convert args to the right type and - \ then print them - ." /* printarg_" item item-type @ print-type-prefix - ." ((" item item-type @ type-c-name 2@ type ." )" - ." ip[" item item-offset @ 1+ 0 .r ." ]); */" cr + ." {" cr + item print-declaration + item fetch + item print-debug-arg + ." }" cr endif ; : disasm-args ( -- ) @@ -900,9 +909,7 @@ stack inst-stream IP Cell \ #line 516 "./prim" \ n = n1+n2; \ } -\ NEXT_P1; \ _x_sp0 = (Cell)n; -\ NEXT_P2; \ } \ NEXT_P1; \ spTOS = (Cell)_x_sp0; @@ -1047,7 +1054,7 @@ stack inst-stream IP Cell \ print-debug-args stack-pointer-updates output-parts - output-c-tail + output-c-tail2 ." }" cr cr ;