[sane-devel] Sane API Suggestion

Peter Santoro peter@pscomp.com
Sun, 20 Jul 2003 08:48:54 -0400

The initial version of my based application (written in scheme) does not use the sane api directly, but utilizes 
scanimage and scanadf to perform scanning.  In a future release, I would like to use the sane api directly for better 

Although I have a number of years of experience programming C/C++/Java, I now prefer to use scheme for most of my 
programming.  After briefly looking at the sane api, I noticed that callbacks are sometimes used.  I am aware of a 
number of ways and various ffi libraries to handle callbacks from non-C to C, but it sure would be nice if the sane API 
was a little more non-C friendly.  Specifically, when a callback pointer is required, why not also require a "user data" 
void pointer (or perhaps an integer id) that would be returned untouched to the callback as a parameter?  This would 
allow non-C languages to interface more easily to the sane api.  A thin C interface layer could then use one callback 
dispatcher to handle all C callbacks.  The callback dispatcher could use stdarg.h to process the other args or perhaps 
they could be passed to the callback using a count and array.

In the future, I would be happy to contribute a scheme->sane interface library to the sane project, but it sure would be 
nice if the sane api was more non-C friendly.