diff -rcbB netpbm/pbm/icontopbm.c netpbm_pearls/pbm/icontopbm.c *** netpbm/pbm/icontopbm.c Mon Oct 04 10:10:28 1993 --- netpbm_pearls/pbm/icontopbm.c Mon Jan 23 05:18:44 1995 *************** *** 82,87 **** --- 82,89 ---- gotsome = 0; *width = *height = -1; + if ( ((ch = getc (file)) != '/') && ((ch = getc (file)) != '*') ) + pm_error ("input file is not Sun icon file"); for ( ; ; ) { while ( ( ch = getc( file ) ) == ',' || ch == '\n' || ch == '\t' || diff -rcbB netpbm/pbm/xbmtopbm.c netpbm_pearls/pbm/xbmtopbm.c *** netpbm/pbm/xbmtopbm.c Mon Oct 04 10:10:32 1993 --- netpbm_pearls/pbm/xbmtopbm.c Mon Jan 23 05:09:58 1995 *************** *** 111,117 **** version10 = 1; break; } ! if ( sscanf( line, "static char %s = {", name_and_type ) == 1 ) /* } */ { version10 = 0; break; --- 111,118 ---- version10 = 1; break; } ! if ( sscanf( line, "static char %s = {", name_and_type ) == 1 || /* } */ ! sscanf( line, "static unsigned char %s = {", name_and_type ) == 1 ) /* } */ { version10 = 0; break; diff -rcbB netpbm/pnm/fitstopnm.c netpbm_pearls/pnm/fitstopnm.c *** netpbm/pnm/fitstopnm.c Tue Dec 21 17:38:46 1993 --- netpbm_pearls/pnm/fitstopnm.c Mon Jan 23 03:18:55 1995 *************** *** 349,354 **** --- 349,355 ---- else lval = c[0]<<24 | c[1]<<16 | c[2]<<8 | c[3]; *vp = lval; + break; case -32: for (i=0; i<4; i++) { diff -rcbB netpbm/pnm/giftopnm.c netpbm_pearls/pnm/giftopnm.c *** netpbm/pnm/giftopnm.c Tue Dec 14 17:41:56 1993 --- netpbm_pearls/pnm/giftopnm.c Mon Jan 23 18:56:25 1995 *************** *** 509,514 **** --- 509,515 ---- int v; int xpos = 0, ypos = 0, pass = 0; pixel **image; + pixel *pixrow; /* ** Initialize the Compression routines *************** *** 531,538 **** --- 532,545 ---- return; } + if( interlace ) { if ((image = pnm_allocarray(len, height)) == NULL) pm_error("couldn't alloc space for image" ); + } else { + if ((pixrow = ppm_allocrow(len)) == NULL) + pm_error("couldn't allocate space for row" ); + ppm_writeppminit(stdout, len, height, (pixval)255, 0); + } if (verbose) pm_message("reading %d by %d%s GIF image", *************** *** 539,546 **** --- 546,557 ---- len, height, interlace ? " interlaced" : "" ); while ((v = LWZReadByte(fd,FALSE,c)) >= 0 ) { + if (interlace) PPM_ASSIGN(image[ypos][xpos], cmap[CM_RED][v], cmap[CM_GREEN][v], cmap[CM_BLUE][v]); + else + PPM_ASSIGN(pixrow[xpos], cmap[CM_RED][v], + cmap[CM_GREEN][v], cmap[CM_BLUE][v]); ++xpos; if (xpos == len) { *************** *** 570,575 **** --- 581,588 ---- } } } else { + ppm_writeppmrow(stdout, pixrow, len, + (pixval) 255, 0); ++ypos; } } *************** *** 581,586 **** --- 594,600 ---- if (LWZReadByte(fd,FALSE,c)>=0) pm_message("too much input data, ignoring extra..."); + if (interlace) { if (verbose) pm_message("writing a %s file", pbm_format == PBM_TYPE ? "PBM" : *************** *** 589,592 **** --- 603,607 ---- "UNKNOWN!"); pnm_writepnm(stdout, image, len, height, (pixval) 255, pbm_format, 0 ); + } } diff -rcbB netpbm/pnm/pnmcomp.c netpbm_pearls/pnm/pnmcomp.c *** netpbm/pnm/pnmcomp.c Mon Oct 04 10:11:34 1993 --- netpbm_pearls/pnm/pnmcomp.c Fri Dec 16 04:32:20 1994 *************** *** 7,18 **** /* | notice appear in supporting documentation. This software is | */ /* | provided "as is" without express or implied warranty. | */ /* +-------------------------------------------------------------------+ */ ! #include "pnm.h" - #include "pgm.h" #include "ppm.h" static gray **alpha = NULL; static int alphaCols, alphaRows; static xelval alphaMax; static pixel **image = NULL; --- 7,24 ---- /* | notice appear in supporting documentation. This software is | */ /* | provided "as is" without express or implied warranty. | */ /* +-------------------------------------------------------------------+ */ ! /* ! * Modified 16/Dec/94 by Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) ! * - added -mask option ! * - removed outfile from argv list (always write to stdout now) ! */ #include "pnm.h" #include "ppm.h" + #include "pgm.h" + #include "pbm.h" static gray **alpha = NULL; + static bit **mask = NULL; static int alphaCols, alphaRows; static xelval alphaMax; static pixel **image = NULL; *************** *** 20,28 **** static xelval imageMax; static int InvertFlag = 0; - static char *usage = - "[-invert] [-xoff N] [-yoff N] [-alpha file] overlay [image] [output]"; - /* prototypes */ void composite ARGS((int xoff, int yoff, FILE *ifp, FILE *ofp)); --- 26,31 ---- *************** *** 32,40 **** char *argv[]; { int xoff = 0, yoff = 0; ! FILE *ifp, *ofp, *fp; int argn = 1; ! pnm_init(&argc, argv); --- 35,44 ---- char *argv[]; { int xoff = 0, yoff = 0; ! FILE *ifp; int argn = 1; ! char *usage = "[-invert] [-xoff N] [-yoff N]\ ! [-alpha pgmfile|-mask pbmfile] overlay [image]"; pnm_init(&argc, argv); *************** *** 48,60 **** sscanf(argv[++argn], "%d", &yoff) != 1) pm_usage(usage); } else if (pm_keymatch(argv[argn], "-alpha", 2)) { ! if (argn == argc || alpha != NULL) pm_usage(usage); ! ! fp = pm_openr(argv[++argn]); ! alpha = pgm_readpgm(fp, &alphaCols, &alphaRows, &alphaMax); ! pm_close(fp); } else if (pm_keymatch(argv[argn], "-invert", 2)) { InvertFlag = 1; } else { --- 52,70 ---- sscanf(argv[++argn], "%d", &yoff) != 1) pm_usage(usage); } else if (pm_keymatch(argv[argn], "-alpha", 2)) { ! if (argn == argc || alpha != NULL || mask !=NULL) pm_usage(usage); ! ifp = pm_openr(argv[++argn]); ! alpha = pgm_readpgm(ifp, &alphaCols, &alphaRows, &alphaMax); ! pm_close(ifp); ! } else if (pm_keymatch(argv[argn], "-mask", 2)) { /* -IUW */ ! if (argn == argc || alpha != NULL || mask != NULL) ! pm_usage(usage); ! ! ifp = pm_openr(argv[++argn]); ! mask = pbm_readpbm(ifp, &alphaCols, &alphaRows); ! pm_close(ifp); } else if (pm_keymatch(argv[argn], "-invert", 2)) { InvertFlag = 1; } else { *************** *** 69,84 **** if (argc == argn) pm_usage(usage); ! fp = pm_openr(argv[argn++]); ! image = pnm_readpnm(fp, &imageCols, &imageRows, &imageMax, &imageType); ! pm_close(fp); /* ** If there is an alphamap check to make sure it is the ** same size as the image. */ ! if (alpha != NULL && (imageCols!=alphaCols || imageRows!=alphaRows)) ! pm_error("Alpha map and Image are not the same size"); /* ** Now get the data file --- 79,94 ---- if (argc == argn) pm_usage(usage); ! ifp = pm_openr(argv[argn++]); ! image = pnm_readpnm(ifp, &imageCols, &imageRows, &imageMax, &imageType); ! pm_close(ifp); /* ** If there is an alphamap check to make sure it is the ** same size as the image. */ ! if ((alpha || mask) && (imageCols!=alphaCols || imageRows!=alphaRows)) ! pm_error("Alpha/Mask map and Image are not the same size"); /* ** Now get the data file *************** *** 88,108 **** else ifp = stdin; - /* - ** And the output file - */ if (argc != argn) ! ofp = pm_openw(argv[argn++]); ! else ! ofp = stdout; /* ** Composite the images together */ ! composite(xoff, yoff, ifp, ofp); pm_close(ifp); ! pm_close(ofp); } void composite(xoff, yoff, ifp, ofp) --- 98,113 ---- else ifp = stdin; if (argc != argn) ! pm_usage(usage); /* ** Composite the images together */ ! composite(xoff, yoff, ifp, stdout); pm_close(ifp); ! exit(0); } void composite(xoff, yoff, ifp, ofp) *************** *** 111,117 **** { int x, y, x0, y0; int r,g,b; ! xelval v, maxv, omaxv; xel *pixels; double f; int rows, cols, type, otype; --- 116,122 ---- { int x, y, x0, y0; int r,g,b; ! xelval maxv, omaxv; xel *pixels; double f; int rows, cols, type, otype; *************** *** 157,169 **** if (y0 < 0 || y0 >= imageRows) continue; ! if (alpha == NULL) { ! f = 1.0; ! } else { f = (double)alpha[y0][x0] / (double)alphaMax; if (InvertFlag) f = 1.0 - f; } r = PPM_GETR(pixels[x]) * (1.0 - f) + PPM_GETR(image[y0][x0]) * f; --- 162,180 ---- if (y0 < 0 || y0 >= imageRows) continue; ! ! if (alpha) { f = (double)alpha[y0][x0] / (double)alphaMax; if (InvertFlag) f = 1.0 - f; } + else if (mask) { + f = (mask[y0][x0] == PBM_WHITE ? 0.0 : 1.0); + if (InvertFlag) + f = 1.0 - f; + } + else + f = 1.0; r = PPM_GETR(pixels[x]) * (1.0 - f) + PPM_GETR(image[y0][x0]) * f; diff -rcbB netpbm/pnm/pnmcrop.c netpbm_pearls/pnm/pnmcrop.c *** netpbm/pnm/pnmcrop.c Wed Oct 06 09:50:32 1993 --- netpbm_pearls/pnm/pnmcrop.c Mon Jan 23 03:22:07 1995 *************** *** 40,46 **** which = 0; /* Check for flags. */ ! if ( argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0' ) { if ( pm_keymatch( argv[argn], "-white", 2 ) ) { --- 40,46 ---- which = 0; /* Check for flags. */ ! while ( argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0' ) { if ( pm_keymatch( argv[argn], "-white", 2 ) ) { diff -rcbB netpbm/pnm/pnmscale.c netpbm_pearls/pnm/pnmscale.c *** netpbm/pnm/pnmscale.c Mon Nov 29 12:42:54 1993 --- netpbm_pearls/pnm/pnmscale.c Mon Jan 23 05:24:36 1995 *************** *** 8,13 **** --- 8,16 ---- ** copyright notice and this permission notice appear in supporting ** documentation. This software is provided "as is" without express or ** implied warranty. + ** + ** Modified 16/Sep/94 by Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) + ** - added {min|max} qualifiers for size options */ #include *************** *** 16,21 **** --- 19,27 ---- #define SCALE 4096 #define HALFSCALE 2048 + #define MINSPEC 1 + #define MAXSPEC 2 + int main( argc, argv ) int argc; *************** *** 37,47 **** long* rs; long* gs; long* bs; char* usage = " [pnmfile]\n \ ! -xsize|width|-ysize|-height [pnmfile]\n \ -xscale|-yscale [pnmfile]\n \ -xscale|-xsize|-width -yscale|-ysize|-height [pnmfile]\n \ ! -xysize [pnmfile]\n \ -pixels [pnmfile]"; pnm_init( &argc, argv ); --- 43,54 ---- long* rs; long* gs; long* bs; + int specxminmax, specyminmax, mflag; char* usage = " [pnmfile]\n \ ! -xsize|-width|-ysize|-height [pnmfile]\n \ -xscale|-yscale [pnmfile]\n \ -xscale|-xsize|-width -yscale|-ysize|-height [pnmfile]\n \ ! -xysize|-size [pnmfile]\n \ -pixels [pnmfile]"; pnm_init( &argc, argv ); *************** *** 48,53 **** --- 55,61 ---- argn = 1; specxscale = specyscale = specxsize = specysize = specxysize = newpixels = 0; + specxminmax = specyminmax = mflag = 0; while ( argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0' ) { *************** *** 80,86 **** specyscale = 1; } else if ( pm_keymatch( argv[argn], "-xsize", 4 ) || ! pm_keymatch( argv[argn], "-width", 2 ) ) { if ( specxsize ) pm_error( "already specified a width" ); --- 88,98 ---- specyscale = 1; } else if ( pm_keymatch( argv[argn], "-xsize", 4 ) || ! pm_keymatch( argv[argn], "-width", 2 ) || ! ( pm_keymatch( argv[argn], "-maxxsize", 7 ) && (mflag = MAXSPEC) ) || ! ( pm_keymatch( argv[argn], "-maxwidth", 7 ) && (mflag = MAXSPEC) ) || ! ( pm_keymatch( argv[argn], "-minxsize", 7 ) && (mflag = MINSPEC) ) || ! ( pm_keymatch( argv[argn], "-minwidth", 7 ) && (mflag = MINSPEC) ) ) { if ( specxsize ) pm_error( "already specified a width" ); *************** *** 93,101 **** if ( newcols <= 0 ) pm_error( "new width must be greater than 0" ); specxsize = 1; } else if ( pm_keymatch( argv[argn], "-ysize", 4 ) || ! pm_keymatch( argv[argn], "-height", 2 ) ) { if ( specysize ) pm_error( "already specified a height" ); --- 105,118 ---- if ( newcols <= 0 ) pm_error( "new width must be greater than 0" ); specxsize = 1; + specxminmax = mflag; } else if ( pm_keymatch( argv[argn], "-ysize", 4 ) || ! pm_keymatch( argv[argn], "-height", 2 ) || ! ( pm_keymatch( argv[argn], "-maxysize", 7 ) && (mflag = MAXSPEC) ) || ! ( pm_keymatch( argv[argn], "-maxheight", 7 ) && (mflag = MAXSPEC) ) || ! ( pm_keymatch( argv[argn], "-minysize", 7 ) && (mflag = MINSPEC) ) || ! ( pm_keymatch( argv[argn], "-minheight", 7 ) && (mflag = MINSPEC) ) ) { if ( specysize ) pm_error( "already specified a height" ); *************** *** 108,115 **** if ( newrows <= 0 ) pm_error( "new height must be greater than 0" ); specysize = 1; } ! else if ( pm_keymatch( argv[argn], "-xysize", 3 ) ) { if ( specxsize || specysize || specxscale || specyscale || newpixels ) pm_error( "can't use -xysize with any other specifiers" ); --- 125,138 ---- if ( newrows <= 0 ) pm_error( "new height must be greater than 0" ); specysize = 1; + specyminmax = mflag; } ! else if ( pm_keymatch( argv[argn], "-xysize", 3 ) || ! pm_keymatch( argv[argn], "-size", 3 ) || ! ( pm_keymatch( argv[argn], "-maxxysize", 8 ) && (mflag = MAXSPEC) ) || ! ( pm_keymatch( argv[argn], "-minxysize", 8 ) && (mflag = MINSPEC) ) || ! ( pm_keymatch( argv[argn], "-maxsize", 6 ) && (mflag = MAXSPEC) ) || ! ( pm_keymatch( argv[argn], "-minsize", 6 ) && (mflag = MINSPEC) ) ) { if ( specxsize || specysize || specxscale || specyscale || newpixels ) pm_error( "can't use -xysize with any other specifiers" ); *************** *** 124,129 **** --- 147,153 ---- specxsize = 1; specysize = 1; specxysize = 1; + specxminmax = mflag; } else if ( pm_keymatch( argv[argn], "-pixels", 2 ) ) { *************** *** 138,143 **** --- 162,168 ---- else pm_usage( usage ); ++argn; + mflag = 0; } if ( ! ( specxscale || specyscale || specxsize || specysize || newpixels ) ) *************** *** 192,197 **** --- 217,262 ---- sqrt( (float) newpixels / (float) cols / (float) rows ); specxscale = specyscale = 1; } + + switch ( specxminmax ) + { + case MINSPEC: + if ( specxysize ) + { + if ( cols >= newcols && rows >= newrows ) + { + newcols = cols; + newrows = rows; + } + } + else if ( cols > newcols ) + newcols = cols; + break; + case MAXSPEC: + if ( specxysize ) + { + if ( cols <= newcols && rows <= newrows ) + { + newcols = cols; + newrows = rows; + } + } + else if ( cols < newcols ) + newcols = cols; + break; + } + + switch ( specyminmax ) + { + case MINSPEC: + if ( rows > newrows ) + newrows = rows; + break; + case MAXSPEC: + if ( rows < newrows ) + newrows = rows; + break; + } if ( specxysize ) if ( (float) newcols / (float) newrows > (float) cols / (float) rows ) diff -rcbB netpbm/pnm/pnmtotiff.c netpbm_pearls/pnm/pnmtotiff.c *** netpbm/pnm/pnmtotiff.c Thu Jan 27 17:59:24 1994 --- netpbm_pearls/pnm/pnmtotiff.c Mon Jan 23 18:40:13 1995 *************** *** 276,295 **** for ( col = 0, xP = xels[row], tP = buf; col < cols; ++col, ++xP ) { ! register unsigned char s; s = PPM_GETR( *xP ); if ( maxval != 255 ) s = (long) s * 255 / maxval; ! *tP++ = s; s = PPM_GETG( *xP ); if ( maxval != 255 ) s = (long) s * 255 / maxval; ! *tP++ = s; s = PPM_GETB( *xP ); if ( maxval != 255 ) s = (long) s * 255 / maxval; ! *tP++ = s; } } else --- 276,295 ---- for ( col = 0, xP = xels[row], tP = buf; col < cols; ++col, ++xP ) { ! register xelval s; s = PPM_GETR( *xP ); if ( maxval != 255 ) s = (long) s * 255 / maxval; ! *tP++ = (unsigned char)s; s = PPM_GETG( *xP ); if ( maxval != 255 ) s = (long) s * 255 / maxval; ! *tP++ = (unsigned char)s; s = PPM_GETB( *xP ); if ( maxval != 255 ) s = (long) s * 255 / maxval; ! *tP++ = (unsigned char)s; } } else diff -rcbB netpbm/pnm/tifftopnm.c netpbm_pearls/pnm/tifftopnm.c *** netpbm/pnm/tifftopnm.c Mon Oct 04 10:12:00 1993 --- netpbm_pearls/pnm/tifftopnm.c Mon Jan 23 05:13:43 1995 *************** *** 54,60 **** int headerdump; register u_char sample; register int bitsleft; ! unsigned short bps, spp, photomet; unsigned short* redcolormap; unsigned short* greencolormap; unsigned short* bluecolormap; --- 54,60 ---- int headerdump; register u_char sample; register int bitsleft; ! unsigned short bps, spp, photomet, planarconfig; unsigned short* redcolormap; unsigned short* greencolormap; unsigned short* bluecolormap; *************** *** 101,106 **** --- 101,113 ---- spp = 1; if ( ! TIFFGetField( tif, TIFFTAG_PHOTOMETRIC, &photomet ) ) pm_error( "error getting photometric" ); + if( spp > 1 ){ + if ( ! TIFFGetField( tif, TIFFTAG_PLANARCONFIG, &planarconfig ) ) + pm_error( "error getting planarconfig" ); + }else{ + planarconfig = PLANARCONFIG_CONTIG; + } + switch ( spp ) { *************** *** 114,119 **** --- 121,138 ---- "can only handle 1-channel gray scale or 1- or 3-channel color" ); } + switch( planarconfig ) + { + case PLANARCONFIG_CONTIG: + break; + case PLANARCONFIG_SEPARATE: + if( photomet != PHOTOMETRIC_RGB ) + pm_error( "can only handle separate planes with RGB data" ); + break; + default: + pm_error("Unrecongnized PLANARCONFIG tag!\n"); + } + (void) TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &cols ); (void) TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &rows ); *************** *** 259,264 **** --- 278,284 ---- break; case PHOTOMETRIC_RGB: + if( planarconfig == PLANARCONFIG_CONTIG ){ for ( col = 0; col < cols; ++col, ++xP ) { register xelval r, g, b; *************** *** 273,278 **** --- 293,331 ---- NEXTSAMPLE /* skip alpha channel */ PPM_ASSIGN( *xP, r, g, b ); } + }else{ + /* First clear the value and assign the reds */ + for ( col = 0; col < cols; ++col, ++xP ) + { + NEXTSAMPLE + PPM_ASSIGN( *xP, 0, 0, 0 ); + PPM_PUTR( *xP, sample ); + } + + /* Next the greens */ + if ( TIFFReadScanline( tif, buf, row, 1 ) < 0 ) + pm_error( "bad data read on green line %d", row ); + xP = xelrow; + inP = buf; + bitsleft = 8; + for ( col = 0; col < cols; ++col, ++xP ) + { + NEXTSAMPLE + PPM_PUTG( *xP, sample ); + } + + /* And finally the blues */ + if ( TIFFReadScanline( tif, buf, row, 2 ) < 0 ) + pm_error( "bad data read on green line %d", row ); + xP = xelrow; + inP = buf; + bitsleft = 8; + for ( col = 0; col < cols; ++col, ++xP ) + { + NEXTSAMPLE + PPM_PUTB( *xP, sample ); + } + } break; default: diff -rcbB netpbm/ppm/ppmmake.c netpbm_pearls/ppm/ppmmake.c *** netpbm/ppm/ppmmake.c Mon Oct 04 10:12:28 1993 --- netpbm_pearls/ppm/ppmmake.c Fri Dec 16 03:21:17 1994 *************** *** 50,61 **** ppm_writeppminit( stdout, cols, rows, PPM_MAXMAXVAL, 0 ); pixrow = ppm_allocrow( cols ); - for ( row = 0; row < rows; ++row ) - { for ( col = 0, pP = pixrow; col < cols; ++col, ++pP ) *pP = color; ppm_writeppmrow( stdout, pixrow, cols, PPM_MAXMAXVAL, 0 ); - } pm_close( stdout ); exit( 0 ); --- 50,59 ---- ppm_writeppminit( stdout, cols, rows, PPM_MAXMAXVAL, 0 ); pixrow = ppm_allocrow( cols ); for ( col = 0, pP = pixrow; col < cols; ++col, ++pP ) *pP = color; + for ( row = 0; row < rows; ++row ) ppm_writeppmrow( stdout, pixrow, cols, PPM_MAXMAXVAL, 0 ); pm_close( stdout ); exit( 0 ); diff -rcbB netpbm/ppm/yuvsplittoppm.c netpbm_pearls/ppm/yuvsplittoppm.c *** netpbm/ppm/yuvsplittoppm.c Mon Oct 04 10:13:04 1993 --- netpbm_pearls/ppm/yuvsplittoppm.c Mon Jan 23 03:22:37 1995 *************** *** 22,28 **** #include "ppm.h" /* x must be signed for the following to work correctly */ ! #define limit(x) (((x>0xffffff)?0xff0000:((x<=0xffff)?0:x&0xff0000))>>16) int main(argc, argv) --- 22,28 ---- #include "ppm.h" /* x must be signed for the following to work correctly */ ! #define limit(x) (((x>(long)0xffffff)?(long)0xff0000:((x<=(long)0xffff)?0:x&(long)0xff0000))>>16) int main(argc, argv) diff -rcbB netpbm/ppm/yuvtoppm.c netpbm_pearls/ppm/yuvtoppm.c *** netpbm/ppm/yuvtoppm.c Mon Oct 04 10:13:06 1993 --- netpbm_pearls/ppm/yuvtoppm.c Mon Jan 23 03:23:31 1995 *************** *** 23,29 **** #include "ppm.h" /* x must be signed for the following to work correctly */ ! #define limit(x) (((x>0xffffff)?0xff0000:((x<=0xffff)?0:x&0xff0000))>>16) int main(argc, argv) --- 23,29 ---- #include "ppm.h" /* x must be signed for the following to work correctly */ ! #define limit(x) (((x>(long)0xffffff)?(long)0xff0000:((x<=(long)0xffff)?0:x&(long)0xff0000))>>16) int main(argc, argv)