wisp
 
(Arne Babenhauserheide)
2013-12-31: add syntax case as alternate again (for debugging) support-scheme-macro-paren-quoting

add syntax case as alternate again (for debugging)

diff --git a/examples/tinyenc.w b/examples/tinyenc.w
--- a/examples/tinyenc.w
+++ b/examples/tinyenc.w
@@ -44,6 +44,30 @@ define-syntax with-split-vk
             . exp exp* ...
 
 
+; TODO: Define a macro with-split-kv which executes its body with let bindings to k0 k1 k2 k3 v0 and v1
+; Use syntax-case to be able to break hygiene.
+; http://www.gnu.org/software/guile/manual/html_node/Syntax-Case.html#index-with_002dsyntax
+define-syntax with-split-vk
+  lambda : x
+    syntax-case x :
+      : with-split-vk v k exp exp* ...
+        with-syntax
+          : k0 : datum->syntax x 'k0
+            k1 : datum->syntax x 'k1
+            k2 : datum->syntax x 'k2
+            k3 : datum->syntax x 'k3
+            v0 : datum->syntax x 'v0
+            v1 : datum->syntax x 'v1
+          let
+            : v0 : uint32 : ash v -32
+              v1 : uint32 v
+              k0 : uint32 : ash k -96
+              k1 : uint32 : ash k -64
+              k2 : uint32 : ash k -32
+              k3 : uint32 k
+            . exp exp* ...
+
+
 define : encrypt v k
   . "Encrypt the 64bit (8 byte, big endian) value V with the 128bit key K (16 byte)."
 ;   with-split-vk v k