%&latex
% COMPATIBLE STRUCTURES IN ANS FORTH
% *** Version 1.0.1 ***
%
% David N. Williams
% 1238 Westport Rd.
% Ann Arbor, MI 48103
% David.N.Williams@umich.edu

% Starting date:  July 4, 1994
% Last revision:  July 10, 1995 (1.0)
% Last revision:  July 16, 2000 (1.0.1)
                
% Begin PREAMBLE
\documentclass[letterpaper,twoside,12pt,dvips]{report}
\usepackage{cite}
\usepackage{alltt}
\usepackage{xspace}
\usepackage{array}

\newif\ifprint
%\printtrue
\printfalse

\ifprint\else\usepackage[colorlinks]{hyperref}\fi

\usepackage[letterpaper,dvips,verbose]{geometry}
\ifprint\geometry{% print geom, for double-sided, loose-leaf notebook
 textwidth=5.4in,
 twosideshift=-0.35in,
 tmargin=1.8in,
 headheight=0in, headsep=0in,
 bmargin=1.2in,
 footskip=.5151in,
 textheight=7.5in}
\else\geometry{% screen geom, for PDF viewing
 papersize={6.2in,5.5in},  % margins .4in all around
 textwidth=5.4in,
 twosideshift=0in,  % to make equal side margins, not same as none
 tmargin=0.4in,
 headheight=0in, headsep=0in,
 bmargin=0.4in,
 footskip=.5151in}
\fi

\makeatletter

%\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\renewcommand*\l@section{%
 \renewcommand{\@dotsep}{2000}\@dottedtocline{1}{0em}{1.5em}}
\renewcommand*\l@subsection{%
 \renewcommand{\@dotsep}{4.5}\@dottedtocline{2}{1.5em}{2em}}
%\renewcommand{\thesection}{\arabic{section}.}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}
\renewcommand{\thesubsubsection}{\thesubsection\arabic{subsubsection}.}
\renewcommand{\theparagraph}{\normalfont\arabic{paragraph}.}
\renewcommand\section{\@startsection%
 {section}{1}{\z@}%
 {-3.5ex \@plus -1ex \@minus -.2ex}%
 {2.3ex \@plus.2ex}%
 {\setcounter{footnote}{0}\normalfont\Large\bfseries}}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\renewcommand{\paragraph}{\@startsection%
 {paragraph}{5}{0pt}{-0.5\baselineskip}{-0pt}{\normalfont}}

% This makes Contents and References headings the same style as the 
% section headings we use in place of chapter headings.
\def\@makeschapterhead#1{%
% \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
%   \Huge \bfseries  #1\par\nobreak
    \Large \bfseries  #1\par\nobreak
%   \vskip 40\p@
    \vskip 2.3ex \@plus.2ex
  }}

% To put a stop after section number, but not in \ref's,
% from Robin Fairbairns, "Re: Changing Sections' Headings", 
% comp.text.tex, June 14, 2000:  (I'm not sure why it fails!)
%\def\@seccntformat#1{\@ifundefined{@seccntformat@#1}%
%  {\csname the#1\endcsname\quad}%
%  {\csname @seccntformat@#1\endcsname{#1}}}
%\def\@seccntformat@section#1{\csname the#1\endcsname.\quad}

\makeatother

% From LaTeX Companion, p.93.  This has to go in the individual
% chapter files, so it's only done if the chapter is loaded.
% Robin Fairbairns says \clearpage instead of \newpage to handle
% numbering with floats.  (We don't have any here.)
\newcommand{\clearemptydoublepage}%
% {\newpage{\pagestyle{empty}\cleardoublepage}}
 {\clearpage\ifprint{\pagestyle{empty}\cleardoublepage}\fi}

% For bad page breaks.
\newcommand{\clearprintpage}{\ifprint\clearpage\fi}
\newcommand{\clearscreenpage}{\ifprint\else\clearpage\fi}
 
\renewcommand{\bibname}{References}

\newcommand{\dfa}{{\tt dfa}\xspace}
\newcommand{\sda}{{\tt sda}\xspace}
\newcommand{\sfa}{{\tt sfa}\xspace}
\newcommand{\sfo}{{\tt sfo}\xspace}
\newcommand{\id}{{\tt id}\xspace}
\newcommand{\atype}{{\tt atype}\xspace}
\newcommand{\adtype}{{\tt adtype}\xspace}
\newcommand{\bftype}{{\tt bftype}\xspace}
\newcommand{\stype}{{\tt stype}\xspace}
\newcommand{\utype}{{\tt utype}\xspace}
\newcommand{\ustype}{{\tt ustype}\xspace}
\newcommand{\xldots}{\ldots\xspace}

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{2}

\renewcommand{\descriptionlabel}[1]%
  {\hspace{\labelsep}\textrm{#1}}

\def\undertext#1{$\underline{\text{#1}}$}
\def\twoparder#1#2{{\partial^2#1\over\partial#2^2}}

\clubpenalty=9999
\widowpenalty=9999

\includeonly{intro,strucdata,typestruc,layout,strucwords,extwords,%
 fdl,ref}
%\includeonly{ref}%
% End PREAMBLE

\begin{document}
\pagenumbering{roman}

\begin{titlepage}
\begin{center}

{\Large\bf Compatible Structures in ANS Forth\\}
\bigskip\bigskip
{\large David N. Williams\\}
\bigskip\smallskip
{\normalfont Version 1.0.1\\ \smallskip July, 2000\\}

\vspace{\fill}

{\normalfont\bf Abstract}
\end{center}
We present a Structure word set for ANS Forth, and provide a portable
implementation in the file {\tt cstruct.fs}.  A major aim is
compatibility with structures in C libraries.  The idea for making
structures nestable with reusable field labels is taken from Randolph
Peters' Pocket Forth implementation \cite{rpeters:93}, and we
implement some early binding ideas stressed in a Forth Scientific
Library implementation \cite{scarter:95}.  We implement both left and
right syntaxes for structure data references.

\vspace*{\fill}

\end{titlepage}

\vspace*{\fill}
\noindent Copyright \copyright\ 2000 David N.~Williams

\medskip\noindent
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
any later version published by the Free Software Foundation, with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.  A copy of the license is included in the section entitled 
``GNU free documentation license''.

\tableofcontents
\clearemptydoublepage

\pagenumbering{arabic}
\include{intro}
\include{strucdata}
\include{typestruc}
\include{layout}
\include{strucwords}
\include{extwords}
\footnotesize
\include{fdl}
\normalsize
\include{ref}

\end{document}
