convert enumerators written with a value
(wire-varint 0) is a pair, and both the writer and map-fields only expected a name: the writer passed it out unconverted, and a macro mapping over the enum was handed the pair. Fixes #46.
This commit is contained in:
@@ -334,7 +334,8 @@
|
||||
(else (equal? pattern type))))
|
||||
|
||||
;;; Map function to each field/value of a structure/union/enum
|
||||
;;; For enums, field-type is the type of the enum (since C 23)
|
||||
;;; For enums, field-type is the type of the enum (since C 23), and
|
||||
;;; field-name the enumerator's name, (wire-varint 0) or not
|
||||
;;; (map-fields type-name
|
||||
;;; (lambda (field-name field-type) ...))
|
||||
;;;
|
||||
@@ -350,7 +351,8 @@
|
||||
;; declared, since `enum some-typedef' is not a C type.
|
||||
((enum)
|
||||
(let ((type (list 'enum (cadr info))))
|
||||
(map (lambda (value) (fn value type))
|
||||
(map (lambda (value)
|
||||
(fn (if (pair? value) (car value) value) type))
|
||||
(caddr info))))
|
||||
(else #f)))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user