Re: [Freeciv-Dev] guile buindings
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Markus Linnala wrote:
>
> Here is some preliminary patch to add guile scripting. Actually
> I was able to configure and compile system correctly and run
> guile-core at end of turn, but otherwise it is not working. This
> was just quick hack, and I don't have nowadays to desing and
> make it complete. I hope someone finds this patch usefull. And I
> also hope it has all parts in it.
Just to note, I'm working on server side bindings, some parts of code
could be used in common. For example almost all interface functions
could be the same.
I'm communicating with guile through abstract layer, so it should be
quite easy to change script language looking from server side - but in
this case all interface functions would have to be regenerated. Maybe
I'll be able to come with some idea how to generate interface functions
automatically - at least some of them. For example:
int unit-hp [int u]
{
struct unit * unit = get_unit_by_id(u);
int hp = unit ? unit->hp, 0;
RETURN [ hp ];
}
Which for guile would be translated to
SCM unit_hp_hook (SCM _u)
{
int u = scm2long(_u);
struct unit * unit = get_unit_by_id(u);
int hp = unit ? unit->hp, 0;
return long2scm(hp);
}
+ neccesary entries to define this fun in guile etc.
Artur
|
|