aboutsummaryrefslogtreecommitdiff
path: root/src/macros
diff options
context:
space:
mode:
Diffstat (limited to 'src/macros')
-rw-r--r--src/macros/macros.sc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/macros/macros.sc b/src/macros/macros.sc
new file mode 100644
index 0000000..6ffc7ec
--- /dev/null
+++ b/src/macros/macros.sc
@@ -0,0 +1,12 @@
+(sc-define-syntax (for-i index limit body ...)
+ (for ((define index int 0)
+ (< index limit)
+ (set+ index 1))
+ body ...))
+
+(sc-define-syntax (with-alloc var type allocate free body ...)
+ (let* ()
+ (declare var type)
+ (set var allocate)
+ body ...
+ (free var)))