This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Plugins, Guile, and Gimp


mfox@cpsc.ucalgary.ca (Mark Fox) writes:

> 	The interesting part is that Script-Fu doesn't actually
> register procedures from the procedural database.  Instead it
> registers the same proxy function for each and every procedure in the
> procedural database.  This proxy function then determines what name it
> was called by and then calls the appropriate procedure from the
> procedural database.  If you think about it, this makes perfect sense
> because the proxy function can do any argument and return value
> conversions, and therefore effectively shield SIOD and the procedural
> database from one-anothers internals.
> 
> 	So, is there a way of doing this sort of thing in Guile?  Can
> anybody point me in the right direction?  From what I can tell, it is
> definitely not possible using the 'gh' interface.

This sounds like a job for the tc7_cclo (compiled closure) type subrs.
When the evaluator sees one of these it applies a procedure stored in
the cclo object to the object itself plus any provided arguments.
Currently this mechanism is used to implement subrs with arities not
directly supported by the evaluator.  Look in the file "gsubr.c".