From 5196eced72b4ad6f91394fe3845a94405c67a5ba Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Thu, 30 Apr 2020 10:38:49 +0200 Subject: [PATCH] Fix misc formatting found by looking at remaining instances of {[} --- chapters/arrays.tex | 2 +- chapters/classes.tex | 24 ++++++++++++------------ chapters/functions.tex | 13 +++++++------ 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/chapters/arrays.tex b/chapters/arrays.tex index 79ffc233d..5b1e37e69 100644 --- a/chapters/arrays.tex +++ b/chapters/arrays.tex @@ -789,7 +789,7 @@ \section{Array Indexing}\doublelabel{array-indexing} dimension index bounds (\autoref{array-dimension-lower-and-upper-index-bounds}). The indexing operator takes two or more operands, where the first operand is the array to be indexed and the rest of the operands are index expressions: -arrayname{[}\emph{indexexpr1}, \emph{indexexpr2}, ...{]} +\lstinline[mathescape=true]!$\mathit{arrayname}$[$\mathit{indexexpr}_{1}$, $\mathit{indexexpr}_{2}$, $\ldots$]! A colon is used to denote all indices of one dimension. A vector expression can be used to pick out selected rows, columns and elements diff --git a/chapters/classes.tex b/chapters/classes.tex index 3fdd56ce7..5c7a60bc5 100644 --- a/chapters/classes.tex +++ b/chapters/classes.tex @@ -17,12 +17,9 @@ \section{Access Control -- Public and Protected Elements}\doublelabel{access-con Members of a Modelica class can have two levels of visibility: \lstinline!public! or \lstinline!protected!. The default is \lstinline!public! if nothing else is specified -A protected element, P, in classes and components may not be accessed -via dot notation (e.g., A.P, a.P, a{[}1{]}.P, a.b.P, .A.P; but there is -no restriction on using P or P.x for a protected element P). They may -not be modified or redeclared except for modifiers applied to protected -elements in a base-class modification (not inside any component or -class) and the modifier on the declaration of the protected element. +A protected element, \lstinline!P!, in classes and components may not be accessed via dot notation (e.g., \lstinline!A.P!, \lstinline!a.P!, \lstinline!a[1].P!, \lstinline!a.b.P!, +\lstinline!.A.P!; but there is no restriction on using \lstinline!P! or \lstinline!P.x! for a protected element \lstinline!P!). They may not be modified or redeclared except for +modifiers applied to protected elements in a base-class modification (not inside any component or class) and the modifier on the declaration of the protected element. \begin{example} \begin{lstlisting}[language=modelica] @@ -1447,16 +1444,19 @@ \section{Predefined Types and Classes}\doublelabel{predefined-types-and-classes} and \lstinline!y!. It is not possible to combine extends from the predefined types, enumeration types, or this \lstinline!Clock! type with other components. The names \lstinline!Real!, \lstinline!Integer!, \lstinline!Boolean! and \lstinline!String! are reserved such that it is illegal -to declare an element with these names. {[}Thus it is possible to define -a normal class called \lstinline!Clock! in a package and extend from it.{]} The -definitions use \lstinline!RealType!, \lstinline!IntegerType!, -\lstinline!BooleanType!, \lstinline!StringType!, \lstinline!EnumType! -as mnemonics corresponding to machine representations. +to declare an element with these names. + +\begin{nonnormative} +Hence, it is possible to define a normal class called \lstinline!Clock! in a package and extend from it. +\end{nonnormative} \begin{nonnormative} -Hence the only way to declare a subtype of e.g. \lstinline!Real! is to use the \lstinline!extends! mechanism. +It also follows that the only way to declare a subtype of e.g. \lstinline!Real! is to use the \lstinline!extends! mechanism. \end{nonnormative} +The definitions use \lstinline!RealType!, \lstinline!IntegerType!, \lstinline!BooleanType!, \lstinline!StringType!, \lstinline!EnumType! +as mnemonics corresponding to machine representations. + \subsection{Real Type}\doublelabel{real-type} The following is the predefined \lstinline!Real! type: diff --git a/chapters/functions.tex b/chapters/functions.tex index 230af9634..cdab944de 100644 --- a/chapters/functions.tex +++ b/chapters/functions.tex @@ -890,7 +890,7 @@ \subsection{Scalar Functions Applied to Array Arguments}\doublelabel{scalar-func If the argument is not a foreach argument, it is used as-is. \item If the argument is a foreach argument, the element at index - {[}i,...,j{]} is used. + \lstinline[mathescape=true]![i, $\ldots$, j]! is used. \end{itemize} \end{enumerate} @@ -2517,13 +2517,14 @@ \subsubsection{Utility Functions for Allocating Strings}\doublelabel{utility-fun ModelicaAllocateString (e.g., to free this memory, when appropriate). It is not allowed to access memory that was allocated with \lstinline!ModelicaAllocateString! in a previous call of this external function. -{[}\emph{Memory that is not passed to the Modelica simulation -environment, such as memory that is freed before leaving the function, -or in an ExternalObject, see \autoref{external-objects}, should be allocated -with the standard C-mechanisms, like calloc(..)}{]}. \begin{nonnormative} -The reason why one may not use, for instance, \lstinline!malloc! for string allocation is that a Modelica simulation environment may have +Memory that is not passed to the Modelica simulation environment, such as memory that is freed before leaving the function, or in an \lstinline!ExternalObject!, +see~\autoref{external-objects}, should be allocated with the standard C-mechanisms, like \lstinline[language=C]!calloc(..)!. +\end{nonnormative} + +\begin{nonnormative} +The reason why one may not use, for instance, \lstinline[language=C]!malloc! for string allocation is that a Modelica simulation environment may have its own allocation scheme, e.g., a special stack for local variables of a function. \end{nonnormative}