Truth-in-advertising documentation: confession is good for the soul.

This commit is contained in:
shivers 1996-11-09 23:13:35 +00:00
parent f96eafa42b
commit 52cd685e9a
1 changed files with 10 additions and 3 deletions

View File

@ -2,7 +2,9 @@
;;; Handy for defining random flags and constants.
;;; (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: $ . |
@ -12,8 +14,13 @@
(define-syntax define-enum-constant
(lambda (form rename compare)
(let ((%define (rename 'define))
(var (string->symbol (string-append (symbol->string (cadr form)) "/"
(let* ((%define (rename 'define))
(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)))))
(value (cadddr form)))
`(,%define ,var ,value))))