[GRASS5] Volunteer wanted for CELL driver color problem

Eric G. Miller egm2 at jps.net
Thu Apr 19 21:27:00 EDT 2001


On Thu, Apr 19, 2001 at 06:15:03PM +0100, Glynn Clements wrote:
> Yep; having compared the fifo.orig/sockets.new versions of SWITCHER.c
> (in both devices/lib and devices/XDRIVER/XDRIVER24), there are a
> number of differences which have nothing to do with FIFO/socket
> differences. Specifically:
> 
> 1. XDRIVER24/socket.new version has debug code removed.

Yup, I removed it.  Obviously it had been there for a long time and
there simply was no reason to keep it.

> 2. XDRIVER24/fifo.orig version has "#ifdef ORIG" code; the other three
> don't.
> 
> 3. Both fifo.orig versions have "#ifndef __CYGWIN__" around the FONT
> and TEXT cases; the socket.new versions don't.

Was told that #ifndef for the font was no longer needed.

> 4. Various minor differences which seem equally applicable to all
> versions, but presumably only went into whichever version the author
> was using/considering at the time. This includes my warning
> elimination patches, which were only made to the files which were
> actually listed in compile_warnings.log.
> 
> Also, the fifo.orig versions have the {check,get}_connection()
> functions in connect.c, whilst the socket.new versions inline the
> equivalent code.

The sockets code didn't need that code at all.  And actually, it was the
source of at least one blocked I/O state so the code couldn't respond to
resize or expose events.  The select() and G_sock_accept() handle this
pretty well.

> There are two versions of XDRIVER/lib/connect.c (the socket.new
> version being empty), but not of lib/connect.c, CELL/connect.c,
> HTMLMAP/connect.c or PNGdriver/connect.c.
> 
> Furthermore, all of the various connect.c files are almost identical,
> which is as I would expect; how to transport the data and what to do
> with it are orthogonal. The differences appear to be "fixes" which
> only made it into one version or another.
> 
> My plan is to:
> 
> a) Remove all of the debug code. The (presumably) most heavily used
> version (XDRIVER24/socket.new) seems to live without it. And gdb is
> free.
> 
> b) Remove the "#ifdef ORIG" code; three out of four versions seem OK
> without it.
> 
> c) Remove the "#ifndef __CYGWIN__" around the FONT and TEXT cases. The
> socket versions seem OK without it.
> 
> d) Create {check,get}_connection() for the socket version.

I'd think doing this will make the code more complicated.  Note the
different usages with the file descriptors and the fact the accepted
socket file descriptor is read/write vs. one for reading and one for
writing in FIFO land.

Sockets must have: a socket file descriptor, a listening file
descriptor, and when a connection arrives, an accept file descriptor.
The file descriptor returned by accept() is used for all the real
work of the program and must be closed when the connection terminates
(since each accept() returns a new descriptor).

> e) Remove the myriad versions of connect.c and just leave the one in
> devices/lib.
> 
> f) Define USE_G_FIFO/USE_G_IPC analogous to USE_G_SOCKS. Use these to
> conditionalise code and, ultimately, eliminate README.xdriver.
> 
> g) I'm going to leave src/libes/raster/io.c until later.

The socket code is real simple there.

There's one other distinction worth pointing out.  The sockets versions
don't use the file locking mechanisms that the FIFO and IPC versions
use.  I'm forgetting, but maybe this is in raster/io.c where the locking
is done...

Luck, 
-- 
Eric G. Miller <egm2 at jps.net>

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list