Glimmer Labs wrote:
> We're currently working on a function called from the
> Script-Fu/Tiny-Fu console like
> (pixel-map drawable function)

You can take a look at init_procedures() to see how various Scheme functions 
are defined that all call one foreign function (FF) procedure 
(gimp-db-proc-call) to make the call to GIMP. The gimp-db-proc-call routine is 
passed a string which holds the name of the actual GIMP function to be executed.

> 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.

I don't understand why you need to build a Scheme statement inside your FF 
that needs to be interpreted by TinyScheme. You should be trying to avoid the 
need to process Scheme statements from inside your FF. The idea of using an FF 
for pixel operations is to do lower level stuff and avoid the gawd awful 
slowness one would encounter processing a lot of pixels in Scheme code.

The way I see it, an FF is used to add a new function to Scheme along the 
lines of a library function. An FF shouldn't be trying to access any routines 
in the Scheme interpreter outside of those listed in the interface table. What 
you describe seems to be more of a higher level routine(s).

You might need to review your execution flow and what is getting done in the 
FF and what is getting done in Scheme. See if you can simplify the execution 
flow by moving some stuff to the Scheme code that runs before the FF is invoked.

 > The problem with scheme_call is that it doesn't play well inside
 > foreign functions.

It is not too surprising that you have a problem with using scheme_call when 
you look at the routine. It calls dump_stack_reset() and Eval_Cycle(). These 
will very likely mess things up since your FF was called from inside an 

One possibility would be to create a new instance of a scheme struct before 
calling scheme_call(). The only problem would be if you need the environment 
that was in place when your FF was called but there may be a way to solve that.


Kevin.           |"What are we going to do today, Borg?"
Owner of Elecraft K2 #2172      |"Same thing we always do, Pinkutus:
                                 |  Try to assimilate the world!"
#include <disclaimer/favourite> |              -Pinkutus & the Borg

Gimp-developer mailing list

Reply via email to