1*0Sstevel@tonic-gate\ #ident "%Z%%M% %I% %E% SMI" 2*0Sstevel@tonic-gate\ Copyright 2005 Sun Microsystems, Inc. All rights reserved. 3*0Sstevel@tonic-gate\ Use is subject to license terms. 4*0Sstevel@tonic-gate\ 5*0Sstevel@tonic-gate\ CDDL HEADER START 6*0Sstevel@tonic-gate\ 7*0Sstevel@tonic-gate\ The contents of this file are subject to the terms of the 8*0Sstevel@tonic-gate\ Common Development and Distribution License, Version 1.0 only 9*0Sstevel@tonic-gate\ (the "License"). You may not use this file except in compliance 10*0Sstevel@tonic-gate\ with the License. 11*0Sstevel@tonic-gate\ 12*0Sstevel@tonic-gate\ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 13*0Sstevel@tonic-gate\ or http://www.opensolaris.org/os/licensing. 14*0Sstevel@tonic-gate\ See the License for the specific language governing permissions 15*0Sstevel@tonic-gate\ and limitations under the License. 16*0Sstevel@tonic-gate\ 17*0Sstevel@tonic-gate\ When distributing Covered Code, include this CDDL HEADER in each 18*0Sstevel@tonic-gate\ file and include the License file at usr/src/OPENSOLARIS.LICENSE. 19*0Sstevel@tonic-gate\ If applicable, add the following below this CDDL HEADER, with the 20*0Sstevel@tonic-gate\ fields enclosed by brackets "[]" replaced with your own identifying 21*0Sstevel@tonic-gate\ information: Portions Copyright [yyyy] [name of copyright owner] 22*0Sstevel@tonic-gate\ 23*0Sstevel@tonic-gate\ CDDL HEADER END 24*0Sstevel@tonic-gate\ 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gatecr ." Simple interpreted IF THEN test: " 27*0Sstevel@tonic-gate1 if .passed then space 28*0Sstevel@tonic-gate0 if .failed then space 29*0Sstevel@tonic-gatecr 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate." Simple interpreted IF ELSE THEN test: " 32*0Sstevel@tonic-gate0 if .failed else .passed then space 33*0Sstevel@tonic-gate1 if .passed else .failed then space 34*0Sstevel@tonic-gatecr 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate." Nested interpreted IF test: " 37*0Sstevel@tonic-gate1 1 1 0 0 1 0 0 38*0Sstevel@tonic-gateif if .failed else .failed then space 39*0Sstevel@tonic-gateelse if .failed else .passed then space 40*0Sstevel@tonic-gatethen 41*0Sstevel@tonic-gateif if .failed else .passed then space 42*0Sstevel@tonic-gateelse if .failed else .failed then space 43*0Sstevel@tonic-gatethen 44*0Sstevel@tonic-gateif if .failed else .failed then space 45*0Sstevel@tonic-gateelse if .passed else .failed then space 46*0Sstevel@tonic-gatethen 47*0Sstevel@tonic-gateif if .passed else .failed then space 48*0Sstevel@tonic-gateelse if .failed else .failed then space 49*0Sstevel@tonic-gatethen 50*0Sstevel@tonic-gatecr 51*0Sstevel@tonic-gate 52*0Sstevel@tonic-gate." Compiled single IF tests:" space 53*0Sstevel@tonic-gate: if-true? if .passed space 0 exit then .failed space 0 ; 1 if-true? 54*0Sstevel@tonic-gate: if-false? if .failed space 1 exit then .passed space 1 ; if-false? 55*0Sstevel@tonic-gate: true? if .passed else .failed then space 0 ; true? 56*0Sstevel@tonic-gate: false? if .failed else .passed then space ; false? 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gatecr 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate." Nested compiled IF test: " 61*0Sstevel@tonic-gate: if-test1 ( -- ) 62*0Sstevel@tonic-gate 0 1 0 if 63*0Sstevel@tonic-gate .failed 64*0Sstevel@tonic-gate else 65*0Sstevel@tonic-gate if 66*0Sstevel@tonic-gate dup if .failed then 67*0Sstevel@tonic-gate if .failed else .passed then 68*0Sstevel@tonic-gate else 69*0Sstevel@tonic-gate .failed 70*0Sstevel@tonic-gate then 71*0Sstevel@tonic-gate then 72*0Sstevel@tonic-gate; if-test1 space 73*0Sstevel@tonic-gate 74*0Sstevel@tonic-gate: .passed? ( str,len flag ) 75*0Sstevel@tonic-gate if if then if then .passed space else cr type space .failed cr then 76*0Sstevel@tonic-gate; 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gate: if-test2 ( x x x -- ) 79*0Sstevel@tonic-gate if 80*0Sstevel@tonic-gate if 81*0Sstevel@tonic-gate if 82*0Sstevel@tonic-gate 7 83*0Sstevel@tonic-gate else 84*0Sstevel@tonic-gate 6 85*0Sstevel@tonic-gate then 86*0Sstevel@tonic-gate else 87*0Sstevel@tonic-gate if 88*0Sstevel@tonic-gate 5 89*0Sstevel@tonic-gate else 90*0Sstevel@tonic-gate 4 91*0Sstevel@tonic-gate then 92*0Sstevel@tonic-gate then 93*0Sstevel@tonic-gate else 94*0Sstevel@tonic-gate if 95*0Sstevel@tonic-gate if 96*0Sstevel@tonic-gate 3 97*0Sstevel@tonic-gate else 98*0Sstevel@tonic-gate 2 99*0Sstevel@tonic-gate then 100*0Sstevel@tonic-gate else 101*0Sstevel@tonic-gate if 102*0Sstevel@tonic-gate 1 103*0Sstevel@tonic-gate else 104*0Sstevel@tonic-gate 0 105*0Sstevel@tonic-gate then 106*0Sstevel@tonic-gate then 107*0Sstevel@tonic-gate then 108*0Sstevel@tonic-gate; 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate " if-test2.0" 0 0 0 if-test2 0 = .passed? 111*0Sstevel@tonic-gate " if-test2.1" 1 0 0 if-test2 1 = .passed? 112*0Sstevel@tonic-gate " if-test2.2" 0 1 0 if-test2 2 = .passed? 113*0Sstevel@tonic-gate " if-test2.3" 1 1 0 if-test2 3 = .passed? 114*0Sstevel@tonic-gate " if-test2.4" 0 0 1 if-test2 4 = .passed? 115*0Sstevel@tonic-gate " if-test2.5" 1 0 1 if-test2 5 = .passed? 116*0Sstevel@tonic-gate " if-test2.6" 0 1 1 if-test2 6 = .passed? 117*0Sstevel@tonic-gate " if-test2.7" 1 1 1 if-test2 7 = .passed? 118*0Sstevel@tonic-gatecr 119