From f8cd7018a5ee4ad848a4aa78a58e3dab30d8c611 Mon Sep 17 00:00:00 2001 From: "Y. Wang" Date: Wed, 23 Mar 2022 13:40:42 +0100 Subject: Improve documentation on advtrains.speed. --- assets/manual/manual.tex | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'assets/manual') diff --git a/assets/manual/manual.tex b/assets/manual/manual.tex index ee419e4..69ae2f5 100644 --- a/assets/manual/manual.tex +++ b/assets/manual/manual.tex @@ -54,6 +54,7 @@ \def\luatrue{\texttt{true}} \def\luafalse{\texttt{false}} \def\luanil{\texttt{nil}} +\def\luanan{\texttt{nan}} \def\advtrains{\textsc{advtrains}} \newenvironment{centeredtikzpicture}[1][]{ @@ -1310,26 +1311,27 @@ The \texttt{speed} library allows comparison of speed limits, which can be repre \item $v \geq 0$, which stands for a speed restriction of $v$. \item $-1$ or \luanil, which lifts the speed restriction. \end{itemize} +The use of other values (in particular, \luanan{} and $\pm\infty$) may result in undefined behavior. Note that the meaning of \luanil{} here differ from the meaning used in signal aspect tables (see section \ref{s:sigasp}): \luanil{} lifts the speed limit instead of keeping it. +For speed limits, it is said that $a < b$ if $a$ is more strict than $b$, and $a = b$ if $a$ and $b$ refer to the same speed limit. + The following entries are present in \texttt{advtrains.speed}: \begin{apidoc}{\texttt{advtrains}!\texttt{speed}} -\item \apifunc{lessp}{\var{a},\var{b}} Returns a boolean indicating whether \var{a} is more strict than \var{b}. -\item \apifunc{greaterp}{\var{a},\var{b}} Returns a boolean indicating whether \var{a} is less strict than \var{b}. -\item \apifunc{equalp}{\var{a},\var{b}} Returns a boolean indicating whether \var{a} is the same speed limit as \var{b}. -\item \apifunc{not\_lessp}{\var{a},\var{b}} Returns a boolean indicating whether \var{a} is not more strict than \var{b}. -\item \apifunc{not\_greaterp}{\var{a},\var{b}} Returns a boolean indicating whether \var{a} is not less strict than \var{b}. -\item \apifunc{not\_equalp}{\var{a},\var{b}} Returns a boolean indicating whether \var{a} and \var{b} are different speed limits. +\item \apifunc{lessp}{\var{a},\var{b}} Returns a boolean indicating whether $a < b$. +\item \apifunc{greaterp}{\var{a},\var{b}} Returns a boolean indicating whether $a > b$. +\item \apifunc{equalp}{\var{a},\var{b}} Returns a boolean indicating whether $a = b$. +\item \apifunc{not\_lessp}{\var{a},\var{b}} Returns a boolean indicating whether $a \ge b$. +\item \apifunc{not\_greaterp}{\var{a},\var{b}} Returns a boolean indicating whether $a \le b$. +\item \apifunc{not\_equalp}{\var{a},\var{b}} Returns a boolean indicating whether $a \ne b$. \item \apifunc{min}{\var{a},\var{b}} Returns the strictest limit of \var{a} and \var{b}. \item \apifunc{max}{\var{a},\var{b}} Returns the less strict limit of \var{a} and \var{b}. \item \apifunc{set\_restriction}{\var{train},\var{type},\var{val}} Set speed restriction of type \var{type} of \var{train} to \var{val} and update the \texttt{speed\_restriction} field of \var{train} accordingly. \var{Type} defaults to \texttt{main}. \item \apifunc{merge\_aspect}{\var{train},\var{asp}} Merge the signal aspect \var{asp} into the speed restriction table of \var{train} and update the \texttt{speed\_restriction} field of \var{train} accordingly. \end{apidoc} -For convenience, this manual refers to the functions above as \texttt{speed<}, \texttt{speed>}, \texttt{speed=}, \texttt{speed>=}, \texttt{speed<=}, \texttt{speed/=}, \texttt{speed-min}, and \texttt{speed-max}, respectively. These names are not available in the \texttt{advtrains} table. - \section{Definition tables}\label{s:deftables} Please refer to \texttt{advtrains/api\_doc.txt} for now. -- cgit v1.2.3