[comp.windows.x] Porting to X

ram@imagen.UUCP (M.V.S. Ramanath) (10/05/89)

I've got a bitmap editor which reads ASCII text commands from
stdin and executes them. For example:
  | Draw a circle with a 10 pixel radius centered at pixel 100:100
  circle 100:100 rad=10;
  | Execute further commands in file 'abc.e'
  execute 'abc.e';

As can be expected, some commands are extremely CPU- and memory-
intensive, especially when large bitmaps are involved. They can also be
file-system intensive when, for example, lots of 'execute' commands
(possibly nested) are involved or when large bitmaps are read from or
written to files. I'd like to port it to X so that it reads commands
from a subwindow and displays the resulting bitmap in another window
with scrollbars (so I'll be shipping bitmaps to the X server).

My question: What's the best way of porting this beast to X ?

I'd like the response time to window events (move, resize, scroll)
to be fast, so I can't spin in the usual loop waiting for the next
event since that would mean very slow response when a CPU intensive
command is invoked by the user. Two methods occur to me and I would
greatly appreciate any comments or suggestions:

1. Scatter event dispatching calls throughout all the CPU intensive
   parts of the code, or:
2. Set up a timer to go off every so often and have the signal handler
   dispatch events.

I'd prefer (2) because it means minimal changes to the code but the
man page for signals warns that system calls may be interrupted. So,

    Is the standard I/O library careful to restart read and write
    calls if interrupted by signals, or do I have to write my own
    'signal safe' version ? Is malloc() (which presumably uses sbrk)
    safe in the presence of signals ?

Since I value reliability more than anything else, I'd rather not
use signals if there is the possibility that there might be data
loss when reading/writing from/to the file system.

imagen!ram@sun.com

kaye@gradient.cis.upenn.edu (Jonathan Kaye) (06/18/91)

I'm beginning to port a large application from the Symbolics to the X
windows environment.  Since I have little desire or experience to
port the code to CLX directly, I want to investigate packages built
on top of CLX (for Lisp, naturally), that support CLOS.  Also, because
the application may be used commercially, I am shying away from
packages that restrict licensing (such as Garnet).  Fortunately, the
application does not depend on special features of Flavors, so I would
expect that I will use pretty standard, simple features of CLOS.  My
interest in using a package on top of CLX is to make managing windows
and controls simpler, eventhough the application has a pretty simple
interface for now.

I would also like a package that is supported over
other architectures, particularly for the Mac (or the Mac running X,
if not supported otherwise).  The Mac is my next step.

I imagine this is not a unique situation.  I would greatly appreciate
any suggestions from people who have done this, those who have thought
about doing this, and even from those who think now about thinking
about doing this.

Please respond directly by e-mail at kaye@gradient.cis.upenn.edu.

Thanks in advance!

Jonathan