aboutsummaryrefslogtreecommitdiff
path: root/src/macros
diff options
context:
space:
mode:
Diffstat (limited to 'src/macros')
-rw-r--r--src/macros/macros.sc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/macros/macros.sc b/src/macros/macros.sc
index cf6be15..8ff799b 100644
--- a/src/macros/macros.sc
+++ b/src/macros/macros.sc
@@ -53,3 +53,17 @@
(with-alloc var gsl-rng*
(gsl-rng-alloc gsl-rng-default) gsl-rng-free
body ...))
+
+(sc-define-syntax (with-rstats var body ...)
+ (with-alloc var gsl-rstat-workspace*
+ (gsl-rstat-alloc) gsl-rstat-free
+ body ...))
+
+(sc-define-syntax (with-rstats* var n body ...)
+ (begin
+ (declare var (array gsl-rstat-workspace* 3))
+ (for-i i n
+ (array-set var i (gsl-rstat-alloc)))
+ body ...
+ (for-i i n
+ (gsl-rstat-free (array-get var i)))))