You don't. Adding ctypes is easy: to make a new ctype, you need to provide an existing ctype to build on, and two functions -- one to translate whatever to the existing type, and one to translate the other way.
Now, the _bitmask
type does just that -- it builds on _int
(but in your case, it's on _long
), and the two translation functions translate a list of symbols to an integer, and an integer to a list of symbols. Once such a type is used, you don't need to know the value of KeyPressMask
-- you just know that you can pass '(KeyPressMask)
as an InputMask
input to the foreign function, and that will be translated to the appropriate number; and you also know that when you get the result value from a function that has an InputMask
output, then it will be a list of symbols that might contain KeyPressMask
. The bottom line is that on the Scheme side you don't deal with numbers -- only with symbol lists.
If you do need to access these values for some obscure reason, then you can build your own ctype in some other way -- using make-ctype
(as I outlined above) should be very easy.