xref: /titanic_52/usr/src/lib/efcode/fcode_test/stack.fth (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate\ #ident	"%Z%%M%	%I%	%E% SMI"
2*7c478bd9Sstevel@tonic-gate\ purpose:
3*7c478bd9Sstevel@tonic-gate\ copyright: Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
4*7c478bd9Sstevel@tonic-gate\ copyright: Use is subject to license terms.
5*7c478bd9Sstevel@tonic-gate\ copyright:
6*7c478bd9Sstevel@tonic-gate\ copyright: CDDL HEADER START
7*7c478bd9Sstevel@tonic-gate\ copyright:
8*7c478bd9Sstevel@tonic-gate\ copyright: The contents of this file are subject to the terms of the
9*7c478bd9Sstevel@tonic-gate\ copyright: Common Development and Distribution License, Version 1.0 only
10*7c478bd9Sstevel@tonic-gate\ copyright: (the "License").  You may not use this file except in compliance
11*7c478bd9Sstevel@tonic-gate\ copyright: with the License.
12*7c478bd9Sstevel@tonic-gate\ copyright:
13*7c478bd9Sstevel@tonic-gate\ copyright: You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14*7c478bd9Sstevel@tonic-gate\ copyright: or http://www.opensolaris.org/os/licensing.
15*7c478bd9Sstevel@tonic-gate\ copyright: See the License for the specific language governing permissions
16*7c478bd9Sstevel@tonic-gate\ copyright: and limitations under the License.
17*7c478bd9Sstevel@tonic-gate\ copyright:
18*7c478bd9Sstevel@tonic-gate\ copyright: When distributing Covered Code, include this CDDL HEADER in each
19*7c478bd9Sstevel@tonic-gate\ copyright: file and include the License file at usr/src/OPENSOLARIS.LICENSE.
20*7c478bd9Sstevel@tonic-gate\ copyright: If applicable, add the following below this CDDL HEADER, with the
21*7c478bd9Sstevel@tonic-gate\ copyright: fields enclosed by brackets "[]" replaced with your own identifying
22*7c478bd9Sstevel@tonic-gate\ copyright: information: Portions Copyright [yyyy] [name of copyright owner]
23*7c478bd9Sstevel@tonic-gate\ copyright:
24*7c478bd9Sstevel@tonic-gate\ copyright: CDDL HEADER END
25*7c478bd9Sstevel@tonic-gate\ copyright:
26*7c478bd9Sstevel@tonic-gate
27*7c478bd9Sstevel@tonic-gate." Stack Manipulation: "
28*7c478bd9Sstevel@tonic-gate	" drop"		1 0 drop		.passed?
29*7c478bd9Sstevel@tonic-gate	" swap"		1 2 1 swap drop =	.passed?
30*7c478bd9Sstevel@tonic-gate	" nip"		1 0 1 nip - 0=		.passed?
31*7c478bd9Sstevel@tonic-gate	" over"		1 2 over 1 = nip nip	.passed?
32*7c478bd9Sstevel@tonic-gate	" dup"		1 dup =			.passed?
33*7c478bd9Sstevel@tonic-gate	" tuck"		2 1 tuck nip =		.passed?
34*7c478bd9Sstevel@tonic-gate	" rot"		3 2 1 rot 3 = nip nip	.passed?
35*7c478bd9Sstevel@tonic-gate	" -rot"		3 2 1 -rot 2 = nip nip	.passed?
36*7c478bd9Sstevel@tonic-gate	" 2rot"		1 2 3 4 5 6 2rot 2 = swap 1 = and swap 6 = and swap
37*7c478bd9Sstevel@tonic-gate			   5 = and swap 4 = and swap 3 = and .passed?
38*7c478bd9Sstevel@tonic-gate	" 2dup"		1 -1 2dup + 0= nip nip	.passed?
39*7c478bd9Sstevel@tonic-gate	" ?dup"		0 1 ?dup = nip 		.passed?
40*7c478bd9Sstevel@tonic-gate	" 2swap"	1 1 0 0 2swap and nip nip .passed?
41*7c478bd9Sstevel@tonic-gate	" 2drop"	1 1 0 0 2drop and	.passed?
42*7c478bd9Sstevel@tonic-gate	" 2over"	1 2 0 0 2over 2swap 2drop rot = -rot = = .passed?
43*7c478bd9Sstevel@tonic-gate	" roll"		1 2 3 4 3 roll 1 = nip nip nip .passed?
44*7c478bd9Sstevel@tonic-gate	" depth"	0 0 depth 4 = nip nip .passed?
45*7c478bd9Sstevel@tonic-gatecr
46*7c478bd9Sstevel@tonic-gate
47*7c478bd9Sstevel@tonic-gate." Return Stack: "
48*7c478bd9Sstevel@tonic-gate: test-rs
49*7c478bd9Sstevel@tonic-gate	" >r"		3 1 >r 2 >r 3 =		.passed?
50*7c478bd9Sstevel@tonic-gate	" r@"		3 r@ 2 = nip		.passed?
51*7c478bd9Sstevel@tonic-gate	" r>"		3 r> 2 = r> 1 = and nip	.passed?
52*7c478bd9Sstevel@tonic-gate;  test-rs
53*7c478bd9Sstevel@tonic-gate: bail-test ( -- )	r> drop  ;
54*7c478bd9Sstevel@tonic-gate: bail ( -- )		1 bail-test drop 0 ;
55*7c478bd9Sstevel@tonic-gate	" Manipulate"	bail			.passed?
56*7c478bd9Sstevel@tonic-gatecr
57