summary refs log tree commit diff stats
path: root/lib/util.sld
blob: fc6a24b15253a9f64bb77533d26c689d621b0d95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(module (acdwm util) (
                      define-public
                      ignore
                      DEBUG
                      dprint
                      )

  (import scheme (chicken base)
          (chicken port))

  (define-syntax define-public
    (syntax-rules ()
      ((define-public (name . arg) forms ...)
       (begin (export name)
              (define (name . arg) forms ...)))
      ((define-public (name args ...) forms ...)
       (begin (export name)
              (define (name args ...) forms ...)))
      ((define-public name value)
       (begin (export name)
              (define name value)))))

  (define (ignore . _) #f)

  (define (eprint . xs)
    (with-output-to-port (current-error-port)
      (lambda () (apply print xs))))

  (define DEBUG (make-parameter #f))

  (define (dprint . xs)
    (when (DEBUG)
      (apply eprint xs))))