--- gforth/cross.fs 2001/03/17 21:36:41 1.95 +++ gforth/cross.fs 2001/09/04 09:15:28 1.101 @@ -808,7 +808,7 @@ ghost (next) ghost unloop ghost ;S 2drop ghost lit ghost (compile) ghost ! 2drop drop ghost (does>) ghost noop 2drop -ghost (.") ghost (S") ghost (ABORT") 2drop drop ( " ) +ghost (.") ghost (S") ghost (ABORT") 2drop drop ghost ' drop ghost :docol ghost :doesjump ghost :dodoes 2drop drop ghost :dovar ghost :dodefer ghost :dofield 2drop drop @@ -944,7 +944,7 @@ Variable user-vars 0 user-vars ! : target>bitmask-size ( u1 -- u2 ) 1- tcell>bit rshift 1+ ; -: allocatetarget ( size --- adr ) +: allocatetarget ( size -- adr ) dup allocate ABORT" CROSS: No memory for target" swap over swap erase ; @@ -1050,7 +1050,7 @@ T has? rom H ' dictionary ALIAS rom-dictionary -: setup-target ( -- ) \G initialize targets memory space +: setup-target ( -- ) \G initialize target's memory space s" rom" T $has? H IF \ check for ram and rom... \ address-space area nip 0<> @@ -1087,7 +1087,7 @@ T has? rom H ELSE r> drop THEN REPEAT drop ; -\ MakeKernal 22feb99jaw +\ MakeKernel 22feb99jaw : makekernel ( targetsize -- targetsize ) dup dictionary >rlen ! setup-target ; @@ -1579,8 +1579,7 @@ Variable to-doc to-doc on IF s" " doc-file-id write-line throw s" make-doc " doc-file-id write-file throw - - tlast @ >image count 1F and doc-file-id write-file throw + Last-Header-Ghost @ >ghostname doc-file-id write-file throw >in @ [char] ( parse 2drop [char] ) parse doc-file-id write-file throw @@ -1777,7 +1776,11 @@ Comment ( Comment \ ELSE postpone literal postpone gexecute THEN ; immediate +T has? peephole H [IF] : (cc) compile call T >body a, H ; ' (cc) IS colon, +[ELSE] + ' (prim) IS colon, +[THEN] : [G'] \G ticks a ghost and returns its address @@ -2043,7 +2046,7 @@ Cond: DOES> restrict? executed-ghost @ create-forward-warn IF ['] reswarn-forward IS resolve-warning THEN - Theader >r dup gdoes, + Theader >r dup , dup gdoes, \ stores execution semantic in the built word \ if the word already has a semantic (concerns S", IS, .", DOES>) \ then keep it @@ -2101,10 +2104,16 @@ Cond: DOES> restrict? postpone ; ( S addr xt ) over >exec ! ; immediate +T has? peephole H [IF] : compile: ( ghost -- ghost [xt] [colon-sys] ) :noname postpone g>body ; : ;compile ( ghost [xt] [colon-sys] -- ghost ) postpone ; over >comp ! ; immediate +[ELSE] +: compile: ( ghost -- ghost xt colon-sys ) :noname ; +: ;compile ( ghost xt colon-sys -- ghost ) + postpone ; drop ['] prim-resolved over >comp ! ; immediate +[THEN] : by ( -- ghost ) \ Name ghost >end @ ; @@ -2141,6 +2150,7 @@ Builder Variable [ELSE] Build: T 0 , H ; by Create +\ compile: alit, ;compile Builder Variable [THEN] @@ -2151,6 +2161,7 @@ Builder 2Variable [ELSE] Build: T 0 , 0 , H ; by Create +\ compile: alit, ;compile Builder 2Variable [THEN] @@ -2161,6 +2172,7 @@ Builder AVariable [ELSE] Build: T 0 A, H ; by Create +\ compile: alit, ;compile Builder AVariable [THEN] @@ -2392,9 +2404,9 @@ Cond: NEXT restrict? sys? next, ;Cond : ," [char] " parse T string, align H ; -Cond: ." restrict? compile (.") T ," H ;Cond ( " ) -Cond: S" restrict? compile (S") T ," H ;Cond ( " ) -Cond: ABORT" restrict? compile (ABORT") T ," H ;Cond ( " ) +Cond: ." restrict? compile (.") T ," H ;Cond +Cond: S" restrict? compile (S") T ," H ;Cond +Cond: ABORT" restrict? compile (ABORT") T ," H ;Cond Cond: IS T ' >body H compile ALiteral compile ! ;Cond : IS T >address ' >body ! H ; @@ -2430,6 +2442,13 @@ Cond: compile ( -- ) restrict? \ name IF gexecute ELSE compile (compile) addr, THEN THEN ;Cond +Cond: [compile] ( -- ) restrict? \ name + bl word gfind dup 0= ABORT" CROSS: Can't compile" + 0> IF gexecute + ELSE dup >magic @ = + IF gexecute + ELSE compile (compile) addr, THEN THEN ;Cond + Cond: postpone ( -- ) restrict? \ name bl word gfind dup 0= ABORT" CROSS: Can't compile" 0> IF gexecute @@ -2686,6 +2705,10 @@ previous : .s .s ; : bye bye ; +\ dummy + +: group source >in ! drop ; + \ turnkey direction : H forth ; immediate : T minimal ; immediate @@ -2703,8 +2726,8 @@ previous : unlock previous forth also cross ; \ also minimal -: [[ also unlock ; -: ]] previous previous also also ; +: [[+++ also unlock ; +: +++]] previous previous also also ; unlock definitions also minimal : lock lock ;