aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2022-08-10 11:16:05 +0200
committerY. Wang <yw05@forksworld.de>2022-08-10 11:16:05 +0200
commit80f2f33bfb2b9bf8d38db86aa7b1a982fd7a548d (patch)
tree1baaae42bfd67c3c6b1084acbcaa1a9cfa1773dc
parent764f7d42913698d9c46f6b1adcff4f0fd73a86b0 (diff)
downloadadvtrains-80f2f33bfb2b9bf8d38db86aa7b1a982fd7a548d.tar.gz
advtrains-80f2f33bfb2b9bf8d38db86aa7b1a982fd7a548d.tar.bz2
advtrains-80f2f33bfb2b9bf8d38db86aa7b1a982fd7a548d.zip
Reformat advtrains.speed docs as manual pages; minor formatting changes
-rw-r--r--Makefile4
-rw-r--r--assets/manual/filter_man_md2tex.lua5
-rw-r--r--assets/manual/man/man3advtrains/speed_lessp.3advtrains.md26
-rw-r--r--assets/manual/man/man3advtrains/speed_set_restriction.3advtrains.md17
-rw-r--r--assets/manual/man/man7advtrains/speed.7advtrains.md18
-rw-r--r--assets/manual/tex/dev-advtrains.tex36
-rw-r--r--assets/manual/tex/introduction.tex2
-rw-r--r--assets/manual/tex/main.tex4
8 files changed, 70 insertions, 42 deletions
diff --git a/Makefile b/Makefile
index fad6c8a..7beb1fc 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ all: doc
doc: doc-pdf doc-man
doc-pdf: $(TEX_MAIN_DSTS)
-%.pdf:: %.tex $(MAN_TEX)
+%.pdf:: %.tex $(MAN_TEX) $(wildcard $(TEX_PATH)/*.tex)
$(LATEXMK) -cd -pdf $<
doc-man: $(MAN_DSTS)
@@ -32,5 +32,5 @@ doc-man: $(MAN_DSTS)
$(MAN_TEX): $(MAN_TEXS)
find $(MAN_PATH) -name '*.tex' -printf '\\input{../man/%P}\n' | sort > $(MAN_TEX)
-%.tex:: %.md
+%.tex:: %.md ${MANUAL_ROOT}/filter_man_md2tex.lua
$(PANDOC) -L ${MANUAL_ROOT}/filter_man_md2tex.lua -t latex -o $@ $<
diff --git a/assets/manual/filter_man_md2tex.lua b/assets/manual/filter_man_md2tex.lua
index baa5c00..fb21405 100644
--- a/assets/manual/filter_man_md2tex.lua
+++ b/assets/manual/filter_man_md2tex.lua
@@ -8,7 +8,10 @@ return {
},
{
Header = function(elem)
- return pandoc.Header(elem.level+1, elem.content)
+ local attr = {
+ class = "unnumbered unlisted",
+ }
+ return pandoc.Header(elem.level+1, elem.content, attr)
end,
},
{
diff --git a/assets/manual/man/man3advtrains/speed_lessp.3advtrains.md b/assets/manual/man/man3advtrains/speed_lessp.3advtrains.md
new file mode 100644
index 0000000..5bc61e7
--- /dev/null
+++ b/assets/manual/man/man3advtrains/speed_lessp.3advtrains.md
@@ -0,0 +1,26 @@
+% SPEED_LESSP(3ADVTRAINS) | Advtrains Developer's Manual
+
+# NAME
+`lessp`, `greaterp`, `equalp`, `not_lessp`, `not_greaterp`, `not_equalp`, `min`, `max` - Speed limit comparison functions
+
+# SYNOPSIS
+
+* `lessp(a, b)`
+* `greaterp(a, b)`
+* `equalp(a, b)`
+* `not_lessp(a, b)`
+* `not_greaterp(a, b)`
+* `min(a, b)`
+* `max(a, b)`
+
+# DESCRIPTION
+`lessp()`, `greaterp()`, `equalp()`, `not_lessp()`, `not_greaterp()`, and `not_equalp()` are predicate functions that returns, respectively,
+
+* Whether `a` is more strict than `b`
+* Whether `a` is less strict than `b`
+* Whether `a` and `b` indicate the same speed limit
+* Whether `a` is not more strict than `b`
+* Whether `a` is nor less strict than `b`
+* Whether `a` and `b` do not indicate the same speed limit
+
+`min()` returns the speed limit that is more strict. `max()` returns the speed limit that is less strict.
diff --git a/assets/manual/man/man3advtrains/speed_set_restriction.3advtrains.md b/assets/manual/man/man3advtrains/speed_set_restriction.3advtrains.md
new file mode 100644
index 0000000..1df5358
--- /dev/null
+++ b/assets/manual/man/man3advtrains/speed_set_restriction.3advtrains.md
@@ -0,0 +1,17 @@
+% SPEED_SET_RESTRICTION(3ADVTRAINS) | Advtrains Developer's Manual
+
+# NAME
+`set_restriction`, `merge_aspect` - Apply speed limits to trains
+
+# SYNOPSIS
+
+* `set_restriction(train, type, val)`
+* `merge_aspect(train, asp)`
+
+# DESCRIPTION
+`set_restriction()` sets the speed restriction of the given type of the given train to `val` and updates train object correspondingly.
+
+`merge_aspect()` sets the speed restriction of the given train based on the value of the signal aspect.
+
+# RETURN VALUE
+`set_restriction()` and `merge_aspect()` do not return any value.
diff --git a/assets/manual/man/man7advtrains/speed.7advtrains.md b/assets/manual/man/man7advtrains/speed.7advtrains.md
new file mode 100644
index 0000000..bf8ed08
--- /dev/null
+++ b/assets/manual/man/man7advtrains/speed.7advtrains.md
@@ -0,0 +1,18 @@
+% SPEED(7ADVTRAINS) | Advtrains Developer's Manual
+
+# NAME
+`speed` - Advtrains speed limit library
+
+# DESCRIPTION
+The speed library allows the manipulation of speed limits, which can be represented with
+
+* A non-negative number, which stands for a regular speed limit in m/s, or
+* -1 or `nil`, which lifts the speed restriction
+
+The use of other values (in particular, nan and infinity) may result in undefined behavior.
+
+This library is available as `advtrains.speed`.
+
+# NOTES
+
+The meaning of `nil` for the speed limit library differs from its meaning in signal aspect tables, where `nil` keeps the current speed limit.
diff --git a/assets/manual/tex/dev-advtrains.tex b/assets/manual/tex/dev-advtrains.tex
deleted file mode 100644
index 4bfbeab..0000000
--- a/assets/manual/tex/dev-advtrains.tex
+++ /dev/null
@@ -1,36 +0,0 @@
-\part{Developer's Manual}
-
-This part is mostly relevant only to those interested in working on internal mechanisms of \advtrains{} or making mods related to \advtrains{}. Please note that this part is still incomplete.
-
-\section{The \texttt{advtrains} table}\label{s:tadvtrains}
-
-\subsection{\texttt{advtrains.speed}}\label{s:tspeed}
-The \texttt{speed} library allows comparison of speed limits, which can be represented with:
-\begin{itemize}
-\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 $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}
-
-%%% Local Variables:
-%%% TeX-master: "a4manual"
-%%% End: \ No newline at end of file
diff --git a/assets/manual/tex/introduction.tex b/assets/manual/tex/introduction.tex
index 1351fbf..752e098 100644
--- a/assets/manual/tex/introduction.tex
+++ b/assets/manual/tex/introduction.tex
@@ -11,7 +11,7 @@ A notable portion of the manual is influenced by various other guides and manual
\item The format of the API documentation is influenced by R$^7$RS.
\item Section \ref{s:interlocking} is written with reference to orwell's interlocking guide and Blockhead's video explaining the three-station setup. The links to both sources can be found in that section.
\item Section \ref{s:luaatc} is a reformatted and restructured version of the LuaATC documentation, written by orwell and Maverick2797.
-\item The manuals related to railway-time are modifed from the railway time API documentation written by orwell. Part of the section is also taken from \texttt{advtrains\_line\_automation/railwaytime.lua}
+\item The manuals related to railway time are modifed from the railway time API documentation written by orwell. Part of the section is also taken from \texttt{advtrains\_line\_automation/railwaytime.lua}
\end{itemize}
\subsection*{Conventions}
diff --git a/assets/manual/tex/main.tex b/assets/manual/tex/main.tex
index 17d327d..593c749 100644
--- a/assets/manual/tex/main.tex
+++ b/assets/manual/tex/main.tex
@@ -7,13 +7,13 @@
\include{signals.tex}
\include{luaatc.tex}
-\include{manpages.tex}
-\include{dev-advtrains.tex}
\include{nodedef.tex}
\include{tables.tex}
\include{contributing.tex}
+\include{manpages.tex}
+
\include{physics.tex}
\ifx\HCode\undefined