rokicki@rocky.STANFORD.EDU (Tomas Rokicki) (12/30/87)
---cut here---
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
}
nameptr = namelength + 1 ;
pptr = strstart [ ext ] ;
while ( ( pptr < strstart [ ext + 1 ] ) )
{ nameoffile [ nameptr ] = chr ( strpool [ pptr ] ) ;
incr ( nameptr ) ;
incr ( pptr ) ;
}
nameoffile [ nameptr ] = 0 ;
namelength = namelength + ( strstart [ ext + 1 ] - strstart [ ext ] )
+ 1 ;
nameptr = namelength + 1 ;
}
makestring () { if ( ( strptr == maxstrings ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's number of strings " ) ;
tputi ( cnull , maxstrings ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
incr ( strptr ) ;
strstart [ strptr ] = poolptr ;
}
boolean zstreqbuf ( s , buf , bfptr , len )
strnumber s ;
buftype buf ;
bufpointer bfptr , len ;
{ /* 10 */ bufpointer i ;
poolpointer j ;
if ( ( ( strstart [ s + 1 ] - strstart [ s ] ) != len ) )
{ return ( false ) ;
}
i = bfptr ;
j = strstart [ s ] ;
while ( ( j < strstart [ s + 1 ] ) )
{ if ( ( strpool [ j ] != buf [ i ] ) )
{ return ( false ) ;
}
incr ( i ) ;
incr ( j ) ;
}
return ( true ) ;
lab10 : ;
}
boolean zstreqstr ( s1 , s2 )
strnumber s1 , s2 ;
{ /* 10 */ if ( ( ( strstart [ s1 + 1 ] - strstart [ s1 ] ) != (
strstart [ s2 + 1 ] - strstart [ s2 ] ) ) )
{ return ( false ) ;
}
pptr1 = strstart [ s1 ] ;
pptr2 = strstart [ s2 ] ;
while ( ( pptr1 < strstart [ s1 + 1 ] ) )
{ if ( ( strpool [ pptr1 ] != strpool [ pptr2 ] ) )
{ return ( false ) ;
}
incr ( pptr1 ) ;
incr ( pptr2 ) ;
}
return ( true ) ;
lab10 : ;
}
zlowercase ( buf , bfptr , len )
buftype buf ;
bufpointer bfptr , len ;
{ bufpointer i ;
if ( ( len > 0 ) ) for ( i = bfptr ; i <= bfptr + len - 1 ; i ++ ) if ( (
( buf [ i ] >= 65 ) && ( buf [ i ] <= 90 ) ) ) buf [ i ] = buf [ i ] +
32 ;
}
zuppercase ( buf , bfptr , len )
buftype buf ;
bufpointer bfptr , len ;
{ bufpointer i ;
if ( ( len > 0 ) ) for ( i = bfptr ; i <= bfptr + len - 1 ; i ++ ) if ( (
( buf [ i ] >= 97 ) && ( buf [ i ] <= 122 ) ) ) buf [ i ] = buf [ i ] -
32 ;
}
hashloc zstrlookup ( buf , j , l , ilk , insertit )
buftype buf ;
bufpointer j , l ;
strilk ilk ;
boolean insertit ;
{ /* 40 45 */ register integer h ;
register integer p ;
register integer k ;
boolean oldstring ;
strnumber strnum ;
h = 0 ;
k = j ;
while ( ( k < j + l ) )
{ h = h + h + buf [ k ] ;
while ( ( h >= 4253 ) ) h = h - 4253 ;
incr ( k ) ;
}
p = h + 1 ;
hashfound = false ;
oldstring = false ;
while ( true )
{ if ( ( hashtext [ p ] > 0 ) ) if ( ( streqbuf ( hashtext [ p ] , buf
, j , l ) ) ) if ( ( hashilk [ p ] == ilk ) )
{ hashfound = true ;
goto lab40 ;
}
else
{ oldstring = true ;
strnum = hashtext [ p ] ;
}
if ( ( hashnext [ p ] == 0 ) )
{ if ( ( ! insertit ) ) goto lab45 ;
{ if ( ( hashtext [ p ] > 0 ) )
{ do { if ( ( ( hashused == 1 ) ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's hash size " ) ;
tputi ( cnull , 5000 ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
decr ( hashused ) ;
} while ( ! ( ( hashtext [ hashused ] == 0 ) ) ) ;
hashnext [ p ] = hashused ;
p = hashused ;
}
if ( ( oldstring ) ) hashtext [ p ] = strnum ;
else
{
{ if ( ( poolptr + l > poolsize ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's pool size " ) ;
tputi ( cnull , poolsize ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
}
k = j ;
while ( ( k < j + l ) )
{
{ strpool [ poolptr ] = buf [ k ] ;
incr ( poolptr ) ;
}
incr ( k ) ;
}
makestring () ;
hashtext [ p ] = strptr - 1 ;
}
hashilk [ p ] = ilk ;
}
goto lab40 ;
}
p = hashnext [ p ] ;
}
lab45 : ;
lab40 : return ( p ) ;
}
zpredefine ( pds , ilk )
pdstype pds ;
strilk ilk ;
{ pdslen i ;
i = 0 ;
while ( pds [ i ] != 0 )
{ buffer [ i + 1 ] = xord [ pds [ i ] ] ;
incr ( i ) ;
}
predefloc = strlookup ( buffer , 1 , i , ilk , true ) ;
}
bufpointer zinttoASCII ( cint , intbuf , intbegin )
integer cint ;
buftype intbuf ;
bufpointer intbegin ;
{ bufpointer intptr, intxptr ;
ASCIIcode inttmpval ;
bufpointer inttmp ;
intptr = intbegin ;
if ( ( cint < 0 ) )
{
{ if ( ( intptr == bufsize ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's buffer size " ) ;
tputi ( cnull , bufsize ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
intbuf [ intptr ] = 45 ;
incr ( intptr ) ;
}
cint = - cint ;
}
intxptr = intptr ;
do {
{ if ( ( intptr == bufsize ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's buffer size " ) ;
tputi ( cnull , bufsize ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
intbuf [ intptr ] = 48 + ( cint % 10 ) ;
incr ( intptr ) ;
}
cint = cint / 10 ;
} while ( ! ( ( cint == 0 ) ) ) ;
inttmp = intptr ;
decr ( intptr ) ;
while ( ( intxptr < intptr ) )
{ inttmpval = intbuf [ intxptr ] ;
intbuf [ intxptr ] = intbuf [ intptr ] ;
intbuf [ intptr ] = inttmpval ;
decr ( intptr ) ;
incr ( intxptr ) ;
}
return ( inttmp ) ;
}
zswap ( swap1 , swap2 )
citenumber swap1 , swap2 ;
{ citenumber innocentbystander ;
innocentbystander = sortedcites [ swap2 ] ;
sortedcites [ swap2 ] = sortedcites [ swap1 ] ;
sortedcites [ swap1 ] = innocentbystander ;
}
zcycle ( cycle1 , cycle2 , cycle3 )
citenumber cycle1 , cycle2 , cycle3 ;
{ citenumber innocentbystander ;
innocentbystander = sortedcites [ cycle3 ] ;
sortedcites [ cycle3 ] = sortedcites [ cycle2 ] ;
sortedcites [ cycle2 ] = sortedcites [ cycle1 ] ;
sortedcites [ cycle1 ] = innocentbystander ;
}
boolean zlessthan ( arg1 , arg2 )
citenumber arg1 , arg2 ;
{ /* 10 */ quarterword charptr ;
strentloc ptr1, ptr2 ;
ASCIIcode char1, char2 ;
ptr1 = arg1 * numentstrs + sortkeynum ;
ptr2 = arg2 * numentstrs + sortkeynum ;
charptr = 0 ;
while ( true )
{ char1 = entrystrs [ ptr1 ] [ charptr ] ;
char2 = entrystrs [ ptr2 ] [ charptr ] ;
if ( ( char2 == 127 ) )
{ return ( false ) ;
}
else if ( ( char1 == 127 ) )
{ return ( true ) ;
}
else if ( ( char2 < char1 ) )
{ return ( false ) ;
}
else if ( ( char1 < char2 ) )
{ return ( true ) ;
}
incr ( charptr ) ;
}
lab10 : ;
}
zquicksort ( leftend , rightend )
citenumber leftend , rightend ;
{ /* 24 42 43 34 */ citenumber left, right ;
citenumber insertptr ;
citenumber middle ;
citenumber partition ;
#ifdef TRACE
{ tputs ( logfile , "sorting " ) ;
tputi ( logfile , leftend ) ;
tputs ( logfile , " through " ) ;
tputi ( logfile , rightend ) ;
tputc ( logfile , 10 ) ;
}
#endif
if ( ( rightend - leftend < 10 ) )
{ for ( insertptr = leftend + 1 ; insertptr <= rightend ; insertptr ++ )
{ for ( right = insertptr ; right >= leftend + 1 ; right -- )
{ if ( ( ! lessthan ( sortedcites [ right ] , sortedcites [ right
- 1 ] ) ) ) goto lab24 ;
swap ( right , right - 1 ) ;
}
lab24 : ;
}
}
else
{ middle = ( leftend + rightend ) / 2 ;
if ( ( lessthan ( sortedcites [ middle ] , sortedcites [ leftend ] ) )
) if ( ( lessthan ( sortedcites [ rightend ] , sortedcites [ leftend ]
) ) ) if ( ( lessthan ( sortedcites [ rightend ] , sortedcites [ middle
] ) ) ) swap ( rightend , leftend ) ;
else cycle ( leftend , rightend , middle ) ;
else swap ( middle , leftend ) ;
else if ( ( lessthan ( sortedcites [ rightend ] , sortedcites [ leftend
] ) ) ) cycle ( leftend , middle , rightend ) ;
else if ( ( lessthan ( sortedcites [ rightend ] , sortedcites [ middle
] ) ) ) swap ( rightend , middle ) ;
else ;
partition = sortedcites [ middle ] ;
left = leftend ;
right = rightend ;
while ( true )
{ while ( true )
{ if ( ( left + 1 == right ) ) goto lab34 ;
incr ( left ) ;
if ( ( lessthan ( partition , sortedcites [ left ] ) ) ) goto
lab42 ;
}
lab42 : while ( true )
{ if ( ( left + 1 == right ) )
{ decr ( left ) ;
decr ( right ) ;
goto lab34 ;
}
decr ( right ) ;
if ( ( lessthan ( sortedcites [ right ] , partition ) ) ) goto
lab43 ;
}
lab43 : swap ( left , right ) ;
}
lab34 : quicksort ( leftend , left ) ;
quicksort ( right , rightend ) ;
}
}
hashloc zbuildin ( pds , bltinnum )
pdstype pds ;
bltinrange bltinnum ;
{ predefine ( pds , 11 ) ;
fntype [ predefloc ] = 0 ;
ilkinfo [ predefloc ] = bltinnum ;
#ifdef STAT
bltinloc [ bltinnum ] = predefloc ;
executioncount [ bltinnum ] = 0 ;
#endif
return ( predefloc ) ;
}
boolean zscan1 ( char1 )
ASCIIcode char1 ;
{ bufptr1 = bufptr2 ;
while ( ( ( buffer [ bufptr2 ] != char1 ) && ( bufptr2 < last ) ) ) incr
( bufptr2 ) ;
if ( ( bufptr2 < last ) ) return ( true ) ;
else return ( false ) ;
}
boolean zscan1white ( char1 )
ASCIIcode char1 ;
{ bufptr1 = bufptr2 ;
while ( ( ( lexclass [ buffer [ bufptr2 ] ] != 1 ) && ( buffer [ bufptr2
] != char1 ) && ( bufptr2 < last ) ) ) incr ( bufptr2 ) ;
if ( ( bufptr2 < last ) ) return ( true ) ;
else return ( false ) ;
}
boolean zscan2 ( char1 , char2 )
ASCIIcode char1 , char2 ;
{ bufptr1 = bufptr2 ;
while ( ( ( buffer [ bufptr2 ] != char1 ) && ( buffer [ bufptr2 ] !=
char2 ) && ( bufptr2 < last ) ) ) incr ( bufptr2 ) ;
if ( ( bufptr2 < last ) ) return ( true ) ;
else return ( false ) ;
}
boolean zscan2white ( char1 , char2 )
ASCIIcode char1 , char2 ;
{ bufptr1 = bufptr2 ;
while ( ( ( buffer [ bufptr2 ] != char1 ) && ( buffer [ bufptr2 ] !=
char2 ) && ( lexclass [ buffer [ bufptr2 ] ] != 1 ) && ( bufptr2 < last
) ) ) incr ( bufptr2 ) ;
if ( ( bufptr2 < last ) ) return ( true ) ;
else return ( false ) ;
}
boolean zscan3 ( char1 , char2 , char3 )
ASCIIcode char1 , char2 , char3 ;
{ bufptr1 = bufptr2 ;
while ( ( ( buffer [ bufptr2 ] != char1 ) && ( buffer [ bufptr2 ] !=
char2 ) && ( buffer [ bufptr2 ] != char3 ) && ( bufptr2 < last ) ) )
incr ( bufptr2 ) ;
if ( ( bufptr2 < last ) ) return ( true ) ;
else return ( false ) ;
}
boolean scanalpha () { bufptr1 = bufptr2 ;
while ( ( ( lexclass [ buffer [ bufptr2 ] ] == 2 ) && ( bufptr2 < last )
) ) incr ( bufptr2 ) ;
if ( ( ( bufptr2 - bufptr1 ) == 0 ) ) return ( false ) ;
else return ( true ) ;
}
zscanidentifier ( char1 , char2 )
ASCIIcode char1 , char2 ;
{ bufptr1 = bufptr2 ;
if ( ( lexclass [ buffer [ bufptr2 ] ] != 3 ) ) while ( ( ( idclass [
buffer [ bufptr2 ] ] == 1 ) && ( bufptr2 < last ) ) ) incr ( bufptr2 )
;
if ( ( ( bufptr2 - bufptr1 ) == 0 ) ) scanresult = 0 ;
else if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2 == last
) ) ) scanresult = 3 ;
else if ( ( ( buffer [ bufptr2 ] == char1 ) || ( buffer [ bufptr2 ] ==
char2 ) ) ) scanresult = 1 ;
else scanresult = 2 ;
}
boolean scannonneginteger () { bufptr1 = bufptr2 ;
tokenvalue = 0 ;
while ( ( ( lexclass [ buffer [ bufptr2 ] ] == 3 ) && ( bufptr2 < last )
) )
{ tokenvalue = tokenvalue * 10 + ( buffer [ bufptr2 ] - 48 ) ;
incr ( bufptr2 ) ;
}
if ( ( ( bufptr2 - bufptr1 ) == 0 ) ) return ( false ) ;
else return ( true ) ;
}
boolean scaninteger () { quarterword signlength ;
bufptr1 = bufptr2 ;
if ( ( buffer [ bufptr2 ] == 45 ) )
{ signlength = 1 ;
incr ( bufptr2 ) ;
}
else signlength = 0 ;
tokenvalue = 0 ;
while ( ( ( lexclass [ buffer [ bufptr2 ] ] == 3 ) && ( bufptr2 < last )
) )
{ tokenvalue = tokenvalue * 10 + ( buffer [ bufptr2 ] - 48 ) ;
incr ( bufptr2 ) ;
}
if ( ( ( signlength == 1 ) ) ) tokenvalue = - tokenvalue ;
if ( ( ( bufptr2 - bufptr1 ) == signlength ) ) return ( false ) ;
else return ( true ) ;
}
boolean scanwhitespace () { while ( ( ( lexclass [ buffer [ bufptr2 ] ] ==
1 ) && ( bufptr2 < last ) ) ) incr ( bufptr2 ) ;
if ( ( bufptr2 < last ) ) return ( true ) ;
else return ( false ) ;
}
boolean eatbstwhitespace () { /* 10 */ while ( true )
{ if ( ( scanwhitespace () ) ) if ( ( buffer [ bufptr2 ] != 37 ) )
{ return ( true ) ;
}
if ( ( ! inputln ( bstfile ) ) )
{ return ( false ) ;
}
incr ( bstlinenum ) ;
bufptr2 = 0 ;
}
lab10 : ;
}
skiptokenprint () { tputs ( cnull , "---line " ) ;
tputi ( cnull , bstlinenum ) ;
tputs ( cnull , " of file " ) ;
printbstname () ;
if ( ( scan2white ( 125 , 37 ) ) ) ;
}
zscanfndef ( fnhashloc )
hashloc fnhashloc ;
{ /* 25 10 */ typedef quarterword fndefloc ;
hashptr2 singlfunction[101] ;
fndefloc singleptr ;
fndefloc copyptr ;
bufpointer endofnum ;
hashloc implfnloc ;
{ if ( ( ! eatbstwhitespace () ) )
{ eatbstprint () ;
{ tputs ( cnull , "function" ) ;
bsterrprintandlookfo () ;
goto lab10 ;
}
}
}
singleptr = 0 ;
while ( ( buffer [ bufptr2 ] != 125 ) )
{ switch ( buffer [ bufptr2 ] )
{ case 35 :
{ incr ( bufptr2 ) ;
if ( ( ! scaninteger () ) )
{ tputs ( cnull , "illegal integer in integer literal" ) ;
skiptokenprint () ;
goto lab25 ;
}
#ifdef TRACE
tputs ( logfile , "#" ) ;
traceprtoken () ;
{ tputs ( logfile , " is an integer literal with value " ) ;
tputi ( logfile , tokenvalue ) ;
tputc ( logfile , 10 ) ;
}
#endif
literalloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 )
, 1 , true ) ;
if ( ( ! hashfound ) )
{ fntype [ literalloc ] = 3 ;
ilkinfo [ literalloc ] = tokenvalue ;
}
if ( ( ( lexclass [ buffer [ bufptr2 ] ] != 1 ) && ( bufptr2 <
last ) && ( buffer [ bufptr2 ] != 125 ) && ( buffer [ bufptr2 ]
!= 37 ) ) )
{ tputs ( cnull , "\"" ) ;
tputc ( cnull , xchr [ buffer [ bufptr2 ] ] ) ;
tputs ( cnull , "\" can't follow a literal" ) ;
skiptokenprint () ;
goto lab25 ;
}
{ singlfunction [ singleptr ] = literalloc ;
if ( ( singleptr == singlefnspace ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's single function space " ) ;
tputi ( cnull , singlefnspace ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
incr ( singleptr ) ;
}
}
break ;
case 34 :
{ incr ( bufptr2 ) ;
if ( ( ! scan1 ( 34 ) ) )
{ tputs ( cnull , "no `\"' to end string literal" ) ;
skiptokenprint () ;
goto lab25 ;
}
#ifdef TRACE
tputs ( logfile , "\"" ) ;
traceprtoken () ;
tputs ( logfile , "\"" ) ;
tputs ( logfile , " is a string literal\n" ) ;
#endif
literalloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 )
, 0 , true ) ;
fntype [ literalloc ] = 4 ;
incr ( bufptr2 ) ;
if ( ( ( lexclass [ buffer [ bufptr2 ] ] != 1 ) && ( bufptr2 <
last ) && ( buffer [ bufptr2 ] != 125 ) && ( buffer [ bufptr2 ]
!= 37 ) ) )
{ tputs ( cnull , "\"" ) ;
tputc ( cnull , xchr [ buffer [ bufptr2 ] ] ) ;
tputs ( cnull , "\" can't follow a literal" ) ;
skiptokenprint () ;
goto lab25 ;
}
{ singlfunction [ singleptr ] = literalloc ;
if ( ( singleptr == singlefnspace ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's single function space " ) ;
tputi ( cnull , singlefnspace ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
incr ( singleptr ) ;
}
}
break ;
case 39 :
{ incr ( bufptr2 ) ;
if ( ( scan2white ( 125 , 37 ) ) ) ;
#ifdef TRACE
tputs ( logfile , "'" ) ;
traceprtoken () ;
tputs ( logfile , " is a quoted function " ) ;
#endif
lowercase ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ;
fnloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 11
, false ) ;
if ( ( ! hashfound ) )
{ printtoken () ;
{ tputs ( cnull , " is an unknown function" ) ;
skiptokenprint () ;
goto lab25 ;
}
}
else if ( ( fnloc == wizloc ) )
{
#ifdef TRACE
tputc ( logfile , 10 ) ;
#endif
tputs ( cnull , "curse you, wizard, before you recurse me: function " ) ;
printtoken () ;
tputs ( cnull , " is illegal\n" ) ;
{ tputs ( cnull , "in its own definition" ) ;
skiptokenprint () ;
goto lab25 ;
}
}
else
{
#ifdef TRACE
tputs ( logfile , "of type " ) ;
traceprfnclass ( fnloc ) ;
tputc ( logfile , 10 ) ;
#endif
{ singlfunction [ singleptr ] = 0 ;
if ( ( singleptr == singlefnspace ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's single function space " ) ;
tputi ( cnull , singlefnspace ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
incr ( singleptr ) ;
}
{ singlfunction [ singleptr ] = fnloc ;
if ( ( singleptr == singlefnspace ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's single function space " ) ;
tputi ( cnull , singlefnspace ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
incr ( singleptr ) ;
}
}
}
break ;
case 123 :
{ svbuffer [ 0 ] = 39 ;
endofnum = inttoASCII ( implfnnum , svbuffer , 1 ) ;
implfnloc = strlookup ( svbuffer , 0 , endofnum , 11 , true ) ;
if ( ( hashfound ) )
{ tputs ( cnull , "this can't happen---already encountered implicit function " ) ;
printpoolstr ( hashtext [ implfnloc ] ) ;
tputc ( cnull , 10 ) ;
}
#ifdef TRACE
traceprpoolstr ( hashtext [ implfnloc ] ) ;
tputs ( logfile , " is an implicit function\n" ) ;
#endif
incr ( implfnnum ) ;
fntype [ implfnloc ] = 2 ;
{ singlfunction [ singleptr ] = 0 ;
if ( ( singleptr == singlefnspace ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's single function space " ) ;
tputi ( cnull , singlefnspace ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
incr ( singleptr ) ;
}
{ singlfunction [ singleptr ] = implfnloc ;
if ( ( singleptr == singlefnspace ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's single function space " ) ;
tputi ( cnull , singlefnspace ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
incr ( singleptr ) ;
}
incr ( bufptr2 ) ;
scanfndef ( implfnloc ) ;
}
break ;
default :
{ if ( ( scan2white ( 125 , 37 ) ) ) ;
#ifdef TRACE
traceprtoken () ;
tputs ( logfile , " is a function " ) ;
#endif
lowercase ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ;
fnloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 11
, false ) ;
if ( ( ! hashfound ) )
{ printtoken () ;
{ tputs ( cnull , " is an unknown function" ) ;
skiptokenprint () ;
goto lab25 ;
}
}
else if ( ( fnloc == wizloc ) )
{
#ifdef TRACE
tputc ( logfile , 10 ) ;
#endif
tputs ( cnull , "curse you, wizard, before you recurse me: function " ) ;
printtoken () ;
tputs ( cnull , " is illegal\n" ) ;
{ tputs ( cnull , "in its own definition" ) ;
skiptokenprint () ;
goto lab25 ;
}
}
else
{
#ifdef TRACE
tputs ( logfile , "of type " ) ;
traceprfnclass ( fnloc ) ;
tputc ( logfile , 10 ) ;
#endif
{ singlfunction [ singleptr ] = fnloc ;
if ( ( singleptr == singlefnspace ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's single function space " ) ;
tputi ( cnull , singlefnspace ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
incr ( singleptr ) ;
}
}
}
break ;
} lab25 :
{ if ( ( ! eatbstwhitespace () ) )
{ eatbstprint () ;
{ tputs ( cnull , "function" ) ;
bsterrprintandlookfo () ;
goto lab10 ;
}
}
}
}
{ singlfunction [ singleptr ] = 5001 ;
if ( ( singleptr == singlefnspace ) )
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's single function space " ) ;
tputi ( cnull , singlefnspace ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
incr ( singleptr ) ;
}
if ( ( singleptr + wizdefptr > wizfnspace ) )
{ tputi ( cnull , singleptr + wizdefptr ) ;
tputs ( cnull , " " ) ;
{ tputs ( cnull , "Sorry, you've exceeded BibTeX's wizard-defined function space " ) ;
tputi ( cnull , wizfnspace ) ;
tputc ( cnull , 10 ) ;
jumpout ( 1 ) ;
}
}
ilkinfo [ fnhashloc ] = wizdefptr ;
copyptr = 0 ;
while ( ( copyptr < singleptr ) )
{ wizfunctions [ wizdefptr ] = singlfunction [ copyptr ] ;
incr ( copyptr ) ;
incr ( wizdefptr ) ;
}
incr ( bufptr2 ) ;
lab10 : ;
}
boolean eatbibwhitespace () { /* 10 */ while ( ( ! scanwhitespace () ) )
{ if ( ( ! inputln ( bibfile [ bibptr ] ) ) )
{ return ( false ) ;
}
incr ( biblinenum ) ;
bufptr2 = 0 ;
}
return ( true ) ;
lab10 : ;
}
boolean compressbibwhite () { /* 10 */
{ exbuf [ fieldend ] = 32 ;
incr ( fieldend ) ;
}
while ( ( ! scanwhitespace () ) )
{ if ( ( ! inputln ( bibfile [ bibptr ] ) ) )
{ eatbibprint () ;
return ( false ) ;
}
incr ( biblinenum ) ;
bufptr2 = 0 ;
if ( ( fieldend + last > bufsize ) )
{ bibfieldtoolongprint () ;
return ( false ) ;
}
}
return ( true ) ;
}
boolean scanbalancedbraces () { /* 10 */
incr ( bufptr2 ) ;
{ if ( ( ! eatbibwhitespace () ) )
{ eatbibprint () ;
return ( false ) ;
}
}
bibbracelevel = 0 ;
if ( ( storefield ) )
{ fieldend = 0 ;
if ( ( fieldend + last - bufptr2 > bufsize ) )
{ bibfieldtoolongprint () ;
return ( false ) ;
}
while ( ( buffer [ bufptr2 ] != rightstrdelim ) ) if ( ( buffer [
bufptr2 ] == 123 ) )
{ incr ( bibbracelevel ) ;
{ exbuf [ fieldend ] = 123 ;
incr ( fieldend ) ;
}
incr ( bufptr2 ) ;
{ if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2 ==
last ) ) ) if ( ( ! compressbibwhite () ) ) return ( false ) ;
}
while ( ( bibbracelevel > 0 ) ) if ( ( buffer [ bufptr2 ] == 125 )
)
{ decr ( bibbracelevel ) ;
{ exbuf [ fieldend ] = 125 ;
incr ( fieldend ) ;
}
incr ( bufptr2 ) ;
{ if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2
== last ) ) ) if ( ( ! compressbibwhite () ) ) return ( false ) ;
}
}
else if ( ( buffer [ bufptr2 ] == 123 ) )
{ incr ( bibbracelevel ) ;
{ exbuf [ fieldend ] = 123 ;
incr ( fieldend ) ;
}
incr ( bufptr2 ) ;
{ if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2
== last ) ) ) if ( ( ! compressbibwhite () ) ) return ( false ) ;
}
}
else while ( ( ( buffer [ bufptr2 ] != 125 ) && ( buffer [
bufptr2 ] != 123 ) ) )
{
{ exbuf [ fieldend ] = buffer [ bufptr2 ] ;
incr ( fieldend ) ;
}
incr ( bufptr2 ) ;
{ if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || (
bufptr2 == last ) ) ) if ( ( ! compressbibwhite () ) )
return ( false ) ;
}
}
}
else if ( ( buffer [ bufptr2 ] == 125 ) )
{ bibunbalancedbracesp () ;
return ( false ) ;
}
else while ( ( ( buffer [ bufptr2 ] != rightstrdelim ) && ( buffer [
bufptr2 ] != 123 ) && ( buffer [ bufptr2 ] != 125 ) ) )
{
{ exbuf [ fieldend ] = buffer [ bufptr2 ] ;
incr ( fieldend ) ;
}
incr ( bufptr2 ) ;
{ if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2 ==
last ) ) ) if ( ( ! compressbibwhite () ) )
return ( false ) ;
}
}
if ( ( fieldend > 1 ) ) if ( ( exbuf [ fieldend - 1 ] == 32 ) )
decr ( fieldend ) ;
fieldvalloc = strlookup ( exbuf , 0 , fieldend , 0 , true ) ;
fntype [ fieldvalloc ] = 4 ;
#ifdef TRACE
tputs ( logfile , "\"" ) ;
traceprpoolstr ( hashtext [ fieldvalloc ] ) ;
tputs ( logfile , "\" is a brace-balanced string\n" ) ;
#endif
}
else while ( ( buffer [ bufptr2 ] != rightstrdelim ) ) if ( ( buffer [
bufptr2 ] == 123 ) )
{ incr ( bibbracelevel ) ;
incr ( bufptr2 ) ;
{ if ( ( ! eatbibwhitespace () ) )
{ eatbibprint () ;
return ( false ) ;
}
}
while ( ( bibbracelevel > 0 ) ) if ( ( buffer [ bufptr2 ] == 125 ) )
{ decr ( bibbracelevel ) ;
incr ( bufptr2 ) ;
{ if ( ( ! eatbibwhitespace () ) )
{ eatbibprint () ;
return ( false ) ;
}
}
}
else if ( ( buffer [ bufptr2 ] == 123 ) )
{ incr ( bibbracelevel ) ;
incr ( bufptr2 ) ;
{ if ( ( ! eatbibwhitespace () ) )
{ eatbibprint () ;
return ( false ) ;
}
}
}
else
{ incr ( bufptr2 ) ;
if ( ( ! scan2 ( 125 , 123 ) ) )
{ if ( ( ! eatbibwhitespace () ) )
{ eatbibprint () ;
return ( false ) ;
}
}
}
}
else if ( ( buffer [ bufptr2 ] == 125 ) )
{ bibunbalancedbracesp () ;
return ( false ) ;
}
else
{ incr ( bufptr2 ) ;
if ( ( ! scan3 ( rightstrdelim , 123 , 125 ) ) )
{ if ( ( ! eatbibwhitespace () ) )
{ eatbibprint () ;
return ( false ) ;
}
}
}
incr ( bufptr2 ) ;
return ( true ) ;
}
zdecrbracelevel ( poplitvar )
strnumber poplitvar ;
{ decr ( bracelevel ) ;
if ( ( bracelevel == - 1 ) )
{ printpoolstr ( poplitvar ) ;
tputs ( cnull , " is not a brace-balanced string\n" ) ;
{ tputs ( cnull , " " ) ;
bstexwarnprint () ;
}
bracelevel = 0 ;
}
}
zcheckbracelevel ( poplitvar )
strnumber poplitvar ;
{ if ( ( bracelevel > 0 ) )
{ printpoolstr ( poplitvar ) ;
tputs ( cnull , " is not a brace-balanced string\n" ) ;
{ tputs ( cnull , " " ) ;
bstexwarnprint () ;
}
}
}
znamescanforand ( poplitvar )
strnumber poplitvar ;
{ bracelevel = 0 ;
precedingwhite = false ;
andfound = false ;
while ( ( ( ! andfound ) && ( exbufptr < exbuflength ) ) ) switch ( exbuf
[ exbufptr ] )
{ case 97 :
case 65 :
{ incr ( exbufptr ) ;
if ( ( precedingwhite ) ) if ( ( exbufptr <= ( exbuflength - 3 ) )
) if ( ( ( exbuf [ exbufptr ] == 110 ) || ( exbuf [ exbufptr ] ==
78 ) ) ) if ( ( ( exbuf [ exbufptr + 1 ] == 100 ) || ( exbuf [
exbufptr + 1 ] == 68 ) ) ) if ( ( lexclass [ exbuf [ exbufptr + 2 ]
] == 1 ) )
{ exbufptr = exbufptr + 2 ;
andfound = true ;
}
precedingwhite = false ;
}
break ;
case 123 :
{ incr ( bracelevel ) ;
incr ( exbufptr ) ;
while ( ( ( bracelevel > 0 ) && ( exbufptr < exbuflength ) ) )
{ if ( ( exbuf [ exbufptr ] == 125 ) ) decr ( bracelevel ) ;
else if ( ( exbuf [ exbufptr ] == 123 ) ) incr ( bracelevel ) ;
incr ( exbufptr ) ;
}
precedingwhite = false ;
}
break ;
case 125 :
{ decrbracelevel ( poplitvar ) ;
incr ( exbufptr ) ;
precedingwhite = false ;
---cut here---