{10:}{11:}{$C-,A+,D-}ifdef('TEXMF_DEBUG'){$C+,D+} endif('TEXMF_DEBUG'){:11}program BibTEX;label 9998,9999{110:},31{:110} {147:},32,9932{:147};const{14:}hashprime=30011;hashsize=35307; hashbase=1;hashmax=hashbase+hashsize-1;hashmaxp1=hashmax+1; maxhashvalue=hashprime+hashprime+125;quotenextfn=hashbase-1; endofdef=hashmax+1;undefined=hashmax+1;bufsize=5000;minprintline=3; maxprintline=79;auxstacksize=20;MAXBIBFILES=20;POOLSIZE=65000; maxstrings=35000;maxcites=5000;WIZFNSPACE=3000;singlefnspace=100; MAXENTINTS=3000;MAXENTSTRS=3000;entstrsize=250;globstrsize=5000; MAXFIELDS=5000;litstksize=100;{:14}{334:}numbltinfns=37;{:334}type{22:} ASCIIcode=0..255;{:22}{31:}lextype=0..5;idtype=0..1;{:31}{36:} alphafile=packed file of ASCIIcode;{:36}{43:}bufpointer=0..bufsize; buftype=array[bufpointer]of ASCIIcode;{:43}{50:}poolpointer=integer; strnumber=0..maxstrings;{:50}{65:}hashloc=hashbase..hashmax; hashpointer=0..hashmax;strilk=0..14;{:65}{74:}pdsloc=1..12;pdslen=0..12; pdstype=packed array[pdsloc]of char;{:74}{106:} auxnumber=0..auxstacksize;{:106}{119:}bibnumber=integer;{:119}{131:} citenumber=0..maxcites;{:131}{161:}fnclass=0..8;wizfnloc=integer; intentloc=integer;strentloc=integer;strglobloc=0..19;fieldloc=integer; hashptr2=quotenextfn..endofdef;{:161}{292:}litstkloc=0..litstksize; stktype=0..4;{:292}{333:}bltinrange=0..numbltinfns;{:333}var{2:} standardinput,standardoutput:text;{:2}{16:}maxentints:integer; maxentstrs:integer;poolsize:integer;maxbibfiles:integer; wizfnspace:integer;maxfields:integer;bad:integer;{:16}{19:}history:0..3; errcount:integer;{:19}{24:}xord:array[ASCIIcode]of ASCIIcode; xchr:array[ASCIIcode]of ASCIIcode;{:24}{30:} lexclass:array[ASCIIcode]of lextype;idclass:array[ASCIIcode]of idtype; {:30}{34:}charwidth:array[ASCIIcode]of integer;stringwidth:integer;{:34} {37:}nameoffile:^ASCIIcode;namelength:integer;nameptr:integer;{:37}{42:} buffer:buftype;last:bufpointer;{:42}{44:}svbuffer:buftype; svptr1:bufpointer;svptr2:bufpointer;tmpptr,tmpendptr:integer;{:44}{49:} strpool:^ASCIIcode;strstart:packed array[strnumber]of poolpointer; poolptr:poolpointer;strptr:strnumber;strnum:strnumber; pptr1,pptr2:poolpointer;{:49}{66:} hashnext:packed array[hashloc]of hashpointer; hashtext:packed array[hashloc]of strnumber; hashilk:packed array[hashloc]of strilk; ilkinfo:packed array[hashloc]of integer;hashused:hashbase..hashmaxp1; hashfound:boolean;dummyloc:hashloc;{:66}{75:}sauxextension:strnumber; slogextension:strnumber;sbblextension:strnumber;sbstextension:strnumber; sbibextension:strnumber;sbstarea:strnumber;sbibarea:strnumber;{:75}{77:} predefloc:hashloc;{:77}{79:}commandnum:integer;{:79}{81:} bufptr1:bufpointer;bufptr2:bufpointer;{:81}{90:}scanresult:0..3;{:90} {92:}tokenvalue:integer;{:92}{98:}auxnamelength:integer;{:98}{105:} auxfile:array[auxnumber]of alphafile; auxlist:array[auxnumber]of strnumber;auxptr:auxnumber; auxlnstack:array[auxnumber]of integer;toplevstr:strnumber; logfile:alphafile;bblfile:alphafile;{:105}{118:}biblist:^strnumber; bibptr:bibnumber;numbibfiles:bibnumber;bibseen:boolean; bibfile:^alphafile;{:118}{125:}bstseen:boolean;bststr:strnumber; bstfile:alphafile;{:125}{130:} citelist:packed array[citenumber]of strnumber;citeptr:citenumber; entryciteptr:citenumber;numcites:citenumber;oldnumcites:citenumber; citationseen:boolean;citeloc:hashloc;lcciteloc:hashloc; lcxciteloc:hashloc;citefound:boolean;allentries:boolean; allmarker:citenumber;{:130}{148:}bbllinenum:integer;bstlinenum:integer; {:148}{162:}fnloc:hashloc;wizloc:hashloc;literalloc:hashloc; macronameloc:hashloc;macrodefloc:hashloc; fntype:packed array[hashloc]of fnclass;wizdefptr:wizfnloc; wizfnptr:wizfnloc;wizfunctions:^hashptr2;intentptr:intentloc; entryints:^integer;numentints:intentloc;strentptr:strentloc; entrystrs:^ASCIIcode;numentstrs:strentloc;strglbptr:0..20; glbstrptr:array[strglobloc]of strnumber; globalstrs:array[strglobloc]of array[0..globstrsize]of ASCIIcode; glbstrend:array[strglobloc]of 0..globstrsize;numglbstrs:0..20; fieldptr:fieldloc;fieldparentptr,fieldendptr:fieldloc; citeparentptr,citexptr:citenumber;fieldinfo:^strnumber; numfields:fieldloc;numpredefinedfields:fieldloc;crossrefnum:fieldloc; nofields:boolean;{:162}{164:}entryseen:boolean;readseen:boolean; readperformed:boolean;readingcompleted:boolean;readcompleted:boolean; {:164}{196:}implfnnum:integer;{:196}{220:}biblinenum:integer; entrytypeloc:hashloc;typelist:packed array[citenumber]of hashptr2; typeexists:boolean;entryexists:packed array[citenumber]of boolean; storeentry:boolean;fieldnameloc:hashloc;fieldvalloc:hashloc; storefield:boolean;storetoken:boolean;rightouterdelim:ASCIIcode; rightstrdelim:ASCIIcode;atbibcommand:boolean;curmacroloc:hashloc; citeinfo:packed array[citenumber]of strnumber;citehashfound:boolean; preambleptr:bibnumber;numpreamblestrings:bibnumber;{:220}{248:} bibbracelevel:integer;{:248}{291:}litstack:array[litstkloc]of integer; litstktype:array[litstkloc]of stktype;litstkptr:litstkloc; cmdstrptr:strnumber;entchrptr:0..entstrsize;globchrptr:0..globstrsize; exbuf:buftype;exbufptr:bufpointer;exbuflength:bufpointer;outbuf:buftype; outbufptr:bufpointer;outbuflength:bufpointer;messwithentries:boolean; sortciteptr:citenumber;sortkeynum:strentloc;bracelevel:integer;{:291} {332:}bequals:hashloc;bgreaterthan:hashloc;blessthan:hashloc; bplus:hashloc;bminus:hashloc;bconcatenate:hashloc;bgets:hashloc; baddperiod:hashloc;bcalltype:hashloc;bchangecase:hashloc; bchrtoint:hashloc;bcite:hashloc;bduplicate:hashloc;bempty:hashloc; bformatname:hashloc;bif:hashloc;binttochr:hashloc;binttostr:hashloc; bmissing:hashloc;bnewline:hashloc;bnumnames:hashloc;bpop:hashloc; bpreamble:hashloc;bpurify:hashloc;bquote:hashloc;bskip:hashloc; bstack:hashloc;bsubstring:hashloc;bswap:hashloc;btextlength:hashloc; btextprefix:hashloc;btopstack:hashloc;btype:hashloc;bwarning:hashloc; bwhile:hashloc;bwidth:hashloc;bwrite:hashloc;bdefault:hashloc; ifndef('NO_BIBTEX_STAT')bltinloc:array[bltinrange]of hashloc; executioncount:array[bltinrange]of integer;totalexcount:integer; bltinptr:bltinrange;endifn('NO_BIBTEX_STAT'){:332}{338:}snull:strnumber; sdefault:strnumber;st:strnumber;sl:strnumber;su:strnumber; spreamble:^strnumber;{:338}{345:}poplit1,poplit2,poplit3:integer; poptyp1,poptyp2,poptyp3:stktype;spptr:poolpointer; spxptr1,spxptr2:poolpointer;spend:poolpointer; splength,sp2length:poolpointer;spbracelevel:integer; exbufxptr,exbufyptr:bufpointer;controlseqloc:hashloc; precedingwhite:boolean;andfound:boolean;numnames:integer; namebfptr:bufpointer;namebfxptr,namebfyptr:bufpointer; nmbracelevel:integer;nametok:packed array[bufpointer]of bufpointer; namesepchar:packed array[bufpointer]of ASCIIcode;numtokens:bufpointer; tokenstarting:boolean;alphafound:boolean; doubleletter,endofgroup,tobewritten:boolean;firststart:bufpointer; firstend:bufpointer;lastend:bufpointer;vonstart:bufpointer; vonend:bufpointer;jrend:bufpointer;curtoken,lasttoken:bufpointer; usedefault:boolean;numcommas:bufpointer;comma1,comma2:bufpointer; numtextchars:bufpointer;{:345}{366:}conversiontype:0..3; prevcolon:boolean;{:366}{470:}verbose:cinttype;{:470}{473:} mincrossrefs:integer;{:473}{12:}{3:}procedure printanewline; begin writeln(logfile);writeln(standardoutput);end;{:3}{18:} procedure markwarning; begin if(history=1)then errcount:=errcount+1 else if(history=0)then begin history:=1;errcount:=1;end;end;procedure markerror; begin if(history<2)then begin history:=2;errcount:=1; end else errcount:=errcount+1;end;procedure markfatal;begin history:=3; end;{:18}{45:}procedure printoverflow; begin begin write(logfile,'Sorry---you''ve exceeded BibTeX''s '); write(standardoutput,'Sorry---you''ve exceeded BibTeX''s ');end; markfatal;end;{:45}{46:}procedure printconfusion; begin begin writeln(logfile,'---this can''t happen'); writeln(standardoutput,'---this can''t happen');end; begin writeln(logfile,'*Please notify the BibTeX maintainer*'); writeln(standardoutput,'*Please notify the BibTeX maintainer*');end; markfatal;end;{:46}{47:}procedure bufferoverflow; begin begin printoverflow; begin writeln(logfile,'buffer size ',bufsize:0); writeln(standardoutput,'buffer size ',bufsize:0);end;goto 9998;end;end; {:47}{48:}function inputln(var f:alphafile):boolean;label 15; begin last:=0; if(eof(f))then inputln:=false else begin while(not eoln(f))do begin if( last>=bufsize)then bufferoverflow;buffer[last]:=xord[getc(f)]; last:=last+1;end;vgetc(f); while(last>0)do if(lexclass[buffer[last-1]]=1)then last:=last-1 else goto 15;15:inputln:=true;end;end;{:48}{52:} procedure outpoolstr(var f:alphafile;s:strnumber);var i:poolpointer; begin if((s<0)or(s>=strptr+3)or(s>=maxstrings))then begin begin write( logfile,'Illegal string number:',s:0); write(standardoutput,'Illegal string number:',s:0);end;printconfusion; goto 9998;end; for i:=strstart[s]to strstart[s+1]-1 do write(f,xchr[strpool[i]]);end; procedure printapoolstr(s:strnumber);begin outpoolstr(standardoutput,s); outpoolstr(logfile,s);end;{:52}{54:}procedure pooloverflow; begin BIBXRETALLOC('str_pool',strpool,ASCIIcode,poolsize,poolsize+ POOLSIZE);end;{:54}{60:}procedure filenmsizeoverflow; begin begin printoverflow; begin writeln(logfile,'file name size ',maxint:0); writeln(standardoutput,'file name size ',maxint:0);end;goto 9998;end; end;{:60}{83:}procedure outtoken(var f:alphafile);var i:bufpointer; begin i:=bufptr1;while(i0)do if(not inputln(bstfile))then goto 32 else bstlinenum:= bstlinenum+1;bufptr2:=last;end;{:150}{151:}procedure bstwarnprint; begin bstlnnumprint;markwarning;end;{:151}{154:}procedure eatbstprint; begin begin write(logfile,'Illegal end of style file in command: '); write(standardoutput,'Illegal end of style file in command: ');end;end; {:154}{158:}procedure unknwnfunctionclassconfusion; begin begin begin write(logfile,'Unknown function class'); write(standardoutput,'Unknown function class');end;printconfusion; goto 9998;end;end;{:158}{159:}procedure printfnclass(fnloc:hashloc); begin case(fntype[fnloc])of 0:begin write(logfile,'built-in'); write(standardoutput,'built-in');end; 1:begin write(logfile,'wizard-defined'); write(standardoutput,'wizard-defined');end; 2:begin write(logfile,'integer-literal'); write(standardoutput,'integer-literal');end; 3:begin write(logfile,'string-literal'); write(standardoutput,'string-literal');end; 4:begin write(logfile,'field');write(standardoutput,'field');end; 5:begin write(logfile,'integer-entry-variable'); write(standardoutput,'integer-entry-variable');end; 6:begin write(logfile,'string-entry-variable'); write(standardoutput,'string-entry-variable');end; 7:begin write(logfile,'integer-global-variable'); write(standardoutput,'integer-global-variable');end; 8:begin write(logfile,'string-global-variable'); write(standardoutput,'string-global-variable');end; others:unknwnfunctionclassconfusion end;end;{:159}{160:} ifdef('TRACE')procedure traceprfnclass(fnloc:hashloc); begin case(fntype[fnloc])of 0:begin write(logfile,'built-in');end; 1:begin write(logfile,'wizard-defined');end; 2:begin write(logfile,'integer-literal');end; 3:begin write(logfile,'string-literal');end; 4:begin write(logfile,'field');end; 5:begin write(logfile,'integer-entry-variable');end; 6:begin write(logfile,'string-entry-variable');end; 7:begin write(logfile,'integer-global-variable');end; 8:begin write(logfile,'string-global-variable');end; others:unknwnfunctionclassconfusion end;end;endif('TRACE'){:160}{166:} procedure idscanningconfusion; begin begin begin write(logfile,'Identifier scanning error'); write(standardoutput,'Identifier scanning error');end;printconfusion; goto 9998;end;end;{:166}{167:}procedure bstidprint; begin if(scanresult=0)then begin write(logfile,'"',xchr[buffer[bufptr2]] ,'" begins identifier, command: '); write(standardoutput,'"',xchr[buffer[bufptr2]], '" begins identifier, command: '); end else if(scanresult=2)then begin write(logfile,'"',xchr[buffer[ bufptr2]],'" immediately follows identifier, command: '); write(standardoutput,'"',xchr[buffer[bufptr2]], '" immediately follows identifier, command: '); end else idscanningconfusion;end;{:167}{168:} procedure bstleftbraceprint; begin begin write(logfile,'"',xchr[123],'" is missing in command: '); write(standardoutput,'"',xchr[123],'" is missing in command: ');end;end; {:168}{169:}procedure bstrightbraceprint; begin begin write(logfile,'"',xchr[125],'" is missing in command: '); write(standardoutput,'"',xchr[125],'" is missing in command: ');end;end; {:169}{170:}procedure alreadyseenfunctionprint(seenfnloc:hashloc); label 10;begin printapoolstr(hashtext[seenfnloc]); begin write(logfile,' is already a type "'); write(standardoutput,' is already a type "');end; printfnclass(seenfnloc);begin writeln(logfile,'" function name'); writeln(standardoutput,'" function name');end; begin bsterrprintandlookforblankline;goto 10;end;10:end;{:170}{189:} procedure singlfnoverflow;begin begin printoverflow; begin writeln(logfile,'single function space ',singlefnspace:0); writeln(standardoutput,'single function space ',singlefnspace:0);end; goto 9998;end;end;{:189}{221:}procedure biblnnumprint; begin begin write(logfile,'--line ',biblinenum:0,' of file '); write(standardoutput,'--line ',biblinenum:0,' of file ');end; printbibname;end;{:221}{222:}procedure biberrprint; begin begin write(logfile,'-');write(standardoutput,'-');end; biblnnumprint;printbadinputline;printskippingwhateverremains; if(atbibcommand)then begin writeln(logfile,'command'); writeln(standardoutput,'command'); end else begin writeln(logfile,'entry');writeln(standardoutput,'entry'); end;end;{:222}{223:}procedure bibwarnprint;begin biblnnumprint; markwarning;end;{:223}{227:} procedure checkfieldoverflow(totalfields:integer);var fptr:fieldloc; startfields:fieldloc; begin if(totalfields>maxfields)then begin startfields:=maxfields; BIBXRETALLOC('field_info',fieldinfo,strnumber,maxfields,totalfields+ MAXFIELDS); for fptr:=startfields to maxfields do begin fieldinfo[fptr]:=0;end;end; end;{:227}{230:}procedure eatbibprint;label 10; begin begin begin write(logfile,'Illegal end of database file'); write(standardoutput,'Illegal end of database file');end;biberrprint; goto 10;end;10:end;{:230}{231:} procedure biboneoftwoprint(char1,char2:ASCIIcode);label 10; begin begin begin write(logfile,'I was expecting a `',xchr[char1], ''' or a `',xchr[char2],''''); write(standardoutput,'I was expecting a `',xchr[char1],''' or a `',xchr[ char2],'''');end;biberrprint;goto 10;end;10:end;{:231}{232:} procedure bibequalssignprint;label 10; begin begin begin write(logfile,'I was expecting an "',xchr[61],'"'); write(standardoutput,'I was expecting an "',xchr[61],'"');end; biberrprint;goto 10;end;10:end;{:232}{233:} procedure bibunbalancedbracesprint;label 10; begin begin begin write(logfile,'Unbalanced braces'); write(standardoutput,'Unbalanced braces');end;biberrprint;goto 10;end; 10:end;{:233}{234:}procedure bibfieldtoolongprint;label 10; begin begin begin write(logfile,'Your field is more than ',bufsize:0, ' characters'); write(standardoutput,'Your field is more than ',bufsize:0,' characters') ;end;biberrprint;goto 10;end;10:end;{:234}{235:} procedure macrowarnprint; begin begin write(logfile,'Warning--string name "'); write(standardoutput,'Warning--string name "');end;printatoken; begin write(logfile,'" is ');write(standardoutput,'" is ');end;end; {:235}{236:}procedure bibidprint; begin if(scanresult=0)then begin write(logfile,'You''re missing '); write(standardoutput,'You''re missing '); end else if(scanresult=2)then begin write(logfile,'"',xchr[buffer[ bufptr2]],'" immediately follows '); write(standardoutput,'"',xchr[buffer[bufptr2]],'" immediately follows ') ;end else idscanningconfusion;end;{:236}{241:}procedure bibcmdconfusion; begin begin begin write(logfile,'Unknown database-file command'); write(standardoutput,'Unknown database-file command');end; printconfusion;goto 9998;end;end;{:241}{272:} procedure citekeydisappearedconfusion; begin begin begin write(logfile,'A cite key disappeared'); write(standardoutput,'A cite key disappeared');end;printconfusion; goto 9998;end;end;{:272}{281:} procedure badcrossreferenceprint(s:strnumber); begin begin write(logfile,'--entry "'); write(standardoutput,'--entry "');end;printapoolstr(citelist[citeptr]); begin writeln(logfile,'"');writeln(standardoutput,'"');end; begin write(logfile,'refers to entry "'); write(standardoutput,'refers to entry "');end;printapoolstr(s);end; {:281}{282:}procedure nonexistentcrossreferenceerror; begin begin write(logfile,'A bad cross reference-'); write(standardoutput,'A bad cross reference-');end; badcrossreferenceprint(fieldinfo[fieldptr]); begin writeln(logfile,'", which doesn''t exist'); writeln(standardoutput,'", which doesn''t exist');end;markerror;end; {:282}{285:}procedure printmissingentry(s:strnumber); begin begin write(logfile, 'Warning--I didn''t find a database entry for "'); write(standardoutput,'Warning--I didn''t find a database entry for "'); end;printapoolstr(s);begin writeln(logfile,'"'); writeln(standardoutput,'"');end;markwarning;end;{:285}{294:} procedure bstexwarnprint; begin if(messwithentries)then begin begin write(logfile,' for entry '); write(standardoutput,' for entry ');end; printapoolstr(citelist[citeptr]);end;printanewline; begin write(logfile,'while executing-'); write(standardoutput,'while executing-');end;bstlnnumprint;markerror; end;{:294}{295:}procedure bstmildexwarnprint; begin if(messwithentries)then begin begin write(logfile,' for entry '); write(standardoutput,' for entry ');end; printapoolstr(citelist[citeptr]);end;printanewline; begin begin write(logfile,'while executing'); write(standardoutput,'while executing');end;bstwarnprint;end;end;{:295} {296:}procedure bstcantmesswithentriesprint; begin begin begin write(logfile,'You can''t mess with entries here'); write(standardoutput,'You can''t mess with entries here');end; bstexwarnprint;end;end;{:296}{311:}procedure illeglliteralconfusion; begin begin begin write(logfile,'Illegal literal type'); write(standardoutput,'Illegal literal type');end;printconfusion; goto 9998;end;end;procedure unknwnliteralconfusion; begin begin begin write(logfile,'Unknown literal type'); write(standardoutput,'Unknown literal type');end;printconfusion; goto 9998;end;end;{:311}{312:}procedure printstklit(stklt:integer; stktp:stktype);begin case(stktp)of 0:begin write(logfile,stklt:0, ' is an integer literal'); write(standardoutput,stklt:0,' is an integer literal');end; 1:begin begin write(logfile,'"');write(standardoutput,'"');end; printapoolstr(stklt);begin write(logfile,'" is a string literal'); write(standardoutput,'" is a string literal');end;end; 2:begin begin write(logfile,'`');write(standardoutput,'`');end; printapoolstr(hashtext[stklt]); begin write(logfile,''' is a function literal'); write(standardoutput,''' is a function literal');end;end; 3:begin begin write(logfile,'`');write(standardoutput,'`');end; printapoolstr(stklt);begin write(logfile,''' is a missing field'); write(standardoutput,''' is a missing field');end;end; 4:illeglliteralconfusion;others:unknwnliteralconfusion end;end;{:312} {314:}procedure printlit(stklt:integer;stktp:stktype); begin case(stktp)of 0:begin writeln(logfile,stklt:0); writeln(standardoutput,stklt:0);end;1:begin printapoolstr(stklt); printanewline;end;2:begin printapoolstr(hashtext[stklt]);printanewline; end;3:begin printapoolstr(stklt);printanewline;end; 4:illeglliteralconfusion;others:unknwnliteralconfusion end;end;{:314} {322:}procedure outputbblline;label 15,10; begin if(outbuflength<>0)then begin while(outbuflength>0)do if(lexclass[ outbuf[outbuflength-1]]=1)then outbuflength:=outbuflength-1 else goto 15 ;15:if(outbuflength=0)then goto 10;outbufptr:=0; while(outbufptr127)do begin begin write(logfile,xchr[entrystrs[(strentptr)*(entstrsize+1)+(entchrptr )]]);end;entchrptr:=entchrptr+1;end;begin writeln(logfile,'"');end; strentptr:=strentptr+1;end;end;end{:461}; begin write(logfile,' has entry integers');end;{462:} begin if(numentints=0)then begin write(logfile,' undefined'); end else if(not readcompleted)then begin write(logfile,' uninitialized') ;end else begin intentptr:=citeptr*numentints; while(intentptr<(citeptr+1)*numentints)do begin begin write(logfile,' ', entryints[intentptr]:0);end;intentptr:=intentptr+1;end;end; begin writeln(logfile);end;end{:462}; begin writeln(logfile,' and has fields');end;{463:} begin if(not readperformed)then begin writeln(logfile, ' uninitialized');end else begin fieldptr:=citeptr*numfields; fieldendptr:=fieldptr+numfields;checkfieldoverflow(fieldendptr); nofields:=true; while(fieldptr0)then begin begin write(logfile,' "');end; begin outpoolstr(logfile,fieldinfo[fieldptr]);end; begin writeln(logfile,'"');end;nofields:=false;end;fieldptr:=fieldptr+1; end;if(nofields)then begin writeln(logfile,' missing');end;end; end{:463};end{:460}else begin writeln(logfile);end; sortciteptr:=sortciteptr+1;end;end;end{:459};{464:} begin begin writeln(logfile,'The wiz-defined functions are');end; if(wizdefptr=0)then begin writeln(logfile,' nonexistent'); end else begin wizfnptr:=0; while(wizfnptrmaxint)then begin begin write(logfile,'File=');write(standardoutput,'File=');end; printapoolstr(filename);begin writeln(logfile,','); writeln(standardoutput,',');end;filenmsizeoverflow;end;nameptr:=1; free(nameoffile); nameoffile:=xmalloc((strstart[filename+1]-strstart[filename])+2); pptr:=strstart[filename]; while(pptr0)do begin nameoffile[nameptr+(strstart[area+1]-strstart[ area])]:=nameoffile[nameptr];nameptr:=nameptr-1;end;nameptr:=1; pptr:=strstart[area]; while(pptrlen)then begin streqbuf:=false; goto 10;end;i:=bfptr;j:=strstart[s]; while(jbuf[i])then begin streqbuf :=false;goto 10;end;i:=i+1;j:=j+1;end;streqbuf:=true;10:end;{:57}{58:} function streqstr(s1,s2:strnumber):boolean;label 10; begin if((strstart[s1+1]-strstart[s1])<>(strstart[s2+1]-strstart[s2])) then begin streqstr:=false;goto 10;end;pptr1:=strstart[s1]; pptr2:=strstart[s2]; while(pptr1strpool[pptr2]) then begin streqstr:=false;goto 10;end;pptr1:=pptr1+1;pptr2:=pptr2+1; end;streqstr:=true;10:end;{:58}{63:}procedure lowercase(var buf:buftype; bfptr,len:bufpointer);var i:bufpointer; begin if(len>0)then for i:=bfptr to bfptr+len-1 do if((buf[i]>=65)and( buf[i]<=90))then buf[i]:=buf[i]+32;end;{:63}{64:} procedure uppercase(var buf:buftype;bfptr,len:bufpointer); var i:bufpointer; begin if(len>0)then for i:=bfptr to bfptr+len-1 do if((buf[i]>=97)and( buf[i]<=122))then buf[i]:=buf[i]-32;end;{:64}{69:} function strlookup(var buf:buftype;j,l:bufpointer;ilk:strilk; insertit:boolean):hashloc;label 40,45;var h:0..maxhashvalue;p:hashloc; k:bufpointer;oldstring:boolean;strnum:strnumber;begin{70:}begin h:=0; k:=j;while(k=hashprime)do h:=h-hashprime;k:=k+1;end;end{:70};p:=h+hashbase; hashfound:=false;oldstring:=false;while true do begin{71:} begin if(hashtext[p]>0)then if(streqbuf(hashtext[p],buf,j,l))then if( hashilk[p]=ilk)then begin hashfound:=true;goto 40; end else begin oldstring:=true;strnum:=hashtext[p];end;end{:71}; if(hashnext[p]=0)then begin if(not insertit)then goto 45;{72:} begin if(hashtext[p]>0)then begin repeat if((hashused=hashbase))then begin printoverflow;begin writeln(logfile,'hash size ',hashsize:0); writeln(standardoutput,'hash size ',hashsize:0);end;goto 9998;end; hashused:=hashused-1;until(hashtext[hashused]=0);hashnext[p]:=hashused; p:=hashused;end; if(oldstring)then hashtext[p]:=strnum else begin begin if(poolptr+l> poolsize)then pooloverflow;end;k:=j; while(karg2)then begin lessthan:=false;goto 10; end else begin begin write(logfile,'Duplicate sort key'); write(standardoutput,'Duplicate sort key');end;printconfusion;goto 9998; end else begin lessthan:=true;goto 10; end else if(char2=127)then begin lessthan:=false;goto 10; end else if(char1char2)then begin lessthan:=false;goto 10;end; charptr:=charptr+1;end;10:end;{:302}{304:} procedure quicksort(leftend,rightend:citenumber);label 24; var left,right:citenumber;insertptr:citenumber;middle:citenumber; partition:citenumber; begin ifdef('TRACE')begin writeln(logfile,'Sorting ',leftend:0, ' through ',rightend:0);end; endif('TRACE')if(rightend-leftend<10)then{305:} begin for insertptr:=leftend+1 to rightend do begin for right:=insertptr downto leftend+1 do begin if(lessthan(citeinfo[right-1],citeinfo[right]) )then goto 24;swap(right-1,right);end;24:end;end{:305}else begin{306:} begin left:=leftend+4;middle:=(leftend+rightend)div 2;right:=rightend-4; if(lessthan(citeinfo[left],citeinfo[middle]))then if(lessthan(citeinfo[ middle],citeinfo[right]))then swap(leftend,middle)else if(lessthan( citeinfo[left],citeinfo[right]))then swap(leftend,right)else swap( leftend,left)else if(lessthan(citeinfo[right],citeinfo[middle]))then swap(leftend,middle)else if(lessthan(citeinfo[right],citeinfo[left])) then swap(leftend,right)else swap(leftend,left);end{:306};{307:} begin partition:=citeinfo[leftend];left:=leftend+1;right:=rightend; repeat while(lessthan(citeinfo[left],partition))do left:=left+1; while(lessthan(partition,citeinfo[right]))do right:=right-1; if(left ',1,bgreaterthan,1); buildin('< ',1,blessthan,2);buildin('+ ',1,bplus,3); buildin('- ',1,bminus,4); buildin('* ',1,bconcatenate,5); buildin(':= ',2,bgets,6); buildin('add.period$ ',11,baddperiod,7); buildin('call.type$ ',10,bcalltype,8); buildin('change.case$',12,bchangecase,9); buildin('chr.to.int$ ',11,bchrtoint,10); buildin('cite$ ',5,bcite,11); buildin('duplicate$ ',10,bduplicate,12); buildin('empty$ ',6,bempty,13); buildin('format.name$',12,bformatname,14); buildin('if$ ',3,bif,15); buildin('int.to.chr$ ',11,binttochr,16); buildin('int.to.str$ ',11,binttostr,17); buildin('missing$ ',8,bmissing,18); buildin('newline$ ',8,bnewline,19); buildin('num.names$ ',10,bnumnames,20); buildin('pop$ ',4,bpop,21); buildin('preamble$ ',9,bpreamble,22); buildin('purify$ ',7,bpurify,23); buildin('quote$ ',6,bquote,24);buildin('skip$ ',5,bskip,25); buildin('stack$ ',6,bstack,26); buildin('substring$ ',10,bsubstring,27); buildin('swap$ ',5,bswap,28); buildin('text.length$',12,btextlength,29); buildin('text.prefix$',12,btextprefix,30); buildin('top$ ',4,btopstack,31); buildin('type$ ',5,btype,32); buildin('warning$ ',8,bwarning,33); buildin('width$ ',6,bwidth,35);buildin('while$ ',6,bwhile,34); buildin('width$ ',6,bwidth,35);buildin('write$ ',6,bwrite,36); {:335}{340:}predefine(' ',0,0);snull:=hashtext[predefloc]; fntype[predefloc]:=3;predefine('default.type',12,0); sdefault:=hashtext[predefloc];fntype[predefloc]:=3;bdefault:=bskip; preambleptr:=0;predefine('i ',1,14);ilkinfo[predefloc]:=0; predefine('j ',1,14);ilkinfo[predefloc]:=1; predefine('oe ',2,14);ilkinfo[predefloc]:=2; predefine('OE ',2,14);ilkinfo[predefloc]:=3; predefine('ae ',2,14);ilkinfo[predefloc]:=4; predefine('AE ',2,14);ilkinfo[predefloc]:=5; predefine('aa ',2,14);ilkinfo[predefloc]:=6; predefine('AA ',2,14);ilkinfo[predefloc]:=7; predefine('o ',1,14);ilkinfo[predefloc]:=8; predefine('O ',1,14);ilkinfo[predefloc]:=9; predefine('l ',1,14);ilkinfo[predefloc]:=10; predefine('L ',1,14);ilkinfo[predefloc]:=11; predefine('ss ',2,14);ilkinfo[predefloc]:=12;{:340}{341:} predefine('crossref ',8,11);fntype[predefloc]:=4; ilkinfo[predefloc]:=numfields;crossrefnum:=numfields; numfields:=numfields+1;numpredefinedfields:=numfields; predefine('sort.key$ ',9,11);fntype[predefloc]:=6; ilkinfo[predefloc]:=numentstrs;sortkeynum:=numentstrs; numentstrs:=numentstrs+1;predefine('entry.max$ ',10,11); fntype[predefloc]:=7;ilkinfo[predefloc]:=entstrsize; predefine('global.max$ ',11,11);fntype[predefloc]:=7; ilkinfo[predefloc]:=globstrsize;{:341}end;{:337}{84:} function scan1(char1:ASCIIcode):boolean;begin bufptr1:=bufptr2; while((buffer[bufptr2]<>char1)and(bufptr21)and(buffer[bufptr2]<>char1)and( bufptr2char1)and(buffer[bufptr2]<>char2)and(bufptr2< last))do bufptr2:=bufptr2+1; if(bufptr2char1)and(buffer[bufptr2]<>char2)and(lexclass[ buffer[bufptr2]]<>1)and(bufptr2char1)and(buffer[bufptr2]<>char2)and(buffer[ bufptr2]<>char3)and(bufptr23)then while((idclass[buffer[bufptr2]]=1) and(bufptr237) then begin eatbstwhitespace:=true;goto 10;end; if(not inputln(bstfile))then begin eatbstwhitespace:=false;goto 10;end; bstlinenum:=bstlinenum+1;bufptr2:=0;end;10:end;{:153}{184:} procedure skiptokenprint;begin begin write(logfile,'-'); write(standardoutput,'-');end;bstlnnumprint;markerror; if(scan2white(125,37))then;end;{:184}{185:} procedure printrecursionillegal; begin ifdef('TRACE')begin writeln(logfile);end; endif('TRACE')begin writeln(logfile, 'Curse you, wizard, before you recurse me:'); writeln(standardoutput,'Curse you, wizard, before you recurse me:');end; begin write(logfile,'function ');write(standardoutput,'function ');end; printatoken;begin writeln(logfile,' is illegal in its own definition'); writeln(standardoutput,' is illegal in its own definition');end; {printrecursionillegal;}skiptokenprint;end;{:185}{186:} procedure skptokenunknownfunctionprint;begin printatoken; begin write(logfile,' is an unknown function'); write(standardoutput,' is an unknown function');end;skiptokenprint;end; {:186}{187:}procedure skipillegalstuffaftertokenprint; begin begin write(logfile,'"',xchr[buffer[bufptr2]], '" can''t follow a literal'); write(standardoutput,'"',xchr[buffer[bufptr2]], '" can''t follow a literal');end;skiptokenprint;end;{:187}{188:} procedure scanfndef(fnhashloc:hashloc);label 25,10; type fndefloc=0..singlefnspace; var singlfunction:packed array[fndefloc]of hashptr2;singleptr:fndefloc; copyptr:fndefloc;endofnum:bufpointer;implfnloc:hashloc; begin begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'function');write(standardoutput,'function'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; singleptr:=0;while(buffer[bufptr2]<>125)do begin{190:} case(buffer[bufptr2])of 35:{191:}begin bufptr2:=bufptr2+1; if(not scaninteger)then begin begin write(logfile, 'Illegal integer in integer literal'); write(standardoutput,'Illegal integer in integer literal');end; skiptokenprint;goto 25;end;ifdef('TRACE')begin write(logfile,'#');end; begin outtoken(logfile);end; begin writeln(logfile,' is an integer literal with value ',tokenvalue:0) ;end; endif('TRACE')literalloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),1, true);if(not hashfound)then begin fntype[literalloc]:=2; ilkinfo[literalloc]:=tokenvalue;end; if((lexclass[buffer[bufptr2]]<>1)and(bufptr2 125)and(buffer[bufptr2]<>37))then begin skipillegalstuffaftertokenprint; goto 25;end;begin singlfunction[singleptr]:=literalloc; if(singleptr=singlefnspace)then singlfnoverflow;singleptr:=singleptr+1; end;end{:191};34:{192:}begin bufptr2:=bufptr2+1; if(not scan1(34))then begin begin write(logfile,'No `',xchr[34], ''' to end string literal'); write(standardoutput,'No `',xchr[34],''' to end string literal');end; skiptokenprint;goto 25;end;ifdef('TRACE')begin write(logfile,'"');end; begin outtoken(logfile);end;begin write(logfile,'"');end; begin writeln(logfile,' is a string literal');end; endif('TRACE')literalloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),0, true);fntype[literalloc]:=3;bufptr2:=bufptr2+1; if((lexclass[buffer[bufptr2]]<>1)and(bufptr2 125)and(buffer[bufptr2]<>37))then begin skipillegalstuffaftertokenprint; goto 25;end;begin singlfunction[singleptr]:=literalloc; if(singleptr=singlefnspace)then singlfnoverflow;singleptr:=singleptr+1; end;end{:192};39:{193:}begin bufptr2:=bufptr2+1; if(scan2white(125,37))then;ifdef('TRACE')begin write(logfile,'''');end; begin outtoken(logfile);end; begin write(logfile,' is a quoted function ');end; endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); fnloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11,false); if(not hashfound)then begin skptokenunknownfunctionprint;goto 25; end else{194:}begin if(fnloc=wizloc)then begin printrecursionillegal; goto 25;end else begin ifdef('TRACE')begin write(logfile,'of type '); end;traceprfnclass(fnloc);begin writeln(logfile);end; endif('TRACE')begin singlfunction[singleptr]:=quotenextfn; if(singleptr=singlefnspace)then singlfnoverflow;singleptr:=singleptr+1; end;begin singlfunction[singleptr]:=fnloc; if(singleptr=singlefnspace)then singlfnoverflow;singleptr:=singleptr+1; end;end end{:194};end{:193};123:{195:}begin exbuf[0]:=39; inttoASCII(implfnnum,exbuf,1,endofnum); implfnloc:=strlookup(exbuf,0,endofnum,11,true); if(hashfound)then begin begin write(logfile, 'Already encountered implicit function'); write(standardoutput,'Already encountered implicit function');end; printconfusion;goto 9998;end; ifdef('TRACE')begin outpoolstr(logfile,hashtext[implfnloc]);end; begin writeln(logfile,' is an implicit function');end; endif('TRACE')implfnnum:=implfnnum+1;fntype[implfnloc]:=1; begin singlfunction[singleptr]:=quotenextfn; if(singleptr=singlefnspace)then singlfnoverflow;singleptr:=singleptr+1; end;begin singlfunction[singleptr]:=implfnloc; if(singleptr=singlefnspace)then singlfnoverflow;singleptr:=singleptr+1; end;bufptr2:=bufptr2+1;scanfndef(implfnloc);end{:195};others:{200:} begin if(scan2white(125,37))then;ifdef('TRACE')begin outtoken(logfile); end;begin write(logfile,' is a function ');end; endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); fnloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11,false); if(not hashfound)then begin skptokenunknownfunctionprint;goto 25; end else if(fnloc=wizloc)then begin printrecursionillegal;goto 25; end else begin ifdef('TRACE')begin write(logfile,'of type ');end; traceprfnclass(fnloc);begin writeln(logfile);end; endif('TRACE')begin singlfunction[singleptr]:=fnloc; if(singleptr=singlefnspace)then singlfnoverflow;singleptr:=singleptr+1; end;end;end{:200}end{:190}; 25:begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'function');write(standardoutput,'function'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end;end; {201:}begin begin singlfunction[singleptr]:=endofdef; if(singleptr=singlefnspace)then singlfnoverflow;singleptr:=singleptr+1; end;if(singleptr+wizdefptr>wizfnspace)then begin BIBXRETALLOC( 'wiz_functions',wizfunctions,hashptr2,wizfnspace,wizfnspace+WIZFNSPACE); end;ilkinfo[fnhashloc]:=wizdefptr;copyptr:=0; while(copyptr1)then if(exbuf[exbufptr-1]=32)then if(exbuf[exbufptr-2]=32) then exbufptr:=exbufptr-1;bibbracelevel:=0;if(storefield)then{257:} begin while(buffer[bufptr2]<>rightstrdelim)do case(buffer[bufptr2])of 123:begin bibbracelevel:=bibbracelevel+1; begin if(exbufptr=bufsize)then begin bibfieldtoolongprint;goto 10; end else begin exbuf[exbufptr]:=123;exbufptr:=exbufptr+1;end;end; bufptr2:=bufptr2+1; begin if((lexclass[buffer[bufptr2]]=1)or(bufptr2=last))then if(not compressbibwhite)then goto 10;end;{258:} begin while true do case(buffer[bufptr2])of 125:begin bibbracelevel:= bibbracelevel-1; begin if(exbufptr=bufsize)then begin bibfieldtoolongprint;goto 10; end else begin exbuf[exbufptr]:=125;exbufptr:=exbufptr+1;end;end; bufptr2:=bufptr2+1; begin if((lexclass[buffer[bufptr2]]=1)or(bufptr2=last))then if(not compressbibwhite)then goto 10;end;if(bibbracelevel=0)then goto 15;end; 123:begin bibbracelevel:=bibbracelevel+1; begin if(exbufptr=bufsize)then begin bibfieldtoolongprint;goto 10; end else begin exbuf[exbufptr]:=123;exbufptr:=exbufptr+1;end;end; bufptr2:=bufptr2+1; begin if((lexclass[buffer[bufptr2]]=1)or(bufptr2=last))then if(not compressbibwhite)then goto 10;end;end; others:begin begin if(exbufptr=bufsize)then begin bibfieldtoolongprint; goto 10;end else begin exbuf[exbufptr]:=buffer[bufptr2]; exbufptr:=exbufptr+1;end;end;bufptr2:=bufptr2+1; begin if((lexclass[buffer[bufptr2]]=1)or(bufptr2=last))then if(not compressbibwhite)then goto 10;end;end end;15:end{:258};end; 125:begin bibunbalancedbracesprint;goto 10;end; others:begin begin if(exbufptr=bufsize)then begin bibfieldtoolongprint; goto 10;end else begin exbuf[exbufptr]:=buffer[bufptr2]; exbufptr:=exbufptr+1;end;end;bufptr2:=bufptr2+1; begin if((lexclass[buffer[bufptr2]]=1)or(bufptr2=last))then if(not compressbibwhite)then goto 10;end;end end;end{:257}else{255:} begin while(buffer[bufptr2]<>rightstrdelim)do if(buffer[bufptr2]=123) then begin bibbracelevel:=bibbracelevel+1;bufptr2:=bufptr2+1; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; while(bibbracelevel>0)do{256:} begin if(buffer[bufptr2]=125)then begin bibbracelevel:=bibbracelevel-1; bufptr2:=bufptr2+1;begin if(not eatbibwhitespace)then begin eatbibprint; goto 10;end;end; end else if(buffer[bufptr2]=123)then begin bibbracelevel:=bibbracelevel +1;bufptr2:=bufptr2+1; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; end else begin bufptr2:=bufptr2+1; if(not scan2(125,123))then begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end;end end{:256}; end else if(buffer[bufptr2]=125)then begin bibunbalancedbracesprint; goto 10;end else begin bufptr2:=bufptr2+1; if(not scan3(rightstrdelim,123,125))then begin if(not eatbibwhitespace) then begin eatbibprint;goto 10;end;end;end end{:255};bufptr2:=bufptr2+1; scanbalancedbraces:=true;10:end;{:254}{251:} function scanafieldtokenandeatwhite:boolean;label 10; begin scanafieldtokenandeatwhite:=false; case(buffer[bufptr2])of 123:begin rightstrdelim:=125; if(not scanbalancedbraces)then goto 10;end;34:begin rightstrdelim:=34; if(not scanbalancedbraces)then goto 10;end; 48,49,50,51,52,53,54,55,56,57:{259:} begin if(not scannonneginteger)then begin begin write(logfile, 'A digit disappeared');write(standardoutput,'A digit disappeared');end; printconfusion;goto 9998;end;if(storefield)then begin tmpptr:=bufptr1; while(tmpptr1)then begin if(exbufptr=bufsize)then begin bibfieldtoolongprint;goto 10; end else begin exbuf[exbufptr]:=strpool[tmpptr];exbufptr:=exbufptr+1; end; end else if(exbuf[exbufptr-1]<>32)then begin if(exbufptr=bufsize)then begin bibfieldtoolongprint;goto 10;end else begin exbuf[exbufptr]:=32; exbufptr:=exbufptr+1;end;end;tmpptr:=tmpptr+1;end;end{:261};end; end{:260}end;begin if(not eatbibwhitespace)then begin eatbibprint; goto 10;end;end;scanafieldtokenandeatwhite:=true;10:end;{:251}{:249} {250:}function scanandstorethefieldvalueandeatwhite:boolean;label 10; begin scanandstorethefieldvalueandeatwhite:=false;exbufptr:=0; if(not scanafieldtokenandeatwhite)then goto 10; while(buffer[bufptr2]=35)do begin bufptr2:=bufptr2+1; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; if(not scanafieldtokenandeatwhite)then goto 10;end; if(storefield)then{262:} begin if(not atbibcommand)then if(exbufptr>0)then if(exbuf[exbufptr-1]= 32)then exbufptr:=exbufptr-1; if((not atbibcommand)and(exbuf[0]=32)and(exbufptr>0))then exbufxptr:=1 else exbufxptr:=0; fieldvalloc:=strlookup(exbuf,exbufxptr,exbufptr-exbufxptr,0,true); fntype[fieldvalloc]:=3;ifdef('TRACE')begin write(logfile,'"');end; begin outpoolstr(logfile,hashtext[fieldvalloc]);end; begin writeln(logfile,'" is a field value');end; endif('TRACE')if(atbibcommand)then{263:} begin case(commandnum)of 1:begin spreamble[preambleptr]:=hashtext[ fieldvalloc];preambleptr:=preambleptr+1;end; 2:ilkinfo[curmacroloc]:=hashtext[fieldvalloc]; others:bibcmdconfusion end;end{:263}else{264:} begin fieldptr:=entryciteptr*numfields+ilkinfo[fieldnameloc]; checkfieldoverflow(fieldptr); if(fieldinfo[fieldptr]<>0)then begin begin write(logfile, 'Warning--I''m ignoring '); write(standardoutput,'Warning--I''m ignoring ');end; printapoolstr(citelist[entryciteptr]); begin write(logfile,'''s extra "');write(standardoutput,'''s extra "'); end;printapoolstr(hashtext[fieldnameloc]); begin begin writeln(logfile,'" field'); writeln(standardoutput,'" field');end;bibwarnprint;end; end else begin fieldinfo[fieldptr]:=hashtext[fieldvalloc]; if((ilkinfo[fieldnameloc]=crossrefnum)and(not allentries))then{265:} begin tmpptr:=exbufxptr; while(tmpptr=oldnumcites)then citeinfo[ilkinfo[citeloc]]:= citeinfo[ilkinfo[citeloc]]+1; end else begin citeloc:=strlookup(exbuf,exbufxptr,exbufptr-exbufxptr,9, true);if(hashfound)then hashciteconfusion;adddatabasecite(citeptr); citeinfo[ilkinfo[citeloc]]:=1;end;end{:265};end;end{:264};end{:262}; scanandstorethefieldvalueandeatwhite:=true;10:end;{:250}{368:} procedure decrbracelevel(poplitvar:strnumber); begin if(bracelevel=0)then bracesunbalancedcomplaint(poplitvar)else bracelevel:=bracelevel-1;end;{:368}{370:} procedure checkbracelevel(poplitvar:strnumber); begin if(bracelevel>0)then bracesunbalancedcomplaint(poplitvar);end; {:370}{385:}procedure namescanforand(poplitvar:strnumber); begin bracelevel:=0;precedingwhite:=false;andfound:=false; while((not andfound)and(exbufptr0)and(exbufptr=65)and(svbuffer[ namebfptr]<=90))then goto 10 else if((svbuffer[namebfptr]>=97)and( svbuffer[namebfptr]<=122))then begin vontokenfound:=true;goto 10; end else if(svbuffer[namebfptr]=123)then begin nmbracelevel:= nmbracelevel+1;namebfptr:=namebfptr+1; if((namebfptr+20))do begin if((svbuffer[ namebfptr]>=65)and(svbuffer[namebfptr]<=90))then goto 10 else if(( svbuffer[namebfptr]>=97)and(svbuffer[namebfptr]<=122))then begin vontokenfound:=true;goto 10; end else if(svbuffer[namebfptr]=125)then nmbracelevel:=nmbracelevel-1 else if(svbuffer[namebfptr]=123)then nmbracelevel:=nmbracelevel+1; namebfptr:=namebfptr+1;end;goto 10;end{:399}else{401:} while((nmbracelevel>0)and(namebfptrvonstart)do begin namebfptr:=nametok[vonend-1]; namebfxptr:=nametok[vonend];if(vontokenfound)then goto 10; vonend:=vonend-1;end;10:end;{:402}{405:} procedure skipstuffatspbracelevelgreaterthanone; begin while((spbracelevel>1)and(spptr0))do begin if(exbuf[exbufyptr] =125)then bracelevel:=bracelevel-1 else if(exbuf[exbufyptr]=123)then bracelevel:=bracelevel+1;exbufyptr:=exbufyptr+1;end;end; end else if(exbuf[exbufyptr-1]=125)then bracelevel:=bracelevel-1; numtextchars:=numtextchars+1;end; if(numtextchars0)do if((lexclass[strpool[spptr]]=2)and(spbracelevel= 1))then begin spptr:=spptr+1;{413:} begin if(doubleletter)then spptr:=spptr+1;usedefault:=true; spxptr2:=spptr;if(strpool[spptr]=123)then begin usedefault:=false; spbracelevel:=spbracelevel+1;spptr:=spptr+1;spxptr1:=spptr; skipstuffatspbracelevelgreaterthanone;spxptr2:=spptr-1;end;{414:} while(curtokenbufsize)then bufferoverflow; while(namebfptrbufsize)then bufferoverflow; begin exbuf[exbufptr]:=123;exbufptr:=exbufptr+1;end; begin exbuf[exbufptr]:=92;exbufptr:=exbufptr+1;end; namebfptr:=namebfptr+2;nmbracelevel:=1; while((namebfptr0))do begin if(svbuffer[ namebfptr]=125)then nmbracelevel:=nmbracelevel-1 else if(svbuffer[ namebfptr]=123)then nmbracelevel:=nmbracelevel+1; begin if(exbufptr=bufsize)then bufferoverflow; begin exbuf[exbufptr]:=svbuffer[namebfptr];exbufptr:=exbufptr+1;end;end; namebfptr:=namebfptr+1;end;goto 15;end{:417};namebfptr:=namebfptr+1;end; 15:end{:416};curtoken:=curtoken+1;if(curtokenbufsize)then bufferoverflow;spptr:=spxptr1; while(spptr0)then begin if(exbufptr=bufsize)then bufferoverflow; begin exbuf[exbufptr]:=125;exbufptr:=exbufptr+1;end;end; end else if(strpool[spptr]=123)then begin spbracelevel:=spbracelevel+1; spptr:=spptr+1;begin if(exbufptr=bufsize)then bufferoverflow; begin exbuf[exbufptr]:=123;exbufptr:=exbufptr+1;end;end; end else begin begin if(exbufptr=bufsize)then bufferoverflow; begin exbuf[exbufptr]:=strpool[spptr];exbufptr:=exbufptr+1;end;end; spptr:=spptr+1;end; if(exbufptr>0)then if(exbuf[exbufptr-1]=126)then{420:} begin exbufptr:=exbufptr-1; if(exbuf[exbufptr-1]=126)then else if(not enoughtextchars(3))then exbufptr:=exbufptr+1 else begin exbuf[exbufptr]:=32; exbufptr:=exbufptr+1;end;end{:420};end{:412};end{:404}; end else if(strpool[spptr]=125)then begin bracesunbalancedcomplaint( poplit1);spptr:=spptr+1; end else begin begin if(exbufptr=bufsize)then bufferoverflow; begin exbuf[exbufptr]:=strpool[spptr];exbufptr:=exbufptr+1;end;end; spptr:=spptr+1;end; if(spbracelevel>0)then bracesunbalancedcomplaint(poplit1); exbuflength:=exbufptr;end{:403};end;{:421}{308:} procedure pushlitstk(pushlt:integer;pushtype:stktype); ifdef('TRACE')var dumptr:litstkloc; endif('TRACE')begin litstack[litstkptr]:=pushlt; litstktype[litstkptr]:=pushtype; ifdef('TRACE')for dumptr:=0 to litstkptr do begin write(logfile,' '); end;begin write(logfile,'Pushing ');end; case(litstktype[litstkptr])of 0:begin writeln(logfile,litstack[litstkptr ]:0);end;1:begin begin write(logfile,'"');end; begin outpoolstr(logfile,litstack[litstkptr]);end; begin writeln(logfile,'"');end;end;2:begin begin write(logfile,'`');end; begin outpoolstr(logfile,hashtext[litstack[litstkptr]]);end; begin writeln(logfile,'''');end;end; 3:begin begin write(logfile,'missing field `');end; begin outpoolstr(logfile,litstack[litstkptr]);end; begin writeln(logfile,'''');end;end; 4:begin writeln(logfile,'a bad literal--popped from an empty stack'); end;others:unknwnliteralconfusion end; endif('TRACE')if(litstkptr=litstksize)then begin printoverflow; begin writeln(logfile,'literal-stack size ',litstksize:0); writeln(standardoutput,'literal-stack size ',litstksize:0);end; goto 9998;end;litstkptr:=litstkptr+1;end;{:308}{310:} procedure poplitstk(var poplit:integer;var poptype:stktype); begin if(litstkptr=0)then begin begin begin write(logfile, 'You can''t pop an empty literal stack'); write(standardoutput,'You can''t pop an empty literal stack');end; bstexwarnprint;end;poptype:=4;end else begin litstkptr:=litstkptr-1; poplit:=litstack[litstkptr];poptype:=litstktype[litstkptr]; if(poptype=1)then if(poplit>=cmdstrptr)then begin if(poplit<>strptr-1) then begin begin write(logfile,'Nontop top of string stack'); write(standardoutput,'Nontop top of string stack');end;printconfusion; goto 9998;end;begin strptr:=strptr-1;poolptr:=strstart[strptr];end;end; end;end;{:310}{313:}procedure printwrongstklit(stklt:integer; stktp1,stktp2:stktype); begin if(stktp1<>4)then begin printstklit(stklt,stktp1); case(stktp2)of 0:begin write(logfile,', not an integer,'); write(standardoutput,', not an integer,');end; 1:begin write(logfile,', not a string,'); write(standardoutput,', not a string,');end; 2:begin write(logfile,', not a function,'); write(standardoutput,', not a function,');end; 3,4:illeglliteralconfusion;others:unknwnliteralconfusion end; bstexwarnprint;end;end;{:313}{315:}procedure poptopandprint; var stklt:integer;stktp:stktype;begin poplitstk(stklt,stktp); if(stktp=4)then begin writeln(logfile,'Empty literal'); writeln(standardoutput,'Empty literal');end else printlit(stklt,stktp); end;{:315}{316:}procedure popwholestack; begin while(litstkptr>0)do poptopandprint;end;{:316}{317:} procedure initcommandexecution;begin litstkptr:=0;cmdstrptr:=strptr;end; {:317}{318:}procedure checkcommandexecution; begin if(litstkptr<>0)then begin begin writeln(logfile,'ptr=',litstkptr: 0,', stack=');writeln(standardoutput,'ptr=',litstkptr:0,', stack=');end; popwholestack; begin begin write(logfile,'---the literal stack isn''t empty'); write(standardoutput,'---the literal stack isn''t empty');end; bstexwarnprint;end;end; if(cmdstrptr<>strptr)then begin ifdef('TRACE')begin writeln(logfile, 'Pointer is ',strptr:0,' but should be ',cmdstrptr:0); writeln(standardoutput,'Pointer is ',strptr:0,' but should be ', cmdstrptr:0);end; endif('TRACE')begin begin write(logfile,'Nonempty empty string stack'); write(standardoutput,'Nonempty empty string stack');end;printconfusion; goto 9998;end;end;end;{:318}{319:}procedure addpoolbufandpush; begin begin if(poolptr+exbuflength>poolsize)then pooloverflow;end; exbufptr:=0; while(exbufptrbufsize)then bufferoverflow; exbufptr:=exbuflength; while(pptr1bufsize)then begin printoverflow; begin writeln(logfile,'output buffer size ',bufsize:0); writeln(standardoutput,'output buffer size ',bufsize:0);end;goto 9998; end;outbufptr:=outbuflength; while(pptr1maxprintline)do{324:}begin endptr:=outbuflength; outbufptr:=maxprintline; while((lexclass[outbuf[outbufptr]]<>1)and(outbufptr>=minprintline))do outbufptr:=outbufptr-1;if(outbufptr=minprintline-1)then{325:} begin outbuf[endptr]:=outbuf[maxprintline-1];outbuf[maxprintline-1]:=37; outbuflength:=maxprintline;breakptr:=outbuflength-1;outputbblline; outbuf[maxprintline-1]:=outbuf[endptr];outbufptr:=0;tmpptr:=breakptr; while(tmpptrpoptyp2)then begin if((poptyp1<>4)and(poptyp2<>4))then begin printstklit(poplit1,poptyp1);begin write(logfile,', '); write(standardoutput,', ');end;printstklit(poplit2,poptyp2); printanewline; begin begin write(logfile,'---they aren''t the same literal types'); write(standardoutput,'---they aren''t the same literal types');end; bstexwarnprint;end;end;pushlitstk(0,0); end else if((poptyp1<>0)and(poptyp1<>1))then begin if(poptyp1<>4)then begin printstklit(poplit1,poptyp1); begin begin write(logfile,', not an integer or a string,'); write(standardoutput,', not an integer or a string,');end; bstexwarnprint;end;end;pushlitstk(0,0); end else if(poptyp1=0)then if(poplit2=poplit1)then pushlitstk(1,0)else pushlitstk(0,0)else if(streqstr(poplit2,poplit1))then pushlitstk(1,0) else pushlitstk(0,0);end;{:346}{347:}procedure xgreaterthan; begin poplitstk(poplit1,poptyp1);poplitstk(poplit2,poptyp2); if(poptyp1<>0)then begin printwrongstklit(poplit1,poptyp1,0); pushlitstk(0,0); end else if(poptyp2<>0)then begin printwrongstklit(poplit2,poptyp2,0); pushlitstk(0,0); end else if(poplit2>poplit1)then pushlitstk(1,0)else pushlitstk(0,0); end;{:347}{348:}procedure xlessthan;begin poplitstk(poplit1,poptyp1); poplitstk(poplit2,poptyp2); if(poptyp1<>0)then begin printwrongstklit(poplit1,poptyp1,0); pushlitstk(0,0); end else if(poptyp2<>0)then begin printwrongstklit(poplit2,poptyp2,0); pushlitstk(0,0); end else if(poplit20)then begin printwrongstklit(poplit1,poptyp1,0); pushlitstk(0,0); end else if(poptyp2<>0)then begin printwrongstklit(poplit2,poptyp2,0); pushlitstk(0,0);end else pushlitstk(poplit2+poplit1,0);end;{:349}{350:} procedure xminus;begin poplitstk(poplit1,poptyp1); poplitstk(poplit2,poptyp2); if(poptyp1<>0)then begin printwrongstklit(poplit1,poptyp1,0); pushlitstk(0,0); end else if(poptyp2<>0)then begin printwrongstklit(poplit2,poptyp2,0); pushlitstk(0,0);end else pushlitstk(poplit2-poplit1,0);end;{:350}{351:} procedure xconcatenate;begin poplitstk(poplit1,poptyp1); poplitstk(poplit2,poptyp2); if(poptyp1<>1)then begin printwrongstklit(poplit1,poptyp1,1); pushlitstk(snull,1); end else if(poptyp2<>1)then begin printwrongstklit(poplit2,poptyp2,1); pushlitstk(snull,1);end else{352:} begin if(poplit2>=cmdstrptr)then if(poplit1>=cmdstrptr)then begin strstart[poplit1]:=strstart[poplit1+1];begin strptr:=strptr+1; poolptr:=strstart[strptr];end;litstkptr:=litstkptr+1; end else if((strstart[poplit2+1]-strstart[poplit2])=0)then pushlitstk( poplit1,1)else begin poolptr:=strstart[poplit2+1]; begin if(poolptr+(strstart[poplit1+1]-strstart[poplit1])>poolsize)then pooloverflow;end;spptr:=strstart[poplit1];spend:=strstart[poplit1+1]; while(spptr=cmdstrptr)then if((strstart[poplit2+1]-strstart[ poplit2])=0)then begin begin strptr:=strptr+1;poolptr:=strstart[strptr]; end;litstack[litstkptr]:=poplit1;litstkptr:=litstkptr+1; end else if((strstart[poplit1+1]-strstart[poplit1])=0)then litstkptr:= litstkptr+1 else begin splength:=(strstart[poplit1+1]-strstart[poplit1]) ;sp2length:=(strstart[poplit2+1]-strstart[poplit2]); begin if(poolptr+splength+sp2length>poolsize)then pooloverflow;end; spptr:=strstart[poplit1+1];spend:=strstart[poplit1]; spxptr1:=spptr+sp2length;while(spptr>spend)do begin spptr:=spptr-1; spxptr1:=spxptr1-1;strpool[spxptr1]:=strpool[spptr];end; spptr:=strstart[poplit2];spend:=strstart[poplit2+1]; while(spptrpoolsize)then pooloverflow;end;spptr:=strstart[poplit2];spend:=strstart[poplit2+1]; while(spptr2)then printwrongstklit(poplit1,poptyp1,2)else if((not messwithentries)and((fntype[poplit1]=6)or(fntype[poplit1]=5)))then bstcantmesswithentriesprint else case(fntype[poplit1])of 5:{356:} if(poptyp2<>0)then printwrongstklit(poplit2,poptyp2,0)else entryints[ citeptr*numentints+ilkinfo[poplit1]]:=poplit2{:356};6:{358:} begin if(poptyp2<>1)then printwrongstklit(poplit2,poptyp2,1)else begin strentptr:=citeptr*numentstrs+ilkinfo[poplit1];entchrptr:=0; spptr:=strstart[poplit2];spxptr1:=strstart[poplit2+1]; if(spxptr1-spptr>entstrsize)then begin begin bst1printstringsizeexceeded ;begin write(logfile,entstrsize:0,', the entry'); write(standardoutput,entstrsize:0,', the entry');end; bst2printstringsizeexceeded;end;spxptr1:=spptr+entstrsize;end; while(spptr0)then printwrongstklit(poplit2,poptyp2,0)else ilkinfo[ poplit1]:=poplit2{:359};8:{360:} begin if(poptyp2<>1)then printwrongstklit(poplit2,poptyp2,1)else begin strglbptr:=ilkinfo[poplit1]; if(poplit2globstrsize)then begin begin bst1printstringsizeexceeded; begin write(logfile,globstrsize:0,', the global'); write(standardoutput,globstrsize:0,', the global');end; bst2printstringsizeexceeded;end;spend:=spptr+globstrsize;end; while(spptr1)then begin printwrongstklit(poplit1,poptyp1,1); pushlitstk(snull,1); end else if((strstart[poplit1+1]-strstart[poplit1])=0)then pushlitstk( snull,1)else{362:}begin spptr:=strstart[poplit1+1]; spend:=strstart[poplit1];while(spptr>spend)do begin spptr:=spptr-1; if(strpool[spptr]<>125)then goto 15;end; 15:case(strpool[spptr])of 46,63,33:begin if(litstack[litstkptr]>= cmdstrptr)then begin strptr:=strptr+1;poolptr:=strstart[strptr];end; litstkptr:=litstkptr+1;end;others:{363:} begin if(poplit1poolsize)then pooloverflow;end; spptr:=strstart[poplit1];spend:=strstart[poplit1+1]; while(spptrpoolsize)then pooloverflow;end;end; begin strpool[poolptr]:=46;poolptr:=poolptr+1;end; pushlitstk(makestring,1);end{:363}end;end{:362};end;{:361}{365:} procedure xchangecase;label 21;begin poplitstk(poplit1,poptyp1); poplitstk(poplit2,poptyp2); if(poptyp1<>1)then begin printwrongstklit(poplit1,poptyp1,1); pushlitstk(snull,1); end else if(poptyp2<>1)then begin printwrongstklit(poplit2,poptyp2,1); pushlitstk(snull,1);end else begin{367:} begin case(strpool[strstart[poplit1]])of 116,84:conversiontype:=0; 108,76:conversiontype:=1;117,85:conversiontype:=2; others:conversiontype:=3 end; if(((strstart[poplit1+1]-strstart[poplit1])<>1)or(conversiontype=3))then begin conversiontype:=3;printapoolstr(poplit1); begin begin write(logfile,' is an illegal case-conversion string'); write(standardoutput,' is an illegal case-conversion string');end; bstexwarnprint;end;end;end{:367};exbuflength:=0;addbufpool(poplit2); {371:}begin bracelevel:=0;exbufptr:=0; while(exbufptr1)then goto 21; if(exbufptr+4>exbuflength)then goto 21 else if(exbuf[exbufptr+1]<>92) then goto 21; if(conversiontype=0)then if(exbufptr=0)then goto 21 else if((prevcolon) and(lexclass[exbuf[exbufptr-1]]=1))then goto 21;{372:} begin exbufptr:=exbufptr+1; while((exbufptr0))do begin exbufptr:= exbufptr+1;exbufxptr:=exbufptr; while((exbufptr0)and(exbuf[exbufptr]<>92))do begin if(exbuf[exbufptr]=125)then bracelevel:=bracelevel-1 else if(exbuf [exbufptr]=123)then bracelevel:=bracelevel+1;exbufptr:=exbufptr+1;end; {376:} begin case(conversiontype)of 0,1:lowercase(exbuf,exbufxptr,exbufptr- exbufxptr);2:uppercase(exbuf,exbufxptr,exbufptr-exbufxptr);3:; others:caseconversionconfusion end;end{:376};end;exbufptr:=exbufptr-1; end{:372};21:prevcolon:=false; end else if(exbuf[exbufptr]=125)then begin decrbracelevel(poplit2); prevcolon:=false;end else if(bracelevel=0)then{377:} begin case(conversiontype)of 0:begin if(exbufptr=0)then else if(( prevcolon)and(lexclass[exbuf[exbufptr-1]]=1))then else lowercase(exbuf, exbufptr,1); if(exbuf[exbufptr]=58)then prevcolon:=true else if(lexclass[exbuf[ exbufptr]]<>1)then prevcolon:=false;end;1:lowercase(exbuf,exbufptr,1); 2:uppercase(exbuf,exbufptr,1);3:;others:caseconversionconfusion end; end{:377};exbufptr:=exbufptr+1;end;checkbracelevel(poplit2);end{:371}; addpoolbufandpush;end;end;{:365}{378:}procedure xchrtoint; begin poplitstk(poplit1,poptyp1); if(poptyp1<>1)then begin printwrongstklit(poplit1,poptyp1,1); pushlitstk(0,0); end else if((strstart[poplit1+1]-strstart[poplit1])<>1)then begin begin write(logfile,'"');write(standardoutput,'"');end;printapoolstr(poplit1); begin begin write(logfile,'" isn''t a single character'); write(standardoutput,'" isn''t a single character');end;bstexwarnprint; end;pushlitstk(0,0);end else pushlitstk(strpool[strstart[poplit1]],0); end;{:378}{379:}procedure xcite; begin if(not messwithentries)then bstcantmesswithentriesprint else pushlitstk(citelist[citeptr],1);end;{:379}{380:}procedure xduplicate; begin poplitstk(poplit1,poptyp1); if(poptyp1<>1)then begin pushlitstk(poplit1,poptyp1); pushlitstk(poplit1,poptyp1); end else begin begin if(litstack[litstkptr]>=cmdstrptr)then begin strptr :=strptr+1;poolptr:=strstart[strptr];end;litstkptr:=litstkptr+1;end; if(poplit1poolsize)then pooloverflow;end;spptr:=strstart[poplit1];spend:=strstart[poplit1+1]; while(spptr1)then begin pushlitstk(0,0);goto 10;end;spptr:=spptr+1;end;pushlitstk(1,0);end{:382} ;3:pushlitstk(1,0);4:pushlitstk(0,0); others:begin printstklit(poplit1,poptyp1); begin begin write(logfile,', not a string or missing field,'); write(standardoutput,', not a string or missing field,');end; bstexwarnprint;end;pushlitstk(0,0);end end;10:end;{:381}{383:} procedure xformatname;label 16,17,52;begin poplitstk(poplit1,poptyp1); poplitstk(poplit2,poptyp2);poplitstk(poplit3,poptyp3); if(poptyp1<>1)then begin printwrongstklit(poplit1,poptyp1,1); pushlitstk(snull,1); end else if(poptyp2<>0)then begin printwrongstklit(poplit2,poptyp2,0); pushlitstk(snull,1); end else if(poptyp3<>1)then begin printwrongstklit(poplit3,poptyp3,1); pushlitstk(snull,1);end else begin exbuflength:=0;addbufpool(poplit3); {384:}begin exbufptr:=0;numnames:=0; while((numnamesexbufxptr)do case(lexclass[exbuf[exbufptr-1]])of 1, 4:exbufptr:=exbufptr-1; others:if(exbuf[exbufptr-1]=44)then begin begin write(logfile,'Name ', poplit2:0,' in "');write(standardoutput,'Name ',poplit2:0,' in "');end; printapoolstr(poplit3);begin write(logfile,'" has a comma at the end'); write(standardoutput,'" has a comma at the end');end;bstexwarnprint; exbufptr:=exbufptr-1;end else goto 16 end;16:end{:389};namebfptr:=0; numcommas:=0;numtokens:=0;tokenstarting:=true; while(exbufxptr0)and(exbufxptr0)do begin if((lexclass[namesepchar[vonstart]]<>4)or( namesepchar[vonstart]=126))then goto 17;vonstart:=vonstart-1;end; 17:vonend:=vonstart;52:firstend:=vonstart;end{:397}; end else if(numcommas=1)then begin vonstart:=0;lastend:=comma1; jrend:=lastend;firststart:=jrend;firstend:=numtokens; vonnameendsandlastnamestartsstuff; end else if(numcommas=2)then begin vonstart:=0;lastend:=comma1; jrend:=comma2;firststart:=jrend;firstend:=numtokens; vonnameendsandlastnamestartsstuff; end else begin begin write(logfile,'Illegal number of comma,s'); write(standardoutput,'Illegal number of comma,s');end;printconfusion; goto 9998;end;end{:396};exbuflength:=0;addbufpool(poplit1); figureouttheformattedname;addpoolbufandpush;end;end;{:383}{423:} procedure xinttochr;begin poplitstk(poplit1,poptyp1); if(poptyp1<>0)then begin printwrongstklit(poplit1,poptyp1,0); pushlitstk(snull,1); end else if((poplit1<0)or(poplit1>127))then begin begin begin write( logfile,poplit1:0,' isn''t valid ASCII'); write(standardoutput,poplit1:0,' isn''t valid ASCII');end; bstexwarnprint;end;pushlitstk(snull,1); end else begin begin if(poolptr+1>poolsize)then pooloverflow;end; begin strpool[poolptr]:=poplit1;poolptr:=poolptr+1;end; pushlitstk(makestring,1);end;end;{:423}{424:}procedure xinttostr; begin poplitstk(poplit1,poptyp1); if(poptyp1<>0)then begin printwrongstklit(poplit1,poptyp1,0); pushlitstk(snull,1); end else begin inttoASCII(poplit1,exbuf,0,exbuflength); addpoolbufandpush;end;end;{:424}{425:}procedure xmissing; begin poplitstk(poplit1,poptyp1); if(not messwithentries)then bstcantmesswithentriesprint else if((poptyp1 <>1)and(poptyp1<>3))then begin if(poptyp1<>4)then begin printstklit( poplit1,poptyp1); begin begin write(logfile,', not a string or missing field,'); write(standardoutput,', not a string or missing field,');end; bstexwarnprint;end;end;pushlitstk(0,0); end else if(poptyp1=3)then pushlitstk(1,0)else pushlitstk(0,0);end; {:425}{427:}procedure xnumnames;begin poplitstk(poplit1,poptyp1); if(poptyp1<>1)then begin printwrongstklit(poplit1,poptyp1,1); pushlitstk(0,0);end else begin exbuflength:=0;addbufpool(poplit1);{428:} begin exbufptr:=0;numnames:=0; while(exbufptr1)then begin printwrongstklit(poplit1,poptyp1,1); pushlitstk(snull,1);end else begin exbuflength:=0;addbufpool(poplit1); {432:}begin bracelevel:=0;exbufxptr:=0;exbufptr:=0; while(exbufptr0))do begin exbufptr:= exbufptr+1;exbufyptr:=exbufptr; while((exbufptr0)and(exbuf[exbufptr]<>92))do begin case(lexclass[exbuf[exbufptr]])of 2,3:begin exbuf[exbufxptr]:= exbuf[exbufptr];exbufxptr:=exbufxptr+1;end; others:if(exbuf[exbufptr]=125)then bracelevel:=bracelevel-1 else if( exbuf[exbufptr]=123)then bracelevel:=bracelevel+1 end; exbufptr:=exbufptr+1;end;end;exbufptr:=exbufptr-1;end{:433}; end else if(exbuf[exbufptr]=125)then if(bracelevel>0)then bracelevel:= bracelevel-1 end;exbufptr:=exbufptr+1;end;exbuflength:=exbufxptr; end{:432};addpoolbufandpush;end;end;{:431}{435:}procedure xquote; begin begin if(poolptr+1>poolsize)then pooloverflow;end; begin strpool[poolptr]:=34;poolptr:=poolptr+1;end; pushlitstk(makestring,1);end;{:435}{438:}procedure xsubstring;label 10; begin poplitstk(poplit1,poptyp1);poplitstk(poplit2,poptyp2); poplitstk(poplit3,poptyp3); if(poptyp1<>0)then begin printwrongstklit(poplit1,poptyp1,0); pushlitstk(snull,1); end else if(poptyp2<>0)then begin printwrongstklit(poplit2,poptyp2,0); pushlitstk(snull,1); end else if(poptyp3<>1)then begin printwrongstklit(poplit3,poptyp3,1); pushlitstk(snull,1); end else begin splength:=(strstart[poplit3+1]-strstart[poplit3]); if(poplit1>=splength)then if((poplit2=1)or(poplit2=-1))then begin begin if(litstack[litstkptr]>=cmdstrptr)then begin strptr:=strptr+1; poolptr:=strstart[strptr];end;litstkptr:=litstkptr+1;end;goto 10;end; if((poplit1<=0)or(poplit2=0)or(poplit2>splength)or(poplit2<-splength)) then begin pushlitstk(snull,1);goto 10;end else{439:} begin if(poplit2>0)then begin if(poplit1>splength-(poplit2-1))then poplit1:=splength-(poplit2-1);spptr:=strstart[poplit3]+(poplit2-1); spend:=spptr+poplit1; if(poplit2=1)then if(poplit3>=cmdstrptr)then begin strstart[poplit3+1]:= spend;begin strptr:=strptr+1;poolptr:=strstart[strptr];end; litstkptr:=litstkptr+1;goto 10;end;end else begin poplit2:=-poplit2; if(poplit1>splength-(poplit2-1))then poplit1:=splength-(poplit2-1); spend:=strstart[poplit3+1]-(poplit2-1);spptr:=spend-poplit1;end; while(spptr1)or(poplit1=cmdstrptr))then begin strptr:=strptr+1; poolptr:=strstart[strptr];end;pushlitstk(poplit2,poptyp2); end else if((poptyp2<>1)or(poplit21)then begin printwrongstklit(poplit1,poptyp1,1); pushlitstk(snull,1);end else begin numtextchars:=0;{443:} begin spptr:=strstart[poplit1];spend:=strstart[poplit1+1]; spbracelevel:=0;while(spptr0))do begin if(strpool[spptr]=125) then spbracelevel:=spbracelevel-1 else if(strpool[spptr]=123)then spbracelevel:=spbracelevel+1;spptr:=spptr+1;end; numtextchars:=numtextchars+1;end; end else if(strpool[spptr-1]=125)then begin if(spbracelevel>0)then spbracelevel:=spbracelevel-1;end else numtextchars:=numtextchars+1;end; end{:443};pushlitstk(numtextchars,0);end;end;{:442}{444:} procedure xtextprefix;label 10;begin poplitstk(poplit1,poptyp1); poplitstk(poplit2,poptyp2); if(poptyp1<>0)then begin printwrongstklit(poplit1,poptyp1,0); pushlitstk(snull,1); end else if(poptyp2<>1)then begin printwrongstklit(poplit2,poptyp2,1); pushlitstk(snull,1); end else if(poplit1<=0)then begin pushlitstk(snull,1);goto 10; end else{445:}begin spptr:=strstart[poplit2];spend:=strstart[poplit2+1]; {446:}begin numtextchars:=0;spbracelevel:=0;spxptr1:=spptr; while((spxptr10))do begin if(strpool[spxptr1]= 125)then spbracelevel:=spbracelevel-1 else if(strpool[spxptr1]=123)then spbracelevel:=spbracelevel+1;spxptr1:=spxptr1+1;end; numtextchars:=numtextchars+1;end; end else if(strpool[spxptr1-1]=125)then begin if(spbracelevel>0)then spbracelevel:=spbracelevel-1;end else numtextchars:=numtextchars+1;end; spend:=spxptr1;end{:446}; if(poplit2>=cmdstrptr)then poolptr:=spend else while(spptr0)do begin begin strpool[poolptr]:=125; poolptr:=poolptr+1;end;spbracelevel:=spbracelevel-1;end; pushlitstk(makestring,1);end{:445};10:end;{:444}{448:}procedure xtype; begin if(not messwithentries)then bstcantmesswithentriesprint else if(( typelist[citeptr]=undefined)or(typelist[citeptr]=0))then pushlitstk( snull,1)else pushlitstk(hashtext[typelist[citeptr]],1);end;{:448}{449:} procedure xwarning;begin poplitstk(poplit1,poptyp1); if(poptyp1<>1)then printwrongstklit(poplit1,poptyp1,1)else begin begin write(logfile,'Warning--');write(standardoutput,'Warning--');end; printlit(poplit1,poptyp1);markwarning;end;end;{:449}{451:} procedure xwidth;begin poplitstk(poplit1,poptyp1); if(poptyp1<>1)then begin printwrongstklit(poplit1,poptyp1,1); pushlitstk(0,0);end else begin exbuflength:=0;addbufpool(poplit1); stringwidth:=0;{452:}begin bracelevel:=0;exbufptr:=0; while(exbufptr0))do begin exbufptr:= exbufptr+1;exbufxptr:=exbufptr; while((exbufptr0)and(exbuf[exbufptr]<>92))do begin if(exbuf[exbufptr]=125)then bracelevel:=bracelevel-1 else if(exbuf [exbufptr]=123)then bracelevel:=bracelevel+1 else stringwidth:= stringwidth+charwidth[exbuf[exbufptr]];exbufptr:=exbufptr+1;end;end; exbufptr:=exbufptr-1;end{:453} else stringwidth:=stringwidth+charwidth[123]else stringwidth:= stringwidth+charwidth[123]; end else if(exbuf[exbufptr]=125)then begin decrbracelevel(poplit1); stringwidth:=stringwidth+charwidth[125]; end else stringwidth:=stringwidth+charwidth[exbuf[exbufptr]]; exbufptr:=exbufptr+1;end;checkbracelevel(poplit1);end{:452}; pushlitstk(stringwidth,0);end end;{:451}{455:}procedure xwrite; begin poplitstk(poplit1,poptyp1); if(poptyp1<>1)then printwrongstklit(poplit1,poptyp1,1)else addoutpool( poplit1);end;{:455}{326:}procedure executefn(exfnloc:hashloc);{344:} label 51;var rpoplt1,rpoplt2:integer;rpoptp1,rpoptp2:stktype;{:344} wizptr:wizfnloc;begin ifdef('TRACE')begin write(logfile,'execute_fn `'); end;begin outpoolstr(logfile,hashtext[exfnloc]);end; begin writeln(logfile,'''');end; endif('TRACE')case(fntype[exfnloc])of 0:{342:} begin ifndef('NO_BIBTEX_STAT')executioncount[ilkinfo[exfnloc]]:= executioncount[ilkinfo[exfnloc]]+1; endifn('NO_BIBTEX_STAT')case(ilkinfo[exfnloc])of 0:xequals; 1:xgreaterthan;2:xlessthan;3:xplus;4:xminus;5:xconcatenate;6:xgets; 7:xaddperiod;8:{364:} begin if(not messwithentries)then bstcantmesswithentriesprint else if( typelist[citeptr]=undefined)then executefn(bdefault)else if(typelist[ citeptr]=0)then else executefn(typelist[citeptr]);end{:364}; 9:xchangecase;10:xchrtoint;11:xcite;12:xduplicate;13:xempty; 14:xformatname;15:{422:}begin poplitstk(poplit1,poptyp1); poplitstk(poplit2,poptyp2);poplitstk(poplit3,poptyp3); if(poptyp1<>2)then printwrongstklit(poplit1,poptyp1,2)else if(poptyp2<>2 )then printwrongstklit(poplit2,poptyp2,2)else if(poptyp3<>0)then printwrongstklit(poplit3,poptyp3,0)else if(poplit3>0)then executefn( poplit2)else executefn(poplit1);end{:422};16:xinttochr;17:xinttostr; 18:xmissing;19:{426:}begin outputbblline;end{:426};20:xnumnames; 21:{429:}begin poplitstk(poplit1,poptyp1);end{:429};22:xpreamble; 23:xpurify;24:xquote;25:{436:}begin;end{:436};26:{437:} begin popwholestack;end{:437};27:xsubstring;28:xswap;29:xtextlength; 30:xtextprefix;31:{447:}begin poptopandprint;end{:447};32:xtype; 33:xwarning;34:{450:}begin poplitstk(rpoplt1,rpoptp1); poplitstk(rpoplt2,rpoptp2); if(rpoptp1<>2)then printwrongstklit(rpoplt1,rpoptp1,2)else if(rpoptp2<>2 )then printwrongstklit(rpoplt2,rpoptp2,2)else while true do begin executefn(rpoplt2);poplitstk(poplit1,poptyp1); if(poptyp1<>0)then begin printwrongstklit(poplit1,poptyp1,0);goto 51; end else if(poplit1>0)then executefn(rpoplt1)else goto 51;end; 51:end{:450};35:xwidth;36:xwrite; others:begin begin write(logfile,'Unknown built-in function'); write(standardoutput,'Unknown built-in function');end;printconfusion; goto 9998;end end;end{:342};1:{327:}begin wizptr:=ilkinfo[exfnloc]; while(wizfunctions[wizptr]<>endofdef)do begin if(wizfunctions[wizptr]<> quotenextfn)then executefn(wizfunctions[wizptr])else begin wizptr:= wizptr+1;pushlitstk(wizfunctions[wizptr],2);end;wizptr:=wizptr+1;end; end{:327};2:pushlitstk(ilkinfo[exfnloc],0); 3:pushlitstk(hashtext[exfnloc],1);4:{328:} begin if(not messwithentries)then bstcantmesswithentriesprint else begin fieldptr:=citeptr*numfields+ilkinfo[exfnloc]; checkfieldoverflow(fieldptr); if(fieldinfo[fieldptr]=0)then pushlitstk(hashtext[exfnloc],3)else pushlitstk(fieldinfo[fieldptr],1);end end{:328};5:{329:} begin if(not messwithentries)then bstcantmesswithentriesprint else pushlitstk(entryints[citeptr*numentints+ilkinfo[exfnloc]],0);end{:329}; 6:{330:} begin if(not messwithentries)then bstcantmesswithentriesprint else begin strentptr:=citeptr*numentstrs+ilkinfo[exfnloc];exbufptr:=0; while(entrystrs[(strentptr)*(entstrsize+1)+(exbufptr)]<>127)do begin exbuf[exbufptr]:=entrystrs[(strentptr)*(entstrsize+1)+(exbufptr)]; exbufptr:=exbufptr+1;end;exbuflength:=exbufptr;addpoolbufandpush;end; end{:330};7:pushlitstk(ilkinfo[exfnloc],0);8:{331:} begin strglbptr:=ilkinfo[exfnloc]; if(glbstrptr[strglbptr]>0)then pushlitstk(glbstrptr[strglbptr],1)else begin begin if(poolptr+glbstrend[strglbptr]>poolsize)then pooloverflow; end;globchrptr:=0; while(globchrptrmaxint)or(auxnamelength+(strstart[slogextension+1]- strstart[slogextension])>maxint)or(auxnamelength+(strstart[sbblextension +1]-strstart[sbblextension])>maxint))then begin samtoolongfilenameprint; goto 46;end;{107:}begin namelength:=auxnamelength; if strcmp(nameoffile+1+namelength-3,'aux')<>0 then addextension( sauxextension);auxptr:=0; if(not aopenin(auxfile[auxptr],-1))then begin samwrongfilenameprint; goto 46;end;namelength:=auxnamelength;addextension(slogextension); if(not aopenout(logfile))then begin samwrongfilenameprint;goto 46;end; namelength:=auxnamelength;addextension(sbblextension); if(not aopenout(bblfile))then begin samwrongfilenameprint;goto 46;end; end{:107};{108:}begin namelength:=auxnamelength; addextension(sauxextension);nameptr:=1; while(nameptr<=namelength)do begin buffer[nameptr]:=xord[nameoffile[ nameptr]];nameptr:=nameptr+1;end; toplevstr:=hashtext[strlookup(buffer,1,auxnamelength,0,true)]; auxlist[auxptr]:=hashtext[strlookup(buffer,1,namelength,3,true)]; if(hashfound)then begin ifdef('TRACE')printauxname; endif('TRACE')begin begin write(logfile, 'Already encountered auxiliary file'); write(standardoutput,'Already encountered auxiliary file');end; printconfusion;goto 9998;end;end;auxlnstack[auxptr]:=0;end{:108}; goto 41;end{:104};46:uexit(1);41:end;{:101}{121:} procedure auxbibdatacommand;label 10; begin if(bibseen)then begin auxerrillegalanotherprint(0); begin auxerrprint;goto 10;end;end;bibseen:=true; while(buffer[bufptr2]<>125)do begin bufptr2:=bufptr2+1; if(not scan2white(125,44))then begin auxerrnorightbraceprint; begin auxerrprint;goto 10;end;end; if(lexclass[buffer[bufptr2]]=1)then begin auxerrwhitespaceinargumentprint;begin auxerrprint;goto 10;end;end; if((last>bufptr2+1)and(buffer[bufptr2]=125))then begin auxerrstuffafterrightbraceprint;begin auxerrprint;goto 10;end;end;{124:} begin if(bibptr=maxbibfiles)then begin BIBXRETALLOC('bib_list',biblist, strnumber,maxbibfiles,maxbibfiles+MAXBIBFILES); BIBXRETALLOC('bib_file',bibfile,alphafile,maxbibfiles,maxbibfiles); BIBXRETALLOC('s_preamble',spreamble,strnumber,maxbibfiles,maxbibfiles); end; biblist[bibptr]:=hashtext[strlookup(buffer,bufptr1,(bufptr2-bufptr1),6, true)];if(hashfound)then begin begin write(logfile, 'This database file appears more than once: '); write(standardoutput,'This database file appears more than once: ');end; printbibname;begin auxerrprint;goto 10;end;end; startname(biblist[bibptr]); if(not aopenin(bibfile[bibptr],kpsebibformat))then begin begin write( logfile,'I couldn''t open database file '); write(standardoutput,'I couldn''t open database file ');end; printbibname;begin auxerrprint;goto 10;end;end; ifdef('TRACE')begin outpoolstr(logfile,biblist[bibptr]);end; begin outpoolstr(logfile,sbibextension);end; begin writeln(logfile,' is a bibdata file');end; endif('TRACE')bibptr:=bibptr+1;end{:124};end;10:end;{:121}{127:} procedure auxbibstylecommand;label 10; begin if(bstseen)then begin auxerrillegalanotherprint(1); begin auxerrprint;goto 10;end;end;bstseen:=true;bufptr2:=bufptr2+1; if(not scan1white(125))then begin auxerrnorightbraceprint; begin auxerrprint;goto 10;end;end; if(lexclass[buffer[bufptr2]]=1)then begin auxerrwhitespaceinargumentprint;begin auxerrprint;goto 10;end;end; if(last>bufptr2+1)then begin auxerrstuffafterrightbraceprint; begin auxerrprint;goto 10;end;end;{128:} begin bststr:=hashtext[strlookup(buffer,bufptr1,(bufptr2-bufptr1),5,true )];if(hashfound)then begin ifdef('TRACE')printbstname; endif('TRACE')begin begin write(logfile,'Already encountered style file' );write(standardoutput,'Already encountered style file');end; printconfusion;goto 9998;end;end;startname(bststr); if(not aopenin(bstfile,kpsebstformat))then begin begin write(logfile, 'I couldn''t open style file '); write(standardoutput,'I couldn''t open style file ');end;printbstname; bststr:=0;begin auxerrprint;goto 10;end;end; if verbose then begin begin write(logfile,'The style file: '); write(standardoutput,'The style file: ');end;printbstname;end;end{:128}; 10:end;{:127}{133:}procedure auxcitationcommand;label 23,10; begin citationseen:=true; while(buffer[bufptr2]<>125)do begin bufptr2:=bufptr2+1; if(not scan2white(125,44))then begin auxerrnorightbraceprint; begin auxerrprint;goto 10;end;end; if(lexclass[buffer[bufptr2]]=1)then begin auxerrwhitespaceinargumentprint;begin auxerrprint;goto 10;end;end; if((last>bufptr2+1)and(buffer[bufptr2]=125))then begin auxerrstuffafterrightbraceprint;begin auxerrprint;goto 10;end;end;{134:} begin ifdef('TRACE')begin outtoken(logfile);end; begin write(logfile,' cite key encountered');end;endif('TRACE'){135:} begin if((bufptr2-bufptr1)=1)then if(buffer[bufptr1]=42)then begin ifdef('TRACE')begin writeln(logfile,'---entire database to be included') ;end;endif('TRACE')if(allentries)then begin begin writeln(logfile, 'Multiple inclusions of entire database'); writeln(standardoutput,'Multiple inclusions of entire database');end; begin auxerrprint;goto 10;end;end else begin allentries:=true; allmarker:=citeptr;goto 23;end;end;end{:135};tmpptr:=bufptr1; while(tmpptrbufptr2+1)then begin auxerrstuffafterrightbraceprint; begin auxerrprint;goto 10;end;end;{141:}begin auxptr:=auxptr+1; if(auxptr=auxstacksize)then begin printatoken;begin write(logfile,': '); write(standardoutput,': ');end;begin printoverflow; begin writeln(logfile,'auxiliary file depth ',auxstacksize:0); writeln(standardoutput,'auxiliary file depth ',auxstacksize:0);end; goto 9998;end;end;auxextensionok:=true; if((bufptr2-bufptr1)<(strstart[sauxextension+1]-strstart[sauxextension]) )then auxextensionok:=false else if(not streqbuf(sauxextension,buffer, bufptr2-(strstart[sauxextension+1]-strstart[sauxextension]),(strstart[ sauxextension+1]-strstart[sauxextension])))then auxextensionok:=false; if(not auxextensionok)then begin printatoken; begin write(logfile,' has a wrong extension'); write(standardoutput,' has a wrong extension');end;auxptr:=auxptr-1; begin auxerrprint;goto 10;end;end; auxlist[auxptr]:=hashtext[strlookup(buffer,bufptr1,(bufptr2-bufptr1),3, true)]; if(hashfound)then begin begin write(logfile,'Already encountered file ') ;write(standardoutput,'Already encountered file ');end;printauxname; auxptr:=auxptr-1;begin auxerrprint;goto 10;end;end;{142:} begin startname(auxlist[auxptr]);nameptr:=namelength+1; nameoffile[nameptr]:=0; if(not aopenin(auxfile[auxptr],-1))then begin begin write(logfile, 'I couldn''t open auxiliary file '); write(standardoutput,'I couldn''t open auxiliary file ');end; printauxname;auxptr:=auxptr-1;begin auxerrprint;goto 10;end;end; begin write(logfile,'A level-',auxptr:0,' auxiliary file: '); write(standardoutput,'A level-',auxptr:0,' auxiliary file: ');end; printauxname;auxlnstack[auxptr]:=0;end{:142};end{:141};10:end;{:140} {143:}procedure poptheauxstack;begin aclose(auxfile[auxptr]); if(auxptr=0)then goto 31 else auxptr:=auxptr-1;end;{:143}{144:}{117:} procedure getauxcommandandprocess;label 10;begin bufptr2:=0; if(not scan1(123))then goto 10; commandnum:=ilkinfo[strlookup(buffer,bufptr1,(bufptr2-bufptr1),2,false)] ;if(hashfound)then case(commandnum)of 0:auxbibdatacommand; 1:auxbibstylecommand;2:auxcitationcommand;3:auxinputcommand; others:begin begin write(logfile,'Unknown auxiliary-file command'); write(standardoutput,'Unknown auxiliary-file command');end; printconfusion;goto 9998;end end;10:end;{:117}{:144}{146:} procedure lastcheckforauxerrors;begin numcites:=citeptr; numbibfiles:=bibptr;if(not citationseen)then begin auxend1errprint; begin write(logfile,'\citation commands'); write(standardoutput,'\citation commands');end;auxend2errprint; end else if((numcites=0)and(not allentries))then begin auxend1errprint; begin write(logfile,'cite keys');write(standardoutput,'cite keys');end; auxend2errprint;end;if(not bibseen)then begin auxend1errprint; begin write(logfile,'\bibdata command'); write(standardoutput,'\bibdata command');end;auxend2errprint; end else if(numbibfiles=0)then begin auxend1errprint; begin write(logfile,'database files'); write(standardoutput,'database files');end;auxend2errprint;end; if(not bstseen)then begin auxend1errprint; begin write(logfile,'\bibstyle command'); write(standardoutput,'\bibstyle command');end;auxend2errprint; end else if(bststr=0)then begin auxend1errprint; begin write(logfile,'style file');write(standardoutput,'style file'); end;auxend2errprint;end;end;{:146}{171:}procedure bstentrycommand; label 10;begin if(entryseen)then begin begin write(logfile, 'Illegal, another entry command'); write(standardoutput,'Illegal, another entry command');end; begin bsterrprintandlookforblankline;goto 10;end;end;entryseen:=true; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{172:} begin begin if(buffer[bufptr2]<>123)then begin bstleftbraceprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end; while(buffer[bufptr2]<>125)do begin begin scanidentifier(125,37,37); if((scanresult=3)or(scanresult=1))then else begin bstidprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{173:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a field');end; endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); fnloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11,true); begin if(hashfound)then begin alreadyseenfunctionprint(fnloc);goto 10; end;end;fntype[fnloc]:=4;ilkinfo[fnloc]:=numfields; numfields:=numfields+1;end{:173}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end;end; bufptr2:=bufptr2+1;end{:172}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end; if(numfields=numpredefinedfields)then begin begin write(logfile, 'Warning--I didn''t find any fields'); write(standardoutput,'Warning--I didn''t find any fields');end; bstwarnprint;end;{174:} begin begin if(buffer[bufptr2]<>123)then begin bstleftbraceprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end; while(buffer[bufptr2]<>125)do begin begin scanidentifier(125,37,37); if((scanresult=3)or(scanresult=1))then else begin bstidprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{175:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is an integer entry-variable');end; endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); fnloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11,true); begin if(hashfound)then begin alreadyseenfunctionprint(fnloc);goto 10; end;end;fntype[fnloc]:=5;ilkinfo[fnloc]:=numentints; numentints:=numentints+1;end{:175}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end;end; bufptr2:=bufptr2+1;end{:174}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{176:} begin begin if(buffer[bufptr2]<>123)then begin bstleftbraceprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end; while(buffer[bufptr2]<>125)do begin begin scanidentifier(125,37,37); if((scanresult=3)or(scanresult=1))then else begin bstidprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{177:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a string entry-variable');end; endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); fnloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11,true); begin if(hashfound)then begin alreadyseenfunctionprint(fnloc);goto 10; end;end;fntype[fnloc]:=6;ilkinfo[fnloc]:=numentstrs; numentstrs:=numentstrs+1;end{:177}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'entry');write(standardoutput,'entry');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end;end; bufptr2:=bufptr2+1;end{:176};10:end;{:171}{178:} function badargumenttoken:boolean;label 10;begin badargumenttoken:=true; lowercase(buffer,bufptr1,(bufptr2-bufptr1)); fnloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11,false); if(not hashfound)then begin printatoken; begin begin write(logfile,' is an unknown function'); write(standardoutput,' is an unknown function');end; begin bsterrprintandlookforblankline;goto 10;end;end; end else if((fntype[fnloc]<>0)and(fntype[fnloc]<>1))then begin printatoken;begin write(logfile,' has bad function type '); write(standardoutput,' has bad function type ');end;printfnclass(fnloc); begin bsterrprintandlookforblankline;goto 10;end;end; badargumenttoken:=false;10:end;{:178}{179:}procedure bstexecutecommand; label 10;begin if(not readseen)then begin begin write(logfile, 'Illegal, execute command before read command'); write(standardoutput,'Illegal, execute command before read command'); end;begin bsterrprintandlookforblankline;goto 10;end;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'execute');write(standardoutput,'execute'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>123)then begin bstleftbraceprint; begin begin write(logfile,'execute');write(standardoutput,'execute'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'execute');write(standardoutput,'execute'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin scanidentifier(125,37,37); if((scanresult=3)or(scanresult=1))then else begin bstidprint; begin begin write(logfile,'execute');write(standardoutput,'execute'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{180:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a to be executed function');end; endif('TRACE')if(badargumenttoken)then goto 10;end{:180}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'execute');write(standardoutput,'execute'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>125)then begin bstrightbraceprint; begin begin write(logfile,'execute');write(standardoutput,'execute'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end;{297:}begin initcommandexecution; messwithentries:=false;executefn(fnloc);checkcommandexecution;end{:297}; 10:end;{:179}{181:}procedure bstfunctioncommand;label 10; begin begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'function');write(standardoutput,'function'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{182:} begin begin if(buffer[bufptr2]<>123)then begin bstleftbraceprint; begin begin write(logfile,'function');write(standardoutput,'function'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'function');write(standardoutput,'function'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin scanidentifier(125,37,37); if((scanresult=3)or(scanresult=1))then else begin bstidprint; begin begin write(logfile,'function');write(standardoutput,'function'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{183:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a wizard-defined function');end; endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); wizloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11,true); begin if(hashfound)then begin alreadyseenfunctionprint(wizloc);goto 10; end;end;fntype[wizloc]:=1; if(hashtext[wizloc]=sdefault)then bdefault:=wizloc;end{:183}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'function');write(standardoutput,'function'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>125)then begin bstrightbraceprint; begin begin write(logfile,'function');write(standardoutput,'function'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end;end{:182}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'function');write(standardoutput,'function'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>123)then begin bstleftbraceprint; begin begin write(logfile,'function');write(standardoutput,'function'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end;scanfndef(wizloc);10:end;{:181}{202:} procedure bstintegerscommand;label 10; begin begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'integers');write(standardoutput,'integers'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>123)then begin bstleftbraceprint; begin begin write(logfile,'integers');write(standardoutput,'integers'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'integers');write(standardoutput,'integers'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; while(buffer[bufptr2]<>125)do begin begin scanidentifier(125,37,37); if((scanresult=3)or(scanresult=1))then else begin bstidprint; begin begin write(logfile,'integers');write(standardoutput,'integers'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{203:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is an integer global-variable');end; endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); fnloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11,true); begin if(hashfound)then begin alreadyseenfunctionprint(fnloc);goto 10; end;end;fntype[fnloc]:=7;ilkinfo[fnloc]:=0;end{:203}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'integers');write(standardoutput,'integers'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end;end; bufptr2:=bufptr2+1;10:end;{:202}{204:}procedure bstiteratecommand; label 10;begin if(not readseen)then begin begin write(logfile, 'Illegal, iterate command before read command'); write(standardoutput,'Illegal, iterate command before read command'); end;begin bsterrprintandlookforblankline;goto 10;end;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'iterate');write(standardoutput,'iterate'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>123)then begin bstleftbraceprint; begin begin write(logfile,'iterate');write(standardoutput,'iterate'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'iterate');write(standardoutput,'iterate'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin scanidentifier(125,37,37); if((scanresult=3)or(scanresult=1))then else begin bstidprint; begin begin write(logfile,'iterate');write(standardoutput,'iterate'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{205:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a to be iterated function');end; endif('TRACE')if(badargumenttoken)then goto 10;end{:205}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'iterate');write(standardoutput,'iterate'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>125)then begin bstrightbraceprint; begin begin write(logfile,'iterate');write(standardoutput,'iterate'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end;{298:}begin initcommandexecution; messwithentries:=true;sortciteptr:=0; while(sortciteptr123)then begin bstleftbraceprint; begin begin write(logfile,'macro');write(standardoutput,'macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'macro');write(standardoutput,'macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin scanidentifier(125,37,37); if((scanresult=3)or(scanresult=1))then else begin bstidprint; begin begin write(logfile,'macro');write(standardoutput,'macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{208:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a macro');end; endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); macronameloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),13,true); if(hashfound)then begin printatoken; begin begin write(logfile,' is already defined as a macro'); write(standardoutput,' is already defined as a macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end; ilkinfo[macronameloc]:=hashtext[macronameloc];end{:208}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'macro');write(standardoutput,'macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>125)then begin bstrightbraceprint; begin begin write(logfile,'macro');write(standardoutput,'macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end;end{:207}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'macro');write(standardoutput,'macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{209:} begin begin if(buffer[bufptr2]<>123)then begin bstleftbraceprint; begin begin write(logfile,'macro');write(standardoutput,'macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'macro');write(standardoutput,'macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end; if(buffer[bufptr2]<>34)then begin begin write(logfile, 'A macro definition must be ',xchr[34],'-delimited'); write(standardoutput,'A macro definition must be ',xchr[34],'-delimited' );end;begin bsterrprintandlookforblankline;goto 10;end;end;{210:} begin bufptr2:=bufptr2+1; if(not scan1(34))then begin begin write(logfile,'There''s no `',xchr[34] ,''' to end macro definition'); write(standardoutput,'There''s no `',xchr[34], ''' to end macro definition');end;begin bsterrprintandlookforblankline; goto 10;end;end;ifdef('TRACE')begin write(logfile,'"');end; begin outtoken(logfile);end;begin write(logfile,'"');end; begin writeln(logfile,' is a macro string');end; endif('TRACE')macrodefloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),0, true);fntype[macrodefloc]:=3; ilkinfo[macronameloc]:=hashtext[macrodefloc];bufptr2:=bufptr2+1; end{:210};begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'macro');write(standardoutput,'macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>125)then begin bstrightbraceprint; begin begin write(logfile,'macro');write(standardoutput,'macro');end; begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end;end{:209};10:end;{:206}{211:}{237:} procedure getbibcommandorentryandprocess;label 22,26,15,10; begin atbibcommand:=false;{238:} while(not scan1(64))do begin if(not inputln(bibfile[bibptr]))then goto 10;biblinenum:=biblinenum+1;bufptr2:=0;end{:238};{239:} begin if(buffer[bufptr2]<>64)then begin begin write(logfile,'An "',xchr[ 64],'" disappeared'); write(standardoutput,'An "',xchr[64],'" disappeared');end; printconfusion;goto 9998;end;bufptr2:=bufptr2+1; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; scanidentifier(123,40,40); begin if((scanresult=3)or(scanresult=1))then else begin bibidprint; begin begin write(logfile,'an entry type'); write(standardoutput,'an entry type');end;biberrprint;goto 10;end;end; end;ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is an entry type or a database-file command'); end;endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); commandnum:=ilkinfo[strlookup(buffer,bufptr1,(bufptr2-bufptr1),12,false) ];if(hashfound)then{240:}begin atbibcommand:=true; case(commandnum)of 0:{242:}begin goto 10;end{:242};1:{243:} begin if(preambleptr=maxbibfiles)then begin BIBXRETALLOC('bib_list', biblist,strnumber,maxbibfiles,maxbibfiles+MAXBIBFILES); BIBXRETALLOC('bib_file',bibfile,alphafile,maxbibfiles,maxbibfiles); BIBXRETALLOC('s_preamble',spreamble,strnumber,maxbibfiles,maxbibfiles); end;begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end; end; if(buffer[bufptr2]=123)then rightouterdelim:=125 else if(buffer[bufptr2] =40)then rightouterdelim:=41 else begin biboneoftwoprint(123,40); goto 10;end;bufptr2:=bufptr2+1; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; storefield:=true; if(not scanandstorethefieldvalueandeatwhite)then goto 10; if(buffer[bufptr2]<>rightouterdelim)then begin begin write(logfile, 'Missing "',xchr[rightouterdelim],'" in preamble command'); write(standardoutput,'Missing "',xchr[rightouterdelim], '" in preamble command');end;biberrprint;goto 10;end;bufptr2:=bufptr2+1; goto 10;end{:243};2:{244:} begin begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end; end;{245:} begin if(buffer[bufptr2]=123)then rightouterdelim:=125 else if(buffer[ bufptr2]=40)then rightouterdelim:=41 else begin biboneoftwoprint(123,40) ;goto 10;end;bufptr2:=bufptr2+1; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; scanidentifier(61,61,61); begin if((scanresult=3)or(scanresult=1))then else begin bibidprint; begin begin write(logfile,'a string name'); write(standardoutput,'a string name');end;biberrprint;goto 10;end;end; end;{246:}begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a database-defined macro');end; endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); curmacroloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),13,true); ilkinfo[curmacroloc]:=hashtext[curmacroloc]; {if(hashfound)then begin macrowarnprint; begin begin writeln(logfile,'having its definition overwritten'); writeln(standardoutput,'having its definition overwritten');end; bibwarnprint;end;end;}end{:246};end{:245}; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; {247:}begin if(buffer[bufptr2]<>61)then begin bibequalssignprint; goto 10;end;bufptr2:=bufptr2+1; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; storefield:=true; if(not scanandstorethefieldvalueandeatwhite)then goto 10; if(buffer[bufptr2]<>rightouterdelim)then begin begin write(logfile, 'Missing "',xchr[rightouterdelim],'" in string command'); write(standardoutput,'Missing "',xchr[rightouterdelim], '" in string command');end;biberrprint;goto 10;end;bufptr2:=bufptr2+1; end{:247};goto 10;end{:244};others:bibcmdconfusion end;end{:240} else begin entrytypeloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11, false); if((not hashfound)or(fntype[entrytypeloc]<>1))then typeexists:=false else typeexists:=true;end;end{:239}; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; {267:} begin if(buffer[bufptr2]=123)then rightouterdelim:=125 else if(buffer[ bufptr2]=40)then rightouterdelim:=41 else begin biboneoftwoprint(123,40) ;goto 10;end;bufptr2:=bufptr2+1; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; if(rightouterdelim=41)then begin if(scan1white(44))then; end else if(scan2white(44,125))then;{268:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a database key');end; endif('TRACE')tmpptr:=bufptr1; while(tmpptr= oldnumcites))then begin if(typelist[entryciteptr]=0)then begin{270:} begin if((not allentries)and(entryciteptr>=oldnumcites))then begin citeloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),9,true); if(not hashfound)then begin ilkinfo[lcciteloc]:=citeloc; ilkinfo[citeloc]:=entryciteptr; citelist[entryciteptr]:=hashtext[citeloc];hashfound:=true;end;end; end{:270};goto 26;end; end else if(not entryexists[entryciteptr])then begin{271:} begin exbufptr:=0;tmpptr:=strstart[citeinfo[entryciteptr]]; tmpendptr:=strstart[citeinfo[entryciteptr]+1]; while(tmpptrrightouterdelim)do begin if(buffer[bufptr2] <>44)then begin biboneoftwoprint(44,rightouterdelim);goto 10;end; bufptr2:=bufptr2+1;begin if(not eatbibwhitespace)then begin eatbibprint; goto 10;end;end;if(buffer[bufptr2]=rightouterdelim)then goto 15;{276:} begin scanidentifier(61,61,61); begin if((scanresult=3)or(scanresult=1))then else begin bibidprint; begin begin write(logfile,'a field name'); write(standardoutput,'a field name');end;biberrprint;goto 10;end;end; end;ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a field name');end; endif('TRACE')storefield:=false; if(storeentry)then begin lowercase(buffer,bufptr1,(bufptr2-bufptr1)); fieldnameloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11,false); if(hashfound)then if(fntype[fieldnameloc]=4)then storefield:=true;end; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; if(buffer[bufptr2]<>61)then begin bibequalssignprint;goto 10;end; bufptr2:=bufptr2+1;end{:276}; begin if(not eatbibwhitespace)then begin eatbibprint;goto 10;end;end; if(not scanandstorethefieldvalueandeatwhite)then goto 10;end; 15:bufptr2:=bufptr2+1;end{:275};10:end;{:237}{:211}{212:} procedure bstreadcommand;label 10; begin if(readseen)then begin begin write(logfile, 'Illegal, another read command'); write(standardoutput,'Illegal, another read command');end; begin bsterrprintandlookforblankline;goto 10;end;end;readseen:=true; if(not entryseen)then begin begin write(logfile, 'Illegal, read command before entry command'); write(standardoutput,'Illegal, read command before entry command');end; begin bsterrprintandlookforblankline;goto 10;end;end;svptr1:=bufptr2; svptr2:=last;tmpptr:=svptr1; while(tmpptr0)then if(findcitelocsforthiscitekey(fieldinfo[ fieldptr]))then begin citeloc:=ilkinfo[lcciteloc]; fieldinfo[fieldptr]:=hashtext[citeloc];citeparentptr:=ilkinfo[citeloc]; fieldptr:=citeptr*numfields+numpredefinedfields; fieldendptr:=fieldptr-numpredefinedfields+numfields; fieldparentptr:=citeparentptr*numfields+numpredefinedfields; while(fieldptr0)then if(not findcitelocsforthiscitekey( fieldinfo[fieldptr]))then begin if(citehashfound)then hashciteconfusion; nonexistentcrossreferenceerror;fieldinfo[fieldptr]:=0; end else begin if(citeloc<>ilkinfo[lcciteloc])then hashciteconfusion; citeparentptr:=ilkinfo[citeloc]; if(typelist[citeparentptr]=0)then begin nonexistentcrossreferenceerror; fieldinfo[fieldptr]:=0; end else begin fieldparentptr:=citeparentptr*numfields+crossrefnum; if(fieldinfo[fieldparentptr]<>0)then{283:} begin begin write(logfile,'Warning--you''ve nested cross references'); write(standardoutput,'Warning--you''ve nested cross references');end; badcrossreferenceprint(citelist[citeparentptr]); begin writeln(logfile,'", which also refers to something'); writeln(standardoutput,'", which also refers to something');end; markwarning;end{:283}; if((not allentries)and(citeparentptr>=oldnumcites)and(citeinfo[ citeparentptr]=mincrossrefs))then begin if(citeptr> citexptr)then{286:}begin checkfieldoverflow((citexptr+1)*numfields); citelist[citexptr]:=citelist[citeptr]; typelist[citexptr]:=typelist[citeptr]; if(not findcitelocsforthiscitekey(citelist[citeptr]))then citekeydisappearedconfusion; if((not citehashfound)or(citeloc<>ilkinfo[lcciteloc]))then hashciteconfusion;ilkinfo[citeloc]:=citexptr; fieldptr:=citexptr*numfields;fieldendptr:=fieldptr+numfields; tmpptr:=citeptr*numfields; while(fieldptrmaxentints)then BIBXRETALLOC('entry_ints', entryints,integer,maxentints,(numentints+1)*(numcites+1));intentptr:=0; while(intentptrmaxentstrs)then begin BIBXRETALLOC( 'entry_strs',entrystrs,ASCIIcode,maxentstrs,(numentstrs+1)*(numcites+1)* (entstrsize+1));maxentstrs:=numentstrs*numcites;end;strentptr:=0; while(strentptr123)then begin bstleftbraceprint; begin begin write(logfile,'reverse');write(standardoutput,'reverse'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'reverse');write(standardoutput,'reverse'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin scanidentifier(125,37,37); if((scanresult=3)or(scanresult=1))then else begin bstidprint; begin begin write(logfile,'reverse');write(standardoutput,'reverse'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{214:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a to be iterated in reverse function');end; endif('TRACE')if(badargumenttoken)then goto 10;end{:214}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'reverse');write(standardoutput,'reverse'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>125)then begin bstrightbraceprint; begin begin write(logfile,'reverse');write(standardoutput,'reverse'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end;{299:}begin initcommandexecution; messwithentries:=true;if(numcites>0)then begin sortciteptr:=numcites; repeat sortciteptr:=sortciteptr-1;citeptr:=citeinfo[sortciteptr]; ifdef('TRACE')begin outpoolstr(logfile,hashtext[fnloc]);end; begin write(logfile,' to be iterated in reverse on ');end; begin outpoolstr(logfile,citelist[citeptr]);end;begin writeln(logfile); end;endif('TRACE')executefn(fnloc);checkcommandexecution; until(sortciteptr=0);end;end{:299};10:end;{:213}{215:} procedure bstsortcommand;label 10; begin if(not readseen)then begin begin write(logfile, 'Illegal, sort command before read command'); write(standardoutput,'Illegal, sort command before read command');end; begin bsterrprintandlookforblankline;goto 10;end;end;{300:} begin ifdef('TRACE')begin writeln(logfile,'Sorting the entries');end; endif('TRACE')if(numcites>1)then quicksort(0,numcites-1); ifdef('TRACE')begin writeln(logfile,'Done sorting');end; endif('TRACE')end{:300};10:end;{:215}{216:}procedure bststringscommand; label 10;begin begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'strings');write(standardoutput,'strings'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; begin if(buffer[bufptr2]<>123)then begin bstleftbraceprint; begin begin write(logfile,'strings');write(standardoutput,'strings'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end; bufptr2:=bufptr2+1;end; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'strings');write(standardoutput,'strings'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end; while(buffer[bufptr2]<>125)do begin begin scanidentifier(125,37,37); if((scanresult=3)or(scanresult=1))then else begin bstidprint; begin begin write(logfile,'strings');write(standardoutput,'strings'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end;{217:} begin ifdef('TRACE')begin outtoken(logfile);end; begin writeln(logfile,' is a string global-variable');end; endif('TRACE')lowercase(buffer,bufptr1,(bufptr2-bufptr1)); fnloc:=strlookup(buffer,bufptr1,(bufptr2-bufptr1),11,true); begin if(hashfound)then begin alreadyseenfunctionprint(fnloc);goto 10; end;end;fntype[fnloc]:=8;ilkinfo[fnloc]:=numglbstrs; if(numglbstrs=20)then begin printoverflow; begin writeln(logfile,'number of string global-variables ',20:0); writeln(standardoutput,'number of string global-variables ',20:0);end; goto 9998;end;numglbstrs:=numglbstrs+1;end{:217}; begin if(not eatbstwhitespace)then begin eatbstprint; begin begin write(logfile,'strings');write(standardoutput,'strings'); end;begin bsterrprintandlookforblankline;goto 10;end;end;end;end;end; bufptr2:=bufptr2+1;10:end;{:216}{218:}{155:} procedure getbstcommandandprocess;label 10; begin if(not scanalpha)then begin begin write(logfile,'"',xchr[buffer[ bufptr2]],'" can''t start a style-file command'); write(standardoutput,'"',xchr[buffer[bufptr2]], '" can''t start a style-file command');end; begin bsterrprintandlookforblankline;goto 10;end;end; lowercase(buffer,bufptr1,(bufptr2-bufptr1)); commandnum:=ilkinfo[strlookup(buffer,bufptr1,(bufptr2-bufptr1),4,false)] ;if(not hashfound)then begin printatoken; begin begin write(logfile,' is an illegal style-file command'); write(standardoutput,' is an illegal style-file command');end; begin bsterrprintandlookforblankline;goto 10;end;end;end;{156:} case(commandnum)of 0:bstentrycommand;1:bstexecutecommand; 2:bstfunctioncommand;3:bstintegerscommand;4:bstiteratecommand; 5:bstmacrocommand;6:bstreadcommand;7:bstreversecommand;8:bstsortcommand; 9:bststringscommand; others:begin begin write(logfile,'Unknown style-file command'); write(standardoutput,'Unknown style-file command');end;printconfusion; goto 9998;end end{:156};10:end;{:155}{:218}{:12}{13:} procedure initialize;var{23:}i:integer;{:23}{67:}k:hashloc;{:67} begin{17:}bad:=0;if(minprintline<3)then bad:=1; if(maxprintline<=minprintline)then bad:=10*bad+2; if(maxprintline>=bufsize)then bad:=10*bad+3; if(hashprime<128)then bad:=10*bad+4; if(hashprime>hashsize)then bad:=10*bad+5; if(maxstrings>hashsize)then bad:=10*bad+7; if(maxcites>maxstrings)then bad:=10*bad+8; if(entstrsize>bufsize)then bad:=10*bad+9; if(globstrsize>bufsize)then bad:=100*bad+11;{:17}{303:} if(10<2*4+2)then bad:=100*bad+22;{:303}; if(bad>0)then begin writeln(standardoutput,bad:0,' is a bad bad'); uexit(1);end;{20:}history:=0;{:20}{25:}xchr[32]:=' ';xchr[33]:='!'; xchr[34]:='"';xchr[35]:='#';xchr[36]:='$';xchr[37]:='%';xchr[38]:='&'; xchr[39]:='''';xchr[40]:='(';xchr[41]:=')';xchr[42]:='*';xchr[43]:='+'; xchr[44]:=',';xchr[45]:='-';xchr[46]:='.';xchr[47]:='/';xchr[48]:='0'; xchr[49]:='1';xchr[50]:='2';xchr[51]:='3';xchr[52]:='4';xchr[53]:='5'; xchr[54]:='6';xchr[55]:='7';xchr[56]:='8';xchr[57]:='9';xchr[58]:=':'; xchr[59]:=';';xchr[60]:='<';xchr[61]:='=';xchr[62]:='>';xchr[63]:='?'; xchr[64]:='@';xchr[65]:='A';xchr[66]:='B';xchr[67]:='C';xchr[68]:='D'; xchr[69]:='E';xchr[70]:='F';xchr[71]:='G';xchr[72]:='H';xchr[73]:='I'; xchr[74]:='J';xchr[75]:='K';xchr[76]:='L';xchr[77]:='M';xchr[78]:='N'; xchr[79]:='O';xchr[80]:='P';xchr[81]:='Q';xchr[82]:='R';xchr[83]:='S'; xchr[84]:='T';xchr[85]:='U';xchr[86]:='V';xchr[87]:='W';xchr[88]:='X'; xchr[89]:='Y';xchr[90]:='Z';xchr[91]:='[';xchr[92]:='\';xchr[93]:=']'; xchr[94]:='^';xchr[95]:='_';xchr[96]:='`';xchr[97]:='a';xchr[98]:='b'; xchr[99]:='c';xchr[100]:='d';xchr[101]:='e';xchr[102]:='f'; xchr[103]:='g';xchr[104]:='h';xchr[105]:='i';xchr[106]:='j'; xchr[107]:='k';xchr[108]:='l';xchr[109]:='m';xchr[110]:='n'; xchr[111]:='o';xchr[112]:='p';xchr[113]:='q';xchr[114]:='r'; xchr[115]:='s';xchr[116]:='t';xchr[117]:='u';xchr[118]:='v'; xchr[119]:='w';xchr[120]:='x';xchr[121]:='y';xchr[122]:='z'; xchr[123]:='{';xchr[124]:='|';xchr[125]:='}';xchr[126]:='~'; xchr[0]:=' ';xchr[127]:=' ';{:25}{27:}for i:=0 to 31 do xchr[i]:=chr(i); for i:=127 to 255 do xchr[i]:=chr(i);{:27}{28:} for i:=0 to 255 do xord[xchr[i]]:=i;{:28}{32:} for i:=0 to 127 do lexclass[i]:=5;for i:=0 to 31 do lexclass[i]:=0; lexclass[127]:=0;lexclass[9]:=1;lexclass[13]:=1;lexclass[32]:=1; lexclass[126]:=4;lexclass[45]:=4;for i:=48 to 57 do lexclass[i]:=3; for i:=65 to 90 do lexclass[i]:=2;for i:=97 to 122 do lexclass[i]:=2; {:32}{33:}for i:=0 to 127 do idclass[i]:=1; for i:=0 to 31 do idclass[i]:=0;idclass[32]:=0;idclass[9]:=0; idclass[34]:=0;idclass[35]:=0;idclass[37]:=0;idclass[39]:=0; idclass[40]:=0;idclass[41]:=0;idclass[44]:=0;idclass[61]:=0; idclass[123]:=0;idclass[125]:=0;{:33}{35:} for i:=0 to 127 do charwidth[i]:=0;charwidth[32]:=278; charwidth[33]:=278;charwidth[34]:=500;charwidth[35]:=833; charwidth[36]:=500;charwidth[37]:=833;charwidth[38]:=778; charwidth[39]:=278;charwidth[40]:=389;charwidth[41]:=389; charwidth[42]:=500;charwidth[43]:=778;charwidth[44]:=278; charwidth[45]:=333;charwidth[46]:=278;charwidth[47]:=500; charwidth[48]:=500;charwidth[49]:=500;charwidth[50]:=500; charwidth[51]:=500;charwidth[52]:=500;charwidth[53]:=500; charwidth[54]:=500;charwidth[55]:=500;charwidth[56]:=500; charwidth[57]:=500;charwidth[58]:=278;charwidth[59]:=278; charwidth[60]:=278;charwidth[61]:=778;charwidth[62]:=472; charwidth[63]:=472;charwidth[64]:=778;charwidth[65]:=750; charwidth[66]:=708;charwidth[67]:=722;charwidth[68]:=764; charwidth[69]:=681;charwidth[70]:=653;charwidth[71]:=785; charwidth[72]:=750;charwidth[73]:=361;charwidth[74]:=514; charwidth[75]:=778;charwidth[76]:=625;charwidth[77]:=917; charwidth[78]:=750;charwidth[79]:=778;charwidth[80]:=681; charwidth[81]:=778;charwidth[82]:=736;charwidth[83]:=556; charwidth[84]:=722;charwidth[85]:=750;charwidth[86]:=750; charwidth[87]:=1028;charwidth[88]:=750;charwidth[89]:=750; charwidth[90]:=611;charwidth[91]:=278;charwidth[92]:=500; charwidth[93]:=278;charwidth[94]:=500;charwidth[95]:=278; charwidth[96]:=278;charwidth[97]:=500;charwidth[98]:=556; charwidth[99]:=444;charwidth[100]:=556;charwidth[101]:=444; charwidth[102]:=306;charwidth[103]:=500;charwidth[104]:=556; charwidth[105]:=278;charwidth[106]:=306;charwidth[107]:=528; charwidth[108]:=278;charwidth[109]:=833;charwidth[110]:=556; charwidth[111]:=500;charwidth[112]:=556;charwidth[113]:=528; charwidth[114]:=392;charwidth[115]:=394;charwidth[116]:=389; charwidth[117]:=556;charwidth[118]:=528;charwidth[119]:=722; charwidth[120]:=528;charwidth[121]:=528;charwidth[122]:=444; charwidth[123]:=500;charwidth[124]:=1000;charwidth[125]:=500; charwidth[126]:=500;{:35}{68:} for k:=hashbase to hashmax do begin hashnext[k]:=0;hashtext[k]:=0;end; hashused:=hashmax+1;{:68}{73:}poolptr:=0;strptr:=1; strstart[strptr]:=poolptr;{:73}{120:}bibptr:=0;bibseen:=false;{:120} {126:}bststr:=0;bstseen:=false;{:126}{132:}citeptr:=0; citationseen:=false;allentries:=false;{:132}{163:}wizdefptr:=0; numentints:=0;numentstrs:=0;numfields:=0;strglbptr:=0; while(strglbptr<20)do begin glbstrptr[strglbptr]:=0; glbstrend[strglbptr]:=0;strglbptr:=strglbptr+1;end;numglbstrs:=0;{:163} {165:}entryseen:=false;readseen:=false;readperformed:=false; readingcompleted:=false;readcompleted:=false;{:165}{197:}implfnnum:=0; {:197}{293:}outbuflength:=0;{:293};predefcertainstrings; getthetoplevelauxfilename;end;{:13}{468:}procedure parsearguments; const noptions=4;var longoptions:array[0..noptions]of getoptstruct; getoptreturnval:integer;optionindex:cinttype;currentoption:0..noptions; begin{471:}verbose:=true;{:471}{474:}mincrossrefs:=2;{:474};{469:} currentoption:=0;longoptions[0].name:='terse';longoptions[0].hasarg:=0; longoptions[0].flag:=addressof(verbose);longoptions[0].val:=0; currentoption:=currentoption+1;{:469}{472:} longoptions[currentoption].name:='min-crossrefs'; longoptions[currentoption].hasarg:=1;longoptions[currentoption].flag:=0; longoptions[currentoption].val:=0;currentoption:=currentoption+1;{:472} {475:}longoptions[currentoption].name:='help'; longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0; longoptions[currentoption].val:=0;currentoption:=currentoption+1;{:475} {476:}longoptions[currentoption].name:='version'; longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0; longoptions[currentoption].val:=0;currentoption:=currentoption+1;{:476} {477:}longoptions[currentoption].name:=0; longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0; longoptions[currentoption].val:=0;{:477}; repeat getoptreturnval:=getoptlongonly(argc,argv,'',longoptions, addressof(optionindex));if getoptreturnval=-1 then begin; end else if getoptreturnval=63 then begin usage(1,'bibtex'); end else if(strcmp(longoptions[optionindex].name,'min-crossrefs')=0)then begin mincrossrefs:=atoi(optarg); end else if(strcmp(longoptions[optionindex].name,'help')=0)then begin usage(0,BIBTEXHELP); end else if(strcmp(longoptions[optionindex].name,'version')=0)then begin printversionandexit('This is BibTeX, Version 0.99c','Oren Patashnik',nil );end;until getoptreturnval=-1; if(optind+1<>argc)then begin writeln(stderr, 'bibtex: Need exactly one file argument.');usage(1,'bibtex');end;end; {:468}begin standardinput:=stdin;standardoutput:=stdout; maxentints:=MAXENTINTS;maxentstrs:=MAXENTSTRS;poolsize:=POOLSIZE; maxbibfiles:=MAXBIBFILES;maxfields:=MAXFIELDS; bibfile:=XTALLOC(maxbibfiles+1,alphafile); biblist:=XTALLOC(maxbibfiles+1,strnumber); entryints:=XTALLOC(maxentints+1,integer); entrystrs:=XTALLOC((maxentstrs+1)*(entstrsize+1),ASCIIcode); wizfunctions:=XTALLOC(wizfnspace+1,hashptr2); fieldinfo:=XTALLOC(maxfields+1,strnumber); spreamble:=XTALLOC(maxbibfiles+1,strnumber); strpool:=XTALLOC(poolsize+1,ASCIIcode);initialize; if verbose then begin begin write(logfile, 'This is BibTeX, Version 0.99c'); write(standardoutput,'This is BibTeX, Version 0.99c');end; begin writeln(logfile,versionstring); writeln(standardoutput,versionstring);end;end;{111:} if verbose then begin begin write(logfile, 'The top-level auxiliary file: '); write(standardoutput,'The top-level auxiliary file: ');end;printauxname; end;while true do begin auxlnstack[auxptr]:=auxlnstack[auxptr]+1; if(not inputln(auxfile[auxptr]))then poptheauxstack else getauxcommandandprocess;end;ifdef('TRACE')begin writeln(logfile, 'Finished reading the auxiliary file(s)');end; endif('TRACE')31:lastcheckforauxerrors;{:111};{152:} if(bststr=0)then goto 9932;bstlinenum:=0;bbllinenum:=1;bufptr2:=last; hack1;begin if(not eatbstwhitespace)then hack2;getbstcommandandprocess; end;32:aclose(bstfile);9932:aclose(bblfile);{:152};9998:{456:} begin if((readperformed)and(not readingcompleted))then begin begin write (logfile,'Aborted at line ',biblinenum:0,' of file '); write(standardoutput,'Aborted at line ',biblinenum:0,' of file ');end; printbibname;end;traceandstatprinting;{467:}case(history)of 0:; 1:begin if(errcount=1)then begin writeln(logfile,'(There was 1 warning)' );writeln(standardoutput,'(There was 1 warning)'); end else begin writeln(logfile,'(There were ',errcount:0,' warnings)'); writeln(standardoutput,'(There were ',errcount:0,' warnings)');end;end; 2:begin if(errcount=1)then begin writeln(logfile, '(There was 1 error message)'); writeln(standardoutput,'(There was 1 error message)'); end else begin writeln(logfile,'(There were ',errcount:0, ' error messages)'); writeln(standardoutput,'(There were ',errcount:0,' error messages)'); end;end;3:begin writeln(logfile,'(That was a fatal error)'); writeln(standardoutput,'(That was a fatal error)');end; others:begin begin write(logfile,'History is bunk'); write(standardoutput,'History is bunk');end;printconfusion;end end{:467} ;aclose(logfile);end{:456};9999:if(history>1)then uexit(history); end.{:10}