diff --git a/chapters/functions.tex b/chapters/functions.tex index 457fc5b99..892ab1ce7 100644 --- a/chapters/functions.tex +++ b/chapters/functions.tex @@ -243,8 +243,8 @@ \section{Pure Modelica Functions}\label{pure-modelica-functions} errors for the same input values and only the output values influence the simulation result, i.e.\ is seen as equivalent to a mathematical map from input values to output values. Some input values may map to - errors. Pure functions are thus allowed to fail by calling assert, or - ModelicaError in C-code, or dividing by zero. Such errors will only be + errors. Pure functions are thus allowed to fail by calling \lstinline!assert!, or + \lstinline[language=C]!ModelicaError! in C code, or dividing by zero. Such errors will only be reported when and if the function is called. \emph{Pure} Modelica functions are not assumed to be thread-safe. \item @@ -1712,7 +1712,7 @@ \section{External Function Interface}\label{external-function-interface} This is just as for any other function. The components in the protected part allow local variables for temporary storage to be declared. \end{nonnormative} -The \lstinline!language-specification! must currently be one of \lstinline!"builtin"!, \lstinline!"C"!, \lstinline!"C..."! (for one of the specific C-standards like C89, C99, and C11 -- specifying +The \lstinline!language-specification! must currently be one of \lstinline!"builtin"!, \lstinline!"C"!, \lstinline!"C..."! (for one of the specific C standards like C89, C99, and C11 -- specifying that it relies on the C standard library of that version) or \lstinline!"FORTRAN 77"!. Unless the external language is specified, it is assumed to be \lstinline!"C"!. \begin{nonnormative} @@ -1724,7 +1724,7 @@ \section{External Function Interface}\label{external-function-interface} \lstinline!"builtin"! functions is implementation-defined. \begin{nonnormative} -Typically, for functions from the standard C-library, the prototype of the function is provided but no library annotation. Currently, there are +Typically, for functions from the standard C library, the prototype of the function is provided but no library annotation. Currently, there are no other builtin functions defined in Modelica. \end{nonnormative} @@ -1802,7 +1802,7 @@ \subsubsection{Simple Types}\label{simple-types} is 0 it is treated as false in Modelica; otherwise as true. \begin{nonnormative} -It is recommended that the C-function should interpret any non-zero value as true. +It is recommended that the C function should interpret any non-zero value as true. \end{nonnormative} Arguments of simple types are by default mapped as follows for FORTRAN~77: @@ -1976,7 +1976,7 @@ \subsubsection{Arrays}\label{arrays-1} annotation(arrayLayout = "columnMajor"); end fie; \end{lstlisting} -This corresponds to the following C-prototype: +This corresponds to the following C prototype: \begin{lstlisting}[language=C] double fie(double *, size\_t, size\_t); \end{lstlisting} @@ -2250,9 +2250,9 @@ \subsection{Annotations for External Libraries and Include Files}\label{annotati package.mo // contains the Modelica code from above Resources Include // contains the include files - ExternalFunc1.h // C-header file - ExternalFunc2.h // C-header file - ExternalFunc3.c // C-source file + ExternalFunc1.h // C header file + ExternalFunc2.h // C header file + ExternalFunc3.c // C source file Library // contains the object libraries for different platforms win32 @@ -2271,7 +2271,7 @@ \subsection{Annotations for External Libraries and Include Files}\label{annotati Header file for the function in the dynamic link / shared library \filename{ExternalLib2} so that the desired functions are defined to be exported -for Microsoft VisualStudio and for GNU C-compiler (note, for Linux it is +for Microsoft VisualStudio and for GNU C compiler (note, for Linux it is recommended to use the compiler option \lstinline!-fPIC! to build shared libraries or object libraries that are later transformed to a shared library): @@ -2323,7 +2323,7 @@ \subsubsection{Input Parameters, Function Value}\label{input-parameters-function external; end foo; \end{lstlisting} -This corresponds to the following C-prototype: +This corresponds to the following C prototype: \begin{lstlisting}[language=C] double foo(double, int); \end{lstlisting} @@ -2353,7 +2353,7 @@ \subsubsection{Arbitrary Placement of Output Parameters, No External Function Va external "C" myfoo(x, u1, y, u2); end foo; \end{lstlisting} -This corresponds to the following C-prototype: +This corresponds to the following C prototype: \begin{lstlisting}[language=C] void myfoo(double, double *, int, int *); \end{lstlisting} @@ -2382,7 +2382,7 @@ \subsubsection{External Function with Both Function Value and Output Variable}\l external "C" funcvalue = myfoo(x, y, out1); end foo; \end{lstlisting} -This corresponds to the following C-prototype: +This corresponds to the following C prototype: \begin{lstlisting}[language=C] double myfoo(double, int, int *); \end{lstlisting} @@ -2494,7 +2494,7 @@ \subsubsection{Utility Functions for Allocating Strings}\label{utility-functions \begin{nonnormative} 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~\cref{external-objects}, should be allocated with the standard C-mechanisms, like \lstinline[language=C]!calloc!. +see~\cref{external-objects}, should be allocated with the standard C mechanisms, like \lstinline[language=C]!calloc!. \end{nonnormative} \begin{nonnormative} @@ -2556,7 +2556,7 @@ \subsection{External Objects}\label{external-objects} \item External functions may be defined which operate on the internal memory of an \lstinline!ExternalObject!. An \lstinline!ExternalObject! used as input argument or - return value of an external C-function is mapped to the C-type + return value of an external C function is mapped to the C type \lstinline!void*!. \end{itemize} @@ -2599,7 +2599,7 @@ \subsection{External Objects}\label{external-objects} external "C" y = interpolateMyTable(table, u); end interpolateTable; \end{lstlisting} -The external C-functions may be defined in the following way: +The external C functions may be defined in the following way: \begin{lstlisting}[language=C] typedef struct { /* User-defined datastructure of the table */ double* array; /* nrow*ncolumn vector */ diff --git a/chapters/operatorsandexpressions.tex b/chapters/operatorsandexpressions.tex index 91a75cc71..3f7c69bb6 100644 --- a/chapters/operatorsandexpressions.tex +++ b/chapters/operatorsandexpressions.tex @@ -240,9 +240,9 @@ \section{Equality, Relational, and Logical Operators}\label{equality-relational- scalar operands of simple types. The result is \lstinline!Boolean! and is true or false if the relation is fulfilled or not, respectively. \item - For operands of type \lstinline!String!, \lstinline!str1 op str2! is for each relational - operator, \lstinline!op!, defined in terms of the C-function \lstinline!strcmp! as - \lstinline!strcmp(str1,str2) op 0!. + For operands of type \lstinline!String!, \lstinline!str1 $\mathit{op}$ str2! is for each relational + operator, $\mathit{op}$, defined in terms of the C function \lstinline[language=C]!strcmp! as + \lstinline[language=C]!strcmp(str1, str2) $\mathit{op}$ 0!. \item For operands of type \lstinline!Boolean!, \lstinline!false < true!. \item diff --git a/chapters/revisions.tex b/chapters/revisions.tex index 7dd58fee6..bd24cd5d4 100644 --- a/chapters/revisions.tex +++ b/chapters/revisions.tex @@ -1203,7 +1203,7 @@ \subsection{Main changes in Modelica 3.2}\label{main-changes-in-modelica-3-2} Global name lookup has been introduced (e.g. \lstinline!.Modelica.Constants.pi!), see \cref{global-name-lookup}. \item - New C-functions \lstinline!ModelicaVFormatMessage! and \lstinline!ModelicaVFormatError!, to + New C functions \lstinline!ModelicaVFormatMessage! and \lstinline!ModelicaVFormatError!, to simplify message formatting in external functions (see \cref{utility-functions}) \item Additional annotations allowing: @@ -2231,7 +2231,7 @@ \subsection{Main Changes in Modelica 2.0}\label{main-changes-in-modelica-2-0} and default arguments make the same function fit for beginners and expert users. \item - Additional utilities for external C-functions that are interfaced to + Additional utilities for external C functions that are interfaced to Modelica models, especially supporting external functions returning strings and external functions with internal memory (e.g., to interface user-defined tables, property databases, sparse matrix