[sane-devel] Sane API Suggestion

abel deuring a.deuring@satzbau-gmbh.de
Mon, 21 Jul 2003 23:07:37 +0200


Major A schrieb:

> The SANE API is designed to be simple and portable, and any change
> towards object orientation or functional programming would only bloat
> it unnecessarily. Sorry, if you want to interface Scheme to SANE,
> you'll have to adapt to the way things are.

Well, changing the current API is indeed not a good idea. For newer 
versions, we should be a bit more open, IMHO.

> 
> Adding a callback data argument to both sane_init() and
> SANE_Authorization_Callback would cause a number of problems, in
> particular that of network transparency. Scheme or C++ programmers
> would certainly like to use that parameter as a pointer to a
> structure, but that only works if the size of the argument is at least
> that of void*. Since the latter varies across platforms, this would be
> ugly and non-portable.

I don't think that network transparency introduces a problem for "user 
data" pointer sizes. Since Sane itself does not deal with this pointer, 
the net backend does not need to send and receive the correct value of 
this pointer to/from the Sane server. Instead, the net backend can use 
the pointer value as passed by the application in the callback.

> 
> Since the only callback in SANE is the one responsible for
> authentication, I'd say it wouldn't be worth changing anything. A
> Scheme frontend would either have to relay the authentication request
> to the user, in which case the callback data is not used, or look up
> username and password in a database, in which case the resource string
> supplied is sufficient.

Well, some time has passed sine my last look into the Sane 2 API docs, 
but IIRC it has at least one more callback.

Abel