--- ray/src/px/psign.c 2003/06/08 12:03:10 2.20 +++ ray/src/px/psign.c 2011/05/20 02:06:39 2.27 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: psign.c,v 2.20 2003/06/08 12:03:10 schorsch Exp $"; +static const char RCSid[] = "$Id: psign.c,v 2.27 2011/05/20 02:06:39 greg Exp $"; #endif /* * psign.c - produce picture from text. @@ -7,8 +7,13 @@ static const char RCSid[] = "$Id: psign.c,v 2.20 2003/ * 7/1/87 */ -#include "standard.h" +#include "copyright.h" + +#include + #include "platform.h" +#include "standard.h" +#include "resolu.h" #include "color.h" #include "font.h" @@ -34,6 +39,12 @@ unsigned char *ourbitmap; /* our output bitmap */ int xsiz, ysiz; /* bitmap dimensions */ int xdim; /* size of horizontal scan (bytes) */ + /* conflicting def's in param.h */ +#undef tstbit +#undef setbit +#undef clrbit +#undef tglbit + #define bitop(x,y,op) (ourbitmap[(y)*xdim+((x)>>3)] op (1<<((x)&7))) #define tstbit(x,y) bitop(x,y,&) #define setbit(x,y) bitop(x,y,|=) @@ -52,10 +63,21 @@ LINE *ourtext; /* our text */ int nlines, maxline; /* text dimensions */ int maxwidth; /* maximum line width (dvi) */ +static void makemap(void); +static void get_text(FILE *fp); +static void arg_text(int ac, char *av[]); +static void maptext(void); +static void mapglyph(GLYPH *gl, int tx0, int ty0); +static void mapcoord(int p[2], int tx, int ty); +static void mapedge(int x, int y, int run, int rise); +static void writemap(FILE *fp); -main(argc, argv) -int argc; -char *argv[]; + +int +main( + int argc, + char *argv[] +) { int an; SET_FILE_BINARY(stdout); @@ -119,7 +141,7 @@ unkopt: ourfont = getfont(fontfile); /* get text */ if (an == argc) - gettext(stdin); + get_text(stdin); else arg_text(argc-an, argv+an); @@ -139,7 +161,8 @@ unkopt: } -makemap() /* create the bit map */ +static void +makemap(void) /* create the bit map */ { double pictaspect; @@ -195,15 +218,17 @@ makemap() /* create the bit map */ if (ysiz % SSS) ysiz += SSS - ysiz%SSS; xdim = (xsiz+7)/8; - ourbitmap = (BYTE *)bmalloc(ysiz*xdim); + ourbitmap = (uby8 *)bmalloc(ysiz*xdim); if (ourbitmap == NULL) error(SYSTEM, "Out of memory in makemap"); - bzero((char *)ourbitmap, ysiz*xdim); + memset((char *)ourbitmap, '\0', ysiz*xdim); } -gettext(fp) /* get text from a file */ -FILE *fp; +static void +get_text( /* get text from a file */ + FILE *fp +) { char buf[MAXLINE]; register LINE *curl; @@ -219,7 +244,7 @@ FILE *fp; len = strlen(buf); curl->s = (char *)malloc(len); curl->sp = (short *)malloc(sizeof(short)*len--); - if (curl->s == NULL | curl->sp == NULL) + if ((curl->s == NULL) | (curl->sp == NULL)) goto memerr; if (len > maxline) maxline = len; @@ -241,13 +266,15 @@ FILE *fp; } return; memerr: - error(SYSTEM, "Out of memory in gettext"); + error(SYSTEM, "Out of memory in get_text"); } -arg_text(ac, av) /* get text from arguments */ -int ac; -char *av[]; +static void +arg_text( /* get text from arguments */ + int ac, + char *av[] +) { register char *cp; @@ -283,7 +310,8 @@ memerr: } -maptext() /* map our text */ +static void +maptext(void) /* map our text */ { register LINE *curl; int l, len; @@ -299,9 +327,12 @@ maptext() /* map our text */ } -mapglyph(gl, tx0, ty0) /* convert a glyph */ -GLYPH *gl; -int tx0, ty0; +static void +mapglyph( /* convert a glyph */ + GLYPH *gl, + int tx0, + int ty0 +) { int n; register GORD *gp; @@ -322,8 +353,12 @@ int tx0, ty0; } -mapcoord(p, tx, ty) /* map text to picture coordinates */ -int p[2], tx, ty; +static void +mapcoord( /* map text to picture coordinates */ + int p[2], + int tx, + int ty +) { tx = (long)tx*cwidth >> 8; ty = (long)ty*cheight >> 8; @@ -349,9 +384,13 @@ int p[2], tx, ty; } -mapedge(x, y, run, rise) /* map an edge */ -register int x, y; -int run, rise; +static void +mapedge( /* map an edge */ + register int x, + register int y, + int run, + int rise +) { int xstep; int rise2, run2; @@ -386,8 +425,10 @@ int run, rise; } -writemap(fp) /* write out bitmap */ -FILE *fp; +static void +writemap( /* write out bitmap */ + FILE *fp +) { COLR pixval[SSS*SSS+1]; /* possible pixel values */ COLOR ctmp0, ctmp1;