• 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)
  • From Lloyd Konneker@21:1/5 to All on Tue Jul 6 07:36:24 2021
    Nevermind, and sorry to pollute the forum. It was my stupid programming error.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeff Peck@21:1/5 to All on Tue Mar 29 11:07:44 2022
    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]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)