argument-type function
argumentp function
c-name-case function
+ c-qualifier-keyword generic
c-type macro class
c-type-alias macro
c-type-equal-p generic
+ c-type-qualifier-keywords function
c-type-qualifiers generic
c-type-space function
c-type-subtype generic
c-fragment
c-function-arguments
c-function-type
+c-qualifier-keyword
+ cl:symbol
c-tagged-type-kind
c-enum-type
c-struct-type
non-null then the final character of the returned string will be a space.
\end{describe}
+\begin{describe}{gf}{c-qualifier-keyword @<qualifier> @> @<string>}
+ Return, as a string, the C keyword corresponding to the Lisp @<qualifier>.
+
+ There is a standard method, which deals with many qualifiers. Additional
+ methods exist for qualifier keywords which need special handling, such as
+ @|:atomic|; they are not listed here explicitly.
+
+ \begin{describe}{meth}{c-qualifier-keyword @<keyword> @> @<string>}
+ Returns the @<keyword>'s print-name, in lower case. This is sufficient
+ for the standard qualifiers @|:const|, @|:restrict|, and @|:volatile|.
+ \end{describe}
+\end{describe}
+
+\begin{describe}{fun}{c-type-qualifier-keywords @<c-type> @> @<list>}
+ Return the @<c-type>'s qualifiers, as a list of C keyword names.
+\end{describe}
+
\subsection{Leaf types} \label{sec:clang.c-types.leaf}
(defmethod pprint-c-type ((type simple-c-type) stream kernel)
(pprint-logical-block (stream nil)
- (format stream "~{~(~A~) ~@_~}~A"
- (c-type-qualifiers type)
+ (format stream "~{~A ~@_~}~A"
+ (c-type-qualifier-keywords type)
(c-type-name type))
(funcall kernel stream 0 t)))
(defmethod pprint-c-type ((type tagged-c-type) stream kernel)
(pprint-logical-block (stream nil)
- (format stream "~{~(~A~) ~@_~}~(~A~) ~A"
- (c-type-qualifiers type)
+ (format stream "~{~A ~@_~}~(~A~) ~A"
+ (c-type-qualifier-keywords type)
(c-tagged-type-kind type)
(c-type-tag type))
(funcall kernel stream 0 t)))
(lambda (stream prio spacep)
(when spacep (c-type-space stream))
(maybe-in-parens (stream (> prio 1))
- (format stream "*~{~(~A~)~^ ~@_~}"
- (c-type-qualifiers type))
+ (format stream "*~{~A~^ ~@_~}"
+ (c-type-qualifier-keywords type))
(funcall kernel stream 1 (c-type-qualifiers type))))))
;; S-expression notation protocol.
The qualifiers of the returned type are the union of the requested
QUALIFIERS and the qualifiers already applied to TYPE."))
+(export 'c-qualifier-keyword)
+(defgeneric c-qualifier-keyword (qualifier)
+ (:documentation "Return the C keyword for the QUALIFIER (a Lisp keyword).")
+ (:method ((qualifier symbol)) (string-downcase qualifier)))
+
+(export 'c-type-qualifier-keywords)
+(defun c-type-qualifier-keywords (c-type)
+ "Return the type's qualifiers, as a list of C keyword names."
+ (mapcar #'c-qualifier-keyword (c-type-qualifiers c-type)))
+
(export 'c-type-subtype)
(defgeneric c-type-subtype (type)
(:documentation