From ad57e361cbc8fb9c17d7b3cd9457c369dcd031a7 Mon Sep 17 00:00:00 2001 From: ram <ram> Date: Wed, 17 Oct 1990 03:36:12 +0000 Subject: [PATCH] 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. --- code/c-call.lisp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/code/c-call.lisp b/code/c-call.lisp index 50cf85ab6..a3536e141 100644 --- a/code/c-call.lisp +++ b/code/c-call.lisp @@ -276,19 +276,17 @@ (dolist (field fields) (unless (= (length field) 2) (error "Malformed field specification: ~S." field)) - (let* ((ftype (second field)) - (type (if (eq ftype pname) pname (get-c-type (second field)))) - (size (if (eq ftype pname) 32 (c-type-size type))) - (start (align-offset pos (if (eq ftype pname) 32 - (c-type-alignment type))))) + (let* ((type (get-c-type (second field))) + (size (c-type-size type)) + (start (align-offset pos (c-type-alignment type)))) + (unless size + (error "Variable size field ~A in record ~A not allowed." + (first field) name)) (push (make-field-info :name (first field) :type type :offset start :size size) info) - (unless size - (error "Variable size field ~A in record ~A not allowd." - (first field) name)) (setq pos (+ start size)) (setq align (max (find-alignment size) align)))) @@ -319,9 +317,7 @@ (let ((name (c-type-description record))) (mapcar #'(lambda (x) `(defoperator (,(symbolicate name "-" (field-info-name x)) - ,(c-type-description (let ((type (field-info-type x))) - (if (structurep type) type - (get-c-type type))))) + ,(c-type-description (field-info-type x))) ((rec ,name)) `(alien-index (alien-value ,rec) ,,(field-info-offset x) -- GitLab