the basic idea is to avoid large amounts of duplicated code.
it sounds like you have a lot of functions where nearly all the code is the
same, except for a few function calls. i'd suggest judicious uses of ifdefs.
you might even want to combine redisplay-x.c and redisplay-gtk.c into one file,
with ifdefs. obviously the line between when you use ifdefs and separate out
into two entirely separate functions is a judgment call; but i strongly believe
that when you have any significant shared logic, it should appear only once,
even if writing it is trickier due to the ifdefs. whenever you have the same
code duplicated, it *will* start rotting, and very quickly.
you may well discover [and i believe this to be true] that a lot of
system-dependent stuff in redisplay-*.c should actually be abstracted out, and
you might consider doing that too -- but the ifdef approach should be the first
thing you do.
[there's even an option to diff, --ifdef=NAME, that lets you output a merged
file with ifdefs. i'd rearrange redisplay-x.c and redisplay-gtk.c so that
similar code is in the same order, and then run this and work from there.]
once you've gotten this working, if you still have energy you can look into
moving more stuff into the system-independent code.
"William M. Perry" wrote:
Ben Wing <ben(a)666.com> writes:
> "William M. Perry" wrote:
> >
> > Anybody mind this being applied to the 21.5 branch? This moves
> > read_bitmap_data_from_file into glyphs-shared.c. This definition is used
> > even if Xmu is present on the system, so everybody reads .xbm files the
> > same way.
> >
> > This code was duplicated in xmu.c if !HAVE_XMU, glyphs-gtk.c and
> > glyphs-msw.c.
> >
> > I'm taking the hint ben. :)
>
> thank you thank you thank you!
I was looking at the redisplay and event code, and it is pretty close, but
every single damn one of the function names is different, or has different
argument orderings between X and GTK. Do you think it is worth having a
gigantic set of macros in event-gtk.h and event-Xt.h and one common
event-xish.c?
I'm not sure if it would make things better or not.
-bp
--
Ceterum censeo vi esse delendam
--
ben
I'm sometimes slow in getting around to reading my mail, so if you
want to reach me faster, call 520-661-6661.
See
http://www.666.com/ben/chronic-pain/ for the hell I've been
through.