2 ;; (import-define ...) is a combination of an import clause and a
3 ;; define clause so as to set up a "raw" import with a call wrapper.
7 ; (define-import PCM LIB
9 ; "void*" PCM ; "void*" ; snd_pcm_t **pcmp [output]
10 ; "char*" NAME ; const char *name
11 ; "int" STREAM ; snd_pcm_stream_t stream
12 ; "int" MODE ; int mode
15 (define-macro (define-import DATA LIB)
17 (println (history true))
18 (letn ((ARGL (transpose (explode (2 (args)) 2)))
19 (HERE (prefix (last (ARGL 1))))
20 (RAW (context (sym (string (println (term HERE)) ".raw"))))
23 (FN (cons (sym (args 0) HERE) (filter (fn (x) (!= DATA x)) ARGS)))
25 (IMP (apply import (filter string? (cons LIB (args)))))
27 (println (list 'FN FN))
30 (CALL (cons IMP ARGS))
33 (let ((DATA (pack "Lu" 0)))
35 ((unpack "Lu" DATA) 0)))))
36 (letex ((FN FN) (CALL (cons IMP ARGS)))
39 (global 'define-import)