diff options
Diffstat (limited to 'Build/source/texk/dvipsk/dospecial.c')
-rw-r--r-- | Build/source/texk/dvipsk/dospecial.c | 616 |
1 files changed, 308 insertions, 308 deletions
diff --git a/Build/source/texk/dvipsk/dospecial.c b/Build/source/texk/dvipsk/dospecial.c index 63fefbf4ac8..e68470913f8 100644 --- a/Build/source/texk/dvipsk/dospecial.c +++ b/Build/source/texk/dvipsk/dospecial.c @@ -20,12 +20,12 @@ extern int system(); */ #include "protos.h" -static int specialerrors = 20 ; +static int specialerrors = 20; struct bangspecial { - struct bangspecial *next ; - char actualstuff[1] ; /* more space will actually be allocated */ -} *bangspecials = NULL ; + struct bangspecial *next; + char actualstuff[1]; /* more space will actually be allocated */ +} *bangspecials = NULL; void specerror(const char *s) @@ -35,85 +35,85 @@ specerror(const char *s) && !kpse_tex_hush ("special") #endif ) { - error(s) ; - specialerrors-- ; + error(s); + specialerrors--; } else if (specialerrors == 0 #ifdef KPATHSEA && !kpse_tex_hush ("special") #endif ) { - error("more errors in special, being ignored . . .") ; + error("more errors in special, being ignored . . ."); error("(perhaps dvips doesn't support your macro package?)"); - specialerrors-- ; + specialerrors--; } } static void outputstring(register char *p) { - (void)putc('\n', bitfile) ; + (void)putc('\n', bitfile); while(*p) { - (void)putc(*p, bitfile) ; - p++ ; + (void)putc(*p, bitfile); + p++; } - (void)putc('\n', bitfile) ; + (void)putc('\n', bitfile); } static void trytobreakout(register char *p) { - register int i ; - register int instring = 0 ; - int lastc = 0 ; + register int i; + register int instring = 0; + int lastc = 0; - i = 0 ; - (void)putc('\n', bitfile) ; + i = 0; + (void)putc('\n', bitfile); if(*p == '%') { while(*p) { - (void)putc(*p, bitfile) ; - p++ ; + (void)putc(*p, bitfile); + p++; } - (void)putc('\n', bitfile) ; - return ; + (void)putc('\n', bitfile); + return; } while (*p) { if (i > 65 && *p == ' ' && instring == 0) { - (void)putc('\n', bitfile) ; - i = 0 ; + (void)putc('\n', bitfile); + i = 0; } else { - (void)putc(*p, bitfile) ; - i++ ; + (void)putc(*p, bitfile); + i++; } if (*p == '(' && lastc != '\\') - instring = 1 ; + instring = 1; else if (*p == ')' && lastc != '\\') - instring = 0 ; - lastc = *p ; - p++ ; + instring = 0; + lastc = *p; + p++; } - (void)putc('\n', bitfile) ; + (void)putc('\n', bitfile); } static void dobs(register struct bangspecial *q) { if (q) { - dobs(q->next) ; - trytobreakout(q->actualstuff) ; + dobs(q->next); + trytobreakout(q->actualstuff); } } void outbangspecials(void) { if (bangspecials) { - cmdout("TeXDict") ; - cmdout("begin") ; - cmdout("@defspecial\n") ; - dobs(bangspecials) ; - cmdout("\n@fedspecial") ; - cmdout("end") ; + cmdout("TeXDict"); + cmdout("begin"); + cmdout("@defspecial\n"); + dobs(bangspecials); + cmdout("\n@fedspecial"); + cmdout("end"); } } @@ -181,9 +181,9 @@ char Tolower(register char c) { if ('A' <= c && c <= 'Z') - return(c+32) ; + return(c+32); else - return(c) ; + return(c); } #endif #endif /* IBM: VM/CMS */ @@ -192,91 +192,91 @@ Tolower(register char c) int IsSame(const char *a, const char *b) { - for( ; *a != '\0'; ) { + for(; *a != '\0'; ) { if( TOLOWER(*a) != TOLOWER(*b) ) return( 0 ); - a++ ; - b++ ; + a++; + b++; } return( *b == '\0' ); } -char *KeyStr ; /* Key and ... */ -const char *ValStr ; /* ... String values found */ -long ValInt ; /* Integer value found */ -float ValNum ; /* Number or Dimension value found */ +char *KeyStr; /* Key and ... */ +const char *ValStr; /* ... String values found */ +long ValInt; /* Integer value found */ +float ValNum; /* Number or Dimension value found */ char * GetKeyVal(char *str, int *tno) /* returns NULL if none found, else next scan point */ /* str : starting point for scan */ /* tno : table entry number of keyword, or -1 if keyword not found */ { - register char *s ; - register int i ; - register char t ; + register char *s; + register int i; + register char t; - for (s=str; *s <= ' ' && *s; s++) ; /* skip over blanks */ + for (s=str; *s <= ' ' && *s; s++); /* skip over blanks */ if (*s == '\0') - return (NULL) ; - KeyStr = s ; - while (*s>' ' && *s!='=') s++ ; + return (NULL); + KeyStr = s; + while (*s>' ' && *s!='=') s++; if (0 != (t = *s)) - *s++ = 0 ; + *s++ = 0; for(i=0; i<NKEYS; i++) if( IsSame(KeyStr, KeyTab[i].Entry) ) - goto found ; + goto found; *tno = -1; - return (s) ; + return (s); -found: *tno = i ; +found: *tno = i; if (KeyTab[i].Type == None) - return (s) ; + return (s); if (t && t <= ' ') { - for (; *s <= ' ' && *s; s++) ; /* now look for the value part */ + for (; *s <= ' ' && *s; s++); /* now look for the value part */ if ((t = *s)=='=') - s++ ; + s++; } - ValStr = "" ; + ValStr = ""; if ( t == '=' ) { while (*s <= ' ' && *s) - s++ ; + s++; if (*s=='\'' || *s=='\"') - t = *s++ ; /* get string delimiter */ - else t = ' ' ; - ValStr = s ; + t = *s++; /* get string delimiter */ + else t = ' '; + ValStr = s; while (*s!=t && *s) - s++ ; + s++; if (*s) - *s++ = 0 ; + *s++ = 0; } switch (KeyTab[i].Type) { case Integer: if(sscanf(ValStr,"%ld",&ValInt)!=1) { sprintf(errbuf,"Non-integer value (%s) given for keyword %s", - ValStr, KeyStr) ; - specerror(errbuf) ; - ValInt = 0 ; + ValStr, KeyStr); + specerror(errbuf); + ValInt = 0; } - break ; + break; case Number: case Dimension: if(sscanf(ValStr,"%f",&ValNum)!=1) { sprintf(errbuf,"Non-numeric value (%s) given for keyword %s", - ValStr, KeyStr) ; - specerror(errbuf) ; - ValNum = 0.0 ; + ValStr, KeyStr); + specerror(errbuf); + ValNum = 0.0; } if (KeyTab[i].Type==Dimension) { if (curfnt==NULL) - error("! No font selected") ; - ValNum = ValNum * ((double)curfnt->scaledsize) * conv * 72 / DPI ; + error("! No font selected"); + ValNum = ValNum * ((double)curfnt->scaledsize) * conv * 72 / DPI; } - break ; - default: break ; + break; + default: break; } - return (s) ; + return (s); } /* @@ -291,9 +291,9 @@ found: *tno = i ; void predospecial(integer numbytes, Boolean scanning) { - register char *p = nextstring ; - register int i = 0 ; - int j ; + register char *p = nextstring; + register int i = 0; + int j; static int omega_specials = 0; if (nextstring + numbytes > maxstring) { @@ -303,31 +303,31 @@ predospecial(integer numbytes, Boolean scanning) error("! Integer overflow in predospecial"); exit(1); } - p = nextstring = mymalloc(1000 + 2 * numbytes) ; - maxstring = nextstring + 2 * numbytes + 700 ; + p = nextstring = mymalloc(1000 + 2 * numbytes); + maxstring = nextstring + 2 * numbytes + 700; } for (i=numbytes; i>0; i--) #ifdef VMCMS /* IBM: VM/CMS */ - *p++ = ascii2ebcdic[(char)dvibyte()] ; + *p++ = ascii2ebcdic[(char)dvibyte()]; #else #ifdef MVSXA /* IBM: MVS/XA */ - *p++ = ascii2ebcdic[(char)dvibyte()] ; + *p++ = ascii2ebcdic[(char)dvibyte()]; #else - *p++ = (char)dvibyte() ; + *p++ = (char)dvibyte(); #endif /* IBM: VM/CMS */ #endif if (pprescan) - return ; + return; while (p[-1] <= ' ' && p > nextstring) - p-- ; /* trim trailing blanks */ - if (p==nextstring) return ; /* all blank is no-op */ - *p = 0 ; - p = nextstring ; + p--; /* trim trailing blanks */ + if (p==nextstring) return; /* all blank is no-op */ + *p = 0; + p = nextstring; while (*p <= ' ') - p++ ; + p++; #ifdef DEBUG if (dd(D_SPECIAL)) - (void)fprintf(stderr, "Preprocessing special: %s\n", p) ; + (void)fprintf(stderr, "Preprocessing special: %s\n", p); #endif /* @@ -344,111 +344,111 @@ case 'o': } return; } - break ; + break; case 'l': if (strncmp(p, "landscape", 9)==0) { if (hpapersize || vpapersize) error( - "both landscape and papersize specified: ignoring landscape") ; + "both landscape and papersize specified: ignoring landscape"); else - landscape = 1 ; - return ; + landscape = 1; + return; } - break ; + break; case 'p': - if (strncmp(p, "pos:", 4)==0) return ; /* positional specials */ + if (strncmp(p, "pos:", 4)==0) return; /* positional specials */ if (strncmp(p, "papersize", 9)==0) { - p += 9 ; + p += 9; while (*p == '=' || *p == ' ') - p++ ; + p++; if (hpapersize == 0 || vpapersize == 0) { if (landscape) { error( - "both landscape and papersize specified: ignoring landscape") ; - landscape = 0 ; + "both landscape and papersize specified: ignoring landscape"); + landscape = 0; } - handlepapersize(p, &hpapersize, &vpapersize) ; + handlepapersize(p, &hpapersize, &vpapersize); } - return ; + return; } - break ; + break; case 'x': - if (strncmp(p, "xtex:", 5)==0) return ; - break ; + if (strncmp(p, "xtex:", 5)==0) return; + break; case 's': - if (strncmp(p, "src:", 4)==0) return ; /* source specials */ - break ; + if (strncmp(p, "src:", 4)==0) return; /* source specials */ + break; case 'h': if (strncmp(p, "header", 6)==0) { - char *q, *r, *pre = NULL, *post = NULL ; - p += 6 ; + char *q, *r, *pre = NULL, *post = NULL; + p += 6; while ((*p <= ' ' || *p == '=' || *p == '(') && *p != 0) - p++ ; + p++; if(*p == '{') { p++; while ((*p <= ' ' || *p == '=' || *p == '(') && *p != 0) p++; - q = p ; + q = p; while (*p != '}' && *p != 0) p++; - r = p-1 ; + r = p-1; while ((*r <= ' ' || *r == ')') && r >= q) - r-- ; - if (*p != 0) p++ ; - r[1] = 0 ; /* q is the file name */ + r--; + if (*p != 0) p++; + r[1] = 0; /* q is the file name */ while ((*p <= ' ' || *p == '=' || *p == '(') && *p != 0) - p++ ; + p++; if(strncmp(p, "pre", 3) == 0) { - int bracecount = 1, num_bytes = 0 ; + int bracecount = 1, num_bytes = 0; while(*p != '{' && *p != 0) - p++ ; + p++; if (*p != 0) p++; for(r = p; *r != 0; r++) { - if (*r == '{') bracecount++ ; - else if (*r == '}') bracecount-- ; - if (bracecount == 0) break ; - num_bytes++ ; + if (*r == '{') bracecount++; + else if (*r == '}') bracecount--; + if (bracecount == 0) break; + num_bytes++; } pre = (char *)malloc(num_bytes+1); - r = pre ; + r = pre; for (j=0; j < num_bytes; j++) *r++ = *p++; *r = 0; if (*p != 0) p++; } while ((*p <= ' ' || *p == '=' || *p == '(') && *p != 0) - p++ ; + p++; if(strncmp(p, "post", 4) == 0) { - int bracecount = 1, num_bytes = 0 ; + int bracecount = 1, num_bytes = 0; while(*p != '{' && *p != 0) - p++ ; + p++; if (*p != 0) p++; for(r = p; *r != 0; r++) { - if (*r == '{') bracecount++ ; - else if (*r == '}') bracecount-- ; - if (bracecount == 0) break ; - num_bytes++ ; + if (*r == '{') bracecount++; + else if (*r == '}') bracecount--; + if (bracecount == 0) break; + num_bytes++; } post = (char *)malloc(num_bytes+1); - r = post ; + r = post; for (j=0; j < num_bytes; j++) *r++ = *p++; *r = 0; } if (strlen(q) > 0) - (void)add_header_general(q, pre, post) ; + (void)add_header_general(q, pre, post); } else { - q = p ; /* we will remove enclosing parentheses */ - p = p + strlen(p) - 1 ; + q = p; /* we will remove enclosing parentheses */ + p = p + strlen(p) - 1; while ((*p <= ' ' || *p == ')') && p >= q) - p-- ; - p[1] = 0 ; + p--; + p[1] = 0; if (p >= q) - (void)add_header(q) ; + (void)add_header(q); } } - break ; + break; /* IBM: color - added section here for color header and color history */ /* using strncmp in this fashion isn't perfect; if later someone wants to introduce a verb like colorspace, well, just checking @@ -456,42 +456,42 @@ case 'h': --tgr */ case 'b': if (strncmp(p, "background", 10) == 0) { - usescolor = 1 ; - p += 10 ; - while ( *p && *p <= ' ' ) p++ ; - background(p) ; - return ; + usescolor = 1; + p += 10; + while ( *p && *p <= ' ' ) p++; + background(p); + return; } - break ; + break; case 'c': if (strncmp(p, "color", 5) == 0) { - usescolor = 1 ; - p += 5 ; - while ( *p && *p <= ' ' ) p++ ; + usescolor = 1; + p += 5; + while ( *p && *p <= ' ' ) p++; if (strncmp(p, "push", 4) == 0 ) { - p += 4 ; - while ( *p && *p <= ' ' ) p++ ; - pushcolor(p, 0) ; + p += 4; + while ( *p && *p <= ' ' ) p++; + pushcolor(p, 0); } else if (strncmp(p, "pop", 3) == 0 ) { - popcolor(0) ; + popcolor(0); } else { - resetcolorstack(p,0) ; + resetcolorstack(p,0); } } /* IBM: color - end changes */ - break ; + break; case '!': { - register struct bangspecial *q ; - p++ ; + register struct bangspecial *q; + p++; q = (struct bangspecial *)mymalloc((integer) - (sizeof(struct bangspecial) + strlen(p))) ; - (void)strcpy(q->actualstuff, p) ; - q->next = bangspecials ; - bangspecials = q ; - usesspecial = 1 ; - return ; + (sizeof(struct bangspecial) + strlen(p))); + (void)strcpy(q->actualstuff, p); + q->next = bangspecials; + bangspecials = q; + usesspecial = 1; + return; } - break ; + break; default: #if 0 { @@ -499,41 +499,41 @@ default: return; } #endif - break ; + break; } - usesspecial = 1 ; /* now the special prolog will be sent */ + usesspecial = 1; /* now the special prolog will be sent */ if (scanning && *p != '"' && (p=GetKeyVal(p, &j)) != NULL && j==0 && *ValStr != '`') /* Don't bother to scan compressed files. */ - scanfontcomments(ValStr) ; + scanfontcomments(ValStr); } int maccess(char *s) { - FILE *f = search(figpath, s, "r") ; + FILE *f = search(figpath, s, "r"); if (f) - (*close_file) (f) ; - return (f != 0) ; + (*close_file) (f); + return (f != 0); } -const char *tasks[] = { 0, "iff2ps", "tek2ps" } ; +const char *tasks[] = { 0, "iff2ps", "tek2ps" }; -static char psfile[511] ; +static char psfile[511]; void dospecial(integer numbytes) { - register char *p = nextstring ; - register int i = 0 ; - int j, systemtype = 0 ; - register const char *q ; - Boolean psfilewanted = 1 ; - const char *task = 0 ; - char cmdbuf[111] ; + register char *p = nextstring; + register int i = 0; + int j, systemtype = 0; + register const char *q; + Boolean psfilewanted = 1; + const char *task = 0; + char cmdbuf[111]; #ifdef HPS if (HPS_FLAG && PAGEUS_INTERUPPTUS) { - HREF_COUNT-- ; - start_new_box() ; - PAGEUS_INTERUPPTUS = 0 ; + HREF_COUNT--; + start_new_box(); + PAGEUS_INTERUPPTUS = 0; } if (HPS_FLAG && NEED_NEW_BOX) { vertical_in_hps(); @@ -541,27 +541,27 @@ if (HPS_FLAG && NEED_NEW_BOX) { } #endif if (nextstring + numbytes > maxstring) - error("! out of string space in dospecial") ; + error("! out of string space in dospecial"); for (i=numbytes; i>0; i--) #ifdef VMCMS /* IBM: VM/CMS */ - *p++ = ascii2ebcdic[(char)dvibyte()] ; + *p++ = ascii2ebcdic[(char)dvibyte()]; #else #ifdef MVSXA /* IBM: MVS/XA */ - *p++ = ascii2ebcdic[(char)dvibyte()] ; + *p++ = ascii2ebcdic[(char)dvibyte()]; #else - *p++ = (char)dvibyte() ; + *p++ = (char)dvibyte(); #endif /* IBM: VM/CMS */ #endif while (p[-1] <= ' ' && p > nextstring) - p-- ; /* trim trailing blanks */ - if (p==nextstring) return ; /* all blank is no-op */ - *p = 0 ; - p = nextstring ; + p--; /* trim trailing blanks */ + if (p==nextstring) return; /* all blank is no-op */ + *p = 0; + p = nextstring; while (*p <= ' ') - p++ ; + p++; #ifdef DEBUG if (dd(D_SPECIAL)) - (void)fprintf(stderr, "Processing special: %s\n", p) ; + (void)fprintf(stderr, "Processing special: %s\n", p); #endif switch (*p) { @@ -569,30 +569,30 @@ case 'o': if (strncmp(p, "om:", 3)==0) { /* Omega specials ignored */ return; } - break ; + break; case 'e': if (strncmp(p, "em:", 3)==0) { /* emTeX specials in emspecial.c */ emspecial(p); return; } - break ; + break; case 'p': - if (strncmp(p, "pos:", 4)==0) return ; /* positional specials */ + if (strncmp(p, "pos:", 4)==0) return; /* positional specials */ if (strncmp(p, "ps:", 3)==0) { - psflush() ; /* now anything can happen. */ + psflush(); /* now anything can happen. */ if (p[3]==':') { if (strncmp(p+4, "[nobreak]", 9) == 0) { - hvpos() ; - outputstring(&p[13]) ; + hvpos(); + outputstring(&p[13]); } else if (strncmp(p+4, "[begin]", 7) == 0) { - hvpos() ; - trytobreakout(&p[11]) ; + hvpos(); + trytobreakout(&p[11]); } else if (strncmp(p+4, "[end]", 5) == 0) trytobreakout(&p[9]); else trytobreakout(&p[4]); } else if (strncmp(p+3, " plotfile ", 10) == 0) { - char *sfp ; - hvpos() ; + char *sfp; + hvpos(); p += 13; /* * Fixed to allow popen input for plotfile @@ -601,9 +601,9 @@ case 'p': while (*p == ' ') p++; if (*p == '"') { p++; - for (sfp = p; *sfp && *sfp != '"'; sfp++) ; + for (sfp = p; *sfp && *sfp != '"'; sfp++); } else { - for (sfp = p; *sfp && *sfp != ' '; sfp++) ; + for (sfp = p; *sfp && *sfp != ' '; sfp++); } *sfp = '\0'; if (*p == '`') @@ -612,27 +612,27 @@ case 'p': figcopyfile (p, 0); /* End TJD changes */ } else { - hvpos() ; + hvpos(); trytobreakout(&p[3]); - psflush() ; - hvpos() ; + psflush(); + hvpos(); } return; } if (strncmp(p, "papersize", 9) == 0) - return ; + return; #ifdef TPIC if (strncmp(p, "pn ", 3) == 0) {setPenSize(p+2); return;} if (strncmp(p, "pa ", 3) == 0) {addPath(p+2); return;} #endif - break ; + break; case 'l': - if (strncmp(p, "landscape", 9)==0) return ; - break ; + if (strncmp(p, "landscape", 9)==0) return; + break; case '!': - return ; + return; case 'h': - if (strncmp(p, "header", 6)==0) return ; + if (strncmp(p, "header", 6)==0) return; #ifdef HPS if (strncmp(p, "html:", 5)==0) { if (! HPS_FLAG) return; @@ -672,60 +672,60 @@ case 'h': case 'w': case 'W': if (strncmp(p+1, "arning", 6) == 0) { - static int maxwarns = 50 ; + static int maxwarns = 50; if (maxwarns > 0) { - error(p) ; - maxwarns-- ; + error(p); + maxwarns--; } else if (maxwarns == 0) { - error(". . . rest of warnings suppressed") ; - maxwarns-- ; + error(". . . rest of warnings suppressed"); + maxwarns--; } - return ; + return; } #ifdef TPIC if (strcmp(p, "wh") == 0) {whitenLast(); return;} #endif - break ; + break; case 'b': if ( strncmp(p, "background", 10) == 0 ) - return ; /* already handled in prescan */ + return; /* already handled in prescan */ #ifdef TPIC if (strcmp(p, "bk") == 0) {blackenLast(); return;} #endif - break ; + break; case 'c': if (strncmp(p, "color", 5) == 0) { - p += 5 ; - while ( *p && *p <= ' ' ) p++ ; + p += 5; + while ( *p && *p <= ' ' ) p++; if (strncmp(p, "push", 4) == 0 ) { - p += 4 ; - while ( *p && *p <= ' ' ) p++ ; + p += 4; + while ( *p && *p <= ' ' ) p++; pushcolor(p,1); } else if (strncmp(p, "pop", 3) == 0 ) { - popcolor(1) ; + popcolor(1); } else { - resetcolorstack(p,1) ; + resetcolorstack(p,1); } - return ; + return; } /* IBM: color - end changes*/ - break ; + break; case 'f': #ifdef TPIC if (strcmp(p, "fp") == 0) {flushPath(0); return;} #endif - break ; + break; case 'i': #ifdef TPIC if (strcmp(p, "ip") == 0) {flushPath(1); return;} /* tpic 2.0 */ if (strncmp(p, "ia ", 3) == 0) {arc(p+2, 1); return;} /* tpic 2.0 */ #endif - break ; + break; case 'd': #ifdef TPIC if (strncmp(p, "da ", 3) == 0) {flushDashed(p+2, 0); return;} if (strncmp(p, "dt ", 3) == 0) {flushDashed(p+2, 1); return;} #endif - break ; + break; case 's': if (strncmp(p, "src:", 4) == 0) return; /* source specials */ #ifdef TPIC @@ -734,25 +734,25 @@ case 's': if (strcmp(p, "sh") == 0) {shadeLast(p+2); return;} /* tpic 2.0 */ if (strncmp(p, "sh ", 3) == 0) {shadeLast(p+3); return;} /* tpic 2.0 */ #endif - break ; + break; case 'a': #ifdef TPIC if (strncmp(p, "ar ", 3) == 0) {arc(p+2, 0); return;} /* tpic 2.0 */ #endif - break ; + break; case 't': #ifdef TPIC if (strncmp(p, "tx ", 3) == 0) {SetShade(p+3); return;} #endif - break ; + break; case '"': - hvpos() ; - cmdout("@beginspecial") ; - cmdout("@setspecial") ; - trytobreakout(p+1) ; - cmdout("\n@endspecial") ; - return ; - break ; + hvpos(); + cmdout("@beginspecial"); + cmdout("@setspecial"); + trytobreakout(p+1); + cmdout("\n@endspecial"); + return; + break; default: #if 0 { @@ -762,7 +762,7 @@ default: return; } #endif - break ; + break; } /* At last we get to the key/value conventions */ psfile[0] = '\0'; @@ -774,66 +774,66 @@ default: case -1: /* for compatability with old conventions, we allow a file name * to be given without the 'psfile=' keyword */ if (!psfile[0] && maccess(KeyStr)==0) /* yes we can read it */ - (void)strcpy(psfile,KeyStr) ; + (void)strcpy(psfile,KeyStr); else { if (strlen(KeyStr) < 40) { sprintf(errbuf, "Unknown keyword (%s) in \\special will be ignored", - KeyStr) ; + KeyStr); } else { sprintf(errbuf, "Unknown keyword (%.40s...) in \\special will be ignored", - KeyStr) ; + KeyStr); } - specerror(errbuf) ; + specerror(errbuf); } - break ; + break; case 0: case 1: case 2: /* psfile */ if (psfile[0]) { sprintf(errbuf, "More than one \\special %s given; %s ignored", - "psfile", ValStr) ; - specerror(errbuf) ; + "psfile", ValStr); + specerror(errbuf); } - else (void)strcpy(psfile,ValStr) ; - task = tasks[j] ; - break ; + else (void)strcpy(psfile,ValStr); + task = tasks[j]; + break; default: /* most keywords are output as PostScript procedure calls */ if (KeyTab[j].Type == Integer) numout((integer)ValInt); else if (KeyTab[j].Type == String) for (q=ValStr; *q; q++) - scout(*q) ; - else if (KeyTab[j].Type == None) ; + scout(*q); + else if (KeyTab[j].Type == None); else { /* Number or Dimension */ - ValInt = (integer)(ValNum<0? ValNum-0.5 : ValNum+0.5) ; + ValInt = (integer)(ValNum<0? ValNum-0.5 : ValNum+0.5); if (ValInt-ValNum < 0.001 && ValInt-ValNum > -0.001) - numout((integer)ValInt) ; + numout((integer)ValInt); else { - (void)sprintf(cmdbuf, "%f", ValNum) ; - cmdout(cmdbuf) ; + (void)sprintf(cmdbuf, "%f", ValNum); + cmdout(cmdbuf); } } (void)sprintf(cmdbuf, "@%s", KeyStr); - cmdout(cmdbuf) ; + cmdout(cmdbuf); } cmdout("@setspecial"); if(psfile[0]) { if (task == 0) { - systemtype = (psfile[0]=='`') ; - figcopyfile(psfile+systemtype, systemtype) ; + systemtype = (psfile[0]=='`'); + figcopyfile(psfile+systemtype, systemtype); } else { - fprintf (stderr, "dvips: iff2ps and tek2ps are not supported.\n") ; + fprintf (stderr, "dvips: iff2ps and tek2ps are not supported.\n"); } } else if (psfilewanted #ifdef KPATHSEA && !kpse_tex_hush ("special") #endif ) - specerror("No \\special psfile was given; figure will be blank") ; + specerror("No \\special psfile was given; figure will be blank"); - cmdout("@endspecial") ; + cmdout("@endspecial"); } /* @@ -841,77 +841,77 @@ default: * Currently we only deal with psfile's or PSfiles and only those * that do not use rotations. */ -static float rbbox[4] ; +static float rbbox[4]; float * bbdospecial(int nbytes) { - char *p = nextstring ; - int i, j ; - char seen[NKEYS] ; - float valseen[NKEYS] ; + char *p = nextstring; + int i, j; + char seen[NKEYS]; + float valseen[NKEYS]; if (nextstring + nbytes > maxstring) { - p = nextstring = mymalloc(1000 + 2 * nbytes) ; - maxstring = nextstring + 2 * nbytes + 700 ; + p = nextstring = mymalloc(1000 + 2 * nbytes); + maxstring = nextstring + 2 * nbytes + 700; } if (nextstring + nbytes > maxstring) - error("! out of string space in bbdospecial") ; + error("! out of string space in bbdospecial"); for (i=nbytes; i>0; i--) #ifdef VMCMS /* IBM: VM/CMS */ - *p++ = ascii2ebcdic[(char)dvibyte()] ; + *p++ = ascii2ebcdic[(char)dvibyte()]; #else #ifdef MVSXA /* IBM: MVS/XA */ - *p++ = ascii2ebcdic[(char)dvibyte()] ; + *p++ = ascii2ebcdic[(char)dvibyte()]; #else - *p++ = (char)dvibyte() ; + *p++ = (char)dvibyte(); #endif /* IBM: VM/CMS */ #endif while (p[-1] <= ' ' && p > nextstring) - p-- ; /* trim trailing blanks */ - if (p==nextstring) return NULL ; /* all blank is no-op */ - *p = 0 ; - p = nextstring ; + p--; /* trim trailing blanks */ + if (p==nextstring) return NULL; /* all blank is no-op */ + *p = 0; + p = nextstring; while (*p && *p <= ' ') - p++ ; + p++; if (strncmp(p, "psfile", 6)==0 || strncmp(p, "PSfile", 6)==0) { float originx = 0, originy = 0, hscale = 1, vscale = 1, - hsize = 0, vsize = 0 ; + hsize = 0, vsize = 0; for (j=0; j<NKEYS; j++) - seen[j] = 0 ; - j = 0 ; + seen[j] = 0; + j = 0; while ((p=GetKeyVal(p, &j))) { if (j >= 0 && j < NKEYS && KeyTab[j].Type == Number) { - seen[j]++ ; - valseen[j] = ValNum ; + seen[j]++; + valseen[j] = ValNum; } } /* * This code mimics what happens in @setspecial. */ if (seen[3]) - hsize = valseen[3] ; + hsize = valseen[3]; if (seen[4]) - vsize = valseen[4] ; + vsize = valseen[4]; if (seen[5]) - originx = valseen[5] ; + originx = valseen[5]; if (seen[6]) - originy = valseen[6] ; + originy = valseen[6]; if (seen[7]) - hscale = valseen[7] / 100.0 ; + hscale = valseen[7] / 100.0; if (seen[8]) - vscale = valseen[8] / 100.0 ; + vscale = valseen[8] / 100.0; if (seen[10] && seen[12]) - hsize = valseen[12] - valseen[10] ; + hsize = valseen[12] - valseen[10]; if (seen[11] && seen[13]) - vsize = valseen[13] - valseen[11] ; + vsize = valseen[13] - valseen[11]; if (seen[14] || seen[15]) { if (seen[14] && seen[15] == 0) { - hscale = vscale = valseen[14] / (10.0 * hsize) ; + hscale = vscale = valseen[14] / (10.0 * hsize); } else if (seen[15] && seen[14] == 0) { - hscale = vscale = valseen[15] / (10.0 * vsize) ; + hscale = vscale = valseen[15] / (10.0 * vsize); } else { - hscale = valseen[14] / (10.0 * hsize) ; - vscale = valseen[15] / (10.0 * vsize) ; + hscale = valseen[14] / (10.0 * hsize); + vscale = valseen[15] / (10.0 * vsize); } } /* at this point, the bounding box in PostScript units relative to @@ -919,11 +919,11 @@ bbdospecial(int nbytes) originx originy originx+hsize*hscale originy+vsize*vscale We'll let the bbox routine handle the remaining math. */ - rbbox[0] = originx ; - rbbox[1] = originy ; - rbbox[2] = originx+hsize*hscale ; - rbbox[3] = originy+vsize*vscale ; - return rbbox ; + rbbox[0] = originx; + rbbox[1] = originy; + rbbox[2] = originx+hsize*hscale; + rbbox[3] = originy+vsize*vscale; + return rbbox; } - return 0 ; + return 0; } |