From 24321feed45afb55bef5128f40bbd9feefe26dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Sat, 17 Dec 2011 14:26:38 +0000 Subject: [PATCH] - loadModel() documentation git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10753 f25d12d1-65f4-0310-ae8a-bbce733d8d8e --- Compiler/FrontEnd/ModelicaBuiltin.mo | 47 ++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/Compiler/FrontEnd/ModelicaBuiltin.mo b/Compiler/FrontEnd/ModelicaBuiltin.mo index 72a3334a639..14ec7ef2ad1 100644 --- a/Compiler/FrontEnd/ModelicaBuiltin.mo +++ b/Compiler/FrontEnd/ModelicaBuiltin.mo @@ -1061,13 +1061,19 @@ function setModelicaPath "The Modelica Library Path - MODELICAPATH in the langua input String modelicaPath; output Boolean success; external "builtin"; -annotation(preferredView="text"); +annotation(Documentation(info=" +See loadModel() for a description of what the MODELICAPATH is used for. +"), + preferredView="text"); end setModelicaPath; -function getModelicaPath "The Modelica Library Path - MODELICAPATH in the language specification; OPENMODELICALIBRARY in OpenModelica." +function getModelicaPath "Get the Modelica Library Path" output String modelicaPath; external "builtin"; -annotation(preferredView="text"); +annotation(Documentation(info=" +See loadModel() for a description of what the MODELICAPATH is used for. +"), + preferredView="text"); end getModelicaPath; function setCompilerFlags @@ -1491,17 +1497,38 @@ external "builtin"; annotation(preferredView="text"); end generateCode; -function loadModel "Parses the getModelicaPath(), and finds the package to load. -If the input is Modelica.XXX, the complete Modelica AST is loaded. - -Default priority is: no version name > highest main release > highest pre-release > lexical sort of others. -If none of the searched versions exist, false is returned and an error is added to the buffer. -" +function loadModel "Loads a Modelica library" input TypeName className; input String[:] priorityVersion := {"default"}; output Boolean success; external "builtin"; -annotation(preferredView="text"); +annotation(Documentation(info=" +Loads a Modelica library. +

Syntax

+
+
loadModel(Modelica)
// loads MSL +
loadModel(Modelica,{\"3.2\"})
// loads MSL 3.2 +
+

Description

+

loadModel() begins by parsing the getModelicaPath(), and looking for candidate packages to load in the given paths (separated by : or ; depending on OS).

+

The candidate is selected by choosing the one with the highest priority, chosen by looking through the priorityVersion argument to the function. +If the version searched for is \"default\", the following special priority is used: no version name > highest main release > highest pre-release > lexical sort of others (see table below for examples). +If none of the searched versions exist, false is returned and an error is added to the buffer.

+

A top-level package may either be defined in a file (\"Modelica 3.2.mo\") or directory (\"Modelica 3.2/package.mo\")

+ + + + + + + +
PriorityExample
No version nameModelica
Main releaseModelica 3.3
Pre-releaseModelica 3.3 Beta 1
Non-orderedModelica Trunk
+ +

Bugs

+

If loadModel(Modelica.XXX), loadModel(Modelica) is called, loading the complete library.

+

There is a special exception that prefers Modelica 3.1 over any other MSL version since this is the preferred version for OpenModelica.

+"), +preferredView="text"); end loadModel; function deleteFile "Deletes a file with the given name"