Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
Add some example auto-completion information for use by OMEdit
Browse files Browse the repository at this point in the history
  • Loading branch information
atrosinenko authored and OpenModelica-Hudson committed Apr 2, 2019
1 parent a2024ab commit 1983c2f
Showing 1 changed file with 120 additions and 0 deletions.
120 changes: 120 additions & 0 deletions Compiler/FrontEnd/ModelicaBuiltin.mo
Expand Up @@ -4137,6 +4137,126 @@ package ReleaseNotes
end ReleaseNotes;
end UsersGuide;

package AutoCompletion "Auto completion information for OMEdit."
package Annotations "Auto completion information on annotations."
// Annotations for Documentation
record Documentation "Defines the documentation."
String info "The textual description of the class.";
String revisions "A list of revisions and other annotations defined by a tool.";
end Documentation;

String preferredView = "diagram" "Default view when selecting the class (<b>info</b>, <b>diagram</b> or <b>text</b>).";
Boolean DocumentationClass = true "Implies that this class and all classes within it are treated as having the annotation <b>preferredView=\"info\"</b>. If the annotation <b>preferredView</b> is explicitly set for a class, it has precedence over a <b>DocumentationClass</b> annotation.";

// Annotations for Code Generation
Boolean Evaluate = true "Defines if the value can be utilize for symbolic processing.";
Boolean HideResult = true "Proposes to not show the simulator results.";
Boolean Inline = true "Proposes to inline the function which means the body of the function is included at all places where the function is called.";
Boolean LateInline = true "Proposes to inline the function after all symbolic transformations have been performed.";
Boolean GenerateEvents = true "proposes that crossing functions in the function should generate events.";
Integer smoothOrder "Defines the number of differentiations of the function, in order that all of the differentiated outputs are continuous provided all input arguments and their derivatives up to order <b>smoothOrder</b> are continuous.";

// Annotations for Simulation Experiments
record experiment "Define default experiment parameters."
Real StartTime(unit = "s") = 0 "Default start time of simulation.";
Real StopTime(unit = "s") = 1 "Default stop time of simulation.";
Real Interval(unit = "s", min = 0) = 0.002 "Resolution for the result grid.";
Real Tolerance(min = 0) = 1e-6 "Default relative integration tolerance.";
end experiment;

// Annotation for single use of class
Boolean singleInstance = true "Indicates that there should only be one component instance of the class.";

// TODO: Annotations for Graphical Objects. Do we really need them? Don't think that users will prefer to write them manually.

// Annotations for the Graphical User Interface
String defaultComponentName "Recommended name when creating a component of the class.";
String defaultComponentPrefixes "Recommended prefixes when creating a component of the class.";
String missingInnerMessage "Specifies a message when an <b>outer</b> component of the class does not have a corresponding <b>inner</b> component.";
Boolean absoluteValue "If <b>false</b>, then the variable defines a relative quantity, and if <b>true</b> an absolute quantity.";
Boolean defaultConnectionStructurallyInconsistent "If <b>true</b>, it is stated that a default connection will result in a structurally inconsistent model or block.";
String obsolete "Indicates that the class ideally should not be used anymore and gives a message indicating the recommended action.";
String unassignedMessage "Defines a diagnostic message to use when a variable declaration cannot be computed due to the structure of the equations.";

record Dialog
parameter String tab = "General";
parameter String group = "Parameters";
parameter Boolean enable = true;
parameter Boolean showStartAttribute = false;
parameter Boolean colorSelector = false;
parameter Selector loadSelector;
parameter Selector saveSelector;
parameter String groupImage = "";
parameter Boolean connectorSizing = false;
end Dialog;

record Selector
parameter String filter = "";
parameter String caption = "";
end Selector;

// Annotations for Version Handling
String version "The version number of the released library.";
String versionDate "The date in UTC format (according to ISO 8601) when the library was released.";
Integer versionBuild "The optional build number of the library.";
String dateModified "The UTC date and time (according to ISO 8601) of the last modification of the package.";
String revisionId "A tool specific revision identifier possibly generated by a source code management system (e.g. Subversion or CVS).";

record uses "A list of dependent classes."
end uses;

// Annotations for Access Control to Protect Intellectual Property
type Access = enumeration(hide, icon, documentation, diagram, nonPackageText, nonPackageDuplicate, packageText, packageDuplicate);

record Protection "Protection of class"
Access access "Defines what parts of a class are visible.";
String features[:] = fill("", 0) "Required license features";
record License
String libraryKey;
String licenseFile = "" "Optional, default mapping if empty";
end License;
end Protection;

record Authorization
String licensor = "" "Optional string to show information about the licensor";
String libraryKey "Matching the key in the class. Must be encrypted and not visible";
License license[:] "Definition of the license options and of the access rights";
end Authorization;

record License
String licensee = "" "Optional string to show information about the licensee";
String id[:] "Unique machine identifications, e.g. MAC addresses";
String features[:] = fill("", 0) "Activated library license features";
String startDate = "" "Optional start date in UTCformat YYYY-MM-DD";
String expirationDate = "" "Optional expiration date in UTCformat YYYY-MM-DD";
String operations[:] = fill("",0) "Library usage conditions";
end License;

// TODO: Function Derivative Annotations

// Inverse Function Annotation
record inverse
end inverse;

// TODO: External Function Annotations

// Annotation Choices for Modifications and Redeclarations
record choices "Defines a suitable redeclaration or modifications of the element."
Boolean checkBox = true "Display a checkbox to input the values false or true in the graphical user interface.";
// TODO: how to handle choice?
end choices;

Boolean choicesAllMatching "Specify whether to construct an automatic list of choices menu or not.";

// TODO: Annotation for External Libraries and Include Files

annotation(
Documentation(info = "<html>In this package annotations are gathered in their record-like form together with meta information such as descriptions, units, min, max, etc.</html>"));
end Annotations;
annotation(
Documentation(info = "<html>In this package a machine-readable auto completion information is gathered for use by OMEdit.</html>"));
end AutoCompletion;

annotation(
Documentation(revisions="<html>See <a href=\"modelica://OpenModelica.UsersGuide.ReleaseNotes\">ReleaseNotes</a></html>",
__Dymola_DocumentationClass = true),
Expand Down

0 comments on commit 1983c2f

Please sign in to comment.