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