Skip to content

Commit

Permalink
- Added function cevalStringAppendList
Browse files Browse the repository at this point in the history
- Added a notebook for basic MetaModelica types


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7280 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Dec 3, 2010
1 parent 14310bf commit 74b3e9f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Compiler/Ceval.mo
Expand Up @@ -1092,6 +1092,7 @@ algorithm
case "stringInt" equation true = RTOpts.acceptMetaModelicaGrammar(); then cevalStringInt;
case "stringListStringChar" equation true = RTOpts.acceptMetaModelicaGrammar(); then cevalStringListStringChar;
case "listStringCharString" equation true = RTOpts.acceptMetaModelicaGrammar(); then cevalListStringCharString;
case "stringAppendList" equation true = RTOpts.acceptMetaModelicaGrammar(); then cevalStringAppendList;
case "listLength" equation true = RTOpts.acceptMetaModelicaGrammar(); then cevalListLength;
case "listAppend" equation true = RTOpts.acceptMetaModelicaGrammar(); then cevalListAppend;
// Box/Unbox
Expand Down Expand Up @@ -2837,6 +2838,41 @@ algorithm
end matchcontinue;
end cevalListStringCharString;

protected function cevalStringAppendList
input Env.Cache inCache;
input Env.Env inEnv;
input list<DAE.Exp> inExpExpLst;
input Boolean inBoolean;
input Option<Interactive.InteractiveSymbolTable> inInteractiveInteractiveSymbolTableOption;
input Msg inMsg;
output Env.Cache outCache;
output Values.Value outValue;
output Option<Interactive.InteractiveSymbolTable> outInteractiveInteractiveSymbolTableOption;
algorithm
(outCache,outValue,outInteractiveInteractiveSymbolTableOption):=
matchcontinue (inCache,inEnv,inExpExpLst,inBoolean,inInteractiveInteractiveSymbolTableOption,inMsg)
local
list<Env.Frame> env;
DAE.Exp exp;
Boolean impl;
Option<Interactive.InteractiveSymbolTable> st;
Msg msg;
Env.Cache cache;
String str;
Integer i;
Real r;
list<String> chList;
list<Values.Value> valList;
case (cache,env,{exp},impl,st,msg)
equation
(cache,Values.LIST(valList),st) = ceval(cache,env, exp, impl, st,NONE(), msg);
chList = Util.listMap(valList, ValuesUtil.extractValueString);
str = stringAppendList(chList);
then
(cache,Values.STRING(str),st);
end matchcontinue;
end cevalStringAppendList;

protected function cevalListLength
input Env.Cache inCache;
input Env.Env inEnv;
Expand Down
7 changes: 7 additions & 0 deletions Compiler/ValuesUtil.mo
Expand Up @@ -2395,4 +2395,11 @@ algorithm
end matchcontinue;
end valueDimensions;

public function extractValueString
input Values.Value val;
output String str;
algorithm
Values.STRING(str) := val;
end extractValueString;

end ValuesUtil;

0 comments on commit 74b3e9f

Please sign in to comment.