aboutsummaryrefslogtreecommitdiff
path: root/src/macros
diff options
context:
space:
mode:
authorArun Isaac2021-05-07 16:45:28 +0530
committerArun Isaac2021-05-07 17:05:07 +0530
commit4224e183522b696e60556c8ea88dec5409d8a746 (patch)
tree732799e61eb3032fabdcfb9960f22d63097ea966 /src/macros
parent80949873b409a54f7cb7e8defe9fe640670a1ae1 (diff)
downloadnsmc-4224e183522b696e60556c8ea88dec5409d8a746.tar.gz
nsmc-4224e183522b696e60556c8ea88dec5409d8a746.tar.lz
nsmc-4224e183522b696e60556c8ea88dec5409d8a746.zip
Move with-rstats and define with-rstats* sc macros.
* src/extent-sampling.sc (with-rstats): Move to ... * src/macros/macros.sc (with-rstats): ... to here. (with-rstats*): New macro.
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)))))