Truth-in-advertising documentation: confession is good for the soul.
This commit is contained in:
parent
f96eafa42b
commit
52cd685e9a
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
;;; Handy for defining random flags and constants.
|
;;; Handy for defining random flags and constants.
|
||||||
;;; (define-enum-constant "errno" intr 9) => (define errno/intr 9)
|
;;; (define-enum-constant "errno" intr 9) => (define errno/intr 9)
|
||||||
;;; Ugly, but it works.
|
|
||||||
|
;;; This is deeply bogus code. It merely serves to demonstrate what a loser
|
||||||
|
;;; I am when it comes to serious modern-tech macrology.
|
||||||
|
|
||||||
;;; The question: is / the best separator? Alternates: $ . |
|
;;; The question: is / the best separator? Alternates: $ . |
|
||||||
|
|
||||||
|
@ -12,8 +14,13 @@
|
||||||
|
|
||||||
(define-syntax define-enum-constant
|
(define-syntax define-enum-constant
|
||||||
(lambda (form rename compare)
|
(lambda (form rename compare)
|
||||||
(let ((%define (rename 'define))
|
(let* ((%define (rename 'define))
|
||||||
(var (string->symbol (string-append (symbol->string (cadr form)) "/"
|
(base (let ((b (cadr form)))
|
||||||
|
(cond ((string? b) b)
|
||||||
|
((symbol? b) (symbol->string b))
|
||||||
|
(else (error "Enum constant base must be symbol or string"
|
||||||
|
b )))))
|
||||||
|
(var (string->symbol (string-append base "/"
|
||||||
(symbol->string (caddr form)))))
|
(symbol->string (caddr form)))))
|
||||||
(value (cadddr form)))
|
(value (cadddr form)))
|
||||||
`(,%define ,var ,value))))
|
`(,%define ,var ,value))))
|
||||||
|
|
Loading…
Reference in New Issue