home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
3
/
3248
< prev
next >
Wrap
Internet Message Format
|
1991-04-28
|
62KB
From: mcastle@mcs213d.cs.umr.edu (Mike Castle {Nexus})
Newsgroups: alt.sources
Subject: PBMPlus on MSDOS patches (03/03)
Message-ID: <2694@umriscc.isc.umr.edu>
Date: 29 Apr 91 03:48:44 GMT
*** pbmplus.old/pnm/pnmtoxwd.c Fri Apr 12 00:31:06 1991
--- pbmplus.new/pnm/pnmtoxwd.c Sat Apr 20 17:33:28 1991
***************
*** 18,23 ****
--- 18,28 ----
#define MAXCOLORS 256
#endif /*PPM*/
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char* argv[];
***************
*** 67,72 ****
--- 72,89 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".xwd" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
xels = pnm_readpnm( ifp, &cols, &rows, &maxval, &format );
lmaxval = (long) maxval;
pm_close( ifp );
***************
*** 185,190 ****
--- 202,237 ----
h11.bits_per_rgb = h11.pixmap_depth;
/* Write out the header in big-endian order. */
+ #ifdef GNUDOS
+ pm_writebiglong( ofp, h11.header_size );
+ pm_writebiglong( ofp, h11.file_version );
+ pm_writebiglong( ofp, h11.pixmap_format );
+ pm_writebiglong( ofp, h11.pixmap_depth );
+ pm_writebiglong( ofp, h11.pixmap_width );
+ pm_writebiglong( ofp, h11.pixmap_height );
+ pm_writebiglong( ofp, h11.xoffset );
+ pm_writebiglong( ofp, h11.byte_order );
+ pm_writebiglong( ofp, h11.bitmap_unit );
+ pm_writebiglong( ofp, h11.bitmap_bit_order );
+ pm_writebiglong( ofp, h11.bitmap_pad );
+ pm_writebiglong( ofp, h11.bits_per_pixel );
+ pm_writebiglong( ofp, h11.bytes_per_line );
+ pm_writebiglong( ofp, h11.visual_class );
+ pm_writebiglong( ofp, h11.red_mask );
+ pm_writebiglong( ofp, h11.green_mask );
+ pm_writebiglong( ofp, h11.blue_mask );
+ pm_writebiglong( ofp, h11.bits_per_rgb );
+ pm_writebiglong( ofp, h11.colormap_entries );
+ pm_writebiglong( ofp, h11.ncolors );
+ pm_writebiglong( ofp, h11.window_width );
+ pm_writebiglong( ofp, h11.window_height );
+ pm_writebiglong( ofp, h11.window_x );
+ pm_writebiglong( ofp, h11.window_y );
+ pm_writebiglong( ofp, h11.window_bdrwidth );
+
+ /* Write out the dump name. */
+ fwrite( dumpname, 1, strlen( dumpname ) + 1, ofp );
+ #else /* GNUDOS */
pm_writebiglong( stdout, h11.header_size );
pm_writebiglong( stdout, h11.file_version );
pm_writebiglong( stdout, h11.pixmap_format );
***************
*** 213,218 ****
--- 260,266 ----
/* Write out the dump name. */
fwrite( dumpname, 1, strlen( dumpname ) + 1, stdout );
+ #endif /* GNUDOS */
if ( ! direct )
{
***************
*** 252,263 ****
pm_error( "shouldn't happen", 0,0,0,0,0 );
#endif /*PPM*/
}
pm_writebiglong( stdout, color.pixel );
pm_writebigshort( stdout, color.red );
pm_writebigshort( stdout, color.green );
pm_writebigshort( stdout, color.blue );
! putc( color.flags, stdout );
! putc( color.pad, stdout );
}
}
--- 300,320 ----
pm_error( "shouldn't happen", 0,0,0,0,0 );
#endif /*PPM*/
}
+ #ifdef GNUDOS
+ pm_writebiglong( ofp, color.pixel );
+ pm_writebigshort( ofp, color.red );
+ pm_writebigshort( ofp, color.green );
+ pm_writebigshort( ofp, color.blue );
+ fputc( color.flags, ofp );
+ fputc( color.pad, ofp );
+ #else /* GNUDOS */
pm_writebiglong( stdout, color.pixel );
pm_writebigshort( stdout, color.red );
pm_writebigshort( stdout, color.green );
pm_writebigshort( stdout, color.blue );
! putc( color.flags, stdout );
! putc( color.pad, stdout );
! #endif /* GNUDOS */
}
}
***************
*** 276,282 ****
--- 333,343 ----
ul = ( ( PPM_GETR( *xP ) * ( 255 / lmaxval ) ) << 16 ) |
( ( PPM_GETG( *xP ) * ( 255 / lmaxval ) ) << 8 ) |
( PPM_GETB( *xP ) * ( 255 / lmaxval ) );
+ #ifdef GNUDOS
+ fwrite( &ul, sizeof(ul), 1, ofp );
+ #else /* GNUDOS */
fwrite( &ul, sizeof(ul), 1, stdout );
+ #endif /* GNUDOS */
}
break;
#endif /*PPM*/
***************
*** 290,296 ****
--- 351,361 ----
ul = ( ( val * ( 255 / lmaxval ) ) << 16 ) |
( ( val * ( 255 / lmaxval ) ) << 8 ) |
( val * ( 255 / lmaxval ) );
+ #ifdef GNUDOS
+ fwrite( &ul, sizeof(ul), 1, ofp );
+ #else /* GNUDOS */
fwrite( &ul, sizeof(ul), 1, stdout );
+ #endif /* GNUDOS */
}
break;
}
***************
*** 319,341 ****
--- 384,422 ----
bitshift -= h11.bits_per_pixel;
if ( bitshift < 0 )
{
+ #ifdef GNUDOS
+ fputc( byte, ofp );
+ #else /* GNUDOS */
putchar( byte );
+ #endif /* GNUDOS */
bitshift = 8 - h11.bits_per_pixel;
byte = 0;
}
}
if ( bitshift < 8 - h11.bits_per_pixel )
+ #ifdef GNUDOS
+ fputc( byte, ofp );
+ #else /* GNUDOS */
putchar( byte );
+ #endif /* GNUDOS */
}
else
{
#ifdef PPM
for ( col = 0, xP = xels[row]; col < cols; ++col, ++xP )
+ #ifdef GNUDOS
+ fputc( ppm_lookupcolor( cht, xP ), ofp );
+ #else /* GNUDOS */
putchar( ppm_lookupcolor( cht, xP ) );
+ #endif /* GNUDOS */
#else /*PPM*/
pm_error( "shouldn't happen", 0,0,0,0,0 );
#endif /*PPM*/
}
+
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/pnm/rasttopn.c pbmplus.new/pnm/rasttopn.c
*** pbmplus.old/pnm/rasttopn.c Fri Apr 12 00:31:04 1991
--- pbmplus.new/pnm/rasttopn.c Sat Apr 20 17:04:04 1991
***************
*** 38,44 ****
--- 38,48 ----
if ( argn != argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
++argn;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/pnm/xwdtopnm.c pbmplus.new/pnm/xwdtopnm.c
*** pbmplus.old/pnm/xwdtopnm.c Fri Apr 12 00:31:04 1991
--- pbmplus.new/pnm/xwdtopnm.c Sat Apr 20 17:04:30 1991
***************
*** 37,43 ****
pm_usage( "[xwdfile]" );
if ( argc == 2 )
! ifp = pm_openr( argv[1] );
else
ifp = stdin;
--- 37,47 ----
pm_usage( "[xwdfile]" );
if ( argc == 2 )
! #ifdef GNUDOS
! ifp = pm_openrb( argv[1] );
! #else /* GNUDOS */
! ifp = pm_openr argv[1] );
! #endif /* GNUDOS */
else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/ppm/body.c pbmplus.new/ppm/body.c
*** pbmplus.old/ppm/body.c
--- pbmplus.new/ppm/body.c Sat Apr 20 10:08:52 1991
***************
*** 0 ****
--- 1,11 ----
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
diff -c -B -H +new-file +recursive pbmplus.old/ppm/delppm.bat pbmplus.new/ppm/delppm.bat
*** pbmplus.old/ppm/delppm.bat
--- pbmplus.new/ppm/delppm.bat Fri Apr 12 22:49:26 1991
***************
*** 0 ****
--- 1,34 ----
+ del GIFTOPPM
+ del GOULDTOP
+ del ILBMTOPP
+ del IMGTOPPM
+ del MTVTOPPM
+ del PCXTOPPM
+ del PGMTOPPM
+ del PI1TOPPM
+ del PICTTOPP
+ del PPMHIST
+ del PPMMAKE
+ del PPMPAT
+ del PPMQUANT
+ del PPMRELIE
+ del PPMTOGIF
+ del PPMTOICR
+ del PPMTOILB
+ del PPMTOPCX
+ del PPMTOPGM
+ del PPMTOPI1
+ del PPMTOPIC
+ del PPMTOPS
+ del PPMTOPUZ
+ del PPMTORGB
+ del PPMTOUIL
+ del PPMTOXPM
+ del QRTTOPPM
+ del RAWTOPPM
+ del RGB3TOPP
+ del SPCTOPPM
+ del SPUTOPPM
+ del TGATOPPM
+ del XIMTOPPM
+ del XPMTOPPM
diff -c -B -H +new-file +recursive pbmplus.old/ppm/exeppm.bat pbmplus.new/ppm/exeppm.bat
*** pbmplus.old/ppm/exeppm.bat
--- pbmplus.new/ppm/exeppm.bat Fri Apr 12 22:48:58 1991
***************
*** 0 ****
--- 1,34 ----
+ copy /b c:\gcc\bin\stub.exe+GIFTOPPM GIFTOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+GOULDTOP GOULDTOP.exe
+ copy /b c:\gcc\bin\stub.exe+ILBMTOPP ILBMTOPP.exe
+ copy /b c:\gcc\bin\stub.exe+IMGTOPPM IMGTOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+MTVTOPPM MTVTOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+PCXTOPPM PCXTOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+PGMTOPPM PGMTOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+PI1TOPPM PI1TOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+PICTTOPP PICTTOPP.exe
+ copy /b c:\gcc\bin\stub.exe+PPMHIST PPMHIST.exe
+ copy /b c:\gcc\bin\stub.exe+PPMMAKE PPMMAKE.exe
+ copy /b c:\gcc\bin\stub.exe+PPMPAT PPMPAT.exe
+ copy /b c:\gcc\bin\stub.exe+PPMQUANT PPMQUANT.exe
+ copy /b c:\gcc\bin\stub.exe+PPMRELIE PPMRELIE.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOGIF PPMTOGIF.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOICR PPMTOICR.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOILB PPMTOILB.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOPCX PPMTOPCX.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOPGM PPMTOPGM.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOPI1 PPMTOPI1.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOPIC PPMTOPIC.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOPS PPMTOPS.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOPUZ PPMTOPUZ.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTORGB PPMTORGB.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOUIL PPMTOUIL.exe
+ copy /b c:\gcc\bin\stub.exe+PPMTOXPM PPMTOXPM.exe
+ copy /b c:\gcc\bin\stub.exe+QRTTOPPM QRTTOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+RAWTOPPM RAWTOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+RGB3TOPP RGB3TOPP.exe
+ copy /b c:\gcc\bin\stub.exe+SPCTOPPM SPCTOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+SPUTOPPM SPUTOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+TGATOPPM TGATOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+XIMTOPPM XIMTOPPM.exe
+ copy /b c:\gcc\bin\stub.exe+XPMTOPPM XPMTOPPM.exe
diff -c -B -H +new-file +recursive pbmplus.old/ppm/giftoppm.c pbmplus.new/ppm/giftoppm.c
*** pbmplus.old/ppm/giftoppm.c Fri Apr 12 00:31:16 1991
--- pbmplus.new/ppm/giftoppm.c Sat Apr 20 12:47:24 1991
***************
*** 90,96 ****
--- 90,100 ----
++argn;
}
if (argn != argc) {
+ #ifdef GNUDOS
+ in = pm_openrb(argv[argn]);
+ #else /* GNUDOS */
in = pm_openr(argv[argn]);
+ #endif /* GNUDOS */
++argn;
} else {
in = stdin;
***************
*** 109,115 ****
FILE *fd;
int imageNumber;
{
! unsigned char buf[16];
unsigned char c;
unsigned char localColorMap[3][MAXCOLORMAPSIZE];
int useGlobalColormap;
--- 113,120 ----
FILE *fd;
int imageNumber;
{
! /* unsigned char buf[16];*/
! char buf[16];
unsigned char c;
unsigned char localColorMap[3][MAXCOLORMAPSIZE];
int useGlobalColormap;
***************
*** 515,521 ****
if ((image = ppm_allocarray(len, height)) == NULL)
pm_error("couldn't alloc space for image", 0,0,0,0,0);
! if (verbose)
pm_message("reading %d by %d%s GIF image",
len, height, interlace ? " interlaced" : "", 0,0);
--- 520,526 ----
if ((image = ppm_allocarray(len, height)) == NULL)
pm_error("couldn't alloc space for image", 0,0,0,0,0);
! if (verbose)
pm_message("reading %d by %d%s GIF image",
len, height, interlace ? " interlaced" : "", 0,0);
diff -c -B -H +new-file +recursive pbmplus.old/ppm/gouldtop.c pbmplus.new/ppm/gouldtop.c
*** pbmplus.old/ppm/gouldtop.c Fri Apr 12 00:32:48 1991
--- pbmplus.new/ppm/gouldtop.c Sat Apr 20 00:25:20 1991
***************
*** 35,41 ****
--- 35,45 ----
pm_usage( "[gouldfile]" );
if ( argc == 2 )
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[1] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/ppm/header.c pbmplus.new/ppm/header.c
*** pbmplus.old/ppm/header.c
--- pbmplus.new/ppm/header.c Fri Apr 19 15:37:02 1991
***************
*** 0 ****
--- 1,4 ----
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ilbmtopp.c pbmplus.new/ppm/ilbmtopp.c
*** pbmplus.old/ppm/ilbmtopp.c Fri Apr 12 00:31:16 1991
--- pbmplus.new/ppm/ilbmtopp.c Sat Apr 20 00:24:58 1991
***************
*** 34,40 ****
--- 34,44 ----
if ( argn < argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
argn++;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/ppm/imgtoppm.c pbmplus.new/ppm/imgtoppm.c
*** pbmplus.old/ppm/imgtoppm.c Fri Apr 12 00:31:22 1991
--- pbmplus.new/ppm/imgtoppm.c Sat Apr 20 11:06:50 1991
***************
*** 25,32 ****
register int col;
pixval maxval;
int len, cmaplen, gotAT, gotCM;
! unsigned char buf[4096];
! register unsigned char *bP;
ppm_init( &argc, argv );
--- 25,34 ----
register int col;
pixval maxval;
int len, cmaplen, gotAT, gotCM;
! /* unsigned char buf[4096]; */
! char buf[4096];
! /* register unsigned char *bP; */
! register char *bP;
ppm_init( &argc, argv );
***************
*** 34,40 ****
--- 36,46 ----
if ( argn < argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
argn++;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/ppm/makefile.pc pbmplus.new/ppm/makefile.pc
*** pbmplus.old/ppm/makefile.pc
--- pbmplus.new/ppm/makefile.pc Sat Apr 20 00:17:12 1991
***************
*** 0 ****
--- 1,180 ----
+ # Makefile for ppm tools.
+ #
+ # Copyright (C) 1989, 1991 by Jef Poskanzer.
+ #
+ # Permission to use, copy, modify, and distribute this software and its
+ # documentation for any purpose and without fee is hereby granted, provided
+ # that the above copyright notice appear in all copies and that both that
+ # copyright notice and this permission notice appear in supporting
+ # documentation. This software is provided "as is" without express or
+ # implied warranty.
+
+ # Default values, usually overridden by top-level Makefile.
+ #CC = cc
+ CC = gcc -fcombine-regs
+ #CFLAGS = -O
+ CFLAGS = -g
+ #CFLAGS = -g -O
+ #RGBDEF = -DRGB_DB=\"/usr/lib/X11/rgb.txt\"
+ #LDFLAGS = -s
+ LDFLAGS =
+ INSTALLBINARIES = /usr/new/pbm
+ INSTALLSCRIPTS = $(INSTALLBINARIES)
+ INSTALLMANUALS1 = /usr/man/mann
+ SUFFIXMANUALS1 = 1
+ INSTALLMANUALS3 = /usr/man/mann
+ SUFFIXMANUALS3 = 3
+ INSTALLMANUALS5 = /usr/man/mann
+ SUFFIXMANUALS5 = 5
+ MANCP = cp
+
+ PGMDIR = ../pgm
+ INCLUDEPGM = -I$(PGMDIR)
+ LIBPGM = $(PGMDIR)/libpgm.a
+ DEFPGM = $(PGMDIR)/pgm.h
+ DEFLIBPGM = $(PGMDIR)/libpgm.h
+
+ PBMDIR = ../pbm
+ INCLUDEPBM = -I$(PBMDIR)
+ LIBPBM = $(PBMDIR)/libpbm.a
+ DEFPBM = $(PBMDIR)/pbm.h ../pbmplus.h
+ DEFLIBPBM = $(PBMDIR)/libpbm.h
+
+ SHELL = /bin/sh
+ INCLUDE = $(INCLUDEPGM) $(INCLUDEPBM)
+ ALLCFLAGS = $(CFLAGS) $(RGBDEF) $(INCLUDE)
+ LIBPPM = libppm.a
+
+ PORTBINARIES = giftoppm gouldtoppm ilbmtoppm imgtoppm mtvtoppm \
+ pcxtoppm pgmtoppm pi1toppm picttoppm \
+ ppmhist ppmmake ppmquant \
+ ppmrelief ppmtogif ppmtoicr ppmtoilbm \
+ ppmtopcx ppmtopgm ppmtopi1 ppmtopict ppmtops \
+ ppmtopuzz ppmtorgb3 ppmtouil ppmtoxpm \
+ qrttoppm rawtoppm rgb3toppm spctoppm \
+ sputoppm tgatoppm ximtoppm xpmtoppm
+ MATHBINARIES = ppmpat
+ BINARIES = $(PORTBINARIES) $(MATHBINARIES)
+ SCRIPTS = ppmquantall
+
+ OBJECTS = giftoppm.o gouldtoppm.o ilbmtoppm.o imgtoppm.o mtvtoppm.o \
+ pcxtoppm.o pgmtoppm.o pi1toppm.o picttoppm.o \
+ ppmhist.o ppmmake.o ppmquant.o \
+ ppmrelief.o ppmtogif.o ppmtoicr.o ppmtoilbm.o \
+ ppmtopcx.o ppmtopgm.o ppmtopi1.o ppmtopict.o ppmtops.o \
+ ppmtopuzz.o ppmtorgb3.o ppmtouil.o ppmtoxpm.o \
+ qrttoppm.o rawtoppm.o rgb3toppm.o spctoppm.o \
+ sputoppm.o tgatoppm.o ximtoppm.o xpmtoppm.o \
+ ppmpat.o
+
+ MANUALS1 = $(BINARIES) $(SCRIPTS)
+ MANUALS3 = libppm
+ MANUALS5 = ppm
+
+
+ all: binaries
+
+
+ binaries: $(BINARIES)
+
+ installbinaries: binaries
+ cd $(INSTALLBINARIES)
+ cp $(BINARIES) $(INSTALLBINARIES)
+ cd $(INSTALLSCRIPTS)
+ cp $(SCRIPTS) $(INSTALLSCRIPTS)
+ cd $(INSTALLSCRIPTS)
+
+
+ merge: ppmmerge
+ ppmmerge: ppmmerge.c $(OBJECTS) $(LIBPPM) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(OBJECTS) -lm $(LIBPPM) $(LIBPGM) $(LIBPBM)
+
+ installmerge: installppmmerge
+ installppmmerge: ppmmerge
+ cd $(INSTALLBINARIES) ; rm -f $(BINARIES)
+ cp ppmmerge $(INSTALLBINARIES)
+ cd $(INSTALLBINARIES) ; for i in $(BINARIES) ; do ln ppmmerge $$i ; done
+ rm $(INSTALLBINARIES)/ppmmerge
+ cd $(INSTALLSCRIPTS) ; rm -f $(SCRIPTS)
+ cp $(SCRIPTS) $(INSTALLSCRIPTS)
+ cd $(INSTALLSCRIPTS) ; chmod +x $(SCRIPTS)
+
+
+ installmanuals:
+ for i in $(MANUALS1) ; do $(MANCP) $$i.1 $(INSTALLMANUALS1)/$$i.$(SUFFIXMANUALS1) ; done
+ for i in $(MANUALS3) ; do $(MANCP) $$i.3 $(INSTALLMANUALS3)/$$i.$(SUFFIXMANUALS3) ; done
+ for i in $(MANUALS5) ; do $(MANCP) $$i.5 $(INSTALLMANUALS5)/$$i.$(SUFFIXMANUALS5) ; done
+
+
+ # Rule for plain programs.
+ $(PORTBINARIES): ppm.h $(DEFPGM) $(DEFPBM) $(LIBPPM) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(LIBPPM) $(LIBPGM) $(LIBPBM)
+
+ # Rule for math-dependent programs.
+ $(MATHBINARIES): ppm.h $(DEFPGM) $(DEFPBM) $(LIBPPM) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c -lm $(LIBPPM) $(LIBPGM) $(LIBPBM)
+
+ # Rule for objects.
+ $(OBJECTS): ppm.h $(DEFPGM) $(DEFPBM)
+ $(CC) $(ALLCFLAGS) "-Dmain=$*_main" -c $*.c
+
+ # And libraries.
+ $(LIBPBM):
+ cd $(PBMDIR) ; make lib
+ $(LIBPGM):
+ cd $(PGMDIR) ; make lib
+ lib: $(LIBPPM)
+ $(LIBPPM): libppm1.o libppm2.o libppm3.o libppm4.o libppm5.o
+
+ ar rc $(LIBPPM) libppm1.o libppm2.o libppm3.o libppm4.o libppm5.o
+
+
+ libppm1.o: ppm.h $(DEFPGM) $(DEFPBM) libppm.h libppm1.c
+ $(CC) $(ALLCFLAGS) -c libppm1.c
+ libppm2.o: ppm.h $(DEFPGM) $(DEFPBM) libppm.h libppm2.c $(DEFLIBPGM) \
+ $(DEFLIBPBM)
+ $(CC) $(ALLCFLAGS) -c libppm2.c
+ libppm3.o: ppm.h $(DEFPGM) $(DEFPBM) libppm.h libppm3.c
+ $(CC) $(ALLCFLAGS) -c libppm3.c
+ libppm4.o: ppm.h $(DEFPGM) $(DEFPBM) ppmcmap.h libppm4.c
+ $(CC) $(ALLCFLAGS) -c libppm4.c
+ libppm5.o: ppm.h $(DEFPGM) $(DEFPBM) ppmdraw.h libppm5.c
+ $(CC) $(ALLCFLAGS) -c libppm5.c
+
+ # Other dependencies.
+ giftoppm giftoppm.o: giftoppm.c
+ gouldtoppm gouldtoppm.o: gouldtoppm.c
+ ilbmtoppm ilbmtoppm.o: ilbmtoppm.c ilbm.h
+ imgtoppm imgtoppm.o: imgtoppm.c
+ mtvtoppm mtvtoppm.o: mtvtoppm.c
+ pcxtoppm pcxtoppm.o: pcxtoppm.c
+ pgmtoppm pgmtoppm.o: pgmtoppm.c
+ pi1toppm pi1toppm.o: pi1toppm.c
+ picttoppm picttoppm.o: picttoppm.c
+ ppmhist ppmhist.o: ppmhist.c ppmcmap.h
+ ppmmake ppmmake.o: ppmmake.c
+ ppmpat ppmpat.o: ppmpat.c ppmdraw.h
+ ppmquant ppmquant.o: ppmquant.c $(PGMDIR)/dithers.h ppmcmap.h
+ ppmrelief ppmrelief.o: ppmrelief.c
+ ppmtogif ppmtogif.o: ppmtogif.c ppmcmap.h
+ ppmtoicr ppmtoicr.o: ppmtoicr.c
+ ppmtoilbm ppmtoilbm.o: ppmtoilbm.c ilbm.h ppmcmap.h
+ ppmtopcx ppmtopcx.o: ppmtopcx.c
+ ppmtopgm ppmtopgm.o: ppmtopgm.c
+ ppmtopi1 ppmtopi1.o: ppmtopi1.c
+ ppmtopict ppmtopict.o: ppmtopict.c ppmcmap.h
+ ppmtopuzz ppmtopuzz.o: ppmtopuzz.c
+ ppmtops ppmtops.o: ppmtops.c
+ ppmtorgb3 ppmtorgb3.o: ppmtorgb3.c
+ ppmtouil ppmtouil.o: ppmtouil.c
+ ppmtoxpm ppmtoxpm.o: ppmtoxpm.c
+ qrttoppm qrttoppm.o: qrttoppm.c
+ rawtoppm rawtoppm.o: rawtoppm.c
+ rgb3toppm rgb3toppm.o: rgb3toppm.c
+ spctoppm spctoppm.o: spctoppm.c
+ sputoppm sputoppm.o: sputoppm.c
+ tgatoppm tgatoppm.o: tgatoppm.c tga.h
+ ximtoppm ximtoppm.o: ximtoppm.c xim.h
+ xpmtoppm xpmtoppm.o: xpmtoppm.c
+
+
diff -c -B -H +new-file +recursive pbmplus.old/ppm/mtvtoppm.c pbmplus.new/ppm/mtvtoppm.c
*** pbmplus.old/ppm/mtvtoppm.c Fri Apr 12 00:31:14 1991
--- pbmplus.new/ppm/mtvtoppm.c Sat Apr 20 00:24:04 1991
***************
*** 30,36 ****
--- 30,40 ----
pm_usage( "[mtvfile]" );
if ( argc == 2 )
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[1] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/ppm/pcxtoppm.c pbmplus.new/ppm/pcxtoppm.c
*** pbmplus.old/ppm/pcxtoppm.c Fri Apr 12 00:32:46 1991
--- pbmplus.new/ppm/pcxtoppm.c Sat Apr 20 00:23:42 1991
***************
*** 58,64 ****
--- 58,68 ----
break;
case 2:
ifname = argv[1];
+ #ifdef GNUDOS
+ ifp = pm_openrb(ifname);
+ #else /* GNUDOS */
ifp = pm_openr(ifname);
+ #endif/* GNUDOS */
break;
default:
pm_usage("[pcxfile]");
diff -c -B -H +new-file +recursive pbmplus.old/ppm/pi1toppm.c pbmplus.new/ppm/pi1toppm.c
*** pbmplus.old/ppm/pi1toppm.c Fri Apr 12 00:32:46 1991
--- pbmplus.new/ppm/pi1toppm.c Sat Apr 20 00:23:10 1991
***************
*** 35,41 ****
--- 35,45 ----
pm_usage( "[pi1file]" );
if ( argc == 2 )
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[1] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/ppm/picttopp.c pbmplus.new/ppm/picttopp.c
*** pbmplus.old/ppm/picttopp.c Fri Apr 12 00:31:26 1991
--- pbmplus.new/ppm/picttopp.c Sat Apr 20 00:22:44 1991
***************
*** 314,320 ****
--- 314,324 ----
}
if (argn < argc) {
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr(argv[argn]);
+ #endif /* GNUDOS */
++argn;
} else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmpat.c pbmplus.new/ppm/ppmpat.c
*** pbmplus.old/ppm/ppmpat.c Fri Apr 12 00:31:18 1991
--- pbmplus.new/ppm/ppmpat.c Sat Apr 20 16:30:54 1991
***************
*** 86,92 ****
pm_error( "only one base pattern may be specified", 0,0,0,0,0 );
pattern = PAT_CAMO;
}
! else if (pm_keymatch( argv[argn], "-anticamo", 2 ) == 0)
{
if ( pattern != PAT_NONE )
pm_error( "only one base pattern may be specified", 0,0,0,0,0 );
--- 86,92 ----
pm_error( "only one base pattern may be specified", 0,0,0,0,0 );
pattern = PAT_CAMO;
}
! else if (pm_keymatch( argv[argn], "-anticamo", 2 ) )
{
if ( pattern != PAT_NONE )
pm_error( "only one base pattern may be specified", 0,0,0,0,0 );
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmquant pbmplus.new/ppm/ppmquant
*** pbmplus.old/ppm/ppmquant Fri Apr 12 00:31:26 1991
--- pbmplus.new/ppm/ppmquant
***************
*** 1,45 ****
- #!/bin/csh -f
- #
- # ppmquantall - run ppmquant on a bunch of files all at once, so they share
- # a common colormap
- #
- # WARNING: overwrites the source files with the results!!!
- #
- # Verbose explanation: Let's say you've got a dozen pixmaps that you want
- # to display on the screen all at the same time. Your screen can only
- # display 256 different colors, but the pixmaps have a total of a thousand
- # or so different colors. For a single pixmap you solve this problem with
- # ppmquant; this script solves it for multiple pixmaps. All it does is
- # concatenate them together into one big pixmap, run ppmquant on that, and
- # then split it up into little pixmaps again.
-
- if ( $#argv < 3 ) then
- echo "usage: ppmquantall <newcolors> <ppmfile> <ppmfile> ..."
- exit 1
- endif
-
- set newcolors=$argv[1]
- set files=( $argv[2-] )
-
- set heights=()
- foreach i ( $files )
- set heights=( $heights `head -2 $i | tail -1 | sed 's/.* //'` )
- end
-
- set all=/tmp/pqa.all.$$
- rm -f $all
- pnmcat -tb -white $files | ppmquant -quiet $newcolors > $all
- if ( $status != 0 ) exit $status
-
- set width=`head -2 $all | tail -1 | sed 's/ .*//'`
-
- @ y = 0
- @ i = 1
- while ( $i <= $#files )
- pnmcut 0 $y $width $heights[$i] $all | pnmcrop -white > $files[$i]
- if ( $status != 0 ) exit $status
- @ y = $y + $heights[$i]
- @ i++
- end
-
- rm -f $all
--- 0 ----
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtogif.c pbmplus.new/ppm/ppmtogif.c
*** pbmplus.old/ppm/ppmtogif.c Fri Apr 12 00:31:20 1991
--- pbmplus.new/ppm/ppmtogif.c Sat Apr 20 11:21:12 1991
***************
*** 29,34 ****
--- 29,39 ----
static pixel** pixels;
static colorhash_table cht;
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char* argv[];
***************
*** 68,73 ****
--- 73,90 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[argc-1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".gif" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pixels = ppm_readppm( ifp, &cols, &rows, &maxval );
pm_close( ifp );
***************
*** 106,114 ****
--- 123,137 ----
ppm_freecolorhist( chv );
/* All set, let's do it. */
+ #ifdef GNUDOS
+ GIFEncode(
+ ofp, cols, rows, interlace, 0, BitsPerPixel,
+ Red, Green, Blue, GetPixel );
+ #else /* GNUDOS */
GIFEncode(
stdout, cols, rows, interlace, 0, BitsPerPixel,
Red, Green, Blue, GetPixel );
+ #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtoicr.c pbmplus.new/ppm/ppmtoicr.c
*** pbmplus.old/ppm/ppmtoicr.c Fri Apr 12 00:32:48 1991
--- pbmplus.new/ppm/ppmtoicr.c Sat Apr 20 10:12:02 1991
***************
*** 20,25 ****
--- 20,30 ----
colorhash_table cht;
char *testimage;
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main(argc, argv)
int argc;
char *argv[];
***************
*** 87,92 ****
--- 92,105 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ strcpy( fname, windowname );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ strcat( fname, ".icr" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pixels = ppm_readppm( ifp, &cols, &rows, &maxval );
pm_close( ifp );
***************
*** 138,155 ****
/* Format is "ESC^W;left;top;width;height;display;windowname" */
pm_message("creating window %s ...", windowname, 0,0,0,0);
(void)printf("\033^W;%d;%d;%d;%d;%d;%s^",0,0,cols*expand,rows*expand,display,windowname);
fflush(stdout);
!
/****************** Download the colormap. ********************/
pm_message("downloading colormap for %s ...", windowname, 0,0,0,0);
(void)printf("\033^M;%d;%d;%d;%s^",0,MAXCOLORS,CLUTCOLORS,windowname);
thischar = rgb;
for (j=0; j<CLUTCOLORS; j++) {
c = *thischar++;
if (c > 31 && c < 123 ) { /* printable ASCII */
putchar(c);
}
else {
--- 151,186 ----
/* Format is "ESC^W;left;top;width;height;display;windowname" */
pm_message("creating window %s ...", windowname, 0,0,0,0);
+ #ifdef GNUDOS
+ (void)fprintf( ofp, "\033^W;%d;%d;%d;%d;%d;%s^",0,0,cols*expand,rows*expand,display,windowname);
+ fflush( ofp );
+ #else /* GNUDOS */
(void)printf("\033^W;%d;%d;%d;%d;%d;%s^",0,0,cols*expand,rows*expand,display,windowname);
fflush(stdout);
! #endif /* GNUDOS */
/****************** Download the colormap. ********************/
pm_message("downloading colormap for %s ...", windowname, 0,0,0,0);
+ #ifdef GNUDOS
+ (void)fprintf( ofp, "\033^M;%d;%d;%d;%s^",0,MAXCOLORS,CLUTCOLORS,windowname);
+ #else /* GNUDOS */
(void)printf("\033^M;%d;%d;%d;%s^",0,MAXCOLORS,CLUTCOLORS,windowname);
+ #endif /* GNUDOS */
thischar = rgb;
for (j=0; j<CLUTCOLORS; j++) {
c = *thischar++;
if (c > 31 && c < 123 ) { /* printable ASCII */
+ #ifdef GNUDOS
+ fputc(c, ofp );
+ }
+ else {
+ fputc((c>>6)+123, ofp ); /* non-printable, so encode it */
+ fputc((c & 0x3f) + 32, ofp );
+ }
+ }
+ fflush( ofp );
+ #else /* GNUDOS */
putchar(c);
}
else {
***************
*** 158,163 ****
--- 189,195 ----
}
}
fflush(stdout);
+ #endif /* GNUDOS */
/**************** send out picture *************************/
/* Protocol's RLE scheme is quicker but buggy */
***************
*** 174,184 ****
--- 206,230 ----
for (i = 0; i < rows; i++) {
newxsize = rleit(thisline,space,cols);
thisline += cols; /* increment to next line */
+ #ifdef GNUDOS
+ (void)printf("\033^R;%d;%d;%d;%d;%s^",0,i*expand,expand,newxsize,windowname);
+ #else /* GNUDOS */
(void)printf("\033^R;%d;%d;%d;%d;%s^",0,i*expand,expand,newxsize,windowname);
+ #endif /* GNUDOS */
thischar = space;
for (j=0; j< newxsize; j++) {
c= *thischar++; /*get byte to send */
if (c>31 && c <123) {
+ #ifdef GNUDOS
+ fputc(c, ofp );
+ }
+ else {
+ fputc((c>>6) + 123, ofp );
+ fputc((c & 0x3f) + 32, ofp );
+ }
+ }
+ fflush( ofp );
+ #else /* GNUDOS */
putchar(c);
}
else {
***************
*** 187,194 ****
--- 233,245 ----
}
}
fflush(stdout);
+ #endif /* GNUDOS */
}
free(space);
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
+
exit(0);
}
***************
*** 197,206 ****
--- 248,272 ----
else {
pm_message("sending picture data ...", 0,0,0,0,0);
for (i = 0; i < rows; i++) {
+ #ifdef GNUDOS
+ (void)fprintf( ofp, "\033^P;%d;%d;%d;%d;%s^",0,i*expand,expand,cols,windowname);
+ #else /* GNUDOS */
(void)printf("\033^P;%d;%d;%d;%d;%s^",0,i*expand,expand,cols,windowname);
+ #endif /* GNUDOS */
for (j = 0; j < cols; j++) {
c = GetPixel(j,i);
if (c > 31 && c < 123) {
+ #ifdef GNUDOS
+ fputc(c, ofp );
+ }
+ else {
+ fputc((c>>6)+123, ofp );
+ fputc((c & 0x3f) + 32, ofp );
+ }
+ }
+ }
+ fflush( ofp );
+ #else /* GNUDOS */
putchar(c);
}
else {
***************
*** 210,215 ****
--- 276,286 ----
}
}
fflush(stdout);
+ #endif /* GNUDOS */
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
+
exit(0);
}
}
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtoilb.c pbmplus.new/ppm/ppmtoilb.c
*** pbmplus.old/ppm/ppmtoilb.c Fri Apr 12 00:31:22 1991
--- pbmplus.new/ppm/ppmtoilb.c Sat Apr 20 10:08:38 1991
***************
*** 19,24 ****
--- 19,29 ----
static int colorstobpp();
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 60,65 ****
--- 65,82 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[argc-1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".ilb" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pixels = ppm_readppm( ifp, &cols, &rows, &maxval );
pm_close( ifp );
***************
*** 256,265 ****
--- 273,290 ----
*cp = 0;
}
}
+ #ifdef GNUDOS
+ fwrite( coded_rowbuf, RowBytes(cols), 1, ofp );
+ #else /* GNUDOS */
fwrite( coded_rowbuf, RowBytes(cols), 1, stdout );
+ #endif /* GNUDOS */
}
}
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
+
exit( 0 );
}
***************
*** 302,314 ****
--- 327,347 ----
put_fourchars( str )
char *str;
{
+ #ifdef GNUDOS
+ fputs( str, ofp );
+ #else /* GNUDOS */
fputs( str, stdout );
+ #endif /* GNUDOS */
}
put_big_short( s )
short s;
{
+ #ifdef GNUDOS
+ if ( pm_writebigshort( ofp, s ) == -1 )
+ #else /* GNUDOS */
if ( pm_writebigshort( stdout, s ) == -1 )
+ #endif /* GNUDOS */
pm_error( "write error", 0,0,0,0,0 );
}
***************
*** 315,321 ****
--- 348,358 ----
put_big_long( l )
long l;
{
+ #ifdef GNUDOS
+ if ( pm_writebiglong( ofp, l ) == -1 )
+ #else /* GNUDOS */
if ( pm_writebiglong( stdout, l ) == -1 )
+ #endif /* GNUDOS */
pm_error( "write error", 0,0,0,0,0 );
}
***************
*** 322,327 ****
--- 359,368 ----
put_byte( b )
unsigned char b;
{
+ #ifdef GNUDOS
+ if ( fputc( b, ofp ) == EOF )
+ #else /* GNUDOS */
if ( putc( b, stdout ) == EOF )
+ #endif /* GNUDOS */
pm_error( "write error", 0,0,0,0,0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtopcx.c pbmplus.new/ppm/ppmtopcx.c
*** pbmplus.old/ppm/ppmtopcx.c Fri Apr 12 00:32:46 1991
--- pbmplus.new/ppm/ppmtopcx.c Sat Apr 20 11:30:32 1991
***************
*** 22,27 ****
--- 22,32 ----
pixel **pixels;
colorhash_table cht;
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 49,54 ****
--- 54,71 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[argc-1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".pcx" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pixels = ppm_readppm( ifp, &cols, &rows, &maxval );
pm_close( ifp );
***************
*** 90,96 ****
ppm_freecolorhist( chv );
/* All set, let's do it. */
! PCXEncode( stdout, cols, rows, colors, Red, Green, Blue, ReadPlanes );
exit( 0 );
}
--- 107,117 ----
ppm_freecolorhist( chv );
/* All set, let's do it. */
! #ifdef GNUDOS
! PCXEncode( ofp, cols, rows, colors, Red, Green, Blue, ReadPlanes );
! #else /* GNUDOS */
! PCXEncode( stdout, cols, rows, colors, Red, Green, Blue, ReadPlanes );
! #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtopi1.c pbmplus.new/ppm/ppmtopi1.c
*** pbmplus.old/ppm/ppmtopi1.c Fri Apr 12 00:32:48 1991
--- pbmplus.new/ppm/ppmtopi1.c Sat Apr 20 10:08:28 1991
***************
*** 18,23 ****
--- 18,28 ----
#define MAXVAL 7
#define MAXCOLORS 16
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 42,47 ****
--- 47,64 ----
else
ifp = stdin;
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".pi1" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pixels = ppm_readppm( ifp, &cols, &rows, &maxval );
pm_close( ifp );
if ( (cols > COLS) || (rows > ROWS) )
***************
*** 58,64 ****
pm_message( "%d colors found", colors, 0,0,0,0 );
/* Write PI1 header - resolution and palette. */
! (void) pm_writebigshort( stdout, (short) 0 ); /* low resolution */
for ( i = 0; i < 16; ++i )
{
short w;
--- 75,85 ----
pm_message( "%d colors found", colors, 0,0,0,0 );
/* Write PI1 header - resolution and palette. */
! #ifdef GNUDOS
! (void) pm_writebigshort( ofp, (short) 0 ); /* low resolution */
! #else /* GNUDOS */
! (void) pm_writebigshort( stdout, (short) 0 ); /* low resolution */
! #endif /* GNUDOS */
for ( i = 0; i < 16; ++i )
{
short w;
***************
*** 76,82 ****
--- 97,107 ----
}
else
w = 0;
+ #ifdef GNUDOS
+ (void) pm_writebigshort( ofp, w );
+ #else /* GNUDOS */
(void) pm_writebigshort( stdout, w );
+ #endif /* GNUDOS */
}
if ( maxval > MAXVAL )
pm_message(
***************
*** 112,118 ****
--- 137,151 ----
/* And write out the screen buffer. */
for ( i = 0; i < ROWS*COLS/4; ++i )
+ #ifdef GNUDOS
+ (void) pm_writebigshort( ofp, screen[i] );
+ #else /* GNUDOS */
(void) pm_writebigshort( stdout, screen[i] );
+ #endif /* GNUDOS */
+
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtopic.c pbmplus.new/ppm/ppmtopic.c
*** pbmplus.old/ppm/ppmtopic.c Fri Apr 12 00:31:26 1991
--- pbmplus.new/ppm/ppmtopic.c Sat Apr 20 10:16:00 1991
***************
*** 130,135 ****
--- 130,140 ----
#define MAXCOLORS 256
colorhash_table cht;
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main(argc, argv)
int argc;
char *argv[];
***************
*** 155,160 ****
--- 160,177 ----
if (argn != argc)
pm_usage("[ppmfile]");
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[argc-1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".pct" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pixels = ppm_readppm(ifp, &cols, &rows, &maxval);
if (cols < 8)
pm_error("ppm input too narrow, must be >= 8 pixels wide", 0,0,0,0,0);
***************
*** 174,186 ****
--- 191,223 ----
cht = ppm_colorhisttocolorhash(chv, colors);
/* write the header */
+ #ifdef GNUDOS
+ putFill( ofp, HEADER_SIZE);
+ #else /* GNUDOS */
putFill(stdout, HEADER_SIZE);
+ #endif /* GNUDOS */
/* write picSize and picFrame */
+ #ifdef GNUDOS
+ putShort( ofp, 0);
+ putRect( ofp, 0, 0, rows, cols);
+ #else /* GNUDOS */
putShort(stdout, 0);
putRect(stdout, 0, 0, rows, cols);
+ #endif /* GNUDOS */
/* write version op and version */
+ #ifdef GNUDOS
+ putShort( ofp, PICT_picVersion);
+ putShort( ofp, 0x02FF);
+ putShort( ofp, PICT_headerOp);
+ putLong( ofp, -1L);
+ putFixed( ofp, 0, 0);
+ putFixed( ofp, 0, 0);
+ putFixed( ofp, cols, 0);
+ putFixed( ofp, rows, 0);
+ putFill( ofp, 4);
+ #else /* GNUDOS */
putShort(stdout, PICT_picVersion);
putShort(stdout, 0x02FF);
putShort(stdout, PICT_headerOp);
***************
*** 190,202 ****
putFixed(stdout, cols, 0);
putFixed(stdout, rows, 0);
putFill(stdout, 4);
! /* seems to be needed by many PICT2 programs */
putShort(stdout, PICT_clipRgn);
putShort(stdout, 10);
putRect(stdout, 0, 0, rows, cols);
/* write picture */
putShort(stdout, PICT_PackBitsRect);
putShort(stdout, cols | 0x8000);
putRect(stdout, 0, 0, rows, cols);
--- 227,266 ----
putFixed(stdout, cols, 0);
putFixed(stdout, rows, 0);
putFill(stdout, 4);
+ #endif /* GNUDOS */
! /* seems to be needed by many PICT2 programs */
! #ifdef GNUDOS
! putShort( ofp, PICT_clipRgn);
! putShort( ofp, 10);
! putRect( ofp, 0, 0, rows, cols);
! #else /* GNUDOS */
putShort(stdout, PICT_clipRgn);
putShort(stdout, 10);
putRect(stdout, 0, 0, rows, cols);
+ #endif /* GNUDOS */
/* write picture */
+ #ifdef GNUDOS
+ putShort( ofp, PICT_PackBitsRect);
+ putShort( ofp, cols | 0x8000);
+ putRect( ofp, 0, 0, rows, cols);
+ putShort( ofp, 0); /* pmVersion */
+ putShort( ofp, 0); /* packType */
+ putLong( ofp, 0L); /* packSize */
+ putFixed( ofp, 72, 0); /* hRes */
+ putFixed( ofp, 72, 0); /* vRes */
+ putShort( ofp, 0); /* pixelType */
+ putShort( ofp, 8); /* pixelSize */
+ putShort( ofp, 1); /* cmpCount */
+ putShort( ofp, 8); /* cmpSize */
+ putLong( ofp, 0L); /* planeBytes */
+ putLong( ofp, 0L); /* pmTable */
+ putLong( ofp, 0L); /* pmReserved */
+ putLong( ofp, 0L); /* ctSeed */
+ putShort( ofp, 0); /* ctFlags */
+ putShort( ofp, colors-1); /* ctSize */
+ #else /* GNUDOS */
putShort(stdout, PICT_PackBitsRect);
putShort(stdout, cols | 0x8000);
putRect(stdout, 0, 0, rows, cols);
***************
*** 215,225 ****
--- 279,294 ----
putLong(stdout, 0L); /* ctSeed */
putShort(stdout, 0); /* ctFlags */
putShort(stdout, colors-1); /* ctSize */
+ #endif /* GNUDOS */
/* Write out the colormap. */
for (i = 0; i < colors; i++)
{
+ #ifdef GNUDOS
+ putShort( ofp, i );
+ #else /* GNUDOS */
putShort(stdout, i);
+ #endif /* GNUDOS */
rval = PPM_GETR(chv[i].color);
gval = PPM_GETG(chv[i].color);
bval = PPM_GETB(chv[i].color);
***************
*** 229,251 ****
--- 298,344 ----
gval = gval * 65535L / lmaxval;
bval = bval * 65535L / lmaxval;
}
+ #ifdef GNUDOS
+ putShort( ofp, (short)rval);
+ putShort( ofp, (short)gval);
+ putShort( ofp, (short)bval);
+ #else /* GNUDOS */
putShort(stdout, (short)rval);
putShort(stdout, (short)gval);
putShort(stdout, (short)bval);
+ #endif /* GNUDOS */
}
+ #ifdef GNUDOS
+ putRect( ofp, 0, 0, rows, cols); /* srcRect */
+ putRect( ofp, 0, 0, rows, cols); /* dstRect */
+ putShort( ofp, 0); /* mode */
+ #else /* GNUDOS */
putRect(stdout, 0, 0, rows, cols); /* srcRect */
putRect(stdout, 0, 0, rows, cols); /* dstRect */
putShort(stdout, 0); /* mode */
+ #endif /* GNUDOS */
/* Finally, write out the data. */
packed = (char*) malloc((unsigned)(cols+cols/MAX_COUNT+1));
oc = 0;
for (row = 0; row < rows; row++)
+ #ifdef GNUDOS
+ oc += putRow( ofp, row, cols, pixels[row], packed);
+ #else /* GNUDOS */
oc += putRow(stdout, row, cols, pixels[row], packed);
+ #endif /* GNUDOS */
/* if we wrote an odd number of pixdata bytes, pad */
if (oc & 1)
+ #ifdef GNUDOS
+ putc(0, ofp );
+ putShort( ofp, PICT_EndOfPicture);
+
+ lmaxval = ftell( ofp ) - HEADER_SIZE;
+ if (fseek( ofp, (long)HEADER_SIZE, 0) >= 0)
+ putShort( ofp, (short)(lmaxval & 0xffff));
+ #else /* GNUDOS */
putc(0, stdout);
putShort(stdout, PICT_EndOfPicture);
***************
*** 252,257 ****
--- 345,355 ----
lmaxval = ftell(stdout) - HEADER_SIZE;
if (fseek(stdout, (long)HEADER_SIZE, 0) >= 0)
putShort(stdout, (short)(lmaxval & 0xffff));
+ #endif /* GNUDOS */
+
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
exit(0);
}
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtops.c pbmplus.new/ppm/ppmtops.c
*** pbmplus.old/ppm/ppmtops.c Fri Apr 12 00:31:20 1991
--- pbmplus.new/ppm/ppmtops.c Sat Apr 20 10:20:34 1991
***************
*** 14,19 ****
--- 14,24 ----
static void putinit(), putitem(), putpix(), putgray(), putrest();
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 65,70 ****
--- 70,87 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[argc-1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".ps" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
ppm_readppminit( ifp, &cols, &rows, &maxval, &format );
pixrow = ppm_allocrow( cols );
***************
*** 99,104 ****
--- 116,125 ----
putrest( );
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
+
exit( 0 );
}
***************
*** 120,125 ****
--- 141,167 ----
if ( llx < 0.0 || lly < 0.0 )
pm_message( "warning, image too large for page", 0,0,0,0,0 );
+ #ifdef GNUDOS
+ fprintf( ofp, "%%!PS-Adobe-2.0 EPSF-2.0)\n" );
+ fprintf( ofp, "%%%%Creator: ppmtops\n" );
+ fprintf( ofp, "%%%%Title: %s.ps\n", name );
+ fprintf( ofp, "%%%%Pages: 1\n" );
+ fprintf( ofp,
+ "%%%%BoundingBox: %d %d %d %d\n",
+ (int) llx, (int) lly, (int) ( llx + scols ), (int) ( lly + srows ) );
+ fprintf( ofp, "%%%%EndComments\n" );
+ fprintf( ofp, "%%%%EndProlog\n" );
+ fprintf( ofp, "%%%%Page: 1 1\n" );
+ fprintf( ofp, "/picstr %d string def\n", HSBUFSIZ );
+ fprintf( ofp, "gsave\n" );
+ fprintf( ofp, "%g %g translate\n", llx, lly );
+ fprintf( ofp, "%g %g scale\n", scols, srows );
+ fprintf( ofp, "%d %d %d\n", cols, rows, bps );
+ fprintf( ofp, "[ %d 0 0 -%d 0 %d ]\n", cols, rows, rows );
+ fprintf( ofp, "{ currentfile picstr readhexstring pop }\n" );
+ fprintf( ofp, "false 3\n" );
+ fprintf( ofp, "colorimage\n" );
+ #else /* GNUDOS */
printf( "%%!PS-Adobe-2.0 EPSF-2.0)\n" );
printf( "%%%%Creator: ppmtops\n" );
printf( "%%%%Title: %s.ps\n", name );
***************
*** 139,144 ****
--- 181,187 ----
printf( "{ currentfile picstr readhexstring pop }\n" );
printf( "false 3\n" );
printf( "colorimage\n" );
+ #endif /* GNUDOS */
bitspersample = bps;
itemsperline = items = 0;
***************
*** 154,164 ****
--- 197,215 ----
if ( itemsperline == 30 )
{
+ #ifdef GNUDOS
+ fputc( '\n', ofp );
+ itemsperline = 0;
+ }
+ fputc( hexits[item >> 4], ofp );
+ fputc( hexits[item & 15], ofp );
+ #else /* GNUDOS */
putchar( '\n' );
itemsperline = 0;
}
putchar( hexits[item >> 4] );
putchar( hexits[item & 15] );
+ #endif /* GNUDOS */
itemsperline++;
items++;
item = 0;
***************
*** 193,200 ****
--- 244,258 ----
putitem( );
while ( items % HSBUFSIZ != 0 )
putitem( );
+ #ifdef GNUDOS
+ fprintf( ofp, "\n" );
+ fprintf( ofp, "grestore\n" );
+ fprintf( ofp, "showpage\n" );
+ fprintf( ofp, "%%%%Trailer\n" );
+ #else /* GNUDOS */
printf( "\n" );
printf( "grestore\n" );
printf( "showpage\n" );
printf( "%%%%Trailer\n" );
+ #endif /* GNUDOS */
}
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtopuz.c pbmplus.new/ppm/ppmtopuz.c
*** pbmplus.old/ppm/ppmtopuz.c Fri Apr 12 00:32:46 1991
--- pbmplus.new/ppm/ppmtopuz.c Sat Apr 20 10:08:18 1991
***************
*** 16,21 ****
--- 16,26 ----
#define MAXVAL 255
#define MAXCOLORS 256
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 39,44 ****
--- 44,62 ----
else
ifp = stdin;
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".puz" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
+
pixels = ppm_readppm( ifp, &cols, &rows, &maxval );
pm_close( ifp );
***************
*** 53,61 ****
pm_message( "%d colors found", colors, 0,0,0,0 );
/* Write puzzle header. */
(void) pm_writebiglong( stdout, cols );
(void) pm_writebiglong( stdout, rows );
! (void) putchar( (unsigned char) colors );
if ( maxval > MAXVAL )
pm_message(
"maxval is not %d - automatically rescaling colors", MAXVAL,
--- 71,86 ----
pm_message( "%d colors found", colors, 0,0,0,0 );
/* Write puzzle header. */
+ #ifdef GNUDOS
+ (void) pm_writebiglong( ofp, cols );
+ (void) pm_writebiglong( ofp, rows );
+ (void) fputc( (unsigned char) colors, ofp );
+ #else /* GNUDOS */
(void) pm_writebiglong( stdout, cols );
(void) pm_writebiglong( stdout, rows );
! (void) putchar( (unsigned char) colors );
! #endif /* GNUDOS */
!
if ( maxval > MAXVAL )
pm_message(
"maxval is not %d - automatically rescaling colors", MAXVAL,
***************
*** 67,75 ****
--- 92,106 ----
p = chv[i].color;
if ( maxval != MAXVAL )
PPM_DEPTH( p, p, maxval, MAXVAL );
+ #ifdef GNUDOS
+ (void) fputc( (unsigned char) PPM_GETR( p ), ofp );
+ (void) fputc( (unsigned char) PPM_GETG( p ), ofp );
+ (void) fputc( (unsigned char) PPM_GETB( p ), ofp );
+ #else /* GNUDOS */
(void) putchar( (unsigned char) PPM_GETR( p ) );
(void) putchar( (unsigned char) PPM_GETG( p ) );
(void) putchar( (unsigned char) PPM_GETB( p ) );
+ #endif /* GNUDOS */
}
/* Convert color vector to color hash table, for fast lookup. */
***************
*** 88,96 ****
--- 119,135 ----
pm_error(
"color not found?!? row=%d col=%d r=%d g=%d b=%d",
row, col, PPM_GETR(*pP), PPM_GETG(*pP), PPM_GETB(*pP) );
+ #ifdef GNUDOS
+ (void) fputc( (unsigned char) color, ofp );
+ #else /* GNUDOS */
(void) putchar( (unsigned char) color );
+ #endif /* GNUDOS */
}
}
+
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtorgb.c pbmplus.new/ppm/ppmtorgb.c
*** pbmplus.old/ppm/ppmtorgb.c Fri Apr 12 00:32:48 1991
--- pbmplus.new/ppm/ppmtorgb.c Sat Apr 20 10:23:04 1991
***************
*** 55,69 ****
--- 55,81 ----
pixelrow = ppm_allocrow( cols );
(void) strcpy( filename, basename );
(void) strcat( filename, ".red" );
+ #ifdef GNUDOS
+ redfile = pm_openwb( filename );
+ #else /* GNUDOS */
redfile = pm_openw( filename );
+ #endif /* GNUDOS */
pgm_writepgminit( redfile, cols, rows, (gray) maxval, 0 );
(void) strcpy( filename, basename );
(void) strcat( filename, ".grn" );
+ #ifdef GNUDOS
+ grnfile = pm_openwb( filename );
+ #else /* GNUDOS */
grnfile = pm_openw( filename );
+ #endif /* GNUDOS */
pgm_writepgminit( grnfile, cols, rows, (gray) maxval, 0 );
(void) strcpy( filename, basename );
(void) strcat( filename, ".blu" );
+ #ifdef GNUDOS
+ blufile = pm_openwb( filename );
+ #else /* GNUDOS */
blufile = pm_openw( filename );
+ #endif /* GNUDOS */
pgm_writepgminit( blufile, cols, rows, (gray) maxval, 0 );
grayrow = pgm_allocrow( cols );
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtouil.c pbmplus.new/ppm/ppmtouil.c
*** pbmplus.old/ppm/ppmtouil.c Fri Apr 12 00:32:46 1991
--- pbmplus.new/ppm/ppmtouil.c Sat Apr 20 10:26:10 1991
***************
*** 29,34 ****
--- 29,39 ----
char* rgbname; /* ascii rgb color, either mnemonic or #rgb value */
} cixel_map;
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char* argv[];
***************
*** 94,99 ****
--- 99,116 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".uil" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
/* Read in the ppm file. */
pixels = ppm_readppm( ifp, &cols, &rows, &maxval );
pm_close( ifp );
***************
*** 113,118 ****
--- 130,177 ----
gen_cmap( chv, ncolors, maxval, cmap, &charspp );
/* Write out the UIL header. */
+ #ifdef GNUDOS
+ fprintf( ofp, "module %s\n", out_name );
+ fprintf( ofp, "version = 'V1.0'\n" );
+ fprintf( ofp, "names = case_sensitive\n" );
+
+ /* Write out the ascii colormap. */
+ fprintf( ofp, "\n" );
+ fprintf( ofp, "value\n" );
+ fprintf( ofp, " %s_rgb : color_table (\n", out_name );
+ for ( i = 0; i < ncolors; ++i )
+ {
+ fprintf( ofp, " color( '%s' ) = '%s'", cmap[i].rgbname, cmap[i].cixel );
+ if ( i != ncolors - 1 )
+ fprintf( ofp, ",\n" );
+ else
+ fprintf( ofp, "\n" );
+ }
+ fprintf( ofp, " );\n" );
+
+ /* Write out the ascii character-pixel image. */
+ fprintf( ofp, "\n" );
+ fprintf( ofp,
+ "%s_icon : exported icon( color_table = %s_rgb,\n",
+ out_name, out_name );
+ for ( row = 0; row < rows; ++row )
+ {
+ fprintf( ofp, " '" );
+ for ( col = 0, pP = pixels[row]; col < cols; ++col, ++pP )
+ {
+ if ( ( col * charspp ) % 70 == 0 && col > 0 )
+ fprintf( ofp, "'&\n '" ); /* line continuation */
+ fprintf( ofp, "%s", cmap[ppm_lookupcolor(cht, pP)].cixel );
+ }
+ if ( row != rows - 1 )
+ fprintf( ofp, "',\n" );
+ else
+ fprintf( ofp, "'\n") ;
+ }
+ fprintf( ofp, ");\n" );
+ fprintf( ofp, "\n" );
+ fprintf( ofp, "end module;\n" );
+ #else /* GNUDOS */
printf( "module %s\n", out_name );
printf( "version = 'V1.0'\n" );
printf( "names = case_sensitive\n" );
***************
*** 153,158 ****
--- 212,222 ----
printf( ");\n" );
printf( "\n" );
printf( "end module;\n" );
+ #endif /* GNUDOS */
+
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ppmtoxpm.c pbmplus.new/ppm/ppmtoxpm.c
*** pbmplus.old/ppm/ppmtoxpm.c Fri Apr 12 00:31:24 1991
--- pbmplus.new/ppm/ppmtoxpm.c Sat Apr 20 10:26:40 1991
***************
*** 32,37 ****
--- 32,42 ----
char* rgbname; /* ascii rgb color, either mnemonic or #rgb value */
} cixel_map;
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char* argv[];
***************
*** 98,103 ****
--- 103,120 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[argc-1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".xbm" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
/* Read in the ppm file. */
pixels = ppm_readppm( ifp, &cols, &rows, &maxval );
pm_close( ifp );
***************
*** 117,122 ****
--- 134,172 ----
gen_cmap( chv, ncolors, maxval, cmap, &charspp );
/* Write out the XPM header. */
+ #ifdef GNUDOS
+ fprintf( ofp, "#define %s_format %d\n", out_name, 1 );
+ fprintf( ofp, "#define %s_width %d\n", out_name, cols );
+ fprintf( ofp, "#define %s_height %d\n", out_name, rows );
+ fprintf( ofp, "#define %s_ncolors %d\n", out_name, ncolors );
+ fprintf( ofp, "#define %s_chars_per_pixel %d\n", out_name, charspp );
+
+ /* Write out the ascii colormap. */
+ fprintf( ofp, "static char *%s_colors[] = {\n", out_name );
+ for ( i = 0; i < ncolors; ++i )
+ {
+ fprintf( ofp, " \"%s\", \"%s\"", cmap[i].cixel, cmap[i].rgbname );
+ if ( i != ncolors - 1 )
+ fprintf( ofp, ",\n" );
+ else
+ fprintf( ofp, "\n" );
+ }
+ fprintf( ofp, "};\n" );
+
+ /* Write out the ascii character-pixel image. */
+ fprintf( ofp, "static char *%s_pixels[] = {\n", out_name );
+ for ( row = 0; row < rows; ++row )
+ {
+ fprintf( ofp, "\"" );
+ for ( col = 0, pP = pixels[row]; col < cols; ++col, ++pP )
+ fprintf( ofp, "%s", cmap[ppm_lookupcolor(cht, pP)].cixel );
+ if ( row != rows - 1 )
+ fprintf( ofp, "\",\n" );
+ else
+ fprintf( ofp, "\"\n" );
+ }
+ fprintf( ofp, "};\n" );
+ #else /* GNUDOS */
printf( "#define %s_format %d\n", out_name, 1 );
printf( "#define %s_width %d\n", out_name, cols );
printf( "#define %s_height %d\n", out_name, rows );
***************
*** 148,153 ****
--- 198,208 ----
printf( "\"\n" );
}
printf( "};\n" );
+ #endif /* GNUDOS */
+
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/ppm/qrttoppm.c pbmplus.new/ppm/qrttoppm.c
*** pbmplus.old/ppm/qrttoppm.c Fri Apr 12 00:31:20 1991
--- pbmplus.new/ppm/qrttoppm.c Sat Apr 20 00:22:20 1991
***************
*** 28,34 ****
--- 28,38 ----
pm_usage( "[qrtfile]" );
if ( argc == 2 )
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[1] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/ppm/rawtoppm.c pbmplus.new/ppm/rawtoppm.c
*** pbmplus.old/ppm/rawtoppm.c Fri Apr 12 00:32:48 1991
--- pbmplus.new/ppm/rawtoppm.c Sat Apr 20 00:21:54 1991
***************
*** 98,104 ****
--- 98,108 ----
if ( argn < argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
++argn;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/ppm/spctoppm.c pbmplus.new/ppm/spctoppm.c
*** pbmplus.old/ppm/spctoppm.c Fri Apr 12 00:32:48 1991
--- pbmplus.new/ppm/spctoppm.c Sat Apr 20 00:21:08 1991
***************
*** 42,48 ****
--- 42,52 ----
pm_usage( "[spcfile]" );
if ( argc == 2 )
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[1] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/ppm/sputoppm.c pbmplus.new/ppm/sputoppm.c
*** pbmplus.old/ppm/sputoppm.c Fri Apr 12 00:32:48 1991
--- pbmplus.new/ppm/sputoppm.c Sat Apr 20 00:20:42 1991
***************
*** 34,40 ****
--- 34,44 ----
pm_usage( "[spufile]" );
if ( argc == 2 )
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[1] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/ppm/tgatoppm.c pbmplus.new/ppm/tgatoppm.c
*** pbmplus.old/ppm/tgatoppm.c Fri Apr 12 00:31:22 1991
--- pbmplus.new/ppm/tgatoppm.c Sat Apr 20 00:20:22 1991
***************
*** 53,59 ****
--- 53,63 ----
if ( argn != argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
++argn;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/ppm/ximtoppm.c pbmplus.new/ppm/ximtoppm.c
*** pbmplus.old/ppm/ximtoppm.c Fri Apr 12 00:31:24 1991
--- pbmplus.new/ppm/ximtoppm.c Sat Apr 20 00:19:56 1991
***************
*** 31,37 ****
--- 31,41 ----
if ( argn < argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
++argn;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/ppm/xpmtoppm.c pbmplus.new/ppm/xpmtoppm.c
*** pbmplus.old/ppm/xpmtoppm.c Fri Apr 12 00:32:46 1991
--- pbmplus.new/ppm/xpmtoppm.c Sat Apr 20 00:19:30 1991
***************
*** 33,39 ****
--- 33,43 ----
pm_usage( "[xpmfile]" );
if ( argc == 2 )
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[1] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/readme.dos pbmplus.new/readme.dos
*** pbmplus.old/readme.dos
--- pbmplus.new/readme.dos Sun Apr 28 12:24:24 1991
***************
*** 0 ****
--- 1,108 ----
+ This is my first release of my port of the pbmplus package to DOS.
+ It was done using DJ Delorie's DOS port of GCC. You REQUIRE a 386 or
+ better machine. 387 optional for parts, and those parts should tell you
+ when you don't have one. See the GCC package for more details. Also,
+ lots of ram and disk space help. See below for more information.
+
+ The gcc package can be obtained from: grape.ecs.clarkson.edu
+ (I believe it can also be found on garbo.uwase.fi, and probably others.
+ Check archie).
+
+ The PBMPlus package can be obtained from ..... damn... have to go look
+ that up.
+
+ I believe this package works for the most part.
+
+ Parts I know don't work:
+ GIFTOPPM -- this may be a flaw in GCC malloc, I don't know.
+ PBMTOGEM -- this is a little-endian/big-endian problem *sigh*
+ at least GEMTOPBM works....
+ PNMGAMMA -- all 0's get mapped to 256, even with correction of 1.0. Go
+ figure. Fix, make an appropriate file of all 1's and run
+ through PNMARITH (well, I think this will work).
+
+ None of the TIFF stuff. Can't get the damn library to link in. I think
+ this is just pilot error on my part with using 'ld'
+
+ This is the first real project I've worked on in C, and I'm pretty much
+ clueless. :-> It doesn't take a genius to go through and change printf
+ to fprintf(ofp , just someone with nothing better to do, and an editor
+ that supports macros well.
+
+ If anyone finds any other problems, please get in touch with me. I
+ won't have net access over the summer (I'm looking into it, but no luck
+ yet, and I can't afford lond-distance phone calls on a regular basis).
+ If you find a problem, I would be interested in a copy of the input file
+ in the original format, and one in GIF, TARGA, RAW, or any format that
+ CSHOW can handle. I would also like copies of any other patches you may
+ develop.
+
+ You can either send me disks (with self-addressed stamped envelope to
+ mail them back with, hopefully with fixes :-), or send me mail, and I'll
+ send disks with an SASE to you.
+
+ My address is:
+ Mike Castle
+ R 2 Bx 69
+ Troy, MO 63379
+ USA
+
+
+ EXEs: If you are reading this from the distribution through
+ comp.binaries.ibm.pc, then most likely you have all (or most) of the
+ .exe files. The file GO32.EXE _MUST_ be in you path. This is the DJ's
+ DOS extender, and is needed to get the other programs to work. I used
+ just the stub that calls the extender rather than the actual extender
+ when I created the actuall exe files in order to save space. The entire
+ package would have been about twice the size had I built them with the
+ extender. If you want to change that, get the original PBMPlus source,
+ apply my patches, and then rebuild (see PATCHes: below).
+
+ PATCHes: As will be posted to alt.sources, my patches include several
+ utility batch files to (hopefully) aid making them. They are:
+ MAKEALL.BAT This assumes using GNUMAKE (available on Simtel20, et al)
+ MAKEEXE.BAT This builds the actuall executables from the 32-bit
+ code produced by GCC. Edit it to fit your system,
+ and desires.
+ DELP?M.BAT These exist in each directory, and just deletes all
+ of the a.out files from GCC. Useful for cleaning up.
+ EXEP?M.BAT Also in each directory. Called by MAKEEXE.BAT, they
+ perform the actuall 'copy /b stub.exe+xxxxx xxxxx.eexe'
+
+ The makefile.pc in each of pbm, pgm, ppm, and pnm directories might work
+ with other make's. I don't know. But it should still provide a good
+ indication of how to procede.
+
+ If you have unix-like utilities for DOS (rm, mv, etc), you can probably
+ use the original makefiles. Just watch out for long command lines in
+ the pnm makefile.
+
+ These patches *should* allow compilation on a unix machine resulting in
+ identical executables to the official PBMPlus package (well, in theory,
+ it should).
+
+ CAVEATs: This package is SLOW. This is due to the fact that when you do
+ redirection through DOS (ala tgatoppm my.tga | ppmquant 256 | ppmtogif),
+ DOS has to create tempory output/input files for redirection purposes.
+ Hazards of a single-tasking OS. To determine the amount of diskspace
+ you need, do this:
+ disk_space = height * width * 12
+
+ for 1 redirection ( pcxtoppm my.pcx | ppmtogif ).
+
+ Multiply by 2 for more than 1 redirection.
+
+ DEVIATIONS: Since DOS doens't like certain characters to go through
+ stdin/stdout, I changed all p?mto???.exe's to produce an output file
+ instead of using redirection as you would on a unix system. If used
+ directly, like 'ppmtogif my.ppm' the output file will be my.gif. If
+ used with redirection, the outfile will be noname.gif. The extensions
+ were chosen, for the most part, from the last three letters of the
+ p?mtoxxx utility. Some were changed, some should probably be changed.
+
+ Sorry for the rambling nature of this doc, just writing things down as I
+ think of them.
+
+ Enjoy the package, bugs and all.
+
+ Mike Castle