Re: shmem in backends?

Matto Marjanovic (maddog@mir.com)
Thu, 23 Jul 1998 09:29:26 -0400 (EDT)

>From: "Yuri Dario" <mc6530@mclink.it>
>Date: Thu, 23 Jul 1998 09:35:27 +0100

>oops, I have some #ifdefs in the backend, but they can be removed easily. I will think on a sample API for
>SANE. Now I'm using a structure like
>
>static struct _Thread_Data { // for OS/2 thread data
> Mustek_Scanner* scanner; // scanner internal data
> int fds; // pipe write handle
>} Thread_Data;
>
>because beginthread() accept only one parameter. We need also a function for starting the thread, with at
>least two parameters (function address and pointer to data).
>I didn't implement thread stop&waiting, but that function are endthread() and killthread().
>
>I think that 3 function wrappers and one data structure should be sufficient. But every backend uses a
>different name for its data (Mustek_Scanner, Umax_Scanner,...), so we need to use a macro for the
>preprocessor.

I suggest just using an opaque pointer ("void *") instead of any
structure.... No need to tie a backend down to passing any
particular set of data to its threads, when this threading is all
quite backend-dependent anyway. (Much like SANE_Handle is cast
about into all those Mustek_Scanner, Umax_Scanner, etc., ptrs.)

>I think that we need also an API for reading a line from the configuration file: actually sources strip \n at the
>end, but e.g. under OS/2 in text mode there is also a \r to remove; spaces at start and end of line should
>also be removed. So a single api (maybe called sanei_config_read) should be fine. I can write it and add
>to sanei_config.c; or someone else is working on that?

I still like the idea of adopting a single config file for all the
backends, with a SAMBA-config-like syntax to split it up into
per-backend blocks, and set tokens = values. Then provide a
mechanism to read this once and give access to the the database
of values to each backend.
But, no, I haven't put any work into this.

-matt m.

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com