summaryrefslogtreecommitdiff
path: root/wm.scm
blob: 8304dca12d26b9568b9273bc2ed642e6cf8ca321 (about) (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
(define-module (wm)
  #:use-module (system foreign)
  #:export (wm-init wm-quit))

(define libschewm (dynamic-link "libschewm"))

(define (int-as-bool i)
  (not (eq? 0 i)))

(define (schewm-func return-type name args)
  (pointer->procedure
   return-type
   (dynamic-func name libschewm)
   args))

(define (wm-init)
  (let ((c/wm-init
         (schewm-func int "wm_init" '())))
    (int-as-bool (c/wm-init))))

(define (wm-quit s)
  (let ((c/wm-quit
         (schewm-func void "wm_quit" (list '*))))
  (c/wm-quit (string->pointer s))))