*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Wed, 24 Jan 2007 14:36:53 +0100
changeset 4714 3ea57c207759
parent 4713 199dbf1a1406
child 4715 a7e5fe02aba8
*** empty log message ***
ImageReader.st
--- a/ImageReader.st	Thu Jan 18 22:47:03 2007 +0100
+++ b/ImageReader.st	Wed Jan 24 14:36:53 2007 +0100
@@ -53,7 +53,7 @@
     short nBits;
 };
 
-static struct ccitt_def 
+static struct ccitt_def
 whiteDef[] = {
     { 0x3500, 8 }, /* 0 */
     { 0x1c00, 6 },
@@ -85,40 +85,40 @@
     { 0x4800, 7 },
     { 0x3000, 7 },
     { 0x0200, 8 },
-    { 0x0300, 8 }, /* 30 */ 
-    { 0x1a00, 8 }, 
-    { 0x1b00, 8 }, 
-    { 0x1200, 8 }, 
-    { 0x1300, 8 }, 
-    { 0x1400, 8 }, 
-    { 0x1500, 8 }, 
-    { 0x1600, 8 }, 
-    { 0x1700, 8 }, 
-    { 0x2800, 8 }, 
+    { 0x0300, 8 }, /* 30 */
+    { 0x1a00, 8 },
+    { 0x1b00, 8 },
+    { 0x1200, 8 },
+    { 0x1300, 8 },
+    { 0x1400, 8 },
+    { 0x1500, 8 },
+    { 0x1600, 8 },
+    { 0x1700, 8 },
+    { 0x2800, 8 },
     { 0x2900, 8 }, /* 40 */
-    { 0x2a00, 8 }, 
-    { 0x2b00, 8 }, 
-    { 0x2c00, 8 }, 
-    { 0x2d00, 8 }, 
-    { 0x0400, 8 }, 
-    { 0x0500, 8 }, 
-    { 0x0a00, 8 }, 
-    { 0x0b00, 8 }, 
-    { 0x5200, 8 }, 
+    { 0x2a00, 8 },
+    { 0x2b00, 8 },
+    { 0x2c00, 8 },
+    { 0x2d00, 8 },
+    { 0x0400, 8 },
+    { 0x0500, 8 },
+    { 0x0a00, 8 },
+    { 0x0b00, 8 },
+    { 0x5200, 8 },
     { 0x5300, 8 }, /* 50 */
-    { 0x5400, 8 }, 
-    { 0x5500, 8 }, 
-    { 0x2400, 8 }, 
-    { 0x2500, 8 }, 
-    { 0x5800, 8 }, 
-    { 0x5900, 8 }, 
-    { 0x5a00, 8 }, 
-    { 0x5b00, 8 }, 
-    { 0x4a00, 8 }, 
+    { 0x5400, 8 },
+    { 0x5500, 8 },
+    { 0x2400, 8 },
+    { 0x2500, 8 },
+    { 0x5800, 8 },
+    { 0x5900, 8 },
+    { 0x5a00, 8 },
+    { 0x5b00, 8 },
+    { 0x4a00, 8 },
     { 0x4b00, 8 }, /* 60 */
-    { 0x3200, 8 }, 
-    { 0x3300, 8 }, 
-    { 0x3400, 8 }, 
+    { 0x3200, 8 },
+    { 0x3300, 8 },
+    { 0x3400, 8 },
 /* ---------------- */
     { 0xd800, 5 }, /* 64 */
     { 0x9000, 5 }, /* 128 */
@@ -165,7 +165,7 @@
     { 0x0010, 12 }, /* EOL */
 };
 
-static struct ccitt_def 
+static struct ccitt_def
 blackDef[] = {
     { 0x0dc0, 10 }, /* 0 */
     { 0x4000, 3 },
@@ -196,41 +196,41 @@
     { 0x0ca0, 12 },
     { 0x0cb0, 12 },
     { 0x0cc0, 12 },
-    { 0x0cd0, 12 }, 
+    { 0x0cd0, 12 },
     { 0x0680, 12 }, /* 30 */
-    { 0x0690, 12 }, 
-    { 0x06a0, 12 }, 
-    { 0x06b0, 12 }, 
-    { 0x0d20, 12 }, 
-    { 0x0d30, 12 }, 
-    { 0x0d40, 12 }, 
-    { 0x0d50, 12 }, 
-    { 0x0d60, 12 }, 
+    { 0x0690, 12 },
+    { 0x06a0, 12 },
+    { 0x06b0, 12 },
+    { 0x0d20, 12 },
+    { 0x0d30, 12 },
+    { 0x0d40, 12 },
+    { 0x0d50, 12 },
+    { 0x0d60, 12 },
     { 0x0d70, 12 },
-    { 0x06c0, 12 }, /* 40 */ 
-    { 0x06d0, 12 }, 
-    { 0x0da0, 12 }, 
-    { 0x0db0, 12 }, 
-    { 0x0540, 12 }, 
-    { 0x0550, 12 }, 
-    { 0x0560, 12 }, 
-    { 0x0570, 12 }, 
-    { 0x0640, 12 }, 
+    { 0x06c0, 12 }, /* 40 */
+    { 0x06d0, 12 },
+    { 0x0da0, 12 },
+    { 0x0db0, 12 },
+    { 0x0540, 12 },
+    { 0x0550, 12 },
+    { 0x0560, 12 },
+    { 0x0570, 12 },
+    { 0x0640, 12 },
     { 0x0650, 12 },
-    { 0x0520, 12 }, /* 50 */ 
-    { 0x0530, 12 }, 
-    { 0x0240, 12 }, 
-    { 0x0370, 12 }, 
-    { 0x0380, 12 }, 
-    { 0x0270, 12 }, 
-    { 0x0280, 12 }, 
-    { 0x0580, 12 }, 
-    { 0x0590, 12 }, 
+    { 0x0520, 12 }, /* 50 */
+    { 0x0530, 12 },
+    { 0x0240, 12 },
+    { 0x0370, 12 },
+    { 0x0380, 12 },
+    { 0x0270, 12 },
+    { 0x0280, 12 },
+    { 0x0580, 12 },
+    { 0x0590, 12 },
     { 0x02b0, 12 },
-    { 0x02c0, 12 }, /* 60 */ 
-    { 0x05a0, 12 }, 
-    { 0x0660, 12 }, 
-    { 0x0670, 12 }, 
+    { 0x02c0, 12 }, /* 60 */
+    { 0x05a0, 12 },
+    { 0x0660, 12 },
+    { 0x0670, 12 },
 /* ---------------- */
     { 0x03c0, 10 }, /* 64 */
     { 0x0c80, 12 }, /* 128 */
@@ -339,7 +339,7 @@
     }
 }
 
-static short 
+static short
 leftBits[] = {
      0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF
 };
@@ -466,7 +466,7 @@
 	unsigned char chars[8192 - 4];
 };
 
-static int        
+static int
 __decodeLZW__(from, to, inCount, fromSize, toSize)
     unsigned char *from;
     unsigned char *to;
@@ -532,7 +532,7 @@
 	code = (bits >> shift) & mask;
 	bits &= ~(mask << shift);
 	nBits -= codeLen;
-                        
+
 	if (code == 257) break;
 	if (code == 256) {
 	    if (! inCount)
@@ -563,7 +563,9 @@
 	    if (code == 257) break;
 	    /* add to output */
 	    if (to >= toEnd) {
-		fprintf(stderr, "ImageReader [warning]: LZW outBuffer overrun\n");
+		if (@global(InfoPrinting) == true) {
+		    console_fprintf(stderr, "ImageReader [warning]: LZW outBuffer overrun\n");
+		}
 		ret = 0;
 		break;
 	    }
@@ -601,11 +603,13 @@
 		    ret = 0;
 		    goto out;
 		}
-            
+
 		/* writeString(string[oldCode] + first(string[oldCode]) ) */
 		len = stringLen[oldCode];
 		if ((to+len) >= toEnd) {
-		    fprintf(stderr, "ImageReader [warning]: LZW outBuffer overrun\n");
+		    if (@global(InfoPrinting) == true) {
+			console_fprintf(stderr, "ImageReader [warning]: LZW outBuffer overrun\n");
+		    }
 		    ret = 0;
 		    goto out;
 		}
@@ -640,7 +644,7 @@
 		    if (nextCode == 1023) {
 			codeLen = 11;
 			mask = 0x7FF;
-		    } else 
+		    } else
 			if (nextCode == 2047) {
 			    codeLen = 12;
 			    mask = 0xFFF;
@@ -659,7 +663,9 @@
     free(stringLen);
 
     if (from > fromEnd) {
-	fprintf(stderr, "ImageReader [warning]: LZW inBuffer overrun\n");
+	if (@global(InfoPrinting) == true) {
+	    console_fprintf(stderr, "ImageReader [warning]: LZW inBuffer overrun\n");
+	}
 	ret = 0;
     }
     return ret;
@@ -717,7 +723,9 @@
     toEnd = to + toSize;
 
     if ((unsigned)codeLen > 12) {
-	fprintf(stderr, "ImageReader [warning]: GIF bad codelen (>12)\n");
+	if (@global(InfoPrinting) == true) {
+	    console_fprintf(stderr, "ImageReader [warning]: GIF bad codelen (>12)\n");
+	}
 	return 0;
     }
     prefix = (unsigned short *)malloc(sizeof(short) * 4096);
@@ -762,7 +770,7 @@
 	    codeLen = initialCodeLen;
 	    maxCode = clearCode<<1;
 	    mask = maxCode - 1;
-	    freeCode = clearCode + 2;  
+	    freeCode = clearCode + 2;
 
 	    /* fetch code */
 	    while (nBits < codeLen) {
@@ -778,7 +786,9 @@
 	    if (code == endCode) break;
 	    /* add to output */
 	    if (to >= toEnd) {
-		fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
+		if (@global(InfoPrinting) == true) {
+		    console_fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
+		}
 		ret = 0;
 		break;
 	    }
@@ -798,7 +808,9 @@
 
 		/* debugging and protecting myself from overwrites */
 		if (curCode >= 4096) {
-		    fprintf(stderr, "ImageReader [warning]: GIF corrupted input (code > 4095)\n");
+		    if (@global(InfoPrinting) == true) {
+			console_fprintf(stderr, "ImageReader [warning]: GIF corrupted input (code > 4095)\n");
+		    }
 		    ret = 0;
 		    break;
 		}
@@ -811,14 +823,18 @@
 
 #if 0
 	    if ((to+outCount) >= toEnd) {
-		fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
+		if (@global(InfoPrinting) == true) {
+		    console_fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
+		}
 		ret = 0;
 		break;
 	    }
 #endif
 	    for (i = outCount - 1; i >= 0; i--) {
 		if (to >= toEnd) {
-		    fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
+		    if (@global(InfoPrinting) == true) {
+			console_fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
+		    }
 		    ret = 0;
 		    break;
 		}
@@ -828,7 +844,9 @@
 
 	    /* debugging and protecting myself from overwrites */
 	    if (freeCode >= 4096) {
-		fprintf(stderr, "ImageReader [warning]: GIF corrupted input (freeCode > 4095)\n");
+		if (@global(InfoPrinting) == true) {
+		    console_fprintf(stderr, "ImageReader [warning]: GIF corrupted input (freeCode > 4095)\n");
+		}
 		ret = 0;
 		break;
 	    }
@@ -853,7 +871,9 @@
     free(outCode);
 
     if (from > fromEnd) {
-	fprintf(stderr, "ImageReader [warning]: GIF inBuffer overrun\n");
+	if (@global(InfoPrinting) == true) {
+	    console_fprintf(stderr, "ImageReader [warning]: GIF inBuffer overrun\n");
+	}
 	ret = 0;
     }
     return ret;
@@ -884,7 +904,7 @@
 		c = getc(fp);
 		if (c == EOF) {
 		    if (@global(InfoPrinting) == true) {
-			fprintf(stderr, "ImageReader [warning]: premature EOF\n"); 
+			console_fprintf(stderr, "ImageReader [warning]: premature EOF\n");
 		    }
 		    return 0;
 		}
@@ -893,7 +913,7 @@
 	    if (j<w) {
 		if (pp >= (dest+szDest)) {
 		    if (@global(InfoPrinting) == true) {
-			fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
+			console_fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
 		    }
 		    return 0;
 		}
@@ -934,7 +954,7 @@
 	    if (j<w) {
 		if (pp >= (dest+szDest)) {
 		    if (@global(InfoPrinting) == true) {
-			fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
+			console_fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
 		    }
 		    return 0;
 		}
@@ -979,7 +999,7 @@
 		if (j<w) {
 		    if (pp >= (dest+szDest)) {
 			if (@global(InfoPrinting) == true) {
-			    fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
+			    console_fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
 			}
 			return 0;
 		    }
@@ -993,7 +1013,7 @@
 	return 1;
     }
     if (comp == 2) {  /* read RLE4 compressed data */
-	x = y = 0;  
+	x = y = 0;
 	pp = dest + x + (h-y-1)*w;
 
 	while (y<h) {
@@ -1006,27 +1026,27 @@
 		for (i=0; i<c; i++,x++,pp++) {
 		    if (pp >= (dest+szDest)) {
 			if (@global(InfoPrinting) == true) {
-			    fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
+			    console_fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
 			}
 			return 0;
 		    }
 		    *pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
 		}
-	    } else {    
+	    } else {
 		/* c==0x00  :  escape codes */
-		c = getc(fp);  
+		c = getc(fp);
 		if (c == EOF) return 0;
 
 		if (c == 0x00) {                    /* end of line */
 		    x=0;  y++;  pp = dest + x + (h-y-1)*w;
-		} else 
+		} else
 		    if (c == 0x01) break;               /* end of pic8 */
 
 		    else if (c == 0x02) {                /* delta */
-			c = getc(fp);  
+			c = getc(fp);
 			if (c == EOF) return 0;
 			x += (c & 0xFF);
-			c = getc(fp);  
+			c = getc(fp);
 			if (c == EOF) return 0;
 			y += (c & 0xFF);
 			pp = dest + x + (h-y-1)*w;
@@ -1039,7 +1059,7 @@
 			    }
 			    if (pp >= (dest+szDest)) {
 				if (@global(InfoPrinting) == true) {
-				    fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
+				    console_fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
 				}
 				return 0;
 			    }
@@ -1072,24 +1092,24 @@
     unsigned char *pp;
 
     if (comp == 0) {   /* uncompressed data */
-	padw = ((w + 3)/4) * 4; 
+	padw = ((w + 3)/4) * 4;
 
 	for (i=h-1; i>=0; i--) {
 	    pp = dest + (i * w);
 
 	    for (j=0; j<padw; j++) {
-		c = getc(fp);  
+		c = getc(fp);
 		if (c==EOF) {
 		    if (@global(InfoPrinting) == true) {
-			fprintf(stderr, "ImageReader [warning]: BMP premature EOF [%d]\n", __LINE__);
-			fprintf(stderr, "h=%d i=%d w=%d j=%d padw=%d\n", h, i, w, j, padw);
+			console_fprintf(stderr, "ImageReader [warning]: BMP premature EOF [%d]\n", __LINE__);
+			console_fprintf(stderr, "h=%d i=%d w=%d j=%d padw=%d\n", h, i, w, j, padw);
 		    }
 		    return 0;
 		}
 		if (j<w) {
 		    if (pp >= (dest+szDest)) {
 			if (@global(InfoPrinting) == true) {
-			    fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
+			    console_fprintf(stderr, "ImageReader [warning]: BMP outBuffer overrun\n");
 			}
 			return 0;
 		    }
@@ -1098,28 +1118,28 @@
 	    }
 	    if (ferror(fp)) {
 		if (@global(InfoPrinting) == true) {
-		    fprintf(stderr, "ImageReader [warning]: BMP ferror set\n");
+		    console_fprintf(stderr, "ImageReader [warning]: BMP ferror set\n");
 		}
 		return 0;
 	    }
 	}
 	if (ferror(fp)) {
 	    if (@global(InfoPrinting) == true) {
-		fprintf(stderr, "ImageReader [warning]: BMP ferror set at end\n");
+		console_fprintf(stderr, "ImageReader [warning]: BMP ferror set at end\n");
 	    }
 	    return 0;
 	}
 	return 1;
     }
     if (comp == 1) {  /* RLE8 compressed */
-	x = y = 0;  
+	x = y = 0;
 	pp = dest + x + (h-y-1)*w;
 
 	while (y<h) {
-	    c = getc(fp);  
+	    c = getc(fp);
 	    if (c == EOF) {
 		if (@global(InfoPrinting) == true) {
-		    fprintf(stderr, "ImageReader [warning]: BMP/RLE8 premature EOF [%d]\n", __LINE__);
+		    console_fprintf(stderr, "ImageReader [warning]: BMP/RLE8 premature EOF [%d]\n", __LINE__);
 		}
 		return 0;
 	    }
@@ -1127,7 +1147,7 @@
 		c1 = getc(fp);
 		if (c1 == EOF) {
 		    if (@global(InfoPrinting) == true) {
-			fprintf(stderr, "ImageReader [warning]: BMP/RLE8 premature EOF [%d]\n", __LINE__);
+			console_fprintf(stderr, "ImageReader [warning]: BMP/RLE8 premature EOF [%d]\n", __LINE__);
 		    }
 		    return 0;
 		}
@@ -1136,38 +1156,38 @@
 		for (i=0; i<c; i++,x++,pp++) {
 		    if (pp >= (dest+szDest)) {
 			if (@global(InfoPrinting) == true) {
-			    fprintf(stderr, "ImageReader [warning]: BMP/RLE8 outBuffer overrun\n");
+			    console_fprintf(stderr, "ImageReader [warning]: BMP/RLE8 outBuffer overrun\n");
 			}
 			return 0;
 		    }
 		    *pp = c1;
 		}
-	    } else {    
+	    } else {
 		/* c==0x00  :  escape codes */
-		c = getc(fp);  
+		c = getc(fp);
 		if (c == EOF) {
 		    if (@global(InfoPrinting) == true) {
-			fprintf(stderr, "ImageReader [warning]: BMP/RLE8 premature EOF [%d]\n", __LINE__);
+			console_fprintf(stderr, "ImageReader [warning]: BMP/RLE8 premature EOF [%d]\n", __LINE__);
 		    }
 		    return 0;
 		}
 		if (c == 0x00) {                    /* end of line */
 		    x=0;  y++;  pp = dest + x + (h-y-1)*w;
-		} else 
+		} else
 		    if (c == 0x01) break;               /* end of pic8 */
 		    else if (c == 0x02) {               /* delta */
 			c = getc(fp);
 			if (c == EOF) {
 			    if (@global(InfoPrinting) == true) {
-				fprintf(stderr, "ImageReader [warning]: BMP/RLE8 premature EOF [%d]\n", __LINE__);
+				console_fprintf(stderr, "ImageReader [warning]: BMP/RLE8 premature EOF [%d]\n", __LINE__);
 			    }
 			    return 0;
 			}
 			x += (c & 0xFF);
-			c = getc(fp);  
+			c = getc(fp);
 			if (c == EOF) {
 			    if (@global(InfoPrinting) == true) {
-				fprintf(stderr, "ImageReader [warning]: BMP/RLE8 premature EOF [%d]\n", __LINE__);
+				console_fprintf(stderr, "ImageReader [warning]: BMP/RLE8 premature EOF [%d]\n", __LINE__);
 			    }
 			    return 0;
 			}
@@ -1180,7 +1200,7 @@
 			    if (c1 == EOF) return 0;
 			    if (pp >= (dest+szDest)) {
 				if (@global(InfoPrinting) == true) {
-				    fprintf(stderr, "ImageReader [warning]: BMP/RLE8 outBuffer overrun\n");
+				    console_fprintf(stderr, "ImageReader [warning]: BMP/RLE8 outBuffer overrun\n");
 				}
 				return 0;
 			    }
@@ -1189,24 +1209,24 @@
 
 			if (c & 1) getc(fp);  /* odd length run: read an extra pad byte */
 		    }
-	    }  
+	    }
 	    if (ferror(fp)) {
 		if (@global(InfoPrinting) == true) {
-		    fprintf(stderr, "ImageReader [warning]: BMP/RLE8 ferror set\n");
+		    console_fprintf(stderr, "ImageReader [warning]: BMP/RLE8 ferror set\n");
 		}
 		return 0;
 	    }
-	} 
+	}
 	if (ferror(fp)) {
 	    if (@global(InfoPrinting) == true) {
-		fprintf(stderr, "ImageReader [warning]: BMP/RLE8 ferror set at end\n");
+		console_fprintf(stderr, "ImageReader [warning]: BMP/RLE8 ferror set at end\n");
 	    }
 	    return 0;
 	}
 	return 1;
     }
     if (@global(InfoPrinting) == true) {
-	fprintf(stderr, "ImageReader [warning]: BMP unhandled compression: %d\n", comp);
+	console_fprintf(stderr, "ImageReader [warning]: BMP unhandled compression: %d\n", comp);
     }
     return 0;
 }
@@ -1232,7 +1252,7 @@
 
 documentation
 "
-    Abstract class to provide common functions for image-readers 
+    Abstract class to provide common functions for image-readers
     (i.e. TIFFReader, GIFReader etc.)
 
     ImageReaders are created temporary to read an image from a stream.
@@ -1256,7 +1276,7 @@
 
     If you add a new reader, dont forget to add the method #isValidImageFile:
     which should return true, if this reader supports reading a given file.
-    If your new reader class supports writing files, dont forget to add 
+    If your new reader class supports writing files, dont forget to add
     #canRepresent:anImage and return true from this method.
 
     [See also:]
@@ -1334,12 +1354,12 @@
     self primitiveFailed
 !
 
-decompressCCITT3From:srcBytes into:dstBytes startingAt:offset count:count 
+decompressCCITT3From:srcBytes into:dstBytes startingAt:offset count:count
     "decompress CCITT Group 3 compressed image data.
      count bytes from srcBytes are decompressed into dstBytes.
      Calls primitive c function for speed"
 %{
-    if (__isByteArray(srcBytes) 
+    if (__isByteArray(srcBytes)
      && __isByteArray(dstBytes)
      && __bothSmallInteger(offset, count)) {
 	if (__decodeCCITTgroup3__(__ByteArrayInstPtr(srcBytes)->ba_element,
@@ -1359,7 +1379,7 @@
      count bytes from srcBytes are decompressed into dstBytes.
      Calls primitive c function for speed"
 %{
-    if (__isByteArray(srcBytes) 
+    if (__isByteArray(srcBytes)
      && __isByteArray(dstBytes)
      && __bothSmallInteger(codeLen, offset)
      && __isSmallInteger(count)) {
@@ -1384,7 +1404,7 @@
      count bytes from srcBytes are decompressed into dstBytes.
      Calls primitive c function for speed"
 %{
-    if (__isByteArray(srcBytes) 
+    if (__isByteArray(srcBytes)
      && __isByteArray(dstBytes)
      && __bothSmallInteger(offset, count)) {
 	if (__decodeLZW__(__ByteArrayInstPtr(srcBytes)->ba_element,
@@ -1475,8 +1495,8 @@
 	   && __isByteArray(aByteArray))) {
 	RETURN (false);
     }
-    if (loadBMP1to8(__intVal(width), __intVal(height), 
-		 __FILEVal(f), 
+    if (loadBMP1to8(__intVal(width), __intVal(height),
+		 __FILEVal(f),
 		__ByteArrayInstPtr(aByteArray)->ba_element,
 		__byteArraySize(aByteArray) )) {
 	RETURN (true);
@@ -1501,8 +1521,8 @@
 	   && __isByteArray(aByteArray))) {
 	RETURN (false);
     }
-    if (loadBMP2to8(__intVal(width), __intVal(height), 
-	     __FILEVal(f), 
+    if (loadBMP2to8(__intVal(width), __intVal(height),
+	     __FILEVal(f),
 	     __ByteArrayInstPtr(aByteArray)->ba_element,
 	     __byteArraySize(aByteArray) )) {
 	RETURN (true);
@@ -1528,8 +1548,8 @@
 	   && __isByteArray(aByteArray))) {
 	RETURN (false);
     }
-    if (loadBMP4to8(__intVal(width), __intVal(height), __intVal(compression), 
-	     __FILEVal(f), 
+    if (loadBMP4to8(__intVal(width), __intVal(height), __intVal(compression),
+	     __FILEVal(f),
 	     __ByteArrayInstPtr(aByteArray)->ba_element,
 	     __byteArraySize(aByteArray) )) {
 	RETURN (true);
@@ -1555,8 +1575,8 @@
 	   && __isByteArray(aByteArray))) {
 	RETURN (false);
     }
-    if (loadBMP8(__intVal(width), __intVal(height), __intVal(compression), 
-	     __FILEVal(f), 
+    if (loadBMP8(__intVal(width), __intVal(height), __intVal(compression),
+	     __FILEVal(f),
 	     __ByteArrayInstPtr(aByteArray)->ba_element,
 	     __byteArraySize(aByteArray) )) {
 	RETURN (true);
@@ -1604,17 +1624,17 @@
 
      bytes := #[ 0 1 2 3 4 5 6 7 8 9 ].
      self swap:6 bytesFromRGB_to_BGR_in:bytes.
-     bytes.     
+     bytes.
     "
     "
      |bytes|
 
      bytes := ByteArray new:1000000.
-     bytes replaceFrom:1 with:#[ 0 1 2 3 4 5 6 7 8 9 10 11 12].   
+     bytes replaceFrom:1 with:#[ 0 1 2 3 4 5 6 7 8 9 10 11 12].
      Time millisecondsToRun:[
 	self swap:1000000 bytesFromRGB_to_BGR_in:bytes.
-     ].    
-     bytes copyTo:10. 
+     ].
+     bytes copyTo:10.
     "
 ! !
 
@@ -1639,7 +1659,7 @@
 	]
     ].
     inStream isNil ifTrue:[
-	'ImageReader [warning]: open error on: ' infoPrint. aFilename infoPrintCR. 
+	'ImageReader [warning]: open error on: ' infoPrint. aFilename infoPrintCR.
     ].
     ^ inStream
 
@@ -1649,7 +1669,7 @@
 !ImageReader class methodsFor:'image reading'!
 
 fromFile:aFileName
-    "read an image (in my format) from aFileName. 
+    "read an image (in my format) from aFileName.
      Return the image or nil on error."
 
     |reader|
@@ -1681,7 +1701,7 @@
 !
 
 imagesFromFile:aFileName
-    "read all images (in my format) from aFileName. 
+    "read all images (in my format) from aFileName.
      Return a collection of images or nil on error.
      Not all reader may support multiple images."
 
@@ -1713,7 +1733,7 @@
 !
 
 readFile:aFileName
-    "create a reader and let it read an image (in my format) from aFileName. 
+    "create a reader and let it read an image (in my format) from aFileName.
      Return the reader."
 
     |reader inStream|
@@ -1740,7 +1760,7 @@
 !
 
 readStream:aStream
-    "create a reader and let it read a stream (in my format). 
+    "create a reader and let it read a stream (in my format).
      Return the reader. The stream remains open."
 
     |reader|
@@ -1822,7 +1842,9 @@
 	    if (--__nOut == 0) {
 #ifdef DEBUG
 		if (__outP >= outEnd) {
-		    fprintf(stderr, "oops %d\n", __LINE__);
+		    if (@global(InfoPrinting) == true) {
+			console_fprintf(stderr, "oops %d\n", __LINE__);
+		    }
 		    goto fail;
 		}
 #endif
@@ -1839,7 +1861,9 @@
 
 #ifdef DEBUG
 	    if (__outP >= outEnd) {
-		fprintf(stderr, "oops2 %d\n", __LINE__);
+		if (@global(InfoPrinting) == true) {
+		    console_fprintf(stderr, "oops2 %d\n", __LINE__);
+		}
 		goto fail;
 	    }
 #endif
@@ -1939,7 +1963,7 @@
     "Modified: 22.4.1996 / 19:15:24 / cg"
 !
 
-data 
+data
     "return the raw image data"
 
     ^ data
@@ -1954,7 +1978,7 @@
     "Modified: 24.6.1997 / 15:33:43 / cg"
 !
 
-height 
+height
     "return the height of the image"
 
     ^ height
@@ -2024,8 +2048,8 @@
 	inStream isFileStream ifTrue:[
 	    image fileName:inStream pathName.
 	].
-	image 
-	    width:width 
+	image
+	    width:width
 	    height:height
 	    photometric:photometric
 	    samplesPerPixel:samplesPerPixel
@@ -2125,7 +2149,7 @@
 
     errorString := self class name , ' [info]: ' , aMessage.
     inStream isFileStream ifTrue:[
-        errorString := errorString , ' [in ' , inStream pathName , ']'
+	errorString := errorString , ' [in ' , inStream pathName , ']'
     ].
 
     Image badImageFormatQuerySignal raiseErrorString:errorString.
@@ -2203,8 +2227,8 @@
      Creates a maskImage, with zeros at positions where the image
      has the given pixelValue; all other mask pixels are set to 1."
 
-    mask := self class 
-		buildMaskFromColor:maskPixelValue 
+    mask := self class
+		buildMaskFromColor:maskPixelValue
 		for:data
 		width:width
 		height:height
@@ -2222,7 +2246,7 @@
     [
 	stream := aFileName asFilename newReadWriteStream.
     ] on:FileStream openErrorSignal do:[:ex|
-	^ Image fileCreationErrorSignal 
+	^ Image fileCreationErrorSignal
 	    raiseWith:image
 	    errorString:('file creation error: ' , aFileName asString).
     ].
@@ -2242,7 +2266,7 @@
 save:image onStream:aStream
     "save image in my format on a Stream"
 
-    ^ Image cannotRepresentImageSignal 
+    ^ Image cannotRepresentImageSignal
 	raiseWith:image
 	errorString:('image save not implemented for this format').
 ! !
@@ -2270,16 +2294,16 @@
 !
 
 dimensionHolder:aValueHolderOrBlock
-    "set the valueHolder or block, which is evaluated during the readProcess, 
-     as soon as the images dimension is known. 
+    "set the valueHolder or block, which is evaluated during the readProcess,
+     as soon as the images dimension is known.
      Useful for background image reading, if the size is need to be known (for example: for formatting purposes)."
 
     dimensionHolder := aValueHolderOrBlock
 !
 
 progressHolder:aValueHolderOrBlock
-    "set the valueHolder or block, which is evaluated during the readProcess, 
-     and set with progress information (0..100 percent). 
+    "set the valueHolder or block, which is evaluated during the readProcess,
+     and set with progress information (0..100 percent).
      Useful for user feedback"
 
     progressHolder := aValueHolderOrBlock
@@ -2305,5 +2329,5 @@
 !ImageReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.90 2005-07-08 19:37:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.91 2007-01-24 13:36:53 cg Exp $'
 ! !