Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with modify tinyscheme to do late binding of unbound variable to a foreign func

34 views
Skip to first unread message

Lloyd Konneker

unread,
Jul 5, 2021, 11:55:35 AM7/5/21
to
I am hacking at the TinyScheme interpreter that is embedded in the GIMP open source image editing app.

Is this an appropriate forum to get help? or please point me to a more appropriate forum.

The idea is that whenever an unbound variable is encountered and the name exists in the GIMP API, create a foreign function object and bind it to the symbol in the global environment.

In C code of the tinyscheme interpreter, at the point the interpreter determines a symbol is unbound, more or less:

scheme_define (sc,
sc->global_env,
symbol,
sc->vptr->mk_foreign_func (sc, script_fu_marshal_procedure_call);

and then simply use the new binding as it would have been used if it was found in the first place.

Where symbol is an object of the interpreter ( type field is T_SYM and name field is "gimp-drawable-desaturate") and where script_fu_marshal_procedure_call is a foreign C function.
It seems to work, but right after the TS interpreter calls the foreign func, the symbol object is trashed: its name field is garbage. Whereas I expected it to still exist.

Probably just a stupid programming error, but is the concept sound?

Lloyd Konneker

unread,
Jul 6, 2021, 10:36:26 AM7/6/21
to
Nevermind, and sorry to pollute the forum. It was my stupid programming error.

Jeff Peck

unread,
Mar 29, 2022, 2:07:47 PM3/29/22
to
Oh, good!
So maybe I'm not the last person on the planet using TinyScheme/script-fu on GIMP.

Since you have been into the source code, I wonder if you are able to get the gimp-server working?
I did quick hack with emacs comint-mode to send the header-bytes and text, but gimp-server just hangs/dies.
[the window "Console" is painful to use... so integrating with emacs would be super nice]

0 new messages