Skip to content

Commit

Permalink
- Moved setClassComment to ModelicaBuiltin.mo
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10197 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 21, 2011
1 parent cb6673e commit 0d7e17a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
7 changes: 7 additions & 0 deletions Compiler/FrontEnd/ModelicaBuiltin.mo
Expand Up @@ -1335,6 +1335,13 @@ function setSourceFile
external "builtin";
end setSourceFile;

function setClassComment
input TypeName class_;
input String filename;
output Boolean success;
external "builtin";
end setClassComment;

function getClassNames
input TypeName class_ := $TypeName(AllLoadedClasses);
output TypeName classNames[:];
Expand Down
7 changes: 7 additions & 0 deletions Compiler/Script/CevalScript.mo
Expand Up @@ -818,6 +818,13 @@ algorithm
then
(cache,Values.BOOL(b),st);

case (cache,env,"setClassComment",{Values.CODE(Absyn.C_TYPENAME(path)),Values.STRING(str)},st as Interactive.SYMBOLTABLE(ast=p),msg)
equation
(p,b) = Interactive.setClassComment(path, str, p);
st = Interactive.setSymbolTableAST(st, p);
then
(cache,Values.BOOL(b),st);

case (cache,env,"getClassNames",{Values.CODE(Absyn.C_TYPENAME(Absyn.IDENT("AllLoadedClasses")))},st as Interactive.SYMBOLTABLE(ast = p),msg)
equation
paths = Interactive.getTopClassnames(p);
Expand Down
25 changes: 7 additions & 18 deletions Compiler/Script/Interactive.mo
Expand Up @@ -2094,16 +2094,6 @@ algorithm
then
("error",st);

case (istmts, st as SYMBOLTABLE(ast = p))
equation
matchApiFunction(istmts, "setClassComment");
{Absyn.CREF(componentRef = class_),Absyn.STRING(value = str)} =
getApiFunctionArgs(istmts);
(p_1,resstr) = setClassComment(class_, str, p);
st = setSymbolTableAST(st, p_1);
then
(resstr, st);

case (istmts, st as SYMBOLTABLE(ast = p))
equation
matchApiFunction(istmts, "getClassRestriction");
Expand Down Expand Up @@ -8070,17 +8060,17 @@ algorithm
end matchcontinue;
end deleteClassFromList;

protected function setClassComment
public function setClassComment
"function: setClassComment
author: PA
Sets the class comment."
input Absyn.ComponentRef inComponentRef;
input Absyn.Path path;
input String inString;
input Absyn.Program inProgram;
output Absyn.Program outProgram;
output String outString;
output Boolean success;
algorithm
(outProgram,outString) := matchcontinue (inComponentRef,inString,inProgram)
(outProgram,success) := matchcontinue (path,inString,inProgram)
local
Absyn.Path p_class;
Absyn.Within within_;
Expand All @@ -8090,17 +8080,16 @@ algorithm
String str;
Absyn.TimeStamp ts;

case (class_,str,p as Absyn.PROGRAM(globalBuildTimes=ts))
case (p_class,str,p as Absyn.PROGRAM(globalBuildTimes=ts))
equation
p_class = Absyn.crefToPath(class_);
within_ = buildWithin(p_class);
cdef = getPathedClassInProgram(p_class, p);
cdef_1 = setClassCommentInClass(cdef, str);
newp = updateProgram(Absyn.PROGRAM({cdef_1},within_,ts), p);
then
(newp,"Ok");
(newp,true);

case (_,_,p) then (p,"Error");
case (_,_,p) then (p,false);
end matchcontinue;
end setClassComment;

Expand Down

0 comments on commit 0d7e17a

Please sign in to comment.