Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Help function for OMShell

Help function for OMShell

(I dont know if this is the right place for an improvement suggestion? Is there a wishlist/roadmap for OpenModelica?)
I am new to OpeModelica and would like to suggest arguments for the "help" command, like in Matlab or Octave, for the OMShell.  This would also require an easy way to include help lines in a new model. In Matlab it works like this:

function test()
%This is the documentation for this user defined function.
%Further explanations

%This is not part of the documenation
message = "hello world"
end

>help test

> %This is the documentation for this user defined function.
>%Further explanations

Is there something similar in OpenModelica?

Edited by: stefaneidelloth - Jun-28-12 10:53:11

Re: Help function for OMShell

To define documentation in Modelica, set Documentation.info:

Code:

function fill "Returns an array with all elements equal"

  input OpenModelica.Internal.BuiltinType s;
  input Integer n annotation(__OpenModelica_varArgs=true);
  output OpenModelica.Internal.BuiltinType o[:];
  external "builtin";
  annotation(Documentation(info="<html>
  See <a href=\"modelica://ModelicaReference.Operators.'fill()'\">fill()</a>
</html>"));
end fill;

To query, use getDocumentationAnnotation():

Code:

[martin@mega trunk]$ /home/martin/trunk/build/bin/OMShell-terminal

OMShell Copyright 1997-2012, Open Source Modelica Consortium (OSMC)
Distributed under OMSC-PL and GPL, see www.openmodelica.org

To get help on using OMShell and OpenModelica, type "help()" and press enter
Started server using:omc +d=interactive > /tmp/omshell.log 2>&1 &
>>> getDocumentationAnnotation(fill)
{"<html>
  See <a href=\"modelica://ModelicaReference.Operators.'fill()'\">fill()</a>
</html>",""}
>>>

Re: Help function for OMShell

ok, thanks a lot.

There are 0 guests and 0 other users also viewing this topic
You are here: