diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/c/cpp.scm | 7 | ||||
-rw-r--r-- | module/vulgar/termios.scm | 12 |
2 files changed, 7 insertions, 12 deletions
diff --git a/module/c/cpp.scm b/module/c/cpp.scm index 69e21d27..2fe842c8 100644 --- a/module/c/cpp.scm +++ b/module/c/cpp.scm @@ -114,7 +114,10 @@ (string-append "cpp -dM " header-file)) read-lines))) -(define-macro (include# header-file) +(define-macro (include# header-file . args) + + (define define-form (if (null? args) 'define (car args))) + (define lines (remove (compose private-c-symbol? car) (tokenize-header-file header-file))) @@ -131,7 +134,7 @@ (define graph (add-node graph* (cons '_POSIX_VDISABLE #f) '())) `(begin - ,@(map (lambda (pair) `(define ,(car pair) ,(cdr pair))) + ,@(map (lambda (pair) `(,define-form ,(car pair) ,(cdr pair))) (resolve-dependency-graph graph)))) diff --git a/module/vulgar/termios.scm b/module/vulgar/termios.scm index 3fe82f92..62212122 100644 --- a/module/vulgar/termios.scm +++ b/module/vulgar/termios.scm @@ -7,6 +7,7 @@ :use-module (ice-9 format) :use-module (ice-9 rdelim) :use-module (srfi srfi-9) ; records + :use-module (c cpp) :use-module (util) :export (make-termios copy-termios @@ -14,16 +15,7 @@ -;;; Constants, TODO, auto parse these from -;; /usr/include/bits/termios.h - -(define-public ECHO 0000010) -(define-public ICANON 0000002) - -;; @var{when} values -(define-public TCSANOW 0) -(define-public TCSADRAIN 1) -(define-public TCSAFLUSH 2) +(include# "/usr/include/termios.h" define-public) |