Skip to content

Commit

Permalink
Write T' as math to avoid syntax highlighting confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Dec 28, 2020
1 parent fca9d96 commit fcf57ee
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions chapters/functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1768,10 +1768,7 @@ \subsubsection{Arrays}\label{arrays-1}
Arrays are by default stored in row-major order when calling C functions and in column-major order when calling FORTRAN~77 functions. These defaults can be overridden by the \lstinline!arrayLayout! annotation. See the example below.

The table below shows the mapping of an array argument in the absence of an explicit external function call when calling a C function.
The type \lstinline!T! is allowed to be any of the simple types which can be passed to C as
defined in \cref{simple-types} or a record type as defined in
\cref{records} and it is mapped to the type \lstinline!T'! as defined in these sections
for input arguments.
The type \lstinline!T! is allowed to be any of the simple types which can be passed to C as defined in \cref{simple-types} or a record type as defined in \cref{records} and it is mapped to the type $T'$ as defined in these sections for input arguments.
Array inputs to C-functions are const-pointers, indicating that the arrays shall not be changed.

\begin{center}
Expand All @@ -1782,28 +1779,24 @@ \subsubsection{Arrays}\label{arrays-1}
\hline
\hline
\lstinline!T[$\mathit{dim}_{1}$]! &
\lstinline[language=C]!const T' *, size_t $\mathit{dim}_{1}$! &
\lstinline[language=C]!T' *, size_t $\mathit{dim}_{1}$!
\lstinline[language=C]!const $T'$ *, size_t $\mathit{dim}_{1}$! &
\lstinline[language=C]!$T'$ *, size_t $\mathit{dim}_{1}$!
\\
\lstinline!T[$\mathit{dim}_{1}$, $\mathit{dim}_{2}$]! &
\lstinline[language=C]!const T' *, size_t $\mathit{dim}_{1}$, size_t $\mathit{dim}_{2}$! &
\lstinline[language=C]!T' *, size_t $\mathit{dim}_{1}$, size_t $\mathit{dim}_{2}$!
\lstinline[language=C]!const $T'$ *, size_t $\mathit{dim}_{1}$, size_t $\mathit{dim}_{2}$! &
\lstinline[language=C]!$T'$ *, size_t $\mathit{dim}_{1}$, size_t $\mathit{dim}_{2}$!
\\
\lstinline!T[$\ldots$, $\mathit{dim}_{n}$]! &
\lstinline[language=C]!const T' *, $\ldots$, size_t $\mathit{dim}_{n}$! &
\lstinline[language=C]!T' *, $\ldots$, size_t $\mathit{dim}_{n}$!
\lstinline[language=C]!const $T'$ *, $\ldots$, size_t $\mathit{dim}_{n}$! &
\lstinline[language=C]!$T'$ *, $\ldots$, size_t $\mathit{dim}_{n}$!
\\
\hline
\end{tabular}
\end{center}

The method used to pass array arguments to FORTRAN~77 functions in the
absence of an explicit external function call is similar to the one
defined above for C: first the address of the array, then the dimension
sizes as integers. See the table below. The type T is allowed to be any
of the simple types which can be passed to FORTRAN~77 as defined in
\cref{simple-types} and it is mapped to the type T' as defined in that
section.
The method used to pass array arguments to FORTRAN~77 functions in the absence of an explicit external function call is similar to the one defined above for C: first the address of the array, then the dimension sizes as integers.
See the table below.
The type T is allowed to be any of the simple types which can be passed to FORTRAN~77 as defined in \cref{simple-types} and it is mapped to the type $T'$ as defined in that section.

\begin{center}
\begin{tabular}{l|l}
Expand All @@ -1813,13 +1806,13 @@ \subsubsection{Arrays}\label{arrays-1}
\hline
\hline
\lstinline!T[$\mathit{dim}_{1}$]! &
\lstinline[language=FORTRAN77]!T', INTEGER $\mathit{dim}_{1}$!
\lstinline[language=FORTRAN77]!$T'$, INTEGER $\mathit{dim}_{1}$!
\\
\lstinline!T[$\mathit{dim}_{1}$, $\mathit{dim}_{2}$]! &
\lstinline[language=FORTRAN77]!T', INTEGER $\mathit{dim}_{1}$, INTEGER $\mathit{dim}_{2}$!
\lstinline[language=FORTRAN77]!$T'$, INTEGER $\mathit{dim}_{1}$, INTEGER $\mathit{dim}_{2}$!
\\
\lstinline!T[$\mathit{dim}_{1}$, $\ldots$, $\mathit{dim}_{n}$]! &
\lstinline[language=FORTRAN77]!T', INTEGER $\mathit{dim}_{1}$, $\ldots$, INTEGER $\mathit{dim}_{n}$!
\lstinline[language=FORTRAN77]!$T'$, INTEGER $\mathit{dim}_{1}$, $\ldots$, INTEGER $\mathit{dim}_{n}$!
\\
\hline
\end{tabular}
Expand Down

0 comments on commit fcf57ee

Please sign in to comment.