Lisp HUG Maillist Archive

FLI conversion of types

Is it possible in the FLI definition of a function to just force the conversion of numeric values to the proper type? For example, if I have the following foreign function:

(define-foreign-function (rotate-object "RotateObject")
    ((pitch :float)
     (yaw :float)
     (roll :float))
  ...)

I can't call this with integer values:

(rotate-object 90 0 0) ; <-- error

One would think that LW could just do the conversion of types automatically. Now, for contant values, this isn't much of a problem, because I can just put .0 on the end of the numbers and now it works. But when I use symbols, since they can technically represent anything, I have to wrap them with (float ...) in order to force the conversion. Likewise, I have to use (truncate ...) for integer parameters.

Is there a way in the :lambda-list of the FLI definition to force (float) or (truncate)? If not, will future versions of LW just do this for me, please? :-)

Jeff M.

--
massung@gmail.com

Re: FLI conversion of types

Unable to parse email body. Email id is 5305

Re: FLI conversion of types

Unable to parse email body. Email id is 5308

Re: FLI conversion of types

i am using lisp personal edition LW4.4
i am facing problem with the lispwork itself when i am interpreting
some function which are not syntactically correct more than 3 or 4
times the lisp work automatically starts a dos prompt shell of lisp
interpretor and the gui lispwork stop works and on closing the dos
prompt shell the whole lisp work closes .
is i have to redownload the whole lispwork ?

thanx
yasar
On 2/7/06, Martin Simmons <martin@lispworks.com> wrote:
>
> Hi Jeff & Yasar,
>
> There is an example in the manual:
>
> http://www.lispworks.com/documentation/lw445/FLI/html/fli-162.htm
>
> You can define this as a named type using FLI:DEFINE-FOREIGN-TYPE, e.g.
>
> (fli:define-foreign-type integer-as-string ()
>   '(:wrapper :int
>               :lisp-to-foreign read-from-string
>               :foreign-to-lisp prin1-to-string))
>
> and conversions for float/int can be handled similarly.
>
> --
> Martin Simmons                              Email: martin@lispworks.com
> LispWorks Ltd, St John's Innovation Centre    TEL:   +44 1223 421860
> Cowley Road, Cambridge CB4 0WS, England.      FAX:   +44 870 2206189
>
>


--
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
solely for the use of the addressee(s). If you are not the intended
recipient, please notify the sender by e-mail and delete the original
message. Further, you are not to copy, disclose, or distribute this
e-mail or its contents to any other person and any such actions are
unlawful. This e-mail may contain viruses. Enggsylph has taken every
reasonable precaution to minimize this risk, but is not liable for any
damage you may sustain as a result of any virus in this e-mail. You
should carry out your own virus checks before opening the e-mail or
attachment. enggsylph reserves the right to monitor and review the
content of all messages sent to or from this e-mail address. Messages
sent to or from this e-mail address may be stored on the I e-mail
system.
***ENGG SYLPH******** End of Disclaimer ********ENGG SYLPH***


Re: FLI conversion of types

Unable to parse email body. Email id is 5324

Updated at: 2020-12-10 08:49 UTC