From 3e457210bd5b513828a19ea4baa63c899626fbff Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Sat, 29 Aug 2009 20:42:22 +0000 Subject: [PATCH] Implement "$=" to compare two strings (needed by BootX) git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@572 f158a5a8-5612-0410-a976-696ce0be7e32 --- forth/bootstrap/bootstrap.fs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/forth/bootstrap/bootstrap.fs b/forth/bootstrap/bootstrap.fs index 7c59c7b..8a76842 100644 --- a/forth/bootstrap/bootstrap.fs +++ b/forth/bootstrap/bootstrap.fs @@ -533,6 +533,20 @@ variable leaves 0 leaves ! drop ; +\ compare two string + +: $= ( str1 len1 str2 len2 -- true|false ) + rot ( str1 str2 len2 len1 ) + over ( str1 str2 len2 len1 len2 ) + <> if ( str1 str2 len2 ) + 3drop + false + else ( str1 str2 len2 ) + comp + 0= + then +; + \ : +! tuck @ + swap ! ; : off false swap ! ; : on true swap ! ;