[sane-devel] re: Sane API Suggestion

Peter Santoro peter at pscomp.com
Sun Jul 20 14:00:41 BST 2003


Oops, sorry for the typo in my first paragraph.  Here's my previous post 
with a corrected first paragraph:

The initial version of my 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 control.

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.


Peter




More information about the sane-devel mailing list