From: Tim Vaughan Date: Sat, 30 Apr 2016 12:23:39 +0000 (+1200) Subject: Fixed problem with TICK, but now only works when compiled. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=forth.jl.git;a=commitdiff_plain;h=c2154a2f9cda1913ca2f966fda842a861aa3a502 Fixed problem with TICK, but now only works when compiled. --- diff --git a/src/forth.jl b/src/forth.jl index e7faf97..df86674 100644 --- a/src/forth.jl +++ b/src/forth.jl @@ -822,10 +822,14 @@ IMMEDIATE = defPrimWord("IMMEDIATE", () -> begin return NEXT end, flags=F_IMMED) +#TICK = defWord("'", +# [STATE_CFA, FETCH, ZBRANCH, 7, +# FROMR, DUP, INCR, TOR, FETCH, EXIT, +# WORD, FIND, TOCFA, EXIT]) + TICK = defWord("'", - [STATE_CFA, FETCH, ZBRANCH, 7, - FROMR, DUP, INCR, TOR, FETCH, EXIT, - WORD, FIND, TOCFA, EXIT]) + [FROMR, DUP, INCR, TOR, FETCH, EXIT]) + # Strings diff --git a/src/lib.4th b/src/lib.4th index d806cb8..5d6507d 100644 --- a/src/lib.4th +++ b/src/lib.4th @@ -572,7 +572,6 @@ ( begin the definition with : NAME [IMMEDIATE] ) ':' EMIT SPACE DUP ID. SPACE DUP ?IMMEDIATE IF ." IMMEDIATE " THEN - CR 8 SPACES >DFA ( get the data address, ie. points after DOCOL | end-of-word start-of-data ) @@ -580,9 +579,7 @@ BEGIN ( end start ) 2DUP > WHILE - DUP @ CFA> ID. SPACE - 1+ -( DUP @ ( end start codeword ) + DUP @ ( end start codeword ) CASE ' LIT OF ( is it LIT ? ) @@ -596,7 +593,7 @@ 2DUP TELL ( print the string ) '"' EMIT SPACE ( finish the string with a final quote ) + ( end start+1+len, aligned ) - 1- ( because we're about to add 1 below ) + 1- ( because we're about to add 4 below ) ENDOF ' 0BRANCH OF ( is it 0BRANCH ? ) ." 0BRANCH ( " @@ -633,7 +630,6 @@ ENDCASE 1+ ( end start+1 ) -) REPEAT ';' EMIT CR