![]() | ||
| Home | SwiftX Archive | SwiftForth Archive | |

Hmm, I noticed that if 1- is left in and $Revision = "$Revision:xx" that
compare isn't equal but if $Revision2 = "x$Revision:xx1" also then it is...
-----Original Message-----
From: Bulgrien, Dennis
Sent: Tuesday, September 17, 2002 8:07
To: swiftx_at_forth.com
Subject: [swiftx] COMPARE Full Length
Why must I COMPARE one less than the length of a string for it to recognize
a match? I create two strings in the target image, $Revision being the
shorter one to match, $Revision2 being the longer one to scan. At compile
time the longer one is scanned with a DO loop starting from the first
character address. If the shorter is found at the I'th position it is
DUMPC'ed.
TARGET
S" $Revision:x" DUP 1+ ALLOT 2CONSTANT $Revision
S" x$Revision:x1" DUP 1+ ALLOT 2CONSTANT $Revision2
INTERPRETER
: $Revision, $Revision2 OVER + SWAP ?DO $Revision { 1- } I OVER COMPARE DUP
0= IF I 13 DUMPC DROP ELSE CR . THEN LOOP ;
$Revision,
Without 1- :
-1
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
With 1- :
-1
120CB 24 52 65 76 69 73 69 6F 6E 3A 78 31 FF $Revision:x1.
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
----------------------------------------------------------------------
THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
----------------------------------------------------------------------
THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
Received on Tue Sep 17 2002 - 06:41:44 PDT
This archive was generated by hypermail 2.2.0 : Mon Dec 01 2008 - 03:04:47 PST