[sane-devel] [RFC][PATCH] sanei configuration framework extension
stef.dev at free.fr
Wed Jul 9 17:56:14 UTC 2008
Le Monday 07 July 2008 22:25:34 m. allan noah, vous avez écrit :
> 2008/6/25 stef <stef.dev at free.fr>:
> > here's the patch modified like you suggest. Now both descriptors
> > and placeholders are given by the backend. There is no need for a
> > free'ing function anymore.
> this looks very good, but i dont see much point in the helper
> functions. presumably the backend will maintain some sort of enum list
> of indexes (like most do with options), so it wont need to lookup by
> name, and the initializer would probably be fewer lines of code if
> done inside the backend, and you wont need the descriptor array to be
> null terminated.
> oh, and what about a backend that has only option lines in the config
> file, it would never call the callback. i guess the backend can still
> read the SANEI_Config structure pointer if it cached it somewhere,
> after calling sanei_configure_attach()?
> "The truth is an offense, but not a sin"
I removed other functions other than the one for parsing configuration
options given by the backend. It is now up to the backend to allocate and
free the needed ressources, and to provie the option count in SANEI_Config.
In case a backend doesn't provide an attach callback and had only option
lines, the SANEI_Config structure is still filled with the values found
during configuration parsing after the call. So it can be used by the
The attached patch implements all this and a sample usage in the rts8891
backend. All SANE_TYPE_* with their optional constraints are supported. Among
the existing configuration file, only 'calibrate' and 'port' options of
canon_pp.conf wouldn't be handled directly since they rely on 2 strings
I developped and tested this patch using testsuites built with 'check'
(http://check.sf.net). I can provide them in case of interest.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5511 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20080709/e203b29c/attachment.bin
More information about the sane-devel