Make enum work in non first order cases.
Closes PR 13323.
This commit is contained in:
parent
ff344a6622
commit
9fd9a42c61
|
@ -151,6 +151,9 @@
|
|||
;; Make sure `_box` at least compiles:
|
||||
(test #t ctype? (_fun (_box _int) -> _void))
|
||||
|
||||
;; Make sure that _enum works in non first order cases
|
||||
(test #t ctype? (let ([enum _enum]) (enum '(x y))))
|
||||
|
||||
(define-cstruct _ic7i ([i1 _int]
|
||||
[c7 _c7_list]
|
||||
[i2 _int]))
|
||||
|
|
|
@ -794,9 +794,9 @@
|
|||
;; ----------------------------------------------------------------------------
|
||||
;; Utility types
|
||||
|
||||
;; Call this with a name (symbol) and a list of symbols, where a symbol can be
|
||||
;; Call this with a name (symbol or #f) and a list of symbols, where a symbol can be
|
||||
;; followed by a '= and an integer to have a similar effect of C's enum.
|
||||
(define (_enum name symbols [basetype _ufixint] #:unknown [unknown _enum])
|
||||
(define ((_enum name) symbols [basetype _ufixint] #:unknown [unknown _enum])
|
||||
(define sym->int '())
|
||||
(define int->sym '())
|
||||
(define s->c
|
||||
|
@ -832,8 +832,8 @@
|
|||
(define-syntax (_enum* stx)
|
||||
(syntax-case stx ()
|
||||
[(_ x ...)
|
||||
(with-syntax ([name (syntax-local-name)]) #'(_enum 'name x ...))]
|
||||
[id (identifier? #'id) #'_enum]))
|
||||
(with-syntax ([name (syntax-local-name)]) #'((_enum 'name) x ...))]
|
||||
[id (identifier? #'id) #'(_enum #f)]))
|
||||
|
||||
;; Call this with a name (symbol) and a list of (symbol int) or symbols like
|
||||
;; the above with '= -- but the numbers have to be specified in some way. The
|
||||
|
|
Loading…
Reference in New Issue
Block a user