diff options
Diffstat (limited to 'lib/util.sld')
-rw-r--r-- | lib/util.sld | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/util.sld b/lib/util.sld new file mode 100644 index 0000000..fc6a24b --- /dev/null +++ b/lib/util.sld | |||
@@ -0,0 +1,33 @@ | |||
1 | (module (acdwm util) ( | ||
2 | define-public | ||
3 | ignore | ||
4 | DEBUG | ||
5 | dprint | ||
6 | ) | ||
7 | |||
8 | (import scheme (chicken base) | ||
9 | (chicken port)) | ||
10 | |||
11 | (define-syntax define-public | ||
12 | (syntax-rules () | ||
13 | ((define-public (name . arg) forms ...) | ||
14 | (begin (export name) | ||
15 | (define (name . arg) forms ...))) | ||
16 | ((define-public (name args ...) forms ...) | ||
17 | (begin (export name) | ||
18 | (define (name args ...) forms ...))) | ||
19 | ((define-public name value) | ||
20 | (begin (export name) | ||
21 | (define name value))))) | ||
22 | |||
23 | (define (ignore . _) #f) | ||
24 | |||
25 | (define (eprint . xs) | ||
26 | (with-output-to-port (current-error-port) | ||
27 | (lambda () (apply print xs)))) | ||
28 | |||
29 | (define DEBUG (make-parameter #f)) | ||
30 | |||
31 | (define (dprint . xs) | ||
32 | (when (DEBUG) | ||
33 | (apply eprint xs)))) | ||