A foreign pointer to an object of type
VARIANT
.
A keyword specifying the type of value.
The value to store in variant .
The function
set-variant
can be used to set the type and value of a
VARIANT
object. It is useful if the default type provided by the automatic conversion for
VARIANT
return values is incorrect. The value of meaning of
type
is an specified below
If
type
is
nil
then the actual VT code is chosen dynamically according to the Lisp type of
value
(see Automation types, VT codes and their corresponding Lisp types).
If
type
is a cons of the form
(:array .
type
)
for some keyword
type
, then
variant
is set to contain an array of objects of
type
. Each element of
value
is expected to be suitable for conversion to
type
.
If
type
is
:array
or another list starting with
:array
then
variant
is set to contain an array of
VARIANT
objects with the same dimensions as
value
. Each element of
value
is converted as if by calling
set-variant
with a type chosen as follows:
:array
, then
nil
is passed as the element type.
(:array
array
)
then
array
should be an array with the same dimensions as
value
. The element type is taken from the corresponding element of
array
.
(:array .
types
)
then
types
should be a suitable value for the
:initial-contents
argument to
make-array
to make an array of types with the same dimensions as
value
. The element type is taken from the corresponding element of that array. In particular, if
value
is a
vector
of length
n
then
type
should be a list of the form
(:array
type
1
type
2
...
type
n
)
.
(set-variant v :null)
(set-variant v :short 10)
(set-variant v '(:pointer :short) ptr)
(set-variant v '(:array :short :int) #(1 2))