\codehsize=\textwidth
\nwdefspace=0pt		% to put xrefs at right margin (where they belong)
\def\@begincode{%
	\trivlist \item[]%
	\leftskip\@totalleftmargin \advance\leftskip\codemargin
	\rightskip\hsize \advance\rightskip -\codehsize
	\parskip\z@ \parindent\z@ \parfillskip\@flushglue
	\linewidth\codehsize
	\nowebsize
	\let\maybehbox\mbox
	\let\eatline=\relax
}
\newcount\ind
\newenvironment{ppcode}{%
	\sfcode`;=3000                % a `;' acts like a period
	\pretolerance=10000 %
	\hyphenpenalty=10000 %
	\exhyphenpenalty=10000 %
	\global\ind=2 % This fakeout is important for opt to work correctly
	\par
	\global\hangindent\ind em
}{%
	\mathout
}
\newbox\bak\setbox\bak=\hbox to -1em{} % backspace 1 em
\newbox\bakk\setbox\bakk=\hbox to -2em{} % backspace 2 ems

\def\pretzelindent{\global\advance\ind by1\hangindent\ind em}%
\def\pretzeloutdent{\global\advance\ind by-1}%
\def\pretzelopt#1{\hfil\penalty#10\hfilneg}%
\def\pretzelbackup{\copy\bak}%
\def\pretzelbreakspace{\hfil\penalty-1\hfilneg
	\kern2.5em\copy\bakk\ignorespaces}%
% parm below is to eat {} generated by Pretzel
\def\pretzelforce#1{\mathout\par\hangindent\ind em\noindent
	\kern\ind em\copy\bakk#1\ignorespaces}%
\def\pretzelbigforce{\mathout\par\smallskip\pretzelforce}%
\def\pretzelnoindent{\hskip-\ind em\hskip 2em}%
\def\mathin{\ifmmode\else\begin{math}\fi{}}
\def\mathout{\ifmmode\end{math}\fi{}}

\def\javakey#1{\mbox{\bf#1}}
{\catcode`\_=\active\catcode`\$=\active
% Note:  The double braces when defining _ and $ in \javaclass
% and \java@id are necessary to deal correctly with \csname
	\gdef\javaclass{\bgroup\catcode`\_=\active\catcode`\$=\active
		\def_{{!}}\def${{?}}\java@class}%
	\gdef\javaid{\bgroup\catcode`\_=\active\catcode`\$=\active
		\let_=\_\let$=\$\java@id}%
	\gdef\java@id#1{{\def_{{!}}\def\_{!}\def${{?}}\def\${?}%
			\@ifundefined{java@id@#1}%
			{\global\let\java@idfont@local=\it}%
			{\global\let\java@idfont@local=\bf}%
		}\mbox{\java@idfont@local#1}\egroup}%
	\gdef\Tt{\catcode`\_=\active\let_=\_\It}%
}
\def\java@class#1{\expandafter\gdef\csname java@id@#1\endcsname{x}\egroup}
\def\javacomment//#1\javacomment{\mbox{$/\!/${}#1}}
\def\pretzelbreakspace{\hfil\penalty-1\hfilneg
	\kern2.5em\copy\bakk\ignorespaces}%
\def\java@resumemath{\\mathin{}}
\def\javaassign#1{\buildrel\;#1\over{\gets}}

\catcode`\^^K=\other	% for \verb* with strings

\def\javaint#1{\java@num{int}{#1}}
\def\javaoct#1{\java@num{oct}{#1}}
\def\javahex#1{\java@num{hex}{#1}}
\def\javadec#1{\java@num{dec}{#1}}

\let\java@intfont=\rm
\let\java@octfont=\it
\let\java@hexfont=\tt
\let\java@decfont=\rm

\let\java@intprefix=\null
\def\java@octprefix{{$^\circ$}\kern-.2em}
\def\java@hexprefix{{$^{\scriptscriptstyle\#}$}}
\let\java@decprefix=\null

\let\java@intsuffix=\null
\let\java@octsuffix=\null
\let\java@hexsuffix=\null
\let\java@decsuffix=\null

\def\java@num#1#2{\mbox{%
	\csname java@#1prefix\endcsname
	\csname java@#1font\endcsname
	\csname java@#1\endcsname
	#2\end
	\csname java@#1suffix\endcsname
}}

\def\java@int#1{\let\java@next=\java@int
	\ifx#1\end\let\java@next=\relax\else
	\ifx#1l\java@suffix{long}\else
	\ifx#1L\java@suffix{long}\else
		#1%
	\fi\fi\fi\java@next
}
\def\java@suffix#1{\kern.1em{$_{\mathbf{#1}}$}}
\def\java@oct0{\java@int}
\def\java@hex0#1{\java@int}	% #1 is to ignore initial X or x
\def\java@dec#1{\let\java@next=\java@dec
	\ifx#1\end\let\java@next=\relax\else
	\ifx#1D\java@suffix{double}\else
	\ifx#1d\java@suffix{double}\else
	\ifx#1F\java@suffix{float}\else
	\ifx#1f\java@suffix{float}\else
	\ifx#1E\let\java@next=\java@edec$\cdot10^\bgroup\else
	\ifx#1e\let\java@next=\java@edec$\cdot10^\bgroup\else
		#1%
	\fi\fi\fi\fi\fi\fi\fi\java@next
}
\def\java@edec#1{\let\java@next=\java@edec
	\ifx#1\end\egroup$\let\java@next=\relax\else
	\ifx#1D\egroup_{\mathbf{double}}$\let\java@next=\java@dec\else
	\ifx#1d\egroup_{\mathbf{double}}$\let\java@next=\java@dec\else
	\ifx#1F\egroup_{\mathbf{float}}$\let\java@next=\java@dec\else
	\ifx#1f\egroup_{\mathbf{float}}$\let\java@next=\java@dec\else
		#1%
	\fi\fi\fi\fi\fi\java@next
}

% hacks so that the index and mini-indexes will work with our
% jury-rigged back end
\let\java@iddefs=\nwidentdefs
\let\java@iduses=\nwidentuses
{\catcode`\_=\active
	\gdef\nwidentdefs{\bgroup\catcode`\_=\active\def_{!}\java@helpdefs}%
	\gdef\nwidentuses{\bgroup\catcode`\_=\active\def_{!}\java@helpuses}%
}
\def\java@helpdefs#1{\java@iddefs{#1}\egroup}
\def\java@helpuses#1{\java@iduses{#1}\egroup}

\let\java@ixlog=\nwixlogsorted
\def\nwixlogsorted#1#2{%
	\ifx#1i\immediate\write\@auxout{\string\bgroup
		\string\catcode`\string\_=\string\active}\fi
	\java@ixlog{#1}{#2}%
	\ifx#1i\immediate\write\@auxout{\string\egroup}\fi
}
\let\nwixident=\javaid
