Skip to content
Snippets Groups Projects
Commit ad57e361 authored by ram's avatar ram
Browse files

Changed def-c-record to make the field-info-type always be a c-type,

since that's what the slot is declared to be.  Also, check for
variable size element type before creating the field-info, since the
field-info-size must be an integer.
parent f452b954
No related branches found
No related tags found
No related merge requests found
...@@ -276,19 +276,17 @@ ...@@ -276,19 +276,17 @@
(dolist (field fields) (dolist (field fields)
(unless (= (length field) 2) (unless (= (length field) 2)
(error "Malformed field specification: ~S." field)) (error "Malformed field specification: ~S." field))
(let* ((ftype (second field)) (let* ((type (get-c-type (second field)))
(type (if (eq ftype pname) pname (get-c-type (second field)))) (size (c-type-size type))
(size (if (eq ftype pname) 32 (c-type-size type))) (start (align-offset pos (c-type-alignment type))))
(start (align-offset pos (if (eq ftype pname) 32 (unless size
(c-type-alignment type))))) (error "Variable size field ~A in record ~A not allowed."
(first field) name))
(push (make-field-info :name (first field) (push (make-field-info :name (first field)
:type type :type type
:offset start :offset start
:size size) :size size)
info) info)
(unless size
(error "Variable size field ~A in record ~A not allowd."
(first field) name))
(setq pos (+ start size)) (setq pos (+ start size))
(setq align (max (find-alignment size) align)))) (setq align (max (find-alignment size) align))))
...@@ -319,9 +317,7 @@ ...@@ -319,9 +317,7 @@
(let ((name (c-type-description record))) (let ((name (c-type-description record)))
(mapcar #'(lambda (x) (mapcar #'(lambda (x)
`(defoperator (,(symbolicate name "-" (field-info-name x)) `(defoperator (,(symbolicate name "-" (field-info-name x))
,(c-type-description (let ((type (field-info-type x))) ,(c-type-description (field-info-type x)))
(if (structurep type) type
(get-c-type type)))))
((rec ,name)) ((rec ,name))
`(alien-index (alien-value ,rec) `(alien-index (alien-value ,rec)
,,(field-info-offset x) ,,(field-info-offset x)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment