Commit ef991087 authored by pknaggs's avatar pknaggs
Browse files

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
Loading
Loading
Loading
Loading
+43 −22
Original line number Original line Diff line number Diff line
% !TeX root = forth.tex
% !TeX spellcheck = en_US

\chapter{The optional Locals word set} % 13
\chapter{The optional Locals word set} % 13
\wordlist{local}
\wordlist{local}


\section{Introduction} % 13.1
\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
\section{Additional terms and notation} % 13.2


@@ -109,7 +115,7 @@ shall take the following actions at compile time:
\end{enumerate}
\end{enumerate}


A system implementing the Locals word set shall support the
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
\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
	(tick), \word[core]{[']}, or \word[core]{FIND}, shall not be
	used with local names;
	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;
	definition has an environmental dependency;


\item Locals may be accessed or updated within control structures,
\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}
\begin{itemize}
\item executing a named \emph{local} while in interpretation state
\item executing a named \emph{local} while in interpretation state
	(\wref{local:LOCAL}{(LOCAL)});
	(\wref{local:LOCAL}{(LOCAL)});
\item \place{x:enhanced-locals}{a local name ends in ``\texttt{:}'', ``\texttt{[}'', ``\texttt{\textasciicircum}'';}
\item a local name ends in ``\texttt{:}'', ``\texttt{[}'', ``\texttt{\textasciicircum}'';
\item \place{x:enhanced-locals}{a local name is a single non-alphabetic character;}
\item 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 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 \word{b:} \ldots\ \texttt{:\}} is used more than once in a word.
\end{itemize}
\end{itemize}


\subsubsection{Other system documentation} % 13.4.1.3
\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
\subsubsection{Environmental dependencies} % 13.4.2.1
\label{locals:environment}
\label{locals:environment}
\begin{itemize}
\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}).
	(\xref[13.3.3 Processing locals]{local:locals}).
\end{itemize}
\end{itemize}


@@ -198,8 +204,8 @@ See: \xref[3.4 The Forth text interpreter]{usage:command}.


\section{Compliance and labeling} % 13.5
\section{Compliance and labeling} % 13.5


\cbstart\patch{F94}
\cbstart\patch{F12}
\subsection[Forth systems]{ANS\strike{3.5}{25} Forth systems} % 13.5.1
\subsection[Forth-\snapshot systems]{Forth-\snapshot\strike{-1}{25} systems} % 13.5.1
\cbend
\cbend


The phrase ``Providing the Locals word set'' shall be appended to
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
appended to the label of any Standard System that provides all of
the Locals and Locals Extensions word sets.
the Locals and Locals Extensions word sets.


\cbstart\patch{F94}
\cbstart\patch{F12}
\subsection[Forth programs]{ANS\strike{3.5}{25} Forth programs} % 13.5.2
\subsection[Forth-\snapshot programs]{Forth-\snapshot\strike{-1}{25} programs} % 13.5.2
\cbend
\cbend


The phrase ``Requiring the Locals word set'' shall be appended to
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
	each local will return its value. The value of a local may be
	changed using \wref{core:TO}{TO}.
	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|
	\begin{rationale} % A.13.6.2.1795 LOCALS|
\remove{ed12}{%
		A possible implementation of this word and an example of usage
		A possible implementation of this word and an example of usage
		is given in \ref{rat:local}, above. It is intended as an
		is given in \ref{rat:local}, above. It is intended as an
		example only; any implementation yielding the described
		example only; any implementation yielding the described
		semantics is acceptable.
		semantics is acceptable.}
	\end{rationale}
	\end{rationale}
\end{worddef}
\end{worddef}


\newpage
% -------------------------------------------------------------------


\begin{worddef*}[b:]{}{\brace:}[brace-colon][x:enhanced-locals]
\begin{worddef}[b:]{2550}{\brace:}[brace-colon][x:enhanced-locals]
\interpret
\interpret
	Interpretation semantics for this word are undefined.
	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.
	\item[\arg{val}] names are uninitialized.
	\end{list}
	\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.
		given below.


\execute[name]
\execute[name]
@@ -384,7 +403,8 @@ to provide all of the Locals and Locals Extensions word sets.
\runtime[\word{TO} \param{name}]
\runtime[\word{TO} \param{name}]
	\stack{x}{}
	\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},
\see \xref[2.2 Notation]{notations},
	\wref{core:VALUE}{},
	\wref{core:VALUE}{},
@@ -392,7 +412,7 @@ to provide all of the Locals and Locals Extensions word sets.
	\rref{local:b:}{}.
	\rref{local:b:}{}.


	\begin{rationale}
	\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
		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.
		of parsing them in the hope that a common practice would emerge.


@@ -474,7 +494,8 @@ to provide all of the Locals and Locals Extensions word sets.
\tab\,\word{2DROP} define-locals \\
\tab\,\word{2DROP} define-locals \\
\word{;} \word{IMMEDIATE}
\word{;} \word{IMMEDIATE}
	\end{implement}
	\end{implement}
\end{worddef*}
\end{worddef}

\endinput
\endinput