This defines two types,
BOOL
and
LONG
, which are used to associate a Lisp boolean value (
t
or
nil
) with a C boolean of type
int
, and a Lisp
bignum
with a C
long
. These are required because the Windows function
GetCursorPos
returns a boolean to indicate if it has executed successfully, and the cursor's
x
and
y
positions are specified in a
long
format in the
POINT
structure.

Next, we need to define a structure for the FLI which is used to get the coordinates of the cursor. These coordinates will consist of an
x
and a
y
position. We use the define-c-typedef macro for this, and the resulting Lisp FLI code has obvious parallels with the C
tagPOINT
structure.

(fli:define-c-struct tagpoint

(x long)

(y long))

The
tagPOINT
structure for the FLI, corresponding to the C structure of the same name, has been defined. This now needs to be further defined as a type for the FLI, using define-c-typedef.

(fli:define-c-typedef point (:struct tagpoint))

Finally, a pointer type to point to the structure is required. It is this FLI pointer which will be passed to the Windows function
GetCursorPos
, so that
GetCursorPos
can change the
x
and
y
values of the structure pointed to.

(fli:define-c-typedef lppoint (:pointer point))

All the required FLI types have now been defined. Although it may seem that there is a level of duplicity in the definitions of the structures, pointers and types in this section, this was necessary to match the data structures of the C functions to which the FLI will interface. We can now move on to the definition of FLI functions to perform the interfacing.