1\ #ident "%Z%%M% %I% %E% SMI" 2\ purpose: 3\ copyright: Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4\ copyright: Use is subject to license terms. 5\ copyright: 6\ copyright: CDDL HEADER START 7\ copyright: 8\ copyright: The contents of this file are subject to the terms of the 9\ copyright: Common Development and Distribution License, Version 1.0 only 10\ copyright: (the "License"). You may not use this file except in compliance 11\ copyright: with the License. 12\ copyright: 13\ copyright: You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 14\ copyright: or http://www.opensolaris.org/os/licensing. 15\ copyright: See the License for the specific language governing permissions 16\ copyright: and limitations under the License. 17\ copyright: 18\ copyright: When distributing Covered Code, include this CDDL HEADER in each 19\ copyright: file and include the License file at usr/src/OPENSOLARIS.LICENSE. 20\ copyright: If applicable, add the following below this CDDL HEADER, with the 21\ copyright: fields enclosed by brackets "[]" replaced with your own identifying 22\ copyright: information: Portions Copyright [yyyy] [name of copyright owner] 23\ copyright: 24\ copyright: CDDL HEADER END 25\ copyright: 26 27 ." parse:" 28 : $= ( str1 len1 str2 len2 -- true/false ) 29 2 pick <> if 30 3drop false 31 else 32 swap dup 0= if 33 3drop true 34 else 35 true swap 0 do 36 2 pick i + c@ 37 2 pick i + c@ 38 = and 39 loop nip nip 40 then 41 then 42 ; 43 : parse-test 44 " $= test.1" " abcd" " abcd" $= .passed? 45 " $= test.2" " abdc" " abcd" $= invert .passed? 46 " $= test.3" " abc" " abcd" $= invert .passed? 47 " 9600,8,n,1,-" 48 ascii , left-parse-string " 9600" $= " left-parse.1" rot .passed? 49 ascii , left-parse-string " 8" $= " left-parse.2" rot .passed? 50 ascii , left-parse-string " n" $= " left-parse.3" rot .passed? 51 ascii , left-parse-string " 1" $= " left-parse.4" rot .passed? 52 ascii , left-parse-string " -" $= " left-parse.5" rot .passed? 53 2drop 54 ; 55 parse-test 56 cr 57