From c31a57815be4d3ef5f6fd28cc9a34b3be55bfe56 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 5 Feb 2021 15:00:27 +0530 Subject: Migrate C source to SC. sph-sc is a scheme-like S-expression syntax for C. It elements much of the pain and repetition involved in writing C syntax. * src/extent-sampling.c, src/gaussian-nd-random.c, src/nd-random.c, src/oracles.c, src/utils.c: Delete files. * src/extent-sampling.sc, src/gaussian-nd-random.sc, src/macros/macros.sc, src/nd-random.sc, src/oracles.sc, src/utils.sc: New files. * CMakeLists.txt: Generate C source files from SC source files. --- src/macros/macros.sc | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/macros/macros.sc (limited to 'src/macros') 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))) -- cgit v1.2.3