Commit ef991087 authored by pknaggs's avatar pknaggs

Added reference to Rational in introduction

Removed x:enhanced-locals markup
Replaced F94 with F12
Added implementation of LOCALS| (taken from rational introduction)
Added rational for LOCALS| (taken from rational introduction)
Added word number for {:
Minor revisions to definition and rational of {:
parent 1c54820f
% !TeX root = forth.tex
% !TeX spellcheck = en_US
\chapter{The optional Locals word set} % 13
\wordlist{local}
\section{Introduction} % 13.1
\label{locals:intro}
See: \xref[Annex A.13 The Locals Word Set]{rat:local}.
\cbstart\patch{ed12}
See: \xref[Annex A.13 The Locals Word Set]{rat:local}.\strike{4}{175}
\cbend
\section{Additional terms and notation} % 13.2
......@@ -109,7 +115,7 @@ shall take the following actions at compile time:
\end{enumerate}
A system implementing the Locals word set shall support the
declaration of at least \replace{x:enhanced-locals}{eight}{sixteen} locals in a definition.
declaration of at least sixteen locals in a definition.
\subsubsection{Syntax restrictions} % 13.3.3.2
......@@ -141,7 +147,7 @@ syntaxes for local declarations with the following restrictions:
(tick), \word[core]{[']}, or \word[core]{FIND}, shall not be
used with local names;
\item A program that declares more than \replace{x:enhanced-locals}{eight}{sixteen} locals in a single
\item A program that declares more than sixteen locals in a single
definition has an environmental dependency;
\item Locals may be accessed or updated within control structures,
......@@ -170,10 +176,10 @@ See: \xref[3.4 The Forth text interpreter]{usage:command}.
\begin{itemize}
\item executing a named \emph{local} while in interpretation state
(\wref{local:LOCAL}{(LOCAL)});
\item \place{x:enhanced-locals}{a local name ends in ``\texttt{:}'', ``\texttt{[}'', ``\texttt{\textasciicircum}'';}
\item \place{x:enhanced-locals}{a local name is a single non-alphabetic character;}
\item \place{x:enhanced-locals}{the text between \word{b:} and \texttt{:\}} extends over more than one line;}
\item \place{x:enhanced-locals}{\word{b:} \ldots{} \texttt{:\}} is used more than once in a word.}
\item a local name ends in ``\texttt{:}'', ``\texttt{[}'', ``\texttt{\textasciicircum}'';
\item a local name is a single non-alphabetic character;
\item the text between \word{b:} and \texttt{:\}} extends over more than one line;
\item \word{b:} \ldots\ \texttt{:\}} is used more than once in a word.
\end{itemize}
\subsubsection{Other system documentation} % 13.4.1.3
......@@ -186,7 +192,7 @@ See: \xref[3.4 The Forth text interpreter]{usage:command}.
\subsubsection{Environmental dependencies} % 13.4.2.1
\label{locals:environment}
\begin{itemize}
\item declaring more than \replace{x:enhanced-locals}{eight}{sixteen} locals in a single definition
\item declaring more than sixteen locals in a single definition
(\xref[13.3.3 Processing locals]{local:locals}).
\end{itemize}
......@@ -198,8 +204,8 @@ See: \xref[3.4 The Forth text interpreter]{usage:command}.
\section{Compliance and labeling} % 13.5
\cbstart\patch{F94}
\subsection[Forth systems]{ANS\strike{3.5}{25} Forth systems} % 13.5.1
\cbstart\patch{F12}
\subsection[Forth-\snapshot systems]{Forth-\snapshot\strike{-1}{25} systems} % 13.5.1
\cbend
The phrase ``Providing the Locals word set'' shall be appended to
......@@ -214,8 +220,8 @@ The phrase ``Providing the Locals Extensions word set'' shall be
appended to the label of any Standard System that provides all of
the Locals and Locals Extensions word sets.
\cbstart\patch{F94}
\subsection[Forth programs]{ANS\strike{3.5}{25} Forth programs} % 13.5.2
\cbstart\patch{F12}
\subsection[Forth-\snapshot programs]{Forth-\snapshot\strike{-1}{25} programs} % 13.5.2
\cbend
The phrase ``Requiring the Locals word set'' shall be appended to
......@@ -319,19 +325,32 @@ to provide all of the Locals and Locals Extensions word sets.
each local will return its value. The value of a local may be
changed using \wref{core:TO}{TO}.
\see \rref{local:LOCALS}{}.
\see \remove{ed12}{\rref{local:LOCALS}{}.}
\begin{implement}
\cbstart\patch{ed12}
\uline{\word{:} \word{LOCALS} \word{p} "name{\ldots}name |" -{}- )} \\
\tab \uline{\word{BEGIN}} \\
\tab~ \uline{\word{BL} \word{WORD} ~ \word{COUNT} \word{OVER} \word{C@}} \\
\tab~ \uline{\word{[CHAR]} | \word{-} \word{OVER} 1 \word{-} \word{OR} ~ \word{WHILE}} \\
\tab~ \uline{\word[local]{LOCAL}} \\
\tab \uline{\word{REPEAT} \word{2DROP} ~ 0 0 \word{LOCAL}} \\
\uline{\word{;} \word{IMMEDIATE}}
\cbend
\end{implement}
\begin{rationale} % A.13.6.2.1795 LOCALS|
\remove{ed12}{%
A possible implementation of this word and an example of usage
is given in \ref{rat:local}, above. It is intended as an
example only; any implementation yielding the described
semantics is acceptable.
semantics is acceptable.}
\end{rationale}
\end{worddef}
\newpage
% -------------------------------------------------------------------
\begin{worddef*}[b:]{}{\brace:}[brace-colon][x:enhanced-locals]
\begin{worddef}[b:]{2550}{\brace:}[brace-colon][x:enhanced-locals]
\interpret
Interpretation semantics for this word are undefined.
......@@ -371,7 +390,7 @@ to provide all of the Locals and Locals Extensions word sets.
\item[\arg{val}] names are uninitialized.
\end{list}
\arg{val} names and \arg{arg} names have the execution semantics
\arg{val} \remove{ed12}{names} and \arg{arg} names have the execution semantics
given below.
\execute[name]
......@@ -384,7 +403,8 @@ to provide all of the Locals and Locals Extensions word sets.
\runtime[\word{TO} \param{name}]
\stack{x}{}
Assign the value \param{x} to the local \param{name}.
\replace{ed12}{Assign the value \param{x} to the local \param{name}.}{%
Set \param{name} to the value \param{x}.}
\see \xref[2.2 Notation]{notations},
\wref{core:VALUE}{},
......@@ -392,7 +412,7 @@ to provide all of the Locals and Locals Extensions word sets.
\rref{local:b:}{}.
\begin{rationale}
The Forth 94 Technical Committee where unable to identify any common
The Forth 94 Technical Committee \replace{ed12}{where}{were} unable to identify any common
practice for locals. They provided a way to define locals and a method
of parsing them in the hope that a common practice would emerge.
......@@ -402,7 +422,7 @@ to provide all of the Locals and Locals Extensions word sets.
other systems. The \word{b:} \ldots\ \texttt{:\}} notation is a compromise
to avoid name conflicts.
The notation provides for different kinds of local: those that are
The notation provides for different kinds of local: those that are
initialized from the data stack at run-time, uninitialized locals, and
outputs. Initialized locals are separated from uninitialized locals by
`\texttt{\textbar}'. The definition of locals is terminated by
......@@ -416,7 +436,7 @@ to provide all of the Locals and Locals Extensions word sets.
have used `\texttt{\bs}' (ASCII \$5C) or `\texttt{\textbrokenbar}' (\$A6).
Systems are free to continue to provide these alternative separators.
However, only the recognition of the `\texttt{\textbar}' separator is
mandatory. Therefore portable programs must use the `\texttt{\textbar}'
mandatory. Therefore portable programs must use the `\texttt{\textbar}'
separator.
A number of systems extend the locals notation in various ways. Some of
......@@ -474,7 +494,8 @@ to provide all of the Locals and Locals Extensions word sets.
\tab\,\word{2DROP} define-locals \\
\word{;} \word{IMMEDIATE}
\end{implement}
\end{worddef*}
\end{worddef}
\endinput
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment