% -*- Mode:Text -*- 
% tt 9-18-94
% \sourcepath, defined in sorspath.tex, is the path of the LaTeX source files
% \inputfilename is like \jobname, but is the file currently being read
 \input sorspath		
 \proofbox{{\em STEP Software Reference}\par
	{\tt\sourcepath/\inputfilename}\par
	Copyright \copyright~\number\year\ T. Toffoli\par
	{\bf DRAFT},
	\today
	}

\let\tsy\textsf	    % symbols done in sans serif

\newcommand{\SF}{StepForth}

\newcommand{\cam}{\tsc{step}}
\newcommand{\Cam}{\tsc{Step}}
\newcommand{\CAM}{STEP}			% for headings where \sc is bad
\newcommand{\STEP}{STEP}		% for headings where \sc is bad
\newcommand{\step}{\tsc{step}}
\newcommand{\Step}{\tsc{Step}}
\newcommand{\chip}{\tsc{step}chip}
\newcommand{\CHIP}{STEPchip}		% for headings where \sc is bad
%\newcommand{\cam}{\tsc{cam}8}
%\newcommand{\Cam}{\tsc{Cam}8}
%\newcommand{\STEP}{CAM8}		% for headings where \sc is bad
%\newcommand{\CAM}{CAM8}		% for headings where \sc is bad
%\newcommand{\step}{\tsc{cam}8}
%\newcommand{\Step}{\tsc{Cam}8}
%\newcommand{\chip}{\tsc{cam}8chip}
%\newcommand{\CHIP}{CAM8chip}		% for headings where \sc is bad

\newcommand{\team}{team}
\newcommand{\ctrler}{controller}


\newcommand{\steplist}{step list}
\newcommand{\dram}{\tsc{dram}}
\newcommand{\Dram}{\tsc{Dram}}
\newcommand{\sram}{\tsc{sram}}
\newcommand{\Sram}{\tsc{Sram}}
\newcommand{\io}{\tsc{i/o}}
\newcommand{\vlsi}{\tsc{vlsi}}
\newcommand{\lut}{\tsc{lut}}
\newcommand{\crt}{\tsc{crt}}

\newcommand{\vtab}{VTab}
\newcommand{\htab}{HTab}
\newcommand{\vsync}{VSync}
\newcommand{\hsync}{HSync}

\newcommand{\bus}{CBus}
\newcommand{\sbus}{SBus}
\newcommand{\sparcstation}{\tsc{sparc}station}
\newcommand{\sun}{\tsc{sun}}
\newcommand{\vga}{\tsc{vga}}
\newcommand{\cpu}{\tsc{cpu}}
\newcommand{\forth}{\tsc{forth}}
\newcommand{\ioctl}{\ttt{ioctl}}


 \def\DO{\tsc{do}}
 \def\BEGIN{\tsc{begin}}
 \def\IF{\tsc{if}}
 \def\CASE{\tsc{case}}
 \def\DOES{\tsc{does}}

 \def\ascii{\tsc{ascii}}
 \def\unix{\tsc{unix}}
 \def\true{\tsc{true}}
 \def\false{\tsc{false}}
 \def\compile{\tsc{compile}}
 \def\interpret{\tsc{interpret}}
 \def\current{\tsc{current}}
 \def\context{\tsc{context}}
 \def\ag#1{{\sl #1}\/}
 \def\oneliner#1{\par\leavevmode\kern2em{\tt#1}\par}
 \def\return{$\hookleftarrow$}
 \def\OR{{\tt\char'174}}
 \def\FLAG{{\sl flag}}
 \def\TRUE{$\langle true\rangle$}
 \def\FALSE{$\langle false\rangle$}

% VERBATIMS
%\id is like \verb, but inserts some space before and after text

\makeatletter

\def\@meaning#1>{}
\def\@nearverbatim{\expandafter\@meaning\meaning}

\def\idpad{\thinspace}
\def\id{\idpad\begingroup \tt \let\do\@makeother \dospecials 
          \@ifstar{\@sid}{\@id}}
\def\@sid#1{\def\@tempa ##1#1{##1\endgroup\idpad}\@tempa}
\def\@id{\obeyspaces \frenchspacing \@sid}
\makeatother

%\redefine verbatim to leave no \topsep before and after
\makeatletter
\def\@endparenv{\addpenalty\@endparpenalty\@endpetrue}
\def\@trivlist{
  \if@noskipsec \leavevmode \fi
  \ifvmode \advance\@topsepadd\partopsep \else \unskip\par\fi
  \if@inlabel \@noparitemtrue \@noparlisttrue 
    \else \@noparlistfalse \@topsep\@topsepadd \fi
    \advance\@topsep \parskip
  \leftskip\z@\rightskip\@rightskip \parfillskip\@flushglue
  \@setpar{\if@newlist\else{\@@par}\fi}%
  \global\@newlisttrue \@outerparskip\parskip}

\def\replacements{
 \def\say##1{}
 \let\ss\relax
 \let\ff\relax
 \def\={---}
 \def\return{$\hookleftarrow$}
 \def\imm{\gdef\IMM{\dagger}\gdef\MODS{1}}
 \def\dfr{\gdef\DFR{*}\gdef\MODS{1}}
 \def\cmp{\gdef\CMP{C}\gdef\MODS{1}}
 \def\itp{\gdef\ITP{I}\gdef\MODS{1}}
 \def\modifiers{\ifodd\MODS $\;^{\mathsc{\IMM\DFR\CMP\ITP}}$\fi}
 \def\resetMODS{\gdef\IMM{}\gdef\DFR{}\gdef\CMP{}\gdef\ITP{}\gdef\MODS{0}}
 \resetMODS
} %end \replacements


 \def\interface#1{\parsearg#1::\@nil}
 \def\parsearg#1:#2:#3\@nil{%
	\ \if!#1! \else({\sl#1}\/)\fi{ \sl #2} \hfill}
 \def\indwordname#1{\setbox0=\hbox{\tt#1}%
    \ifdim\wd0<50pt\wd0=50pt\fi
    \leavevmode\box0}

\def\macros{
 \def\see##1{see \ttt{##1}}
 \def\wordname##1{\setbox0=\hbox{\tt##1}%
    \ifdim\wd0<50pt\wd0=50pt\fi
%    \kern-1em\box0}
    \box0}
 \def\definer##1{\hfill\ttt{##1}\modifiers}
}% end macros

\newenvironment{thesaurus}{
 \par
 \footnotesize
 \newdimen\LSKIP\LSKIP=1em
 \newdimen\PARSKIP\PARSKIP=2pt
 \setlength{\parskip}{\PARSKIP}
 \advance\leftskip by\LSKIP
 \setlength{\parindent}{0pt}
 \def\loneskip{\smallskip}
 \setlength{\marginparwidth}{1em}
 \def\en##1{{\bf##1} (\sect{##1})}
%\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
% -.2ex}{2.3ex plus .2ex}{\Large\bf}}
 \def\subsection{\@startsection{subsection}{2}{-8pt}{-2ex}{1ex}{\normalsize\bf}}
%% put \hrule just before section heading
 \def\@startsection##1##2##3##4##5##6{\if@noskipsec \leavevmode \fi 
   \par \@tempskipa ##4\relax
   \@afterindenttrue
   \ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse\fi
   \if@nobreak \ifnum##2=2\hrule\fi\everypar{}\else
     \addpenalty{\@secpenalty}\addvspace{\@tempskipa}\ifnum##2=2\hrule\fi\fi \@ifstar
     {\@ssect{##3}{##4}{##5}{##6}}{\@dblarg{\@sect{##1}{##2}{##3}{##4}{##5}{##6}}}}
 \def\entry##1{\subsection{##1}\sectlabel{##1}}
 \gdef\WORDS{0}
 \def\parnoskip{\ifodd\WORDS\setlength{\parskip}{0pt}%
			        \else\setlength{\parskip}{8pt}\fi
   \par\leavevmode\kern-1em%
   \setlength{\parskip}{\PARSKIP}\everypar{\gdef\WORDS{0}}}

%\@word{THES-NAME}{SORT-NAME}{INDEX-NAME}{INTERFACE}{DEFINER}
%\word{NAME}{INTERFACE}{DEFINER}
%\Word{THES-NAME}{SORT-NAME}{INTERFACE}{DEFINER}
%\WORD{THES-NAME}{SORT-NAME}{INDEX-NAME}{INTERFACE}{DEFINER}
 \def\@word##1##2##3##4##5{\gdef\WORDS{1}%
	\parnoskip
	\wordname{##1}%
	\interface{##4}%
	\definer{##5}%
	\par\resetMODS
	\index[t]{##2z@\indwordname{##3}\interface{##4}}}
 \def\@wordnoindex##1##2##3##4##5{\gdef\WORDS{1}%
	\parnoskip
	\wordname{##1}%
	\interface{##4}%
	\definer{##5}%
	\par\resetMODS}
 \def\word##1##2##3{\@word{##1}{##1}{##1}{##2}{##3}}
 \def\Word##1##2##3##4{\@word{##1}{##2}{##1}{##3}{##4}}
 \def\WORD##1##2##3##4##5{\@word{##1}{##2}{##3}{##4}{##5}}
\replacements\macros}{\par} %end definition of thesaurus environment

%\def\@wrindex#1{\let\thepage\relax
%   \edef\@tempa{\write\@indexfile{\string
%      \indexentry{#1}{\thesubsection}}}\expandafter\endgroup\@tempa
%   \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

\def\thesindexstyle{
\renewenvironment{theindex}{%
	\chapter{Thesaurus index}%
	\parindent\z@
	\renewcommand{\item}{\par\hangindent40\p@\leavevmode}
	\setlength{\columnseprule}{0.4pt}%
	\setlength{\columnsep}{8pt}%
	\begin{multicols}{3}%
	\replacements}%
	{\end{multicols}}
		  }
\makeatother
