Ram Bhamidipaty writes:
From lurking on this list for a while I get the impression that the
redisplay code is very tricky. From looking through the mercurial
repository on src/redisplay.c I can see a lot of comments that
support this.
I am interested in trying to add a regression suite of sorts to the
redisplay code. I took a quick look around the repository and I did
not see anything like this - but maybe I missed it.
Try searching for "sledgehammer". ("Sledgehammer checks" are
consistency checks that check everything in a data structure on a
frequent basis, and tend to make XEmacs very very slow.) I know Ben
Wing used sledgehammer checks in Mule and the new unicode
implementation, but I don't recall seeing it in the redisplay code.
I have in mind something like this: Create some hooks into
redisplay.c that make some critical data structures (like struct
display_line) have a simple Lisp accessible representation.
[...]
My question: Is there any C code in xemacs that creates simple Lisp
structures and returns them to Lisp? Basically I want to create a
function that would turn a struct display_line into a Lisp list -
is there some code that I could look at to get an idea on how to do
this?
There are two steps here. First you need to turn C data types into
Lisp objects. This is done with functions named like "make_int".
Strings are most complicated. Integers are converted with make_int
(defined as a macro in lisp-union.h), strings have plethora of
interfaces (I think mostly found in text.c and text.h, and also
alloc.c) which match "build.*string" or "make.*string". Once
you've
done that, you can build up structures like lists with functions like
Fcons, Flist, etc. There are also internal helper functions for
common cases like list3. Those functions are also found in alloc.c
IIRC.
That should be enough to get you started.
Remember that you should be very careful to #ifdef these changes, as
they are likely to kill performance. Also, do not call any functions
that say "this function can GC" while actually in redisplay; you
*will* crash.
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta