guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile status. Some questions to adopt usage as embedded game.


From: Germán Diago
Subject: Re: Guile status. Some questions to adopt usage as embedded game.
Date: Wed, 26 Mar 2014 20:56:59 +0700

Very informative. Unfortunately the iOS part could be a showstopper for this very project :(

I would really like to improve things in guile. I have been for a long time a linux user and 
still remains my fav operating system, even if I am using a MAC now for work reasons.

But with the impossibility of linking in iOS and not a mature ecmascript backend or lua ready,
this is going to be difficult for now.

Thank you guys.



2014-03-26 4:13 GMT+07:00 Ludovic Courtès <address@hidden>:
address@hidden (Ludovic Courtès) skribis:

> Germán Diago <address@hidden> skribis:

[...]

>> 4.-  When writing a FFI from C++ functions, I know how guile code will
>> look, but I couldn't find any Ecmascript mapping documentation. Any
>> pointers where I could find something?
>
> In theory it should be possible to import and use Scheme functions from
> ECMAscript.  See
> <http://wingolog.org/archives/2009/02/22/ecmascript-for-guile>.

Here’s a session that uses the FFI from ECMAscript to bind the C
library’s ‘sqrt’ function:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,L ecmascript
Happy hacking with ECMAScript!  To switch back, type `,L scheme'.
ecmascript@(guile-user)> require('system.foreign');
;;; <unknown-location>: warning: possibly unbound variable `require'
$1 = #<<js-module-object> 27b94b0>
ecmascript@(guile-user)> this['dynamic-link'];
$2 = #<procedure dynamic-link (#:optional _)>
ecmascript@(guile-user)> this['dynamic-func'] ('sqrt', this['dynamic-link']());
$3 = #<pointer 0x7f5d7d79aae0>
ecmascript@(guile-user)> this['list'] ($1['double']);
$8 = (2)
ecmascript@(guile-user)> $1['pointer->procedure'] ($1['double'], $3, $8);
$9 = #<procedure 2a5fa20 (_)>
ecmascript@(guile-user)> $9 (2);
$10 = 1.4142135623730951
--8<---------------cut here---------------end--------------->8---

A bit verbose, but funny.  :-)

Ludo’.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]