From d0c1755df063901d0e81f6e37f01cd2f079ba90e Mon Sep 17 00:00:00 2001 From: OLSSON Hans Date: Tue, 26 Apr 2022 12:36:49 +0200 Subject: [PATCH 1/2] Enhancement to allow functions to return record values. See https://github.com/modelica/ModelicaSpecification/issues/3130#issuecomment-1073942425 Note that this should be fairly straightforward to implement. --- chapters/functions.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapters/functions.tex b/chapters/functions.tex index 039af5f98..f04087071 100644 --- a/chapters/functions.tex +++ b/chapters/functions.tex @@ -2229,8 +2229,8 @@ \subsubsection{Records}\label{records} Arrays cannot be mapped. \end{itemize} -Records are passed by reference (i.e.\ a pointer to the record is being -passed). +Records that are the return value of the C function are returned by value. +Other records are passed by reference (i.e.\ a pointer to the record is being passed). \begin{example} \begin{lstlisting}[language=modelica] From e5a8ee1e489fa3352c87d8ac39bde618ad2809eb Mon Sep 17 00:00:00 2001 From: OLSSON Hans Date: Tue, 26 Apr 2022 12:41:40 +0200 Subject: [PATCH 2/2] Clarify table as indicated in previous comment. --- chapters/functions.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chapters/functions.tex b/chapters/functions.tex index f04087071..4ea235c3b 100644 --- a/chapters/functions.tex +++ b/chapters/functions.tex @@ -2283,10 +2283,11 @@ \subsection{Return Type Mapping}\label{return-type-mapping} \lstinline!String! & \lstinline[language=C]!const char*! & \emph{Not allowed}\\ \lstinline!T[$\mathit{dim}_{1}$, $\ldots$, $\mathit{dim}_{n}$]! & \emph{Not allowed} & \emph{Not allowed} \\ Enumeration type & \lstinline[language=C]!int! & \lstinline[language=FORTRAN77]!INTEGER!\\ -Record & See \cref{records} & \emph{Not allowed}\\ +Record & \lstinline[language=C]!struct CRec! & \emph{Not allowed}\\ \hline \end{tabular} \end{center} +For the contents of \lstinline[language=C]!struct CRec! see \cref{records}. The element type \lstinline!T! of an array can be any simple type as defined in \cref{simple-types} or, for C, a record type is returned as a value of the record type defined in \cref{records}.