[comp.windows.x] Some O'Reilly Xt Programs Core Dump

simpson@saturn.ind.trw.com (Scott Simpson) (03/22/90)

SPARCstation 1, SunOS 4.0.3c, X11 R4

None of the O'Reilly xbitmap programs that come with the X11 R4 distribution
work.  They all core dump.  The reason they core dump is that you need
to call BitmapEditGetArrayString with the bitmap widget, not a parent of the
bitmap widget.  Here are some context diffs for the first bitmap program:

*** xbitmap1.c.orig	Wed Mar 21 16:48:18 1990
--- xbitmap1.c	Wed Mar 21 14:14:22 1990
***************
*** 38,44 ****
  {
  	int x, y;
  	char *cell;
! 	cell = BitmapEditGetArrayString(widget);
  
  	(void) putchar('\n');
  	for (y = 0; y < pixmap_height_in_cells; y++) {
--- 38,44 ----
  {
  	int x, y;
  	char *cell;
! 	cell = BitmapEditGetArrayString(client_data);
  
  	(void) putchar('\n');
  	for (y = 0; y < pixmap_height_in_cells; y++) {
***************
*** 76,82 ****
  
  	output = XtCreateManagedWidget("output", commandWidgetClass, buttonbox, NULL, 0);
  
- 	XtAddCallback(output, XtNcallback, printout, NULL);
  
  	quit = XtCreateManagedWidget("quit", commandWidgetClass, buttonbox, NULL, 0);
  
--- 76,81 ----
***************
*** 83,88 ****
--- 82,89 ----
  	XtAddCallback(quit, XtNcallback, exit, NULL);
  
  	bigBitmap = XtCreateManagedWidget("bigBitmap", bitmapEditWidgetClass, form, NULL, 0);
+ 
+ 	XtAddCallback(output, XtNcallback, printout, bigBitmap);
  
  	/* need the following values for the printout routine. */
  	i = 0;

I don't see how this program ever worked, unless the semantics of the
bitmap editor widget changed.  There are also some other errors in the
files in the O'Reilly distribution.  For example, the XBitmap2 resource
file uses # for comments and xbitmap2.c calls XawScrollBarSetThumb and
I have XawScrollbarSetThumb in my Xaw library.  The files in this
directory need to be tested a little more thoroughly.
Scott Simpson    TRW Information Networks Division    simpson@trwind.trw.com

argv%turnpike@Sun.COM (Dan Heller) (03/22/90)

In article <3901@trwind.UUCP> simpson@saturn.ind.trw.com (Scott Simpson) writes:
> SPARCstation 1, SunOS 4.0.3c, X11 R4
> None of the O'Reilly xbitmap programs that come with the X11 R4 distribution
> work.  They all core dump.  The reason they core dump is that you need...
...
> I don't see how this program ever worked, unless the semantics of the
> bitmap editor widget changed.

I originally wrote this program under R3 and Adrian converted it
later for some of the possible R4 changes.  Obviously, some were missed.

A general thing to keep in mind is that the book was written when
R3 was alive and kicking.  It was -before- R4 did the book actually
attempt to integrate some of the proposed R4 changes.  Whenever you
buy third party documentation on software that is so new, you have
to expect that there are going to be some problems.  Your alternative
is to wait till the authors get up to speed with the new software
so they can write a flawless book :-).

My point is that you should take some of the bugs with a grain of
salt -- please continue to report bugs and all that.  But don't
make assumptions that buggy programs were written and not tested
before they are printed.  Believe me, they are tested extensively
several times on various platforms *using the currently available
software* for verification.

As for this particular bug, I am not familiar with it, since I
haven't seen the latest stuff.

Of course, the standard disclaimer is that "production" may have
accidentally affected some text before going to print.  For further
info on this, see your astrologer.

dan
-----------------------------------------------------------
		    O'Reilly && Associates
		argv@sun.com / argv@ora.com
	   632 Petaluma Ave, Sebastopol, CA 95472 
     800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
    Opinions expressed reflect those of the author only.

simpson@saturn.ind.trw.com (Scott Simpson) (03/23/90)

In article <133317@sun.Eng.Sun.COM> argv@sun.UUCP (Dan Heller) writes:
>In article <3901@trwind.UUCP> simpson@saturn.ind.trw.com (Scott Simpson) writes:
>> work.  They all core dump.  The reason they core dump is that you need...
>A general thing to keep in mind is that the book was written when
>R3 was alive and kicking.  It was -before- R4 did the book actually
>attempt to integrate some of the proposed R4 changes.  Whenever you

The programs don't work regardless of whether X11 R3 or X11 R4 are
used.  Most of the errors I have been finding are pure logic errors.
I don't see how they ever could have worked in Release 3 or Release 4.
To save net bandwidth, I will send further bug reports to
ora!bugs@uunet.uu.net.  I assume this is a valid bug address.
My mail to this address hasn't bounced yet.
Scott Simpson    TRW Information Networks Division    simpson@trwind.trw.com