Last active
August 29, 2015 13:57
-
-
Save Madsy/9712545 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-module (lambda-demo opengl enums) | |
#:use-module (rnrs bytevectors) | |
#:export (gl-enum)) | |
(eval-when (expand load eval) | |
(define *gl-enums* | |
'((depth-buffer-bit . #x100 ) | |
(stencil-buffer-bit . #x400 ) | |
(color-buffer-bit . #x4000 ) | |
(false . #x0 ) | |
(true . #x1 ) | |
(points . #x0 ) | |
(lines . #x1 ) | |
(line-loop . #x2 ) | |
(line-strip . #x3 ) | |
(triangles . #x4 ) | |
(triangle-strip . #x5 ) | |
(triangle-fan . #x6 ) | |
(quads . #x7 ) | |
(mirror-clamp-to-edge . #x8743 )))) | |
;(define-syntax-rule (gl-enum enum) | |
; (cdr (assq enum *gl-enums*))) | |
(define-syntax gl-enum | |
(lambda (form) | |
(syntax-case form () | |
((gl-enum kw) | |
(let ((val (assq-ref *gl-enums* (syntax->datum #'kw)))) | |
(if val | |
(datum->syntax #'kw val) | |
(syntax-violation 'gl-enum "unknown keyword" form))))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment