c-types-impl.lisp
cl:* variable function c-type
cl:array class c-type
+ bool c-type
c-array-dimensions generic
c-array-type class
c-enum-type class
c-pointer-type class
c-struct-type class
c-tagged-type-kind generic
+ c-type-bool variable
+ c-type-char variable
+ c-type-double variable
+ c-type-double-complex variable
+ c-type-double-imaginary variable
+ c-type-float variable
+ c-type-float-complex variable
+ c-type-float-imaginary variable
+ c-type-int variable
+ c-type-long variable
+ c-type-long-double variable
+ c-type-long-double-complex variable
+ c-type-long-double-imaginary variable
+ c-type-long-long variable
c-type-name generic
+ c-type-ptrdiff-t variable
+ c-type-short variable
+ c-type-signed-char variable
+ c-type-size-t variable
c-type-tag generic
+ c-type-unsigned variable
+ c-type-unsigned-char variable
+ c-type-unsigned-long variable
+ c-type-unsigned-long-long variable
+ c-type-unsigned-short variable
+ c-type-va-list variable
+ c-type-void variable
+ c-type-wchar-t variable
c-union-type class
cl:char function setf c-type parser
commentify-argument-names function
(eql cl:function) t
(eql cl:nil) t
(eql cl:union) t
- (eql sod::bool) t
+ (eql bool) t
(eql double) t
(eql double-complex) t
(eql double-imaginary) t
(eql cl:float)
(eql cl:schar)
(eql cl:string)
- (eql sod::bool)
+ (eql bool)
(eql const-string)
(eql double)
(eql double-complex)
\end{describe}
\begin{describe}{mac}
- {defctype @{ @<name> @! (@<name> @<nickname>^*) @} @<type-spec>
- @> @<names>}
+ {defctype \=@{ @<name> @! (@<name>^+) @} @<type-spec> \+ \\
+ @[[ @|:export| @<export-flag> @]]^* \-
+ \nlret @<names>}
Defines a new symbolic type specifier @<name>; if a list of @<name>s is
given, then all are defined in the same way. The type constructed by using
any of the @<name>s is as described by the type specifier @<type-spec>.
The resulting type object is constructed once, at the time that the macro
expansion is evaluated; the same (@|eq|) value is used each time any
@<name> is used in a type specifier.
+
+ A variable named @|c-type-@<name>|, for the first @<name> only, is defined
+ and initialized to contain the C type object so constructed. Altering or
+ binding this name is discouraged.
+
+ If @<export-flag> is true, then the variable name, and all of the @<name>s,
+ are exported from the current package.
\end{describe}
\begin{describe}{mac}{c-type-alias @<original> @<alias>^* @> @<aliases>}
\end{describe}
\begin{describe}{mac}
- {define-simple-c-type @{ @<name> @! (@<name>^*) @} @<string> @> @<name>}
+ {define-simple-c-type \=@{ @<name> @! (@<name>^+) @} @<string> \+ \\
+ @[[ @|:export| @<export-flag> @]] \-
+ \nlret @<name>}
Define type specifiers for a new simple C type. Each symbol @<name> is
defined as a symbolic type specifier for the (unique interned) simple C
type whose name is the value of @<string>. Further, each @<name> is
defined to be a type operator: the type specifier @|(@<name>
@<qualifier>^*)| evaluates to the (unique interned) simple C type whose
name is @<string> and which has the @<qualifiers> (which are evaluated).
+
+ Furthermore, a variable @|c-type-@<name>| is defined, for the first @<name>
+ only, and initialized with the newly constructed C type object.
+
+ If @<export-flag> is true, then the @|c-type-@<name>| variable name, and
+ all of the @<name>s, are exported from the current package.
\end{describe}
\begin{describe}{cls}{tagged-c-type (qualifiable-c-type)
`(make-simple-type ,head (list ,@tail))))
(export 'define-simple-c-type)
-(defmacro define-simple-c-type (names type)
+(defmacro define-simple-c-type (names type &key export)
"Define each of NAMES to be a simple type called TYPE."
(let ((names (if (listp names) names (list names))))
`(progn
(setf (gethash ,type *simple-type-map*) ',(car names))
- (defctype ,names ,type)
+ (defctype ,names ,type :export ,export)
(define-c-type-syntax ,(car names) (&rest quals)
`(make-simple-type ,',type (list ,@quals))))))
;; Built-in C types.
-(export '(void
- float double long-double
- float-complex double-complex long-double-complex
- float-imaginary double-imaginary long-double-imaginary
- va-list size-t ptrdiff-t wchar-t
- char unsigned-char uchar signed-char schar
- int signed signed-int sint unsigned unsigned-int uint
- short signed-short short-int signed-short-int sshort
- unsigned-short unsigned-short-int ushort
- long signed-long long-int signed-long-int slong
- unsigned-long unsigned-long-int ulong
- long-long signed-long-long long-long-int signed-long-long-int
- unsigned-long-long unsigned-long-long-int llong sllong ullong))
-
-(define-simple-c-type void "void")
-
-(define-simple-c-type char "char")
-(define-simple-c-type (unsigned-char uchar) "unsigned char")
-(define-simple-c-type (signed-char schar) "signed char")
-(define-simple-c-type wchar-t "wchar-t")
-
-(define-simple-c-type (int signed signed-int sint) "int")
-(define-simple-c-type (unsigned unsigned-int uint) "unsigned")
+(define-simple-c-type void "void" :export t)
+
+(define-simple-c-type char "char" :export t)
+(define-simple-c-type (unsigned-char uchar) "unsigned char" :export t)
+(define-simple-c-type (signed-char schar) "signed char" :export t)
+(define-simple-c-type wchar-t "wchar-t" :export t)
+
+(define-simple-c-type (int signed signed-int sint) "int" :export t)
+(define-simple-c-type (unsigned unsigned-int uint) "unsigned" :export t)
(define-simple-c-type (short signed-short short-int signed-short-int sshort)
- "short")
+ "short" :export t)
(define-simple-c-type (unsigned-short unsigned-short-int ushort)
- "unsigned short")
+ "unsigned short" :export t)
(define-simple-c-type (long signed-long long-int signed-long-int slong)
- "long")
+ "long" :export t)
(define-simple-c-type (unsigned-long unsigned-long-int ulong)
- "unsigned long")
+ "unsigned long" :export t)
(define-simple-c-type (long-long signed-long-long long-long-int
signed-long-long-int llong sllong)
- "long long")
+ "long long" :export t)
(define-simple-c-type (unsigned-long-long unsigned-long-long-int ullong)
- "unsigned long long")
+ "unsigned long long" :export t)
-(define-simple-c-type float "float")
-(define-simple-c-type double "double")
-(define-simple-c-type long-double "long double")
+(define-simple-c-type float "float" :export t)
+(define-simple-c-type double "double" :export t)
+(define-simple-c-type long-double "long double" :export t)
-(define-simple-c-type bool "_Bool")
+(define-simple-c-type bool "_Bool" :export t)
-(define-simple-c-type float-complex "float _Complex")
-(define-simple-c-type double-complex "double _Complex")
-(define-simple-c-type long-double-complex "long double _Complex")
+(define-simple-c-type float-complex "float _Complex" :export t)
+(define-simple-c-type double-complex "double _Complex" :export t)
+(define-simple-c-type long-double-complex "long double _Complex" :export t)
-(define-simple-c-type float-imaginary "float _Imaginary")
-(define-simple-c-type double-imaginary "double _Imaginary")
-(define-simple-c-type long-double-imaginary "long double _Imaginary")
+(define-simple-c-type float-imaginary "float _Imaginary" :export t)
+(define-simple-c-type double-imaginary "double _Imaginary" :export t)
+(define-simple-c-type long-double-imaginary
+ "long double _Imaginary" :export t)
-(define-simple-c-type va-list "va_list")
-(define-simple-c-type size-t "size_t")
-(define-simple-c-type ptrdiff-t "ptrdiff_t")
+(define-simple-c-type va-list "va_list" :export t)
+(define-simple-c-type size-t "size_t" :export t)
+(define-simple-c-type ptrdiff-t "ptrdiff_t" :export t)
;;;--------------------------------------------------------------------------
;;; Tagged types (enums, structs and unions).