Is there simple way to calculate during compilation. Something like #. inĀ 
Common Lisp.

For example how to do something like
(case ftype
  ((#.(keyword->g-type 'enum)
    #.(keyword->g-type 'flags))
        (convert-to-foreign value (g-type->lisp type)))
  (#.(keyword->g-type 'double)
        (coerce value 'double-float))
  (#.(keyword->g-type 'float)
        (coerce value 'single-float))
  ((#.(keyword->g-type 'int)
    #.(keyword->g-type 'uint)
    #.(keyword->g-type 'long)
    #.(keyword->g-type 'ulong)
    #.(keyword->g-type 'int64)
    #.(keyword->g-type 'uint64)) 
        (round value))
  (else value))



where keyword->g-type is a function (-> symbol? exact-integer?).

I don't want to place resulting numbers, because then there will be a lot of 
"magic numbers" corresponfing to different foreign types. 


-- 
Roman Klochkov
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to