Re: Script-Fu/tinyscheme: using scheme_call?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/10/07, Kevin Cozens <kevin@xxxxxxxxx> wrote:

> Have you also looked at init_procedures() and marshall_proc_db_call() in the
> scheme_wrapper.c file? You will find other examples of defining Scheme
> routines that will call C when invoked and which require parameters.

Our current setup uses init_procedures to load our functions, and is
based on what we found there.  Many of the functions listed there do
an excellent job of parsing arguments passed from Scheme, but the only
Script-Fu/Tiny-Fu way we've been able to find to make calls back to
the Scheme interpreter is using the ts_interpret_string function,
which calls tinyscheme's scheme_load_string and requires that you know
the string name of the procedure you're trying to call.

> That is about all I can suggest for the moment without knowing the specifics
> of the situtation where you feel you have to use scheme_call.

We're currently working on a function called from the
Script-Fu/Tiny-Fu console like
(pixel-map drawable function)
that maps said function (which takes an argument for each channel in
the drawable and returns a list of new values for each channel) to
every pixel in a drawable.

When writing a foreign function that parses a Scheme argument list, we
haven't found a way to get back a string procedure name from an
argument of type T_CLOSURE, which is a problem since all user-defined
Scheme procedures have this type, so we can't use scheme_load_string.
Also, tinyscheme already has scheme_call, a function that works well
enough to return values we can parse and takes arguments in the same
format Scheme passes them to foreign functions (i.e. "pointer"s to
Scheme functions of type T_CLOSURE and "pointer"s to argument lists).
Even if we were to find a way to get a string name for a procedure and
build string calls like "(function r g b)" to pass to
scheme_load_string, it seems like a step backward to do so having
received the parameters in the first place in a format closer to
tinyscheme's evaluation cycle.

The problem with scheme_call is that it doesn't play well inside
foreign functions. Any foreign function, as far as we can tell, that
calls scheme_call will proceed normally and return.  However, the
function's return value isn't picked up by tinyscheme, so something
like (+ 1 (foreign-func-with-scheme_call 2)) won't return anything.
This behavior is specific to foreign functiosn that call scheme_call,
so something like (+ 1 (foreign-func-without-scheme_call 2)) will
generally work.

We'll try to contact the tinyscheme people about this.

Thanks,
Ted and Emily
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux