It might be useful if there were a way for the backend to say to the
frontend "I have a status message", or "I have a yes/no/cancel
question", and then let the frontend handle it and return any user
response back. Additional return codes for the sane API functions
aren't quite enough, because the backend might want to ask a question
in the middle of an API function call, and then the call has to exit
and somehow be restarted with the information it didn't have. So what
about frontends supplying callback functions to the backend at
initialization time? For example, a callback that answers a
yes/no/cancel question might have prototype
SANE_Answer sane_ask (SANE_String question)
where SANE_Answer = {SANE_YES, SANE_NO, SANE_CANCEL, SANE_UNSUPPORTED}
The frontend then puts the question to the user if it's interactive,
or returns SANE_UNSUPPORTED if it isn't.
Though the most useful callback would be one that just reports a
status message. If the backend detects some kind of special failure
whose details can't be communicated through the SANE_Status codes,
this would come in handy. It also potentially works over the network,
whereas calling printf() doesn't.
Of course, the return type of the backend functions could just change to
struct {SANE_Status, SANE_String} where the string part is an optional
elaboration on the status. But doing this means that every return statement
in every backend has to change.
Obviously either approach involves an API change so it would have to
be for a future version. I imagine this kind of thing has been
suggested before, and there is a good reason not to do it.
Kevin
-- Kevin Charter /\ Grad Studies charter@cs.ualberta.ca /\/ \ Department of Computing Science http://web.cs.ualberta.ca/~charter \ -------- University of Alberta -------------- Edmonton AB CANADA
-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com