3
created pygist-1.5 mock distribution directory
5
- python interpreted code
6
- make targets to actually build a python module
7
- README fixed to reflect python reality instead of yorick
9
the gist/ and play/ directories are straight from the yorick-1.5
10
distribution EXCEPT gist/Makefile has been slightly modified
11
- should make a copy of this outside the gist/ directory in
12
order to make it easy to drop in a later version of the
13
package from the yorick source
15
the Makefile has three important targets:
17
make ysite Y_SITE=....
18
sets the directory where the g/ subdirectory must be installed
19
in order for gist to find style sheets, postscript template, etc
22
configure for current platform (after make ysite)
25
builds libpyg.a containing gistCmodule plus all gist code
27
If you don't set Y_SITE, the default is the source directory. You do
28
not need to run make config explicitly. The install targets are
29
currently broken, of course.
31
I did some more work to address some of the problems below:
33
(1) I made a first cut at error handling, adopting exactly the same
34
strategy Busby originally used for pygist. It would still be better
35
to integrate this into python's system, but if that system does not
36
use longjmps, it will need to remain in pretty much its current form.
38
(2) I made a first cut at a blocking event loop for pause, window,wait=1
41
That means the only FIXMEs left are the argc/argv access (which may
42
not be appropriate) and the 24-bit color interface, which needs to be
43
added to setkw_color and pli.
47
(1) renamed fma pyg_fma (like pyg_pause) to avoid name conflict
48
(Compaq /usr/include.dtk/math.h declares fma)
50
(2) changed gist-1.4 functions to gist-1.5 (e.g.- GmMalloc -> p_malloc)
51
changed #include directives to reflect 1.5
53
(3) made simple Makefile with -I options for A-div network
55
(4) made first pass through yorick/graph.c (which was Busby's
56
starting point for gistCmodule.c;) ideally, gistCmodule.c
57
should be scanned line-by-line to make it correspond to the
58
1.5 yorick/graph.c (it is largely still at 1.3)
60
I did a good job with the window function and one or two others,
61
but I didn't check the bulk of the file.
63
(5) placed FIXME comments at the places I noticed that need repair
64
the window,wait=1 and mouse functions in particular need work
66
(6) needs to add support for true color plf, pli, plfc commands
70
The worst problem will be to figure out how to handle errors.
72
Xlib can signal errors asynchronously, which Busby tried to handle by
73
means of a SETJMP0 macro. I disabled that, since the gist error and
74
event handling has totally changed. Nevertheless, everywhere there is
75
a SETJMP0 macro in gistCmodule.c still needs to be fixed.
77
I am realizing that the gist-1.5 error handling probably needs to be
78
reworked in order to be usable with pygist. The play/README file
79
describes how the event/exception mechanism is supposed to work in
80
gist (yorick). This is bound to be inconsistent with python's
81
mechanism. The low level graphics functions in gist watch the new
82
p_signalling semaphore, and the error routines set it when Xlib alerts
83
them of an error. The thing which probably needs to be reworked is
84
that the gist graphics routines call p_abort(), which longjmps back to
85
gist's main event handling loop. The problem is that under python,
86
those routines might well be called outside gist's event loop, which
87
would be a disaster. There must be someplace to longjmp to in python
88
when an asynchronous signal (SIGINT, SIGFPE, etc) occurs, and the
89
p_abort() function in the yorick version of gist should be replaced by
90
one that longjmps to the python error handling system. (A good place
91
to start would be to track down exactly what happens when you type C-c
92
to python -- how does it print "KeyboardInterrupt"?)
94
So, you need to find a good place to longjmp to in python. When you
95
do, write a function to do the longjmp, and set u_abort_hook to your
96
function to override the default p_abort(). If all else fails, you
97
can reinstate Busby's SETJMP0 idea and make the longjmp target inside
98
each individual wrapper routine. That is probably a bad idea,
99
however. Even once you've done that, you will need to watch out that
100
gist might try to steal SIGINT away from python. You can tell what
101
exception or error is being signalled from within your u_abort_hook by
102
testing the p_signalling semaphore, and take appropriate action.
104
The new gist event handling system is not quite so disastrous for
105
pygist. The function u_getc (declared in play/unix/ugetc.h) is
106
designed to be the readline rl_getc_function; gist will turn its event
107
handling inside out so that its main event loop happens while python
108
is waiting for keyboard input if you build a readline version of
109
python and put rl_getc_function=u_getc. You might also consider
110
adding calls to u_pending_events other places in python, if you need
111
to have the gist graphics event queue run at times other than when you
112
are waiting for keyboard input.
114
Finally, the window,wait=1 and mouse functions need to block until
115
their event arrives. That will probably require adding an API to
116
gist, similar to the u_getc function, but waiting for a callback to
117
tell it to return instead of for keyboard input to arrive.