;; Despite the fact that it looks pretty trivial, this can't be done with
;; `defstruct' for the simple reason that we add more methods to the
;; accessor functions later.
- ((label :type keyword :initarg :label :reader ds-label)
+ ((%label :type keyword :initarg :label :reader ds-label)
(name :type string :initarg :name :reader ds-name)
- (kind :type (member type complexity sign size qualifier specs)
+ (kind :type (member %type complexity sign size qualifier %specs)
:initarg :kind :reader ds-kind)
(taggedp :type boolean :initarg :taggedp
:initform nil :reader ds-taggedp))
(defparameter *declspec-map*
(let ((map (make-hash-table :test #'equal)))
- (dolist (item '((type :void :char :int :float :double
- (:bool :compat "_Bool"))
+ (dolist (item '((%type :char :int :float :double)
(complexity (:complex :compat "_Complex")
(:imaginary :compat "_Imaginary"))
((type :taggedp t) :enum :struct :union)
(if (consp spec) spec (list spec)))
(dolist (spec (cdr item))
(destructuring-bind (label
- &key
- (name (string-downcase label))
- compat
- (taggedp taggedp))
+ &key (name (string-downcase label))
+ compat (taggedp taggedp))
(if (consp spec) spec (list spec))
(let ((ds (make-instance 'declspec
:label label
(:documentation "Carrier for a storage specifier."))
(defmethod ds-label ((spec storespec)) spec)
-(defmethod ds-kind ((spec storespec)) 'specs)
+(defmethod ds-kind ((spec storespec)) '%specs)
(defmethod ds-label ((ty c-type)) :c-type)
(defmethod ds-name ((ty c-type)) (princ-to-string ty))
-(defmethod ds-kind ((ty c-type)) 'type)
+(defmethod ds-kind ((ty c-type)) '%type)
;; A collection of declaration specifiers, and how to merge them together.
(defclass declspecs ()
;; This could have been done with `defstruct' just as well, but a
;; `defclass' can be tweaked interactively, which is a win at the moment.
- ((type :initform nil :initarg :type :reader ds-type)
+ ((%type :initform nil :initarg :type :reader ds-type)
(complexity :initform nil :initarg :complexity :reader ds-complexity)
(sign :initform nil :initarg :sign :reader ds-sign)
(size :initform nil :initarg :size :reader ds-size)
- (specs :initform nil :initarg :specs :reader ds-specs)
+ (%specs :initform nil :initarg :specs :reader ds-specs)
(qualifier :initform nil :initarg :qualifiers :reader ds-qualifiers))
(:documentation "Represents a collection of declaration specifiers.
;; Turns out to be easier to do this by hand.
(let ((ds (and (eq (token-type scanner) :id)
(let ((kw (token-value scanner)))
- (or (and (boundp '*module-type-map*)
+ (or (gethash kw *declspec-map*)
+ (and (boundp '*module-type-map*)
(gethash kw *module-type-map*))
- (gethash kw *declspec-map*))))))
+ (find-simple-c-type kw))))))
(cond ((or (not ds) (and predicate (not (funcall predicate ds))))
(values (list indicator) nil nil))
((and (typep ds 'declspec) (ds-taggedp ds))
(disallow-keyword-functions (type)
(when (typep type 'c-keyword-function-type)
(error "Functions with keyword arguments are only ~
- allowed at top-level.")))
+ allowed at top-level")))
(star ()
;; Prefix: `*' qualifiers