From: max@ccrl.nj.nec.com (Maximilian Ott)
Subject: Problems with Raster::poke on sun sparc
Organization: C&C Research Labs, NEC USA, Princeton, N.J.
Date: Tue, 29 Dec 92 21:09:27 GMT

Hi,

I'm trying to write a class to read PPM files similar to the
TIFFRaster class. Last night I got a crude version running and tried
to massage it a little bit today. 

And all of a sudden I ran into this crazy bug and have no idea what is
going on. I stripped it down to the small program below. All it does
is to create a Raster (256x256) and set every pixel to 0. Whenever I
ran it it core dumps when trying to poke 206@0 (!!). For reasons
beyond my understanding dbx crashes with 

dbx: internal error: unexpected value 90 at line 2620 in file
../common/object.c 

when looking at the core.

As a crude debugging hack I put a printf as first statement into
(xraster.c)Raster::poke 

    void Raster::poke(
	unsigned long x, unsigned long y,
	ColorIntensity red, ColorIntensity green, ColorIntensity blue, float
    ) {
        printf("...... Raster::poke\n");
	RasterRep* r = rep();
	...

and it doesn't even print anything when it attempts the mysterious
poke(206,0). If I run the program I get

..
.... write col: 205 of: 256
...... Raster::poke
...... poked!
.... write col: 206 of: 256
Segmentation fault (core dumped)

Any ideas?

I'm using AT 2.1 from SUN on a sparc 2. All the example programs
including the one calling TIFFRaster compile and execute perfectly. We
also have Saber C++ installed but I hope I avoided mixing the incs and
libs.

Thanks,

max

----
Max Ott                 max@ccrl.nj.nec.com         phone: (609)951-2469
NEC C&C Research        Princeton, NJ, 08540        fax:   (609)951-2499
--------------
/*@  make
 * screwy.c -- trying to figure out Ratser::poke
 * Author          : Maximilian Ott
 * Created On      : Tue Dec 29 15:10:05 1992
 * Last Modified On: Tue Dec 29 16:02:05 1992
 *+********************************************************************/
#include <IV-look/kit.h>
#include <InterViews/background.h>
#include <InterViews/image.h>
#include <InterViews/layout.h>
#include <InterViews/session.h>
#include <InterViews/style.h>
#include <InterViews/color.h>
#include <InterViews/raster.h>
#include <stdlib.h>

Raster* 
test_load()

{
  int     width, height;
  int     x, y;

  width = height = 256;
  printf(".. alloc raster %dx%d\n", width, height);
  Raster* r = new Raster((u_long)width, (u_long)height);
  printf(".... after alloc\n");

  for (y = 0; y < height; ++y) {
    for (x = 0; x < width; ++x) {
      printf(".... write col: %d of: %d\n", x, width);
      r->poke(
          (u_long)x, (u_long)(height - y),
          (ColorIntensity)0.0, 
          (ColorIntensity)0.0, 
          (ColorIntensity)0.0, 
	  1.0
      );
      printf("...... poked!\n");
    }
  }
  return r;
} /* end of PPMRasterImpl::load */

int 
main(int argc, char** argv) 

{
  Session* session = new Session("Image", argc, argv);
  WidgetKit& kit = *WidgetKit::instance();
  const LayoutKit& layout = *LayoutKit::instance();

  printf("calling load\n");
  Raster* r = test_load();
} /* end of main */

----- Imakefile ------

#mk#
# Imakefile -- 
# Author          : Maximilian Ott
# Created On      : Tue Dec 29 15:13:43 1992
# Last Modified On: Tue Dec 29 15:45:38 1992
##################################################################

#ifdef InObjectCodeDir

/* APP_CCLDFLAGS  = -L/usr/lang/SC1.0 */

Use_libInterViews()
ComplexProgramTarget(test)

MakeObjectFromSrc(screwy)

#else

MakeInObjectCodeDir()

#endif




-- 
Max Ott                 max@ccrl.nj.nec.com         phone: (609)951-2469
NEC C&C Research        Princeton, NJ, 08540        fax:   (609)951-2499
Newsgroups: comp.windows.interviews