Imported Upstream version 21
[debian/pforth] / t_locals.fth
1 \ @(#) t_locals.fth 97/01/28 1.1
2 \ Test PForth LOCAL variables.
3 \
4 \ Copyright 1996 3DO, Phil Burk
5
6 include? }T{  t_tools.fth
7
8 anew task-t_locals.fth
9 decimal
10
11 test{
12
13 echo off
14
15
16 \ test value and locals
17 T{ 333 value  my-value   my-value }T{  333 }T
18 T{ 1000 -> my-value   my-value }T{ 1000 }T
19 T{ 35 +-> my-value   my-value }T{ 1035 }T
20 : test.value  ( -- ok )
21         100 -> my-value
22         my-value 100 =
23         47 +-> my-value
24         my-value 147 = AND
25 ;
26 T{ test.value }T{ TRUE }T
27
28 \ test locals in a word
29 : test.locs  { aa bb | cc -- ok }
30         cc 0=
31         aa bb + -> cc
32         aa bb +   cc = AND
33         aa -> cc
34         bb +->  cc
35         aa bb +   cc = AND
36 ;
37 T{ 200 59 test.locs }T{  TRUE }T
38
39
40 }test
41