home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / windows / intervie / 3475 < prev    next >
Encoding:
Text File  |  1992-12-29  |  3.8 KB  |  150 lines

  1. Newsgroups: comp.windows.interviews
  2. Path: sparky!uunet!paladin.american.edu!darwin.sura.net!jvnc.net!nj.nec.com!max
  3. From: max@ccrl.nj.nec.com (Maximilian Ott)
  4. Subject: Problems with Raster::poke on sun sparc
  5. Message-ID: <1992Dec29.210927.23562@research.nj.nec.com>
  6. Sender: news@research.nj.nec.com
  7. Organization: C&C Research Labs, NEC USA, Princeton, N.J.
  8. Date: Tue, 29 Dec 92 21:09:27 GMT
  9. Lines: 139
  10.  
  11. Hi,
  12.  
  13. I'm trying to write a class to read PPM files similar to the
  14. TIFFRaster class. Last night I got a crude version running and tried
  15. to massage it a little bit today. 
  16.  
  17. And all of a sudden I ran into this crazy bug and have no idea what is
  18. going on. I stripped it down to the small program below. All it does
  19. is to create a Raster (256x256) and set every pixel to 0. Whenever I
  20. ran it it core dumps when trying to poke 206@0 (!!). For reasons
  21. beyond my understanding dbx crashes with 
  22.  
  23. dbx: internal error: unexpected value 90 at line 2620 in file
  24. ../common/object.c 
  25.  
  26. when looking at the core.
  27.  
  28. As a crude debugging hack I put a printf as first statement into
  29. (xraster.c)Raster::poke 
  30.  
  31.     void Raster::poke(
  32.     unsigned long x, unsigned long y,
  33.     ColorIntensity red, ColorIntensity green, ColorIntensity blue, float
  34.     ) {
  35.         printf("...... Raster::poke\n");
  36.     RasterRep* r = rep();
  37.     ...
  38.  
  39. and it doesn't even print anything when it attempts the mysterious
  40. poke(206,0). If I run the program I get
  41.  
  42. ..
  43. .... write col: 205 of: 256
  44. ...... Raster::poke
  45. ...... poked!
  46. .... write col: 206 of: 256
  47. Segmentation fault (core dumped)
  48.  
  49. Any ideas?
  50.  
  51. I'm using AT 2.1 from SUN on a sparc 2. All the example programs
  52. including the one calling TIFFRaster compile and execute perfectly. We
  53. also have Saber C++ installed but I hope I avoided mixing the incs and
  54. libs.
  55.  
  56. Thanks,
  57.  
  58. max
  59.  
  60. ----
  61. Max Ott                 max@ccrl.nj.nec.com         phone: (609)951-2469
  62. NEC C&C Research        Princeton, NJ, 08540        fax:   (609)951-2499
  63. --------------
  64. /*@  make
  65.  * screwy.c -- trying to figure out Ratser::poke
  66.  * Author          : Maximilian Ott
  67.  * Created On      : Tue Dec 29 15:10:05 1992
  68.  * Last Modified On: Tue Dec 29 16:02:05 1992
  69.  *+********************************************************************/
  70. #include <IV-look/kit.h>
  71. #include <InterViews/background.h>
  72. #include <InterViews/image.h>
  73. #include <InterViews/layout.h>
  74. #include <InterViews/session.h>
  75. #include <InterViews/style.h>
  76. #include <InterViews/color.h>
  77. #include <InterViews/raster.h>
  78. #include <stdlib.h>
  79.  
  80. Raster* 
  81. test_load()
  82.  
  83. {
  84.   int     width, height;
  85.   int     x, y;
  86.  
  87.   width = height = 256;
  88.   printf(".. alloc raster %dx%d\n", width, height);
  89.   Raster* r = new Raster((u_long)width, (u_long)height);
  90.   printf(".... after alloc\n");
  91.  
  92.   for (y = 0; y < height; ++y) {
  93.     for (x = 0; x < width; ++x) {
  94.       printf(".... write col: %d of: %d\n", x, width);
  95.       r->poke(
  96.           (u_long)x, (u_long)(height - y),
  97.           (ColorIntensity)0.0, 
  98.           (ColorIntensity)0.0, 
  99.           (ColorIntensity)0.0, 
  100.       1.0
  101.       );
  102.       printf("...... poked!\n");
  103.     }
  104.   }
  105.   return r;
  106. } /* end of PPMRasterImpl::load */
  107.  
  108. int 
  109. main(int argc, char** argv) 
  110.  
  111. {
  112.   Session* session = new Session("Image", argc, argv);
  113.   WidgetKit& kit = *WidgetKit::instance();
  114.   const LayoutKit& layout = *LayoutKit::instance();
  115.  
  116.   printf("calling load\n");
  117.   Raster* r = test_load();
  118. } /* end of main */
  119.  
  120. ----- Imakefile ------
  121.  
  122. #mk#
  123. # Imakefile -- 
  124. # Author          : Maximilian Ott
  125. # Created On      : Tue Dec 29 15:13:43 1992
  126. # Last Modified On: Tue Dec 29 15:45:38 1992
  127. ##################################################################
  128.  
  129. #ifdef InObjectCodeDir
  130.  
  131. /* APP_CCLDFLAGS  = -L/usr/lang/SC1.0 */
  132.  
  133. Use_libInterViews()
  134. ComplexProgramTarget(test)
  135.  
  136. MakeObjectFromSrc(screwy)
  137.  
  138. #else
  139.  
  140. MakeInObjectCodeDir()
  141.  
  142. #endif
  143.  
  144.  
  145.  
  146.  
  147. -- 
  148. Max Ott                 max@ccrl.nj.nec.com         phone: (609)951-2469
  149. NEC C&C Research        Princeton, NJ, 08540        fax:   (609)951-2499
  150.