#include "w2c-ext.h" /*732*/ #define padded true #define padchar ' ' #define ampand '&' #define ctrlflag '^' #define pauseask "PAUSED. Type to continue" #define railwidth 1 #define railheight 1 #define postwidth 1 #define postheight 1 #define railtypes 2 #define maxDfonts 100 #define maxDchar 255 #define maxligs 10000 #define maxbuf 201 #define maxstring 100 #define pagemax 30000 #define maxlinesize 1000 #define leftstop 0 #define deepest 10 #define hresolution 10 #define vresolution 6 #define fixedwidth true #define charwidth 1 #define gapwidth 1 #define charht 1 #define minfont 1 #define maxfont 1 #define onlyonefont true #define candlfont false #define mindlfont 0 #define maxdlfont 0 #define maxcodes 60 #define maxplain 4 typedef unsigned char byte; typedef schar bite; typedef short iword; typedef text /* file of bite*/bytefile; typedef schar Dfontptr; typedef unsigned char Dcharptr; typedef struct{iword breadth; byte IMfont; byte IMchar; iword multi; }codeobject; typedef schar codeptr; typedef schar trio; typedef struct{iword vmove; iword hmove; codeobject symbol; iword num; iword guard; }ligthing; typedef schar sptr; typedef char fixstring[maxstring + 1]; typedef struct{byte len; fixstring data; }varstring; typedef short pagei; typedef pagei link; typedef struct{link prox; iword hpos; iword vpos; codeobject symbol; link down; }pagerecord; integer ini,inj; boolean usestdin; varstring command; boolean squash,runon,quiet,batchview; integer magnify,hmag,vmag,firstpage,countpages; bytefile dvifile,tfmfile,rasterfile; integer dviindx,tfmindx,rasterindx; varstring dviname,tfmname,rastername,printname,dvidef,tfmdef,rasterdef,printex ; varstring fontname,pn,pd,pex; text printfile; boolean start,timetostop,pagegap; integer counter[10]; integer Dh,Dv,Dw,Dx,Dy,Dz; integer Dhstack[203],Dvstack[203],Dwstack[203],Dxstack[203],Dystack[203], Dzstack[203]; unsigned char stackht; boolean justpushed; real dvifactor,hconv,vconv,magnification; integer Dlmargin,Dtopmargin,nnn; byte bbb; codeobject railchars[railtypes + 1]; integer railbase; codeobject postchar; Dfontptr nf; integer fontnum[maxDfonts + 1],fontspace[maxDfonts + 1],scheme[maxDfonts + 1], firstch[maxDfonts + 1],lastch[maxDfonts + 1]; integer Dwidth[maxDfonts + 1][maxDchar + 1]; integer Dcheck,thinspace,Dfont,curscheme; varstring knownschemes[maxcodes + 1]; codeptr schememap[maxcodes + 1]; codeobject codes[maxcodes + 1][maxDchar + 1]; codeobject nochar; codeptr schemetop; ligthing ligatures[maxligs + 1]; short topofligs; iword rowfont; byte ch; fixstring hack; varstring buffer,blank; sptr thumb,finger; integer Dhleft,IMhleft,Dhmid,IMhmid,Dhright,IMhright,IMh,IMv,Ddis,IMdis,Hshunt ; integer IMhstack[203],IMvstack[203]; iword hmax,vmax,hmin,vmin; link zzz,cell,tempp,curpgeptr,mid,midptr,run,runptr,left,leftptr,Lrunptr,right ,rightptr,Rrunptr; pagei pagesize; iword Oldv,Oldh; boolean sorted; pagerecord pool[pagemax + 1]; iword PRv,PRvnext,PRh,PRhnext,PRfont; char deviceID[13]; boolean list,xwzfortran,bfeedabsolute,bfeedbystring,feedabsolute,bfeedscream, bspaceabsolute,bspacebystring,spaceabsolute,absisincr,wldoescr,wantsplit, isheader,dopause,inspection; integer wlfeeddist,crfeeddist,feeddist,tfeeddist,bfeeddist,tinydrop,bigdrop, spacedist,tspacedist,bspacedist,pausei,pausesteps; char feedchar,tfeedchar,crchar,spacechar,tspacechar,bspacechar; varstring startstuff,stopstuff,pagetop,bfeedstring,fontcommand,vabscom,habscom ,pauseafter; real hfudge,vfudge,lmargin,topmargin; #include "coerce.h" #ifdef ANSI void error(void) #else /* not ANSI*/ void error() #endif /* ANSI*/ { ; } #ifdef ANSI void crash(void) #else /* not ANSI*/ void crash() #endif /* ANSI*/ { real u; u = -1; error(); if((u<0)) uexit(1); } #ifdef ANSI void zparsefile( varstring name, varstring *dir, varstring *nam, varstring *ex ) #else /* not ANSI*/ void zparsefile( name, dir, nam, ex) varstring name; varstring *dir; varstring *nam; varstring *ex; #endif /* ANSI*/ { sptr p,r,s; dir[0] = blank; nam[0] = blank; ex[0] = blank; s = name.len; if((s>0)) { p = ssearch(name,'/',- (integer)s); if((p>0)) substring(dir[0],name,1,p); r = ssearch(name,'.',- (integer)s); if((r>p)) substring(ex[0],name,r,s-r+1); else r = s+1; substring(nam[0],name,p+1,r-p-1); } } #ifdef ANSI void znameof( fixstring result, varstring name) #else /* not ANSI*/ void znameof( result, name) fixstring result; varstring name; #endif /* ANSI*/ { integer n,i; n = name.len; if((n>maxstring)) n = maxstring; {register integer for_end;i=1;for_end=n; if (i<=for_end)do result[i] = name.data[i]; while(i++ < for_end);} {register integer for_end;i=n+1;for_end=maxstring; if (i<=for_end)do result[i] = ' '; while(i++ < for_end);} } #ifdef ANSI boolean zopenbinary( bytefile ff, varstring *name, integer searchpath) #else /* not ANSI*/ boolean zopenbinary( ff, name, searchpath) bytefile ff; varstring *name; integer searchpath; #endif /* ANSI*/ { register boolean Result;ccharpointer curname; curname = name[0].data; if(testreadaccess(curname,searchpath)) { reset(ff,curname); Result = true; } else Result = false; return(Result); } #ifdef ANSI void getcommand(void) #else /* not ANSI*/ void getcommand() #endif /* ANSI*/ { fixstring ss; integer nn; varstring tt; ccharpointer cc; command = blank; {register integer for_end;nn=1;for_end=argc-1; if (nn<=for_end)do { argv(nn,ss); cc = ss; cc = cc+1; setstring(cc,buffer); tt = buffer; append(command,tt); command.len = command.len+1; } while(nn++ < for_end);} } #ifdef ANSI void readterminal(void) #else /* not ANSI*/ void readterminal() #endif /* ANSI*/ { byte k; buffer = blank; if(!eof(input)) { if(eoln(input)) readln(input); k = 0; while((!eoln(input))){ k = k+1; read(input,buffer.data[k]); } buffer.len = k; finger = 0; { finger = finger+1; ch = ord(buffer.data[finger]); } } } #ifdef ANSI byte zreadbyte( bytefile ffile, integer *findx) #else /* not ANSI*/ byte zreadbyte( ffile, findx) bytefile ffile; integer *findx; #endif /* ANSI*/ { register byte Result;bite x; if(eof(ffile)) { { fprintf( *output, "%s%s%c", "Error: ", "End of file", '\n'); error(); } Result = 0; } else{ read(ffile,x); if(x<0) Result = x+256; else Result = x; findx[0] = findx[0]+1; } return(Result); } #ifdef ANSI void zskipbytes( bytefile ffile, integer *findx, integer n) #else /* not ANSI*/ void zskipbytes( ffile, findx, n) bytefile ffile; integer *findx; integer n; #endif /* ANSI*/ { integer k; bite x; if(n<0) { fprintf( *output, "%s%s%c", "Fatal: ", "skip_bytes called with negative number", '\n'); crash(); } findx[0] = findx[0]+n; {register integer for_end;k=1;for_end=n; if (k<=for_end)do { if(eof(ffile)) { fprintf( *output, "%s%s%c", "Error: ", "End of file", '\n'); error(); } else read(ffile,x); } while(k++ < for_end);} } #ifdef ANSI integer zreadinteger( bytefile ffile, integer *findx, integer k) #else /* not ANSI*/ integer zreadinteger( ffile, findx, k) bytefile ffile; integer *findx; integer k; #endif /* ANSI*/ { register integer Result;byte a,i; integer n; n = readbyte(ffile,findx[0]); if((k<0)&&(n>127)) n = n-256; {register integer for_end;i=1;for_end=abs(k)-1; if (i<=for_end)do { a = readbyte(ffile,findx[0]); n = n*256+a; } while(i++ < for_end);} Result = n; return(Result); } #ifdef ANSI void push(void) #else /* not ANSI*/ void push() #endif /* ANSI*/ { real x; if(stackht==200) { fprintf( *output, "%s%s%*d%c%c", "Fatal: ", "Capacity exceeded (stack size=", 1, 200, ')', '\n'); crash(); } else{ Dhstack[stackht] = Dh; Dvstack[stackht] = Dv; Dwstack[stackht] = Dw; Dxstack[stackht] = Dx; Dystack[stackht] = Dy; Dzstack[stackht] = Dz; IMhstack[stackht] = IMh; IMvstack[stackht] = IMv; if(justpushed&&(stackht>0)) { x = hconv*(Dhstack[stackht]-Dhstack[stackht-1]); if(abs(x)>1.5) IMhstack[stackht] = IMhstack[stackht]+round(x); } Dhleft = Dh; IMhleft = IMhstack[stackht]; stackht = stackht+1; justpushed = true; } } #ifdef ANSI void pop(void) #else /* not ANSI*/ void pop() #endif /* ANSI*/ { if(stackht==0) { fprintf( *output, "%s%s%c", "Error: ", "POP illegal at level zero", '\n') ; error(); } else{ stackht = stackht-1; Dh = Dhstack[stackht]; Dv = Dvstack[stackht]; Dw = Dwstack[stackht]; Dx = Dxstack[stackht]; Dy = Dystack[stackht]; Dz = Dzstack[stackht]; IMh = IMhstack[stackht]; IMv = IMvstack[stackht]; railbase = IMv*railtypes; } } #ifdef ANSI void zdopost( integer Drulht, integer Drulwidth) #else /* not ANSI*/ void zdopost( Drulht, Drulwidth) integer Drulht; integer Drulwidth; #endif /* ANSI*/ { integer vn,vi,hn,hi,postv,rulehp; codeobject rulecod; roundIMh(0); hn = round(Drulwidth*hconv/ ((double)postwidth)); vn = round(Drulht*vconv/ ((double)postheight)); if(hn<=0) hn = 1; if(vn<=0) vn = 1; rulecod = postchar; Ddis = Drulwidth; IMdis = hn*postwidth; Dhright = Dh+Ddis; IMhright = IMh+IMdis; {register integer for_end;vi=vn-1;for_end=0; if (vi>=for_end)do { postv = IMv-vi*postheight; {register integer for_end;hi=1;for_end=hn; if (hi<=for_end)do { rulehp = IMh+(hi-1)*postwidth; dosetchar(postv,rulehp,rulecod); } while(hi++ < for_end);} } while(vi-- > for_end);} } #ifdef ANSI void zdorail( integer Drulht, integer Drulwidth) #else /* not ANSI*/ void zdorail( Drulht, Drulwidth) integer Drulht; integer Drulwidth; #endif /* ANSI*/ { integer vn,vi,hn,hi,railv,charvp,rulehp; codeobject rulecod; schar chari; roundIMh(0); hn = round(Drulwidth*hconv/ ((double)railwidth)); vn = round(Drulht*vconv*railtypes/ ((double)railheight)); if(hn<=0) hn = 1; if(vn<=0) vn = 1; Ddis = Drulwidth; IMdis = hn*railwidth; Dhright = Dh+Ddis; IMhright = IMh+IMdis; {register integer for_end;vi=vn-1;for_end=0; if (vi>=for_end)do { railv = railbase-vi; charvp = ((railv-1)/railtypes)+1; chari = railtypes-((railv-1)%railtypes); rulecod = railchars[chari]; {register integer for_end;hi=1;for_end=hn; if (hi<=for_end)do { rulehp = IMh+(hi-1)*railwidth; dosetchar(charvp,rulehp,rulecod); } while(hi++ < for_end);} } while(vi-- > for_end);} } #ifdef ANSI codeptr znamesearch( varstring ss) #else /* not ANSI*/ codeptr znamesearch( ss) varstring ss; #endif /* ANSI*/ { register codeptr Result;codeptr i; i = schemetop; while(((i>0)&&(!equals(ss,knownschemes[i]))))i = i-1; if((i==0)) Result = 0; else Result = i; return(Result); } #ifdef ANSI void zsetscheme( codeptr ix) #else /* not ANSI*/ void zsetscheme( ix) codeptr ix; #endif /* ANSI*/ { schemetop = schemetop+1; upcase(buffer); knownschemes[schemetop] = buffer; schememap[schemetop] = ix; } #ifdef ANSI void zalphabet( byte start, byte length, codeptr s, byte PRfont, byte PRfirst ) #else /* not ANSI*/ void zalphabet( start, length, s, PRfont, PRfirst) byte start; byte length; codeptr s; byte PRfont; byte PRfirst; #endif /* ANSI*/ { integer i; codeobject ccc; if((s<1)) { fprintf( *output, "%s%s%c", "Fatal: ", "Alphabet: scheme < 1 ", '\n'); crash(); } else if((s>maxcodes)) { fprintf( *output, "%s%s%c", "Fatal: ", "Alphabet: scheme too large", '\n'); crash(); } else if((PRfirst<0)) { fprintf( *output, "%s%s%c", "Fatal: ", "Alphabet: negative first", '\n'); crash(); } else if((start<0)) { fprintf( *output, "%s%s%c", "Fatal: ", "Alphabet: negative start", '\n') ; crash(); } else if((length<0)) { fprintf( *output, "%s%s%c", "Fatal: ", "Alphabet: negative length", '\n') ; crash(); } else if((start+length-1>maxDchar)) { fprintf( *output, "%s%s%c", "Fatal: ", "Alphabet: overflow", '\n'); crash(); } ccc.IMfont = PRfont; ccc.breadth = charwidth; {register integer for_end;i=0;for_end=length-1; if (i<=for_end)do { ccc.IMchar = PRfirst+i; codes[s][start+i] = ccc; } while(i++ < for_end);} } #ifdef ANSI void zsetstring( ccharpointer ss, varstring *result) #else /* not ANSI*/ void zsetstring( ss, result) ccharpointer ss; varstring *result; #endif /* ANSI*/ { byte i,j; result[0] = blank; j = strlen(ss)-1; if(padded) { while(((j>0)&&(ss[j]==padchar)))j = j-1; if((j==0)&&(ss[j]==padchar)) j = j-1; } j = j+1; if((j>maxstring)) { fprintf( *output, "%s%s%c", "Error: ", "String too long", '\n'); error(); } else{ result[0].len = j; {register integer for_end;i=1;for_end=j; if (i<=for_end)do result[0].data[i] = ss[0+i-1]; while(i++ < for_end);} } } #ifdef ANSI void zsubstring( varstring *result, varstring ss, integer start, integer length) #else /* not ANSI*/ void zsubstring( result, ss, start, length) varstring *result; varstring ss; integer start; integer length; #endif /* ANSI*/ { sptr i; result[0] = blank; if(((start<=0)||(length<0)||(start+length>ss.len+1))) { fprintf( *output, "%s%s%c", "Error: ", "Impossible substring", '\n'); error(); } else{ result[0].len = length; {register integer for_end;i=1;for_end=length; if (i<=for_end)do result[0].data[i] = ss.data[i-1+start]; while(i++ < for_end);} } } #ifdef ANSI void zappend( varstring *head, varstring tail) #else /* not ANSI*/ void zappend( head, tail) varstring *head; varstring tail; #endif /* ANSI*/ { integer k; if((head[0].len+tail.len>maxstring)) { fprintf( *output, "%s%s%c", "Error: ", "string too long", '\n'); error(); } else{ {register integer for_end;k=1;for_end=tail.len; if (k<=for_end)do head[0].data[k+head[0].len] = tail.data[k]; while(k++ < for_end);} head[0].len = head[0].len+tail.len; } } #ifdef ANSI void zaddchar( varstring *s, char c) #else /* not ANSI*/ void zaddchar( s, c) varstring *s; char c; #endif /* ANSI*/ { if(s[0].len>=maxstring) { fprintf( *output, "%s%s%c", "Error: ", "string too long", '\n'); error(); } else{ s[0].len = s[0].len+1; s[0].data[s[0].len] = c; } } #ifdef ANSI boolean zequals( varstring s, varstring t) #else /* not ANSI*/ boolean zequals( s, t) varstring s; varstring t; #endif /* ANSI*/ { register boolean Result;ccharpointer c,d; c = s.data; c = c+1; d = t.data; d = d+1; if((s.len!=t.len)) Result = false; else Result = (strncmp(c,d,s.len)==0); return(Result); } #ifdef ANSI void zprintcommand( varstring pattern, integer val, char control) #else /* not ANSI*/ void zprintcommand( pattern, val, control) varstring pattern; integer val; char control; #endif /* ANSI*/ { varstring ss; splice(ss,pattern,val); printstring(printfile,ss,control); } #ifdef ANSI void zprintstring( text f, varstring ss, char control) #else /* not ANSI*/ void zprintstring( f, ss, control) text f; varstring ss; char control; #endif /* ANSI*/ { sptr i; boolean iscon; char cc; iscon = false; {register integer for_end;i=1;for_end=ss.len; if (i<=for_end)do { cc = ss.data[i]; if(iscon) { if((cc!=control)) cc = chr(ord(cc)%32); iscon = false; fprintf( *f, "%c", cc); } else if(((cc==control)&&(control!=' '))) iscon = true; else fprintf( *f, "%c", cc); } while(i++ < for_end);} } #ifdef ANSI void zsplice( varstring *out, varstring source, integer nn) #else /* not ANSI*/ void zsplice( out, source, nn) varstring *out; varstring source; integer nn; #endif /* ANSI*/ { integer i; char cc; varstring tail; i = ssearch(source,ampand,1); if((i==0)) out[0] = source; else{ substring(out[0],source,1,i-1); substring(tail,source,i+2,source.len-i-1); cc = source.data[i+1]; intstring(out[0],nn,cc); append(out[0],tail); } } #ifdef ANSI void zintstring( varstring *result, integer n, char cc) #else /* not ANSI*/ void zintstring( result, n, cc) varstring *result; integer n; char cc; #endif /* ANSI*/ { integer nn; if((cc=='O')) intbase(result[0],n,8); else if((cc=='H')) intbase(result[0],n,16); else if((cc=='D')) intbase(result[0],n,10); else if((cc=='B')&&(n>=0)&&(n<=255)) addchar(result[0],chr(n)); else if((cc=='B')) { fprintf( *output, "%s%s%c", "Error: ", "Out-of-range byte", '\n'); error(); } else if((cc=='W')) { if((n>=0)&&(n<=32767)) { addchar(result[0],chr(n/256)); addchar(result[0],chr(n%256)); } else if((n<0)&&(n>-32768L)) { nn = n+65536L; addchar(result[0],chr(nn/256)); addchar(result[0],chr(nn%256)); } else{ fprintf( *output, "%s%s%c", "Error: ", "Out-of-range word", '\n'); error(); } } else{ fprintf( *output, "%s%s%c", "Error: ", "Int_string called with illegal type", '\n'); error(); } } #ifdef ANSI void zintbase( varstring *result, integer nn, byte s) #else /* not ANSI*/ void zintbase( result, nn, s) varstring *result; integer nn; byte s; #endif /* ANSI*/ { integer nh; nh = nn; if(nh<0) { addchar(result[0],'-'); nh = - (integer)nh; } if(nh>=s) { intbase(result[0],nh/s,s); nh = nh%s; } if(nh>=10) addchar(result[0],chr(nh+55)); else addchar(result[0],chr(nh+48)); } #ifdef ANSI void zupcase( varstring *ss) #else /* not ANSI*/ void zupcase( ss) varstring *ss; #endif /* ANSI*/ { sptr i; byte ch; {register integer for_end;i=1;for_end=ss[0].len; if (i<=for_end)do { ch = ord(ss[0].data[i]); if(((ch>=97)&&(ch<=122))) ss[0].data[i] = chr(ch-32); } while(i++ < for_end);} } #ifdef ANSI integer zstoi( integer xwzdefault, boolean insist) #else /* not ANSI*/ integer zstoi( xwzdefault, insist) integer xwzdefault; boolean insist; #endif /* ANSI*/ { register integer Result;/*732*/integer value,sig; value = xwzdefault; sig = 1; while(((finger<=buffer.len)&&(ch==32))){ finger = finger+1; ch = ord(buffer.data[finger]); } if((ch==43)) { finger = finger+1; ch = ord(buffer.data[finger]); } else if((ch==45)) { sig = -1; { finger = finger+1; ch = ord(buffer.data[finger]); } } thumb = finger; if((finger<=buffer.len)&&((ch>=48)&&(ch<=57))) { value = 0; while(((finger<=buffer.len)&&((ch>=48)&&(ch<=57)))){ value = value*10+(ord(ch)-48); { finger = finger+1; ch = ord(buffer.data[finger]); } } value = value*sig; } else if(insist) { { fprintf( *output, "%s%s%c", "Error: ", "Integer expected ", '\n'); error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } else if(((sig==-1)&&(45==45))) if((finger>1)) { finger = finger-1; ch = ord(buffer.data[finger]); } lab732:Result = value; return(Result); } #ifdef ANSI void zgetname( varstring *val) #else /* not ANSI*/ void zgetname( val) varstring *val; #endif /* ANSI*/ { while(((finger<=buffer.len)&&((ch==32)||(ch==61)))){ finger = finger+1; ch = ord(buffer.data[finger]); } thumb = finger; while(((finger<=buffer.len)&&!((ch==32)||(ch==45)))){ finger = finger+1; ch = ord(buffer.data[finger]); } substring(val[0],buffer,thumb,finger-thumb); } #ifdef ANSI sptr zssearch( varstring s, char target, integer go) #else /* not ANSI*/ sptr zssearch( s, target, go) varstring s; char target; integer go; #endif /* ANSI*/ { register sptr Result;/*732*/integer nn,gg; gg = abs(go); nn = 0; if((gg>s.len)||(go==0)) { fprintf( *output, "%s%s%c", "Error: ", "Impossible search", '\n'); error(); } else{ if((go>0)) { {register integer for_end;nn=gg;for_end=s.len; if (nn<=for_end)do if((s.data[nn]==target)) goto lab732; while(nn++ < for_end);} } else{ {register integer for_end;nn=gg;for_end=1; if (nn>=for_end)do if((s.data[nn]==target)) goto lab732; while(nn-- > for_end);} } nn = 0; } lab732:Result = nn; return(Result); } #ifdef ANSI void zroundIMh( byte code) #else /* not ANSI*/ void zroundIMh( code) byte code; #endif /* ANSI*/ { integer stop,diff,n,m,delta,newIMh,roundedh; roundedh = round(hconv*(Dh+Dlmargin)); delta = Dh-Dhright; if((delta>thinspace)||(delta<=-4*thinspace)) newIMh = roundedh; else newIMh = IMhright+round(hconv*(delta)); if(!fixedwidth) { if((newIMh>roundedh+2)) newIMh = roundedh+2; else if((newIMhthinspace)&&(newIMh0)&&(curscheme<=maxplain)))) newIMh = IMhright+gapwidth; else if((delta>-2*thinspace)) { if((newIMh=for_end)do { diff = Dh-Dhstack[n]; if(abs(diff)<=abs(delta)) { m = n; delta = diff; } } while(n-- > for_end);} if((delta>thinspace)&&(newIMhIMhstack[m]-gapwidth)) newIMh = IMhstack[m]-gapwidth; else if(abs(delta)<=thinspace) newIMh = IMhstack[m]; } if(justpushed) { Dhmid = Dh; IMhmid = newIMh; justpushed = false; } IMh = newIMh; } #ifdef ANSI void zsetPRfont( integer newfont) #else /* not ANSI*/ void zsetPRfont( newfont) integer newfont; #endif /* ANSI*/ { if((newfont==PRfont)||onlyonefont) ; else{ printcommand(fontcommand,newfont,ctrlflag); PRfont = newfont; } } #ifdef ANSI void zsetvabs( integer mm) #else /* not ANSI*/ void zsetvabs( mm) integer mm; #endif /* ANSI*/ { integer newpos; if(absisincr) newpos = mm-PRv; else newpos = mm; printcommand(vabscom,newpos,ctrlflag); PRv = mm; } #ifdef ANSI void zsethabs( integer mm) #else /* not ANSI*/ void zsethabs( mm) integer mm; #endif /* ANSI*/ { integer newpos; if(absisincr) newpos = mm-PRh; else newpos = mm; printcommand(habscom,newpos,ctrlflag); PRh = mm; } #ifdef ANSI boolean zopenandask( bytefile ff, integer *fc, varstring *name, varstring *xwzdefault, boolean ask) #else /* not ANSI*/ boolean zopenandask( ff, fc, name, xwzdefault, ask) bytefile ff; integer *fc; varstring *name; varstring *xwzdefault; boolean ask; #endif /* ANSI*/ { register boolean Result;boolean success,fail; varstring defdir,defnam,defex,trydir,trynam,tryex; success = false; fail = false; do{parsefile(xwzdefault[0],defdir,defnam,defex); parsefile(name[0],trydir,trynam,tryex); if((trydir.len==0)) name[0] = defdir; else name[0] = trydir; append(name[0],trynam); if((tryex.len==0)) append(name[0],defex); else append(name[0],tryex); success = openbinary(ff,name[0],fc[0]); if(success) fc[0] = 0; else if(ask) { fprintf( *output, "%s", "Couldnt open file: "); printstring(output,name[0],' '); fprintf( *output, "%c%c", ' ', '\n'); if(true) { { fprintf( *output, "%s%c", "Please type a replacement or NO to abandon search", '\n'); readterminal(); } name[0] = buffer; if(((name[0].len==2)&&((name[0].data[1]=='N')||(name[0].data[1]=='n')) &&((name[0].data[2]=='O')||(name[0].data[2]=='o')))) fail = true; } else fail = true; } else fail = true; }while( ! (success||fail) ); Result = success; return(Result); } #ifdef ANSI real zrrreadreal( bytefile ffile, integer *findx) #else /* not ANSI*/ real zrrreadreal( ffile, findx) bytefile ffile; integer *findx; #endif /* ANSI*/ { register real Result;integer a,b; a = readinteger(ffile,findx[0],-4); b = readinteger(ffile,findx[0],-4); if(b<=0) { { fprintf( *output, "%s%s%c", "Error: ", "Denominator <= 0! ", '\n'); error(); } Result = 1; } else Result = a/ ((double)b); return(Result); } #ifdef ANSI void setrule(void) #else /* not ANSI*/ void setrule() #endif /* ANSI*/ { integer Dp,Dq; Dp = readinteger(dvifile,dviindx,-4); Dq = readinteger(dvifile,dviindx,-4); if((Dp<=0)||(Dq<=0)) ; else if((Dp*vconv<=postheight/ ((double)2))) dorail(Dp,Dq); else dopost(Dp,Dq); } #ifdef ANSI void zchangefont( integer Dnew) #else /* not ANSI*/ void zchangefont( Dnew) integer Dnew; #endif /* ANSI*/ { Dfont = 0; fontnum[nf] = Dnew; while((fontnum[Dfont]!=Dnew))Dfont = Dfont+1; if(Dfont==nf) { fprintf( *output, "%s%s%*d%c", "Error: ", "Undefined font called for, number ", 1, Dnew, '\n'); error(); } curscheme = scheme[Dfont]; thinspace = fontspace[Dfont]; } #ifdef ANSI void zdefinefont( integer Dnew) #else /* not ANSI*/ void zdefinefont( Dnew) integer Dnew; #endif /* ANSI*/ { /*9999 9998*/integer scalesize,designsize,k,f; byte dirlen,namlen; real fontmag; boolean fontok; integer TFMcheck,lh,nw; byte fn,ck; varstring tryname,tfmscheme; integer inwidth[256]; byte widptr[256]; byte b3,b2,b1,b0; integer alpha,beta,z; Dcheck = readinteger(dvifile,dviindx,-4); scalesize = readinteger(dvifile,dviindx,-4); designsize = readinteger(dvifile,dviindx,-4); dirlen = readinteger(dvifile,dviindx,1); namlen = readinteger(dvifile,dviindx,1); namlen = namlen+dirlen; if(namlen==0) { fprintf( *output, "%s%s%c", "Error: ", "Null font name! ", '\n'); error(); } else if(namlen>=maxstring) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%*d%c", "Error: ", "Too-long font name! length = ", 1, namlen, '\n'); error(); } goto lab9999; } tfmname = blank; {register integer for_end;k=1;for_end=namlen; if (k<=for_end)do { tfmname.data[k] = chr(readbyte(dvifile,dviindx)); } while(k++ < for_end);} tfmname.len = namlen; fontname = tfmname; if((scalesize<=0)||(scalesize>=134217728L)) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%*d%s%c", "Error: ", "Bad scale (", 1, scalesize, ")!", '\n'); error(); } goto lab9999; } else if((designsize<=0)||(designsize>=134217728L)) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%*d%s%c", "Error: ", "Bad design size (", 1, designsize, ")!", '\n'); error(); } goto lab9999; } fontmag = scalesize/ ((double)designsize); if((fontmag>1000)||(fontmag<0.001)) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%E%c", "Error: ", "Way-out font magnification!!! ", fontmag, '\n'); error(); } goto lab9999; } if(nf==maxDfonts) { fprintf( *output, "%s%s%*d%s%c", "Fatal: ", "Capacity exceeded (max fonts=", 1, maxDfonts, ")!", '\n'); crash(); } fontnum[nf] = Dnew; f = 0; while((fontnum[f]!=Dnew))f = f+1; if(f=8388608L)){ z = z/2; beta = beta/2; } tryname = tfmname; upcase(tryname); fontspace[nf] = round(fontspace[nf]*0.99); tfmindx = TFMFILEPATH; fontok = openandask(tfmfile,tfmindx,tfmname,tfmdef,true); if(!fontok) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%c", "Error: ", "TFM file can't be opened!", '\n'); error(); } goto lab9999; } skipbytes(tfmfile,tfmindx,2); lh = readinteger(tfmfile,tfmindx,2); firstch[nf] = readinteger(tfmfile,tfmindx,2); lastch[nf] = readinteger(tfmfile,tfmindx,2); if((lastch[nf]maxDchar)) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%*d%s%*d%c", "Error: ", "Illegal values for first_char and/or last_char, first_char = ", 1, firstch[nf], " last_char = ", 1, lastch[nf], '\n') ; error(); } goto lab9999; } nw = readinteger(tfmfile,tfmindx,2); if((nw==0)||(nw>256)) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%d%c", "Error: ", "Illegal value for nw, nw= ", nw, '\n'); error(); } goto lab9999; } skipbytes(tfmfile,tfmindx,14); TFMcheck = readinteger(tfmfile,tfmindx,-4); skipbytes(tfmfile,tfmindx,4); tfmscheme = blank; if(lh<2) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%c", "Error: ", "Header must have at least 2 words", '\n'); error(); } goto lab9999; } else if(lh==2) ; else{ ck = readbyte(tfmfile,tfmindx); if((ck>=40)||(ck>4*lh-9)) skipbytes(tfmfile,tfmindx,4*lh-9); else{ tfmscheme.len = ck; {register integer for_end;k=1;for_end=ck; if (k<=for_end)do tfmscheme.data[k] = chr(readbyte(tfmfile,tfmindx)); while(k++ < for_end);} skipbytes(tfmfile,tfmindx,4*lh-ck-9); upcase(tfmscheme); } } fn = namesearch(tryname); if((fn==0)) { k = tryname.len; while(((ord(tryname.data[k])>=48)&&(ord(tryname.data[k])<=57))){ tryname.data[k] = ' '; k = k-1; } tryname.len = k; fn = namesearch(tryname); if((fn==0)) fn = namesearch(tfmscheme); } if((fn==0)&&candlfont) ; else if((fn==0)) { printstring(output,fontname,' '); fprintf( *output, "%c%c", ':', '\n'); if((tfmscheme.len>0)) { fprintf( *output, "%s%s%c", "Error: ", "Unknown coding scheme, using TEX TEXT instead", '\n'); error(); } else{ fprintf( *output, "%s%s%c", "Error: ", "No coding scheme, using TEX TEXT instead (examine NOSCHEME.ADD) ", '\n') ; error(); } scheme[nf] = schememap[3]; } else scheme[nf] = schememap[fn]; {register integer for_end;k=firstch[nf];for_end=lastch[nf]; if (k<=for_end) do { widptr[k] = readbyte(tfmfile,tfmindx); skipbytes(tfmfile,tfmindx,3); if(widptr[k]>nw) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%d%c", "Error: ", "Impossible width ", widptr[k], '\n'); error(); } goto lab9999; } } while(k++ < for_end);} {register integer for_end;k=0;for_end=nw-1; if (k<=for_end)do { b0 = readbyte(tfmfile,tfmindx); b1 = readbyte(tfmfile,tfmindx); b2 = readbyte(tfmfile,tfmindx); b3 = readbyte(tfmfile,tfmindx); inwidth[k] = (((((b3*z)/256)+(b2*z))/256)+(b1*z))/beta; if(b0==255) inwidth[k] = inwidth[k]-alpha; else if(b0!=0) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%c", "Error: ", "Out-of-bounds value for b0", '\n'); error(); } goto lab9999; } } while(k++ < for_end);} if(inwidth[0]!=0) { printstring(output,fontname,' '); fprintf( *output, "%s", " ---- "); { fprintf( *output, "%s%s%c", "Error: ", "First width should be zero ", '\n'); error(); } goto lab9999; } {register integer for_end;k=firstch[nf];for_end=lastch[nf]; if (k<=for_end) do Dwidth[nf][k] = inwidth[widptr[k]]; while(k++ < for_end);} lab9998:{register integer for_end;k=firstch[nf];for_end=lastch[nf]; if (k<= for_end)do if((Dwidth[nf][k]<0)||(Dwidth[nf][k]>50000000L)) { { fprintf( *output, "%s%s%*d%s%*d%c", "Error: ", "Way-out width = ", 1, Dwidth[nf][k], "DVI units, character number ", 1, k, '\n') ; error(); } codes[scheme[nf]][k].breadth = -32766; } while(k++ < for_end);} if((Dcheck!=0)&&(TFMcheck!=0)&&(Dcheck!=TFMcheck)) { { fprintf( *output, "%s%s%c", "Error: ", "Check sums do not agree!", '\n'); error(); } fprintf( *output, "%s%d%s%d%c", "DVI check was: ", Dcheck, " TFM check was: ", TFMcheck, '\n'); fprintf( *output, "%s", " "); } fontmag = (fontmag-1)*100.0; if(!quiet) { fprintf( *output, "%c%c", ' ', '\n'); printstring(output,fontname,' '); fprintf( *output, "%s%*d%s", " --- loaded at ", 1, scalesize, " DVI units"); if(abs(fontmag)>1) fprintf( *output, "%s%*d%s", " ( magnified ", 1, round(fontmag), "%)"); fprintf( *output, "%c%c", ' ', '\n'); } nf = nf+1; lab9999:if(fontok) ; } #ifdef ANSI void zsetcharacter( integer cnum) #else /* not ANSI*/ void zsetcharacter( cnum) integer cnum; #endif /* ANSI*/ { codeobject cod; integer di; if(curscheme==0) ; else if((cnumlastch[Dfont])) { { fprintf( *output, "%s%s%*d%s%*d%c", "Error: ", "Character ", 1, cnum, " invalid in font number ", 1, fontnum[Dfont], '\n') ; error(); } } else{ cod = codes[curscheme][cnum]; if(cod.breadth!=-32766) { roundIMh(cnum); if(cod.breadth==-32765) ; dosetchar(IMv,IMh,cod); Ddis = Dwidth[Dfont][cnum]; if(cod.breadth==-32766) IMdis = 0; else IMdis = abs(cod.breadth); railbase = IMv*railtypes; Dhright = Dh+Ddis; IMhright = IMh+IMdis; } } } #ifdef ANSI void zdosetchar( iword Setv, iword Seth, codeobject cod) #else /* not ANSI*/ void zdosetchar( Setv, Seth, cod) iword Setv; iword Seth; codeobject cod; #endif /* ANSI*/ { iword ki,kk,tempv,temph; codeobject mc; short kptr; if(cod.breadth>=0) { if((Sethhmax)) { { fprintf( *output, "%s%s%c", "Error: ", "Out of bounds --right", '\n') ; error(); } Seth = hmax; } if((Setvvmax)) { { fprintf( *output, "%s%s%c", "Error: ", "Out of bounds -- vertical ", '\n'); error(); } Setv = vmax; } if(Hshunt>(Seth-3)) Hshunt = (Seth-3); { if(((Oldv>Setv)||((Oldv==Setv)&&(Oldh>Seth)))) { pool[runptr].prox = zzz; runptr = pool[run].prox; cell = cell+1; pool[midptr].prox = cell; midptr = cell; pool[midptr].down = runptr; runptr = run; pool[run].prox = zzz; } cell = cell+1; pool[runptr].prox = cell; runptr = cell; { pool[runptr].hpos = Seth; Oldh = Seth; pool[runptr].vpos = Setv; Oldv = Setv; pool[runptr].symbol = cod; } pagesize = pagesize+1; if(pagesize>=pagemax) { fprintf( *output, "%s%s%c", "Fatal: ", "Overflowed page: either a bug, or recompile with larger page_max", '\n') ; crash(); } } } else if(cod.breadth==-32766) ; else{ if((cod.multi<=0)||(cod.multi>topofligs)) { fprintf( *output, "%s%s%c", "Error: ", "Illegal value of char in multi-character command", '\n'); error(); } else{ kptr = cod.multi; if((ligatures[kptr].guard!=-32767)) { fprintf( *output, "%s%s%c", "Error: ", "Sentry not found in Kerns ", '\n'); error(); } ki = ligatures[kptr].num; kptr = kptr-2*ki; if((ki<=0)||(kptr<0)) { fprintf( *output, "%s%s%c", "Error: ", "Illegal value of k_i in multi-character command", '\n'); error(); } {register integer for_end;kk=1;for_end=ki; if (kk<=for_end)do { tempv = Setv+ligatures[kptr].vmove; temph = Seth+ligatures[kptr].hmove; kptr = kptr+1; mc = ligatures[kptr].symbol; dosetchar(tempv,temph,mc); kptr = kptr+1; } while(kk++ < for_end);} } } } #ifdef ANSI void zrowchar( integer context, codeobject *value) #else /* not ANSI*/ void zrowchar( context, value) integer context; codeobject *value; #endif /* ANSI*/ { /*732*/ #define obra 123 #define oket 125 #define hbra 91 #define hket 93 #define vbra 60 #define vket 62 ligthing ligbuff[maxbuf + 1]; unsigned char bufnum; unsigned char buflen; iword deltah,deltav; byte ch,bra; integer i; codeobject rowcod; integer printwidth; value[0].breadth = charwidth; value[0].IMfont = rowfont; { finger = finger+1; ch = ord(buffer.data[finger]); } if((context==0)&&(ch!=32)&&(ch!=90)) { { fprintf( *output, "%s%s%c", "Error: ", "Character specifiers must start with at least one space", '\n') ; error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } while(((finger<=buffer.len)&&(ch==32))){ finger = finger+1; ch = ord(buffer.data[finger]); } if(!(finger<=buffer.len)) { { fprintf( *output, "%s%s%c", "Error: ", "Fallen off row", '\n'); error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } if((ch==65)) value[0].IMchar = 64; else if((ch==83)) value[0].IMchar = 32; else if((ch==81)) value[0].IMchar = 39; else if((ch==87)) value[0].IMchar = 34; else if((ch==69)) value[0].IMchar = 127; else if((ch==39)||(ch==34)||(ch==64)||(ch==127)) { { fprintf( *output, "%s%s%c", "Error: ", "Bad character---Rejected", '\n'); error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } else if((ch==32)) { { fprintf( *output, "%s%s%c", "Error: ", "Space found out of context", '\n'); error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } else if((ch==90)) value[0].breadth = -32766; else if((ch==76)) { { finger = finger+1; ch = ord(buffer.data[finger]); } value[0].IMchar = ch; } else if((ch==67)) { { finger = finger+1; ch = ord(buffer.data[finger]); } value[0].IMchar = ch%32; } else if((context>=250)) value[0].IMchar = ch; else if((ch==77)) { rowchar(250,value[0]); value[0].IMchar = value[0].IMchar+128; } else if(((ch==78)||(ch==68))&&(context>=230)) { { fprintf( *output, "%s%s%c", "Error: ", "Narrow or Down escape out of context", '\n'); error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } else if((ch==78)) { rowchar(230,value[0]); value[0].breadth = 0; } else if((ch==68)) { rowchar(230,value[0]); value[0].breadth = -32765; } else if((ch==70)) { rowfont = stoi(0,true); if((context==0)) rowchar(1,value[0]); else rowchar(context,value[0]); } else if((ch==obra)||(ch==hbra)||(ch==vbra)) { if((context>=ch)) { { fprintf( *output, "%s%s%c", "Error: ", "Illegal nesting of brackets in row_spec", '\n'); error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } {register integer for_end;i=1;for_end=maxbuf; if (i<=for_end)do ligbuff[i].symbol = nochar; while(i++ < for_end);} buflen = 0; deltah = 0; deltav = 0; bra = ch; do{rowchar(bra,rowcod); if((rowcod.breadth==-32764)) deltav = deltav-charht; else if((rowcod.breadth==-32763)) ; else if((buflen+3>maxbuf)) { fprintf( *output, "%s%s%c", "Fatal: ", "Overflowed lig_buff array", '\n'); crash(); } else if((rowcod.breadth==-32762)) deltah = deltah-stoi(0,true); else if((rowcod.breadth==-32761)) deltav = deltav-stoi(0,true); else{ buflen = buflen+1; ligbuff[buflen].vmove = deltav; ligbuff[buflen].hmove = deltah; buflen = buflen+1; ligbuff[buflen].symbol = rowcod; if((bra==vbra)) deltav = deltav+charht; if(((bra==hbra)||(batchview&&(bra==obra)))) deltah = deltah+charwidth; } }while( ! ((rowcod.breadth==-32763)||!(finger<=buffer.len)) ); bufnum = 0; if((buflen==0)) value[0].breadth = -32766; else if((topofligs+buflen+1>=maxligs)) { fprintf( *output, "%s%s%c", "Fatal: ", "Ligature array overflowed, must recompile with larger array", '\n') ; crash(); } else{ {register integer for_end;i=1;for_end=buflen; if (i<=for_end)do ligatures[topofligs+i] = ligbuff[i]; while(i++ < for_end);} topofligs = topofligs+buflen+1; bufnum = buflen/2; ligatures[topofligs].num = bufnum; ligatures[topofligs].guard = -32767; value[0].multi = topofligs; value[0].breadth = -20000; } if((bra==obra)) printwidth = charwidth; else if((bra==hbra)) printwidth = deltah; else{ printwidth = charwidth; {register integer for_end;i=1;for_end=bufnum; if (i<=for_end)do if((printwidth<- (integer)ligbuff[2*i].symbol.breadth)&&(ligbuff[2*i] .symbol.breadth>-30000)) printwidth = - (integer)ligbuff[2*i].symbol.breadth; while(i++ < for_end);} } value[0].breadth = - (integer)printwidth; } else if((ch==85)&&(context==vbra)) value[0].breadth = -32764; else if((ch==85)) { { fprintf( *output, "%s%s%c", "Error: ", "U escape out of context", '\n') ; error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } else if(((ch==oket)||(ch==hket)||(ch==vket))&&(context==ch-2)) value[0].breadth = -32763; else if((ch==oket)||(ch==hket)||(ch==vket)) { { fprintf( *output, "%s%s%c", "Error: ", "Mismatching brackets ", '\n'); error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } else if((ch==75)&&(context==hbra)) value[0].breadth = -32762; else if((ch==75)&&(context==vbra)) value[0].breadth = -32761; else if((ch==75)) { { fprintf( *output, "%s%s%c", "Error: ", "Kern escape out of context", '\n'); error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } else value[0].IMchar = ch; lab732:; } #ifdef ANSI void parsecommand(void) #else /* not ANSI*/ void parsecommand() #endif /* ANSI*/ { /*732*/byte key; buffer = command; finger = 0; { finger = finger+1; ch = ord(buffer.data[finger]); } while((finger<=buffer.len)){ while(((finger<=buffer.len)&&(ch==32))){ finger = finger+1; ch = ord(buffer.data[finger]); } if((finger<=buffer.len)&&(ch==45)) { { finger = finger+1; ch = ord(buffer.data[finger]); } thumb = finger; if(((ch>=97)&&(ch<=122))) ch = ch-32; key = ch; { finger = finger+1; ch = ord(buffer.data[finger]); } while(((finger<=buffer.len)&&((ch==32)||(ch==61)))){ finger = finger+1; ch = ord(buffer.data[finger]); } if((key==81)) quiet = true; else if((key==83)) squash = true; else if((key==82)) runon = true; else if((key==80)) getname(printname); else if((key==68)) getname(tfmdef); else if((key==70)) firstpage = stoi(firstpage,true); else if((key==67)) countpages = stoi(countpages,true); else if((key==77)) magnify = stoi(magnify,true); else if((key==88)) hmag = stoi(hmag,true); else if((key==89)) vmag = stoi(vmag,true); else if((key==66)) batchview = true; else if((key==73)) { inspection = true; pausei = stoi(pausesteps,false); if(((pausei<0)||(pausei>200))) { { fprintf( *output, "%s%s%c", "Error: ", "Illegal value for I flag", '\n'); error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } else pausesteps = pausei; pausei = 0; } else{ { fprintf( *output, "%s%s%c", "Error: ", "Unknown command ", '\n'); error(); } printstring(output,buffer,' '); fprintf( *output, "%c%c", ' ', '\n'); fprintf( *output, "%*c%c", thumb, '^', '\n'); goto lab732; } } else if((finger<=buffer.len)) { if((dviname.len>0)) { { fprintf( *output, "%s%s%c", "Error: ", "Two filenames. Previous name will be ignored, it was:", '\n') ; error(); } printstring(output,dviname,' '); fprintf( *output, "%c%c", ' ', '\n'); } getname(dviname); } lab732:; } } #ifdef ANSI void zmovedown( integer ddd) #else /* not ANSI*/ void zmovedown( ddd) integer ddd; #endif /* ANSI*/ { integer newIMv,delta; Dv = Dv+ddd; delta = round(vconv*(ddd)); if(delta>=bigdrop) { newIMv = round(vconv*(Dv+Dtopmargin)); if((newIMvIMv-bigdrop)) IMv = IMv-bigdrop; else IMv = newIMv; railbase = IMv*railtypes; } else{ IMv = IMv+delta; railbase = railbase+round(vconv*(ddd*railtypes)); if((ddd>tinydrop)&&(delta==0)) IMv = IMv+1; else if((ddd<- (integer)tinydrop)&&(delta==0)) IMv = IMv-1; else railbase = IMv*railtypes; } } #ifdef ANSI link readline(void) #else /* not ANSI*/ link readline() #endif /* ANSI*/ { register link Result;link head,tail; integer size; head = curpgeptr; size = 0; PRvnext = pool[curpgeptr].vpos; do{tail = curpgeptr; curpgeptr = pool[curpgeptr].prox; size = size+1; if(size==maxlinesize) { fprintf( *output, "%s%s%c", "Error: ", "Excessively long line ", '\n'); error(); } }while( ! ((((curpgeptr==zzz))||(PRvnext!=pool[curpgeptr].vpos))) ); pool[tail].prox = zzz; Result = head; return(Result); } #ifdef ANSI void zdoline( link lineptr, integer depth) #else /* not ANSI*/ void zdoline( lineptr, depth) link lineptr; integer depth; #endif /* ANSI*/ { link overflow; if((PRvnext0)) while((PRv+wlfeeddist<=PRvnext)){ fprintf( *printfile, "%c", '\n'); if(inspection) flush(printfile); if(dopause) { pausei = pausei+1; if((pausei>=pausesteps)) { { fprintf( *printfile, "%c", '\n'); if(inspection) flush(printfile); fprintf( *output, "%c%c", ' ', '\n'); } fprintf( *output, "%s", pauseask); readln(input); printstring(output,pauseafter,' '); pausei = 0; } } if(xwzfortran) fprintf( *printfile, "%c", feedchar); if(wldoescr) PRh = 0; PRv = PRv+wlfeeddist; if(squash) PRv = PRvnext; } else if(feedabsolute) setvabs(PRvnext); else{ while((PRvnext>=PRv+feeddist)){ fprintf( *printfile, "%c", feedchar); if(squash) PRv = PRvnext; else PRv = PRv+feeddist; } fprintf( *printfile, "%c", '\n'); if(inspection) flush(printfile); if(wldoescr) PRh = 0; } while((PRvnext>PRv)){ fprintf( *printfile, "%c", tfeedchar); PRv = PRv+tfeeddist; } overflow = zzz; while((lineptr!=zzz)){ PRhnext = pool[lineptr].hpos-Hshunt; if(!bspaceabsolute&&!bspacebystring&&(PRhnextPRh)) sethabs(PRhnext); else{ while((PRhnext>=PRh+spacedist)){ fprintf( *printfile, "%c", spacechar); PRh = PRh+spacedist; } while((PRhnext>PRh)){ fprintf( *printfile, "%c", tspacechar); PRh = PRh+tspacedist; } } } if(pool[lineptr].symbol.IMfont!=PRfont) setPRfont(pool[lineptr].symbol.IMfont); fprintf( *printfile, "%c", chr(pool[lineptr].symbol.IMchar)); PRh = PRh+pool[lineptr].symbol.breadth; tempp = lineptr; lineptr = pool[lineptr].prox; } } if((overflow==zzz)) { if(((!wldoescr)||feedabsolute||((!wantsplit)&&(bspaceabsolute||(crfeeddist 0)||(lmargin>0)))) sethabs(0); else{ fprintf( *printfile, "%c", crchar); PRh = 0; PRv = PRv+crfeeddist; } } } else{ if(xwzfortran) { fprintf( *printfile, "%c", '\n'); if(inspection) flush(printfile); fprintf( *printfile, "%c", crchar); PRh = 0; PRv = PRv+crfeeddist; } else if((bspaceabsolute&&((crfeeddist>0)||(lmargin>0)))) sethabs(0); else{ fprintf( *printfile, "%c", crchar); PRh = 0; PRv = PRv+crfeeddist; } if((depth=171)&&(Dcom<=234)) changefont(Dcom-171); else switch(Dcom) {case 128: case 129: case 130: case 131: { Dpar = readinteger(dvifile,dviindx,Dcom-127); setcharacter(Dpar); Dh = Dh+Ddis; IMh = IMh+IMdis; } break; case 132: { setrule(); Dh = Dh+Ddis; IMh = IMh+IMdis; } break; case 133: case 134: case 135: case 136: { Dpar = readinteger(dvifile,dviindx,Dcom-132); setcharacter(Dpar); } break; case 137: setrule(); break; case 138: ; break; case 140: endpage = true; break; case 141: push(); break; case 142: pop(); break; case 143: case 144: case 145: case 146: { Dpar = readinteger(dvifile,dviindx,143-Dcom-1); Dh = Dh+Dpar; } break; case 147: Dh = Dh+Dw; break; case 148: case 149: case 150: case 151: { Dpar = readinteger(dvifile,dviindx,148-Dcom-1); Dw = Dpar; Dh = Dh+Dw; } break; case 152: Dh = Dh+Dx; break; case 153: case 154: case 155: case 156: { Dpar = readinteger(dvifile,dviindx,153-Dcom-1); Dx = Dpar; Dh = Dh+Dx; } break; case 157: case 158: case 159: case 160: { Dpar = readinteger(dvifile,dviindx,157-Dcom-1); movedown(Dpar); } break; case 161: movedown(Dy); break; case 162: case 163: case 164: case 165: { Dpar = readinteger(dvifile,dviindx,162-Dcom-1); Dy = Dpar; movedown(Dy); } break; case 166: movedown(Dz); break; case 167: case 168: case 169: case 170: { Dpar = readinteger(dvifile,dviindx,167-Dcom-1); Dz = Dpar; movedown(Dz); } break; case 235: case 236: case 237: case 238: { Dpar = readinteger(dvifile,dviindx,Dcom-234); changefont(Dpar); } break; case 243: case 244: case 245: case 246: { Dpar = readinteger(dvifile,dviindx,Dcom-242); definefont(Dpar); } break; case 239: case 240: case 241: case 242: { Dpar = readinteger(dvifile,dviindx,Dcom-238); { fprintf( *output, "%s%s%c", "Error: ", "Cant do Special commands", '\n'); error(); } skipbytes(dvifile,dviindx,Dpar); } break; case 139: case 247: case 248: case 249: { fprintf( *output, "%s%s%s%*d%s%c", "Fatal: ", "Bad DVI file: ", "Byte: ", 1, Dcom, " out of context inside page", '\n') ; crash(); } break; case 250: case 251: case 252: case 253: case 254: case 255: { fprintf( *output, "%s%s%s%d%c", "Fatal: ", "Bad DVI file: ", "Illegal command byte, ", Dcom, '\n'); crash(); } break; } }while( ! (endpage) ); pop(); } #ifdef ANSI void Skippage(void) #else /* not ANSI*/ void Skippage() #endif /* ANSI*/ { byte Dcom; integer Dpar; boolean endpage; endpage = false; do{Dcom = readbyte(dvifile,dviindx); if((Dcom<128)||((Dcom<=234)&&(Dcom>=171))) ; else switch(Dcom) {case 128: case 129: case 130: case 131: skipbytes(dvifile,dviindx,Dcom-127); break; case 132: case 137: skipbytes(dvifile,dviindx,8); break; case 133: case 134: case 135: case 136: skipbytes(dvifile,dviindx,Dcom-132); break; case 138: ; break; case 140: endpage = true; break; case 141: case 142: ; break; case 143: case 144: case 145: case 146: skipbytes(dvifile,dviindx,Dcom-142); break; case 147: ; break; case 148: case 149: case 150: case 151: skipbytes(dvifile,dviindx,Dcom-147); break; case 152: ; break; case 153: case 154: case 155: case 156: skipbytes(dvifile,dviindx,Dcom-152); break; case 157: case 158: case 159: case 160: skipbytes(dvifile,dviindx,Dcom-156); break; case 161: ; break; case 162: case 163: case 164: case 165: skipbytes(dvifile,dviindx,Dcom-161); break; case 166: ; break; case 167: case 168: case 169: case 170: skipbytes(dvifile,dviindx,Dcom-166); break; case 235: case 236: case 237: case 238: skipbytes(dvifile,dviindx,Dcom-234); break; case 243: case 244: case 245: case 246: { Dpar = readinteger(dvifile,dviindx,Dcom-242); definefont(Dpar); } break; case 239: case 240: case 241: case 242: { Dpar = readinteger(dvifile,dviindx,Dcom-238); { fprintf( *output, "%s%s%c", "Error: ", "Cant do Special commands", '\n'); error(); } skipbytes(dvifile,dviindx,Dpar); } break; case 139: case 247: case 248: case 249: { fprintf( *output, "%s%s%s%*d%s%c", "Fatal: ", "Bad DVI file: ", "Byte: ", 1, Dcom, " out of context inside page", '\n') ; crash(); } break; case 250: case 251: case 252: case 253: case 254: case 255: { fprintf( *output, "%s%s%s%d%c", "Fatal: ", "Bad DVI file: ", "Illegal command byte, ", Dcom, '\n'); crash(); } break; } }while( ! (endpage) ); } #ifdef ANSI void readBOP(void) #else /* not ANSI*/ void readBOP() #endif /* ANSI*/ { byte k; integer Dpar; do{k = readbyte(dvifile,dviindx); if((k>=243)&&(k<=246)) { Dpar = readinteger(dvifile,dviindx,k-242); definefont(Dpar); k = 138; } }while( ! (k!=138) ); if(k==248) countpages = -1; else if(k!=139) { fprintf( *output, "%s%s%s%c", "Fatal: ", "Bad DVI file: ", "Byte is not BOP", '\n'); crash(); } else{ {register integer for_end;k=0;for_end=9; if (k<=for_end)do counter[k] = readinteger(dvifile,dviindx,-4); while(k++ < for_end);} skipbytes(dvifile,dviindx,4); } } #ifdef ANSI void zrow( integer scheme, integer rownum, iword firstfont) #else /* not ANSI*/ void zrow( scheme, rownum, firstfont) integer scheme; integer rownum; iword firstfont; #endif /* ANSI*/ { /*732*/integer n; codeobject codd; rowfont = firstfont; finger = 0; {register integer for_end;n=8*rownum;for_end=8*rownum+7; if (n<=for_end)do { rowchar(0,codd); if((codd.breadth==-32766)) ; else codes[scheme][n] = codd; } while(n++ < for_end);} lab732:; } #ifdef ANSI void Sendpage(void) #else /* not ANSI*/ void Sendpage() #endif /* ANSI*/ { link line; PRfont = -32767; PRh = 0; PRv = 0; while((!(curpgeptr==zzz))){ line = readline(); doline(line,0); } } void main_body() {*input = stdin; *output = stdout; blank.len = 0; {register integer for_end;ini=1;for_end=maxstring; if (ini<=for_end)do blank.data[ini] = padchar; while(ini++ < for_end);} setstring(".dvi",buffer); dvidef = buffer; setstring("/tex/fonts/.tfm",buffer); tfmdef = buffer; setstring("/tex/gfdir/.&Dgf",buffer); rasterdef = buffer; setstring(".lpr",buffer); printex = buffer; quiet = false; runon = false; squash = false; magnify = 100; hmag = 100; vmag = 100; batchview = false; firstpage = -1000000L; countpages = 1000000L; printname = blank; start = false; timetostop = false; pagegap = false; {register integer for_end;ini=0;for_end=9; if (ini<=for_end)do counter[ini] = 0; while(ini++ < for_end);} nf = 0; {register integer for_end;ini=0;for_end=maxDfonts; if (ini<=for_end)do { fontnum[ini] = 0; scheme[ini] = 0; firstch[ini] = 0; lastch[ini] = 0; fontspace[ini] = 0; } while(ini++ < for_end);} nochar.breadth = -32766; nochar.IMfont = 0; nochar.IMchar = 0; schemetop = 0; {register integer for_end;ini=0;for_end=maxcodes; if (ini<=for_end)do { knownschemes[ini] = blank; schememap[ini] = 0; {register integer for_end;inj=0;for_end=maxDchar; if (inj<=for_end)do { codes[ini][inj] = nochar; } while(inj++ < for_end);} } while(ini++ < for_end);} topofligs = 0; {register integer for_end;ini=1;for_end=maxligs; if (ini<=for_end)do ligatures[ini].symbol = nochar; while(ini++ < for_end);} hmax = hresolution*100; vmax = vresolution*100; hmin = 0; vmin = 0; cell = 0; cell = cell+1; mid = cell; cell = cell+1; left = cell; cell = cell+1; right = cell; cell = cell+1; run = cell; cell = cell+1; zzz = cell; pool[zzz].vpos = 32767; pool[zzz].prox = zzz; midptr = zzz; runptr = zzz; vstrcpy(deviceID,"Lineprinter "); list = false; xwzfortran = false; bfeedabsolute = false; bfeedbystring = false; feedabsolute = false; bfeedscream = true; bspaceabsolute = false; bspacebystring = false; spaceabsolute = false; absisincr = false; wldoescr = false; wantsplit = true; isheader = false; dopause = false; inspection = false; wlfeeddist = 1; crfeeddist = 0; feeddist = 1; tfeeddist = 1; bfeeddist = 0; tinydrop = 50000L; bigdrop = 4; spacedist = 1; tspacedist = 1; bspacedist = 1; pausei = 0; pausesteps = 20; feedchar = chr(10); tfeedchar = chr(10); crchar = chr(13); spacechar = chr(32); tspacechar = chr(32); bspacechar = chr(8); startstuff = blank; stopstuff = blank; pagetop = blank; bfeedstring = blank; fontcommand = blank; vabscom = blank; habscom = blank; pauseafter = blank; lmargin = 1.0; topmargin = 1.0; hfudge = 7.227/ ((double)5.25); vfudge = 2.0; setpaths(TFMFILEPATHBIT+TEXINPUTPATHBIT); wlfeeddist = 1; wldoescr = true; command = blank; getcommand(); dviname = blank; if((argc>1)) parsecommand(); if(true&&(dviname.len==0)) do{{ fprintf( *output, "%s%c", "DVI file name? ", '\n'); readterminal(); } getname(dviname); }while( ! ((dviname.len>0)) ); dviindx = TEXINPUTPATH; if(!openandask(dvifile,dviindx,dviname,dvidef,true)) { fprintf( *output, "%s%s%c", "Fatal: ", "couldnt open DVI file", '\n'); crash(); } if(!(argc>1)) if(true) { buffer = blank; { fprintf( *output, "%s%c", "First page? (default = print ALL pages) ", '\n'); readterminal(); } if((buffer.len>0)) firstpage = stoi(firstpage,true); { fprintf( *output, "%s%c", "Maximum no. of pages? (default = 1000000) ", '\n'); readterminal(); } if((buffer.len>0)) countpages = stoi(countpages,true); { fprintf( *output, "%s%c", "What magnification? (integer, percent, default=100%=DVI file mag)1", '\n') ; readterminal(); } if((buffer.len>0)) magnify = stoi(magnify,true); } setstring("TEX EXTENDED ASCII",buffer); setscheme(1); alphabet(32,95,1,1,32); setstring( " . {|v} Z Z & ~ {LC-} Z ", buffer); row(1,0,1); setstring( " Z Z Z {^|} {+_} {LO+} Z Z ", buffer); row(1,1,1); setstring( " Z Z Z Z Z Z {LOx} Z ", buffer); row(1,2,1); setstring( " [{L<-}-] [-{-L>}] {=/} Z {L<_} {L>_} {=_} [or] ", buffer); row(1,3,1); setstring("TEX TYPEWRITER TEXT",buffer); setscheme(2); alphabet(32,95,2,1,32); codes[2][127].IMchar = 34; setstring( " Z [{/_}{_\\}] {0-} [/\\] Z Z Z Z ", buffer); row(2,0,1); setstring( " Z Z Z Z _}> LY ", buffer); row(2,0,1); setstring( " {oI} {u|} Z {^|} {v|} Q ! ? ", buffer); row(2,1,1); setstring( " i j ` Q Z Z ", buffer); row(2,2,1); setstring( " , {LB_} [ae] [oe] {o/} [LALE] [LOLE] {LO/} ", buffer); row(2,3,1); setstring("TEX TEXT",buffer); setscheme(3); {register integer for_end;ini=0;for_end=127; if (ini<=for_end)do codes[3][ini] = codes[2][ini]; while(ini++ < for_end);} setstring( " Z Z Z [ff] [fi] [fl] [ffi] [ffl] ", buffer); row(3,1,1); setstring( " Z Z Z Z ! Z ? Z ", buffer); row(3,7,1); setstring( " Z Z Z Z W Z Z ", buffer); row(3,11,1); setstring( " Z Z Z - [--] W ~ W ", buffer); row(3,15,1); setstring("TEX TEXT WITHOUT F-LIGATURES",buffer); setscheme(4); {register integer for_end;ini=0;for_end=127; if (ini<=for_end)do codes[4][ini] = codes[3][ini]; while(ini++ < for_end);} setstring( " {oI} {u|} Z {^|} {v|} Q ! ? ", buffer); row(4,1,1); setstring("AEFMNOT ONLY",buffer); setscheme(5); setstring( " Z LA Z Z Z LE LF Z ", buffer); row(5,8,1); setstring( " Z Z Z Z Z LM LN LO ", buffer); row(5,9,1); setstring( " Z Z Z Z LT Z Z Z ", buffer); row(5,10,1); setstring("TEX MATH ITALIC",buffer); setscheme(6); {register integer for_end;ini=0;for_end=9; if (ini<=for_end)do codes[6][ini] = codes[2][ini]; while(ini++ < for_end);} alphabet(48,43,6,1,48); alphabet(97,26,6,1,97); setstring( " Z Z . , Z / Z * ", buffer); row(6,7,1); setstring("TEX MATH SYMBOLS",buffer); setscheme(7); alphabet(65,26,7,1,65); setstring( " - . {\\/} * {-:} Z {+_} ", buffer); row(7,0,1); setstring( " {LO+} {LO-} {LOx} {LO/} LO LO o o ", buffer); row(7,1,1); setstring( " Z {=_} Z Z {L<_} {L>_} {L<_} {L>_} ", buffer); row(7,2,1); setstring( " ~ Z Z [LL>] L< L> ", buffer); row(7,3,1); setstring( " [{L<-}-] [-{L>-}] {|^} {|v} Z Z Z Z ", buffer); row(7,4,1); setstring( " Z Z Z Z [{L<-}{-L>}] / \\ {~_} ", buffer); row(7,4,1); setstring( " [{L<=}=] [={L>=}] {|^} {|v} Z Z Z Z ", buffer); row(7,5,1); setstring( " Z Z Z Z [{L<=}{=L>}] Z Z Z ", buffer); row(7,5,1); setstring( " Q [oo] {L(-} {-L)} Z Z Z Z ", buffer); row(7,6,1); setstring( " Z Z Z Z [{/_}{_\\}] / Q ", buffer); row(7,6,1); setstring( " [{\\-}{-/}] ~ {0/} LR LT {|_}", buffer); row(7,7,1); setstring( " Z Z Z LU Z {LU+} & [or] ", buffer); row(7,11,1); setstring( " [{|-}-] [-{-|}] Z Z Z Z L{ L} ", buffer); row(7,12,1); setstring( " L< L> | [||] {^|v} {^|v} \\ Z ", buffer); row(7,13,1); setstring( " <[S_]{v/}> [{LI_}{LI_}] Z Z Z Z ", buffer); row(7,14,1); setstring( " {LS*} {|-} {|-_} {9|} Z Z Z Z ", buffer); row(7,15,1); setstring("TEX MATH EXTENSION",buffer); setscheme(8); setstring( " ZZZZ", buffer); row(8,0,1); setstring( " ZZZZ", buffer); row(8,1,1); setstring( " ZZZZ", buffer); row(8,2,1); setstring( " ZZZZ", buffer); row(8,3,1); setstring( " ZZZZ", buffer); row(8,4,1); setstring( " |L}> ZZZZ", buffer); row(8,5,1); setstring( " ZZZZ", buffer); row(8,6,1); setstring( " ZZZZ", buffer); row(8,7,1); setstring( " ZZZZ", buffer); row(8,8,1); setstring( " <[__]\\[{/_}_]> <[__][LILI]> ZZZZ", buffer); row(8,10,1); setstring( " ZZZZ", buffer); row(8,12,1); setstring( " ZZZZ", buffer); row(8,13,1); setstring( " / \\ ZZZZ", buffer); row(8,15,1); setstring( "ZZZZ ", buffer); row(8,0,1); setstring( "ZZZZ ", buffer); row(8,1,1); setstring( "ZZZZ ", buffer); row(8,2,1); setstring( "ZZZZ " ,buffer); row(8,3,1); setstring( "ZZZZ ", buffer); row(8,4,1); setstring( "ZZZZ " ,buffer); row(8,5,1); setstring( "ZZZZ ", buffer); row(8,6,1); setstring( "ZZZZ ]|> ", buffer); row(8,7,1); setstring( "ZZZZ ]/> ", buffer); row(8,8,1); setstring( "ZZZZ ", buffer); row(8,10,1); setstring( "ZZZZ ", buffer); row(8,12,1); setstring( "ZZZZ ", buffer); row(8,13,1); setstring( "ZZZZ \\ / ", buffer); row(8,15,1); setstring( " ZZZZ", buffer); row(8,9,1); setstring( "ZZZZ ZZ", buffer); row(8,9,1); setstring( "ZZZZZZ <[S_][{\\/}S{/\\}][|{\\/}|][{/\\}_{/\\}]> " ,buffer); row(8,9,1); setstring( " <[___]\\[SL>][{/_}__]> <[___][|S|][|S|][|S|]> ZZZZZ", buffer); row(8,11,1); setstring( "ZZZ <[S_][/S\\][|S|][|S|]> ZZZ", buffer); row(8,11,1); setstring( "ZZZZZ " ,buffer); row(8,11,1); setstring( " ZZZZZ", buffer); row(8,14,1); setstring( "ZZZ ZZZ", buffer); row(8,14,1); setstring( "ZZZZZ ", buffer); row(8,14,1); setstring("LATEX SYMBOLS",buffer); setscheme(9); setstring("LATEX CIRCLE",buffer); setscheme(10); setstring( " Z [L<|] [{L<_}|] [|L>] [|{L>_}] Z Z Z ", buffer); row(9,0,1); setstring( " [L<] [L>] Z Z Z Z Z Z ", buffer); row(9,5,1); setstring( " Z Z ~ ~ Z Z Z Z ", buffer); row(9,7,1); setstring("LATEX LINE",buffer); setscheme(11); setstring( " / | | | | | Z Z ", buffer); row(11,0,1); setstring( " / L< / v | v ^ v ", buffer); row(11,1,1); setstring( " / / L> / / ^ Z ^ ", buffer); row(11,2,1); setstring( " / L< / L< / L< L> Z ", buffer); row(11,3,1); setstring( " / / / / Z / Z Z ", buffer); row(11,4,1); setstring( " _ L< L> L< / L> Z L< ", buffer); row(11,5,1); setstring( " Z L> Z L> Z Z ^ L> ", buffer); row(11,6,1); setstring( " Z L< L> Z Z L< L> v ", buffer); row(11,7,1); setstring( " \\ | | | | | Z Z ", buffer); row(11,8,1); setstring( " \\ L< \\ ^ | ^ v ^ ", buffer); row(11,9,1); setstring( " \\ \\ L> \\ \\ v Z v ", buffer); row(11,10,1); setstring( " \\ L< \\ L< \\ L< L> Z ", buffer); row(11,11,1); setstring( " \\ \\ \\ \\ Z \\ Z Z " ,buffer); row(11,12,1); setstring( " _ L< L> L< \\ L> Z L< ", buffer); row(11,13,1); setstring( " Z L> Z L> Z Z Z L> ", buffer); row(11,14,1); setstring( " Z L< L> Z Z L< L> Z ", buffer); row(11,15,1); setstring("ADOBESTANDARDENCODING",buffer); setscheme(12); alphabet(32,95,12,1,32); setstring( " Z ! {LC/} $ / {Y=} f {LS*} ", buffer); row(12,20,1); setstring( " * Q W [L [fi] [fl] ", buffer); row(12,21,1); setstring( " Z - {|-} {|-_} . Z {9|} . ", buffer); row(12,22,1); setstring( " , [,,] W [L>L>] [...] [%.] Z ? ", buffer); row(12,23,1); setstring( " Z ` Q ^ ~ Z ", buffer); row(12,24,1); setstring( " Z , Z W , Z ", buffer); row(12,25,1); setstring( " [--] Z Z Z Z Z Z Z ", buffer); row(12,26,1); setstring( " Z [LALE] Z Z Z Z Z ", buffer); row(12,28,1); setstring( " L {O/} [OLE] Z Z Z Z ", buffer); row(12,29,1); setstring( " Z [ae] Z Z Z i Z Z ", buffer); row(12,30,1); setstring( " l {O/} [oe] {B_} Z Z Z Z ", buffer); row(12,31,1); setstring("ADOBESYMBOLENCODING",buffer); setscheme(13); alphabet(32,48,13,1,32); setstring( " Z Z [{\\-}{-/}] Z Z Z {)-}$ ", buffer); row(13,4,1); setstring( " {~=} Z Z X [{/_}{_\\}] Z {oI} S ", buffer); row(13,8,1); setstring( " Z Z v Z [/\\] Z Z Z ", buffer); row(13,9,1); setstring( " {O-} P _}> T Y Z Z ", buffer); row(13,10,1); setstring( " {u|} LZ L[ L] {|_} _ ", buffer); row(13,11,1); setstring( " Z Z Z Z Z Z Z ", buffer); row(13,12,1); setstring( " Z Z Z L{ | L} ~ Z ", buffer); row(13,15,1); setstring( " Z Z Q {L<_} / [oo] f Z ", buffer); row(13,20,1); setstring( " Z Z Z [{L<-}{-L>}] [{L<-}-] {^|} [-{-L>}] {|v} ", buffer); row(13,21,1); setstring( " o {+_} W {L>_} x Z d o ", buffer); row(13,22,1); setstring( " {-:} {=/} {=_} [...] [---] Z ", buffer); row(13,23,1); setstring( " Z Z Z Z {Ox} {O+} {O/} Z ", buffer); row(13,24,1); setstring( " LU Z Z Z Z Z {(-} {(-/} ", buffer); row(13,25,1); setstring( " {/_} {Or} {Oc} [TLM] . ", buffer); row(13,26,1); setstring( " ~ & [or] [{L<=}{=L>}] [{L<=}=] {^|} [={=L>}] {|v} ", buffer); row(13,27,1); setstring( " Z {Or} {Oc} [TLM] _}> ", buffer); row(13,28,1); setstring( " ", buffer); row(13,29,1); setstring( " Z ", buffer); row(13,30,1); setstring( " Z ", buffer); row(13,31,1); setstring("SYMBOL",buffer); setscheme(13); setstring("PSSYML",buffer); setscheme(13); setstring("PSSYMU",buffer); setscheme(14); {register integer for_end;ini=0;for_end=127; if (ini<=for_end)do codes[14][ini] = codes[13][ini+128]; while(ini++ < for_end);} if(batchview) { setstring( " Z Z [\\=] Z [L<=] [L>=] [==] [or] ", buffer); row(1,3,1); setstring( " Z [==] Z Z [L<=] [L>=] [L<=] [L>=] ", buffer); row(7,2,1); } railchars[1] = codes[1][95]; railchars[2] = codes[1][45]; postchar = codes[1][124]; if(inspection) { batchview = true; quiet = true; dopause = (pausesteps>0); } if(batchview) { vstrcpy(deviceID,"screenview "); runon = true; xwzfortran = false; list = true; } if(xwzfortran) { wldoescr = true; wlfeeddist = 1; feedchar = ' '; tfeedchar = ' '; crchar = '+'; } if(list) { wlfeeddist = 1; crfeeddist = 1; crchar = ' '; wldoescr = true; lmargin = 0; topmargin = 0; } if(!quiet) fprintf( *output, "%s%s%s%c", "This is Crudetype, Version 3.01, copyright, experimental WEB2C", " --- ", deviceID, '\n') ; if((printname.len==0)) { parsefile(dviname,pd,pn,pex); if(true) printname = pd; else printname = blank; append(printname,pn); append(printname,printex); } if(inspection) { setstring("/dev/tty",buffer); printname = buffer; } rewrite(printfile,printname.data); printstring(printfile,startstuff,ctrlflag); fprintf( *printfile, "%c", '\n'); if(inspection) flush(printfile); bbb = readbyte(dvifile,dviindx); if(bbb!=247) { fprintf( *output, "%s%s%s%c", "Fatal: ", "Bad DVI file: ", "First byte isn't start of preamble!", '\n') ; crash(); } bbb = readbyte(dvifile,dviindx); if(bbb!=2) { fprintf( *output, "%s%s%*d%s%*d%c", "Error: ", "Identification byte should be ", 1, 2, ", it is actually", 1, bbb, '\n') ; error(); } dvifactor = rrreadreal(dvifile,dviindx)/ ((double)254000.0); Dlmargin = round(lmargin/ ((double)dvifactor)); Dtopmargin = round(topmargin/ ((double)dvifactor)); magnification = readinteger(dvifile,dviindx,4)/ ((double)1000); dvifactor = dvifactor*magnification; dvifactor = dvifactor*magnify/ ((double)100.0); hconv = dvifactor*hresolution*hfudge*hmag/ ((double)100.0); vconv = dvifactor*vresolution*vfudge*vmag/ ((double)100.0); bbb = readbyte(dvifile,dviindx); if(quiet) skipbytes(dvifile,dviindx,bbb); else{ {register integer for_end;nnn=1;for_end=bbb; if (nnn<=for_end)do fprintf( *output, "%c", chr(readbyte(dvifile,dviindx))); while(nnn++ < for_end);} fprintf( *output, "%c%c", ' ', '\n'); } do{readBOP(); if((counter[0]>=firstpage)) start = true; if(start&&(countpages>0)) { if(runon) { fprintf( *printfile, "%c", '\n'); fprintf( *printfile, "%s%*d%c", "------ PAGE ", 1, counter[0], ' '); fprintf( *printfile, "%s", "----------------------------------"); fprintf( *printfile, "%s", "----------------------------------"); fprintf( *printfile, "%c", '\n'); } else if(pagegap) page(printfile); else pagegap = true; if(isheader) printstring(printfile,pagetop,ctrlflag); countpages = countpages-1; if(!quiet) fprintf( *output, "%c%*d", '[', 1, counter[0]); Readonepage(); sorted = false; pool[runptr].prox = zzz; runptr = pool[run].prox; cell = cell+1; pool[midptr].prox = cell; midptr = cell; pool[midptr].down = runptr; do{pool[midptr].prox = zzz; midptr = pool[mid].prox; leftptr = left; pool[left].prox = zzz; rightptr = right; pool[right].prox = zzz; do{{ tempp = midptr; midptr = pool[midptr].prox; pool[leftptr].prox = tempp; leftptr = pool[leftptr].prox; } if(!(midptr==zzz)) { tempp = midptr; midptr = pool[midptr].prox; pool[rightptr].prox = tempp; rightptr = pool[rightptr].prox; } }while( ! ((midptr==zzz)) ); midptr = mid; pool[mid].prox = zzz; pool[leftptr].prox = zzz; leftptr = pool[left].prox; pool[rightptr].prox = zzz; rightptr = pool[right].prox; sorted = (rightptr==zzz); if(sorted) curpgeptr = pool[pool[left].prox].down; else do{if((rightptr==zzz)) { tempp = leftptr; leftptr = pool[leftptr].prox; pool[midptr].prox = tempp; midptr = pool[midptr].prox; } else if((leftptr==zzz)) { tempp = rightptr; rightptr = pool[rightptr].prox; pool[midptr].prox = tempp; midptr = pool[midptr].prox; } else{ runptr = run; pool[run].prox = zzz; Lrunptr = pool[leftptr].down; Rrunptr = pool[rightptr].down; do{if(((pool[Lrunptr].vpos0)) Skippage(); else timetostop = true; }while( ! (timetostop) ); printstring(printfile,stopstuff,ctrlflag); fprintf( *printfile, "%c", '\n'); if(inspection) flush(printfile); if(!quiet) { fprintf( *output, "%s", "Output written to file: "); printstring(output,printname,' '); } fprintf( *output, "%c%c", ' ', '\n'); lab732:; }