--- ray/src/meta/meta2tga.c 2003/08/01 14:14:24 1.2 +++ ray/src/meta/meta2tga.c 2004/02/04 18:49:24 1.6 @@ -1,33 +1,24 @@ #ifndef lint -static const char RCSid[] = "$Id: meta2tga.c,v 1.2 2003/08/01 14:14:24 schorsch Exp $"; +static const char RCSid[] = "$Id: meta2tga.c,v 1.6 2004/02/04 18:49:24 greg Exp $"; #endif /* * Program to convert meta-files to Targa 8-bit color-mapped format */ +#include "copyright.h" -#define MAXALLOC 5000 - -#define DXSIZE 400 /* default x resolution */ - -#define DYSIZE 400 /* default y resolution */ - -#define XCOM "pexpand +vOCImsp -DP %s | psort +y" - - - - +#include "rtprocess.h" #include "meta.h" - #include "plot.h" - #include "rast.h" - #include "targa.h" +#define MAXALLOC 30000 +#define DXSIZE 400 /* default x resolution */ +#define DYSIZE 400 /* default y resolution */ +#define XCOM "pexpand +vOCImsp -DP %s | psort +y" - char *progname; SCANBLOCK outblock; @@ -48,6 +39,10 @@ static int lineno = 0; static short condonly = FALSE, conditioned = FALSE; +static int putthead(struct hdStruct *hp, char *ip, FILE *fp); + + + char * findtack(s) /* find place to tack on suffix */ register char *s; @@ -58,14 +53,14 @@ register char *s; } -main(argc, argv) +int +main( + int argc, + char **argv +) -int argc; -char **argv; - { FILE *fp; - FILE *popen(); char comargs[200], command[300]; fout = stdout; @@ -147,22 +142,24 @@ char **argv; - - - -thispage() /* rewind current file */ +void +thispage(void) /* rewind current file */ { if (lineno) error(USER, "cannot restart page in thispage"); } - -initfile() /* initialize this file */ +void +initfile(void) /* initialize this file */ { static int filenum = 0; + /* static unsigned char cmap[24] = {255,255,255, 255,152,0, 0,188,0, 0,0,255, 179,179,0, 255,0,255, 0,200,200, 0,0,0}; + */ + static unsigned char cmap[24] = {0,0,0, 0,0,255, 0,188,0, 255,152,0, + 0,200,200, 255,0,255, 179,179,0, 255,255,255}; struct hdStruct thead; register int i; @@ -192,9 +189,9 @@ initfile() /* initialize this file */ +void +nextpage(void) /* advance to next page */ -nextpage() /* advance to next page */ - { if (lineno == 0) @@ -215,13 +212,13 @@ nextpage() /* advance to next page */ #define MINRUN 4 +extern void +printblock(void) /* output scanline block to file */ -printblock() /* output scanline block to file */ - { int i, c2; register unsigned char *scanline; - register int j, beg, cnt; + register int j, beg, cnt = 0; if (lineno == 0) initfile(); @@ -253,19 +250,23 @@ printblock() /* output scanline block to file */ } -putint2(i, fp) /* put a 2-byte positive integer */ -register int i; -register FILE *fp; +void +putint2( /* put a 2-byte positive integer */ + register int i, + register FILE *fp +) { putc(i&0xff, fp); putc(i>>8&0xff, fp); } -putthead(hp, ip, fp) /* write header to output */ -struct hdStruct *hp; -char *ip; -register FILE *fp; +int +putthead( /* write header to output */ + struct hdStruct *hp, + char *ip, + register FILE *fp +) { if (ip != NULL) putc(strlen(ip), fp);