1: \ test some gforth extension words
2:
3: \ Copyright (C) 2009 Free Software Foundation, Inc.
4:
5: \ This file is part of Gforth.
6:
7: \ Gforth is free software; you can redistribute it and/or
8: \ modify it under the terms of the GNU General Public License
9: \ as published by the Free Software Foundation, either version 3
10: \ of the License, or (at your option) any later version.
11:
12: \ This program is distributed in the hope that it will be useful,
13: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
14: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: \ GNU General Public License for more details.
16:
17: \ You should have received a copy of the GNU General Public License
18: \ along with this program. If not, see http://www.gnu.org/licenses/.
19:
20: require ./tester.fs
21: decimal
22:
23: { : macro1 ]] dup * [[ ; immediate -> }
24: { : word1 macro1 ; -> }
25: { 5 word1 -> 25 }
26:
27: { : macro2 7 ]]l + [[ ; immediate -> }
28: { : word2 macro2 ; -> }
29: { 8 word2 -> 15 }
30:
31: { : macro3 s" test" ]]2l compare [[ ; immediate -> }
32: { : word3 macro3 ; -> }
33: { s" tess" word3 -> -1 }
34: { s" test" word3 -> 0 }
35: { s" tesu" word3 -> 1 }
36:
37: { : macro4 4e ]]fl f+ [[ ; immediate -> }
38: { : word4 macro4 ; -> }
39: { 5e word4 -> 9e }
40:
41: { : macro5 ]] 0< if macro1 [[ ; immediate -> }
42: { : word5 dup macro5 then ; -> }
43: { -5 word5 -> 25 }
44: { 5 word5 -> 5 }
45:
46: \ test multi-line ]]
47: : macro6 ]]
48: 0<
49:
50:
51: if
52: macro1 [[ ; immediate
53: { : word6 dup macro6 then ; -> }
54: { -5 word6 -> 25 }
55: { 5 word6 -> 5 }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>