xref: /titanic_50/usr/src/lib/efcode/fcode_test/parse.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 ." parse:"
28*7c478bd9Sstevel@tonic-gate : $=  ( str1 len1 str2 len2 -- true/false )
29*7c478bd9Sstevel@tonic-gate   2 pick <> if
30*7c478bd9Sstevel@tonic-gate      3drop false
31*7c478bd9Sstevel@tonic-gate   else
32*7c478bd9Sstevel@tonic-gate      swap dup 0= if
33*7c478bd9Sstevel@tonic-gate         3drop true
34*7c478bd9Sstevel@tonic-gate      else
35*7c478bd9Sstevel@tonic-gate         true swap 0 do
36*7c478bd9Sstevel@tonic-gate            2 pick i + c@
37*7c478bd9Sstevel@tonic-gate            2 pick i + c@
38*7c478bd9Sstevel@tonic-gate            = and
39*7c478bd9Sstevel@tonic-gate         loop nip nip
40*7c478bd9Sstevel@tonic-gate      then
41*7c478bd9Sstevel@tonic-gate   then
42*7c478bd9Sstevel@tonic-gate ;
43*7c478bd9Sstevel@tonic-gate : parse-test
44*7c478bd9Sstevel@tonic-gate   " $= test.1" " abcd" " abcd" $= .passed?
45*7c478bd9Sstevel@tonic-gate   " $= test.2" " abdc" " abcd" $= invert .passed?
46*7c478bd9Sstevel@tonic-gate   " $= test.3" " abc"  " abcd" $= invert .passed?
47*7c478bd9Sstevel@tonic-gate   " 9600,8,n,1,-"
48*7c478bd9Sstevel@tonic-gate   ascii , left-parse-string " 9600" $= " left-parse.1" rot .passed?
49*7c478bd9Sstevel@tonic-gate   ascii , left-parse-string " 8"    $= " left-parse.2" rot .passed?
50*7c478bd9Sstevel@tonic-gate   ascii , left-parse-string " n"    $= " left-parse.3" rot .passed?
51*7c478bd9Sstevel@tonic-gate   ascii , left-parse-string " 1"    $= " left-parse.4" rot .passed?
52*7c478bd9Sstevel@tonic-gate   ascii , left-parse-string " -"    $= " left-parse.5" rot .passed?
53*7c478bd9Sstevel@tonic-gate   2drop
54*7c478bd9Sstevel@tonic-gate ;
55*7c478bd9Sstevel@tonic-gate parse-test
56*7c478bd9Sstevel@tonic-gate cr
57