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

Skip to first unread message

Lloyd Konneker

Jul 5, 2021, 11:55:35 AMJul 5
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->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

Jul 6, 2021, 10:36:26 AMJul 6
Nevermind, and sorry to pollute the forum. It was my stupid programming error.
Reply all
Reply to author
0 new messages