From 74b3e9fa0208828815a39e15c10ee0ae9da6ef0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Fri, 3 Dec 2010 15:32:54 +0000 Subject: [PATCH] - Added function cevalStringAppendList - Added a notebook for basic MetaModelica types git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7280 f25d12d1-65f4-0310-ae8a-bbce733d8d8e --- Compiler/Ceval.mo | 36 ++++++++++++++++++++++++++++++++++++ Compiler/ValuesUtil.mo | 7 +++++++ 2 files changed, 43 insertions(+) diff --git a/Compiler/Ceval.mo b/Compiler/Ceval.mo index 142aee1afa8..363125b2515 100644 --- a/Compiler/Ceval.mo +++ b/Compiler/Ceval.mo @@ -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 @@ -2837,6 +2838,41 @@ algorithm end matchcontinue; end cevalListStringCharString; +protected function cevalStringAppendList + input Env.Cache inCache; + input Env.Env inEnv; + input list inExpExpLst; + input Boolean inBoolean; + input Option inInteractiveInteractiveSymbolTableOption; + input Msg inMsg; + output Env.Cache outCache; + output Values.Value outValue; + output Option outInteractiveInteractiveSymbolTableOption; +algorithm + (outCache,outValue,outInteractiveInteractiveSymbolTableOption):= + matchcontinue (inCache,inEnv,inExpExpLst,inBoolean,inInteractiveInteractiveSymbolTableOption,inMsg) + local + list env; + DAE.Exp exp; + Boolean impl; + Option st; + Msg msg; + Env.Cache cache; + String str; + Integer i; + Real r; + list chList; + list 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; diff --git a/Compiler/ValuesUtil.mo b/Compiler/ValuesUtil.mo index 43fd2b0aed1..37fe12022f6 100644 --- a/Compiler/ValuesUtil.mo +++ b/Compiler/ValuesUtil.mo @@ -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;