Permalink
Browse files

Introduce macro-case-target to write target language specific runtime…

… library code
  • Loading branch information...
1 parent 83d16ec commit 54f18e20ee03b4184870986c7b96b631df35b50e @feeley feeley committed Feb 26, 2014
Showing with 234 additions and 355 deletions.
  1. +1 −1 include/stamp.h
  2. +16 −0 lib/_gambit#.scm
  3. +217 −354 lib/_std.scm
View
@@ -3,4 +3,4 @@
*/
#define ___STAMP_YMD 20140226
-#define ___STAMP_HMS 31140
+#define ___STAMP_HMS 31334
View
@@ -498,6 +498,22 @@
;;;----------------------------------------------------------------------------
+(##define-macro (macro-case-target . clauses)
+ (let ((target (if (and (pair? ##compilation-options)
+ (pair? (car ##compilation-options)))
+ (let ((t (assq 'target ##compilation-options)))
+ (if t (cadr t) 'c))
+ 'c)))
+ (let loop ((clauses clauses))
+ (if (pair? clauses)
+ (let* ((clause (car clauses))
+ (cases (car clause)))
+ (if (or (eq? cases 'else)
+ (memq target cases))
+ `(begin ,@(cdr clause))
+ (loop (cdr clauses))))
+ `(begin)))))
+
(##define-macro (macro-if-forces forces noforces)
(if ((if (and (pair? ##compilation-options)
(pair? (car ##compilation-options)))
Oops, something went wrong.

0 comments on commit 54f18e2

Please sign in to comment.