[OpenBIOS] [commit] r1380 - trunk/openbios-devel/forth/lib
repository service
svn at openbios.org
Sat Feb 20 14:22:09 CET 2016
Author: mcayland
Date: Sat Feb 20 14:22:09 2016
New Revision: 1380
URL: http://tracker.coreboot.org/trac/openbios/changeset/1380
Log:
string.fs: add functions to support ROT13 string encoding/decoding
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
Modified:
trunk/openbios-devel/forth/lib/string.fs
Modified: trunk/openbios-devel/forth/lib/string.fs
==============================================================================
--- trunk/openbios-devel/forth/lib/string.fs Sat Feb 13 14:34:31 2016 (r1379)
+++ trunk/openbios-devel/forth/lib/string.fs Sat Feb 20 14:22:09 2016 (r1380)
@@ -125,3 +125,17 @@
: parse-hex ( str len -- value )
base @ hex -rot $number if 0 then swap base !
;
+
+
+\ -----------------------------------------------------
+\ miscellaneous functions
+\ -----------------------------------------------------
+
+: rot13 ( c - c )
+ dup upc [char] A [char] M between if d# 13 + exit then
+ dup upc [char] N [char] Z between if d# 13 - then
+;
+
+: rot13-str ( str len -- newstr len )
+ strdup 2dup bounds ?do i c@ rot13 i c! loop
+;
More information about the OpenBIOS
mailing list