diff options
author | Karl Berry <karl@freefriends.org> | 2010-03-28 18:14:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-03-28 18:14:06 +0000 |
commit | 20a73306c88f8fdb131482213e9b1b6a8c5e729b (patch) | |
tree | be5857d40602520beebe30c48e31306bbc0e9d17 /Build/source/texk/dvipsk/loadfont.c | |
parent | 549a764cf19a1f244d773ab70965eadeef67d5a8 (diff) |
eliminate spaces before semicolons
git-svn-id: svn://tug.org/texlive/trunk@17592 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipsk/loadfont.c')
-rw-r--r-- | Build/source/texk/dvipsk/loadfont.c | 364 |
1 files changed, 182 insertions, 182 deletions
diff --git a/Build/source/texk/dvipsk/loadfont.c b/Build/source/texk/dvipsk/loadfont.c index 31e8e60a150..6c324852f74 100644 --- a/Build/source/texk/dvipsk/loadfont.c +++ b/Build/source/texk/dvipsk/loadfont.c @@ -28,13 +28,13 @@ #include "protos_add.h" char errbuf[1000]; -int lastresortsizes[40] ; +int lastresortsizes[40]; /* * Now we have some routines to get stuff from the PK file. * Subroutine pkbyte returns the next byte. */ -FILE *pkfile ; -char name[MAXPATHLEN] ; +FILE *pkfile; +char name[MAXPATHLEN]; void badpk(const char *s) { @@ -45,36 +45,36 @@ badpk(const char *s) shalfword pkbyte(void) { - register shalfword i ; + register shalfword i; if ((i=getc(pkfile))==EOF) - badpk("unexpected eof") ; - return(i) ; + badpk("unexpected eof"); + return(i); } integer pkquad(void) { - register integer i ; + register integer i; - i = pkbyte() ; + i = pkbyte(); if (i > 127) - i -= 256 ; - i = i * 256 + pkbyte() ; - i = i * 256 + pkbyte() ; - i = i * 256 + pkbyte() ; - return(i) ; + i -= 256; + i = i * 256 + pkbyte(); + i = i * 256 + pkbyte(); + i = i * 256 + pkbyte(); + return(i); } integer pktrio(void) { - register integer i ; + register integer i; - i = pkbyte() ; - i = i * 256 + pkbyte() ; - i = i * 256 + pkbyte() ; - return(i) ; + i = pkbyte(); + i = i * 256 + pkbyte(); + i = i * 256 + pkbyte(); + return(i); } @@ -85,45 +85,45 @@ pktrio(void) #ifdef VMCMS /* IBM: VM/CMS - we let DVIPS EXEC handle this after the DVIPS MODULE has finished to avoid complications with system calls. */ -int dontmakefont = 0 ; +int dontmakefont = 0; #else #ifdef MVSXA /* IBM: MVS/XA - we let system administrator handle this on MVS/XA since some printers can't get to user fonts anyway */ -int dontmakefont = 1 ; +int dontmakefont = 1; #else -int dontmakefont = 0 ; /* if makefont fails once we won't try again */ +int dontmakefont = 0; /* if makefont fails once we won't try again */ #endif /* IBM: VM/CMS */ #endif void lectureuser(void) { - static int userwarned = 0 ; + static int userwarned = 0; if (! userwarned) { - error("Such scaling will generate extremely poor output.") ; - userwarned = 1 ; + error("Such scaling will generate extremely poor output."); + userwarned = 1; } } Boolean pkopen(register fontdesctype *fd) { - register char *d, *n ; - char *name_ret ; + register char *d, *n; + char *name_ret; #ifdef KPATHSEA - int dpi_ret ; + int dpi_ret; #else - int vdpi ; + int vdpi; #endif - d = fd->area ; - n = fd->name ; + d = fd->area; + n = fd->name; #ifndef KPATHSEA if (*d==0) - d = pkpath ; + d = pkpath; #endif #ifdef FONTLIB if (*(fd->area) == 0) { - int del ; + int del; for (del=0; del<=RES_TOLERANCE(fd->dpi); del=del>0?-del:-del+1) { if ((pkfile=flisearch(n, fd->dpi + del)) != (FILE *)NULL ) return(1); @@ -148,13 +148,13 @@ pkopen(register fontdesctype *fd) } else if (!kpse_bitmap_tolerance ((double) dpi_ret, (double) fd->dpi)) { - fd->loadeddpi = dpi_ret ; - fd->alreadyscaled = 0 ; + fd->loadeddpi = dpi_ret; + fd->alreadyscaled = 0; (void)sprintf(errbuf, "Font %s at %d not found; scaling %d instead.", - n, fd->dpi, dpi_ret) ; - error(errbuf) ; - lectureuser() ; + n, fd->dpi, dpi_ret); + error(errbuf); + lectureuser(); } if (this_name != name_ret) @@ -163,39 +163,39 @@ pkopen(register fontdesctype *fd) return pkfile != NULL; } #else - int del ; + int del; for (del=0; del<=RES_TOLERANCE(fd->dpi); del=del>0?-del:-del+1) { if (actualdpi == vactualdpi) { - vdpi = 0 ; + vdpi = 0; } else { vdpi = (2 * ((long)vactualdpi) * (fd->dpi + del) + actualdpi) - / (2 * actualdpi) ; + / (2 * actualdpi); } #ifdef MVSXA - (void)sprintf(name, "pk%d(%s)", fd->dpi + del, n) ; + (void)sprintf(name, "pk%d(%s)", fd->dpi + del, n); #else - (void)sprintf(name, "%s.%dpk", n, fd->dpi + del) ; + (void)sprintf(name, "%s.%dpk", n, fd->dpi + del); #endif if (0 != (pkfile=pksearch(d, name, READBIN, n, fd->dpi + del, vdpi))) - return(1) ; + return(1); } } if (d == pkpath) { if (actualdpi == vactualdpi) { - vdpi = 0 ; + vdpi = 0; } else { vdpi = (2 * ((long)vactualdpi) * fd->dpi + actualdpi) - / (2 * actualdpi) ; + / (2 * actualdpi); } #ifdef MVSXA - (void)sprintf(name, "pk%d(%s)", fd->dpi, n) ; + (void)sprintf(name, "pk%d(%s)", fd->dpi, n); #else - (void)sprintf(name, "%s.%dpk", n, fd->dpi) ; + (void)sprintf(name, "%s.%dpk", n, fd->dpi); #endif - makefont(n, (int)fd->dpi, DPI) ; + makefont(n, (int)fd->dpi, DPI); if (dontmakefont == 0 && (pkfile = pksearch(d, name, READBIN, n, fd->dpi, vdpi))) - return(1) ; + return(1); #ifndef MSDOS #ifdef OS2 if (_osmode == OS2_MODE) @@ -203,7 +203,7 @@ pkopen(register fontdesctype *fd) but do try for MSDOS */ #else #ifndef ATARIST - dontmakefont = 1 ; + dontmakefont = 1; #endif #endif #endif @@ -218,21 +218,21 @@ pkopen(register fontdesctype *fd) * and then work down. */ { - int i, j ; + int i, j; if (lastresortsizes[0] && fd->dpi < 30000) { - for (i=0; lastresortsizes[i] < fd->dpi; i++) ; + for (i=0; lastresortsizes[i] < fd->dpi; i++); for (j = i-1; j >= 0; j--) { if (actualdpi == vactualdpi) { - vdpi = 0 ; + vdpi = 0; } else { vdpi = (2 * ((long)vactualdpi) * lastresortsizes[j] + actualdpi) - / (2 * actualdpi) ; + / (2 * actualdpi); } #ifdef MVSXA - (void)sprintf(name, "pk%d(%s)", lastresortsizes[j], n) ; + (void)sprintf(name, "pk%d(%s)", lastresortsizes[j], n); #else - (void)sprintf(name, "%s.%dpk", n, lastresortsizes[j]) ; + (void)sprintf(name, "%s.%dpk", n, lastresortsizes[j]); #endif #ifdef FONTLIB if (0 != (pkfile=flisearch(n,(halfword)lastresortsizes[j])) @@ -242,24 +242,24 @@ pkopen(register fontdesctype *fd) if (0 != (pkfile=pksearch(d, name, READBIN, n, (halfword)lastresortsizes[j], vdpi))) { #endif - fd->loadeddpi = lastresortsizes[j] ; - fd->alreadyscaled = 0 ; + fd->loadeddpi = lastresortsizes[j]; + fd->alreadyscaled = 0; (void)sprintf(errbuf, "Font %s at %d dpi not found; scaling %d instead.", - n, fd->dpi, lastresortsizes[j]) ; - error(errbuf) ; - lectureuser() ; - return 1 ; + n, fd->dpi, lastresortsizes[j]); + error(errbuf); + lectureuser(); + return 1; } } for (j = i; lastresortsizes[j] < 30000; j++) { if (actualdpi == vactualdpi) { - vdpi = 0 ; + vdpi = 0; } else { vdpi = (2 * ((long)vactualdpi) * lastresortsizes[j] + actualdpi) - / (2 * actualdpi) ; + / (2 * actualdpi); } - (void)sprintf(name, "%s.%dpk", n, lastresortsizes[j]) ; + (void)sprintf(name, "%s.%dpk", n, lastresortsizes[j]); #ifdef FONTLIB if (0 != (pkfile=flisearch(n, (halfword)lastresortsizes[j])) || 0 != (pkfile=pksearch(d, name, READBIN, n, @@ -268,28 +268,28 @@ pkopen(register fontdesctype *fd) if (0 != (pkfile=pksearch(d, name, READBIN, n, (halfword)lastresortsizes[j], vdpi))) { #endif - fd->loadeddpi = lastresortsizes[j] ; - fd->alreadyscaled = 0 ; + fd->loadeddpi = lastresortsizes[j]; + fd->alreadyscaled = 0; (void)sprintf(errbuf, "Font %s at %d dpi not found; scaling %d instead.", - name, fd->dpi, lastresortsizes[j]) ; - error(errbuf) ; - lectureuser() ; - return 1 ; + name, fd->dpi, lastresortsizes[j]); + error(errbuf); + lectureuser(); + return 1; } } } } #ifdef MVSXA - (void)sprintf(name, "%s.pk%d", n, fd->dpi) ; + (void)sprintf(name, "%s.pk%d", n, fd->dpi); #else - (void)sprintf(name, "%s.%dpk", n, fd->dpi) ; + (void)sprintf(name, "%s.%dpk", n, fd->dpi); #endif (void)sprintf(errbuf, "Font %s%s not found, characters will be left blank.", - fd->area, name) ; - error(errbuf) ; - return(0) ; + fd->area, name); + error(errbuf); + return(0); #endif /* KPATHSEA */ } @@ -302,76 +302,76 @@ pkopen(register fontdesctype *fd) void loadfont(register fontdesctype *curfnt) { - register integer i ; - register shalfword cmd ; - register integer k ; - register integer length = 0 ; - register shalfword cc = 0 ; - register integer scaledsize = curfnt->scaledsize ; - register quarterword *tempr ; - register chardesctype *cd = 0 ; - int maxcc = 0 ; - int munged = 0 ; + register integer i; + register shalfword cmd; + register integer k; + register integer length = 0; + register shalfword cc = 0; + register integer scaledsize = curfnt->scaledsize; + register quarterword *tempr; + register chardesctype *cd = 0; + int maxcc = 0; + int munged = 0; /* * We clear out some pointers: */ if (curfnt->loaded == 3) { for (i=0; i<256; i++) { - curfnt->chardesc[i].TFMwidth = 0 ; - curfnt->chardesc[i].packptr = NULL ; - curfnt->chardesc[i].pixelwidth = 0 ; - curfnt->chardesc[i].flags &= EXISTS ; - curfnt->chardesc[i].flags2 = 0 ; + curfnt->chardesc[i].TFMwidth = 0; + curfnt->chardesc[i].packptr = NULL; + curfnt->chardesc[i].pixelwidth = 0; + curfnt->chardesc[i].flags &= EXISTS; + curfnt->chardesc[i].flags2 = 0; } } else { for (i=0; i<256; i++) { - curfnt->chardesc[i].TFMwidth = 0 ; - curfnt->chardesc[i].packptr = NULL ; - curfnt->chardesc[i].pixelwidth = 0 ; - curfnt->chardesc[i].flags = 0 ; - curfnt->chardesc[i].flags2 = 0 ; + curfnt->chardesc[i].TFMwidth = 0; + curfnt->chardesc[i].packptr = NULL; + curfnt->chardesc[i].pixelwidth = 0; + curfnt->chardesc[i].flags = 0; + curfnt->chardesc[i].flags2 = 0; } } - curfnt->maxchars = 256 ; /* just in case we return before the end */ + curfnt->maxchars = 256; /* just in case we return before the end */ if (!pkopen(curfnt)) { - tfmload(curfnt) ; - return ; + tfmload(curfnt); + return; } if (!quiet) { if (strlen(realnameoffile) + prettycolumn > STDOUTSIZE) { - fprintf(stderr, "\n") ; - prettycolumn = 0 ; + fprintf(stderr, "\n"); + prettycolumn = 0; } (void)fprintf(stderr, "<%s>", realnameoffile); - prettycolumn += strlen(realnameoffile) + 2 ; + prettycolumn += strlen(realnameoffile) + 2; } #ifdef DEBUG if (dd(D_FONTS)) (void)fprintf(stderr,"Loading pk font %s at %.1fpt\n", - curfnt->name, (real)scaledsize/(alpha*0x100000)) ; + curfnt->name, (real)scaledsize/(alpha*0x100000)); #endif /* DEBUG */ if (pkbyte()!=247) - badpk("expected pre") ; + badpk("expected pre"); if (pkbyte()!=89) - badpk("wrong id byte") ; + badpk("wrong id byte"); for(i=pkbyte(); i>0; i--) - (void)pkbyte() ; - k = (integer)(alpha * (real)pkquad()) ; + (void)pkbyte(); + k = (integer)(alpha * (real)pkquad()); if (k > curfnt->designsize + fsizetol || k < curfnt->designsize - fsizetol) { char *msg = concat ("Design size mismatch in font ", curfnt->name); error (msg); free (msg); } - k = pkquad() ; + k = pkquad(); if (k && curfnt->checksum) if (k!=curfnt->checksum) { char *msg = concat ("Checksum mismatch in font ", curfnt->name); error (msg); free (msg); } - k = pkquad() ; /* assume that hppp is correct in the PK file */ - k = pkquad() ; /* assume that vppp is correct in the PK file */ + k = pkquad(); /* assume that hppp is correct in the PK file */ + k = pkquad(); /* assume that vppp is correct in the PK file */ /* * Now we get down to the serious business of reading character definitions. */ @@ -379,135 +379,135 @@ loadfont(register fontdesctype *curfnt) if (cmd < 240) { switch (cmd & 7) { case 0: case 1: case 2: case 3: - length = (cmd & 7) * 256 + pkbyte() - 3 ; - cc = pkbyte() ; - cd = curfnt->chardesc+cc ; + length = (cmd & 7) * 256 + pkbyte() - 3; + cc = pkbyte(); + cd = curfnt->chardesc+cc; if (nosmallchars || curfnt->dpi != curfnt->loadeddpi) - cd->flags |= BIGCHAR ; - cd->TFMwidth = scalewidth(pktrio(), scaledsize) ; - cd->pixelwidth = pkbyte() ; - break ; + cd->flags |= BIGCHAR; + cd->TFMwidth = scalewidth(pktrio(), scaledsize); + cd->pixelwidth = pkbyte(); + break; case 4: case 5: case 6: - length = (cmd & 3) * 65536L + pkbyte() * 256L ; - length = length + pkbyte() - 4L ; - cc = pkbyte() ; - cd = curfnt->chardesc+cc ; - cd->TFMwidth = scalewidth(pktrio(), scaledsize) ; - cd->flags |= BIGCHAR ; - i = pkbyte() ; - cd->pixelwidth = i * 256 + pkbyte() ; - break ; + length = (cmd & 3) * 65536L + pkbyte() * 256L; + length = length + pkbyte() - 4L; + cc = pkbyte(); + cd = curfnt->chardesc+cc; + cd->TFMwidth = scalewidth(pktrio(), scaledsize); + cd->flags |= BIGCHAR; + i = pkbyte(); + cd->pixelwidth = i * 256 + pkbyte(); + break; case 7: - length = pkquad() - 11 ; - cc = pkquad() ; - if (cc<0 || cc>255) badpk("character code out of range") ; - cd = curfnt->chardesc + cc ; - cd->flags |= BIGCHAR ; - cd->TFMwidth = scalewidth(pkquad(), scaledsize) ; - cd->pixelwidth = (pkquad() + 32768) >> 16 ; - k = pkquad() ; + length = pkquad() - 11; + cc = pkquad(); + if (cc<0 || cc>255) badpk("character code out of range"); + cd = curfnt->chardesc + cc; + cd->flags |= BIGCHAR; + cd->TFMwidth = scalewidth(pkquad(), scaledsize); + cd->pixelwidth = (pkquad() + 32768) >> 16; + k = pkquad(); } if (cd->pixelwidth == 0 && cd->TFMwidth != 0) { if (cd->TFMwidth > 0) - k = (integer)(cd->TFMwidth * conv + 0.5) ; + k = (integer)(cd->TFMwidth * conv + 0.5); else - k = -(integer)(-cd->TFMwidth * conv + 0.5) ; + k = -(integer)(-cd->TFMwidth * conv + 0.5); if (k != 0) { - cd->pixelwidth = k ; - munged++ ; + cd->pixelwidth = k; + munged++; } } if (length <= 0) - badpk("packet length too small") ; + badpk("packet length too small"); if (dopprescan && ((cd->flags & EXISTS) == 0)) { for (length--; length>0; length--) - (void)pkbyte() ; + (void)pkbyte(); } else { if (cc > maxcc) - maxcc = cc ; + maxcc = cc; if (bytesleft < length || (length > MINCHUNK && compressed)) { #ifdef DEBUG if (dd(D_MEM)) (void)fprintf(stderr, #ifdef SHORTINT "Allocating new raster memory (%ld req, %ld left)\n", - length, bytesleft) ; + length, bytesleft); #else "Allocating new raster memory (%d req, %d left)\n", - (int)length, (int)bytesleft) ; + (int)length, (int)bytesleft); #endif #endif /* DEBUG */ if (length > MINCHUNK) { - tempr = (quarterword *)mymalloc((integer)length) ; + tempr = (quarterword *)mymalloc((integer)length); } else { - raster = (quarterword *)mymalloc((integer)RASTERCHUNK) ; - tempr = raster ; - bytesleft = RASTERCHUNK - length ; - raster += length ; + raster = (quarterword *)mymalloc((integer)RASTERCHUNK); + tempr = raster; + bytesleft = RASTERCHUNK - length; + raster += length; } } else { - tempr = raster ; - bytesleft -= length ; - raster += length ; + tempr = raster; + bytesleft -= length; + raster += length; } - cd->packptr = tempr ; - *tempr++ = cmd ; + cd->packptr = tempr; + *tempr++ = cmd; for (length--; length>0; length--) - *tempr++ = pkbyte() ; + *tempr++ = pkbyte(); } - cd->flags2 |= EXISTS ; + cd->flags2 |= EXISTS; } else { - k = 0 ; + k = 0; switch (cmd) { case 243: - k = pkbyte() ; + k = pkbyte(); if (k > 127) - k -= 256 ; + k -= 256; case 242: - k = k * 256 + pkbyte() ; + k = k * 256 + pkbyte(); case 241: - k = k * 256 + pkbyte() ; + k = k * 256 + pkbyte(); case 240: - k = k * 256 + pkbyte() ; + k = k * 256 + pkbyte(); while (k-- > 0) - i = pkbyte() ; - break ; + i = pkbyte(); + break; case 244: - k = pkquad() ; - break ; + k = pkquad(); + break; case 246: - break ; + break; default: - badpk("! unexpected command") ; + badpk("! unexpected command"); } } } #ifdef FONTLIB if (flib) - flib = 0 ; + flib = 0; else #endif - (void)fclose(pkfile) ; - curfnt->loaded = 1 ; - curfnt->maxchars = maxcc + 1 ; + (void)fclose(pkfile); + curfnt->loaded = 1; + curfnt->maxchars = maxcc + 1; if (munged > 0) { - static int seen = 0 ; + static int seen = 0; sprintf(errbuf, "Font %s at %d dpi has most likely been made improperly;", - curfnt->name, curfnt->dpi) ; - error(errbuf) ; + curfnt->name, curfnt->dpi); + error(errbuf); if (seen) - return ; - seen = 1 ; + return; + seen = 1; sprintf(errbuf, - "%d characters have 0 escapements but non-trivial TFM widths.", munged) ; - error(errbuf) ; + "%d characters have 0 escapements but non-trivial TFM widths.", munged); + error(errbuf); error( - "I'm stumbling along as best I can, but I recommend regenerating") ; + "I'm stumbling along as best I can, but I recommend regenerating"); error( - "these fonts; the problem is probably that they are non-CM fonts") ; + "these fonts; the problem is probably that they are non-CM fonts"); error( - "(such as circle10 or line10) created with a MF with the CM base") ; - error("preloaded .") ; + "(such as circle10 or line10) created with a MF with the CM base"); + error("preloaded ."); } } |