sane-project-website/old-archive/1998-07/0141.html

75 wiersze
3.9 KiB
HTML

<!-- received="Thu Jul 23 06:30:17 1998 PDT" -->
<!-- sent="Thu, 23 Jul 1998 09:29:26 -0400 (EDT)" -->
<!-- name="Matto Marjanovic" -->
<!-- email="maddog@mir.com" -->
<!-- subject="Re: shmem in backends?" -->
<!-- id="m0yzLR0-000J3sC@yoo-hoo.ai.mit.edu" -->
<!-- inreplyto="shmem in backends?" -->
<title>sane-devel: Re: shmem in backends?</title>
<h1>Re: shmem in backends?</h1>
<b>Matto Marjanovic</b> (<a href="mailto:maddog@mir.com"><i>maddog@mir.com</i></a>)<br>
<i>Thu, 23 Jul 1998 09:29:26 -0400 (EDT)</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#141">[ date ]</a><a href="index.html#141">[ thread ]</a><a href="subject.html#141">[ subject ]</a><a href="author.html#141">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0142.html">Chinedum Osuji: "Re: problems with sgi/umax"</a>
<li> <b>Previous message:</b> <a href="0140.html">Yuri Dario: "[PATCH] OS/2 parallel port and scsi matching support"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
<i> &gt;From: "Yuri Dario" &lt;<a href="mailto:mc6530@mclink.it">mc6530@mclink.it</a>&gt;</i><br>
<i> &gt;Date: Thu, 23 Jul 1998 09:35:27 +0100</i><br>
<p>
<i> &gt;oops, I have some #ifdefs in the backend, but they can be removed easily. I will think on a sample API for </i><br>
<i> &gt;SANE. Now I'm using a structure like </i><br>
<i> &gt;</i><br>
<i> &gt;static struct _Thread_Data { // for OS/2 thread data</i><br>
<i> &gt; Mustek_Scanner* scanner; // scanner internal data</i><br>
<i> &gt; int fds; // pipe write handle</i><br>
<i> &gt;} Thread_Data;</i><br>
<i> &gt;</i><br>
<i> &gt;because beginthread() accept only one parameter. We need also a function for starting the thread, with at </i><br>
<i> &gt;least two parameters (function address and pointer to data).</i><br>
<i> &gt;I didn't implement thread stop&amp;waiting, but that function are endthread() and killthread().</i><br>
<i> &gt;</i><br>
<i> &gt;I think that 3 function wrappers and one data structure should be sufficient. But every backend uses a </i><br>
<i> &gt;different name for its data (Mustek_Scanner, Umax_Scanner,...), so we need to use a macro for the </i><br>
<i> &gt;preprocessor.</i><br>
<p>
I suggest just using an opaque pointer ("void *") instead of any<br>
structure.... No need to tie a backend down to passing any<br>
particular set of data to its threads, when this threading is all<br>
quite backend-dependent anyway. (Much like SANE_Handle is cast<br>
about into all those Mustek_Scanner, Umax_Scanner, etc., ptrs.)<br>
<p>
<i> &gt;I think that we need also an API for reading a line from the configuration file: actually sources strip \n at the </i><br>
<i> &gt;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 </i><br>
<i> &gt;also be removed. So a single api (maybe called sanei_config_read) should be fine. I can write it and add </i><br>
<i> &gt;to sanei_config.c; or someone else is working on that?</i><br>
<p>
I still like the idea of adopting a single config file for all the<br>
backends, with a SAMBA-config-like syntax to split it up into<br>
per-backend blocks, and set tokens = values. Then provide a <br>
mechanism to read this once and give access to the the database<br>
of values to each backend.<br>
But, no, I haven't put any work into this.<br>
<p>
-matt m.<br>
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0142.html">Chinedum Osuji: "Re: problems with sgi/umax"</a>
<li> <b>Previous message:</b> <a href="0140.html">Yuri Dario: "[PATCH] OS/2 parallel port and scsi matching support"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>