From 69de9dcf770e648343ce466ed4f906b9d007be5c Mon Sep 17 00:00:00 2001 From: OLSSON Hans Date: Wed, 9 Sep 2020 12:07:13 +0200 Subject: [PATCH] Move non-normative motivation for package to start of chapter, and move up most definitions as discussed. --- chapters/packages.tex | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/chapters/packages.tex b/chapters/packages.tex index 37e2fe565..049c79c2c 100644 --- a/chapters/packages.tex +++ b/chapters/packages.tex @@ -1,13 +1,5 @@ \chapter{Packages}\label{packages} - -\section{Package as Specialized Class}\label{package-as-specialized-class} - -The package concept is a specialized class (\cref{specialized-classes}), using the -keyword \lstinline!package!. - -\section{Motivation and Usage of Packages}\label{motivation-and-usage-of-packages} - -\begin{nonnormative} +\label{motivation-and-usage-of-packages} Packages in Modelica may contain definitions of constants and classes including all kinds of specialized classes, functions, and subpackages. By the term subpackage we mean that the package is declared @@ -40,9 +32,12 @@ \section{Motivation and Usage of Packages}\label{motivation-and-usage-of-package standard mapping of package names to storage places, typically file or directory locations in the file system. \end{itemize} -\end{nonnormative} +\section{Package as Specialized Class}\label{package-as-specialized-class} + +The package concept is a specialized class (\cref{specialized-classes}), using the +keyword \lstinline!package!. -\subsection{Importing Definitions from a Package}\label{importing-definitions-from-a-package} +\section{Importing Definitions from a Package}\label{importing-definitions-from-a-package} The import-clause makes public classes and other public definitions declared in some package available for use by shorter names in a class @@ -85,7 +80,7 @@ \subsection{Importing Definitions from a Package}\label{importing-definitions-fr Here $\mathit{packagename}$ is the fully qualified name of the imported package including possible dot notation and $\mathit{definitionname}$ is the name of an element in a package. The multiple definition import is equivalent to multiple single definition imports with corresponding $\mathit{packagename}$ and definition names. -\subsubsection{Lookup of Imported Names}\label{lookup-of-imported-names} +\subsection{Lookup of Imported Names}\label{lookup-of-imported-names} This section only defines how the imported name is looked up in the import clause. For lookup in general -- including how import clauses are used -- see \cref{static-name-lookup}. @@ -114,7 +109,7 @@ \subsubsection{Lookup of Imported Names}\label{lookup-of-imported-names} \end{lstlisting} \end{nonnormative} -\subsubsection{Summary of Rules for Import Clauses}\label{summary-of-rules-for-import-clauses} +\subsection{Summary of Rules for Import Clauses}\label{summary-of-rules-for-import-clauses} The following rules apply to import-clauses: \begin{itemize} @@ -137,7 +132,7 @@ \subsubsection{Summary of Rules for Import Clauses}\label{summary-of-rules-for-i Multiple qualified import-clauses may not have the same import name. \end{itemize} -\subsection{Mapping Package/Class Structures to a Hierarchical File System}\label{mapping-package-class-structures-to-a-hierarchical-file-system} +\section{Mapping Package/Class Structures to a Hierarchical File System}\label{mapping-package-class-structures-to-a-hierarchical-file-system} Packages/classes may be represented in the hierarchical structure of the operating system (the file system). For classes with version @@ -162,7 +157,7 @@ \subsection{Mapping Package/Class Structures to a Hierarchical File System}\labe Tools may also store classes in data-base systems, but that is not standardized. \end{nonnormative} -\subsubsection{Mapping a Package/Class Hierarchy into a Directory Hierarchy (Structured Entity)}\label{mapping-a-package-class-hierarchy-into-a-directory-hierarchy-structured-entity} +\subsection{Mapping a Package/Class Hierarchy into a Directory Hierarchy (Structured Entity)}\label{mapping-a-package-class-hierarchy-into-a-directory-hierarchy-structured-entity} A directory shall contain a node, the file \filename{package.mo}. The node shall contain a stored-definition that defines a class \lstinline!A! with a name matching the name of the structured entity. @@ -195,7 +190,7 @@ \subsubsection{Mapping a Package/Class Hierarchy into a Directory Hierarchy (Str \filename{package.mo} (this ensures that the relative order between classes and constants stored in different ways is preserved). -\subsubsection{Mapping a Package/Class Hierarchy into a Single File (Nonstructured Entity)}\label{mapping-a-package-class-hierarchy-into-a-single-file-nonstructured-entity} +\subsection{Mapping a Package/Class Hierarchy into a Single File (Nonstructured Entity)}\label{mapping-a-package-class-hierarchy-into-a-single-file-nonstructured-entity} When mapping a package or class-hierarchy to a file (e.g.\ the file \filename{A.mo}), that file shall only define a single class \lstinline!A! with a name matching the name of the nonstructured entity. In a file hierarchy the files shall have the extension \filename{.mo}. @@ -204,7 +199,7 @@ \subsubsection{Mapping a Package/Class Hierarchy into a Single File (Nonstructur to file-structure and it is an error if it is loaded from the \lstinline!MODELICAPATH!. -\subsubsection{The within Clause}\label{the-within-clause} +\subsection{The within Clause}\label{the-within-clause} A within-clause has the following syntax: \begin{lstlisting}[language=grammar] @@ -230,7 +225,7 @@ \subsubsection{The within Clause}\label{the-within-clause} \end{lstlisting} \end{example} -\subsection{External resources}\label{external-resources} +\section{External resources}\label{external-resources} In order to reference external resources from documentation (such as links and images in html-text) and/or to reference images in the Bitmap @@ -285,7 +280,7 @@ \subsection{External resources}\label{external-resources} resource than \filename{modelica://Modelica/C.jpg}. \end{example} -\subsection{The Modelica Library Path -- MODELICAPATH}\label{the-modelica-library-path-modelicapath} +\section{The Modelica Library Path -- MODELICAPATH}\label{the-modelica-library-path-modelicapath} The top-level scope implicitly contains a number of classes stored externally. If a top-level name is not found at global scope, a Modelica @@ -314,7 +309,7 @@ \subsection{The Modelica Library Path -- MODELICAPATH}\label{the-modelica-librar fails without searching for \lstinline!A! in any of the remaining roots in \lstinline!MODELICAPATH!. \end{nonnormative} -\subsubsection{Example of Searching MODELICAPATH}\label{example-of-searching-modelicapath} +\subsection{Example of Searching MODELICAPATH}\label{example-of-searching-modelicapath} 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