Help with modify tinyscheme to do late binding of unbound variable to a
From
Lloyd Konneker@21:1/5 to
All on Mon Jul 5 08:55:33 2021
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?
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)