2N/A\ #ident "%Z%%M% %I% %E% SMI"
2N/A\ purpose:
2N/A\ copyright: Copyright 2005 Sun Microsystems, Inc. All rights reserved.
2N/A\ copyright: Use is subject to license terms.
2N/A\ copyright:
2N/A\ copyright: CDDL HEADER START
2N/A\ copyright:
2N/A\ copyright: The contents of this file are subject to the terms of the
2N/A\ copyright: Common Development and Distribution License, Version 1.0 only
2N/A\ copyright: (the "License"). You may not use this file except in compliance
2N/A\ copyright: with the License.
2N/A\ copyright:
2N/A\ copyright: You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A\ copyright: or http://www.opensolaris.org/os/licensing.
2N/A\ copyright: See the License for the specific language governing permissions
2N/A\ copyright: and limitations under the License.
2N/A\ copyright:
2N/A\ copyright: When distributing Covered Code, include this CDDL HEADER in each
2N/A\ copyright: file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A\ copyright: If applicable, add the following below this CDDL HEADER, with the
2N/A\ copyright: fields enclosed by brackets "[]" replaced with your own identifying
2N/A\ copyright: information: Portions Copyright [yyyy] [name of copyright owner]
2N/A\ copyright:
2N/A\ copyright: CDDL HEADER END
2N/A\ copyright:
2N/A
2N/A ." parse:"
2N/A : $= ( str1 len1 str2 len2 -- true/false )
2N/A 2 pick <> if
2N/A 3drop false
2N/A else
2N/A swap dup 0= if
2N/A 3drop true
2N/A else
2N/A true swap 0 do
2N/A 2 pick i + c@
2N/A 2 pick i + c@
2N/A = and
2N/A loop nip nip
2N/A then
2N/A then
2N/A ;
2N/A : parse-test
2N/A " $= test.1" " abcd" " abcd" $= .passed?
2N/A " $= test.2" " abdc" " abcd" $= invert .passed?
2N/A " $= test.3" " abc" " abcd" $= invert .passed?
2N/A " 9600,8,n,1,-"
2N/A ascii , left-parse-string " 9600" $= " left-parse.1" rot .passed?
2N/A ascii , left-parse-string " 8" $= " left-parse.2" rot .passed?
2N/A ascii , left-parse-string " n" $= " left-parse.3" rot .passed?
2N/A ascii , left-parse-string " 1" $= " left-parse.4" rot .passed?
2N/A ascii , left-parse-string " -" $= " left-parse.5" rot .passed?
2N/A 2drop
2N/A ;
2N/A parse-test
2N/A cr