Added define-enum-constants macro.
(And cleaned up all the enum constants in the OS-dependent subdirs)
This commit is contained in:
parent
70a1342cef
commit
e84440fecd
|
@ -7,10 +7,22 @@
|
|||
;;; The question: is / the best separator? Alternates: $ . |
|
||||
|
||||
|
||||
;;; (define-enum-constant fruit apple 1) =>
|
||||
;;; (define fruit/apple 1)
|
||||
|
||||
(define-syntax define-enum-constant
|
||||
(lambda (form rename compare)
|
||||
(let ((%define (rename 'define))
|
||||
(var (string->symbol (string-append (cadr form) "/"
|
||||
(var (string->symbol (string-append (symbol->string (cadr form)) "/"
|
||||
(symbol->string (caddr form)))))
|
||||
(value (cadddr form)))
|
||||
`(,%define ,var ,value))))
|
||||
|
||||
;;; (define-enum-constants fruit (apple 1) (orange 2))
|
||||
;;; => (begin (define-enum-constant fruit apple 1)
|
||||
;;; (define-enum-constant fruit orange 2))
|
||||
|
||||
(define-syntax define-enum-constants
|
||||
(syntax-rules ()
|
||||
((define-enum-constants set (elt val) ...)
|
||||
(begin (define-enum-constant set elt val) ...))))
|
||||
|
|
Loading…
Reference in New Issue