Merge pull request #80 from letoh/use-pattern-rules
authorPhil Burk <philburk@mobileer.com>
Sun, 13 Sep 2020 20:36:19 +0000 (13:36 -0700)
committerGitHub <noreply@github.com>
Sun, 13 Sep 2020 20:36:19 +0000 (13:36 -0700)
use pattern rules instead of suffix rules in the Makefile

fth/ansilocs.fth
fth/t_locals.fth

index 3423bfc..923eef2 100644 (file)
@@ -139,19 +139,11 @@ if.forgotten lv.term
     THEN
 ;
 
     THEN
 ;
 
-
 : VALUE
     CREATE ( n <name> )
         ,
 : VALUE
     CREATE ( n <name> )
         ,
-        immediate
     DOES>
     DOES>
-        state @
-        IF
-            [compile] aliteral
-            compile @
-        ELSE
-            @
-        THEN
+        @
 ;
 
 : TO  ( val <name> -- )
 ;
 
 : TO  ( val <name> -- )
@@ -161,7 +153,7 @@ if.forgotten lv.term
         lv.compile.store
     ELSE
         find
         lv.compile.store
     ELSE
         find
-        1 = 0= abort" TO or -> before non-local or non-value"
+        0= abort" not found"
         >body  \ point to data
         state @
         IF  \ compiling  ( -- pfa )
         >body  \ point to data
         state @
         IF  \ compiling  ( -- pfa )
@@ -183,7 +175,7 @@ if.forgotten lv.term
         [compile] literal compile (local+!)
     ELSE
         find
         [compile] literal compile (local+!)
     ELSE
         find
-        1 = 0= abort" +-> before non-local or non-value"
+        0= abort" not found"
         >body  \ point to data
         state @
         IF  \ compiling  ( -- pfa )
         >body  \ point to data
         state @
         IF  \ compiling  ( -- pfa )
index 5cec9e0..0384ee2 100644 (file)
@@ -14,6 +14,7 @@ test{
 T{ 333 value  my-value   my-value }T{  333 }T
 T{ 1000 -> my-value   my-value }T{ 1000 }T
 T{ 35 +-> my-value   my-value }T{ 1035 }T
 T{ 333 value  my-value   my-value }T{  333 }T
 T{ 1000 -> my-value   my-value }T{ 1000 }T
 T{ 35 +-> my-value   my-value }T{ 1035 }T
+T{ 987 to my-value   my-value }T{ 987 }T
 : test.value  ( -- ok )
     100 -> my-value
     my-value 100 =
 : test.value  ( -- ok )
     100 -> my-value
     my-value 100 =
@@ -22,6 +23,11 @@ T{ 35 +-> my-value   my-value }T{ 1035 }T
 ;
 T{ test.value }T{ TRUE }T
 
 ;
 T{ test.value }T{ TRUE }T
 
+\ test compile time behavior of a VALUE
+567 value VAL3 immediate
+: VD3 val3 literal ;
+T{ vd3 }T{ 567 }T
+
 \ test locals in a word
 : test.locs  { aa bb | cc -- ok }
     cc 0=
 \ test locals in a word
 : test.locs  { aa bb | cc -- ok }
     cc 0=