Skip to content

Commit

Permalink
Sensible quoting.
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Aug 30, 2024
1 parent 8395967 commit 9ae02db
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions chapters/packages.tex
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ \section{The Modelica Library Path -- MODELICAPATH}\label{the-modelica-library-p
If during lookup a top-level name is not found in the unnamed top-level scope, the search continues in the package hierarchies stored in these directories.

\begin{example}
\Cref{fig:roots} below shows an example \lstinline!MODELICAPATH! = \filename{"C:\textbackslash{}library;C:\textbackslash{}lib1;C:\textbackslash{}lib2"}, with three directories containing the roots of the package hierarchies \lstinline!Modelica!, \lstinline!MyLib!, and \lstinline!ComplexNumbers!.
\Cref{fig:roots} below shows an example \lstinline!MODELICAPATH! = \filename{C:\textbackslash{}library;C:\textbackslash{}lib1;C:\textbackslash{}lib2}, with three directories containing the roots of the package hierarchies \lstinline!Modelica!, \lstinline!MyLib!, and \lstinline!ComplexNumbers!.
The first two are represented as the subdirectories \filename{C:\textbackslash{}library\textbackslash{}Modelica} and \filename{C:\textbackslash{}lib1\textbackslash{}MyLib}, whereas the third is stored as the file \filename{C:\textbackslash{}lib2\textbackslash{}ComplexNumbers.mo}.

\begin{figure}[H]
\begin{center}
\includegraphics{modelicapath}
\end{center}
\caption{Roots of package hierarchies, e.g., \lstinline!Modelica!, \lstinline!MyLib!, and \lstinline!ComplexNumbers! in
\lstinline!MODELICAPATH! = \filename{"C:\textbackslash{}library;C:\textbackslash{}lib1;C:\textbackslash{}lib2"}.}
\lstinline!MODELICAPATH! = \filename{C:\textbackslash{}library;C:\textbackslash{}lib1;C:\textbackslash{}lib2}.}
\label{fig:roots}
\end{figure}

Expand All @@ -171,6 +171,8 @@ \section{The Modelica Library Path -- MODELICAPATH}\label{the-modelica-library-p
This subdirectory must have a file \filename{package.mo} containing a definition of the package \lstinline!MyLib!, according to the Modelica rules on how to map a package hierarchy to the file system.
The subpackage \lstinline!Pack2! is stored in its own subdirectory or file in the subdirectory \filename{MyLib}.
In this case the search succeeds and the package \lstinline!MyLib.Pack2! is loaded into the environment.

Note that if you use the environment variable \lstinline!MODELICAPATH! in Modelica the value is a string which implies that it is quoted, i.e., \lstinline!"C:\\library;C:\\lib1;C:\\lib2"!.
\end{example}


Expand Down

0 comments on commit 9ae02db

Please sign in to comment.