diff --git a/Compiler/Absyn.mo b/Compiler/Absyn.mo index 38a7ca326ac..a23e01da64d 100644 --- a/Compiler/Absyn.mo +++ b/Compiler/Absyn.mo @@ -2270,11 +2270,11 @@ algorithm String id, id2; case (FULLYQUALIFIED(p), p2) then pathPrefixOf(p, p2); case (p, FULLYQUALIFIED(p2)) then pathPrefixOf(p, p2); - case (IDENT(id), IDENT(id2)) then stringEqual(id, id2); - case (IDENT(id), QUALIFIED(name = id2)) then stringEqual(id, id2); + case (IDENT(id), IDENT(id2)) then stringEq(id, id2); + case (IDENT(id), QUALIFIED(name = id2)) then stringEq(id, id2); case (QUALIFIED(id, p), QUALIFIED(id2, p2)) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); true = pathPrefixOf(p, p2); then true; @@ -2316,13 +2316,13 @@ algorithm // qual case (QUALIFIED(name=id1,path=p),QUALIFIED(name=id2,path=p2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then removePrefix(p,p2); // ids case(IDENT(id1),QUALIFIED(name=id2,path=p2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then p2; end matchcontinue; end removePrefix; @@ -2351,18 +2351,18 @@ algorithm // qual case(CREF_QUAL(name = prefixIdent, componentRef = prefixRestCr), CREF_QUAL(name = ident, componentRef = restCr)) equation - true = stringEqual(prefixIdent, ident); + true = stringEq(prefixIdent, ident); then crefRemovePrefix(prefixRestCr, restCr); // id vs. qual case(CREF_IDENT(name = prefixIdent), CREF_QUAL(name = ident, componentRef = restCr)) equation - true = stringEqual(prefixIdent, ident); + true = stringEq(prefixIdent, ident); then restCr; // id vs. id case(CREF_IDENT(name = prefixIdent), CREF_IDENT(name = ident)) equation - true = stringEqual(prefixIdent, ident); + true = stringEq(prefixIdent, ident); then CREF_IDENT("", {}); end matchcontinue; end crefRemovePrefix; @@ -2378,10 +2378,10 @@ algorithm b := matchcontinue(p1,p2) Path qp; Boolean b1,b2; case(IDENT(str1),IDENT(str2)) - then stringEqual(str1,str2); + then stringEq(str1,str2); case(QUALIFIED(str1,qp),(p2 as IDENT(str2))) equation - b1 = stringEqual(str1,str2); + b1 = stringEq(str1,str2); b2 = pathContains(qp,p2); b1 = boolOr(b1,b2); then @@ -3635,13 +3635,13 @@ algorithm list ss1,ss2; case (CREF_IDENT(name = id,subscripts=ss1),CREF_IDENT(name = id2,subscripts = ss2)) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); true = subscriptsEqual(ss1,ss2); then true; case (CREF_QUAL(name = id,subScripts = ss1, componentRef = cr1),CREF_QUAL(name = id2,subScripts = ss2, componentRef = cr2)) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); true = subscriptsEqual(ss1,ss2); true = crefEqual(cr1, cr2); then @@ -3684,12 +3684,12 @@ algorithm Ident id,id2; case (CREF_IDENT(name = id),CREF_IDENT(name = id2)) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); then true; case (CREF_QUAL(name = id,componentRef = cr1),CREF_QUAL(name = id2,componentRef = cr2)) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); true = crefEqualNoSubs(cr1, cr2); then true; @@ -3767,7 +3767,7 @@ algorithm then crefEqual(cr1,cr2); case(STRING(s1),STRING(s2)) local String s1,s2; - then stringEqual(s1,s2); + then stringEq(s1,s2); case (BOOL(b1),BOOL(b2)) local Boolean b1,b2; then Util.boolEqual(b1,b2); @@ -4015,7 +4015,7 @@ algorithm case (id,{}) then false; case (id,(id1,_)::rest) equation - true = stringEqual(id, id1); + true = stringEq(id, id1); then true; case (id,(id1,_)::rest) equation @@ -4132,7 +4132,7 @@ algorithm case (_,{}) then (false,{}); case (id,(id_1,_)::_) equation - true = stringEqual(id, id_1); + true = stringEq(id, id_1); then (true,{}); case (id,(_,NONE())::rest) @@ -4305,7 +4305,7 @@ algorithm case (_,{},_) then {}; case (id,SUBSCRIPT(CREF(CREF_IDENT(name,{})))::rest,n) equation - true = stringEqual(id, name); + true = stringEq(id, name); n_1=n+1; lst=findIteratorInSubscripts(id,rest,n_1); then n::lst; @@ -4453,7 +4453,7 @@ algorithm Path p1,p2; case (NAMED_IMPORT(name = id,path=p1),NAMED_IMPORT(name = id2,path=p2)) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); true = ModUtil.pathEqual(p1,p2); then true; diff --git a/Compiler/AbsynDep.mo b/Compiler/AbsynDep.mo index b58ca369a61..5992f961dc6 100644 --- a/Compiler/AbsynDep.mo +++ b/Compiler/AbsynDep.mo @@ -349,7 +349,7 @@ algorithm /* Insert to right */ case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),height=h,left = left,right = (right)),key,value) equation - true = System.strcmp(Absyn.pathString(key),Absyn.pathString(rkey)) > 0; + true = stringCompare(Absyn.pathString(key),Absyn.pathString(rkey)) > 0; t = createEmptyAvlIfNone(right); t_1 = avlTreeAdd(t, key, value); bt = balance(AVLTREENODE(SOME(AVLTREEVALUE(rkey,rval)),h,left,SOME(t_1))); @@ -359,7 +359,7 @@ algorithm /* Insert to left subtree */ case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),height=h,left = left ,right = right),key,value) equation - /*true = System.strcmp(key,rkey) < 0;*/ + /*true = stringCompare(key,rkey) < 0;*/ t = createEmptyAvlIfNone(left); t_1 = avlTreeAdd(t, key, value); bt = balance(AVLTREENODE(SOME(AVLTREEVALUE(rkey,rval)),h,SOME(t_1),right)); @@ -620,7 +620,7 @@ algorithm case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),left = left,right = SOME(right)),key) local AvlTree right; equation - true = System.strcmp(Absyn.pathString(key),Absyn.pathString(rkey)) > 0; + true = stringCompare(Absyn.pathString(key),Absyn.pathString(rkey)) > 0; res = avlTreeGet(right, key); then res; @@ -629,7 +629,7 @@ algorithm case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),left = SOME(left),right = right),key) local AvlTree left; equation - /*true = System.strcmp(key,rkey) < 0;*/ + /*true = stringCompare(key,rkey) < 0;*/ res = avlTreeGet(left, key); then res; diff --git a/Compiler/Algorithm.mo b/Compiler/Algorithm.mo index 4be070325b7..5cf77066614 100644 --- a/Compiler/Algorithm.mo +++ b/Compiler/Algorithm.mo @@ -345,7 +345,7 @@ algorithm DAE.C_CONST() = Util.listReduce(bvals, Types.constOr); sl = Util.listMap(lhs, ExpressionDump.printExpStr); s = Util.stringDelimitList(sl, ", "); - lhs_str = System.stringAppendList({"(",s,")"}); + lhs_str = stringAppendList({"(",s,")"}); rhs_str = ExpressionDump.printExpStr(rhs); Error.addSourceMessage(Error.ASSIGN_CONSTANT_ERROR, {lhs_str,rhs_str}, DAEUtil.getElementSourceFileInfo(source)); then @@ -356,7 +356,7 @@ algorithm DAE.C_PARAM() = Util.listReduce(bvals, Types.constOr); sl = Util.listMap(lhs, ExpressionDump.printExpStr); s = Util.stringDelimitList(sl, ", "); - lhs_str = System.stringAppendList({"(",s,")"}); + lhs_str = stringAppendList({"(",s,")"}); rhs_str = ExpressionDump.printExpStr(rhs); Error.addSourceMessage(Error.ASSIGN_PARAM_ERROR, {lhs_str,rhs_str}, DAEUtil.getElementSourceFileInfo(source)); then @@ -387,7 +387,7 @@ algorithm true = RTOpts.debugFlag("failtrace"); sl = Util.listMap(lhs, ExpressionDump.printExpStr); s = Util.stringDelimitList(sl, ", "); - lhs_str = System.stringAppendList({"(",s,")"}); + lhs_str = stringAppendList({"(",s,")"}); rhs_str = ExpressionDump.printExpStr(rhs); str1 = Util.stringDelimitList(Util.listMap(lprop, Types.printPropStr), ", "); str2 = Types.printPropStr(rprop); diff --git a/Compiler/BackendDAEUtil.mo b/Compiler/BackendDAEUtil.mo index 7afa00e3d6e..408bee90485 100644 --- a/Compiler/BackendDAEUtil.mo +++ b/Compiler/BackendDAEUtil.mo @@ -112,7 +112,7 @@ algorithm strcrefs = Util.listMap(crefs,ComponentReference.crefStr); crefstring = Util.stringDelimitList(strcrefs,", "); expstr = ExpressionDump.printExpStr(e); - scopestr = System.stringAppendList({crefstring," from Expression: ",expstr}); + scopestr = stringAppendList({crefstring," from Expression: ",expstr}); Error.addMessage(Error.LOOKUP_VARIABLE_ERROR, {scopestr,"BackendDAE object"}); printcheckBackendDAEWithErrorMsg(res); then @@ -2414,14 +2414,14 @@ algorithm case (BackendDAE.TREENODE(value = SOME(BackendDAE.TREEVALUE(rkey,rval)),leftSubTree = left,rightSubTree = right),keystr) equation rkeystr = ComponentReference.printComponentRefStr(rkey); - 0 = System.strcmp(rkeystr, keystr); + 0 = stringCompare(rkeystr, keystr); then rval; case (BackendDAE.TREENODE(value = SOME(BackendDAE.TREEVALUE(rkey,rval)),leftSubTree = left,rightSubTree = SOME(right)),keystr) local BackendDAE.BinTree right; equation rkeystr = ComponentReference.printComponentRefStr(rkey) "Search to the right" ; - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = true; res = treeGet2(right, keystr); then @@ -2430,7 +2430,7 @@ algorithm local BackendDAE.BinTree left; equation rkeystr = ComponentReference.printComponentRefStr(rkey) "Search to the left" ; - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = false; res = treeGet2(left, keystr); then @@ -2490,14 +2490,14 @@ algorithm equation rkeystr = ComponentReference.printComponentRefStr(rkey) "Replace this node" ; keystr = ComponentReference.printComponentRefStr(key); - 0 = System.strcmp(rkeystr, keystr); + 0 = stringCompare(rkeystr, keystr); then BackendDAE.TREENODE(SOME(BackendDAE.TREEVALUE(rkey,value)),left,right); case (BackendDAE.TREENODE(value = SOME(BackendDAE.TREEVALUE(rkey,rval)),leftSubTree = left,rightSubTree = (right as SOME(t))),key,value) equation keystr = ComponentReference.printComponentRefStr(key) "Insert to right subtree"; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = true; t_1 = treeAdd(t, key, value); then @@ -2506,7 +2506,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Insert to right node"; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = true; right_1 = treeAdd(BackendDAE.TREENODE(NONE(),NONE(),NONE()), key, value); then @@ -2515,7 +2515,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Insert to left subtree"; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = false; t_1 = treeAdd(t, key, value); then @@ -2524,7 +2524,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Insert to left node"; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = false; left_1 = treeAdd(BackendDAE.TREENODE(NONE(),NONE(),NONE()), key, value); then @@ -2561,7 +2561,7 @@ algorithm equation rkeystr = ComponentReference.printComponentRefStr(rkey) "delete this node, when existing right node" ; keystr = ComponentReference.printComponentRefStr(key); - 0 = System.strcmp(rkeystr, keystr); + 0 = stringCompare(rkeystr, keystr); (rightmost,right_1) = treeDeleteRightmostValue(right); optright_1 = treePruneEmptyNodes(right_1); then @@ -2570,14 +2570,14 @@ algorithm equation rkeystr = ComponentReference.printComponentRefStr(rkey) "delete this node, when no right node, but left node" ; keystr = ComponentReference.printComponentRefStr(key); - 0 = System.strcmp(rkeystr, keystr); + 0 = stringCompare(rkeystr, keystr); then BackendDAE.TREENODE(leftval,lleft,lright); case (BackendDAE.TREENODE(value = SOME(BackendDAE.TREEVALUE(rkey,rval)),leftSubTree = NONE(),rightSubTree = NONE()),key) equation rkeystr = ComponentReference.printComponentRefStr(rkey) "delete this node, when no left or right node" ; keystr = ComponentReference.printComponentRefStr(key); - 0 = System.strcmp(rkeystr, keystr); + 0 = stringCompare(rkeystr, keystr); then BackendDAE.TREENODE(NONE(),NONE(),NONE()); case (BackendDAE.TREENODE(value = SOME(BackendDAE.TREEVALUE(rkey,rval)),leftSubTree = left,rightSubTree = (right as SOME(t))),key) @@ -2585,7 +2585,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "delete in right subtree" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = true; t_1 = treeDelete(t, key); topt_1 = treePruneEmptyNodes(t_1); @@ -2596,7 +2596,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "delete in left subtree" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = false; t_1 = treeDelete(t, key); topt_1 = treePruneEmptyNodes(t_1); diff --git a/Compiler/BackendVariable.mo b/Compiler/BackendVariable.mo index eb745a973f7..8596dbc44d9 100644 --- a/Compiler/BackendVariable.mo +++ b/Compiler/BackendVariable.mo @@ -2429,7 +2429,7 @@ algorithm hashvec_1 = arrayUpdate(hashvec, indx + 1, (BackendDAE.CREFINDEX(cr,newpos) :: indexes)); n_1 = vararrayLength(varr_1); name_str = ComponentReference.printComponentRefStr(cr); - hvalold = System.hash(name_str); + hvalold = stringHashDjb2(name_str); indxold = intMod(hvalold, bsize); indexexold = oldhashvec[indxold + 1]; oldhashvec_1 = arrayUpdate(oldhashvec, indxold + 1, diff --git a/Compiler/Builtin.mo b/Compiler/Builtin.mo index fecd8de2cf1..474117f7da4 100644 --- a/Compiler/Builtin.mo +++ b/Compiler/Builtin.mo @@ -2991,8 +2991,11 @@ algorithm env = Env.extendFrameT(env, "stringGetStringChar", stringInt2string); env = Env.extendFrameT(env, "stringAppend", stringString2string); env = Env.extendFrameT(env, "stringUpdateStringChar", stringStringInteger2string); - env = Env.extendFrameT(env, "stringEqual", stringString2boolean); + env = Env.extendFrameT(env, "stringEq", stringString2boolean); env = Env.extendFrameT(env, "stringCompare", stringString2int); + env = Env.extendFrameT(env, "stringHash", string2int); + env = Env.extendFrameT(env, "stringHashDjb2", string2int); + env = Env.extendFrameT(env, "stringHashSdbm", string2int); // List Operations env = Env.extendFrameT(env, "listAppend", listAListA2listA); @@ -3031,6 +3034,8 @@ algorithm env = Env.extendFrameT(env, "getGlobalRoot", int2boxed); env = Env.extendFrameT(env, "setGlobalRoot", intBoxedNoRetcall); env = Env.extendFrameT(env, "valueConstructor", boxed2int); + env = Env.extendFrameT(env, "valueSlots", boxed2int); + env = Env.extendFrameT(env, "valueEq", AA2bool); then env; case env then env; end matchcontinue; diff --git a/Compiler/Ceval.mo b/Compiler/Ceval.mo index e0324f26dd4..fa7461b5e08 100644 --- a/Compiler/Ceval.mo +++ b/Compiler/Ceval.mo @@ -304,7 +304,7 @@ algorithm // Call functions FIXME: functions are always generated. Put back the check // and write another rule for the false case that generates the function equation - false = stringEqual("Connection.isRoot", Absyn.pathString(funcpath)); + false = stringEq("Connection.isRoot", Absyn.pathString(funcpath)); // do not roll back errors generated by evaluating the arguments (cache,vallst) = cevalList(cache,env, expl, impl, st, msg); // do not handle Connection.isRoot here! @@ -1386,7 +1386,7 @@ algorithm (_,SCode.CLASS(restriction=SCode.R_FUNCTION(),info=Absyn.INFO(fileName = fNew)),_) = Lookup.lookupClass(cache, env, funcpath, true); // see if the build time from the class is the same as the build time from the compiled functions list - false = stringEqual(fNew,""); // see if the WE have a file or not! + false = stringEq(fNew,""); // see if the WE have a file or not! false = Static.needToRebuild(fNew,fOld,buildTime); // we don't need to rebuild! funcstr = ModUtil.pathStringReplaceDot(funcpath, "_"); Debug.fprintln("dynload", "CALL: About to execute function present in CF list: " +& funcstr); @@ -1407,7 +1407,7 @@ algorithm (_,SCode.CLASS(restriction=SCode.R_FUNCTION(),info=Absyn.INFO(fileName = fNew, buildTimes= Absyn.TIMESTAMP(build,_))),_) = Lookup.lookupClass(cache, env, funcpath, true); // note, this should only work for classes that have no file name! - true = stringEqual(fNew,""); // see that we don't have a file! + true = stringEq(fNew,""); // see that we don't have a file! // see if the build time from the class is the same as the build time from the compiled functions list //debug_print("edit",edit); @@ -1544,8 +1544,7 @@ public function isKnownExternalFunc "function isKnownExternalFunc input String inString; input Option inStringOption; algorithm - _:= - matchcontinue (inString,inStringOption) + _:= matchcontinue (inString,inStringOption) case ("acos",SOME("acos")) then (); case ("asin",SOME("asin")) then (); case ("atan",SOME("atan")) then (); @@ -1571,27 +1570,26 @@ protected function cevalKnownExternalFuncs2 "function: cevalKnownExternalFuncs2 input Msg inMsg; output Values.Value outValue; algorithm - outValue:= - matchcontinue (inIdent,inAbsynIdentOption,inValuesValueLst,inMsg) + outValue := matchcontinue (inIdent,inAbsynIdentOption,inValuesValueLst,inMsg) local Real rv_1,rv,rv1,rv2,sv,cv; case ("acos",SOME("acos"),{Values.REAL(real = rv)},_) equation - rv_1 = System.acos(rv); + rv_1 = realAcos(rv); then Values.REAL(rv_1); case ("asin",SOME("asin"),{Values.REAL(real = rv)},_) equation - rv_1 = System.asin(rv); + rv_1 = realAsin(rv); then Values.REAL(rv_1); case ("atan",SOME("atan"),{Values.REAL(real = rv)},_) equation - rv_1 = System.atan(rv); + rv_1 = realAtan(rv); then Values.REAL(rv_1); case ("atan2",SOME("atan2"),{Values.REAL(real = rv1),Values.REAL(real = rv2)},_) equation - rv_1 = System.atan2(rv1, rv2); + rv_1 = realAtan2(rv1, rv2); then Values.REAL(rv_1); case ("cos",SOME("cos"),{Values.REAL(real = rv)},_) @@ -1601,7 +1599,7 @@ algorithm Values.REAL(rv_1); case ("cosh",SOME("cosh"),{Values.REAL(real = rv)},_) equation - rv_1 = System.cosh(rv); + rv_1 = realCosh(rv); then Values.REAL(rv_1); case ("exp",SOME("exp"),{Values.REAL(real = rv)},_) @@ -1611,12 +1609,12 @@ algorithm Values.REAL(rv_1); case ("log",SOME("log"),{Values.REAL(real = rv)},_) equation - rv_1 = System.log(rv); + rv_1 = realLog(rv); then Values.REAL(rv_1); case ("log10",SOME("log10"),{Values.REAL(real = rv)},_) equation - rv_1 = System.log10(rv); + rv_1 = realLog10(rv); then Values.REAL(rv_1); case ("sin",SOME("sin"),{Values.REAL(real = rv)},_) @@ -1626,7 +1624,7 @@ algorithm Values.REAL(rv_1); case ("sinh",SOME("sinh"),{Values.REAL(real = rv)},_) equation - rv_1 = System.sinh(rv); + rv_1 = realSinh(rv); then Values.REAL(rv_1); case ("tan",SOME("tan"),{Values.REAL(real = rv)},_) @@ -1638,7 +1636,7 @@ algorithm Values.REAL(rv_1); case ("tanh",SOME("tanh"),{Values.REAL(real = rv)},_) equation - rv_1 = System.tanh(rv); + rv_1 = realTanh(rv); then Values.REAL(rv_1); end matchcontinue; @@ -1857,7 +1855,7 @@ algorithm false = Types.dimensionsKnown(tp); cr_str = ComponentReference.printComponentRefStr(cr); dim_str = ExpressionDump.printExpStr(dim); - size_str = System.stringAppendList({"size(",cr_str,", ",dim_str,")"}); + size_str = stringAppendList({"size(",cr_str,", ",dim_str,")"}); Error.addMessage(Error.DIMENSION_NOT_KNOWN, {size_str}); then fail(); @@ -2508,14 +2506,14 @@ algorithm case (_, _, _, false) equation fill_size = minLength - stringLength; - str = System.stringAppendList(Util.listFill(" ", fill_size)) +& inString; + str = stringAppendList(Util.listFill(" ", fill_size)) +& inString; then str; // leftJustified is true, append spaces at the end of the string. case (_, _, _, true) equation fill_size = minLength - stringLength; - str = inString +& System.stringAppendList(Util.listFill(" ", fill_size)); + str = inString +& stringAppendList(Util.listFill(" ", fill_size)); then str; end matchcontinue; @@ -2916,7 +2914,7 @@ algorithm // WARNING: This can be very, very slow for long lists - it grows as O(n^2) // TODO: When implemented, use listStringCharString (OMC name) or stringCharListString (RML name) directly chList = Util.listMap(valList, extractValueStringChar); - str = System.stringAppendList(chList); + str = stringAppendList(chList); then (cache,Values.STRING(str),st); end matchcontinue; @@ -3285,7 +3283,7 @@ algorithm case (cache,env,{exp},impl,st,msg) equation (cache,Values.REAL(rv),_) = ceval(cache,env, exp, impl, st,NONE(), msg); - rv_1 = System.sinh(rv); + rv_1 = realSinh(rv); then (cache,Values.REAL(rv_1),st); end matchcontinue; @@ -3349,7 +3347,7 @@ algorithm case (cache,env,{exp},impl,st,msg) equation (cache,Values.REAL(rv),_) = ceval(cache,env, exp, impl, st,NONE(), msg); - rv_1 = System.cosh(rv); + rv_1 = realCosh(rv); then (cache,Values.REAL(rv_1),st); end matchcontinue; @@ -3381,7 +3379,7 @@ algorithm case (cache,env,{exp},impl,st,msg) equation (cache,Values.REAL(rv),_) = ceval(cache,env, exp, impl, st,NONE(), msg); - rv_1 = System.log(rv); + rv_1 = realLog(rv); then (cache,Values.REAL(rv_1),st); end matchcontinue; @@ -3411,7 +3409,7 @@ algorithm case (cache,env,{exp},impl,st,msg) equation (cache,Values.REAL(rv),_) = ceval(cache,env, exp, impl, st,NONE(), msg); - rv_1 = System.log10(rv); + rv_1 = realLog10(rv); then (cache,Values.REAL(rv_1),st); end matchcontinue; @@ -3445,7 +3443,7 @@ algorithm (cache,Values.REAL(rv),_) = ceval(cache,env, exp, impl, st,NONE(), msg); sv = realSin(rv); cv = realCos(rv); - rv_1 = sv/. cv; + rv_1 = sv /. cv; then (cache,Values.REAL(rv_1),st); end matchcontinue; @@ -3477,7 +3475,7 @@ algorithm case (cache,env,{exp},impl,st,msg) /* tanh is not implemented in MetaModelica Compiler (MMC) for some strange reason. */ equation (cache,Values.REAL(rv),_) = ceval(cache,env, exp, impl, st,NONE(), msg); - rv_1 = System.tanh(rv); + rv_1 = realTanh(rv); then (cache,Values.REAL(rv_1),st); end matchcontinue; @@ -3509,7 +3507,7 @@ algorithm case (cache,env,{exp},impl,st,msg) equation (cache,Values.REAL(rv),_) = ceval(cache,env, exp, impl, st,NONE(), msg); - rv_1 = System.asin(rv); + rv_1 = realAsin(rv); then (cache,Values.REAL(rv_1),st); end matchcontinue; @@ -3541,7 +3539,7 @@ algorithm case (cache,env,{exp},impl,st,msg) equation (cache,Values.REAL(rv),_) = ceval(cache,env, exp, impl, st,NONE(), msg); - rv_1 = System.acos(rv); + rv_1 = realAcos(rv); then (cache,Values.REAL(rv_1),st); end matchcontinue; @@ -3573,7 +3571,7 @@ algorithm case (cache,env,{exp},impl,st,msg) /* atan is not implemented in MetaModelica Compiler (MMC) for some strange reason. */ equation (cache,Values.REAL(rv),_) = ceval(cache,env, exp, impl, st,NONE(), msg); - rv_1 = System.atan(rv); + rv_1 = realAtan(rv); then (cache,Values.REAL(rv_1),st); end matchcontinue; @@ -3604,7 +3602,7 @@ algorithm equation (cache,Values.REAL(rv_1),_) = ceval(cache,env, exp1, impl, st,NONE(), msg); (cache,Values.REAL(rv_2),_) = ceval(cache,env, exp2, impl, st,NONE(), msg); - rv = System.atan2(rv_1,rv_2); + rv = realAtan2(rv_1,rv_2); then (cache,Values.REAL(rv),st); end matchcontinue; @@ -3641,7 +3639,7 @@ algorithm (cache,Values.REAL(rv2),_) = ceval(cache,env, exp2, impl, st,NONE(), msg); rv_1 = rv1/. rv2; b = rv_1 <. 0.0; - rv_2 = Util.if_(b,System.realCeil(rv_1),realFloor(rv_1)); + rv_2 = Util.if_(b,realCeil(rv_1),realFloor(rv_1)); then (cache,Values.REAL(rv_2),st); case (cache,env,{exp1,exp2},impl,st,msg) @@ -3651,7 +3649,7 @@ algorithm (cache,Values.REAL(rv2),_) = ceval(cache,env, exp2, impl, st,NONE(), msg); rv_1 = rv1/. rv2; b = rv_1 <. 0.0; - rv_2 = Util.if_(b,System.realCeil(rv_1),realFloor(rv_1)); + rv_2 = Util.if_(b,realCeil(rv_1),realFloor(rv_1)); then (cache,Values.REAL(rv_2),st); case (cache,env,{exp1,exp2},impl,st,msg) @@ -3661,7 +3659,7 @@ algorithm rv2 = intReal(ri); rv_1 = rv1/. rv2; b = rv_1 <. 0.0; - rv_2 = Util.if_(b,System.realCeil(rv_1),realFloor(rv_1)); + rv_2 = Util.if_(b,realCeil(rv_1),realFloor(rv_1)); then (cache,Values.REAL(rv_2),st); case (cache,env,{exp1,exp2},impl,st,msg) @@ -4622,7 +4620,7 @@ algorithm Integer i1, i2; Real r1, r2; case (Values.STRING(string = s1), Values.STRING(string = s2)) - then (System.strcmp(s1, s2) < 0); + then (stringCompare(s1, s2) < 0); case (Values.INTEGER(integer = i1), Values.INTEGER(integer = i2)) then (i1 < i2); case (Values.REAL(real = r1), Values.REAL(real = r2)) @@ -4652,7 +4650,7 @@ algorithm Integer i1, i2; Real r1, r2; case (Values.STRING(string = s1), Values.STRING(string = s2)) - then (System.strcmp(s1, s2) <= 0); + then (stringCompare(s1, s2) <= 0); case (Values.INTEGER(integer = i1), Values.INTEGER(integer = i2)) then (i1 <= i2); case (Values.REAL(real = r1), Values.REAL(real = r2)) @@ -4682,7 +4680,7 @@ algorithm Integer i1, i2; Real r1, r2; case (Values.STRING(string = s1), Values.STRING(string = s2)) - then (System.strcmp(s1, s2) >= 0); + then (stringCompare(s1, s2) >= 0); case (Values.INTEGER(integer = i1), Values.INTEGER(integer = i2)) then (i1 >= i2); case (Values.REAL(real = r1), Values.REAL(real = r2)) @@ -4713,7 +4711,7 @@ algorithm Real r1, r2; Boolean b1, b2; case (Values.STRING(string = s1), Values.STRING(string = s2)) - then (System.strcmp(s1, s2) == 0); + then (stringCompare(s1, s2) == 0); case (Values.INTEGER(integer = i1), Values.INTEGER(integer = i2)) then (i1 == i2); case (Values.REAL(real = r1), Values.REAL(real = r2)) @@ -4742,7 +4740,7 @@ algorithm Real r1, r2; Boolean b1, b2; case (Values.STRING(string = s1), Values.STRING(string = s2)) - then (System.strcmp(s1, s2) <> 0); + then (stringCompare(s1, s2) <> 0); case (Values.INTEGER(integer = i1), Values.INTEGER(integer = i2)) then (i1 <> i2); case (Values.REAL(real = r1), Values.REAL(real = r2)) @@ -5104,7 +5102,7 @@ algorithm case (cache,env,DAE.CREF_IDENT(ident = id,subscriptLst = subsc),DAE.EQBOUND(exp = exp,constant_ = DAE.C_CONST()),impl,MSG()) equation DAE.REDUCTION(path = Absyn.IDENT(name = rfn),expr = elexp,ident = iter,range = iterexp) = exp; - true = stringEqual(rfn, "array"); + true = stringEq(rfn, "array"); Debug.fprintln("ceval", "#- Ceval.cevalCrefBinding: Array evaluation"); then fail(); @@ -5113,7 +5111,7 @@ algorithm case (cache,env,cr,DAE.EQBOUND(exp = exp,constant_ = DAE.C_CONST()),impl,msg) equation DAE.REDUCTION(path = Absyn.IDENT(name = rfn),expr = elexp,ident = iter,range = iterexp) = exp; - false = stringEqual(rfn, "array"); + false = stringEq(rfn, "array"); cr_1 = ComponentReference.crefStripLastSubs(cr) "lookup without subscripts, so dimension sizes can be determined." ; (cache,_,tp,_,_,_,_,_,_) = Lookup.lookupVar(cache,env, cr_1); sizelst = Types.getDimensionSizes(tp); @@ -5191,7 +5189,7 @@ algorithm s1 = ComponentReference.printComponentRefStr(e1); s2 = Types.printBindingStr(inBinding); str = Env.printEnvPathStr(env); - str = System.stringAppendList({"- Ceval.cevalCrefBinding: ", + str = stringAppendList({"- Ceval.cevalCrefBinding: ", s1, " = [", s2, "] in env:", str, " failed\n"}); Debug.fprint("ceval", str); then @@ -5679,7 +5677,7 @@ public function hashFunc input Absyn.Path p; output Integer res; algorithm - res := System.hash(Absyn.pathString(p)); + res := stringHashDjb2(Absyn.pathString(p)); end hashFunc; public function keyEqual @@ -5687,7 +5685,7 @@ public function keyEqual input Key key2; output Boolean res; algorithm - res := stringEqual(Absyn.pathString(key1),Absyn.pathString(key2)); + res := stringEq(Absyn.pathString(key1),Absyn.pathString(key2)); end keyEqual; public function dumpCevalHashTable "" diff --git a/Compiler/CevalScript.mo b/Compiler/CevalScript.mo index f42375e8200..64a6fe24932 100644 --- a/Compiler/CevalScript.mo +++ b/Compiler/CevalScript.mo @@ -492,15 +492,15 @@ algorithm equation res = ""; str1 = Settings.getCompileCommand(); - res = System.stringAppendList({res,"Compile command: ", str1,"\n"}); + res = stringAppendList({res,"Compile command: ", str1,"\n"}); str1 = Settings.getTempDirectoryPath(); - res = System.stringAppendList({res,"Temp folder path: ", str1,"\n"}); + res = stringAppendList({res,"Temp folder path: ", str1,"\n"}); str1 = Settings.getInstallationDirectoryPath(); - res = System.stringAppendList({res,"Installation folder: ", str1,"\n"}); + res = stringAppendList({res,"Installation folder: ", str1,"\n"}); str1 = Settings.getPlotCommand(); - res = System.stringAppendList({res,"Plot command: ", str1,"\n"}); + res = stringAppendList({res,"Plot command: ", str1,"\n"}); str1 = Settings.getModelicaPath(); - res = System.stringAppendList({res,"Modelica path: ", str1,"\n"}); + res = stringAppendList({res,"Modelica path: ", str1,"\n"}); then (cache,Values.STRING(res),st); @@ -649,11 +649,11 @@ algorithm pwd = System.pwd(); pd = System.pathDelimiter(); executableSuffixedExe = stringAppend(executable, System.getExeExt()); - sim_call = System.stringAppendList({cit,pwd,pd,executableSuffixedExe,cit," > output.log 2>&1"}); + sim_call = stringAppendList({cit,pwd,pd,executableSuffixedExe,cit," > output.log 2>&1"}); System.realtimeTick(RT_CLOCK_SIMULATE_SIMULATION); 0 = System.systemCall(sim_call); - result_file = System.stringAppendList({executable,"_res.",outputFormat_str}); + result_file = stringAppendList({executable,"_res.",outputFormat_str}); timeSimulation = System.realtimeTock(RT_CLOCK_SIMULATE_SIMULATION); timeTotal = System.realtimeTock(RT_CLOCK_SIMULATE_TOTAL); simValue = createSimulationResult(result_file, System.readFile("output.log"), @@ -678,7 +678,7 @@ algorithm equation omhome = Settings.getInstallationDirectoryPath() "simulation fail for some other reason than OPENMODELICAHOME not being set." ; errorStr = Error.printMessagesStr(); - res = System.stringAppendList({"Simulation failed.\n",errorStr}); + res = stringAppendList({"Simulation failed.\n",errorStr}); simValue = createSimulationResultFailure(res); then (cache,simValue,st); @@ -789,7 +789,7 @@ algorithm vars_1 = Util.listMap(vars, ExpressionDump.printExpStr); pwd = System.pwd(); pd = System.pathDelimiter(); - filename_1 = System.stringAppendList({pwd,pd,filename}); + filename_1 = stringAppendList({pwd,pd,filename}); value = SimulationResults.readPtolemyplotDataset(filename_1, vars_1, size); then (cache,value,st); @@ -818,7 +818,7 @@ algorithm equation pwd = System.pwd(); pd = System.pathDelimiter(); - filename_1 = System.stringAppendList({pwd,pd,filename}); + filename_1 = stringAppendList({pwd,pd,filename}); value = SimulationResults.readPtolemyplotDatasetSize(filename_1); then (cache,value,st); @@ -859,11 +859,11 @@ algorithm omhome = Settings.getInstallationDirectoryPath(); omhome_1 = System.trim(omhome, "\""); pd = System.pathDelimiter(); - plotCmd = System.stringAppendList({cit,omhome_1,pd,"share",pd,"omc",pd,"scripts",pd,"doPlot",cit}); + plotCmd = stringAppendList({cit,omhome_1,pd,"share",pd,"omc",pd,"scripts",pd,"doPlot",cit}); uniqueStr = intString(tick()); - tmpPlotFile = System.stringAppendList({pwd,pd,"tmpPlot_",uniqueStr,".plt"}); + tmpPlotFile = stringAppendList({pwd,pd,"tmpPlot_",uniqueStr,".plt"}); res = ValuesUtil.writePtolemyplotDataset(tmpPlotFile, value, vars_2, "Plot by OpenModelica"); - call = System.stringAppendList({cit,plotCmd," \"",tmpPlotFile,"\"",cit}); + call = stringAppendList({cit,plotCmd," \"",tmpPlotFile,"\"",cit}); _ = System.systemCall(call); then @@ -945,7 +945,7 @@ algorithm // vars_2 = Util.listUnionElt("time", vars_1); filename = Absyn.pathString(className); - filename2 = System.stringAppendList({filename, "_res.plt"}); + filename2 = stringAppendList({filename, "_res.plt"}); failure(_ = System.getVariableNames(filename2)); // vars_2 = Util.stringSplitAtChar(str, " "); @@ -990,7 +990,7 @@ algorithm // vars_2 = Util.listUnionElt("time", vars_1); filename = Absyn.pathString(className); - filename2 = System.stringAppendList({filename, "_res.plt"}); + filename2 = stringAppendList({filename, "_res.plt"}); str = System.getVariableNames(filename2); vars_2 = Util.stringSplitAtChar(str, " "); @@ -1083,7 +1083,7 @@ algorithm vars_1 = Util.listMap(vars, ExpressionDump.printExpStr) "plot" ; vars_2 = Util.listUnionElt("time", vars_1); filename = Absyn.pathString(className); - filename = System.stringAppendList({filename, "_res.plt"}); + filename = stringAppendList({filename, "_res.plt"}); value = SimulationResults.readPtolemyplotDataset(filename, vars_2, 0); @@ -1114,7 +1114,7 @@ algorithm vars_1 = Util.listMap(vars, ExpressionDump.printExpStr) "plot" ; vars_2 = Util.listUnionElt("time", vars_1); filename = Absyn.pathString(className); - filename = System.stringAppendList({filename, "_res.plt"}); + filename = stringAppendList({filename, "_res.plt"}); failure(_ = SimulationResults.readPtolemyplotDataset(filename, vars_2, 0)); then @@ -1251,12 +1251,12 @@ algorithm visvar_str = Interactive.getElementsOfVisType(className, p); //print("varsofvistype: " +& visvar_str +& "\n"); filename = Absyn.pathString(className); - filename = System.stringAppendList({filename, "_res.plt"}); + filename = stringAppendList({filename, "_res.plt"}); //print("filename: "); //print(filename); vars = SimulationResults.readPtolemyplotVariables(filename, visvar_str); vars_2 = Util.listUnionElt("time", vars); - //print(System.stringAppendList(vars_2)); + //print(stringAppendList(vars_2)); //print(Util.stringDelimitList(vars_2, ", ")); value = SimulationResults.readPtolemyplotDataset(filename, vars_2, 0); res = ValuesUtil.sendPtolemyplotDataset2(value, vars_2, visvar_str, "Plot by OpenModelica"); @@ -1285,7 +1285,7 @@ algorithm //vars_1 = Util.listMap(vars, ExpressionDump.printExpStr) "plot" ; //vars_2 = Util.listUnionElt("time", vars_1); filename = Absyn.pathString(className); - filename = System.stringAppendList({filename, "_res.plt"}); + filename = stringAppendList({filename, "_res.plt"}); vars = SimulationResults.readPtolemyplotVariables(filename); failure(_ = SimulationResults.readPtolemyplotDataset(filename, vars, 0)); @@ -1314,7 +1314,7 @@ algorithm vars_1 = Util.listMap(vars, ExpressionDump.printExpStr) "plot" ; vars_2 = Util.listUnionElt("time", vars_1); // listMap(vars_2, print); - print(System.stringAppendList(vars_2)); + print(stringAppendList(vars_2)); (cache,Values.STRING(filename),_) = Ceval.ceval(cache,env, buildCurrentSimulationResultExp(), true, SOME(st),NONE(), msg); print("tjo\n"); value = SimulationResults.readPtolemyplotDataset(filename, vars_2, 0); @@ -1574,11 +1574,11 @@ algorithm omhome = Settings.getInstallationDirectoryPath(); omhome_1 = System.trim(omhome, "\""); pd = System.pathDelimiter(); - plotCmd = System.stringAppendList({cit,omhome_1,pd,"share",pd,"omc",pd,"scripts",pd,"doPlot",cit}); + plotCmd = stringAppendList({cit,omhome_1,pd,"share",pd,"omc",pd,"scripts",pd,"doPlot",cit}); uniqueStr = intString(tick()); - tmpPlotFile = System.stringAppendList({pwd,pd,"tmpPlot_",uniqueStr,".plt"}); + tmpPlotFile = stringAppendList({pwd,pd,"tmpPlot_",uniqueStr,".plt"}); res = ValuesUtil.writePtolemyplotDataset(tmpPlotFile, value, vars_1, "Plot by OpenModelica"); - call = System.stringAppendList({cit,plotCmd," \"",tmpPlotFile,"\"",cit}); + call = stringAppendList({cit,plotCmd," \"",tmpPlotFile,"\"",cit}); _ = System.systemCall(call); then (cache,Values.BOOL(true),st); @@ -1665,7 +1665,7 @@ algorithm length = listLength(vars_1); (length > 1) = true; filename = Absyn.pathString(className); - filename = System.stringAppendList({filename, "_res.plt"}); + filename = stringAppendList({filename, "_res.plt"}); value = SimulationResults.readPtolemyplotDataset(filename, vars_1, 0); pwd = System.pwd(); @@ -1673,9 +1673,9 @@ algorithm omhome = Settings.getInstallationDirectoryPath(); omhome_1 = System.trim(omhome, "\""); pd = System.pathDelimiter(); - plotCmd = System.stringAppendList({cit,omhome_1,pd,"share",pd,"omc",pd,"scripts",pd,"doPlot",cit}); + plotCmd = stringAppendList({cit,omhome_1,pd,"share",pd,"omc",pd,"scripts",pd,"doPlot",cit}); uniqueStr = intString(tick()); - tmpPlotFile = System.stringAppendList({pwd,pd,"tmpPlot_",uniqueStr,".plt"}); + tmpPlotFile = stringAppendList({pwd,pd,"tmpPlot_",uniqueStr,".plt"}); res = ValuesUtil.sendPtolemyplotDataset(value, vars_1, "Plot by OpenModelica", interpolation, title, legend, grid, logX, logY, xLabel, yLabel, points, ExpressionDump.printExpStr(xRange), ExpressionDump.printExpStr(yRange)); then (cache,Values.BOOL(true),st); @@ -1814,7 +1814,7 @@ algorithm vars = Util.listMap(vars,Expression.CodeVarToCref); strings = Util.listMap(vars, ExpressionDump.printExpStr); // print("setVariableFilter\n"); - // print(System.stringAppendList(vars_1)); + // print(stringAppendList(vars_1)); // print("\n"); // _ = ValuesUtil.setVariableFilter(vars_1); _ = System.setVariableFilter(Util.stringDelimitList(strings, "|")); @@ -1909,7 +1909,7 @@ algorithm (st as Interactive.SYMBOLTABLE(ast = p,explodedAst = sp,instClsLst = ic,lstVarVal = iv,compiledFunctions = cf)),msg) /* no such directory */ equation failure(true = System.directoryExists(str)); - res = System.stringAppendList({"Error, directory ",str," does not exist,"}); + res = stringAppendList({"Error, directory ",str," does not exist,"}); then (cache,Values.STRING(res),st); @@ -2127,7 +2127,7 @@ algorithm omhome_1 = System.trim(omhome, "\""); cit = winCitation(); pd = System.pathDelimiter(); - filename = System.stringAppendList({omhome_1,pd,"share",pd,"doc",pd,"omc",pd,"omc_helptext.txt"}); + filename = stringAppendList({omhome_1,pd,"share",pd,"doc",pd,"omc",pd,"omc_helptext.txt"}); print(filename); str = System.readFile(filename); then @@ -2523,7 +2523,7 @@ algorithm within_ = Interactive.buildWithin(className); p1 = Interactive.updateProgram(Absyn.PROGRAM({refactoredClass}, within_,ts), p); s1 = Absyn.pathString(className); - retStr=System.stringAppendList({"Translation of ",s1," successful.\n"}); + retStr=stringAppendList({"Translation of ",s1," successful.\n"}); then (cache,Values.STRING(retStr),Interactive.SYMBOLTABLE(p1,aDep,sp,ic,iv,cf,lf)); @@ -2531,7 +2531,7 @@ algorithm String errorMsg; Boolean strEmpty; equation errorMsg = Error.printMessagesStr(); - strEmpty = (System.strcmp("",errorMsg)==0); + strEmpty = (stringCompare("",errorMsg)==0); errorMsg = Util.if_(strEmpty,"Internal error, translating graphics to new version",errorMsg); then (cache,Values.STRING(errorMsg),st); @@ -2654,7 +2654,7 @@ algorithm oldDir = System.pwd(); changeToTempDirectory(cdToTemp); (cache,filenameprefix) = extractFilePrefix(cache,env, fileprefix, st_1, msg); - init_filename = System.stringAppendList({filenameprefix,"_init.txt"}); + init_filename = stringAppendList({filenameprefix,"_init.txt"}); (cache,Values.STRING(method_str),SOME(st2)) = Ceval.ceval(cache,env, method, true, SOME(st_1),NONE(), msg); (cache,Values.STRING(outputFormat_str),SOME(st2)) = Ceval.ceval(cache, env, outputFormat, true, SOME(st2),NONE(), msg); exeFile = filenameprefix +& System.getExeExt(); @@ -2759,7 +2759,7 @@ algorithm omhome_1 = System.trim(omhome, "\""); pd = System.pathDelimiter(); cit = winCitation(); - dir_1 = System.stringAppendList({cit,omhome_1,pd,"work",cit}); + dir_1 = stringAppendList({cit,omhome_1,pd,"work",cit}); then dir_1; case (_,_) then ""; /* this function should never fail */ @@ -2806,7 +2806,7 @@ algorithm // to the environment variable! Don't ask me why, ask Microsoft. omhome = Util.if_(System.os() ==& "Windows_NT", "set OPENMODELICAHOME=\"" +& omhome_1 +& "\"&& ", "OPENMODELICAHOME=\"$OPENMODELICAHOME\" "); s_call = - System.stringAppendList({omhome,extra_command, + stringAppendList({omhome,extra_command, omhome_1,pd,"share",pd,"omc",pd,"scripts",pd,"Compile"," ",fileprefix," ",noClean}); Debug.fprintln("dynload", "compileModel: running " +& s_call); 0 = System.systemCall(s_call) ; @@ -2824,7 +2824,7 @@ algorithm libs_str = Util.stringDelimitList(libs, " "); libsfilename = stringAppend(fileprefix, ".libs"); System.writeFile(libsfilename, libs_str); - s_call = System.stringAppendList({"set OPENMODELICAHOME=",omhome_1,"&& ",command," ",fileprefix," ",noClean}); + s_call = stringAppendList({"set OPENMODELICAHOME=",omhome_1,"&& ",command," ",fileprefix," ",noClean}); // print(s_call); Debug.fprintln("dynload", "compileModel: running " +& s_call); 0 = System.systemCall(s_call) ; @@ -2834,7 +2834,7 @@ algorithm */ case (fileprefix,libs,file_dir,_,_) /* compilation failed */ equation - filename = System.stringAppendList({fileprefix,".log"}); + filename = stringAppendList({fileprefix,".log"}); true = System.regularFileExists(filename); str = System.readFile(filename); Error.addMessage(Error.SIMULATOR_BUILD_ERROR, {str}); @@ -2847,7 +2847,7 @@ algorithm command = Settings.getCompileCommand(); false = Util.isEmptyString(command); false = System.regularFileExists(command); - str=System.stringAppendList({"command ",command," not found. Check $OPENMODELICAHOME"}); + str=stringAppendList({"command ",command," not found. Check $OPENMODELICAHOME"}); Error.addMessage(Error.SIMULATOR_BUILD_ERROR, {str}); then fail(); @@ -2861,9 +2861,9 @@ algorithm * please leave Compile instead of Compile.bat * here as it has to work on Linux too */ - s_call = System.stringAppendList({"\"",omhome_1,pd,"share",pd,"omc",pd,"scripts",pd,"Compile","\""}); + s_call = stringAppendList({"\"",omhome_1,pd,"share",pd,"omc",pd,"scripts",pd,"Compile","\""}); false = System.regularFileExists(s_call); - str=System.stringAppendList({"command ",s_call," not found. Check $OPENMODELICAHOME"}); + str=stringAppendList({"command ",s_call," not found. Check $OPENMODELICAHOME"}); Error.addMessage(Error.SIMULATOR_BUILD_ERROR, {str}); then fail(); @@ -3522,7 +3522,7 @@ algorithm simpleEqnSizeStr = intString(simpleEqnSize); warnings = Error.printMessagesStr(); - retStr=System.stringAppendList({"Check of ",classNameStr," completed successfully.\n\n",warnings,"\nClass ",classNameStr," has ",eqnSizeStr," equation(s) and ", + retStr=stringAppendList({"Check of ",classNameStr," completed successfully.\n\n",warnings,"\nClass ",classNameStr," has ",eqnSizeStr," equation(s) and ", varSizeStr," variable(s).\n",simpleEqnSizeStr," of these are trivial equation(s).\n"}); then (cache,Values.STRING(retStr),st); @@ -3563,7 +3563,7 @@ algorithm classNameStr = Absyn.pathString(className); warnings = Error.printMessagesStr(); - retStr=System.stringAppendList({"Check of ",classNameStr," completed successfully.\n\n",warnings,"\nClass ",classNameStr," has ",eqnSizeStr," equation(s) and ", + retStr=stringAppendList({"Check of ",classNameStr," completed successfully.\n\n",warnings,"\nClass ",classNameStr," has ",eqnSizeStr," equation(s) and ", varSizeStr," variable(s).\n",simpleEqnSizeStr," of these are trivial equation(s).\n"}); then (cache,Values.STRING(retStr),st); @@ -3589,7 +3589,7 @@ algorithm classNameStr = Absyn.pathString(className); warnings = Error.printMessagesStr(); // TODO: add a check if warnings is empty, if so then remove \n... --> warnings,"\nClass <--- line below. - retStr=System.stringAppendList({"Check of ",classNameStr," completed successfully.\n\n",warnings,"\n"}); + retStr=stringAppendList({"Check of ",classNameStr," completed successfully.\n\n",warnings,"\n"}); then (cache,Values.STRING(retStr),st); @@ -3599,7 +3599,7 @@ algorithm equation classNameStr = Absyn.pathString(className); errorMsg = Error.printMessagesStr(); - strEmpty = (System.strcmp("",errorMsg)==0); + strEmpty = (stringCompare("",errorMsg)==0); errorMsg = Util.if_(strEmpty,"Internal error, check of model failed with no error message.",errorMsg); // errorMsg = errorMsg +& selectIfNotEmpty("Error Buffer:\n", Print.getErrorString()); then (cache,Values.STRING(errorMsg),st); @@ -3887,7 +3887,7 @@ algorithm list funcpaths; equation //translationLevel=DAE.SCONST(string="flat") - true=stringEqual(translationLevel,"flat"); + true=stringEq(translationLevel,"flat"); _ = Error.getMessagesStr() "Clear messages"; (cache,Values.BOOL(cdToTemp),SOME(st)) = Ceval.ceval(cache,env, storeInTemp, true, SOME(st_1),NONE(), msg); oldDir = System.pwd(); @@ -3899,7 +3899,7 @@ algorithm dae = DAEUtil.transformationsBeforeBackend(dae_1); ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(classname,dae,env)); dlow = BackendDAECreate.lower(dae, Env.getFunctionTree(cache), true, true);//Verificare cosa fa - xml_filename = System.stringAppendList({filenameprefix,".xml"}); + xml_filename = stringAppendList({filenameprefix,".xml"}); funcelems = DAEUtil.getFunctionList(Env.getFunctionTree(cache)); Print.clearBuf(); XMLDump.dumpDAELow(dlow,funcelems,addOriginalIncidenceMatrix,addSolvingInfo,addMathMLCode,dumpResiduals); @@ -3925,7 +3925,7 @@ algorithm equation //translationLevel=DAE.SCONST(string="optimiser") //asInSimulationCode==false => it's NOT necessary to do all the translation's steps before dumping with xml - true=stringEqual(translationLevel,"optimiser"); + true=stringEq(translationLevel,"optimiser"); _ = Error.getMessagesStr() "Clear messages"; (cache,Values.BOOL(cdToTemp),SOME(st)) = Ceval.ceval(cache,env, storeInTemp, true, SOME(st_1),NONE(), msg); oldDir = System.pwd(); @@ -3940,7 +3940,7 @@ algorithm m = BackendDAEUtil.incidenceMatrix(dlow); mT = BackendDAEUtil.transposeMatrix(m); (_,_,dlow_1,m,mT) = BackendDAETransform.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(), BackendDAE.REMOVE_SIMPLE_EQN()), Env.getFunctionTree(cache)); - xml_filename = System.stringAppendList({filenameprefix,".xml"}); + xml_filename = stringAppendList({filenameprefix,".xml"}); funcelems = DAEUtil.getFunctionList(Env.getFunctionTree(cache)); Print.clearBuf(); XMLDump.dumpDAELow(dlow_1,funcelems,addOriginalIncidenceMatrix,addSolvingInfo,addMathMLCode,dumpResiduals); @@ -3967,7 +3967,7 @@ algorithm equation //translationLevel=DAE.SCONST(string="backEnd") //asInSimulationCode==true => it's necessary to do all the translation's steps before dumping with xml - true=stringEqual(translationLevel,"backEnd"); + true=stringEq(translationLevel,"backEnd"); _ = Error.getMessagesStr() "Clear messages"; (cache,Values.BOOL(cdToTemp),SOME(st)) = Ceval.ceval(cache,env, storeInTemp, true, SOME(st_1),NONE(), msg); oldDir = System.pwd(); @@ -3985,7 +3985,7 @@ algorithm (comps) = BackendDAETransform.strongComponents(m, mT, ass1, ass2); indexed_dlow = BackendDAEUtil.translateDae(dlow_1,NONE()); indexed_dlow_1 = BackendDAEUtil.calculateValues(indexed_dlow); - xml_filename = System.stringAppendList({filenameprefix,".xml"}); + xml_filename = stringAppendList({filenameprefix,".xml"}); funcelems = DAEUtil.getFunctionList(Env.getFunctionTree(cache)); Print.clearBuf(); XMLDump.dumpDAELow(indexed_dlow_1,funcelems,addOriginalIncidenceMatrix,addSolvingInfo,addMathMLCode,dumpResiduals); @@ -4091,7 +4091,7 @@ algorithm equation parent_string = Absyn.pathString(inPath); s = Error.printMessagesStr(); - s = System.stringAppendList({parent_string,"->","PROBLEM GETTING CLASS PATHS: ", s, "\n"}); + s = stringAppendList({parent_string,"->","PROBLEM GETTING CLASS PATHS: ", s, "\n"}); print(s); then {}; end matchcontinue; @@ -4361,7 +4361,7 @@ algorithm cflags = System.getCFlags(); ldflags = System.getLDFlags(); senddatalibs = System.getSendDataLibs(); - header = System.stringAppendList({ + header = stringAppendList({ "#Makefile generated by OpenModelica\n\n", "CC=",ccompiler,"\n", "CXX=",cxxcompiler,"\n", @@ -4380,7 +4380,7 @@ protected function generateMakefilename "function generateMakefilename" input String filenameprefix; output String makefilename; algorithm - makefilename := System.stringAppendList({filenameprefix,".makefile"}); + makefilename := stringAppendList({filenameprefix,".makefile"}); end generateMakefilename; protected function generateFunctionName @@ -4529,7 +4529,7 @@ algorithm equation true = RTOpts.debugFlag("nogen"); ss1 = Absyn.pathString(path); - ss1 = System.stringAppendList({"/*- CevalScript.cevalGenerateFunctionDAEs failed( ",ss1," ) set \"nogen\" flag to false */\n"}); + ss1 = stringAppendList({"/*- CevalScript.cevalGenerateFunctionDAEs failed( ",ss1," ) set \"nogen\" flag to false */\n"}); Debug.fprint("failtrace", ss1); then fail(); @@ -4539,7 +4539,7 @@ algorithm true = RTOpts.debugFlag("failtrace"); false = RTOpts.debugFlag("nogen"); ss1 = Absyn.pathString(path); - ss1 = System.stringAppendList({"/*- CevalScript.cevalGenerateFunctionDAEs failed( ",ss1," )*/\n"}); + ss1 = stringAppendList({"/*- CevalScript.cevalGenerateFunctionDAEs failed( ",ss1," )*/\n"}); Debug.fprint("failtrace", ss1); then fail(); diff --git a/Compiler/CevalScript_stub.mo b/Compiler/CevalScript_stub.mo index ca705313a3e..c83b1611dc9 100644 --- a/Compiler/CevalScript_stub.mo +++ b/Compiler/CevalScript_stub.mo @@ -679,7 +679,7 @@ algorithm omhome = System.trim(omhome, "\""); //Remove any quotation marks from omhome. cflags = System.getCFlags(); ldflags = System.getLDFlags(); - header = System.stringAppendList({ + header = stringAppendList({ "#Makefile generated by OpenModelica\n\n", "CC=",ccompiler,"\n", "CXX=",cxxcompiler,"\n", @@ -697,7 +697,7 @@ protected function generateMakefilename "function generateMakefilename" input String filenameprefix; output String makefilename; algorithm - makefilename := System.stringAppendList({filenameprefix,".makefile"}); + makefilename := stringAppendList({filenameprefix,".makefile"}); end generateMakefilename; public function cevalGenerateFunction "function: cevalGenerateFunction @@ -747,7 +747,7 @@ algorithm omhome_1 = System.trim(omhome, "\""); pd = System.pathDelimiter(); cit = winCitation(); - dir_1 = System.stringAppendList({cit,omhome_1,pd,"work",cit}); + dir_1 = stringAppendList({cit,omhome_1,pd,"work",cit}); then dir_1; case (_,_) then ""; /* this function should never fail */ diff --git a/Compiler/Cevalfunc.mo b/Compiler/Cevalfunc.mo index b4c121164f6..8de98bcd66a 100644 --- a/Compiler/Cevalfunc.mo +++ b/Compiler/Cevalfunc.mo @@ -86,7 +86,7 @@ algorithm str = Absyn.pathString(funcpath); replacements = createReplacementRules(inArgs,elementList); ht2 = generateHashMap(replacements,HashTable2.emptyHashTable()); - str = System.stringAppendList({"cevalfunc_",str}); + str = stringAppendList({"cevalfunc_",str}); env3 = Env.openScope(env, false, SOME(str), SOME(Env.FUNCTION_SCOPE)); env1 = extendEnvWithInputArgs(env3,elementList,inArgs,crefArgs, ht2) "also output arguments"; // print("evalfunc env: " +& Env.printEnvStr(env) +& "\n"); @@ -115,7 +115,7 @@ algorithm true = RTOpts.debugFlag("failtrace"); _ = extendEnvWithInputArgs(env,elementList,inArgs,crefArgs,HashTable2.emptyHashTable()); str = Absyn.pathString(funcpath); - str = System.stringAppendList({"- Cevalfunc.evaluateStatements failed for function /* ",str," */\n"}); + str = stringAppendList({"- Cevalfunc.evaluateStatements failed for function /* ",str," */\n"}); Debug.fprint("failtrace", str); then fail(); @@ -126,7 +126,7 @@ algorithm true = RTOpts.debugFlag("failtrace"); failure(_ = extendEnvWithInputArgs(env,elementList,inArgs,crefArgs,HashTable2.emptyHashTable())); str = Absyn.pathString(funcpath); - str = System.stringAppendList({"- Cevalfunc.extendEnvWithInputArgs failed for function /* ",str," */"}); + str = stringAppendList({"- Cevalfunc.extendEnvWithInputArgs failed for function /* ",str," */"}); Debug.fprint("failtrace", str); then fail(); @@ -397,7 +397,7 @@ algorithm case(DAE.TYPES_VAR(varName3,a,p,t as (DAE.T_COMPLEX(complexVarLst = typeslst),_),b,constOfForIteratorRange), varName2::varNames, (val as Values.RECORD(fpath,vals,names,-1))::values) equation - true = stringEqual(varName3, varName2); + true = stringEq(varName3, varName2); lv2 = setValuesInRecord(typeslst,names,vals); ty2 = (DAE.T_COMPLEX(ClassInf.RECORD(fpath) ,lv2 ,NONE(),NONE()),NONE()); tv = DAE.TYPES_VAR(varName3,a,p,ty2,DAE.VALBOUND(val,DAE.BINDING_FROM_DEFAULT_VALUE()),constOfForIteratorRange); @@ -405,7 +405,7 @@ algorithm case(DAE.TYPES_VAR(varName3,a,p,t,b,constOfForIteratorRange) ,varName2::varNames, val::values) equation - true = stringEqual(varName3, varName2); + true = stringEq(varName3, varName2); tv = DAE.TYPES_VAR(varName3,a,p,t,DAE.VALBOUND(val,DAE.BINDING_FROM_DEFAULT_VALUE()),constOfForIteratorRange); then tv; @@ -1094,7 +1094,7 @@ algorithm outVal := matchcontinue(inVal,env,toAssign) true = RTOpts.debugFlag("failtrace"); //(Absyn.CREF_IDENT(dbgString,_)) = Absyn.crefGetFirst(dbgcr); dbgString = Dump.printComponentRefStr(dbgcr); - dbgString = System.stringAppendList({"- Cevalfunc.setValue failed for ", dbgString,"\n"}); + dbgString = stringAppendList({"- Cevalfunc.setValue failed for ", dbgString,"\n"}); Debug.fprint("failtrace", dbgString); then fail(); end matchcontinue; @@ -1191,7 +1191,7 @@ algorithm oenv := matchcontinue(env,inVal,inCr ,hashKey) case(Env.AVLTREENODE(SOME(Env.AVLTREEVALUE(rkey,rval as Env.VAR(fv,c,i,varEnv))),h,oleft,oright), inVal, inCr as Absyn.CREF_QUAL(str,_,child) ,hashKey) equation - true = stringEqual(rkey, str); + true = stringEq(rkey, str); true = Absyn.crefIsIdent(child); varEnv2 = setValue(inVal,varEnv,Absyn.CREF(child)); then @@ -1200,21 +1200,21 @@ algorithm oenv := matchcontinue(env,inVal,inCr ,hashKey) /* case(Env.AVLTREENODE(SOME(Env.AVLTREEVALUE(rkey,rval as Env.VAR(fv,c,i,varEnv))),h,oleft,oright), inVal, inCr as Absyn.CREF_QUAL(str,_,child) ,hashKey) equation - true = stringEqual(rkey, str); + true = stringEq(rkey, str); varEnv2 = setQualValue(varEnv,inVal,child); then Env.AVLTREENODE(SOME(Env.AVLTREEVALUE(rkey,Env.VAR(fv,c,i,varEnv2))),h,oleft,oright); // Check right case(Env.AVLTREENODE(SOME(Env.AVLTREEVALUE(rkey,rval)),h,oleft,SOME(right)), inVal, inCr ,hashKey) equation - true = System.strcmp(key,rkey) > 0; + true = stringCompare(key,rkey) > 0; right = setQualValue2(right,inVal,inCr,hashKey); then Env.AVLTREENODE(SOME(Env.AVLTREEVALUE(rkey,rval)),h,oleft,SOME(right)); // Check left case(Env.AVLTREENODE(SOME(Env.AVLTREEVALUE(rkey,rval)),h,SOME(left),oright), inVal, inCr ,hashKey) equation - true = System.strcmp(key,rkey) 0; + true = stringCompare(key,rkey) 0; rhval = Env.myhash(rkey); (hashKey < rhval) = true; left = setQualValue2(left,inVal,inCr,hashKey); diff --git a/Compiler/ClassLoader.mo b/Compiler/ClassLoader.mo index 798d96d8083..73e608e2785 100644 --- a/Compiler/ClassLoader.mo +++ b/Compiler/ClassLoader.mo @@ -164,7 +164,7 @@ algorithm mp = System.trim(mp_1, " \"\t"); pd = System.pathDelimiter(); classfile = stringAppend(class_, ".mo"); - classfile_1 = System.stringAppendList({mp,pd,classfile}); + classfile_1 = stringAppendList({mp,pd,classfile}); existRegularFile(classfile_1); p = Parser.parse(classfile_1); then @@ -175,8 +175,8 @@ algorithm ts = Absyn.getNewTimeStamp(); mp = System.trim(mp_1, " \"\t"); pd = System.pathDelimiter(); - dirfile = System.stringAppendList({mp,pd,class_}); - packfile = System.stringAppendList({dirfile,pd,"package.mo"}); + dirfile = stringAppendList({mp,pd,class_}); + packfile = stringAppendList({dirfile,pd,"package.mo"}); existDirectoryFile(dirfile); existRegularFile(packfile); Print.printBuf("Class is package stored in a directory, loading whole package(incl. subdir)\n"); @@ -241,8 +241,8 @@ algorithm case (pack,mp,(within_ as Absyn.TOP()),Absyn.PROGRAM(classes = oldc)) equation pd = System.pathDelimiter(); - mp_1 = System.stringAppendList({mp,pd,pack}); - packagefile = System.stringAppendList({mp_1,pd,"package.mo"}); + mp_1 = stringAppendList({mp,pd,pack}); + packagefile = stringAppendList({mp_1,pd,"package.mo"}); existRegularFile(packagefile); Absyn.PROGRAM(p1,w1,ts) = Parser.parse(packagefile); Print.printBuf("loading "); @@ -260,8 +260,8 @@ algorithm case (pack,mp,(within_ as Absyn.WITHIN(path = wpath)),Absyn.PROGRAM(classes = oldc)) equation pd = System.pathDelimiter(); - mp_1 = System.stringAppendList({mp,pd,pack}); - packagefile = System.stringAppendList({mp_1,pd,"package.mo"}); + mp_1 = stringAppendList({mp,pd,pack}); + packagefile = stringAppendList({mp_1,pd,"package.mo"}); existRegularFile(packagefile); Absyn.PROGRAM(p1,w1,ts) = Parser.parse(packagefile); Print.printBuf("loading "); @@ -404,7 +404,7 @@ algorithm case ((f :: fs),mp,within_,Absyn.PROGRAM(classes = oldc,globalBuildTimes = ts)) equation pd = System.pathDelimiter(); - f_1 = System.stringAppendList({mp,pd,f}); + f_1 = stringAppendList({mp,pd,f}); Absyn.PROGRAM(cls,_,_) = Parser.parse(f_1); p_1 = Interactive.updateProgram(Absyn.PROGRAM(cls,within_,ts), Absyn.PROGRAM(oldc,Absyn.TOP(),ts)); p_2 = loadSubpackageFiles(fs, mp, within_, p_1); @@ -437,7 +437,7 @@ algorithm (dir,"package.mo") = Util.getAbsoluteDirectoryAndFile(name); p1_1 = Parser.parse(name); pd = System.pathDelimiter(); - dir_1 = System.stringAppendList({dir,pd,".."}); + dir_1 = stringAppendList({dir,pd,".."}); p1 = loadModelFromEachClass(p1_1, dir_1); then p1; diff --git a/Compiler/ComponentReference.mo b/Compiler/ComponentReference.mo index 6cbb75930e6..8e98de1a4f3 100644 --- a/Compiler/ComponentReference.mo +++ b/Compiler/ComponentReference.mo @@ -277,7 +277,7 @@ algorithm case ((e :: xs)) equation s = Dump.printSubscriptsStr({e}); - str = System.stringAppendList({"#Error converting subscript: ",s," to Expression.\n"}); + str = stringAppendList({"#Error converting subscript: ",s," to Expression.\n"}); //print("#Error converting subscript: " +& s +& " to Expression.\n"); //Print.printErrorBuf(str); xs_1 = toExpCrefSubs(xs); @@ -309,7 +309,7 @@ algorithm then ss; case (inPreString,DAE.CREF_QUAL(ident = s,componentRef = n),inNameSeparator) equation - ns = System.stringAppendList({inPreString, s, inNameSeparator}); + ns = stringAppendList({inPreString, s, inNameSeparator}); ss = crefToStr(ns,n,inNameSeparator); then ss; @@ -396,7 +396,7 @@ algorithm true = RTOpts.modelicaOutput(); str = printComponentRef2Str(s, subs); strrest = printComponentRefStr(cr); - str = System.stringAppendList({str, "__", strrest}); + str = stringAppendList({str, "__", strrest}); then str; @@ -406,7 +406,7 @@ algorithm false = RTOpts.modelicaOutput(); str = printComponentRef2Str(s, subs); strrest = printComponentRefStr(cr); - str = System.stringAppendList({str, ".", strrest}); + str = stringAppendList({str, ".", strrest}); then str; @@ -435,7 +435,7 @@ algorithm equation true = RTOpts.modelicaOutput(); str = ExpressionDump.printListStr(l, ExpressionDump.printSubscriptStr, ","); - str = System.stringAppendList({s, "_L", str, "_R"}); + str = stringAppendList({s, "_L", str, "_R"}); then str; @@ -444,7 +444,7 @@ algorithm equation false = RTOpts.modelicaOutput(); str = ExpressionDump.printListStr(l, ExpressionDump.printSubscriptStr, ","); - str = System.stringAppendList({s, "[", str, "]"}); + str = stringAppendList({s, "[", str, "]"}); then str; end matchcontinue; @@ -471,7 +471,7 @@ algorithm // this printing way will be useful when adressin the 'crefEqual' bug. // str = ComponentReference.printComponentRef2Str(s, subs); str2 = ExpressionDump.typeString(ty); - str = System.stringAppendList({str," [",str2,"]"}); + str = stringAppendList({str," [",str2,"]"}); then str; @@ -481,7 +481,7 @@ algorithm str = printComponentRef2Str(s, subs); str2 = ExpressionDump.typeString(ty); strrest = debugPrintComponentRefTypeStr(cr); - str = System.stringAppendList({str," [",str2,"] ", "__", strrest}); + str = stringAppendList({str," [",str2,"] ", "__", strrest}); then str; @@ -491,7 +491,7 @@ algorithm str = printComponentRef2Str(s, subs); str2 = ExpressionDump.typeString(ty); strrest = debugPrintComponentRefTypeStr(cr); - str = System.stringAppendList({str," [",str2,"] ", ".", strrest}); + str = stringAppendList({str," [",str2,"] ", ".", strrest}); then str; @@ -516,7 +516,7 @@ protected algorithm id1 := crefLastIdent(cr1); id2 := crefLastIdent(cr2); - equal := stringEqual(id1, id2); + equal := stringEq(id1, id2); end crefLastIdentEqual; public function crefFirstCrefEqual @@ -554,7 +554,7 @@ public function crefSortFunc "A sorting function (greatherThan) for crefs" input DAE.ComponentRef cr2; output Boolean greaterThan; algorithm - greaterThan := System.strcmp(printComponentRefStr(cr1),printComponentRefStr(cr2)) > 0; + greaterThan := stringCompare(printComponentRefStr(cr1),printComponentRefStr(cr2)) > 0; end crefSortFunc; public function crefContainedIn @@ -620,7 +620,7 @@ algorithm case (DAE.CREF_QUAL(ident = id1, subscriptLst = ss1,componentRef = cr1), DAE.CREF_QUAL(ident = id2, subscriptLst = ss2,componentRef = cr2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); true = Expression.subscriptEqual(ss1, ss2); res = crefPrefixOf(cr1, cr2); then @@ -631,7 +631,7 @@ algorithm case (DAE.CREF_IDENT(ident = id1,subscriptLst = {}), DAE.CREF_QUAL(ident = id2,subscriptLst = ss2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then true; @@ -639,7 +639,7 @@ algorithm case (DAE.CREF_IDENT(ident = id1,subscriptLst = ss1), DAE.CREF_QUAL(ident = id2,subscriptLst = ss2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); res = Expression.subscriptEqual(ss1, ss2); then res; @@ -649,14 +649,14 @@ algorithm case (DAE.CREF_IDENT(ident = id1,subscriptLst = {}), DAE.CREF_IDENT(ident = id2,subscriptLst = ss2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then true; case (DAE.CREF_IDENT(ident = id1,subscriptLst = ss1), DAE.CREF_IDENT(ident = id2,subscriptLst = ss2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); res = Expression.subscriptEqual(ss1, ss2); then res; @@ -717,19 +717,19 @@ algorithm // check for pointer equality first, if they point to the same thing, they are equal case (inComponentRef1,inComponentRef2) equation - true = System.refEqual(inComponentRef1,inComponentRef2); + true = referenceEq(inComponentRef1,inComponentRef2); then true; // simple identifiers case (DAE.CREF_IDENT(ident = n1,subscriptLst = {}),DAE.CREF_IDENT(ident = n2,subscriptLst = {})) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); then true; case (DAE.CREF_IDENT(ident = n1,subscriptLst = (idx1 as _::_)),DAE.CREF_IDENT(ident = n2,subscriptLst = (idx2 as _::_))) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); true = Expression.subscriptEqual(idx1, idx2); then true; @@ -743,20 +743,20 @@ algorithm equation 0 = System.stringFind(n1, n2); // n2 should be first in n1! s1 = n2 +& "[" +& ExpressionDump.printListStr(idx2, ExpressionDump.printSubscriptStr, ",") +& "]"; - true = stringEqual(s1,n1); + true = stringEq(s1,n1); then true; case (DAE.CREF_IDENT(ident = n1,subscriptLst = (idx2 as _::_)),DAE.CREF_IDENT(ident = n2,subscriptLst = {})) equation 0 = System.stringFind(n2, n1); // n1 should be first in n2! s1 = n1 +& "[" +& ExpressionDump.printListStr(idx2, ExpressionDump.printSubscriptStr, ",") +& "]"; - true = stringEqual(s1,n2); + true = stringEq(s1,n2); then true; // qualified crefs case (DAE.CREF_QUAL(ident = n1,subscriptLst = idx1,componentRef = cr1),DAE.CREF_QUAL(ident = n2,subscriptLst = idx2,componentRef = cr2)) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); true = crefEqualStringCompare(cr1, cr2); true = Expression.subscriptEqual(idx1, idx2); then @@ -774,10 +774,10 @@ algorithm equation s1 = printComponentRefStr(cr1); s2 = printComponentRefStr(cr2); - true = stringEqual(s1, s2); + true = stringEq(s1, s2); // debug_print("cr1", cr1); // debug_print("cr2", cr2); - // System.enableTrace(); + // enableTrace(); then true; */ @@ -788,7 +788,7 @@ algorithm 0 = System.stringFind(n2, n1); // n1 should be first in n2! s1 = printComponentRefStr(cr1); s2 = printComponentRefStr(cr2); - true = stringEqual(s1, s2); + true = stringEq(s1, s2); then true; // left cref is stringified! @@ -797,7 +797,7 @@ algorithm 0 = System.stringFind(n1, n2); // n2 should be first in n1! s1 = printComponentRefStr(cr1); s2 = printComponentRefStr(cr2); - true = stringEqual(s1, s2); + true = stringEq(s1, s2); then true; // the crefs are not equal! @@ -824,21 +824,21 @@ algorithm // check for pointer equality first, if they point to the same thing, they are equal case (inComponentRef1,inComponentRef2) equation - true = System.refEqual(inComponentRef1,inComponentRef2); + true = referenceEq(inComponentRef1,inComponentRef2); then true; // simple identifiers case (DAE.CREF_IDENT(ident = n1,subscriptLst = idx1),DAE.CREF_IDENT(ident = n2,subscriptLst = idx2)) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); true = Expression.subscriptEqual(idx1, idx2); then true; // qualified crefs case (DAE.CREF_QUAL(ident = n1,subscriptLst = idx1,componentRef = cr1),DAE.CREF_QUAL(ident = n2,subscriptLst = idx2,componentRef = cr2)) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); true = crefEqualNoStringCompare(cr1, cr2); true = Expression.subscriptEqual(idx1, idx2); then @@ -1637,13 +1637,13 @@ algorithm case(DAE.CREF_QUAL(id1,_,subs1,cr1),DAE.CREF_IDENT(id2,_,subs2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); true = Expression.subscriptEqual(subs1,subs2); then cr1; case(DAE.CREF_QUAL(id1,_,subs1,cr1),DAE.CREF_QUAL(id2,_,subs2,cr2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); true = Expression.subscriptEqual(subs1,subs2); then crefStripPrefix(cr1,cr2); end matchcontinue; diff --git a/Compiler/ConnectUtil.mo b/Compiler/ConnectUtil.mo index 47b3bc0d0ae..acf349e27c6 100644 --- a/Compiler/ConnectUtil.mo +++ b/Compiler/ConnectUtil.mo @@ -1019,7 +1019,7 @@ algorithm equation strs = Util.listMap(cs, printStreamRefStr); str = Util.stringDelimitList(strs, ", "); - str = System.stringAppendList({"stream set: {",str,"}"}); + str = stringAppendList({"stream set: {",str,"}"}); print("Only one-to-one connections of streams are supported: unsupported connection set:" +& str); then DAEUtil.emptyDae; end matchcontinue; @@ -1278,7 +1278,7 @@ algorithm // pointer equality testing first. case (inSet1, inSet2) equation - true = System.refEqual(inSet1, inSet2); + true = referenceEq(inSet1, inSet2); then true; // deal with empty case @@ -1560,7 +1560,7 @@ algorithm s2 = printSetCrsStr(crs); s3 = Util.stringDelimitList(Util.listMap(dc,ComponentReference.printComponentRefStr), ","); s4 = printOuterConnectsStr(outerConn); - res = System.stringAppendList({"Connect.SETS(\n\t", + res = stringAppendList({"Connect.SETS(\n\t", s1_1,", \n\t", s2,", \n\tdeleted comps: ",s3,", \n\touter connections:",s4,")\n"}); then @@ -1603,7 +1603,7 @@ algorithm equation strs = Util.listMap(Util.listMap(cs, Util.tuple21), ComponentReference.printComponentRefStr); s1 = Util.stringDelimitList(strs, ", "); - res = System.stringAppendList({"\n\tnon-flow set: {",s1,"}"}); + res = stringAppendList({"\n\tnon-flow set: {",s1,"}"}); then res; case Connect.FLOW(tplExpComponentRefFaceLst = cs) @@ -1611,7 +1611,7 @@ algorithm equation strs = Util.listMap(cs, printFlowRefStr); s1 = Util.stringDelimitList(strs, ", "); - res = System.stringAppendList({"\n\tflow set: {",s1,"}"}); + res = stringAppendList({"\n\tflow set: {",s1,"}"}); then res; case Connect.STREAM(tplExpComponentRefFaceLst = cs) @@ -1619,7 +1619,7 @@ algorithm equation strs = Util.listMap(cs, printStreamRefStr); s1 = Util.stringDelimitList(strs, ", "); - res = System.stringAppendList({"\n\tstream set: {",s1,"}"}); + res = stringAppendList({"\n\tstream set: {",s1,"}"}); then res; end matchcontinue; @@ -1681,7 +1681,7 @@ protected function printSetCrsStr algorithm c_strs := Util.listMap(crs, ComponentReference.printComponentRefStr); s := Util.stringDelimitList(c_strs, ", "); - res := System.stringAppendList({"connect crs: {",s,"}"}); + res := stringAppendList({"connect crs: {",s,"}"}); end printSetCrsStr; public function componentFace diff --git a/Compiler/ConnectionGraph.mo b/Compiler/ConnectionGraph.mo index d360a64db90..43054a81b2a 100644 --- a/Compiler/ConnectionGraph.mo +++ b/Compiler/ConnectionGraph.mo @@ -1576,7 +1576,7 @@ algorithm labelFontSize = Util.if_(isBroken, "labelfontsize = 20.0, ", ""); sc1 = ComponentReference.printComponentRefStr(c1); sc2 = ComponentReference.printComponentRefStr(c2); - strDaeEdge = System.stringAppendList({ + strDaeEdge = stringAppendList({ "\"", sc1, "\" -- \"", sc2, "\" [", "dir = \"none\", ", "style = ", style, ", ", @@ -1680,7 +1680,7 @@ algorithm "// Final Roots: ", nrFR, "\n", "// Broken Connections: ", nrBC, "\n" }; - infoNodeStr = System.stringAppendList(infoNode); + infoNodeStr = stringAppendList(infoNode); // replace \n with \\l (left align), replace \t with " " infoNodeStr = System.stringReplace(infoNodeStr, "\n", "\\l"); infoNodeStr = System.stringReplace(infoNodeStr, "\t", " "); // replace / with "" diff --git a/Compiler/DAEDump.mo b/Compiler/DAEDump.mo index f17a6f40998..0ac078cefdd 100644 --- a/Compiler/DAEDump.mo +++ b/Compiler/DAEDump.mo @@ -146,7 +146,7 @@ algorithm res := matchcontinue(func1,func2) local Absyn.Path p1,p2; case(func1,func2) equation - res = System.strcmp(functionNameStr(func1),functionNameStr(func2)) > 0; + res = stringCompare(functionNameStr(func1),functionNameStr(func2)) > 0; then res; case(_,_) then true; end matchcontinue; @@ -432,7 +432,7 @@ algorithm case (SOME(e)) equation s = ExpressionDump.printExpStr(e); - res = System.stringAppendList({"(start=",s,")"}); + res = stringAppendList({"(start=",s,")"}); then res; case (_) then ""; @@ -454,7 +454,7 @@ algorithm equation extargsstr = Dump.getStringList(extargs, dumpExtArgStr, ","); rettystr = dumpExtArgStr(retty); - str = System.stringAppendList( + str = stringAppendList( {"EXTERNALDECL(",id,", (",extargsstr,"), ",rettystr,", \"", lang,"\")"}); then @@ -484,21 +484,21 @@ algorithm crstr = ComponentReference.printComponentRefStr(cr); dirstr = Dump.directionSymbol(dir); tystr = Types.getTypeName(ty); - str = System.stringAppendList({dirstr," ",tystr," ",crstr}); + str = stringAppendList({dirstr," ",tystr," ",crstr}); then str; case DAE.EXTARGEXP(exp = exp,type_ = ty) equation crstr = ExpressionDump.printExpStr(exp); tystr = Types.getTypeName(ty); - str = System.stringAppendList({"(",tystr,") ",crstr}); + str = stringAppendList({"(",tystr,") ",crstr}); then str; case DAE.EXTARGSIZE(componentRef = cr,attributes = attr,type_ = ty,exp = dim) equation crstr = ComponentReference.printComponentRefStr(cr); dimstr = ExpressionDump.printExpStr(dim); - str = System.stringAppendList({"size(",crstr,",",dimstr,")"}); + str = stringAppendList({"size(",crstr,",",dimstr,")"}); then str; end matchcontinue; @@ -694,7 +694,7 @@ algorithm res_1 = Util.stringDelimitListNonEmptyElts( {quantity,unit_str,displayUnit_str,min_str,max_str, Initial_str,fixed_str,nominal_str,stateSel_str}, ", "); - res1 = System.stringAppendList({"(",res_1,")"}); + res1 = stringAppendList({"(",res_1,")"}); is_empty = Util.isEmptyString(res_1); res = Util.if_(is_empty, "", res1); then @@ -708,7 +708,7 @@ algorithm Initial_str = Dump.getOptionWithConcatStr(Initial, ExpressionDump.printExpStr, "start = "); fixed_str = Dump.getOptionWithConcatStr(fixed, ExpressionDump.printExpStr, "fixed = "); res_1 = Util.stringDelimitListNonEmptyElts({quantity,min_str,max_str,Initial_str,fixed_str}, ", "); - res1 = System.stringAppendList({"(",res_1,")"}); + res1 = stringAppendList({"(",res_1,")"}); is_empty = Util.isEmptyString(res_1); res = Util.if_(is_empty, "", res1); then @@ -720,7 +720,7 @@ algorithm Initial_str = Dump.getOptionWithConcatStr(Initial, ExpressionDump.printExpStr, "start = "); fixed_str = Dump.getOptionWithConcatStr(fixed, ExpressionDump.printExpStr, "fixed = "); res_1 = Util.stringDelimitListNonEmptyElts({quantity,Initial_str,fixed_str}, ", "); - res1 = System.stringAppendList({"(",res_1,")"}); + res1 = stringAppendList({"(",res_1,")"}); is_empty = Util.isEmptyString(res_1); res = Util.if_(is_empty, "", res1); then @@ -731,7 +731,7 @@ algorithm quantity = Dump.getOptionWithConcatStr(quant, ExpressionDump.printExpStr, "quantity = "); Initial_str = Dump.getOptionWithConcatStr(Initial, ExpressionDump.printExpStr, "start = "); res_1 = Util.stringDelimitListNonEmptyElts({quantity,Initial_str}, ", "); - res1 = System.stringAppendList({"(",res_1,")"}); + res1 = stringAppendList({"(",res_1,")"}); is_empty = Util.isEmptyString(res_1); res = Util.if_(is_empty, "", res1); then @@ -745,7 +745,7 @@ algorithm Initial_str = Dump.getOptionWithConcatStr(Initial, ExpressionDump.printExpStr, "start = "); fixed_str = Dump.getOptionWithConcatStr(fixed, ExpressionDump.printExpStr, "fixed = "); res_1 = Util.stringDelimitListNonEmptyElts({quantity,min_str,max_str,Initial_str,fixed_str}, ", "); - res1 = System.stringAppendList({"(",res_1,")"}); + res1 = stringAppendList({"(",res_1,")"}); is_empty = Util.isEmptyString(res_1); res = Util.if_(is_empty, "", res1); then @@ -850,7 +850,7 @@ algorithm // String comment with possible annotation. case (SOME(SCode.COMMENT(annopt,SOME(cmt)))) equation - str = System.stringAppendList({" \"",cmt,"\""}); + str = stringAppendList({" \"",cmt,"\""}); str = str +& dumpAnnotationOptionStr(annopt); then str; @@ -1135,14 +1135,14 @@ algorithm equation s1 = ExpressionDump.printExpStr(e1); s2 = ExpressionDump.printExpStr(e2); - str = System.stringAppendList({" assert(",s1, ",",s2,");\n"}); + str = stringAppendList({" assert(",s1, ",",s2,");\n"}); then str; case (DAE.TERMINATE(message=e1)) equation s1 = ExpressionDump.printExpStr(e1); - str = System.stringAppendList({" terminate(",s1,");\n"}); + str = stringAppendList({" terminate(",s1,");\n"}); then str; // adrpo: TODO! FIXME! should we say UNKNOWN equation here? we don't handle all cases! @@ -1323,7 +1323,7 @@ algorithm fstr = Absyn.pathString(fpath); inlineTypeStr = dumpInlineTypeStr(inlineType); daestr = dumpElementsStr(daeElts); - str = System.stringAppendList({"function ",fstr,inlineTypeStr,"\n",daestr,"\nexternal \"C\";\nend ",fstr,";\n\n"}); + str = stringAppendList({"function ",fstr,inlineTypeStr,"\n",daestr,"\nexternal \"C\";\nend ",fstr,";\n\n"}); Print.printBuf(str); then (); @@ -1463,7 +1463,7 @@ algorithm s2 = ExpressionDump.printExpStr(e); es = Util.listMap(expl, ExpressionDump.printExpStr); s3 = Util.stringDelimitList(es, ", "); - str = System.stringAppendList({s1,"(",s3,") := ",s2,";\n"}); + str = stringAppendList({s1,"(",s3,") := ",s2,";\n"}); Print.printBuf(str); then (); @@ -1717,7 +1717,7 @@ algorithm s2 = ExpressionDump.printExpStr(e); es = Util.listMap(expl, ExpressionDump.printExpStr); s3 = Util.stringDelimitList(es, ", "); - str = System.stringAppendList({s1,"(",s3,") := ",s2,";\n"}); + str = stringAppendList({s1,"(",s3,") := ",s2,";\n"}); then str; case (DAE.STMT_IF(exp = e,statementLst = then_,else_ = else_),i) @@ -1781,7 +1781,7 @@ algorithm s1 = indentStr(i); cond_str = ExpressionDump.printExpStr(cond); msg_str = ExpressionDump.printExpStr(msg); - str = System.stringAppendList({s1,"assert(",cond_str,", ",msg_str,");\n"}); + str = stringAppendList({s1,"assert(",cond_str,", ",msg_str,");\n"}); then str; @@ -1789,7 +1789,7 @@ algorithm equation s1 = indentStr(i); s2 = ExpressionDump.printExpStr(e); - str = System.stringAppendList({s1,s2,";\n"}); + str = stringAppendList({s1,s2,";\n"}); then str; @@ -1805,7 +1805,7 @@ algorithm s1 = indentStr(i); e1_str = ExpressionDump.printExpStr(e1); e2_str = ExpressionDump.printExpStr(e2); - str = System.stringAppendList({s1,"reinit(",e1_str,", ",e2_str,");\n"}); + str = stringAppendList({s1,"reinit(",e1_str,", ",e2_str,");\n"}); then str; case (_,i) equation @@ -3294,7 +3294,7 @@ algorithm fstr = Absyn.pathString(fpath); c_str = dumpFunctionStr(constr); d_str = dumpFunctionStr(destr); - str = System.stringAppendList({"class ",fstr,"\n extends ExternalObject;\n",c_str, + str = stringAppendList({"class ",fstr,"\n extends ExternalObject;\n",c_str, d_str,"end ",fstr,";\n"}); then str; diff --git a/Compiler/DAEQuery.mo b/Compiler/DAEQuery.mo index e36a1f77d42..8f63f2a4067 100644 --- a/Compiler/DAEQuery.mo +++ b/Compiler/DAEQuery.mo @@ -73,7 +73,7 @@ algorithm strIMatrix = getIncidenceMatrix(m); strVariables = getVariables(dlow); strEquations = getEquations(dlow); - strIMatrix = System.stringAppendList({strIMatrix, "\n", strVariables, "\n\n\n", strEquations, "\n\n\n", flatStr}); + strIMatrix = stringAppendList({strIMatrix, "\n", strVariables, "\n\n\n", strEquations, "\n\n\n", flatStr}); System.writeFile(file, strIMatrix); then file; @@ -126,21 +126,21 @@ algorithm equation s1 = ExpressionDump.printExpStr(e1); s2 = ExpressionDump.printExpStr(e2); - res = System.stringAppendList({"'", s1," = ",s2, ";'"}); + res = stringAppendList({"'", s1," = ",s2, ";'"}); then res; case (BackendDAE.ARRAY_EQUATION(index = indx,crefOrDerCref = expl), _) equation indx_str = intString(indx); var_str=Util.stringDelimitList(Util.listMap(expl,ExpressionDump.printExpStr),", "); - res = System.stringAppendList({"Array eqn no: ",indx_str," for variables: ",var_str,"\n"}); + res = stringAppendList({"Array eqn no: ",indx_str," for variables: ",var_str,"\n"}); then res; case (BackendDAE.SOLVED_EQUATION(componentRef = cr,exp = e2), _) equation s1 = ComponentReference.printComponentRefStr(cr); s2 = ExpressionDump.printExpStr(e2); - res = System.stringAppendList({"'",s1," = ",s2,";'"}); + res = stringAppendList({"'",s1," = ",s2,";'"}); then res; case (BackendDAE.WHEN_EQUATION(whenEquation = BackendDAE.WHEN_EQ(index = i,left = cr,right = e2)), wcLst) @@ -149,19 +149,19 @@ algorithm s2 = ExpressionDump.printExpStr(e2); BackendDAE.WHEN_CLAUSE(condition, _, _) = listNth(wcLst,i); s3 = ExpressionDump.printExpStr(condition); - res = System.stringAppendList({"'when ", s3, " then " , s1," = ",s2,"; end when;'"}); + res = stringAppendList({"'when ", s3, " then " , s1," = ",s2,"; end when;'"}); then res; case (BackendDAE.RESIDUAL_EQUATION(exp = e),_) equation s1 = ExpressionDump.printExpStr(e); - res = System.stringAppendList({"'", s1,"= 0", ";'"}); + res = stringAppendList({"'", s1,"= 0", ";'"}); then res; case (BackendDAE.ALGORITHM(index = i),_) equation is = intString(i); - res = System.stringAppendList({"Algorithm no: ",is,"\n"}); + res = stringAppendList({"Algorithm no: ",is,"\n"}); then res; end matchcontinue; @@ -181,7 +181,7 @@ algorithm mlen_str := intString(mlen); m_1 := arrayList(m); mstr := getIncidenceMatrix2(m_1,1); - strIMatrix := System.stringAppendList({"% Incidence Matrix\n", + strIMatrix := stringAppendList({"% Incidence Matrix\n", "% ====================================\n", "% number of rows: ", mlen_str, "\n", "IM={", mstr, "};"}); end getIncidenceMatrix; @@ -204,14 +204,14 @@ algorithm case ((row :: {}),rowIndex) equation str1 = getIncidenceRow(row); - str = System.stringAppendList({"{", str1, "}"}); + str = stringAppendList({"{", str1, "}"}); then str; case ((row :: rows),rowIndex) equation str1 = getIncidenceRow(row); str2 = getIncidenceMatrix2(rows,rowIndex+1); - str = System.stringAppendList({"{", str1, "},", str2}); + str = stringAppendList({"{", str1, "},", str2}); then str; end matchcontinue; @@ -234,7 +234,7 @@ algorithm case ((x :: xs)) equation s2 = getIncidenceRow(xs); - s = System.stringAppendList({x, ",", s2}); + s = stringAppendList({x, ",", s2}); then s; end matchcontinue; @@ -413,7 +413,7 @@ algorithm print("fixed:");print(Util.boolString(varFixed(v))); print("\n"); */ - str = System.stringAppendList({"'", str1, "'"}); + str = stringAppendList({"'", str1, "'"}); then str; @@ -452,7 +452,7 @@ algorithm */ varno_1 = varno + 1; str2 = dumpVars2(xs, varno_1); - str = System.stringAppendList({"'", str1, "',", str2}); + str = stringAppendList({"'", str1, "',", str2}); then str; end matchcontinue; @@ -784,7 +784,7 @@ algorithm s3 = incidenceRowExp(e3, vars); ss3 = getIncidenceRow(s3); // build the string now - ss = System.stringAppendList({"{'if', ",s,",'", opStr, "' {",ss1,"}",",{", ss2, "},", ss3, "}"}); + ss = stringAppendList({"{'if', ",s,",'", opStr, "' {",ss1,"}",",{", ss2, "},", ss3, "}"}); pStr = {ss}; then pStr; @@ -801,7 +801,7 @@ algorithm ss2 = getIncidenceRow(s2); s3 = incidenceRowExp(e3, vars); ss3 = getIncidenceRow(s3); - ss = System.stringAppendList({"{'if', ","'", sb, "' {",ss1,"}",",{", ss2, "},", ss3, "}"}); + ss = stringAppendList({"{'if', ","'", sb, "' {",ss1,"}",",{", ss2, "},", ss3, "}"}); pStr = {ss}; then pStr; @@ -816,7 +816,7 @@ algorithm opStr = printExpStr(e1); //opStr = ExpressionDump.relopSymbol(op1); //s = printExpStr(ee2); - sb = System.stringAppendList({"'true',","'=='"}); + sb = stringAppendList({"'true',","'=='"}); s1 = incidenceRowExp(e1, vars); ss1 = getIncidenceRow(s1); s2 = incidenceRowExp(e2, vars); @@ -824,7 +824,7 @@ algorithm s3 = incidenceRowExp(e3, vars); ss3 = getIncidenceRow(s3); // build the string now - ss = System.stringAppendList({"{'if', ",sb,",", "{",ss1,"}",",{", ss2, "},", ss3, "}"}); + ss = stringAppendList({"{'if', ",sb,",", "{",ss1,"}",",{", ss2, "},", ss3, "}"}); pStr = {ss}; then pStr; @@ -836,14 +836,14 @@ algorithm equation //sb = printExpStr(e1); - sb = System.stringAppendList({"'true',","'=='"}); + sb = stringAppendList({"'true',","'=='"}); s1 = incidenceRowExp(e1, vars); ss1 = getIncidenceRow(s1); s2 = incidenceRowExp(e2, vars); ss2 = getIncidenceRow(s2); s3 = incidenceRowExp(e3, vars); ss3 = getIncidenceRow(s3); - ss = System.stringAppendList({"{'if', ", sb, " {",ss1,"}",",{", ss2, "},", ss3, "}"}); + ss = stringAppendList({"{'if', ", sb, " {",ss1,"}",",{", ss2, "},", ss3, "}"}); pStr = {ss}; then pStr; @@ -861,7 +861,7 @@ algorithm ss2 = getIncidenceRow(s2); s3 = incidenceRowExp(e3, vars); ss3 = getIncidenceRow(s3); - ss = System.stringAppendList({"{'if', ","'", sb, "' {",ss1,"}",",{", ss2, "},", ss3, "}"}); + ss = stringAppendList({"{'if', ","'", sb, "' {",ss1,"}",",{", ss2, "},", ss3, "}"}); pStr = {ss}; then pStr; diff --git a/Compiler/DAEUtil.mo b/Compiler/DAEUtil.mo index 274f0a85661..29315e089af 100644 --- a/Compiler/DAEUtil.mo +++ b/Compiler/DAEUtil.mo @@ -547,7 +547,7 @@ algorithm s2 := ComponentReference.printComponentRefStr(cr2); s1 := System.stringReplace(s1, DAE.UNIQUEIO, ""); s2 := System.stringReplace(s2, DAE.UNIQUEIO, ""); - equal := stringEqual(s1,s2); + equal := stringEq(s1,s2); end compareUniquedVarWithNonUnique; public function nameInnerouterUniqueCref " @@ -979,7 +979,7 @@ protected function stringToString "function: stringToString output String str_1; String str_1; algorithm - str_1 := System.stringAppendList({"\"",str,"\""}); + str_1 := stringAppendList({"\"",str,"\""}); end stringToString; @@ -4413,7 +4413,7 @@ algorithm /* Insert to right */ case (DAE.AVLTREENODE(value = SOME(DAE.AVLTREEVALUE(rkey,rval)),height=h,left = left,right = (right)),key,value) equation - true = System.strcmp(Absyn.pathString(key),Absyn.pathString(rkey)) > 0; + true = stringCompare(Absyn.pathString(key),Absyn.pathString(rkey)) > 0; t = createEmptyAvlIfNone(right); t_1 = avlTreeAdd(t, key, value); bt = balance(DAE.AVLTREENODE(SOME(DAE.AVLTREEVALUE(rkey,rval)),h,left,SOME(t_1))); @@ -4423,7 +4423,7 @@ algorithm /* Insert to left subtree */ case (DAE.AVLTREENODE(value = SOME(DAE.AVLTREEVALUE(rkey,rval)),height=h,left = left ,right = right),key,value) equation - /*true = System.strcmp(key,rkey) < 0;*/ + /*true = stringCompare(key,rkey) < 0;*/ t = createEmptyAvlIfNone(left); t_1 = avlTreeAdd(t, key, value); bt = balance(DAE.AVLTREENODE(SOME(DAE.AVLTREEVALUE(rkey,rval)),h,SOME(t_1),right)); @@ -4681,7 +4681,7 @@ algorithm case (DAE.AVLTREENODE(value = SOME(DAE.AVLTREEVALUE(rkey,rval)),left = left,right = SOME(right)),key) local DAE.AvlTree right; equation - true = System.strcmp(Absyn.pathString(key),Absyn.pathString(rkey)) > 0; + true = stringCompare(Absyn.pathString(key),Absyn.pathString(rkey)) > 0; res = avlTreeGet(right, key); then res; @@ -4690,7 +4690,7 @@ algorithm case (DAE.AVLTREENODE(value = SOME(DAE.AVLTREEVALUE(rkey,rval)),left = SOME(left),right = right),key) local DAE.AvlTree left; equation - /*true = System.strcmp(key,rkey) < 0;*/ + /*true = stringCompare(key,rkey) < 0;*/ res = avlTreeGet(left, key); then res; diff --git a/Compiler/DFA.mo b/Compiler/DFA.mo index faf2005720c..3badf027f74 100644 --- a/Compiler/DFA.mo +++ b/Compiler/DFA.mo @@ -1325,17 +1325,17 @@ algorithm Integer value; equation str = intString(value); - str = System.stringAppendList({"Pathvar:", var, " :",str,"\n"}); + str = stringAppendList({"Pathvar:", var, " :",str,"\n"}); then str; case(RP_BOOL(var,_)) equation - str = System.stringAppendList({"Pathvar:", var, " BOOL","\n"}); + str = stringAppendList({"Pathvar:", var, " BOOL","\n"}); then str; case(RP_STRING(var,value)) local String value; equation - str = System.stringAppendList({"Pathvar:", var, ":",value,"\n"}); + str = stringAppendList({"Pathvar:", var, ":",value,"\n"}); then str; case(RP_CONS(var,head,rest)) local @@ -1344,15 +1344,15 @@ algorithm equation headStr = printPatternStr(head); restStr = printPatternStr(rest); - str = System.stringAppendList({"Pathvar:", var, " CONS: ",headStr,",",restStr,"\n"}); + str = stringAppendList({"Pathvar:", var, " CONS: ",headStr,",",restStr,"\n"}); then str; case(RP_WILDCARD(var)) equation - str = System.stringAppendList({"Pathvar:", var, " WILDCARD","\n"}); + str = stringAppendList({"Pathvar:", var, " WILDCARD","\n"}); then str; case(RP_EMPTYLIST(var)) equation - str = System.stringAppendList({"Pathvar:", var, " EMPTY LIST","\n"}); + str = stringAppendList({"Pathvar:", var, " EMPTY LIST","\n"}); then str; case (_) then "Printing of pattern not implemented"; diff --git a/Compiler/Debug.mo b/Compiler/Debug.mo index 898461481bb..7deec641df0 100644 --- a/Compiler/Debug.mo +++ b/Compiler/Debug.mo @@ -127,7 +127,7 @@ algorithm case (flag,strlist) equation true = RTOpts.debugFlag(flag); - str = System.stringAppendList(strlist); + str = stringAppendList(strlist); Print.printErrorBuf(str); then (); diff --git a/Compiler/Derive.mo b/Compiler/Derive.mo index 52cff4af192..71b24e4ebdc 100644 --- a/Compiler/Derive.mo +++ b/Compiler/Derive.mo @@ -1508,7 +1508,7 @@ algorithm true = RTOpts.debugFlag("failtrace"); s = ExpressionDump.printExpStr(e); s2 = ComponentReference.printComponentRefStr(cr); - str = System.stringAppendList({"differentiate_exp ",s," w.r.t:",s2," failed\n"}); + str = stringAppendList({"differentiate_exp ",s," w.r.t:",s2," failed\n"}); //print(str); Debug.fprint("failtrace", str); then diff --git a/Compiler/Derive_stub.mo b/Compiler/Derive_stub.mo index 6e565e35e31..f5f141cc4c0 100644 --- a/Compiler/Derive_stub.mo +++ b/Compiler/Derive_stub.mo @@ -422,7 +422,7 @@ algorithm true = RTOpts.debugFlag("failtrace"); s = ExpressionDump.printExpStr(e); s2 = ComponentReference.printComponentRefStr(cr); - str = System.stringAppendList({"differentiate_exp ",s," w.r.t:",s2," failed\n"}); + str = stringAppendList({"differentiate_exp ",s," w.r.t:",s2," failed\n"}); //print(str); Debug.fprint("failtrace", str); then diff --git a/Compiler/Dump.mo b/Compiler/Dump.mo index 966150b4944..cb32b61d1c4 100644 --- a/Compiler/Dump.mo +++ b/Compiler/Dump.mo @@ -114,7 +114,7 @@ algorithm equation s1 = unparseWithin(0, w); s2 = unparseClassList(0, cs); - str = System.stringAppendList({s1,s2,"\n"}); + str = stringAppendList({s1,s2,"\n"}); then str; case (_,_) then "unparsing failed\n"; @@ -139,7 +139,7 @@ algorithm equation s1 = unparseClassStr(i, c, "", ("",""), ""); s2 = unparseClassList(i, cs); - res = System.stringAppendList({s1,";\n",s2}); + res = stringAppendList({s1,";\n",s2}); then res; end matchcontinue; @@ -162,7 +162,7 @@ algorithm equation s1 = indentStr(i); s2 = Absyn.pathString(p); - str = System.stringAppendList({s1,"within ",s2,";\n"}); + str = stringAppendList({s1,"within ",s2,";\n"}); then str; end matchcontinue; @@ -237,7 +237,7 @@ algorithm s5 = unparseStringCommentOption(optcmt); // the prefix keywords MUST be in the order below given below! See the function comment. prefixKeywords = unparseElementPrefixKeywords(re, finalStr, innerouterStr, encapsulatedStr, partialStr); - str = System.stringAppendList({is,prefixKeywords,restrictionStr," ",n,s5,"\n",s4,is,"end ",n}); + str = stringAppendList({is,prefixKeywords,restrictionStr," ",n,s5,"\n",s4,is,"end ",n}); then str; case (indent,Absyn.CLASS(name = n,partialPrefix = p,finalPrefix = f,encapsulatedPrefix = e,restriction = r, @@ -255,7 +255,7 @@ algorithm s9 = unparseCommentOption(optcmt); // the prefix keywords MUST be in the order below given below! See the function comment. prefixKeywords = unparseElementPrefixKeywords(re, finalStr, innerouterStr, encapsulatedStr, partialStr); - str = System.stringAppendList({is,prefixKeywords,restrictionStr," ",n," = ",s4,s6,s8,s9}); + str = stringAppendList({is,prefixKeywords,restrictionStr," ",n," = ",s4,s6,s8,s9}); then str; case (i,Absyn.CLASS(name = n,partialPrefix = p,finalPrefix = f,encapsulatedPrefix = e,restriction = r, @@ -270,7 +270,7 @@ algorithm s5 = unparseCommentOption(cmt); // the prefix keywords MUST be in the order below given below! See the function comment. prefixKeywords = unparseElementPrefixKeywords(re, finalStr, innerouterStr, encapsulatedStr, partialStr); - str = System.stringAppendList({is,prefixKeywords,restrictionStr," ",n," = enumeration(",s4,")",s5}); + str = stringAppendList({is,prefixKeywords,restrictionStr," ",n," = enumeration(",s4,")",s5}); then str; case (i,Absyn.CLASS(name = n,partialPrefix = p,finalPrefix = f,encapsulatedPrefix = e,restriction = r, @@ -284,7 +284,7 @@ algorithm s5 = unparseCommentOption(cmt); // the prefix keywords MUST be in the order below given below! See the function comment. prefixKeywords = unparseElementPrefixKeywords(re, finalStr, innerouterStr, encapsulatedStr, partialStr); - str = System.stringAppendList({is,prefixKeywords,restrictionStr," ",n," = enumeration(:)",s5}); + str = stringAppendList({is,prefixKeywords,restrictionStr," ",n," = enumeration(:)",s5}); then str; case (i,Absyn.CLASS(name = n,partialPrefix = p,finalPrefix = f,encapsulatedPrefix = e,restriction = r, @@ -301,7 +301,7 @@ algorithm s6 = unparseStringCommentOption(optcmt); // the prefix keywords MUST be in the order below given below! See the function comment. prefixKeywords = unparseElementPrefixKeywords(re, finalStr, innerouterStr, encapsulatedStr, partialStr); - str = System.stringAppendList({is,prefixKeywords,restrictionStr," extends ",baseClassName,s5,s6,"\n",s4,is,"end ",baseClassName}); + str = stringAppendList({is,prefixKeywords,restrictionStr," extends ",baseClassName,s5,s6,"\n",s4,is,"end ",baseClassName}); then str; case (i,Absyn.CLASS(name = n,partialPrefix = p,finalPrefix = f,encapsulatedPrefix = e,restriction = r, @@ -316,7 +316,7 @@ algorithm s5 = Util.stringDelimitList(vars, ", "); s6 = unparseCommentOption(cmt); prefixKeywords = unparseElementPrefixKeywords(re, finalStr, innerouterStr, encapsulatedStr, partialStr); - str = System.stringAppendList({is,prefixKeywords,restrictionStr," ",n," = der(",s4,", ",s5,")", s6}); + str = stringAppendList({is,prefixKeywords,restrictionStr," ",n," = der(",s4,", ",s5,")", s6}); then str; end matchcontinue; @@ -350,7 +350,7 @@ algorithm s2 = selectString(f, "final ", ""); s2_1 = selectString(e, "encapsulated ", ""); s3 = unparseRestrictionStr(r); - str = System.stringAppendList({s2_1,s1,s2,s3}); + str = stringAppendList({s2_1,s1,s2,s3}); then str; end matchcontinue; @@ -370,7 +370,7 @@ algorithm case (SOME(Absyn.COMMENT(annopt,SOME(cmt)))) equation s1 = unparseAnnotationOption(0, annopt); - str = System.stringAppendList({" \"",cmt,"\"",s1}); + str = stringAppendList({" \"",cmt,"\"",s1}); then str; case (SOME(Absyn.COMMENT(annopt,NONE()))) @@ -391,7 +391,7 @@ algorithm local Ident str,cmt; case (SOME(Absyn.COMMENT(_,SOME(cmt)))) equation - str = System.stringAppendList({" \"",cmt,"\""}); + str = stringAppendList({" \"",cmt,"\""}); then str; case (_) then ""; @@ -416,7 +416,7 @@ algorithm equation Print.printBuf("SOME(Absyn.COMMENT("); dumpAnnotationOption(annopt); - str = System.stringAppendList({"SOME(\"",cmt,"\")))"}); + str = stringAppendList({"SOME(\"",cmt,"\")))"}); Print.printBuf(str); then (); @@ -469,14 +469,14 @@ algorithm equation s1 = unparseCommentOption(optcmt); s2 = unparseEnumliterals((a :: b)); - res = System.stringAppendList({str,s1,", ",s2}); + res = stringAppendList({str,s1,", ",s2}); then res; case ({Absyn.ENUMLITERAL(literal = str,comment = optcmt),Absyn.ENUMLITERAL(literal = str2,comment = optcmt2)}) equation s1 = unparseCommentOption(optcmt); s2 = unparseCommentOption(optcmt2); - res = System.stringAppendList({str," ",s1,", ",str2," ",s2}); + res = stringAppendList({str," ",s1,", ",str2," ",s2}); then res; end matchcontinue; @@ -704,7 +704,7 @@ algorithm s3 = intString(scol); s4 = intString(eline); s5 = intString(ecol); - str = System.stringAppendList({"Absyn.INFO(\"",filename,"\", ",s1,", ",s2,", ",s3,", ",s4,", ",s5,")\n"}); + str = stringAppendList({"Absyn.INFO(\"",filename,"\", ",s1,", ",s2,", ",s3,", ",s4,", ",s5,")\n"}); then str; end matchcontinue; @@ -883,7 +883,7 @@ algorithm case (Absyn.CLASSMOD(expOption = SOME(e))) equation s1 = printExpStr(e); - str = System.stringAppendList({" = ",s1}); + str = stringAppendList({" = ",s1}); then str; end matchcontinue; @@ -955,7 +955,7 @@ algorithm s3 = printComponentRefStr(r); s4 = unparseOptModificationStr(optm); s5 = unparseStringCommentOption(optstr); - str = System.stringAppendList({s1,s2,s3,s4,s5}); + str = stringAppendList({s1,s2,s3,s4,s5}); then str; case (Absyn.REDECLARATION(finalItem = f,redeclareKeywords = keywords,each_ = each_,elementSpec = spec,constrainClass = constr)) @@ -968,7 +968,7 @@ algorithm redeclareStr = redeclareStr +& s1; s4 = unparseElementspecStr(0, spec, s2, (redeclareStr,replaceableStr), ""); s5 = unparseConstrainclassOptStr(constr); - str = System.stringAppendList({s4,s5}); + str = stringAppendList({s4,s5}); then str; end matchcontinue; @@ -1089,7 +1089,7 @@ algorithm idstr = Util.getOptionOrDefault(id, ""); crefstr = getOptionStr(cref, printComponentRefStr); expstr = printListStr(exps, printExpStr, ","); - str = System.stringAppendList({idstr,", ",crefstr,", (",expstr,")"}); + str = stringAppendList({idstr,", ",crefstr,", (",expstr,")"}); Print.printBuf(str); then (); @@ -1098,7 +1098,7 @@ algorithm idstr = Util.getOptionOrDefault(id, ""); crefstr = getOptionStr(cref, printComponentRefStr); expstr = printListStr(exps, printExpStr, ","); - str = System.stringAppendList({idstr,", \"",lang,"\", ",crefstr,", (",expstr,")"}); + str = stringAppendList({idstr,", \"",lang,"\", ",crefstr,", (",expstr,")"}); Print.printBuf(str); then (); @@ -1159,7 +1159,7 @@ algorithm equation s1 = unparseElementitemStrLst(i, el); // no ident needed! i_1 = i - 1; is = indentStr(i_1); - str = System.stringAppendList({s1}); + str = stringAppendList({s1}); then str; case (i,Absyn.PUBLIC(contents = el),false) @@ -1167,7 +1167,7 @@ algorithm s1 = unparseElementitemStrLst(i, el); i_1 = i - 1; is = indentStr(i_1); - str = System.stringAppendList({is,"public \n",s1}); + str = stringAppendList({is,"public \n",s1}); then str; case (i,Absyn.PROTECTED(contents = el),_) @@ -1175,7 +1175,7 @@ algorithm s1 = unparseElementitemStrLst(i, el); i_1 = i - 1; is = indentStr(i_1); - str = System.stringAppendList({is,"protected \n",s1}); + str = stringAppendList({is,"protected \n",s1}); then str; case (i,Absyn.EQUATIONS(contents = eqs),_) @@ -1183,7 +1183,7 @@ algorithm s1 = unparseEquationitemStrLst(i, eqs, ";\n"); i_1 = i - 1; is = indentStr(i_1); - str = System.stringAppendList({"\n",is,"equation \n",s1}); + str = stringAppendList({"\n",is,"equation \n",s1}); then str; case (i,Absyn.INITIALEQUATIONS(contents = eqs),_) @@ -1191,7 +1191,7 @@ algorithm s1 = unparseEquationitemStrLst(i, eqs, ";\n"); i_1 = i - 1; is = indentStr(i_1); - str = System.stringAppendList({"\n",is,"initial equation \n",s1}); + str = stringAppendList({"\n",is,"initial equation \n",s1}); then str; case (i,Absyn.ALGORITHMS(contents = eqs),_) @@ -1200,7 +1200,7 @@ algorithm s1 = unparseAlgorithmStrLst(i, eqs, "\n"); i_1 = i - 1; is = indentStr(i_1); - str = System.stringAppendList({is,"algorithm \n",s1}); + str = stringAppendList({is,"algorithm \n",s1}); then str; case (i,Absyn.INITIALALGORITHMS(contents = eqs),_) @@ -1209,7 +1209,7 @@ algorithm s1 = unparseAlgorithmStrLst(i, eqs, "\n"); i_1 = i - 1; is = indentStr(i_1); - str = System.stringAppendList({is,"initial algorithm \n",s1}); + str = stringAppendList({is,"initial algorithm \n",s1}); then str; case (i,Absyn.EXTERNAL(externalDecl = Absyn.EXTERNALDECL( @@ -1223,7 +1223,7 @@ algorithm is = indentStr(i); annstr = unparseAnnotationOption(i, ann); annstr2 = unparseAnnotationOptionSemi(i, ann2); - str = System.stringAppendList( + str = stringAppendList( {"\n",is,"external ",langstr," ",outputstr," = ",ident,"(", expstr,") ",annstr,";",annstr2,"\n"}); then @@ -1238,7 +1238,7 @@ algorithm is = indentStr(i); annstr = unparseAnnotationOption(i, ann); annstr2 = unparseAnnotationOptionSemi(i, ann2); - str = System.stringAppendList( + str = stringAppendList( {"\n",is,"external ",langstr," ",ident,"(",expstr,") ", annstr,"; ",annstr2,"\n"}); then @@ -1251,7 +1251,7 @@ algorithm langstr = getExtlangStr(lang); annstr = unparseAnnotationOption(i, ann); annstr2 = unparseAnnotationOptionSemi(i, ann2); - res = System.stringAppendList({"\n",is,"external ",langstr," ",annstr,";",annstr2,"\n"}); + res = stringAppendList({"\n",is,"external ",langstr," ",annstr,";",annstr2,"\n"}); then res; end matchcontinue; @@ -1266,7 +1266,7 @@ algorithm outString := matchcontinue (inStringOption) local Ident res,str; case (NONE()) then ""; - case (SOME(str)) equation res = System.stringAppendList({"\"",str,"\""}); then res; + case (SOME(str)) equation res = stringAppendList({"\"",str,"\""}); then res; end matchcontinue; end getExtlangStr; @@ -1364,7 +1364,7 @@ algorithm equation s1 = unparseElementitemStr(i, x); s2 = unparseElementitemStrLst(i, xs); - res = System.stringAppendList({s1,"\n",s2}); + res = stringAppendList({s1,"\n",s2}); then res; end matchcontinue; @@ -1442,7 +1442,7 @@ algorithm equation s1 = unparseClassModificationStr(Absyn.CLASSMOD(mod,NONE())); is = indentStr(i); - str = System.stringAppendList({is,"annotation",s1}); + str = stringAppendList({is,"annotation",s1}); then str; case (_,NONE()) then ""; @@ -1556,7 +1556,7 @@ algorithm s3 = unparseInnerouterStr(inout); s4 = unparseElementspecStr(i, spec, s1, redeclareKeywords, s3); s5 = unparseConstrainclassOptStr(constr); - str = System.stringAppendList({s4,s5,";"}); + str = stringAppendList({s4,s5,";"}); then str; case (i,Absyn.ELEMENT(finalPrefix = finalPrefix,redeclareKeywords = NONE(),innerOuter = inout,specification = spec,info = info,constrainClass = constr)) @@ -1565,7 +1565,7 @@ algorithm s3 = unparseInnerouterStr(inout); s4 = unparseElementspecStr(i, spec, s1, ("",""), s3); s5 = unparseConstrainclassOptStr(constr); - str = System.stringAppendList({s4,s5,";"}); + str = stringAppendList({s4,s5,";"}); then str; case(i,Absyn.DEFINEUNIT(name,{})) equation @@ -1580,7 +1580,7 @@ algorithm case (i,Absyn.TEXT(optName = SOME(name),string = text,info = info)) equation s1 = unparseInfoStr(info); - str = System.stringAppendList( + str = stringAppendList( {"/* Absyn.TEXT(SOME(\"",name,"\"), \"",text,"\", ",s1, "); */"}); then @@ -1588,7 +1588,7 @@ algorithm case (i,Absyn.TEXT(optName = NONE(),string = text,info = info)) equation s1 = unparseInfoStr(info); - str = System.stringAppendList({"/* Absyn.TEXT(NONE(), \"",text,"\", ",s1,"); */"}); + str = stringAppendList({"/* Absyn.TEXT(NONE(), \"",text,"\", ",s1,"); */"}); then str; case(_,_) equation @@ -1819,7 +1819,7 @@ algorithm is = indentStr(i); s3 = unparseAnnotationOption(0, annOpt); // adrpo: NOTE final, replaceable/redeclare, inner/outer should NOT be used for extends! - str = System.stringAppendList({is,s2,s3}); + str = stringAppendList({is,s2,s3}); then str; case (i,Absyn.EXTENDS(path = p,elementArg = l,annotationOpt=annOpt),f,r,io) @@ -1830,7 +1830,7 @@ algorithm is = indentStr(i); s4 = unparseAnnotationOption(0, annOpt); // adrpo: NOTE final, replaceable/redeclare, inner/outer should NOT be used for extends! - str = System.stringAppendList({is,s2,"(",s3,")",s4}); + str = stringAppendList({is,s2,"(",s3,")",s4}); then str; case (i,Absyn.COMPONENTS(attributes = attr,typeSpec = t,components = cs),f,r,io) @@ -1841,7 +1841,7 @@ algorithm s3 = getStringList(cs, unparseComponentitemStr, ","); is = indentStr(i); prefixKeywords = unparseElementPrefixKeywords(r, f, io, "", ""); - str = System.stringAppendList({is,prefixKeywords,s2,s1,ad," ",s3}); + str = stringAppendList({is,prefixKeywords,s2,s1,ad," ",s3}); then str; case (indent,Absyn.IMPORT(import_ = i),f,r,io) @@ -1851,7 +1851,7 @@ algorithm s2 = stringAppend("import ", s1); is = indentStr(indent); // adrpo: NOTE final, replaceable/redeclare, inner/outer should NOT be used for import! - str = System.stringAppendList({is,s2}); + str = stringAppendList({is,s2}); then str; case (_,_,_,_,_) @@ -1984,7 +1984,7 @@ algorithm ss = selectString(st, "stream ", ""); vs = unparseVariabilitySymbolStr(var); ds = unparseDirectionSymbolStr(dir); - str = System.stringAppendList({fs,ss,vs,ds}); + str = stringAppendList({fs,ss,vs,ds}); then str; case (_) @@ -2171,7 +2171,7 @@ algorithm s1 = unparseComponentStr(c); s2 = unparseComponentCondition(optcond); s3 = unparseCommentOption(cmtopt); - str = System.stringAppendList({s1,s2,s3}); + str = stringAppendList({s1,s2,s3}); then str; end matchcontinue; @@ -2617,7 +2617,7 @@ algorithm i_1 = i + 1; s2 = unparseEquationitemStrLst(i_1, tb, ";\n"); is = indentStr(i); - str = System.stringAppendList({"if ",s1," then\n",is,s2,is,"end if"}); + str = stringAppendList({"if ",s1," then\n",is,s2,is,"end if"}); then str; case (i,Absyn.EQ_IF(ifExp = e,equationTrueItems = tb,elseIfBranches = eb,equationElseItems = fb)) @@ -2628,7 +2628,7 @@ algorithm s3 = unparseEqElseifStrLst(i_1, eb, "\n"); s4 = unparseEquationitemStrLst(i_1, fb, ";\n"); is = indentStr(i); - str = System.stringAppendList( + str = stringAppendList( {is,"if ",s1," then\n",s2,s3,"\n",is,"else\n",s4,"\n",is, "end if"}); then @@ -2638,7 +2638,7 @@ algorithm s1 = printExpStr(e1); s2 = printExpStr(e2); is = indentStr(i); - str = System.stringAppendList({is,s1," = ",s2}); + str = stringAppendList({is,s1," = ",s2}); then str; case (i,Absyn.EQ_CONNECT(connector1 = e1,connector2 = e2)) @@ -2647,7 +2647,7 @@ algorithm s1 = printComponentRefStr(e1); s2 = printComponentRefStr(e2); is = indentStr(i); - str = System.stringAppendList({is,"connect(",s1,",",s2,")"}); + str = stringAppendList({is,"connect(",s1,",",s2,")"}); then str; case (indent,Absyn.EQ_FOR(iterators = iterators,forEquations = el)) @@ -2655,7 +2655,7 @@ algorithm s1 = printIteratorsStr(iterators); s2 = unparseEquationitemStrLst(indent, el, ";\n"); is = indentStr(indent); - str = System.stringAppendList({is,"for ",s1," loop\n",s2,"\n",is,"end for"}); + str = stringAppendList({is,"for ",s1," loop\n",s2,"\n",is,"end for"}); then str; case (i,Absyn.EQ_NORETCALL(functionName = cref,functionArgs = fargs)) @@ -2663,7 +2663,7 @@ algorithm s2 = printFunctionArgsStr(fargs); id = printComponentRefStr(cref); is = indentStr(i); - str = System.stringAppendList({is, id,"(",s2,")"}); + str = stringAppendList({is, id,"(",s2,")"}); then str; case (i,Absyn.EQ_WHEN_E(whenExp = exp,whenEquations = eql,elseWhenEquations = eqlelse)) @@ -2673,14 +2673,14 @@ algorithm s2 = unparseEquationitemStrLst(i_1, eql, ";\n"); is = indentStr(i); s4 = unparseEqElsewhenStrLst(i_1, eqlelse); - str = System.stringAppendList({is,"when ",s1," then\n",is,s2,is,s4,"\n",is,"end when"}); + str = stringAppendList({is,"when ",s1," then\n",is,s2,is,s4,"\n",is,"end when"}); then str; case (i,Absyn.EQ_FAILURE(equItem)) equation s1 = unparseEquationitemStr(0, equItem); is = indentStr(i); - str = System.stringAppendList({is,"failure(",s1,")"}); + str = stringAppendList({is,"failure(",s1,")"}); then str; case (_,_) @@ -2712,7 +2712,7 @@ algorithm equation s1 = unparseEquationitemStr(i, x); s2 = unparseEquationitemStrLst(i, xs, sep); - res = System.stringAppendList({s1,sep,s2}); + res = stringAppendList({s1,sep,s2}); then res; end matchcontinue; @@ -2791,21 +2791,21 @@ algorithm case (i,{x1},sep) equation s1 = unparseEqElseifStr(i, x1); - res = System.stringAppendList({s1,sep}); + res = stringAppendList({s1,sep}); then res; case (i,(x :: (xs as (_ :: _))),sep) equation s2 = unparseEqElseifStrLst(i, xs, sep); s1 = unparseEqElseifStr(i, x); - res = System.stringAppendList({s1,sep,s2}); + res = stringAppendList({s1,sep,s2}); then res; case (i,{x1,x2},sep) equation s1 = unparseEqElseifStr(i, x1); s2 = unparseEqElseifStr(i, x2); - res = System.stringAppendList({s1,sep,s2}); + res = stringAppendList({s1,sep,s2}); then res; end matchcontinue; @@ -2832,7 +2832,7 @@ algorithm s2 = unparseEquationitemStrLst(i, el, ";\n"); i_1 = i - 1; is = indentStr(i_1); - res = System.stringAppendList({"\n",is,"elseif ",s1," then\n",s2}); + res = stringAppendList({"\n",is,"elseif ",s1," then\n",s2}); then res; end matchcontinue; @@ -2995,7 +2995,7 @@ algorithm equation s1 = unparseAlgorithmStr(i, x); s2 = unparseAlgorithmStrLst(i, xs, sep); - res = System.stringAppendList({s1,sep,s2}); + res = stringAppendList({s1,sep,s2}); then res; end matchcontinue; @@ -3054,7 +3054,7 @@ algorithm s2 = printExpStr(exp); s3 = unparseCommentOption(optcmt); is = indentStr(i); - str = System.stringAppendList({is,s1,":=",s2,s3,";"}); + str = stringAppendList({is,s1,":=",s2,s3,";"}); then str; case (i,Absyn.ALGORITHMITEM(algorithm_ = Absyn.ALG_IF(ifExp = e,trueBranch = tb,elseIfAlgorithmBranch = eb,elseBranch = fb),comment = optcmt)) /* ALG_IF */ @@ -3066,7 +3066,7 @@ algorithm s4 = unparseAlgorithmStrLst(i, fb, "\n"); s5 = unparseCommentOption(optcmt); is = indentStr(i); - str = System.stringAppendList( + str = stringAppendList( {is,"if ",s1," then \n",is,s2,s3,"\n",is,"else ",s4,"\n",is, "end if",s5,";"}); then @@ -3079,7 +3079,7 @@ algorithm s2 = unparseAlgorithmStrLst(ident_1, el, "\n"); s3 = unparseCommentOption(optcmt); is = indentStr(ident); - str = System.stringAppendList( + str = stringAppendList( {is,"for ",s1," loop\n",is,s2,"\n",is,"end for",s3, ";"}); then @@ -3091,7 +3091,7 @@ algorithm s2 = unparseAlgorithmStrLst(i_1, al, "\n"); s3 = unparseCommentOption(optcmt); is = indentStr(i); - str = System.stringAppendList( + str = stringAppendList( {is,"while (",s1,") loop\n",is,s2,"\n",is,"end while",s3,";"}); then str; @@ -3103,7 +3103,7 @@ algorithm s3 = unparseCommentOption(optcmt); is = indentStr(i); s4 = unparseAlgElsewhenStrLst(i_1, al2); - str = System.stringAppendList( + str = stringAppendList( {is,"when ",s1," then\n",is,s2,is,s4,"\n",is,"end when",s3, ";"}); then @@ -3114,7 +3114,7 @@ algorithm s2 = printFunctionArgsStr(fargs); s3 = unparseCommentOption(optcmt); is = indentStr(i); - str = System.stringAppendList({is,s1,"(",s2,")",s3,";"}); + str = stringAppendList({is,s1,"(",s2,")",s3,";"}); then str; case (i,Absyn.ALGORITHMITEMANN(annotation_ = ann)) @@ -3160,7 +3160,7 @@ algorithm s3 = unparseCommentOption(optcmt); strlist = Util.listMap(explist, printExpStr); strlist = Util.listMap1r(strlist, stringAppend, "\ncase:\n "); - s2 = System.stringAppendList(strlist); + s2 = stringAppendList(strlist); str_1 = printMatchType(matchType) +& " cases { " +& s2 +& " } "+& s3 +&";"; then str_1; @@ -3170,7 +3170,7 @@ algorithm s2 = unparseAlgorithmStrLst(i_1, al, "\n"); s3 = unparseCommentOption(optcmt); is = indentStr(i); - str = System.stringAppendList( + str = stringAppendList( {is,"try\n",is,s2,is,"end try",s3,";"}); then str; @@ -3186,7 +3186,7 @@ algorithm s2 = unparseAlgorithmStrLst(i_1, al, "\n"); s3 = unparseCommentOption(optcmt); is = indentStr(i); - str = System.stringAppendList( + str = stringAppendList( {is,"catch\n",is,s2,is,"end catch",s3,";"}); then str; @@ -3223,14 +3223,14 @@ algorithm equation s1 = unparseAlgElsewhenStr(i, x1); s2 = unparseAlgElsewhenStr(i, x2); - res = System.stringAppendList({s1,"\n",s2}); + res = stringAppendList({s1,"\n",s2}); then res; case (i,(x :: (xs as (_ :: _)))) equation s1 = unparseAlgElsewhenStr(i, x); s2 = unparseAlgElsewhenStrLst(i, xs); - res = System.stringAppendList({s1,"\n",s2}); + res = stringAppendList({s1,"\n",s2}); then res; end matchcontinue; @@ -3256,7 +3256,7 @@ algorithm is = indentStr(i); s1 = unparseAlgorithmStrLst(i, algl, "\n"); s2 = printExpStr(exp); - res = System.stringAppendList({"elsewhen ",s2," then\n",s1}); + res = stringAppendList({"elsewhen ",s2," then\n",s1}); then res; end matchcontinue; @@ -3287,14 +3287,14 @@ algorithm equation s1 = unparseEqElsewhenStr(i, x1); s2 = unparseEqElsewhenStr(i, x2); - res = System.stringAppendList({s1,"\n",s2}); + res = stringAppendList({s1,"\n",s2}); then res; case (i,(x :: xs)) equation s1 = unparseEqElsewhenStr(i, x); s2 = unparseEqElsewhenStrLst(i, xs); - res = System.stringAppendList({s1,"\n",s2}); + res = stringAppendList({s1,"\n",s2}); then res; end matchcontinue; @@ -3320,7 +3320,7 @@ algorithm is = indentStr(i); s1 = unparseEquationitemStrLst(i, eql, ";\n"); s2 = printExpStr(exp); - res = System.stringAppendList({"elsewhen ",s2," then\n",s1}); + res = stringAppendList({"elsewhen ",s2," then\n",s1}); then res; end matchcontinue; @@ -3369,7 +3369,7 @@ algorithm equation s2 = unparseAlgElseifStrLst(i, xs, sep); s1 = unparseAlgElseifStr(i, x); - res = System.stringAppendList({s1,sep,s2}); + res = stringAppendList({s1,sep,s2}); then res; end matchcontinue; @@ -3396,7 +3396,7 @@ algorithm s2 = unparseAlgorithmStrLst(i, el, "\n"); i_1 = i - 1; is = indentStr(i_1); - str = System.stringAppendList({is,"elseif ",s1," then\n",s2}); + str = stringAppendList({is,"elseif ",s1," then\n",s2}); then str; end matchcontinue; @@ -3985,7 +3985,7 @@ algorithm equation estr = printExpStr(exp); istr = printIteratorsStr(iterators); - str = System.stringAppendList({estr," for ", istr}); + str = stringAppendList({estr," for ", istr}); then str; end matchcontinue; @@ -4008,14 +4008,14 @@ algorithm case ({(id, SOME(exp))}) equation s1 = printExpStr(exp); - s = System.stringAppendList({id, " in ", s1}); + s = stringAppendList({id, " in ", s1}); then s; case ({(id, NONE())}) then id; case (x::rest) equation s1 = printIteratorsStr({x}); s2 = printIteratorsStr(rest); - s = System.stringAppendList({s1, ", ", s2}); + s = stringAppendList({s1, ", ", s2}); then s; end matchcontinue; end printIteratorsStr; @@ -4144,7 +4144,7 @@ algorithm case (str,pparent,pexpr) /* expr, prio. parent expr, prio. expr */ equation (pparent > pexpr) = true; - str_1 = System.stringAppendList({"(",str,")"}); + str_1 = stringAppendList({"(",str,")"}); then str_1; case (str,_,_) then str; @@ -4290,7 +4290,7 @@ algorithm ts_1 = parenthesize(ts, pt, p); fs_1 = parenthesize(fs, pf, p); el = printElseifStr(elseif_); - str = System.stringAppendList({"if ",cs_1," then ",ts_1,el," else ",fs_1}); + str = stringAppendList({"if ",cs_1," then ",ts_1,el," else ",fs_1}); then str; case (Absyn.CALL(function_ = fcn,functionArgs = args)) @@ -4343,7 +4343,7 @@ algorithm pstop = expPriority(stop); s1_1 = parenthesize(s1, pstart, p); s3_1 = parenthesize(s3, pstop, p); - s = System.stringAppendList({s1_1,":",s3_1}); + s = stringAppendList({s1_1,":",s3_1}); then s; case ((e as Absyn.RANGE(start = start,step = SOME(step),stop = stop))) @@ -4358,14 +4358,14 @@ algorithm s1_1 = parenthesize(s1, pstart, p); s3_1 = parenthesize(s3, pstop, p); s2_1 = parenthesize(s2, pstep, p); - s = System.stringAppendList({s1_1,":",s2_1,":",s3_1}); + s = stringAppendList({s1_1,":",s2_1,":",s3_1}); then s; case (Absyn.CODE(code = c)) local Absyn.CodeNode c; equation res = printCodeStr(c); - res_1 = System.stringAppendList({"Code(",res,")"}); + res_1 = stringAppendList({"Code(",res,")"}); then res_1; case Absyn.END() then "end"; @@ -4375,13 +4375,13 @@ algorithm equation s1 = printExpStr(head); s2 = printExpStr(rest); - s = System.stringAppendList({s1, "::", s2}); + s = stringAppendList({s1, "::", s2}); then s; case Absyn.AS(s1, rest) equation s2 = printExpStr(rest); - s = System.stringAppendList({s1, " as ", s2}); + s = stringAppendList({s1, " as ", s2}); then s; case Absyn.MATCHEXP(matchType, inputExp, localDecls, cases, comment) @@ -4391,7 +4391,7 @@ algorithm s3 = unparseStringCommentOption(comment); s4 = unparseLocalElements(3, localDecls); s5 = getStringList(cases, printCaseStr, "\n"); - s = System.stringAppendList({s1, " ", s2, s3, s4, s5, "\n\tend ", s1}); + s = stringAppendList({s1, " ", s2, s3, s4, s5, "\n\tend ", s1}); then s; case Absyn.VALUEBLOCK(els,Absyn.VALUEBLOCKALGORITHMS(algs),result) @@ -4479,7 +4479,7 @@ algorithm equation s1 = printExpStr(p); s4 = printExpStr(r); - s = System.stringAppendList({"\tcase (", s1, ") then ", s4, ";"}); + s = stringAppendList({"\tcase (", s1, ") then ", s4, ";"}); then s; case Absyn.CASE(p, _, l, eq, r, c) equation @@ -4487,19 +4487,19 @@ algorithm s2 = unparseLocalElements(3, l); s3 = unparseLocalEquations(3, eq); s4 = printExpStr(r); - s = System.stringAppendList({"\tcase (", s1, ")", s2, s3, "\t then ", s4, ";"}); + s = stringAppendList({"\tcase (", s1, ")", s2, s3, "\t then ", s4, ";"}); then s; case Absyn.ELSE({}, {}, r, c) equation s4 = printExpStr(r); - s = System.stringAppendList({"\telse then ", s4, ";"}); + s = stringAppendList({"\telse then ", s4, ";"}); then s; case Absyn.ELSE(l, eq, r, c) equation s2 = unparseLocalElements(3, l); s3 = unparseLocalEquations(3, eq); s4 = printExpStr(r); - s = System.stringAppendList({"\telse", s2, s3, "\t then ", s4, ";"}); + s = stringAppendList({"\telse", s2, s3, "\t then ", s4, ";"}); then s; end matchcontinue; end printCaseStr; @@ -4535,14 +4535,14 @@ algorithm equation s1 = selectString(b, "initial ", ""); s2 = unparseEquationitemStrLst(1, eqitems, ";\n"); - res = System.stringAppendList({s1,"equation ",s2}); + res = stringAppendList({s1,"equation ",s2}); then res; case (Absyn.C_ALGORITHMSECTION(boolean = b,algorithmItemLst = algitems)) equation s1 = selectString(b, "initial ", ""); s2 = unparseAlgorithmStrLst(1, algitems, ";\n"); - res = System.stringAppendList({s1,"algorithm ",s2}); + res = stringAppendList({s1,"algorithm ",s2}); then res; case (Absyn.C_ELEMENT(element = elt)) @@ -4580,7 +4580,7 @@ algorithm s1 = printExpStr(ec); s2 = printExpStr(ee); s3 = printElseifStr(rest); - str = System.stringAppendList({" elseif ",s1," then ",s2,s3}); + str = stringAppendList({" elseif ",s1," then ",s2,s3}); then str; end matchcontinue; @@ -5004,7 +5004,7 @@ algorithm case (NONE()) then ""; case (SOME(s)) equation - str = System.stringAppendList({" \"",s,"\""}); + str = stringAppendList({" \"",s,"\""}); then str; end matchcontinue; @@ -5026,7 +5026,7 @@ algorithm (); case (SOME(s)) equation - str = System.stringAppendList({"SOME(\"",s,"\")"}); + str = stringAppendList({"SOME(\"",s,"\")"}); Print.printBuf(str); then (); @@ -5089,7 +5089,7 @@ algorithm equation str1 = Absyn.pathString(path); str2 = unparseTypeSpecLst(typeSpecLst); - str3 = System.stringAppendList({str1,"<",str2,">"}); + str3 = stringAppendList({str1,"<",str2,">"}); s = getOptionStr(adim, printArraydimStr); str = stringAppend(str3, s); then @@ -5116,7 +5116,7 @@ algorithm equation str1 = unparseTypeSpec(x); str2 = unparseTypeSpecLst(rest); - str3 = System.stringAppendList({str1,", ",str2}); + str3 = stringAppendList({str1,", ",str2}); then str3; end matchcontinue; diff --git a/Compiler/Env.mo b/Compiler/Env.mo index 91908129aa6..0f7132dad5e 100644 --- a/Compiler/Env.mo +++ b/Compiler/Env.mo @@ -272,7 +272,7 @@ algorithm local String name; case(FRAME(optName = SOME(name))::_) equation - true = stringEqual(name, forScopeName); + true = stringEq(name, forScopeName); then true; case(_) then false; end matchcontinue; @@ -286,7 +286,7 @@ algorithm local String name; case(FRAME(optName = SOME(name))::_) equation - true = stringEqual(name, forIterScopeName); + true = stringEq(name, forIterScopeName); then true; case(_) then false; end matchcontinue; @@ -300,7 +300,7 @@ algorithm local String name; case(FRAME(optName = SOME(name))::env) equation - true = stringEqual(name, forScopeName); + true = stringEq(name, forScopeName); env = stripForLoopScope(env); then env; case(env) then env; @@ -994,7 +994,7 @@ algorithm s2 = printAvlTreeStr(httypes); s3 = printImportsStr(imps); encflag_str = Util.boolString(encflag); - res = System.stringAppendList( + res = stringAppendList( "FRAME: " :: sid :: " (enc=" :: encflag_str :: ") \nclasses and vars:\n=============\n" :: s1 :: " Types:\n======\n" :: s2 :: " Imports:\n=======\n" :: s3 :: {}); then @@ -1022,7 +1022,7 @@ algorithm equation s1 = printAvlTreeStr(ht); encflag_str = Util.boolString(encflag); - res = System.stringAppendList( + res = stringAppendList( {"FRAME: ",sid," (enc=",encflag_str, ") \nclasses and vars:\n=============\n",s1,"\n\n\n"}); then @@ -1031,7 +1031,7 @@ algorithm equation s1 = printAvlTreeStr(ht); encflag_str = Util.boolString(encflag); - res = System.stringAppendList( + res = stringAppendList( {"FRAME: unnamed (enc=",encflag_str, ") \nclasses and vars:\n=============\n",s1,"\n\n\n"}); then @@ -1063,7 +1063,7 @@ algorithm equation s1 = printFrameElementStr(("",e)); s2 = printImportsStr(rst); - res = System.stringAppendList({s1,", ",s2}); + res = stringAppendList({s1,", ",s2}); then res; end matchcontinue; @@ -1099,7 +1099,7 @@ algorithm var_str = Types.unparseVar(tv); frame_str = printFrameVarsStr(compframe); bind_str = Types.printBindingStr(bind); - res = System.stringAppendList( + res = stringAppendList( {"v:",n," ",s,"(",elt_str,") [",tp_str,"] {",var_str, "}, binding:",bind_str}); then @@ -1110,32 +1110,32 @@ algorithm elt_str = SCode.printElementStr(elt); tp_str = Types.unparseType(tp); var_str = Types.unparseVar(tv); - res = System.stringAppendList( + res = stringAppendList( {"v:",n," ",s,"(",elt_str,") [",tp_str,"] {",var_str, "}, compframe: []"}); then res; case ((n,VAR(instantiated = DAE.TYPES_VAR(binding = bnd),declaration = NONE(),instStatus = i,env = env))) equation - res = System.stringAppendList({"v:",n,"\n"}); + res = stringAppendList({"v:",n,"\n"}); then res; case ((n,CLASS(class_ = _))) equation - res = System.stringAppendList({"c:",n,"\n"}); + res = stringAppendList({"c:",n,"\n"}); then res; case ((n,TYPE(list_ = lst))) equation len = listLength(lst); lenstr = intString(len); - res = System.stringAppendList({"t:",n," (",lenstr,")\n"}); + res = stringAppendList({"t:",n," (",lenstr,")\n"}); then res; case ((n,IMPORT(import_ = imp))) equation s = Dump.unparseImportStr(imp); - res = System.stringAppendList({"imp:",s,"\n"}); + res = stringAppendList({"imp:",s,"\n"}); then res; end matchcontinue; @@ -1343,7 +1343,7 @@ algorithm // Simple name found in children, search for model from this scope. case (Absyn.IDENT(id1),path,CACHETREE(_,_,CACHETREE(id2,env2,children2)::_)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); //print("found (1) ");print(id); print("\n"); env = cacheGetEnv3(path,children2); then @@ -1360,7 +1360,7 @@ algorithm // for qualified name, found first matching identifier in child case (Absyn.QUALIFIED(id1,path2),path,CACHETREE(_,_,CACHETREE(id2,env2,children2)::_)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); //print("found qualified (1) ");print(id);print("\n"); env = cacheGetEnv2(path2,path,CACHETREE(id2,env2,children2)); then env; @@ -1386,13 +1386,13 @@ algorithm // found matching simple name case (Absyn.IDENT(id1),CACHETREE(id2,env,_)::_) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then env; // found matching qualified name case (Absyn.QUALIFIED(id1,path),CACHETREE(id2,_,children)::_) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); env = cacheGetEnv3(path,children); then env; @@ -1422,7 +1422,7 @@ algorithm case (Absyn.IDENT(id1),(tree as CACHETREE(globalID,globalEnv,CACHETREE(id2,oldEnv,children)::children2)),env) equation // print(id);print(" already added\n"); - true = stringEqual(id1, id2); + true = stringEq(id1, id2); // shouldn't we replace it? // Debug.fprintln("env", ">>>> Env.cacheAdd - already in cache: " +& printEnvPathStr(env)); then tree; @@ -1470,14 +1470,14 @@ algorithm // qualified name, found matching case(Absyn.QUALIFIED(id1,path),CACHETREE(id2,env2,children2)::children,env) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); children2 = cacheAddEnv2(path,children2,env); then CACHETREE(id2,env2,children2)::children; // simple name, found matching case (Absyn.IDENT(id1),CACHETREE(id2,env2,children2)::children,env) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); // Debug.fprintln("env", ">>>> Env.cacheAdd - already in cache: " +& printEnvPathStr(env)); //print("single name, found matching\n"); then CACHETREE(id2,env2,children2)::children; @@ -1524,7 +1524,7 @@ algorithm equation SOME(ENVCACHE(tree)) = arr[1]; s = printCacheTreeStr(tree,1); - str = System.stringAppendList({"Cache:\n",s,"\n"}); + str = stringAppendList({"Cache:\n",s,"\n"}); s2 = DAEDump.dumpFunctionNamesStr(arrayGet(ef,1)); str = str +& "\nInstantiated funcs: " +& s2 +&"\n"; then str; @@ -1547,8 +1547,8 @@ algorithm case (CACHETREE(id,_,children),indent) equation s = Util.stringDelimitList(Util.listMap1(children,printCacheTreeStr,indent+1),"\n"); - s1 = System.stringAppendList(Util.listFill(" ",indent)); - str = System.stringAppendList({s1,id,"\n",s}); + s1 = stringAppendList(Util.listFill(" ",indent)); + str = stringAppendList({s1,id,"\n",s}); then str; end matchcontinue; end printCacheTreeStr; @@ -1679,7 +1679,7 @@ algorithm // replace this node case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),height=h,left = left,right = right),key,value) equation - 0 = System.strcmp(key,rkey); // equal + 0 = stringCompare(key,rkey); // equal // inactive for now, but we should check if we don't replace a class with a var or vice-versa! // checkValueReplacementCompatible(rval, value); bt = balance(AVLTREENODE(SOME(AVLTREEVALUE(rkey,value)),h,left,right)); @@ -1689,7 +1689,7 @@ algorithm // insert to right case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),height=h,left = left,right = (right)),key,value) equation - 1 = System.strcmp(key,rkey); // bigger + 1 = stringCompare(key,rkey); // bigger t = createEmptyAvlIfNone(right); t_1 = avlTreeAdd(t, key, value); bt = balance(AVLTREENODE(SOME(AVLTREEVALUE(rkey,rval)),h,left,SOME(t_1))); @@ -1699,13 +1699,13 @@ algorithm // insert to left subtree case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),height=h,left = left ,right = right),key,value) equation - -1 = System.strcmp(key,rkey); // smaller + -1 = stringCompare(key,rkey); // smaller t = createEmptyAvlIfNone(left); t_1 = avlTreeAdd(t, key, value); bt = balance(AVLTREENODE(SOME(AVLTREEVALUE(rkey,rval)),h,SOME(t_1),right)); then bt; - + case (_,_,_) equation print("avlTreeAdd failed\n"); @@ -2026,7 +2026,7 @@ algorithm // hash func Search to the right case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),left = left,right = right),key) equation - true = stringEqual(rkey, key); + 0 = stringCompare(rkey, key); then rval; @@ -2034,7 +2034,7 @@ algorithm case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),left = left,right = SOME(right)),key) local AvlTree right; equation - true = System.strcmp(key,rkey) > 0; + 1 = stringCompare(key,rkey); res = avlTreeGet(right, key); then res; @@ -2043,7 +2043,7 @@ algorithm case (AVLTREENODE(value = SOME(AVLTREEVALUE(rkey,rval)),left = SOME(left),right = right),key) local AvlTree left; equation - false = System.strcmp(key,rkey) > 0; + -1 = stringCompare(key,rkey); res = avlTreeGet(left, key); then res; diff --git a/Compiler/Expression.mo b/Compiler/Expression.mo index e68b4d10c04..c6a3e545d30 100644 --- a/Compiler/Expression.mo +++ b/Compiler/Expression.mo @@ -2960,7 +2960,7 @@ algorithm false = ComponentReference.crefHasScalarSubscripts(cr); name = ComponentReference.printComponentRefStr(cr); false = Util.stringContainsChar(name,"$"); - id = System.stringAppendList({"$",id}); + id = stringAppendList({"$",id}); id = Util.stringReplaceChar(id,".","$p"); cr_1 = ComponentReference.makeCrefIdent(id,t2,ssl); then @@ -3953,7 +3953,7 @@ public function identEqual input Ident inIdent2; output Boolean outBoolean; algorithm - outBoolean := stringEqual(inIdent1, inIdent2); + outBoolean := stringEq(inIdent1, inIdent2); end identEqual; public function isRange @@ -4243,7 +4243,7 @@ algorithm case(DAE.COMPLEX_VAR(s1,t1)::vars1,DAE.COMPLEX_VAR(s2,t2)::vars2) equation //print(" verify subvars: " +& s1 +& " and " +& s2 +& " to go: " +& intString(listLength(vars1)) +& " , " +& intString(listLength(vars2)) +& "\n"); - true = stringEqual(s1,s2); + true = stringEq(s1,s2); //print(" types: " +& ExpressionDump.typeString(t1) +& " and " +& ExpressionDump.typeString(t2) +& "\n"); true = equalTypes(t1,t2); //print(s1 +& " and " +& s2 +& " EQUAL \n\n"); @@ -4974,7 +4974,7 @@ algorithm // check for pointer equality first, if they point to the same thing, they are equal case (inExp1,inExp2) equation - true = System.refEqual(inExp1,inExp2); + true = referenceEq(inExp1,inExp2); then true; @@ -4989,7 +4989,7 @@ algorithm case (DAE.SCONST(string = c1),DAE.SCONST(string = c2)) local Ident c1,c2; equation - true = stringEqual(c1, c2); + true = stringEq(c1, c2); then true; // booleans @@ -5165,7 +5165,7 @@ algorithm false; case (DAE.REDUCTION(path = path1,expr = e1,ident = id1,range = r1),DAE.REDUCTION(path = path2,expr = e2,ident = id2,range = r2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); b1 = ModUtil.pathEqual(path1, path2); b2 = expEqual(e1, e2); b3 = expEqual(r1, r2); @@ -5319,7 +5319,7 @@ algorithm true = RTOpts.debugFlag("failtrace"); Debug.fprint("failtrace", "- Expression.expContains failed\n"); s = ExpressionDump.printExpStr(e); - str = System.stringAppendList({"exp = ",s,"\n"}); + str = stringAppendList({"exp = ",s,"\n"}); Debug.fprint("failtrace", str); then fail(); diff --git a/Compiler/ExpressionDump.mo b/Compiler/ExpressionDump.mo index 4f07143b82c..84055599a3e 100644 --- a/Compiler/ExpressionDump.mo +++ b/Compiler/ExpressionDump.mo @@ -114,7 +114,7 @@ algorithm ss = Util.listMap(dims, dimensionString); s1 = Util.stringDelimitListNonEmptyElts(ss, ", "); ts = typeString(t); - res = System.stringAppendList({"/tp:",ts,"[",s1,"]/"}); + res = stringAppendList({"/tp:",ts,"[",s1,"]/"}); then res; case(DAE.ET_COMPLEX(varLst=vars,complexClassType=ci)) @@ -237,28 +237,28 @@ algorithm case (DAE.ADD(ty = t)) equation ts = typeString(t); - s = System.stringAppendList({" +<", ts, "> "}); + s = stringAppendList({" +<", ts, "> "}); then s; case (DAE.SUB(ty = t)) equation ts = typeString(t); - s = System.stringAppendList({" -<", ts, "> "}); + s = stringAppendList({" -<", ts, "> "}); then s; case (DAE.MUL(ty = t)) equation ts = typeString(t); - s = System.stringAppendList({" *<", ts, "> "}); + s = stringAppendList({" *<", ts, "> "}); then s; case (DAE.DIV(ty = t)) equation ts = typeString(t); - s = System.stringAppendList({" /<", ts, "> "}); + s = stringAppendList({" /<", ts, "> "}); then s; @@ -419,7 +419,7 @@ algorithm equation s = r(h); srest = printListStr(t, r, sep); - s = System.stringAppendList({s, sep, srest}); + s = stringAppendList({s, sep, srest}); then s; end matchcontinue; @@ -488,7 +488,7 @@ public function printExpListStrNoSpace input list expl; output String res; algorithm - res := System.stringAppendList(Util.listMap(expl,printExpStr)); + res := stringAppendList(Util.listMap(expl,printExpStr)); end printExpListStrNoSpace; public function printOptExpStr " @@ -570,7 +570,7 @@ algorithm case (DAE.SCONST(string = s), stringDelimiter, _, _) equation - s = System.stringAppendList({stringDelimiter, s, stringDelimiter}); + s = stringAppendList({stringDelimiter, s, stringDelimiter}); then s; @@ -606,7 +606,7 @@ algorithm p2 = expPriority(e2); s1_1 = parenthesize(s1, p1, p,false); s2_1 = parenthesize(s2, p2, p,true); - s = System.stringAppendList({s1_1, sym, s2_1}); + s = stringAppendList({s1_1, sym, s2_1}); then s; @@ -631,7 +631,7 @@ algorithm p2 = expPriority(e2); s1_1 = parenthesize(s1, p1, p,false); s2_1 = parenthesize(s2, p2, p,true); - s = System.stringAppendList({s1_1, sym, s2_1}); + s = stringAppendList({s1_1, sym, s2_1}); then s; @@ -656,7 +656,7 @@ algorithm p2 = expPriority(e2); s1_1 = parenthesize(s1, p1, p,false); s2_1 = parenthesize(s2, p1, p,true); - s = System.stringAppendList({s1_1, sym, s2_1}); + s = stringAppendList({s1_1, sym, s2_1}); then s; @@ -672,7 +672,7 @@ algorithm cs_1 = parenthesize(cs, pc, p,false); ts_1 = parenthesize(ts, pt, p,false); fs_1 = parenthesize(fs, pf, p,false); - str = System.stringAppendList({"if ",cs_1," then ",ts_1," else ",fs_1}); + str = stringAppendList({"if ",cs_1," then ",ts_1," else ",fs_1}); then str; @@ -687,7 +687,7 @@ algorithm fs = Absyn.pathString(fcn); argstr = Util.stringDelimitList( Util.listMap3(args, printExp2Str, stringDelimiter, opcreffunc, opcallfunc), ","); - s = System.stringAppendList({fs, "(", argstr, ")"}); + s = stringAppendList({fs, "(", argstr, ")"}); then s; @@ -696,7 +696,7 @@ algorithm fs = Absyn.pathString(fcn); argstr = Util.stringDelimitList( Util.listMap3(args, printExp2Str, stringDelimiter, opcreffunc, opcallfunc), ","); - s = System.stringAppendList({"function ", fs, "(", argstr, ")"}); + s = stringAppendList({"function ", fs, "(", argstr, ")"}); then s; @@ -706,7 +706,7 @@ algorithm // s3 = typeString(tp); // adrpo: not used! s = Util.stringDelimitList( Util.listMap3(es, printExp2Str, stringDelimiter, opcreffunc, opcallfunc), ","); - s = System.stringAppendList({"{", s, "}"}); + s = stringAppendList({"{", s, "}"}); then s; @@ -714,7 +714,7 @@ algorithm equation s = Util.stringDelimitList( Util.listMap3(es, printExp2Str, stringDelimiter, opcreffunc, opcallfunc), ","); - s = System.stringAppendList({"(", s, ")"}); + s = stringAppendList({"(", s, ")"}); then s; @@ -725,7 +725,7 @@ algorithm // s3 = typeString(tp); // adrpo: not used! s = Util.stringDelimitList( Util.listMap1(es, printRowStr, stringDelimiter), "},{"); - s = System.stringAppendList({"{{",s,"}}"}); + s = stringAppendList({"{{",s,"}}"}); then s; @@ -738,7 +738,7 @@ algorithm pstop = expPriority(stop); s1_1 = parenthesize(s1, pstart, p,false); s3_1 = parenthesize(s3, pstop, p,false); - s = System.stringAppendList({s1_1, ":", s3_1}); + s = stringAppendList({s1_1, ":", s3_1}); then s; @@ -754,7 +754,7 @@ algorithm s1_1 = parenthesize(s1, pstart, p,false); s3_1 = parenthesize(s3, pstop, p,false); s2_1 = parenthesize(s2, pstep, p,false); - s = System.stringAppendList({s1_1,":",s2_1,":",s3_1}); + s = stringAppendList({s1_1,":",s2_1,":",s3_1}); then s; @@ -778,7 +778,7 @@ algorithm case (DAE.CAST(ty = DAE.ET_REAL(),exp = e), _, _, _) equation s = printExp2Str(e, stringDelimiter, opcreffunc, opcallfunc); - s_2 = System.stringAppendList({"Real(",s,")"}); + s_2 = stringAppendList({"Real(",s,")"}); then s_2; @@ -786,7 +786,7 @@ algorithm equation str = typeString(tp); s = printExp2Str(e, stringDelimiter, opcreffunc, opcallfunc); - res = System.stringAppendList({"DAE.CAST(",str,", ",s,")"}); + res = stringAppendList({"DAE.CAST(",str,", ",s,")"}); then res; @@ -807,14 +807,14 @@ algorithm equation crstr = printExp2Str(cr, stringDelimiter, opcreffunc, opcallfunc); dimstr = printExp2Str(dim, stringDelimiter, opcreffunc, opcallfunc); - str = System.stringAppendList({"size(",crstr,",",dimstr,")"}); + str = stringAppendList({"size(",crstr,",",dimstr,")"}); then str; case (DAE.SIZE(exp = cr,sz = NONE()), _, _, _) equation crstr = printExp2Str(cr, stringDelimiter, opcreffunc, opcallfunc); - str = System.stringAppendList({"size(",crstr,")"}); + str = stringAppendList({"size(",crstr,")"}); then str; @@ -823,7 +823,7 @@ algorithm fs = Absyn.pathString(fcn); expstr = printExp2Str(exp, stringDelimiter, opcreffunc, opcallfunc); iterstr = printExp2Str(iterexp, stringDelimiter, opcreffunc, opcallfunc); - str = System.stringAppendList({"",fs,"(",expstr," for ",id," in ",iterstr,")"}); + str = stringAppendList({"",fs,"(",expstr," for ",id," in ",iterstr,")"}); then str; @@ -839,7 +839,7 @@ algorithm local list es; equation s = Util.stringDelimitList(Util.listMap3(es,printExp2Str, stringDelimiter, opcreffunc, opcallfunc),","); - s = System.stringAppendList({"List(", s, ")"}); + s = stringAppendList({"List(", s, ")"}); then s; @@ -848,7 +848,7 @@ algorithm equation s1 = printExp2Str(e1, stringDelimiter, opcreffunc, opcallfunc); s2 = printExp2Str(e2, stringDelimiter, opcreffunc, opcallfunc); - s_2 = System.stringAppendList({"listCons(", s1, ",", s2, ")"}); + s_2 = stringAppendList({"listCons(", s1, ",", s2, ")"}); then s_2; @@ -857,7 +857,7 @@ algorithm case (DAE.META_OPTION(SOME(e1)), _, _, _) equation s1 = printExp2Str(e1, stringDelimiter, opcreffunc, opcallfunc); - s_1 = System.stringAppendList({"SOME(",s1,")"}); + s_1 = stringAppendList({"SOME(",s1,")"}); then s_1; @@ -867,7 +867,7 @@ algorithm fs = Absyn.pathString(fcn); argstr = Util.stringDelimitList( Util.listMap3(args,printExp2Str, stringDelimiter, opcreffunc, opcallfunc),","); - s = System.stringAppendList({fs, "(", argstr, ")"}); + s = stringAppendList({fs, "(", argstr, ")"}); then s; @@ -1034,7 +1034,7 @@ algorithm case (DAE.SCONST(string = s)) equation - s = System.stringAppendList({"\"", s, "\""}); + s = stringAppendList({"\"", s, "\""}); then Graphviz.LNODE("SCONST",{s},{},{}); @@ -1124,7 +1124,7 @@ algorithm local list>> es; equation s = Util.stringDelimitList(Util.listMap1(es, printRowStr, "\""), "},{"); - s = System.stringAppendList({"{{", s, "}}"}); + s = stringAppendList({"{{", s, "}}"}); then Graphviz.LNODE("MATRIX",{s},{},{}); @@ -1156,7 +1156,7 @@ algorithm equation ct = dumpExpGraphviz(e); istr = intString(i); - s = System.stringAppendList({"[",istr,"]"}); + s = stringAppendList({"[",istr,"]"}); then Graphviz.LNODE("ASUB",{s},{},{ct}); @@ -1207,7 +1207,7 @@ algorithm case (DAE.END(),level) equation gen_str = genStringNTime(" |", level); - res_str = System.stringAppendList({gen_str,"END","\n"}); + res_str = stringAppendList({gen_str,"END","\n"}); then res_str; @@ -1215,7 +1215,7 @@ algorithm equation gen_str = genStringNTime(" |", level); s = intString(x); - res_str = System.stringAppendList({gen_str,"ICONST ",s,"\n"}); + res_str = stringAppendList({gen_str,"ICONST ",s,"\n"}); then res_str; @@ -1224,28 +1224,28 @@ algorithm equation gen_str = genStringNTime(" |", level); s = realString(x); - res_str = System.stringAppendList({gen_str,"RCONST ",s,"\n"}); + res_str = stringAppendList({gen_str,"RCONST ",s,"\n"}); then res_str; case (DAE.SCONST(string = s),level) /* Graphviz.LNODE(\"SCONST\",{s\'\'},{},{}) */ equation gen_str = genStringNTime(" |", level); - res_str = System.stringAppendList({gen_str,"SCONST ","\"", s,"\"\n"}); + res_str = stringAppendList({gen_str,"SCONST ","\"", s,"\"\n"}); then res_str; case (DAE.BCONST(bool = false),level) /* Graphviz.LNODE(\"BCONST\",{\"false\"},{},{}) */ equation gen_str = genStringNTime(" |", level); - res_str = System.stringAppendList({gen_str,"BCONST ","false","\n"}); + res_str = stringAppendList({gen_str,"BCONST ","false","\n"}); then res_str; case (DAE.BCONST(bool = true),level) /* Graphviz.LNODE(\"BCONST\",{\"true\"},{},{}) */ equation gen_str = genStringNTime(" |", level); - res_str = System.stringAppendList({gen_str,"BCONST ","true","\n"}); + res_str = stringAppendList({gen_str,"BCONST ","true","\n"}); then res_str; @@ -1254,7 +1254,7 @@ algorithm gen_str = genStringNTime(" |", level); s = /*ComponentReference.printComponentRefStr*/ComponentReference.debugPrintComponentRefTypeStr(c); tpStr= typeString(ty); - res_str = System.stringAppendList({gen_str,"CREF ",s," CREFTYPE:",tpStr,"\n"}); + res_str = stringAppendList({gen_str,"CREF ",s," CREFTYPE:",tpStr,"\n"}); then res_str; @@ -1271,7 +1271,7 @@ algorithm str = typeString(tp); lt = dumpExpStr(e1, new_level1); rt = dumpExpStr(e2, new_level2); - res_str = System.stringAppendList({gen_str,"BINARY ",sym," ",str,"\n",lt,rt,""}); + res_str = stringAppendList({gen_str,"BINARY ",sym," ",str,"\n",lt,rt,""}); then res_str; @@ -1283,7 +1283,7 @@ algorithm sym = unaryopSymbol(op); ct = dumpExpStr(e, new_level1); str = "expType:"+&typeString(Expression.typeof(e))+&" optype:"+&typeString(Expression.typeofOp(op))+&"\n"; - res_str = System.stringAppendList({gen_str,"UNARY ",sym," ",str,"\n",ct,""}); + res_str = stringAppendList({gen_str,"UNARY ",sym," ",str,"\n",ct,""}); then res_str; @@ -1295,7 +1295,7 @@ algorithm sym = lbinopSymbol(op); lt = dumpExpStr(e1, new_level1); rt = dumpExpStr(e2, new_level2); - res_str = System.stringAppendList({gen_str,"LBINARY ",sym,"\n",lt,rt,""}); + res_str = stringAppendList({gen_str,"LBINARY ",sym,"\n",lt,rt,""}); then res_str; @@ -1305,7 +1305,7 @@ algorithm new_level1 = level + 1; sym = lunaryopSymbol(op); ct = dumpExpStr(e, new_level1); - res_str = System.stringAppendList({gen_str,"LUNARY ",sym,"\n",ct,""}); + res_str = stringAppendList({gen_str,"LUNARY ",sym,"\n",ct,""}); then res_str; @@ -1317,7 +1317,7 @@ algorithm sym = relopSymbol(op); lt = dumpExpStr(e1, new_level1); rt = dumpExpStr(e2, new_level2); - res_str = System.stringAppendList({gen_str,"RELATION ",sym,"\n",lt,rt,""}); + res_str = stringAppendList({gen_str,"RELATION ",sym,"\n",lt,rt,""}); then res_str; @@ -1331,7 +1331,7 @@ algorithm ct = dumpExpStr(c, new_level1); tt = dumpExpStr(t, new_level2); ft = dumpExpStr(f, new_level3); - res_str = System.stringAppendList({gen_str,"IFEXP ","\n",ct,tt,ft,""}); + res_str = stringAppendList({gen_str,"IFEXP ","\n",ct,tt,ft,""}); then res_str; @@ -1341,8 +1341,8 @@ algorithm fs = Absyn.pathString(fcn); new_level1 = level + 1; argnodes = Util.listMap1(args, dumpExpStr, new_level1); - argnodes_1 = System.stringAppendList(argnodes); - res_str = System.stringAppendList({gen_str,"CALL ",fs,"\n",argnodes_1,""}); + argnodes_1 = stringAppendList(argnodes); + res_str = stringAppendList({gen_str,"CALL ",fs,"\n",argnodes_1,""}); then res_str; @@ -1352,8 +1352,8 @@ algorithm fs = Absyn.pathString(fcn); new_level1 = level + 1; argnodes = Util.listMap1(args, dumpExpStr, new_level1); - argnodes_1 = System.stringAppendList(argnodes); - res_str = System.stringAppendList({gen_str,"CALL ",fs,"\n",argnodes_1,""}); + argnodes_1 = stringAppendList(argnodes); + res_str = stringAppendList({gen_str,"CALL ",fs,"\n",argnodes_1,""}); then res_str; @@ -1363,10 +1363,10 @@ algorithm gen_str = genStringNTime(" |", level); new_level1 = level + 1; nodes = Util.listMap1(es, dumpExpStr, new_level1); - nodes_1 = System.stringAppendList(nodes); + nodes_1 = stringAppendList(nodes); s = Util.boolString(b); tpStr = typeString(tp); - res_str = System.stringAppendList({gen_str,"ARRAY scalar:",s," tp: ",tpStr,"\n",nodes_1}); + res_str = stringAppendList({gen_str,"ARRAY scalar:",s," tp: ",tpStr,"\n",nodes_1}); then res_str; @@ -1375,8 +1375,8 @@ algorithm gen_str = genStringNTime(" |", level); new_level1 = level + 1; nodes = Util.listMap1(es, dumpExpStr, new_level1); - nodes_1 = System.stringAppendList(nodes); - res_str = System.stringAppendList({gen_str,"TUPLE ",nodes_1,"\n"}); + nodes_1 = stringAppendList(nodes); + res_str = stringAppendList({gen_str,"TUPLE ",nodes_1,"\n"}); then res_str; @@ -1385,7 +1385,7 @@ algorithm equation gen_str = genStringNTime(" |", level); s = Util.stringDelimitList(Util.listMap1(es, printRowStr, "\""), "},{"); - res_str = System.stringAppendList({gen_str,"MATRIX ","\n","{{",s,"}}","\n"}); + res_str = stringAppendList({gen_str,"MATRIX ","\n","{{",s,"}}","\n"}); then res_str; @@ -1397,7 +1397,7 @@ algorithm t1 = dumpExpStr(start, new_level1); t2 = ":"; t3 = dumpExpStr(stop, new_level2); - res_str = System.stringAppendList({gen_str,"RANGE ","\n",t1,t2,t3,""}); + res_str = stringAppendList({gen_str,"RANGE ","\n",t1,t2,t3,""}); then res_str; @@ -1410,7 +1410,7 @@ algorithm t1 = dumpExpStr(start, new_level1); t2 = dumpExpStr(step, new_level2); t3 = dumpExpStr(stop, new_level3); - res_str = System.stringAppendList({gen_str,"RANGE ","\n",t1,t2,t3,""}); + res_str = stringAppendList({gen_str,"RANGE ","\n",t1,t2,t3,""}); then res_str; @@ -1420,7 +1420,7 @@ algorithm new_level1 = level + 1; tystr = typeString(ty); ct = dumpExpStr(e, new_level1); - res_str = System.stringAppendList({gen_str,"CAST ","\n",ct,""}); + res_str = stringAppendList({gen_str,"CAST ","\n",ct,""}); then res_str; @@ -1431,8 +1431,8 @@ algorithm new_level1 = level + 1; ct = dumpExpStr(e, new_level1); istr = intString(i); - s = System.stringAppendList({"[",istr,"]"}); - res_str = System.stringAppendList({gen_str,"ASUB ",s,"\n",ct,""}); + s = stringAppendList({"[",istr,"]"}); + res_str = stringAppendList({gen_str,"ASUB ",s,"\n",ct,""}); then res_str; @@ -1443,7 +1443,7 @@ algorithm new_level2 = level + 1; crt = dumpExpStr(cr, new_level1); dimt = dumpExpStr(dim, new_level2); - res_str = System.stringAppendList({gen_str,"SIZE ","\n",crt,dimt,""}); + res_str = stringAppendList({gen_str,"SIZE ","\n",crt,dimt,""}); then res_str; @@ -1452,7 +1452,7 @@ algorithm gen_str = genStringNTime(" |", level); new_level1 = level + 1; crt = dumpExpStr(cr, new_level1); - res_str = System.stringAppendList({gen_str,"SIZE ","\n",crt,""}); + res_str = stringAppendList({gen_str,"SIZE ","\n",crt,""}); then res_str; @@ -1464,14 +1464,14 @@ algorithm fs = Absyn.pathString(fcn); expt = dumpExpStr(exp, new_level1); itert = dumpExpStr(iterexp, new_level2); - res_str = System.stringAppendList({gen_str,"REDUCTION ","\n",expt,itert,""}); + res_str = stringAppendList({gen_str,"REDUCTION ","\n",expt,itert,""}); then res_str; case (_,level) /* Graphviz.NODE(\"#UNKNOWN EXPRESSION# ----eeestr \",{},{}) */ equation gen_str = genStringNTime(" |", level); - res_str = System.stringAppendList({gen_str," UNKNOWN EXPRESSION ","\n"}); + res_str = stringAppendList({gen_str," UNKNOWN EXPRESSION ","\n"}); then res_str; end matchcontinue; @@ -1535,7 +1535,7 @@ algorithm equation s = printArraySizes(lst); s2 = intString(x); - s = System.stringAppendList({s2, s}); + s = stringAppendList({s2, s}); then s; case(_ :: lst) equation @@ -1591,7 +1591,7 @@ algorithm str := matchcontinue(inExp) case(DAE.CREF(cr,_)) then ComponentReference.debugPrintComponentRefTypeStr(cr); case(DAE.ARRAY(_,_,expl)) equation - s1 = "{" +& System.stringAppendList(Util.listMap(expl,debugPrintComponentRefExp)) +& "}"; + s1 = "{" +& stringAppendList(Util.listMap(expl,debugPrintComponentRefExp)) +& "}"; then s1; case(inExp) then printExpStr(inExp); // when not cref, print expression anyways since it is used for some debugging. @@ -2154,14 +2154,14 @@ algorithm case (str,pparent,pexpr,rightOpParenthesis) equation (pparent > pexpr) = true; - str_1 = System.stringAppendList({"(",str,")"}); + str_1 = stringAppendList({"(",str,")"}); then str_1; // If priorites are equal and str is from right hand side, parenthesize to make left associative case (str,pparent,pexpr,true) equation (pparent == pexpr) = true; - str_1 = System.stringAppendList({"(",str,")"}); + str_1 = stringAppendList({"(",str,")"}); then str_1; case (str,_,_,_) then str; diff --git a/Compiler/ExpressionSimplify.mo b/Compiler/ExpressionSimplify.mo index 82276e69e81..75074ff14bb 100644 --- a/Compiler/ExpressionSimplify.mo +++ b/Compiler/ExpressionSimplify.mo @@ -515,7 +515,7 @@ algorithm case(DAE.CALL(path=path,expLst={e})) equation Builtin.isLog(path); - r = System.log(Expression.getRealConst(e)); + r = realLog(Expression.getRealConst(e)); then DAE.RCONST(r); diff --git a/Compiler/HashTable2.mo b/Compiler/HashTable2.mo index 7c03b80852d..d514725fc27 100644 --- a/Compiler/HashTable2.mo +++ b/Compiler/HashTable2.mo @@ -65,7 +65,7 @@ public function hashFunc String crstr; algorithm crstr := ComponentReference.printComponentRefStr(cr); - res := System.hash(crstr); + res := stringHashDjb2(crstr); end hashFunc; public function emptyHashTable diff --git a/Compiler/HashTable4.mo b/Compiler/HashTable4.mo index a4d13f895f5..44c3ea1e637 100644 --- a/Compiler/HashTable4.mo +++ b/Compiler/HashTable4.mo @@ -65,7 +65,7 @@ protected function hashFunc String crstr; algorithm crstr := ExpressionDump.printExpStr(cr); - res := System.hash(crstr); + res := stringHashDjb2(crstr); end hashFunc; public function emptyHashTable diff --git a/Compiler/HashTable5.mo b/Compiler/HashTable5.mo index 8e7b70cf426..3fb43b96327 100644 --- a/Compiler/HashTable5.mo +++ b/Compiler/HashTable5.mo @@ -64,7 +64,7 @@ protected function hashFunc String crstr; algorithm crstr := Dump.printComponentRefStr(cr); - res := System.hash(crstr); + res := stringHashDjb2(crstr); end hashFunc; public function emptyHashTable diff --git a/Compiler/HashTable6.mo b/Compiler/HashTable6.mo index 1e9ec5234e2..1bec9f3ecf0 100644 --- a/Compiler/HashTable6.mo +++ b/Compiler/HashTable6.mo @@ -65,7 +65,7 @@ protected function hashFunc String crstr; algorithm crstr := printKey(cr); - res := System.hash(crstr); + res := stringHashDjb2(crstr); end hashFunc; protected function keyEqual diff --git a/Compiler/HashTableStringToPath.mo b/Compiler/HashTableStringToPath.mo index 84f05d4c782..5f219680a9d 100644 --- a/Compiler/HashTableStringToPath.mo +++ b/Compiler/HashTableStringToPath.mo @@ -64,7 +64,7 @@ public function emptyHashTable " output HashTable hashTable; algorithm - hashTable := BaseHashTable.emptyHashTableWork(1000,100,(System.hash,stringEqual,Util.id,Absyn.pathString)); + hashTable := BaseHashTable.emptyHashTableWork(1000,100,(stringHashDjb2,stringEq,Util.id,Absyn.pathString)); end emptyHashTable; public function emptyHashTableSized @@ -75,7 +75,7 @@ public function emptyHashTableSized input Integer size; output HashTable hashTable; algorithm - hashTable := BaseHashTable.emptyHashTableWork(size,size/10,(System.hash,stringEqual,Util.id,Absyn.pathString)); + hashTable := BaseHashTable.emptyHashTableWork(size,size/10,(stringHashDjb2,stringEq,Util.id,Absyn.pathString)); end emptyHashTableSized; end HashTableStringToPath; diff --git a/Compiler/InnerOuter.mo b/Compiler/InnerOuter.mo index 5249ebb1145..7aefc3bdf5a 100644 --- a/Compiler/InnerOuter.mo +++ b/Compiler/InnerOuter.mo @@ -541,7 +541,7 @@ algorithm case(DAE.CREF_QUAL(id1,_,subs1,cr1),DAE.CREF_QUAL(id2,_,subs2,cr2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); (cr11,cr22) = stripCommonCrefPart(cr1,cr2); then (cr11,cr22); @@ -1978,7 +1978,7 @@ public function hashFunc input Key k; output Integer res; algorithm - res := System.hash(ComponentReference.printComponentRefStr(k)); + res := stringHashDjb2(ComponentReference.printComponentRefStr(k)); end hashFunc; public function keyEqual diff --git a/Compiler/Inst.mo b/Compiler/Inst.mo index 05d0c43eafd..ef3d9851136 100644 --- a/Compiler/Inst.mo +++ b/Compiler/Inst.mo @@ -732,7 +732,7 @@ algorithm // The class and the path match => instantiate the class. case (cache,env,ih,((c as SCode.CLASS(name = name)) :: cs),Absyn.IDENT(name = name2)) equation - true = stringEqual(name, name2); + true = stringEq(name, name2); (cache,env_1,ih,_,dae,_,_,_,_,graph) = instClass(cache,env, ih, UnitAbsynBuilder.emptyInstStore(), DAE.NOMOD(), Prefix.NOPRE(), Connect.emptySet, c, {}, false, TOP_CALL(), ConnectionGraph.EMPTY) "impl" ; @@ -750,8 +750,8 @@ algorithm // The class does not match the path, and no more classes left => error. case (cache,env,ih,((c as SCode.CLASS(name = name)) :: {}),(path as Absyn.IDENT(name = name2))) equation - false = stringEqual(name, name2); - false = stringEqual(name2, ""); + false = stringEq(name, name2); + false = stringEq(name2, ""); Error.addMessage(Error.LOAD_MODEL_ERROR, {name2}); then fail(); @@ -759,7 +759,7 @@ algorithm // The class does not match the path, but there are more classes left => continue searching for a matching class. case (cache,env,ih,((c as SCode.CLASS(name = name)) :: cs),(path as Absyn.IDENT(name = name2))) equation - false = stringEqual(name, name2); + false = stringEq(name, name2); _::_ = cs; // non empty list (cache,env,ih,dae) = instClassInProgram(cache, env, ih, cs, path); then @@ -803,7 +803,7 @@ algorithm case (cache,env,ih,((c as SCode.CLASS(name = name)) :: cs),Absyn.IDENT(name = name2)) local String s; equation - true = stringEqual(name, name2); + true = stringEq(name, name2); env = Env.extendFrameC(env, c); (cache,env_1,ih,dae) = implicitInstantiation(cache,env,ih, DAE.NOMOD(), Prefix.NOPRE(), Connect.emptySet, c, {}) ; then @@ -811,7 +811,7 @@ algorithm case (cache,env,ih,((c as SCode.CLASS(name = name)) :: cs),(path as Absyn.IDENT(name = name2))) equation - false = stringEqual(name, name2); + false = stringEq(name, name2); (cache,env,ih,dae) = instClassInProgramImplicit(cache, env, ih, cs, path); then (cache,env,ih,dae); @@ -853,7 +853,7 @@ algorithm case (cache,env,ih,((c as SCode.CLASS(name = name1)) :: cs),Absyn.IDENT(name = name2)) local String s; equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); env = Env.extendFrameC(env, c); (cache,env_1,ih) = implicitFunctionInstantiation(cache,env,ih, DAE.NOMOD(), Prefix.NOPRE(), Connect.emptySet, c, {}); then @@ -861,7 +861,7 @@ algorithm case (cache,env,ih,((c as SCode.CLASS(name = name1)) :: cs),(path as Absyn.IDENT(name = name2))) equation - false = stringEqual(name1, name2); + false = stringEq(name1, name2); (cache,env,ih) = instFunctionInProgramImplicit(cache,env,ih, cs, path); then (cache,env,ih); @@ -899,7 +899,7 @@ algorithm case (cache,env,ih,((c as SCode.CLASS(name = name1)) :: cs),(ref as Absyn.IDENT(name = name2))) equation - false = stringEqual(name1, name2); + false = stringEq(name1, name2); (cache,env_1,ih,dae1) = instClassDecl(cache,env,ih, DAE.NOMOD(), Prefix.NOPRE(), Connect.emptySet, c, {}) ; (cache,env_2,ih,dae2) = instClassDecls(cache,env_1,ih, cs, ref); dae = DAEUtil.joinDaes(dae1, dae2); @@ -908,14 +908,14 @@ algorithm case (cache,env,ih,((c as SCode.CLASS(name = name1)) :: cs),(ref as Absyn.IDENT(name = name2))) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); (cache,env_1,ih,dae2) = instClassDecls(cache,env,ih, cs, ref); then (cache,env_1,ih,dae2); case (cache,env,ih,((c as SCode.CLASS(name = name1)) :: cs),(ref as Absyn.QUALIFIED(name = name2))) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); (cache,env_1,ih,dae1) = instClassDecl(cache,env,ih, DAE.NOMOD(), Prefix.NOPRE(), Connect.emptySet, c, {}); (cache,env_2,ih,dae2) = instClassDecls(cache,env_1,ih, cs, ref); dae = DAEUtil.joinDaes(dae1, dae2); @@ -924,7 +924,7 @@ algorithm case (cache,env,ih,((c as SCode.CLASS(name = name1)) :: cs),(ref as Absyn.QUALIFIED(name = name2))) equation - false = stringEqual(name1, name2); + false = stringEq(name1, name2); (cache,env_1,ih,dae1) = instClassDecl(cache,env,ih, DAE.NOMOD(), Prefix.NOPRE(), Connect.emptySet, c, {}) ; (cache,env_2,ih,dae2) = instClassDecls(cache,env_1,ih, cs, ref); dae = DAEUtil.joinDaes(dae1, dae2); @@ -1548,13 +1548,13 @@ algorithm outCref := matchcontinue(cr1,cr2) list subs; case(DAE.CREF_IDENT(name,ty,subs),DAE.CREF_QUAL(name2,_,_,child2)) equation - true = stringEqual(name,name2); + true = stringEq(name,name2); then ComponentReference.makeCrefQual(name,ty,subs,child2); case(DAE.CREF_QUAL(name,ty,subs,child),DAE.CREF_QUAL(name2,_,_,child2)) equation - true = stringEqual(name,name2); + true = stringEq(name,name2); outCref = updateCrefTypesWithConnectorPrefix(child,child2); then ComponentReference.makeCrefQual(name,ty,subs,outCref); @@ -3920,14 +3920,14 @@ algorithm local list crefs,crefs2; equation - true = stringEqual(name,name2); + true = stringEq(name,name2); outComps = extractConstantPlusDeps2(inComps,ocr,allComps,className,existing); then selem::outComps; */ case( ((selem as SCode.CLASSDEF(name=name2)))::inComps,SOME(DAE.CREF_IDENT(ident=name)),allComps,className,existing) equation - //false = stringEqual(name,name2); + //false = stringEq(name,name2); allComps = selem::allComps; existing = name2::existing; outComps = extractConstantPlusDeps2(inComps,ocr,allComps,className,existing); @@ -3938,7 +3938,7 @@ algorithm local list crefs,crefs2; equation - true = stringEqual(name,name2); + true = stringEq(name,name2); crefs = getCrefFromMod(scmod); allComps = listAppend(inComps,allComps); existing = name2::existing; @@ -3948,7 +3948,7 @@ algorithm case( ( (selem as SCode.COMPONENT(component=name2)))::inComps,SOME(DAE.CREF_IDENT(ident=name)),allComps,className,existing) equation - false = stringEqual(name,name2); + false = stringEq(name,name2); allComps = selem::allComps; then extractConstantPlusDeps2(inComps,ocr,allComps,className,existing); @@ -3997,19 +3997,19 @@ algorithm outComps := matchcontinue(acrefs,remainingComps,className,existing) case({},_,_,_) then {}; case(Absyn.CREF_QUAL(s1,_,(acr as Absyn.CREF_IDENT(s2,_)))::acrefs,remainingComps,className,existing) equation - true = stringEqual(className,s1); // in same scope look up. + true = stringEq(className,s1); // in same scope look up. acrefs = acr::acrefs; then extractConstantPlusDeps3(acrefs,remainingComps,className,existing); case((acr as Absyn.CREF_QUAL(s1,_,_))::acrefs,remainingComps,className,existing) equation - false = stringEqual(className,s1); + false = stringEq(className,s1); outComps = extractConstantPlusDeps3(acrefs,remainingComps,className,existing); then outComps; case(Absyn.CREF_IDENT(s1,_)::acrefs,remainingComps,className,existing) // modifer dep already added equation - true = Util.listContainsWithCompareFunc(s1,existing,stringEqual); + true = Util.listContainsWithCompareFunc(s1,existing,stringEq); then extractConstantPlusDeps3(acrefs,remainingComps,className,existing); case(Absyn.CREF_IDENT(s1,_)::acrefs,remainingComps,className,existing) @@ -4045,13 +4045,13 @@ algorithm Absyn.Path p, newPath; case(clsName, p) // self reference, remove the first. equation - true = stringEqual(clsName, Absyn.pathFirstIdent(p)); + true = stringEq(clsName, Absyn.pathFirstIdent(p)); newPath = Absyn.removePrefix(Absyn.IDENT(clsName), p); then newPath; case(clsName, p) // not self reference, return the same. equation - false = stringEqual(clsName, Absyn.pathFirstIdent(p)); + false = stringEq(clsName, Absyn.pathFirstIdent(p)); then p; end matchcontinue; @@ -4815,7 +4815,7 @@ algorithm omods := matchcontinue(dep,elems) case(dep,( tpl as (SCode.COMPONENT(component=name1),cmod))::elems) equation name2 = Absyn.printComponentRefStr(dep); - true = stringEqual(name2,name1); + true = stringEq(name2,name1); cmod = DAE.MOD(false,Absyn.NON_EACH(),{DAE.NAMEMOD(name2,cmod)},NONE()); then cmod; @@ -5076,7 +5076,7 @@ algorithm (cache,env_1,ih,store,dae1,csets_1,ci_state_1,tys1,graph) = instElement(cache,env,ih,store, mod, pre, csets, ci_state, el, inst_dims, impl, callscope, graph); - /*s1 = Util.if_(stringEqual("n", str),DAE.dumpElementsStr(dae1),""); + /*s1 = Util.if_(stringEq("n", str),DAE.dumpElementsStr(dae1),""); print(s1) "To print what happened to a specific var";*/ Error.updateCurrentComponent("",NONE()); (cache,env_2,ih,store,dae2,csets_2,ci_state_2,tys2,graph) = @@ -5129,13 +5129,13 @@ algorithm _ := matchcontinue(subs,prior,pre,str) case({},_,pre,str) then (); case(DAE.NAMEMOD(ident = n)::subs,prior,pre,str) equation - false = Util.listContainsWithCompareFunc(n,prior,stringEqual); + false = Util.listContainsWithCompareFunc(n,prior,stringEq); verifySingleMod2(subs,n::prior,pre,str); then (); case(DAE.NAMEMOD(ident = n)::subs,prior,pre,str) equation - true = Util.listContainsWithCompareFunc(n,prior,stringEqual); + true = Util.listContainsWithCompareFunc(n,prior,stringEq); s1 = makePrefixString(pre); Error.addMessage(Error.MULTIPLE_MODIFIER, {n,s1}); then @@ -5555,7 +5555,7 @@ algorithm case (cache,env,ih,mod,pre,csets,cistate, ((comp as SCode.COMPONENT(component = n,typeSpec = (tss as Absyn.TPATH(tpp, _)), info = aInfo)),cmod)::xs, _, _, instdims,impl) equation - true = stringEqual(n, Absyn.pathLastIdent(tpp)); + true = stringEq(n, Absyn.pathLastIdent(tpp)); ns = Env.printEnvPathStr(env) +& "." +& Absyn.pathString(tpp); Error.addMessageOrSourceMessage(Error.COMPONENT_NAME_SAME_AS_TYPE_NAME, {n,ns}, aInfo); then @@ -5949,7 +5949,7 @@ algorithm equation //print(" instElement: A component: " +& n +& "\n"); //Debug.fprintln("debug"," instElement " +& n +& " in s:" +& Env.printEnvPathStr(env) +& " m: " +& SCode.printModStr(m) +& " cm : " +& Mod.printModStr(cmod)); - //false = stringEqual(n, Absyn.pathLastIdent(t)); + //false = stringEq(n, Absyn.pathLastIdent(t)); m = traverseModAddFinal(m, finalPrefix); comp = SCode.COMPONENT(n,io,finalPrefix,repl,prot,attr,ts,m,comment,cond,aInfo,cc); // Fails if multiple decls not identical @@ -6206,7 +6206,7 @@ algorithm Absyn.TPATH(t,_),cc=cc),_),_,_,_,_) local Absyn.ComponentRef tref; SCode.Variability vt; equation - //false = stringEqual(n, Absyn.pathLastIdent(t)); + //false = stringEq(n, Absyn.pathLastIdent(t)); failure((_,cl,cenv) = Lookup.lookupClass(cache,env, t, false)); s = Absyn.pathString(t); scope_str = Env.printEnvPathStr(env); @@ -6319,7 +6319,7 @@ algorithm equation Absyn.CREF_IDENT(id2,_) = Absyn.crefGetFirst(cr); // prefix == first part of cref - 0 = System.strcmp(id2,id); + 0 = stringCompare(id2,id); cr1 = Absyn.crefStripFirst(cr); then ((Absyn.CREF(cr1),(id,cnt+1))); // other expressions falltrough @@ -6443,7 +6443,7 @@ algorithm (newComp as (SCode.CLASSDEF(name=n,classDef=SCode.CLASS(classDef=SCode.PARTS(elementLst=SCode.EXTENDS(baseClassPath=Absyn.IDENT(n2))::_ ))),_)),_,_) equation n=n+&"$parent"; - true = stringEqual(n, n2); + true = stringEq(n, n2); ErrorExt.rollBack("checkMultiplyDeclared"); then false; @@ -6543,7 +6543,7 @@ algorithm Option cond1, cond2; equation // see if the most stuff is the same! - true = stringEqual(n1, n2); + true = stringEq(n1, n2); true = ModUtil.innerOuterEqual(io1, io2); true = Util.boolEqual(fp1, fp2); true = Util.boolEqual(rp1, rp2); @@ -6557,7 +6557,7 @@ algorithm (_, c1, env1) = Lookup.lookupClass(cache, env, tpath1, false); (_, c2, env2) = Lookup.lookupClass(cache, env, tpath2, false); // the class has the same environment - true = stringEqual(Env.printEnvPathStr(env1), Env.printEnvPathStr(env2)); + true = stringEq(Env.printEnvPathStr(env1), Env.printEnvPathStr(env2)); // the classes are the same! true = SCode.classEqual(c1, c2); // add a warning and let it continue! @@ -6597,7 +6597,7 @@ algorithm equation sl1=Util.listMap(enumLst,SCode.enumName); sl2=Util.listMap(elementLst,SCode.elementName); - boolList=Util.listThreadMap(sl1,sl2,stringEqual); + boolList=Util.listThreadMap(sl1,sl2,stringEq); true=Util.boolAndList(boolList); then (); @@ -6605,7 +6605,7 @@ algorithm equation sl1=Util.listMap(enumLst,SCode.enumName); sl2=Util.listMap(elementLst,SCode.elementName); - boolList=Util.listThreadMap(sl1,sl2,stringEqual); + boolList=Util.listThreadMap(sl1,sl2,stringEq); true=Util.boolAndList(boolList); then (); @@ -6642,7 +6642,7 @@ algorithm equation Absyn.CREF_IDENT(name = n1,subscripts = {}) = cr1; Absyn.CREF_IDENT(name = n2,subscripts = {}) = cr2; - true = stringEqual(n1, n2); + true = stringEq(n1, n2); rest_1 = removeCrefFromCrefs(rest, cr2); then rest_1; @@ -6650,7 +6650,7 @@ algorithm equation Absyn.CREF_QUAL(name = n1) = cr1; Absyn.CREF_IDENT(name = n2) = cr2; - true = stringEqual(n1, n2); + true = stringEq(n1, n2); rest_1 = removeCrefFromCrefs(rest, cr2); then rest_1; @@ -6721,7 +6721,7 @@ algorithm typeSpec = t2,modifications = old_mod,cc=(cc as SOME(Absyn.CONSTRAINCLASS(elementSpec=_)))), pre,ci_state,csets,impl,cmod) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); compsOnConstrain = extractConstrainingComps(cc,env,pre) "extract components belonging to constraining class"; crefs = getCrefFromMod(mod); (cache,env_1,ih,csets) = updateComponentsInEnv(cache, env, ih, pre, DAE.NOMOD(), crefs, ci_state, csets, impl); @@ -6747,7 +6747,7 @@ algorithm typeSpec = t2,modifications = old_mod,cc=(cc as NONE())), pre,ci_state,csets,impl,cmod) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); crefs = getCrefFromMod(mod); (cache,env_1,ih,csets) = updateComponentsInEnv(cache,env,ih, pre, DAE.NOMOD(), crefs, ci_state, csets, impl) "m" ; info = Util.getOptionOrDefault(nfo, Absyn.dummyInfo); @@ -6762,7 +6762,7 @@ algorithm case (cache,env,ih,(m as DAE.REDECL(tplSCodeElementModLst = (((redecl as SCode.CLASSDEF(name = n1) ),rmod) :: rest))), SCode.CLASSDEF(name = n2),pre,ci_state,csets,impl,cmod) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); //crefs = getCrefFromMod(mod); (cache,env_1,ih,csets) = updateComponentsInEnv(cache,env,ih, pre, DAE.NOMOD(), {Absyn.CREF_IDENT(n2,{})}, ci_state, csets, impl) "m" ; //(cache,m_1) = Mod.elabMod(cache, env_1, ih, pre, mod, impl); @@ -6778,7 +6778,7 @@ algorithm local Absyn.TypeSpec apt; equation n2 = Absyn.typeSpecPathString(apt); - true = stringEqual(n1, n2); + true = stringEq(n1, n2); (cache,env_1,ih,csets) = updateComponentsInEnv(cache,env,ih, pre, DAE.NOMOD(), {Absyn.CREF_IDENT(n2,{})}, ci_state, csets, impl) "m" ; then (cache,env_1,ih,redecl,rmod,csets); @@ -6788,7 +6788,7 @@ algorithm pre,ci_state,csets,impl,cmod) local DAE.Mod mod; equation - false = stringEqual(n1, n2); + false = stringEq(n1, n2); (cache,env_1,ih,newcomp,mod,csets) = redeclareType(cache, env, ih, DAE.REDECL(redfin,rest), comp, pre, ci_state, csets, impl, cmod); then @@ -6865,7 +6865,7 @@ algorithm osubs := matchcontinue(subs,elems) case((sub as DAE.NAMEMOD(ident=n,mod=mod))::subs,elems) equation osubs = keepConstrainingTypeModifersOnly2(subs,elems); - b = Util.listContainsWithCompareFunc(n,elems,stringEqual); + b = Util.listContainsWithCompareFunc(n,elems,stringEq); osubs2 = Util.if_(b, {sub},{}); osubs = listAppend(osubs2,osubs); then @@ -10249,7 +10249,7 @@ algorithm element := matchcontinue(subs,elemDecl,baseFunc,inCache,inEnv,inIH,inP /*print("\n adding conditions on derivative count: " +& intString(listLength(conditionRefs)) +& "\n"); dbgString = Absyn.optPathString(defaultDerivative); - dbgString = Util.if_(stringEqual(dbgString,""),"", "**** Default Derivative: " +& dbgString +& "\n"); + dbgString = Util.if_(stringEq(dbgString,""),"", "**** Default Derivative: " +& dbgString +& "\n"); print("**** Function derived: " +& Absyn.pathString(baseFunc) +& " \n"); print("**** Deriving function: " +& Absyn.pathString(deriveFunc) +& "\n"); print("**** Conditions: " +& Util.stringDelimitList(DAEDump.dumpDerivativeCond(conditionRefs),", ") +& "\n"); @@ -10341,7 +10341,7 @@ algorithm /* found matching input*/ case(SCode.COMPONENT(component=str2,attributes =SCode.ATTR(direction=Absyn.INPUT()))::elemDecl,str,currPos) equation - true = stringEqual(str2, str); + true = stringEq(str2, str); then currPos; @@ -11972,7 +11972,7 @@ algorithm case (mod,DAE.TYPES_VAR(name,binding=binding)::_,etype,index_list,bind_name,useConstValue) equation - true = stringEqual(name, bind_name); + true = stringEq(name, bind_name); then bindingExp(binding); @@ -12775,7 +12775,7 @@ algorithm case (cache,env,ih,((c as SCode.CLASS(name = name1)) :: cs),Absyn.IDENT(name = name2)) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); (cache,env_1,ih,_,dae,_,_,_,_,_) = instClass(cache,env,ih, UnitAbsyn.noStore, DAE.NOMOD(), Prefix.NOPRE(), Connect.emptySet, c, {}, false, INNER_CALL(), ConnectionGraph.EMPTY) "impl" ; @@ -12784,7 +12784,7 @@ algorithm case (cache,env,ih,((c as SCode.CLASS(name = name1)) :: cs),(path as Absyn.IDENT(name = name2))) equation - false = stringEqual(name1, name2); + false = stringEq(name1, name2); (cache,env,ih,dae) = instBoschClassInProgram(cache,env,ih, cs, path); then (cache,env,ih,dae); @@ -13304,7 +13304,7 @@ algorithm (omod,restmods) := matchcontinue( smod , name , premod) case(DAE.NAMEMOD(id, mod) :: rest, name, premod) equation - true = stringEqual(id, name); + true = stringEq(id, name); rest2 = listAppend(premod,rest); then (mod, rest2); @@ -13492,7 +13492,7 @@ algorithm case( (head as (SCode.CLASSDEF(name = id1),m))::rest, path) equation id2 = Absyn.pathString(path); - true = stringEqual(id1,id2); + true = stringEq(id1,id2); (rec1,rec2) = modifyInstantiateClass2(rest,path); then (head::rec1,rec2); @@ -14241,7 +14241,7 @@ public function hashFunc input Absyn.Path p; output Integer res; algorithm - res := System.hash(Absyn.pathString(p)); + res := stringHashDjb2(Absyn.pathString(p)); end hashFunc; public function keyEqual @@ -14249,7 +14249,7 @@ public function keyEqual input Key key2; output Boolean res; algorithm - res := stringEqual(Absyn.pathString(key1),Absyn.pathString(key2)); + res := stringEq(Absyn.pathString(key1),Absyn.pathString(key2)); end keyEqual; public function dumpInstHashTable "" @@ -14777,7 +14777,7 @@ algorithm equation //classNameStr = Absyn.optPathString(classNameOpt); //warnings = Error.printMessagesStr(); - //retStr= System.stringAppendList({"# CHECK: ", classNameStr, " inst has 0 equation(s) and 0 variable(s)", warnings, "."}); + //retStr= stringAppendList({"# CHECK: ", classNameStr, " inst has 0 equation(s) and 0 variable(s)", warnings, "."}); // do not show empty elements with 0 vars and 0 equs // Debug.fprintln("checkModel", retStr); then (); @@ -14799,7 +14799,7 @@ algorithm simpleEqnSizeStr = intString(simpleEqnSize); classNameStr = Absyn.optPathString(classNameOpt); warnings = Error.printMessagesStr(); - retStr= System.stringAppendList({"# CHECK: ", classNameStr, " inst has ", eqnSizeStr, + retStr= stringAppendList({"# CHECK: ", classNameStr, " inst has ", eqnSizeStr, " equation(s) and ", varSizeStr," variable(s). ", simpleEqnSizeStr, " of these are trivial equation(s).", warnings}); diff --git a/Compiler/InstSection.mo b/Compiler/InstSection.mo index a7fb660ea03..ced95a2e621 100644 --- a/Compiler/InstSection.mo +++ b/Compiler/InstSection.mo @@ -930,7 +930,7 @@ algorithm equation s1 = Dump.printExpStr(left); s2 = Dump.printExpStr(right); - s = System.stringAppendList({s1," = ",s2,";"}); + s = stringAppendList({s1," = ",s2,";"}); Error.addSourceMessage(Error.TUPLE_ASSIGN_CREFS_ONLY,{s},info); then fail(); case (left as Absyn.TUPLE(crs),right,info) @@ -938,7 +938,7 @@ algorithm failure(Absyn.CALL(_,_) = right); s1 = Dump.printExpStr(left); s2 = Dump.printExpStr(right); - s = System.stringAppendList({s1," = ",s2,";"}); + s = stringAppendList({s1," = ",s2,";"}); Error.addSourceMessage(Error.TUPLE_ASSIGN_FUNCALL_ONLY,{s},info); then fail(); end matchcontinue; @@ -1276,8 +1276,8 @@ algorithm t1_str = Types.unparseType(t1); e2_str = ExpressionDump.printExpStr(e2); t2_str = Types.unparseType(t2); - s1 = System.stringAppendList({e1_str,"=",e2_str}); - s2 = System.stringAppendList({t1_str,"=",t2_str}); + s1 = stringAppendList({e1_str,"=",e2_str}); + s2 = stringAppendList({t1_str,"=",t2_str}); Error.addSourceMessage(Error.EQUATION_TYPE_MISMATCH_ERROR, {s1,s2}, DAEUtil.getElementSourceFileInfo(source)); Debug.fprintln("failtrace", "- InstSection.instEqEquation failed with type mismatch in equation: " +& s1 +& " tys: " +& s2); then @@ -1706,7 +1706,7 @@ algorithm false = OptManager.getOption("checkModel"); lhs_str = ExpressionDump.printExpStr(lhs); rhs_str = ExpressionDump.printExpStr(rhs); - eq_str = System.stringAppendList({lhs_str, "=", rhs_str}); + eq_str = stringAppendList({lhs_str, "=", rhs_str}); Error.addMessage(Error.INST_ARRAY_EQ_UNKNOWN_SIZE, {eq_str}); then fail(); @@ -4693,8 +4693,8 @@ algorithm t1_str = Types.unparseType(t1); c2_str = ComponentReference.printComponentRefStr(c2); t2_str = Types.unparseType(t2); - c1_str = System.stringAppendList({c1_str," and ",c2_str}); - t1_str = System.stringAppendList({t1_str," and ",t2_str}); + c1_str = stringAppendList({c1_str," and ",c2_str}); + t1_str = stringAppendList({t1_str," and ",t2_str}); Error.addSourceMessage(Error.INVALID_CONNECTOR_VARIABLE, {c1_str,t1_str},info); then fail(); diff --git a/Compiler/InstanceHierarchy.mo b/Compiler/InstanceHierarchy.mo index 42783da5cb7..83fcdc3d049 100644 --- a/Compiler/InstanceHierarchy.mo +++ b/Compiler/InstanceHierarchy.mo @@ -651,7 +651,7 @@ algorithm case SCode.EXTENDS(baseClassPath = path,modifications = mod) equation str = Absyn.pathString(path); - res = System.stringAppendList({"extends ",str,";"}); + res = stringAppendList({"extends ",str,";"}); then res; @@ -661,14 +661,14 @@ algorithm mod_str = SCode.printModStr(mod); s = Dump.unparseTypeSpec(typath); vs = SCode.unparseVariability(var); - res = System.stringAppendList({vs," ",s," ",n,mod_str,";"}); + res = stringAppendList({vs," ",s," ",n,mod_str,";"}); then res; case SCode.CLASSDEF(name = n,finalPrefix = finalPrefix,replaceablePrefix = repl,classDef = cl) equation //str = printClassStr(cl); - res = System.stringAppendList({"class ",n," ... end ",n,";"}); + res = stringAppendList({"class ",n," ... end ",n,";"}); then res; diff --git a/Compiler/Interactive.mo b/Compiler/Interactive.mo index 9fad12e0278..8dd5d313e32 100644 --- a/Compiler/Interactive.mo +++ b/Compiler/Interactive.mo @@ -277,7 +277,7 @@ algorithm echo = getEcho(); res_1 = selectResultstr(res, semicolon, verbose, echo); (res2,newst_1) = evaluate(ISTMTS(xs,semicolon), newst, verbose); - res_2 = System.stringAppendList({res_1,res2}); + res_2 = stringAppendList({res_1,res2}); then (res_2,newst_1); end matchcontinue; @@ -1011,7 +1011,7 @@ protected function getVariableNames algorithm strlst := getVariableListStr(vars); str := Util.stringDelimitList(strlst, ", "); - res := System.stringAppendList({"{",str,"}"}); + res := stringAppendList({"{",str,"}"}); end getVariableNames; protected function getVariableListStr @@ -1057,12 +1057,12 @@ algorithm case (id,{}) then fail(); case (varid,(IVAR(varIdent = id,type_ = tp) :: rest)) equation - true = stringEqual(varid, id); + true = stringEq(varid, id); then tp; case (varid,(IVAR(varIdent = id) :: rest)) equation - false = stringEqual(varid, id); + false = stringEq(varid, id); tp = getTypeOfVariable(varid, rest); then tp; @@ -1231,7 +1231,7 @@ algorithm case (ident,(IVAR(varIdent = id2) :: rest)) equation - true = stringEqual(ident, id2); + true = stringEq(ident, id2); then rest; @@ -1259,12 +1259,12 @@ algorithm list rest,rest_1; case (ident,v,t,(IVAR(varIdent = id2) :: rest)) equation - true = stringEqual(ident, id2); + true = stringEq(ident, id2); then (IVAR(ident,v,t) :: rest); case (ident,v,t,(IVAR(varIdent = id2,value = val2,type_ = t2) :: rest)) equation - false = stringEqual(ident, id2); + false = stringEq(ident, id2); rest_1 = addVarToVarlist(ident, v, t, rest); then (IVAR(id2,val2,t2) :: rest_1); @@ -1346,7 +1346,7 @@ algorithm case (ISTMTS(interactiveStmtLst = {IEXP(exp = Absyn.CALL(function_ = Absyn.CREF_IDENT(name = fn)))}), _) equation - true = stringEqual(inFunctionName, fn); + true = stringEq(inFunctionName, fn); then (); end matchcontinue; @@ -2376,7 +2376,7 @@ algorithm matchApiFunction(istmts, "refactorClass"); {Absyn.CREF(componentRef = cr)} = getApiFunctionArgs(istmts); s1 = Dump.printComponentRefStr(cr); - resstr = System.stringAppendList({"Failed in translating", s1, " to Modelica v2.0 graphicall annotations"}); + resstr = stringAppendList({"Failed in translating", s1, " to Modelica v2.0 graphicall annotations"}); st = setSymbolTableAST(st, p); then (resstr, st); @@ -2661,7 +2661,7 @@ algorithm matchApiFunction(istmts, "list"); {Absyn.CREF(componentRef = cr)} = getApiFunctionArgs(istmts); resstr = listClass(cr, p); - resstr = System.stringAppendList({"\"",resstr,"\""}); + resstr = stringAppendList({"\"",resstr,"\""}); then (resstr,st); @@ -2770,7 +2770,7 @@ algorithm p_1 = renameComponentFromComponentreplacements(p, comp_reps); paths = extractRenamedClassesAsStringList(comp_reps); paths_1 = Util.stringDelimitList(paths, ","); - paths_2 = System.stringAppendList({"{",paths_1,"}"}); + paths_2 = stringAppendList({"{",paths_1,"}"}); then (paths_2,p_1); case (p,_,_,_) @@ -3099,7 +3099,7 @@ algorithm equation old_comp_path = Absyn.crefToPath(old_comp); old_comp_string = Absyn.pathString(old_comp_path); - true = stringEqual(name, old_comp_string); + true = stringEq(name, old_comp_string); new_comp_path = Absyn.crefToPath(new_comp); new_comp_string = Absyn.pathString(new_comp_path); res_1 = renameComponentInComponentitems(res, old_comp, new_comp); @@ -3876,17 +3876,17 @@ algorithm list a; case (Absyn.CREF_IDENT(name = id),Absyn.CREF_IDENT(name = id2),(res as Absyn.CREF_IDENT(name = id3))) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); then res; case (Absyn.CREF_QUAL(name = id,subScripts = a,componentRef = cr1),Absyn.CREF_IDENT(name = id2),Absyn.CREF_IDENT(name = id3)) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); then Absyn.CREF_QUAL(id3,a,cr1); case (Absyn.CREF_QUAL(name = id,subScripts = a,componentRef = cr1),Absyn.CREF_QUAL(name = id2,componentRef = cr2),Absyn.CREF_QUAL(name = id3,componentRef = cr3)) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); cr = replaceStartInComponentRef2(cr1, cr2, cr3); then Absyn.CREF_QUAL(id3,a,cr); @@ -4100,7 +4100,7 @@ algorithm cr1_str = Absyn.pathString(cr1_pa); cr2_pa = Absyn.crefToPath(cr2); cr2_str = Absyn.pathString(cr2_pa); - res_str = System.stringAppendList({s1,"In class: ",pa_str,"( ",cr1_str," => ",cr2_str," )\n"}); + res_str = stringAppendList({s1,"In class: ",pa_str,"( ",cr1_str," => ",cr2_str," )\n"}); then res_str; end matchcontinue; @@ -4945,7 +4945,7 @@ algorithm path_str = Absyn.pathString(path); cr_pa = Absyn.crefToPath(cr); cr_str = Absyn.pathString(cr_pa); - res_str = System.stringAppendList({s1,"cl: ",pa_str,"\t type: ",path_str,"\t\t name: ",cr_str,"\n"}); + res_str = stringAppendList({s1,"cl: ",pa_str,"\t type: ",path_str,"\t\t name: ",cr_str,"\n"}); then res_str; case ((comps as COMPONENTS(componentLst = (EXTENDSITEM(the1 = pa,the2 = path) :: res)))) @@ -4954,7 +4954,7 @@ algorithm s1 = dumpComponentsToString(res); pa_str = Absyn.pathString(pa); path_str = Absyn.pathString(path); - res_str = System.stringAppendList({s1,"ex: ",pa_str,"\t exte: ",path_str,"\n"}); + res_str = stringAppendList({s1,"ex: ",pa_str,"\t exte: ",path_str,"\n"}); then res_str; end matchcontinue; @@ -5006,7 +5006,7 @@ algorithm compelts_1 = Util.listFlatten(compelts); names = Util.listMap(compelts_1, getComponentitemName); res = Util.stringDelimitList(names, ", "); - res_1 = System.stringAppendList({"{",res,"}"}); + res_1 = stringAppendList({"{",res,"}"}); then res_1; case (_,_) then "Error"; @@ -5461,7 +5461,7 @@ algorithm list rest; case ((Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = cr1)) :: _),cr2) equation - true = stringEqual(cr1, cr2); + true = stringEq(cr1, cr2); then (); case ((_ :: rest),cr) @@ -5622,19 +5622,19 @@ algorithm case (Absyn.NAMED_IMPORT(name = id,path = path)) equation path_str = Absyn.pathString(path); - str = System.stringAppendList({"kind=named, id=",id,", path=",path_str}); + str = stringAppendList({"kind=named, id=",id,", path=",path_str}); then str; case (Absyn.QUAL_IMPORT(path = path)) equation path_str = Absyn.pathString(path); - str = System.stringAppendList({"kind=qualified, path=",path_str}); + str = stringAppendList({"kind=qualified, path=",path_str}); then str; case (Absyn.UNQUAL_IMPORT(path = path)) equation path_str = Absyn.pathString(path); - str = System.stringAppendList({"kind=unqualified, path=",path_str}); + str = stringAppendList({"kind=unqualified, path=",path_str}); then str; end matchcontinue; @@ -5661,13 +5661,13 @@ algorithm case (Absyn.EXTENDS(path = path)) equation path_str = Absyn.pathString(path); - str = System.stringAppendList({"elementtype=extends, path=",path_str}); + str = stringAppendList({"elementtype=extends, path=",path_str}); then str; case (Absyn.IMPORT(import_ = import_)) equation import_str = getImportString(import_); - str = System.stringAppendList({"elementtype=import, ",import_str}); + str = stringAppendList({"elementtype=import, ",import_str}); then str; case (Absyn.COMPONENTS(attributes = attr,typeSpec = typeSpec,components = lst)) @@ -5679,7 +5679,7 @@ algorithm variability_str = attrVariabilityStr(attr); dir_str = attrDirectionStr(attr); names_str = Util.stringDelimitList(names, ", "); - str = System.stringAppendList({"elementtype=component, typename=",typename,", names={", names_str,"}, flow=",flowPrefixstr, + str = stringAppendList({"elementtype=component, typename=",typename,", names={", names_str,"}, flow=",flowPrefixstr, ", stream=",streamPrefixstr,", variability=",variability_str,", direction=", dir_str}); then str; @@ -5712,7 +5712,7 @@ algorithm repl = Util.boolString(r_1); inout_str = innerOuterStr(inout); str_restriction = Absyn.restrString(restr) "compile the classdef string" ; - element_str = System.stringAppendList( + element_str = stringAppendList( {"elementtype=classdef, classname=",id, ", classrestriction=",str_restriction}); sline_str = intString(sline); @@ -5720,7 +5720,7 @@ algorithm eline_str = intString(eline); ecol_str = intString(ecol); readonly_str = selectString(isReadOnly, "readonly", "writable"); - str = System.stringAppendList( + str = stringAppendList( {"elementfile=\"",file,"\", elementreadonly=\"", readonly_str,"\", elementStartLine=",sline_str,", elementStartColumn=",scol_str, ", elementEndLine=",eline_str,", elementEndColumn=",ecol_str,", final=",finalPrefix, @@ -5739,7 +5739,7 @@ algorithm eline_str = intString(eline); ecol_str = intString(ecol); readonly_str = selectString(isReadOnly, "readonly", "writable"); - str = System.stringAppendList( + str = stringAppendList( {"elementfile=\"",file,"\", elementreadonly=\"", readonly_str,"\", elementStartLine=",sline_str,", elementStartColumn=",scol_str, ", elementEndLine=",eline_str,", elementEndColumn=",ecol_str,", final=",finalPrefix, @@ -5771,16 +5771,16 @@ algorithm case (visibility_str,(current :: {})) /* deal with the last element */ equation s1 = getElementInfo(current); - element_str = System.stringAppendList({"{ rec(elementvisibility=",visibility_str,", ",s1,") }"}); - res = System.stringAppendList({element_str,"\n"}); + element_str = stringAppendList({"{ rec(elementvisibility=",visibility_str,", ",s1,") }"}); + res = stringAppendList({element_str,"\n"}); then res; case (visibility_str,(current :: rest)) equation s1 = getElementInfo(current); - element_str = System.stringAppendList({"{ rec(elementvisibility=",visibility_str,", ",s1,") }"}); + element_str = stringAppendList({"{ rec(elementvisibility=",visibility_str,", ",s1,") }"}); s2 = constructElementsInfo(visibility_str, rest); - res = System.stringAppendList({element_str,",\n",s2}); + res = stringAppendList({element_str,",\n",s2}); then res; end matchcontinue; @@ -5807,7 +5807,7 @@ algorithm case ("",s2,_) then s2; case (s1,s2,delimiter) equation - str = System.stringAppendList({s1,delimiter,s2}); + str = stringAppendList({s1,delimiter,s2}); then str; end matchcontinue; @@ -5846,7 +5846,7 @@ algorithm public_str = constructElementsInfo("public", public_elementitem_list); protected_str = constructElementsInfo("protected", protected_elementitem_list); elements_str = appendNonEmptyStrings(public_str, protected_str, ", "); - str = System.stringAppendList({"{ ",elements_str," }"}); + str = stringAppendList({"{ ",elements_str," }"}); then str; /* an extended class with parts: model extends M end M; */ @@ -5859,7 +5859,7 @@ algorithm public_str = constructElementsInfo("public", public_elementitem_list); protected_str = constructElementsInfo("protected", protected_elementitem_list); elements_str = appendNonEmptyStrings(public_str, protected_str, ", "); - str = System.stringAppendList({"{ ",elements_str," }"}); + str = stringAppendList({"{ ",elements_str," }"}); then str; /* otherwise */ @@ -6295,7 +6295,7 @@ algorithm {Absyn.EXTENDS(extpath,extmod,_)} = Util.listSelect1(exts_1, name, extendsElementspecNamed); res = getModificationNames(extmod); res_1 = Util.stringDelimitList(res, ", "); - res_2 = System.stringAppendList({"{",res_1,"}"}); + res_2 = stringAppendList({"{",res_1,"}"}); then res_2; case (_,_,_) then "Error"; @@ -6689,7 +6689,7 @@ algorithm // remove modifier. case ((Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = id,arrayDim = dim,modification = SOME(Absyn.CLASSMOD(args,expopt))),condition = cond,comment = cmt) :: rest),varname,Absyn.CREF_IDENT("",{}),mod) equation - true = stringEqual(varname, id); + true = stringEq(varname, id); optmod = createOptModificationFromEltargs(args,NONE()); then (Absyn.COMPONENTITEM(Absyn.COMPONENT(id,dim,optmod),cond,cmt) :: rest); @@ -6697,13 +6697,13 @@ algorithm // remove modifier. case ((Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = id,arrayDim = dim,modification = NONE()),condition = cond,comment = cmt) :: rest),varname,Absyn.CREF_IDENT("",{}),mod) equation - true = stringEqual(varname, id); + true = stringEq(varname, id); then (Absyn.COMPONENTITEM(Absyn.COMPONENT(id,dim,NONE()),cond,cmt) :: rest); case ((Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = id,arrayDim = dim,modification = SOME(Absyn.CLASSMOD(args,expopt))),condition = cond,comment = cmt) :: rest),varname,submodpath,mod) equation - true = stringEqual(varname, id); + true = stringEq(varname, id); args_1 = setSubmodifierInElementargs(args, submodpath, mod); optmod = createOptModificationFromEltargs(args_1,expopt); then @@ -6711,14 +6711,14 @@ algorithm case ((Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = id,arrayDim = dim,modification = NONE()),condition = cond,comment = cmt) :: rest),varname,submod,Absyn.CLASSMOD({},NONE())) equation - true = stringEqual(varname, id); + true = stringEq(varname, id); then (Absyn.COMPONENTITEM(Absyn.COMPONENT(id,dim,NONE()),cond,cmt) :: rest); case ((Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = id,arrayDim = dim,modification = NONE()),condition = cond,comment = cmt) :: rest),varname,submod,mod) equation - true = stringEqual(varname, id); + true = stringEq(varname, id); then (Absyn.COMPONENTITEM( Absyn.COMPONENT(id,dim, @@ -6795,28 +6795,28 @@ algorithm // Clear modification m(...) case ((Absyn.MODIFICATION(finalItem = f,each_ = each_,componentRef = (cr as Absyn.CREF_IDENT(name = name,subscripts = idx)),comment = cmt,modification=SOME(Absyn.CLASSMOD((submods as _::_),_))) :: rest),Absyn.CREF_IDENT(name = submodident),(mod as Absyn.CLASSMOD( {},NONE()))) equation - true = stringEqual(name, submodident); + true = stringEq(name, submodident); then Absyn.MODIFICATION(f,each_,cr,SOME(Absyn.CLASSMOD(submods,NONE())),cmt)::rest; // Clear modification, m with no submodifiers case ((Absyn.MODIFICATION(finalItem = f,each_ = each_,componentRef = Absyn.CREF_IDENT(name = name,subscripts = idx),comment = cmt,modification=SOME(Absyn.CLASSMOD({},_))) :: rest),Absyn.CREF_IDENT(name = submodident),(mod as Absyn.CLASSMOD( {},NONE()))) equation - true = stringEqual(name, submodident); + true = stringEq(name, submodident); then rest; // modfication, m=e case ((Absyn.MODIFICATION(finalItem = f,each_ = each_,componentRef = Absyn.CREF_IDENT(name = name,subscripts = idx),modification=SOME(Absyn.CLASSMOD(submods,_)),comment = cmt) :: rest),Absyn.CREF_IDENT(name = submodident),(mod as Absyn.CLASSMOD({},SOME(e)))) /* update modification */ equation - true = stringEqual(name, submodident); + true = stringEq(name, submodident); then (Absyn.MODIFICATION(f,each_,Absyn.CREF_IDENT(name,idx),SOME(Absyn.CLASSMOD(submods,SOME(e))),cmt) :: rest); // modfication, m(...)=e case ((Absyn.MODIFICATION(finalItem = f,each_ = each_,componentRef = Absyn.CREF_IDENT(name = name,subscripts = idx),modification=mod2,comment = cmt) :: rest),Absyn.CREF_IDENT(name = submodident),mod) /* update modification */ equation - true = stringEqual(name, submodident); + true = stringEq(name, submodident); then (Absyn.MODIFICATION(f,each_,Absyn.CREF_IDENT(name,idx),SOME(mod),cmt) :: rest); @@ -6830,7 +6830,7 @@ algorithm // Clear modification m.n first part matches. Check that m is not present in rest of list. case ((Absyn.MODIFICATION(finalItem = f,each_ = each_,componentRef = Absyn.CREF_QUAL(name = name1),comment = cmt) :: rest),cr as Absyn.CREF_IDENT(name = name2,subscripts = idx),Absyn.CLASSMOD({},NONE())) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); false = findCrefModification(cr,rest); then (rest); @@ -6838,7 +6838,7 @@ algorithm // Clear modification m(...) case ((Absyn.MODIFICATION(finalItem = f,each_ = each_,componentRef = (cr as Absyn.CREF_IDENT(name = name2)),modification = SOME(Absyn.CLASSMOD(args,NONE())),comment = cmt) :: rest),Absyn.CREF_QUAL(name = name1,componentRef = cr1),Absyn.CLASSMOD({},NONE())) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); {} = setSubmodifierInElementargs(args, cr1, Absyn.CLASSMOD({},NONE())); then (Absyn.MODIFICATION(f,each_,cr,NONE(),cmt) :: rest); @@ -6846,7 +6846,7 @@ algorithm // Clear modification m(...)=expr case ((Absyn.MODIFICATION(finalItem = f,each_ = each_,componentRef = (cr as Absyn.CREF_IDENT(name = name2)),modification = SOME(Absyn.CLASSMOD(args,SOME(e))),comment = cmt) :: rest),Absyn.CREF_QUAL(name = name1,componentRef = cr1),Absyn.CLASSMOD({},NONE())) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); {} = setSubmodifierInElementargs(args, cr1, Absyn.CLASSMOD({},NONE())); then (Absyn.MODIFICATION(f,each_,cr,SOME(Absyn.CLASSMOD({},SOME(e))),cmt) :: rest); @@ -6854,7 +6854,7 @@ algorithm // modification, m for m.n case ((Absyn.MODIFICATION(finalItem = f,each_ = each_,componentRef = (cr as Absyn.CREF_IDENT(name = name2)),modification = SOME(Absyn.CLASSMOD(args,exp)),comment = cmt) :: rest),Absyn.CREF_QUAL(name = name1,componentRef = cr1),mod) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); args_1 = setSubmodifierInElementargs(args, cr1, mod); then (Absyn.MODIFICATION(f,each_,cr,SOME(Absyn.CLASSMOD(args_1,exp)),cmt) :: rest); @@ -6972,7 +6972,7 @@ algorithm mod; case ((Absyn.MODIFICATION(finalItem = f,each_ = each_,componentRef = Absyn.CREF_IDENT(name = name1),modification = SOME(Absyn.CLASSMOD(args,exp)),comment = cmt) :: rest),Absyn.CREF_QUAL(name = name2,componentRef = cr2)) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); res = getModificationValue(args, cr2); then res; @@ -7020,7 +7020,7 @@ algorithm {Absyn.COMPONENTITEM(Absyn.COMPONENT(_,_,SOME(Absyn.CLASSMOD(mod,_))),_,_)} = Util.listSelect1(compelts_1, name, componentitemNamed); res = getModificationNames(mod); res_1 = Util.stringDelimitList(res, ", "); - res_2 = System.stringAppendList({"{",res_1,"}"}); + res_2 = stringAppendList({"{",res_1,"}"}); then res_2; case (_,_,_) then "{}"; @@ -7358,13 +7358,13 @@ algorithm case ((Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = id,arrayDim = dim,modification = SOME(Absyn.CLASSMOD(arg,_))),condition = cond,comment = cmt) :: rest),id2,exp) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); then (Absyn.COMPONENTITEM(Absyn.COMPONENT(id,dim,SOME(Absyn.CLASSMOD(arg,SOME(exp)))),cond,cmt) :: rest); case ((Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = id,arrayDim = dim,modification = NONE()),condition = cond,comment = cmt) :: rest),id2,exp) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); then (Absyn.COMPONENTITEM(Absyn.COMPONENT(id,dim,SOME(Absyn.CLASSMOD({},SOME(exp)))),cond,cmt) :: rest); @@ -7408,7 +7408,7 @@ algorithm local String id1,id2; case (Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = id1)),id2) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then true; case (_,_) then false; @@ -7485,7 +7485,7 @@ algorithm ((p_1,_,(_,_,_,path_str_lst,_))) = traverseClasses(p,NONE(), renameClassVisitor, (old_path,new_path,p,{},env), true) "traverse protected" ; path_str_lst_no_empty = Util.stringDelimitListNonEmptyElts(path_str_lst, ","); - res = System.stringAppendList({"{",path_str_lst_no_empty,"}"}); + res = stringAppendList({"{",path_str_lst_no_empty,"}"}); then (res,p_1); case (p,(old_class as Absyn.CREF_QUAL(name = _)),new_name) @@ -7499,7 +7499,7 @@ algorithm ((p_1,_,(_,_,_,path_str_lst,_))) = traverseClasses(p,NONE(), renameClassVisitor, (old_path,new_path,p,{},env), true) "traverse protected" ; path_str_lst_no_empty = Util.stringDelimitListNonEmptyElts(path_str_lst, ","); - res = System.stringAppendList({"{",path_str_lst_no_empty,"}"}); + res = stringAppendList({"{",path_str_lst_no_empty,"}"}); then (res,p_1); end matchcontinue; @@ -8375,13 +8375,13 @@ algorithm case (Absyn.CLASS(name = name1),(Absyn.CLASS(name = name2) :: xs)) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); then xs; case ((cdef as Absyn.CLASS(name = name1)),((x as Absyn.CLASS(name = name2)) :: xs)) equation - false = stringEqual(name1, name2); + false = stringEq(name1, name2); res = deleteClassFromList(cdef, xs); then (x :: res); @@ -8550,7 +8550,7 @@ algorithm str_eline := intString(el); str_ecol := intString(ec); dim_str := getClassDimensions(cdef); - res_1 := System.stringAppendList( + res_1 := stringAppendList( {"{\"",res,"\",",cmt,",\"",file,"\",{",strPartial,",", strFinal,",",strEncapsulated,"},{\"",str_readonly,"\",",str_sline,",", str_scol,",",str_eline,",",str_ecol,"},",dim_str,"}"}) "composing the final returned string" ; @@ -8604,7 +8604,7 @@ algorithm str_scol := intString(sc); str_eline := intString(el); str_ecol := intString(ec); - res_1 := System.stringAppendList( + res_1 := stringAppendList( {"{ rec(name=\"",name,"\", partial=",strPartial,", final=", strFinal,", encapsulated=",strEncapsulated,", restriction=",res,", comment=", cmt,", file=\"",file,"\", readonly=\"",str_readonly,"\", startLine=", @@ -8621,7 +8621,7 @@ protected function getClassComment String s; algorithm s := getClassComment2(cdef); - res := System.stringAppendList({"\"",s,"\""}); + res := stringAppendList({"\"",s,"\""}); end getClassComment; protected function getClassComment2 @@ -8675,7 +8675,7 @@ algorithm path := Absyn.crefToPath(cr); Absyn.CLASS(_,_,_,_,restr,_,_) := getPathedClassInProgram(path, p); res := Dump.unparseRestrictionStr(restr); - res_1 := System.stringAppendList({"\"",res,"\""}); + res_1 := stringAppendList({"\"",res,"\""}); end getClassRestriction; public function isType @@ -9126,7 +9126,7 @@ algorithm case (Absyn.CREF_IDENT(name = id1),((x as Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = id2))) :: xs)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then x; @@ -9517,7 +9517,7 @@ algorithm equation Values.CODE(Absyn.C_TYPENAME(path)) = getVariableValue("scope", vars) "If not top scope" ; id2 = Absyn.pathLastIdent(path); - true = stringEqual(id1, id2); + true = stringEq(id1, id2); newscope = Absyn.stripLast(path); newscope_1 = Values.CODE(Absyn.C_TYPENAME(newscope)); path_1 = Absyn.stripLast(path); @@ -9528,7 +9528,7 @@ algorithm case (Absyn.END_DEFINITION(name = id1),vars) equation Values.CODE(Absyn.C_TYPENAME(Absyn.IDENT(id2))) = getVariableValue("scope", vars); - true = stringEqual(id1, id2); + true = stringEq(id1, id2); vars_1 = removeVarFromVarlist("scope", vars); then vars_1; @@ -9554,13 +9554,13 @@ algorithm case (id1,(IVAR(varIdent = id2) :: rest)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then rest; case (id1,((v as IVAR(varIdent = id2)) :: rest)) equation - false = stringEqual(id1, id2); + false = stringEq(id1, id2); rest_1 = removeVarFromVarlist(id1, rest); then (v :: rest_1); @@ -9583,13 +9583,13 @@ algorithm case (id1,(IVAR(varIdent = id2,value = v) :: _)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then v; case (id1,(IVAR(varIdent = id2,value = v) :: rest)) equation - false = stringEqual(id1, id2); + false = stringEq(id1, id2); v = getVariableValue(id1, rest); then v; @@ -9616,8 +9616,8 @@ algorithm case (id1::id2::ids, (IVAR(varIdent = id3,value = Values.RECORD(orderd = vals, comp = comp),type_ = t) :: _)) equation - true = stringEqual(id1, id3); - ix = Util.listFindWithCompareFunc(comp, id2, stringEqual, false); + true = stringEq(id1, id3); + ix = Util.listFindWithCompareFunc(comp, id2, stringEq, false); v = listNth(vals, ix); v = getVariableValueLst(id2::ids, {IVAR(id2,v,(DAE.T_NOTYPE(),NONE()))}); then @@ -9625,13 +9625,13 @@ algorithm case ({id1}, (IVAR(varIdent = id2,value = v,type_ = t) :: _)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then v; case (id1::_, (IVAR(varIdent = id2) :: rest)) equation - false = stringEqual(id1, id2); + false = stringEq(id1, id2); v = getVariableValueLst(ids, rest); then v; @@ -9857,12 +9857,12 @@ algorithm case (_,{}) then {}; case (name,(Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.COMPONENTS(components = {Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = name2))}))) :: xs)) equation - true = stringEqual(name, name2); + true = stringEq(name, name2); then xs; case (name,((x as Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.COMPONENTS(components = {Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = name2))})))) :: xs)) equation - false = stringEqual(name, name2); + false = stringEq(name, name2); res = deleteComponentFromElementitems(name, xs); then (x :: res); @@ -10380,26 +10380,26 @@ algorithm case ({Absyn.MODIFICATION(componentRef = Absyn.CREF_IDENT(name = id1))},(cr as Absyn.CREF_IDENT(name = id2))) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then {}; case ({(m as Absyn.MODIFICATION(componentRef = Absyn.CREF_IDENT(name = id1)))},(cr as Absyn.CREF_IDENT(name = id2))) equation - false = stringEqual(id1, id2); + false = stringEq(id1, id2); then fail(); case ((Absyn.MODIFICATION(componentRef = Absyn.CREF_IDENT(name = id1)) :: xs),(cr as Absyn.CREF_IDENT(name = id2))) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); res = removeModificationInElementargs(xs, cr); then res; case (((m as Absyn.MODIFICATION(componentRef = Absyn.CREF_IDENT(name = id1))) :: xs),(cr as Absyn.CREF_IDENT(name = id2))) equation - false = stringEqual(id1, id2); + false = stringEq(id1, id2); res = removeModificationInElementargs(xs, cr); then (m :: res); @@ -11075,7 +11075,7 @@ algorithm comps2 = getProtectedComponentsInClass(cdef); s2 = getComponentsInfo(comps2, "\"protected\"", env_2); str = Util.stringDelimitListNonEmptyElts({s1,s2}, ","); - res = System.stringAppendList({"{",str,"}"}); + res = stringAppendList({"{",str,"}"}); then res; case (_,_) then "Error"; @@ -11180,7 +11180,7 @@ algorithm cdef = getPathedClassInProgram(modelpath, p); comp = getNthComponentInClass(cdef, n); str = getComponentModification(comp); - str_1 = System.stringAppendList({"{",str,"}"}); + str_1 = stringAppendList({"{",str,"}"}); then str_1; case (_,_,_) then "Error"; @@ -11247,7 +11247,7 @@ algorithm Absyn.EQUATIONITEM(equation_ = eq, comment = cmt) = getNthConnectionitemInClass(cdef, n); str2 = getStringComment(cmt); str = getConnectionStr(eq); - res = System.stringAppendList({"{",str,", ",str2,"}"}); + res = stringAppendList({"{",str,", ",str2,"}"}); then res; case (_,_,_) then "Error"; @@ -11263,7 +11263,7 @@ protected function getStringComment "function: getStringComment String s; algorithm s := getStringComment2(cmt); - res := System.stringAppendList({"\"",s,"\""}); + res := stringAppendList({"\"",s,"\""}); end getStringComment; protected function getStringComment2 @@ -11465,8 +11465,8 @@ algorithm sn1 = Absyn.pathString(pn1); pn2 = Absyn.crefToPath(cn2); sn2 = Absyn.pathString(pn2); - true = stringEqual(s1, sn1); - true = stringEqual(s2, sn2); + true = stringEq(s1, sn1); + true = stringEq(s2, sn2); res = deleteEquationInEqlist(xs, c1, c2); then res; @@ -13136,7 +13136,7 @@ algorithm case (((ann as Absyn.MODIFICATION(componentRef = Absyn.CREF_IDENT(name = id1),modification = mod)) :: _),id2,f) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); str = f(mod); then str; @@ -13722,7 +13722,7 @@ algorithm equation s1 = Dump.printComponentRefStr(cr1); s2 = Dump.printComponentRefStr(cr2); - str = System.stringAppendList({s1,",",s2}); + str = stringAppendList({s1,",",s2}); then str; end matchcontinue; @@ -13901,7 +13901,7 @@ algorithm UnitAbsyn.noStore, mod_2, Prefix.NOPRE(), Connect.emptySet, c_1, {}, false, Inst.TOP_CALL(), ConnectionGraph.EMPTY); gexpstr = DAEUtil.getVariableBindingsStr(DAEUtil.daeElements(dae)); - gexpstr_1 = System.stringAppendList({"{",gexpstr,"}"}); + gexpstr_1 = stringAppendList({"{",gexpstr,"}"}); res = getComponentitemsAnnotationsFromItems(rest, env); then (gexpstr_1 :: res); @@ -14055,7 +14055,7 @@ algorithm equation s1 = Dump.printExpStr(Absyn.CODE(Absyn.C_MODIFICATION(mod))); s2 = getComponentitemsModification(rest); - res = System.stringAppendList({s1,",",s2}); + res = stringAppendList({s1,",",s2}); then res; case ({Absyn.COMPONENTITEM(component = Absyn.COMPONENT(modification = SOME(mod)))}) @@ -14870,7 +14870,7 @@ algorithm equation ((lst as (_ :: _))) = getComponentsInfo2(elts, access, env); lst_1 = Util.stringDelimitList(lst, "},{"); - res = System.stringAppendList({"{",lst_1,"}"}); + res = stringAppendList({"{",lst_1,"}"}); then res; case (_,_,_) then ""; @@ -15135,7 +15135,7 @@ algorithm equation res = suffixInfos(rest, dims,typeAd,suffix); s1 = Util.stringDelimitListNonEmptyElts({dim,typeAd},","); - str_1 = System.stringAppendList({str,", ",suffix,",{",s1,"}"}); + str_1 = stringAppendList({str,", ",suffix,",{",s1,"}"}); then (str_1 :: res); end matchcontinue; @@ -15157,7 +15157,7 @@ algorithm case (tp,(str :: rest)) equation res = prefixTypename(tp, rest); - str_1 = System.stringAppendList({tp,",",str}); + str_1 = stringAppendList({tp,",",str}); then (str_1 :: res); end matchcontinue; @@ -15181,14 +15181,14 @@ algorithm equation s1 = stringAppend(c1, ","); lst = getComponentitemsName((c2 :: rest)); - str = System.stringAppendList({s1,"\"",s2,"\""}); + str = stringAppendList({s1,"\"",s2,"\""}); then (str :: lst); case ((Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = c1),comment = NONE()) :: (c2 :: rest))) equation s1 = stringAppend(c1, ","); lst = getComponentitemsName((c2 :: rest)); - str = System.stringAppendList({s1,"\"\""}); + str = stringAppendList({s1,"\"\""}); then (str :: lst); case ((_ :: rest)) @@ -15199,13 +15199,13 @@ algorithm case ({Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = c1),comment = SOME(Absyn.COMMENT(_,SOME(s2))))}) local String res; equation - res = System.stringAppendList({c1,",\"",s2,"\""}); + res = stringAppendList({c1,",\"",s2,"\""}); then {res}; case ({Absyn.COMPONENTITEM(component = Absyn.COMPONENT(name = c1))}) local String res; equation - res = System.stringAppendList({c1,",\"\""}); + res = stringAppendList({c1,",\"\""}); then {res}; case ({_}) then {}; @@ -15454,13 +15454,13 @@ algorithm case (c,Absyn.PROGRAM(classes = {},within_ = w,globalBuildTimes=ts)) then Absyn.PROGRAM({c},w,ts); case ((c as Absyn.CLASS(name = name1)),Absyn.PROGRAM(classes = ((c1 as Absyn.CLASS(name = name2)) :: clst),within_ = w,globalBuildTimes=ts)) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); cp = buildPath(w, Absyn.IDENT(name2)); then Absyn.PROGRAM((c :: clst),w,ts); case ((c as Absyn.CLASS(name = name1)),Absyn.PROGRAM(classes = ((c1 as Absyn.CLASS(name = name2)) :: clst),within_ = w,globalBuildTimes=ts)) equation - false = stringEqual(name1, name2); + false = stringEq(name1, name2); Absyn.PROGRAM(newclst,w,newTs) = replaceClassInProgram(c, Absyn.PROGRAM(clst,w,ts)); then Absyn.PROGRAM((c1 :: newclst),w,newTs); @@ -15651,14 +15651,14 @@ algorithm (a1 :: res); case (((e1 as Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.CLASSDEF(class_ = (c1 as Absyn.CLASS(name = name1))),constrainClass = NONE()))) :: xs),(c as Absyn.CLASS(name = name))) equation - false = stringEqual(name1, name); + false = stringEq(name1, name); res = removeClassInElementitemlist(xs, c); then (e1 :: res); case (((e1 as Absyn.ELEMENTITEM(element = Absyn.ELEMENT(finalPrefix = a,redeclareKeywords = b,innerOuter = c,name = d,specification = Absyn.CLASSDEF(replaceable_ = e,class_ = Absyn.CLASS(name = name1)),info = info,constrainClass = h))) :: xs),(c2 as Absyn.CLASS(name = name))) local Absyn.InnerOuter c; equation - true = stringEqual(name1, name); + true = stringEq(name1, name); then xs; case ((c1 :: xs),c) @@ -15746,14 +15746,14 @@ algorithm (a1 :: res); case (((e1 as Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.CLASSDEF(class_ = (c1 as Absyn.CLASS(name = name1))),constrainClass = NONE()))) :: xs),(c as Absyn.CLASS(name = name))) equation - false = stringEqual(name1, name); + false = stringEq(name1, name); res = replaceClassInElementitemlist(xs, c); then (e1 :: res); case (((e1 as Absyn.ELEMENTITEM(element = Absyn.ELEMENT(finalPrefix = a,redeclareKeywords = b,innerOuter = c,name = d,specification = Absyn.CLASSDEF(replaceable_ = e,class_ = Absyn.CLASS(name = name1)),info = info,constrainClass = h))) :: xs),(c2 as Absyn.CLASS(name = name))) local Absyn.InnerOuter c; equation - true = stringEqual(name1, name); + true = stringEq(name1, name); then (Absyn.ELEMENTITEM(Absyn.ELEMENT(a,b,c,d,Absyn.CLASSDEF(e,c2),info,h)) :: xs); case ((c1 :: xs),c) @@ -16052,12 +16052,12 @@ algorithm res; case ((Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.CLASSDEF(class_ = (c1 as Absyn.CLASS(name = name1))),constrainClass = NONE())) :: xs),name2) equation - true = stringEqual(name1, name2); + true = stringEq(name1, name2); then c1; case ((Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.CLASSDEF(class_ = (c1 as Absyn.CLASS(name = name1))),constrainClass = NONE())) :: xs),name) equation - false = stringEqual(name1, name); + false = stringEq(name1, name); res = getClassFromElementitemlist(xs, name); then res; @@ -16089,7 +16089,7 @@ algorithm case (str,Absyn.PROGRAM(classes = {}, globalBuildTimes=ts)) then false; case (str,Absyn.PROGRAM(classes = (Absyn.CLASS(name = c1) :: p),within_ = w,globalBuildTimes=ts)) equation - false = stringEqual(str, c1); + false = stringEq(str, c1); res = classInProgram(str, Absyn.PROGRAM(p,w,ts)); then res; @@ -16259,7 +16259,7 @@ algorithm /* adrpo: handle also the case: model extends X end X; */ case (str,Absyn.PROGRAM(classes = (Absyn.CLASS(body = Absyn.CLASS_EXTENDS(baseClassName = c1)) :: p),within_ = w, globalBuildTimes=ts)) equation - false = stringEqual(str, c1); + false = stringEq(str, c1); res = getClassInProgram(str, Absyn.PROGRAM(p,w,ts)); then res; @@ -16267,19 +16267,19 @@ algorithm case (str,Absyn.PROGRAM(classes = ((c1 as Absyn.CLASS(body = Absyn.CLASS_EXTENDS(baseClassName = c1name))) :: p),within_ = w,globalBuildTimes=ts)) local Absyn.Class c1; equation - true = stringEqual(str, c1name); + true = stringEq(str, c1name); then c1; case (str,Absyn.PROGRAM(classes = (Absyn.CLASS(name = c1) :: p),within_ = w,globalBuildTimes=ts)) equation - false = stringEqual(str, c1); + false = stringEq(str, c1); res = getClassInProgram(str, Absyn.PROGRAM(p,w,ts)); then res; case (str,Absyn.PROGRAM(classes = ((c1 as Absyn.CLASS(name = c1name)) :: p),within_ = w, globalBuildTimes=ts)) local Absyn.Class c1; equation - true = stringEqual(str, c1name); + true = stringEq(str, c1name); then c1; end matchcontinue; @@ -16414,7 +16414,7 @@ algorithm list rest; case ((Absyn.NAMEDARG(argName = "comment",argValue = Absyn.STRING(value = str)) :: _)) equation - false = stringEqual(str, ""); + false = stringEq(str, ""); then SOME(str); case ((_ :: rest)) @@ -16723,7 +16723,7 @@ algorithm case (((e1 as Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.CLASSDEF(class_ = Absyn.CLASS(info = Absyn.INFO(fileName = filename2)))))) :: xs),filename1) equation - false = stringEqual(filename1, filename2); + false = stringEq(filename1, filename2); res = removeClassDiffFiledInElementitemlist(xs, filename1); then res; @@ -16731,7 +16731,7 @@ algorithm case (((e1 as Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.CLASSDEF(class_ = Absyn.CLASS(info = Absyn.INFO(fileName = filename2)))))) :: xs),filename1) equation - true = stringEqual(filename1, filename2); + true = stringEq(filename1, filename2); res = removeClassDiffFiledInElementitemlist(xs, filename1); then (e1 :: res); @@ -16772,7 +16772,7 @@ algorithm ppath = Absyn.stripLast(classpath); pdef = getPathedClassInProgram(ppath, p); filename2 = Absyn.classFilename(pdef); - true = stringEqual(filename1, filename2); + true = stringEq(filename1, filename2); res = getSurroundingPackage(ppath, p); then res; @@ -17815,7 +17815,7 @@ algorithm FILE(f,now,qc)::tmp; case (f, FILE(f1,_,_)::rest, qc, tmp) // found it, and ignore it equation - true = stringEqual(f, f1); + true = stringEq(f, f1); newTemp = updateLoadedFiles(f, rest, qc, tmp); then newTemp; @@ -17849,7 +17849,7 @@ algorithm NONE(); case (f, FILE(f1,loadTime,info)::rest) // found it equation - true = stringEqual(f,f1); + true = stringEq(f,f1); SOME(modificationTime) = System.getFileModificationTime(f); // The file is loaded and is not changed since the last load true = realGt(loadTime, modificationTime); @@ -17857,7 +17857,7 @@ algorithm SOME(info); case (f, FILE(f1,loadTime,info)::rest) // found it equation - true = stringEqual(f,f1); + true = stringEq(f,f1); // we could not get the modification time NONE() = System.getFileModificationTime(f); then @@ -18324,13 +18324,13 @@ algorithm /* case (Absyn.EXTENDS(path = path)) equation path_str = Absyn.pathString(path); - str = System.stringAppendList({"elementtype=extends, path=",path_str}); + str = stringAppendList({"elementtype=extends, path=",path_str}); then str; case (Absyn.IMPORT(import_ = import_)) equation import_str = getImportString(import_); - str = System.stringAppendList({"elementtype=import, ",import_str}); + str = stringAppendList({"elementtype=import, ",import_str}); then str;*/ case (Absyn.COMPONENTS(attributes = attr,typeSpec = typeSpec,components = lst)) @@ -18362,13 +18362,13 @@ algorithm /* case (Absyn.EXTENDS(path = path)) equation path_str = Absyn.pathString(path); - str = System.stringAppendList({"elementtype=extends, path=",path_str}); + str = stringAppendList({"elementtype=extends, path=",path_str}); then str; case (Absyn.IMPORT(import_ = import_)) equation import_str = getImportString(import_); - str = System.stringAppendList({"elementtype=import, ",import_str}); + str = stringAppendList({"elementtype=import, ",import_str}); then str;*/ case (Absyn.COMPONENTS(attributes = attr,typeSpec = typeSpec,components = lst)) @@ -18726,9 +18726,9 @@ algorithm parent_string = Absyn.pathString(pp); result_path_lst = Util.listMap1(strlst, joinPaths, pp); indent = indent +& " "; - result = System.stringAppendList(Util.listMap2(result_path_lst, + result = stringAppendList(Util.listMap2(result_path_lst, getClassNamesRecursive, p, indent)); - res = System.stringAppendList({indent, parent_string,"\n",result}); + res = stringAppendList({indent, parent_string,"\n",result}); then res; case (pp,_,indent) @@ -18736,7 +18736,7 @@ algorithm parent_string = Absyn.pathString(pp); indent = indent +& " "; s1 = Error.printMessagesStr(); - res = System.stringAppendList({indent, parent_string,"\n","PROBLEM GETTING CLASS NAMES: ", s1}); + res = stringAppendList({indent, parent_string,"\n","PROBLEM GETTING CLASS NAMES: ", s1}); then res; end matchcontinue; end getClassNamesRecursive; diff --git a/Compiler/Linearization.mo b/Compiler/Linearization.mo index 23c9c738087..e643c1a2fac 100644 --- a/Compiler/Linearization.mo +++ b/Compiler/Linearization.mo @@ -234,7 +234,7 @@ algorithm arr = Util.arrayCopy(arr1,arr); arr = MarkArray(rest,vars,arr); s = Util.listMap(arrayList(arr),intString); - str = Util.stringAppendList(s); + str = stringAppendList(s); Debug.fcall("markblocks",print,str); Debug.fcall("markblocks",print,"\n"); then arr; diff --git a/Compiler/Lookup.mo b/Compiler/Lookup.mo index fd97a051007..e03ae41835c 100644 --- a/Compiler/Lookup.mo +++ b/Compiler/Lookup.mo @@ -714,7 +714,7 @@ algorithm /*case (cache,(Env.IMPORT(import_ = Absyn.QUAL_IMPORT(path = path)) :: fs),env,ident) equation id = Absyn.pathLastIdent(path) "If not package, error" ; - true = stringEqual(id, ident); + true = stringEq(id, ident); fr = Env.topFrame(env); (cache,c,env_1) = lookupClass(cache,{fr}, path, true); strippath = Absyn.stripLast(path); @@ -741,7 +741,7 @@ algorithm /* commented since MSL does not follow this rule, instead assertPackage gives warning */ /*case (cache,(Env.IMPORT(import_ = Absyn.NAMED_IMPORT(name = id,path = path)) :: fs),env,ident) equation - true = stringEqual(id, ident) "Assert package for Named imports" ; + true = stringEq(id, ident) "Assert package for Named imports" ; fr = Env.topFrame(env); (cache,c,env_1) = lookupClass(cache,{fr}, path, true); strippath = Absyn.stripLast(path); @@ -2135,7 +2135,7 @@ algorithm case (cache,(env as ((frame as Env.FRAME(optName = SOME(sid),isEncapsulated = true)) :: fs)),id,prevFrames,inState,_) equation - true = stringEqual(id, sid) "Special case if looking up the class that -is- encapsulated. That must be allowed." ; + true = stringEq(id, sid) "Special case if looking up the class that -is- encapsulated. That must be allowed." ; (cache,c,env,prevFrames) = lookupClassInEnv(cache, fs, id, frame::prevFrames, inState, true); Util.setStatefulBoolean(inState,true); then diff --git a/Compiler/Main.mo b/Compiler/Main.mo index 0df062afda7..27a125ab574 100644 --- a/Compiler/Main.mo +++ b/Compiler/Main.mo @@ -177,7 +177,7 @@ algorithm equation true = RTOpts.debugFlag(flagstr); debugstr = Print.getString(); - res_with_debug = System.stringAppendList({res,"\n---DEBUG(",flagstr,")---\n",debugstr,"\n---/DEBUG(",flagstr,")---\n"}); + res_with_debug = stringAppendList({res,"\n---DEBUG(",flagstr,")---\n",debugstr,"\n---/DEBUG(",flagstr,")---\n"}); then res_with_debug; case (_,res) then res; end matchcontinue; @@ -226,7 +226,7 @@ algorithm Debug.fcall0("dumpgraphviz", Print.clearBuf); Debug.fprint("dump", "\nTrying to parse class definition...\n"); (p,msg) = Parser.parsestring(str); - true = stringEqual(msg, "Ok") "Always succeeds, check msg for errors" ; + true = stringEq(msg, "Ok") "Always succeeds, check msg for errors" ; Interactive.typeCheckFunction(p, isymb) "fails here if the string is not \"Ok\"" ; p_1 = Interactive.addScope(p, vars); vars_1 = Interactive.updateScope(p, vars); @@ -250,7 +250,7 @@ algorithm Debug.fprint("dump", "\nNot a class definition, trying expresion parser\n"); (exp,msg) = Parser.parsestringexp(str); - true = stringEqual(msg, "Ok") "always succeeds, check msg for errors" ; + true = stringEq(msg, "Ok") "always succeeds, check msg for errors" ; (evalstr,newisymb) = Interactive.evaluate(exp, isymb, false); Debug.fprint("dump", "\n--------------- Parsed expression ---------------\n"); Debug.fcall("dump", Dump.dumpIstmt, exp); @@ -265,8 +265,8 @@ algorithm Debug.fcall0("failtrace", Print.clearBuf); (p,msg) = Parser.parsestring(str); (p,expmsg) = Parser.parsestringexp(str); - false = stringEqual(msg, "Ok"); - false = stringEqual(expmsg, "Ok"); + false = stringEq(msg, "Ok"); + false = stringEq(expmsg, "Ok"); Debug.fprint("failtrace", "\nBoth parser and expression parser failed: \n"); Debug.fprintl("failtrace", {"parser: \n",msg,"\n"}); Debug.fprintl("failtrace", {"expparser: \n",expmsg,"\n"}); @@ -323,7 +323,7 @@ algorithm equation lst = System.strtok(filename, "."); last :: _ = listReverse(lst); - true = stringEqual(last, "mo"); + true = stringEq(last, "mo"); then (); @@ -331,7 +331,7 @@ algorithm equation lst = System.strtok(filename, "."); last :: _ = listReverse(lst); - true = stringEqual(last, "mof"); + true = stringEq(last, "mof"); then (); end matchcontinue; @@ -346,7 +346,7 @@ protected function isFlatModelicaFile algorithm lst := System.strtok(filename, "."); last :: _ := listReverse(lst); - true := stringEqual(last, "mof"); + true := stringEq(last, "mof"); end isFlatModelicaFile; protected function isModelicaScriptFile @@ -358,7 +358,7 @@ protected function isModelicaScriptFile algorithm lst := System.strtok(filename, "."); last :: _ := listReverse(lst); - true := stringEqual(last, "mos"); + true := stringEq(last, "mos"); end isModelicaScriptFile; protected function isCodegenTemplateFile @@ -370,7 +370,7 @@ protected function isCodegenTemplateFile algorithm lst := System.strtok(filename, "."); last :: _ := listReverse(lst); - true := stringEqual(last, "tpl"); + true := stringEq(last, "tpl"); end isCodegenTemplateFile; protected function versionRequest @@ -933,10 +933,10 @@ algorithm indexed_dlow_1 = BackendDAEUtil.calculateValues(indexed_dlow); Debug.fcall("dumpindxdae", BackendDump.dump, indexed_dlow_1); cname_str = Absyn.pathString(classname); - //filename = System.stringAppendList({cname_str,".cpp"}); - //funcfilename = System.stringAppendList({cname_str,"_functions.cpp"}); - //init_filename = System.stringAppendList({cname_str,"_init.txt"}); - //makefilename = System.stringAppendList({cname_str,".makefile"}); + //filename = stringAppendList({cname_str,".cpp"}); + //funcfilename = stringAppendList({cname_str,"_functions.cpp"}); + //init_filename = stringAppendList({cname_str,"_init.txt"}); + //makefilename = stringAppendList({cname_str,".makefile"}); a_cref = Absyn.pathToCref(classname); file_dir = CevalScript.getFileDir(a_cref, ap); Debug.fcall("execstat",print, "*** Main -> simcodgen -> generateFunctions: " +& realString(clock()) +& "\n" ); @@ -1119,7 +1119,7 @@ algorithm case (file,inSymbolTable) equation true = System.regularFileExists(file); - str = System.stringAppendList({"runScript(\"",file,"\")"}); + str = stringAppendList({"runScript(\"",file,"\")"}); (_,_,outSymbolTable) = handleCommand(str,inSymbolTable); then outSymbolTable; @@ -1217,7 +1217,7 @@ algorithm // print("OMHOME:" +& omhome +& "|"); true = "Windows_NT" ==& System.os(); oldpath = System.readEnv("PATH"); - newpath = System.stringAppendList({omhome,"\\mingw\\bin;",omhome,"\\lib;",oldpath}); + newpath = stringAppendList({omhome,"\\mingw\\bin;",omhome,"\\lib;",oldpath}); _ = System.setEnv("PATH",newpath,true); then fail(); diff --git a/Compiler/Main_stub.mo b/Compiler/Main_stub.mo index df113bb4ca6..1ea5ab27262 100644 --- a/Compiler/Main_stub.mo +++ b/Compiler/Main_stub.mo @@ -117,7 +117,7 @@ protected function makeDebugResult Boolean dumpflag; algorithm debugstr := Print.getString(); - res_with_debug := System.stringAppendList( + res_with_debug := stringAppendList( {res,"\n---DEBUG(",flagstr,")---\n",debugstr,"\n---/DEBUG(", flagstr,")---\n"}); dumpflag := RTOpts.debugFlag(flagstr); @@ -159,14 +159,14 @@ algorithm equation lst = System.strtok(filename, "."); (last :: _) = listReverse(lst); - true = stringEqual(last, "mo"); + true = stringEq(last, "mo"); then (); case (filename) equation lst = System.strtok(filename, "."); (last :: _) = listReverse(lst); - true = stringEqual(last, "mof"); + true = stringEq(last, "mof"); then (); end matchcontinue; @@ -181,7 +181,7 @@ protected function isFlatModelicaFile algorithm lst := System.strtok(filename, "."); (last :: _) := listReverse(lst); - true := stringEqual(last, "mof"); + true := stringEq(last, "mof"); end isFlatModelicaFile; protected function versionRequest diff --git a/Compiler/Mod.mo b/Compiler/Mod.mo index 3ba39c54405..898e47d4420 100644 --- a/Compiler/Mod.mo +++ b/Compiler/Mod.mo @@ -1052,7 +1052,7 @@ algorithm case (DAE.NAMEMOD(ident = n1,mod = m1),(DAE.NAMEMOD(ident = n2,mod = m2) :: tail),env,pre) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); m = merge(m1, m2, env, pre); then (DAE.NAMEMOD(n1,m) :: tail); @@ -1262,7 +1262,7 @@ algorithm // found our modification case ((x as DAE.NAMEMOD(ident = id1)) :: rest,id2) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); lst = lookupNamedModifications(rest, id2); then x :: lst; @@ -1270,7 +1270,7 @@ algorithm // a named modification that doesn't match, skip it case ((x as DAE.NAMEMOD(ident = id1)) :: rest,id2) equation - false = stringEqual(id1, id2); + false = stringEq(id1, id2); lst = lookupNamedModifications(rest, id2); then lst; @@ -1680,7 +1680,7 @@ algorithm DAE.REDECL(finalPrefix = f2,tplSCodeElementModLst = {(SCode.COMPONENT(component = id2,modifications = m2,comment = comment2,cc=cc),_)}),env,pre) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); m1_1 = elabUntypedMod(m2, env, pre); m2_1 = elabUntypedMod(m2, env, pre); m_2 = merge(m1_1, m2_1, env, pre); @@ -1785,7 +1785,7 @@ algorithm // named mods, modifications in the list take precedence case (DAE.NAMEMOD(ident = n1,mod = m1),(DAE.NAMEMOD(ident = n2,mod = m2) :: ss),env,pre) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); m = merge(m1, m2, env, pre); then (DAE.NAMEMOD(n1,m),ss); @@ -1837,7 +1837,7 @@ algorithm // named mods, modifications in the list take precedence case ((DAE.NAMEMOD(ident = n1,mod = m1) :: ss),DAE.NAMEMOD(ident = n2,mod = m2),env,pre) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); m = merge(m1, m2, env, pre); then (ss,DAE.NAMEMOD(n1,m)); @@ -1872,7 +1872,7 @@ algorithm case (DAE.NAMEMOD(ident = n1),DAE.NAMEMOD(ident = n2)) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); then false; case (DAE.IDXMOD(integerLst = i1),DAE.IDXMOD(integerLst = i2)) @@ -2038,7 +2038,7 @@ algorithm case ({},{}) then true; case (DAE.NAMEMOD(id1,mod1)::subModLst1,DAE.NAMEMOD(id2,mod2)::subModLst2) equation - true = stringEqual(id1,id2); + true = stringEq(id1,id2); b1 = modEqual(mod1,mod2); b2 = subModsEqual(subModLst1,subModLst2); equal = Util.boolAndList({b1,b2}); @@ -2100,7 +2100,7 @@ algorithm case (DAE.NAMEMOD(id1,mod1)::subModLst1,DAE.NAMEMOD(id2,mod2)::subModLst2) equation - true = stringEqual(id1,id2); + true = stringEq(id1,id2); b1 = modEqual(mod1,mod2); b2 = subModsEqual(subModLst1,subModLst2); equal = Util.boolAndList({b1,b2}); @@ -2198,7 +2198,7 @@ algorithm finalPrefixstr = Util.if_(finalPrefix, " final", ""); str_lst = Util.listMap(elist_1, SCode.printElementStr); str = Util.stringDelimitList(str_lst, ", "); - res = System.stringAppendList({"(redeclare(",finalPrefixstr,str,"))"}); + res = stringAppendList({"(redeclare(",finalPrefixstr,str,"))"}); then res; case DAE.MOD(finalPrefix = finalPrefix,each_ = each_,subModLst = subs,eqModOption = eq) @@ -2208,7 +2208,7 @@ algorithm s1_1 = Util.stringDelimitList(s1, ","); s1_1 = Util.if_(listLength(subs)>=1," {" +& s1_1 +& "} ",s1_1); s2 = printEqmodStr(eq); - str = System.stringAppendList({finalPrefixstr,s1_1,s2}); + str = stringAppendList({finalPrefixstr,s1_1,s2}); then str; case(_) equation print(" failure in printModStr \n"); then fail(); @@ -2404,7 +2404,7 @@ algorithm Print.printBuf("["); s = intString(x); str = printSubscripts2Str(xs); - res = System.stringAppendList({"[",s,str,"]"}); + res = stringAppendList({"[",s,str,"]"}); then res; end matchcontinue; @@ -2426,7 +2426,7 @@ algorithm Print.printBuf(","); s = intString(x); str = printSubscripts2Str(xs); - res = System.stringAppendList({",",s,str}); + res = stringAppendList({",",s,str}); then res; end matchcontinue; @@ -2450,14 +2450,14 @@ algorithm str = ExpressionDump.printExpStr(e); str2 = Types.printPropStr(prop); e_val_str = ValuesUtil.valString(e_val); - res = System.stringAppendList({" = (typed)",str," ",str2,", E_VALUE: ",e_val_str}); + res = stringAppendList({" = (typed)",str," ",str2,", E_VALUE: ",e_val_str}); then res; case SOME(DAE.TYPED(e,NONE(),prop,_)) equation str = ExpressionDump.printExpStr(e); str2 = Types.printPropStr(prop); - res = System.stringAppendList({" = (typed)",str,str2}); + res = stringAppendList({" = (typed)",str,str2}); then res; case SOME(DAE.UNTYPED(e)) @@ -2543,7 +2543,7 @@ algorithm equation lst = getAllIndexesFromIdxMods(rest); // from an index list {1, 2} make a string such as 1.2 - str = System.stringAppendList(Util.listMap(il, intStringDot)); + str = stringAppendList(Util.listMap(il, intStringDot)); then (str,submod)::lst; // ignore named modifs diff --git a/Compiler/ModUtil.mo b/Compiler/ModUtil.mo index 9e4141f0e20..ff26c216d8e 100644 --- a/Compiler/ModUtil.mo +++ b/Compiler/ModUtil.mo @@ -588,13 +588,13 @@ algorithm // ident vs. ident case (Absyn.IDENT(id1),Absyn.IDENT(id2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then true; // qual ident vs. qual ident case (Absyn.QUALIFIED(id1, path1),Absyn.QUALIFIED(id2, path2)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); true = pathEqual(path1, path2); then true; diff --git a/Compiler/Patternm.mo b/Compiler/Patternm.mo index e90a13345c7..89e49731590 100644 --- a/Compiler/Patternm.mo +++ b/Compiler/Patternm.mo @@ -2215,7 +2215,7 @@ algorithm equation true = constantOrNot(first); constName = getConstantName(first); - true = stringEqual(constName,localMatchObj); + true = stringEq(constName,localMatchObj); then findMatches(localMatchObj,rest,listAppend(localAccIndList,{localPivot}),localPivot+1); case (localMatchObj,first :: rest,localAccIndList,localPivot) local @@ -2223,7 +2223,7 @@ algorithm equation true = constructorOrNot(first); constructorName = getConstructorName(first); - true = stringEqual(constructorName,localMatchObj); + true = stringEq(constructorName,localMatchObj); then findMatches(localMatchObj,rest,listAppend(localAccIndList,{localPivot}),localPivot+1); case (localMatchObj,_ :: rest,localAccIndList,localPivot) then findMatches(localMatchObj,rest,localAccIndList,localPivot+1); @@ -2281,7 +2281,7 @@ algorithm case (_,{}) then Absyn.CREF(Absyn.WILD()); case (localFieldName,Absyn.NAMEDARG(aName,e) :: _) equation - true = stringEqual(localFieldName,aName); + true = stringEq(localFieldName,aName); then e; case (localFieldName,_ :: restNamedArgList) equation @@ -2523,7 +2523,7 @@ algorithm Absyn.Ident firstName; Integer firstNum; equation - true = stringEqual(id,firstName); + true = stringEq(id,firstName); then firstNum; case (id,_ :: restList) local @@ -2691,7 +2691,7 @@ algorithm Integer n; equation stateVar2 = DFA.extractPathVar(p); - true = stringEqual(stateVar,stateVar2); + true = stringEq(stateVar,stateVar2); n = matchArcs(localSavedStates,arcs1,arcs2); then n; @@ -2725,7 +2725,7 @@ algorithm list> rest2; Integer n; equation - true = stringEqual(patName1,patName2); + true = stringEq(patName1,patName2); true = (nextState1 == nextState2); n = matchArcs(localSavedStates,rest1,rest2); then n; @@ -2741,7 +2741,7 @@ algorithm DFA.Stamp nextState; Integer n; equation - true = stringEqual(patName1,patName2); + true = stringEq(patName1,patName2); state2 = localSavedStates[nextState]; n = matchStates(localSavedStates,state1,state2); false = (n == 0); diff --git a/Compiler/Refactor.mo b/Compiler/Refactor.mo index b4d5ee26aba..56ac2130612 100644 --- a/Compiler/Refactor.mo +++ b/Compiler/Refactor.mo @@ -2785,7 +2785,7 @@ algorithm equation str1 = Absyn.pathLastIdent(ip1); str2 = Absyn.pathFirstIdent(ip2); - false = stringEqual(str1, str2); + false = stringEq(str1, str2); p1 = Absyn.stripLast(ip1); out = fixPaths(p1, ip2); then @@ -2795,7 +2795,7 @@ algorithm equation str1 = Absyn.pathLastIdent(ip1); str2 = Absyn.pathFirstIdent(ip2); - true = stringEqual(str1, str2); + true = stringEq(str1, str2); p1 = Absyn.stripLast(ip1); out = Absyn.joinPaths(p1, ip2); then diff --git a/Compiler/SCode.mo b/Compiler/SCode.mo index 3eeb14c3b4e..76bc5263773 100644 --- a/Compiler/SCode.mo +++ b/Compiler/SCode.mo @@ -552,7 +552,7 @@ algorithm str_lst = Util.listMap(eqn_lst, equationStr); s2 = Util.stringDelimitList(str_lst, "\n"); s3 = elseWhenEquationStr(tplAbsynExpEEquationLstLst); - res = System.stringAppendList({"\nelsewhen ",s1," then\n",s2,"\n", s3}); + res = stringAppendList({"\nelsewhen ",s1," then\n",s2,"\n", s3}); then res; end matchcontinue; @@ -585,21 +585,21 @@ algorithm s2 = Util.stringDelimitList(tb_strs, "\n"); s3 = Util.stringDelimitList(fb_strs, "\n"); s4 = elseIfEquationStr(ifexp,tb); - res = System.stringAppendList({"if ",s1," then ",s2,s4,"else ",s3,"end if;"}); + res = stringAppendList({"if ",s1," then ",s2,s4,"else ",s3,"end if;"}); then res; case (EQ_EQUALS(expLeft = e1,expRight = e2)) equation s1 = Dump.printExpStr(e1); s2 = Dump.printExpStr(e2); - res = System.stringAppendList({s1," = ",s2,";"}); + res = stringAppendList({s1," = ",s2,";"}); then res; case (EQ_CONNECT(crefLeft = cr1,crefRight = cr2)) equation s1 = Dump.printComponentRefStr(cr1); s2 = Dump.printComponentRefStr(cr2); - res = System.stringAppendList({"connect(",s1,", ",s2,");"}); + res = stringAppendList({"connect(",s1,", ",s2,");"}); then res; case (EQ_FOR(index = id,range = exp,eEquationLst = eqn_lst)) @@ -607,7 +607,7 @@ algorithm s1 = Dump.printExpStr(exp); str_lst = Util.listMap(eqn_lst, equationStr); s2 = Util.stringDelimitList(str_lst, "\n"); - res = System.stringAppendList({"for ",id," in ",s1," loop\n",s2,"\nend for;"}); + res = stringAppendList({"for ",id," in ",s1," loop\n",s2,"\nend for;"}); then res; case (EQ_WHEN(condition=exp, eEquationLst=eqn_lst, tplAbsynExpEEquationLstLst=tplAbsynExpEEquationLstLst)) @@ -616,21 +616,21 @@ algorithm str_lst = Util.listMap(eqn_lst, equationStr); s2 = Util.stringDelimitList(str_lst, "\n"); s3 = elseWhenEquationStr(tplAbsynExpEEquationLstLst); - res = System.stringAppendList({"when ",s1," then\n",s2,s3,"\nend when;"}); + res = stringAppendList({"when ",s1," then\n",s2,s3,"\nend when;"}); then res; case (EQ_ASSERT(condition = e1,message = e2)) equation s1 = Dump.printExpStr(e1); s2 = Dump.printExpStr(e2); - res = System.stringAppendList({"assert(",s1,", ",s2,");"}); + res = stringAppendList({"assert(",s1,", ",s2,");"}); then res; case (EQ_REINIT(cref = cr,expReinit = e1)) equation s1 = Dump.printComponentRefStr(cr); s2 = Dump.printExpStr(e1); - res = System.stringAppendList({"reinit(",s1,", ",s2,");"}); + res = stringAppendList({"reinit(",s1,", ",s2,");"}); then res; case(EQ_NORETCALL(functionName = cr, functionArgs = fargs)) @@ -778,20 +778,20 @@ algorithm case (id2,((comp as COMPONENT(component = id1)) :: _)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then comp; case (id2,(COMPONENT(component = id1) :: xs)) equation - false = stringEqual(id1, id2); + false = stringEq(id1, id2); elt = getElementNamedFromElts(id2, xs); then elt; case (id2,(CLASSDEF(name = id1) :: xs)) equation - false = stringEqual(id1, id2); + false = stringEq(id1, id2); elt = getElementNamedFromElts(id2, xs); then elt; @@ -804,7 +804,7 @@ algorithm case (id2,((cdef as CLASSDEF(name = id1)) :: _)) equation - true = stringEqual(id1, id2); + true = stringEq(id1, id2); then cdef; @@ -851,7 +851,7 @@ algorithm finalPrefixstr = Util.if_(b, "final", ""); strs = Util.listMap(elist, printElementStr); str = Util.stringDelimitList(strs, ","); - res = System.stringAppendList({"redeclare(",finalPrefixstr,str,")"}); + res = stringAppendList({"redeclare(",finalPrefixstr,str,")"}); then res; case MOD(finalPrefix = finalPrefix,eachPrefix = each_,subModLst = subs,absynExpOption = ass) @@ -860,7 +860,7 @@ algorithm each_str = Dump.unparseEachStr(each_); subs_str = printSubs1Str(subs); ass_str = printEqmodStr(ass); - res = System.stringAppendList({finalPrefixstr,each_str,subs_str,ass_str}); + res = stringAppendList({finalPrefixstr,each_str,subs_str,ass_str}); then res; case _ @@ -951,7 +951,7 @@ algorithm equation mod_str = printModStr(mod); str = printSubsStr(subs); - res = System.stringAppendList({n, " ", mod_str, ", ", str}); + res = stringAppendList({n, " ", mod_str, ", ", str}); then res; case {IDXMOD(subscriptLst = ss,an = mod)} @@ -966,7 +966,7 @@ algorithm str = Dump.printSubscriptsStr(ss); mod_str = printModStr(mod); sub_str = printSubsStr(subs); - res = System.stringAppendList({str,mod_str,", ",sub_str}); + res = stringAppendList({str,mod_str,", ",sub_str}); then res; end matchcontinue; @@ -987,7 +987,7 @@ algorithm case l equation s = printSubsStr(l); - res = System.stringAppendList({"(",s,")"}); + res = stringAppendList({"(",s,")"}); then res; end matchcontinue; @@ -1070,13 +1070,13 @@ algorithm equation str = Absyn.pathString(path); modStr = printModStr(mod); - res = System.stringAppendList({"EXTENDS(",str,", modification=",modStr,")"}); + res = stringAppendList({"EXTENDS(",str,", modification=",modStr,")"}); then res; case CLASSDEF(name = n,finalPrefix = finalPrefix,replaceablePrefix = repl,classDef = cl) equation str = printClassStr(cl); - res = System.stringAppendList({"CLASSDEF(",n,",",str,")"}); + res = stringAppendList({"CLASSDEF(",n,",",str,")"}); then res; case COMPONENT(component = n,innerOuter=io,finalPrefix = finalPrefix,replaceablePrefix = repl, @@ -1087,13 +1087,13 @@ algorithm s = Dump.unparseTypeSpec(tySpec); vs = variabilityString(var); str2 = innerouterString(io); - res = System.stringAppendList({"COMPONENT(",n, " in/out: ", str2, " mod: ",mod_str, " tp: ", s," var :",vs,")"}); + res = stringAppendList({"COMPONENT(",n, " in/out: ", str2, " mod: ",mod_str, " tp: ", s," var :",vs,")"}); then res; case CLASSDEF(name = n,finalPrefix = finalPrefix,replaceablePrefix = repl,classDef = cl) equation str = printClassStr(cl); - res = System.stringAppendList({"CLASSDEF(",n,",...,",str,")"}); + res = stringAppendList({"CLASSDEF(",n,",...,",str,")"}); then res; case (IMPORT(imp = imp)) @@ -1125,7 +1125,7 @@ algorithm case EXTENDS(baseClassPath = path,modifications = mod) equation str = Absyn.pathString(path); - res = System.stringAppendList({"extends ",str,";"}); + res = stringAppendList({"extends ",str,";"}); then res; @@ -1136,15 +1136,15 @@ algorithm mod_str = printModStr(mod); s = Dump.unparseTypeSpec(typath); vs = unparseVariability(var); - vs = Util.if_(stringEqual(vs, ""), "", vs +& " "); - res = System.stringAppendList({ioStr,vs,s," ",n," ",mod_str,";\n"}); + vs = Util.if_(stringEq(vs, ""), "", vs +& " "); + res = stringAppendList({ioStr,vs,s," ",n," ",mod_str,";\n"}); then res; case CLASSDEF(name = n,classDef = cl) equation str = printClassStr(cl); - res = System.stringAppendList({"class ",n,"\n",str,"end ",n,";\n"}); + res = stringAppendList({"class ",n,"\n",str,"end ",n,";\n"}); then res; @@ -1170,7 +1170,7 @@ algorithm equation s = printClassdefStr(def); re = restrString(rest); - res = System.stringAppendList({"CLASS(",id,",_,_,",re,",",s,")\n"}); + res = stringAppendList({"CLASS(",id,",_,_,",re,",",s,")\n"}); then res; end matchcontinue; @@ -1206,7 +1206,7 @@ algorithm equation elts_str = Util.listMap(elts, printElementStr); s1 = Util.stringDelimitList(elts_str, ",\n"); - res = System.stringAppendList({"PARTS(\n",s1,",_,_,_,_,_)"}); + res = stringAppendList({"PARTS(\n",s1,",_,_,_,_,_)"}); then res; /* adrpo: handle also the case: model extends X end X; */ @@ -1221,33 +1221,33 @@ algorithm equation elts_str = Util.listMap(elts, printElementStr); s1 = Util.stringDelimitList(elts_str, ",\n"); - res = System.stringAppendList({"CLASS_EXTENDS(", baseClassName, " PARTS(\n",s1,",_,_,_,_,_)"}); + res = stringAppendList({"CLASS_EXTENDS(", baseClassName, " PARTS(\n",s1,",_,_,_,_,_)"}); then res; case (DERIVED(typeSpec = typeSpec,modifications = mod)) equation s2 = Dump.unparseTypeSpec(typeSpec); s3 = printModStr(mod); - res = System.stringAppendList({"DERIVED(",s2,",",s3,")"}); + res = stringAppendList({"DERIVED(",s2,",",s3,")"}); then res; case (ENUMERATION(enumLst, _)) equation s1 = Util.stringDelimitList(Util.listMap(enumLst, printEnumStr), ", "); - res = System.stringAppendList({"ENUMERATION(", s1, ")"}); + res = stringAppendList({"ENUMERATION(", s1, ")"}); then res; case (OVERLOAD(plst, _)) equation s1 = Util.stringDelimitList(Util.listMap(plst, Absyn.pathString), ", "); - res = System.stringAppendList({"OVERLOAD(", s1, ")"}); + res = stringAppendList({"OVERLOAD(", s1, ")"}); then res; case (PDER(path, slst, _)) equation s1 = Absyn.pathString(path); s2 = Util.stringDelimitList(slst, ", "); - res = System.stringAppendList({"PDER(", s1, ", ", s2, ")"}); + res = stringAppendList({"PDER(", s1, ", ", s2, ")"}); then res; case (_) @@ -1548,7 +1548,7 @@ public function elementEqual case (CLASSDEF(name1,f1,r1,cl1,_),CLASSDEF(name2,f2,r2,cl2,_)) equation - b1 = stringEqual(name1,name2); + b1 = stringEq(name1,name2); b2 = Util.boolEqual(f1,f2); b3 = Util.boolEqual(r1,r2); b3 = classEqual(cl1,cl2); @@ -1558,7 +1558,7 @@ public function elementEqual equation equality(cond1 = cond2); equality(cc1 = cc2); // TODO! FIXME! this might fail for different comments! - b1 = stringEqual(name1,name2); + b1 = stringEq(name1,name2); b1a = ModUtil.innerOuterEqual(io,io2); b2 = Util.boolEqual(f1,f2); b3 = Util.boolEqual(r1,r2); @@ -1580,7 +1580,7 @@ public function elementEqual then equal; case (DEFINEUNIT(name1,os1,or1), DEFINEUNIT(name2,os2,or2)) equation - b1 = stringEqual(name1,name2); + b1 = stringEq(name1,name2); equality(os1 = os2); equality(or1 = or2); then b1; @@ -1625,7 +1625,7 @@ algorithm Absyn.Info info1,info2; case (CLASS(name1,p1,e1,restr1,parts1,info1), CLASS(name2,p2,e2,restr2,parts2,info2)) equation - b1 = stringEqual(name1,name2); + b1 = stringEq(name1,name2); b2 = Util.boolEqual(p1,p2); b3 = Util.boolEqual(e1,e2); b4 = restrictionEqual(restr1,restr2); @@ -1675,7 +1675,7 @@ algorithm case (ENUM(s1,_), ENUM(s2,_)) equation - b1 = stringEqual(s1, s2); + b1 = stringEq(s1, s2); // ignore comments here. then b1; end matchcontinue; @@ -1744,7 +1744,7 @@ protected function classDefEqual blst3 = Util.listThreadMap(ieqns1,ieqns2,equationEqual); blst4 = Util.listThreadMap(algs1,algs2,algorithmEqual); blst5 = Util.listThreadMap(ialgs1,ialgs2,algorithmEqual); - b1 = stringEqual(bcName1,bcName2); + b1 = stringEq(bcName1,bcName2); b2 = modEqual(mod1,mod2); // adrpo: ignore annotations! // blst6 = Util.listThreadMap(anns1,anns2,annotationEqual); @@ -1755,7 +1755,7 @@ protected function classDefEqual case (cdef1 as PDER(p1,ilst1,_),cdef2 as PDER(p2,ilst2,_)) equation - blst = Util.listThreadMap(ilst1,ilst2,stringEqual); + blst = Util.listThreadMap(ilst1,ilst2,stringEq); equal = Util.boolAndList(blst); then equal; // adrpo: TODO! FIXME! are these below really needed??!! @@ -1936,7 +1936,7 @@ algorithm equation blst1 = Util.listThreadMap(eql1,eql2,equationEqual2); b1 = Absyn.expEqual(exp1,exp2); - b2 = stringEqual(id1,id2); + b2 = stringEq(id1,id2); equal = Util.boolAndList(b1::b2::blst1); then equal; case (EQ_WHEN(condition = cond1, eEquationLst = elst1),EQ_WHEN(condition = cond2, eEquationLst = elst2)) // TODO: elsewhen not checked yet. @@ -2043,7 +2043,7 @@ algorithm case ({},{}) then true; case (NAMEMOD(id1,mod1)::subModLst1,NAMEMOD(id2,mod2)::subModLst2) equation - b1 = stringEqual(id1,id2); + b1 = stringEq(id1,id2); b2 = modEqual(mod1,mod2); b3 = subModsEqual(subModLst1,subModLst2); equal = Util.boolAndList({b1,b2,b3}); @@ -2283,14 +2283,14 @@ algorithm then lst; case (id,EQ_FOR(index = id_1, range = e_1, eEquationLst = eeqLst)) equation - false = stringEqual(id, id_1); + false = stringEq(id, id_1); lst_1=Absyn.findIteratorInExp(id,e_1); lst_2=findIteratorInEEquationLst(id,eeqLst); lst=listAppend(lst_1,lst_2); then lst; case (id,EQ_FOR(index = id_1, range = e_1, eEquationLst = eeqLst)) equation - true = stringEqual(id, id_1); + true = stringEq(id, id_1); lst=Absyn.findIteratorInExp(id,e_1); then lst; case (id,EQ_WHEN(condition = e_1, eEquationLst = eeqLst, tplAbsynExpEEquationLstLst = ew)) diff --git a/Compiler/SimCode.mo b/Compiler/SimCode.mo index 33f33ff9267..da19a4b8d1d 100644 --- a/Compiler/SimCode.mo +++ b/Compiler/SimCode.mo @@ -2701,7 +2701,7 @@ algorithm list str; equation str = Util.listMap(comp,intString); - Debug.fprintln("failtrace"," Failed to create Equation with:" +& System.stringAppendList(str)); + Debug.fprintln("failtrace"," Failed to create Equation with:" +& stringAppendList(str)); Error.addMessage(Error.INTERNAL_ERROR, {"createEquations failed"}); then fail(); @@ -2762,7 +2762,7 @@ algorithm list str; equation str = Util.listMap(comp,intString); - Debug.fprintln("failtrace"," Failed to create EquationLin with:" +& System.stringAppendList(str)); + Debug.fprintln("failtrace"," Failed to create EquationLin with:" +& stringAppendList(str)); Error.addMessage(Error.INTERNAL_ERROR, {"createEquationsLin failed"}); then fail(); @@ -2918,7 +2918,7 @@ algorithm false = ComponentReference.crefEqualNoStringCompare(BackendVariable.varCref(v),varOutput); alg = alg[indx + 1]; algStr = DAEDump.dumpAlgorithmsStr({DAE.ALGORITHM(alg,source)}); - message = System.stringAppendList({"Inverse Algorithm needs to be solved for in ",algStr,". This is not implemented yet.\n"}); + message = stringAppendList({"Inverse Algorithm needs to be solved for in ",algStr,". This is not implemented yet.\n"}); Error.addMessage(Error.INTERNAL_ERROR,{message}); then fail(); end matchcontinue; @@ -3034,7 +3034,7 @@ algorithm false = ComponentReference.crefEqualNoStringCompare(BackendVariable.varCref(v),varOutput); alg = alg[indx + 1]; algStr = DAEDump.dumpAlgorithmsStr({DAE.ALGORITHM(alg,source)}); - message = System.stringAppendList({"Inverse Algorithm needs to be solved for in ",algStr,". This is not implemented yet.\n"}); + message = stringAppendList({"Inverse Algorithm needs to be solved for in ",algStr,". This is not implemented yet.\n"}); Error.addMessage(Error.INTERNAL_ERROR,{message}); then fail(); end matchcontinue; @@ -4352,7 +4352,7 @@ algorithm // The variables solved for and the output variables of the algorithm must be the same. false = Util.listSetEqualOnTrue(solvedVars,algOutVars,ComponentReference.crefEqualNoStringCompare); algStr = DAEDump.dumpAlgorithmsStr({DAE.ALGORITHM(alg,source)}); - message = System.stringAppendList({"Inverse Algorithm needs to be solved for in ",algStr,". This is not implemented yet.\n"}); + message = stringAppendList({"Inverse Algorithm needs to be solved for in ",algStr,". This is not implemented yet.\n"}); Error.addMessage(Error.INTERNAL_ERROR,{message}); then fail(); case (_,_) @@ -5678,7 +5678,7 @@ algorithm i_str = intString(i); helpVarIndexStr = intString(helpVarIndex); helpInfo = (helpVarIndex,e,i); - res = System.stringAppendList( + res = stringAppendList( {" if (edge(localData->helpVars[",helpVarIndexStr,"])) AddEvent(",i_str, " + localData->nZeroCrossing);\n"}); helpVarIndex_1 = helpVarIndex + 1; @@ -5691,7 +5691,7 @@ algorithm i_str = intString(i); helpVarIndexStr = intString(helpVarIndex); helpInfo = (helpVarIndex,e,i); - res = System.stringAppendList( + res = stringAppendList( {" else if (edge(localData->helpVars[",helpVarIndexStr,"])) AddEvent(",i_str, " + localData->nZeroCrossing);\n"}); helpVarIndex_1 = helpVarIndex + 1; @@ -5967,7 +5967,7 @@ protected algorithm crStr := ComponentReference.printComponentRefStr(cr); indxStr := intString(indx); - str := System.stringAppendList({"if (change(",crStr,")) { needToIterate=1; }"}); + str := stringAppendList({"if (change(",crStr,")) { needToIterate=1; }"}); end buildDiscreteVarChangesAddEvent; protected function mixedCollectRelations "function: mixedCollectRelations @@ -7978,7 +7978,7 @@ algorithm local DAE.Ident ident; Boolean b; case (DAE.CREF_QUAL(ident = ident)) equation - b = stringEqual(ident,BackendDAE.derivativeNamePrefix); + b = stringEq(ident,BackendDAE.derivativeNamePrefix); then b; case (_) then false; end matchcontinue; @@ -8116,7 +8116,7 @@ protected function hashFunc " String crstr; algorithm crstr := ComponentReference.printComponentRefStr(cr); - res := System.hash(crstr); + res := stringHashDjb2(crstr); end hashFunc; protected function keyEqual diff --git a/Compiler/Static.mo b/Compiler/Static.mo index 26ba991e0a6..f18e696e4b1 100644 --- a/Compiler/Static.mo +++ b/Compiler/Static.mo @@ -1828,7 +1828,7 @@ algorithm s4 = Types.unparseConst(const); s5 = Util.if_(impl, "impl", "expl"); s6 = ExpressionDump.typeString(expty); - str = System.stringAppendList({"(",sp,":",s1,":",s2,":",s3,") ",s4," ",s5," ",s6}); + str = stringAppendList({"(",sp,":",s1,":",s2,":",s3,") ",s4," ",s5," ",s6}); Debug.fprintln("failtrace", str); then fail(); @@ -2342,7 +2342,7 @@ algorithm e_str = Dump.printExpStr(e); strs = Util.listMap(es, Dump.printExpStr); str = Util.stringDelimitList(strs, ","); - elt_str = System.stringAppendList({"[",str,"]"}); + elt_str = stringAppendList({"[",str,"]"}); t1_str = Types.unparseType(t1); t2_str = Types.unparseType(t2); Error.addSourceMessage(Error.TYPE_MISMATCH_ARRAY_EXP, {sp,e_str,t1_str,elt_str,t2_str}, info); @@ -2852,7 +2852,7 @@ algorithm dim2_str = ExpressionDump.dimensionString(dim2); pre_str = PrefixUtil.printPrefixStr3(inPrefix); el_str = ExpressionDump.printListStr(el, Dump.printExpStr, ", "); - el_str1 = System.stringAppendList({"[",el_str,"]"}); + el_str1 = stringAppendList({"[",el_str,"]"}); Error.addSourceMessage(Error.MATRIX_EXP_ROW_SIZE, {pre_str,el_str1,dim1_str,dim2_str},info); then fail(); @@ -3260,7 +3260,7 @@ algorithm expstrs = Util.listMap(dims, Dump.printExpStr); expstr = Util.stringDelimitList(expstrs, ", "); sp = PrefixUtil.printPrefixStr3(pre); - str = System.stringAppendList({expstr," impl=",implstr,", in component: ",sp}); + str = stringAppendList({expstr," impl=",implstr,", in component: ",sp}); Debug.fprintln("failtrace", str); then fail(); @@ -3821,7 +3821,7 @@ algorithm equation el_str = ExpressionDump.printListStr(expl, Dump.printExpStr, ", "); pre_str = PrefixUtil.printPrefixStr3(pre); - s = System.stringAppendList({"pre(",el_str,")"}); + s = stringAppendList({"pre(",el_str,")"}); Error.addSourceMessage(Error.WRONG_TYPE_OR_NO_OF_ARGS, {s,pre_str}, info); then fail(); @@ -5677,7 +5677,7 @@ algorithm lst = Util.listMap(expl, Dump.printExpStr); s = Util.stringDelimitList(lst, ", "); sp = PrefixUtil.printPrefixStr3(pre); - s = System.stringAppendList({"der(",s,")"}); + s = stringAppendList({"der(",s,")"}); Error.addSourceMessage(Error.WRONG_TYPE_OR_NO_OF_ARGS, {s,sp}, info); then fail(); end matchcontinue; @@ -5893,7 +5893,7 @@ algorithm lst = Util.listMap((dim_aexp :: matrices), Dump.printExpStr); s = Util.stringDelimitList(lst, ", "); sp = PrefixUtil.printPrefixStr3(pre); - str = System.stringAppendList({"cat(",s,")"}); + str = stringAppendList({"cat(",s,")"}); Error.addSourceMessage(Error.DIFFERENT_DIM_SIZE_IN_ARGUMENTS, {str,sp}, info); then fail(); @@ -7061,7 +7061,7 @@ algorithm //print(" error, handler found for " +& name +& "\n"); lst = Util.listMap(expl, Dump.printExpStr); s = Util.stringDelimitList(lst, ", "); - s = System.stringAppendList({name,"(",s,")'.\n"}); + s = stringAppendList({name,"(",s,")'.\n"}); ps = PrefixUtil.printPrefixStr3(pre); Error.addSourceMessage(Error.WRONG_TYPE_OR_NO_OF_ARGS, {s,ps}, info); then @@ -8083,7 +8083,7 @@ algorithm then {}; case (name, (Absyn.NAMEDARG(argName = argName, argValue = Absyn.ARRAY(arrayExp = absynExpList)) :: _)) equation - true = stringEqual(name, argName); + true = stringEq(name, argName); daeExpList = absynExpListToDaeExpList(absynExpList); then daeExpList; case (name, _::rest) @@ -8150,7 +8150,7 @@ algorithm case (cache,env,st,impl,id,tp,(Absyn.NAMEDARG(argName = id2,argValue = exp) :: xs),dexp,pre,info) local Absyn.Exp exp; equation - true = stringEqual(id, id2); + true = stringEq(id, id2); (cache,exp_1,DAE.PROP(t,c1),_) = elabExp(cache,env, exp, impl, st,true,pre,info); (exp_2,_) = Types.matchType(exp_1, t, tp, true); then @@ -8259,7 +8259,7 @@ algorithm case ("","",bt) then true; // rebuild all the time if the function has no file! case (newf,oldf,bt) equation - true = stringEqual(newf, oldf); // the files should be the same! + true = stringEq(newf, oldf); // the files should be the same! // the new file nf should have an older modification time than the last build SOME(nfmt) = System.getFileModificationTime(newf); true = realGt(bt, nfmt); // the file was not modified since last build @@ -8461,7 +8461,7 @@ algorithm SCode.DERIVED(typeSpec as Absyn.TPATH(extendsPath, arrayDim), modifications, attributes, comment),info), classEnv, cn) equation - // System.enableTrace(); + // enableTrace(); // change the class name from gravityAcceleration to be world.gravityAcceleration name = componentName +& "." +& name; // remove modifications as they are added via transformModificationsToNamedArguments @@ -8488,7 +8488,7 @@ algorithm case(cache, env, sc as SCode.CLASS(name, partialPrefix, encapsulatedPrefix, restriction, classDef as _, info), classEnv, cn) equation - // System.enableTrace(); + // enableTrace(); // change the class name from gravityAcceleration to be world.gravityAcceleration name = componentName +& "." +& name; // remove modifications as they are added via transformModificationsToNamedArguments @@ -10149,7 +10149,7 @@ algorithm str = Dump.getOptionStr(exp, ExpressionDump.printExpStr); str_lst = Util.listMap(ds, ExpressionDump.dimensionString); s = Util.stringDelimitList(str_lst, ", "); - s1 = System.stringAppendList({"SLOT(",farg_str,", ",filledStr,", ",str,", [",s,"])\n"}); + s1 = stringAppendList({"SLOT(",farg_str,", ",filledStr,", ",str,", [",s,"])\n"}); s2 = printSlotsStr(xs); res = stringAppend(s1, s2); then @@ -10380,12 +10380,12 @@ algorithm list> ts; case (id,(id2,ty) :: ts) equation - true = stringEqual(id, id2); + true = stringEq(id, id2); then ty; case (id,(id2,_) :: ts) equation - false = stringEqual(id, id2); + false = stringEq(id, id2); ty = findNamedArgType(id, ts); then ty; @@ -10420,21 +10420,21 @@ algorithm case ((fa1,_),exp,ds,(SLOT(an = (fa2,b),slotFilled = false) :: xs),checkTypes as true,pre,info) equation - true = stringEqual(fa1, fa2); + true = stringEq(fa1, fa2); then (SLOT((fa2,b),true,SOME(exp),ds) :: xs); // If not checking types, store actual type in slot so error message contains actual type case ((fa1,b),exp,ds,(SLOT(an = (fa2,_),slotFilled = false) :: xs),checkTypes as false,pre,info) equation - true = stringEqual(fa1, fa2); + true = stringEq(fa1, fa2); then (SLOT((fa2,b),true,SOME(exp),ds) :: xs); // fail if slot already filled case ((fa1,_),exp,ds,(SLOT(an = (fa2,b),slotFilled = true) :: xs),checkTypes ,pre,info) equation - true = stringEqual(fa1, fa2); + true = stringEq(fa1, fa2); ps = PrefixUtil.printPrefixStr3(pre); Error.addSourceMessage(Error.FUNCTION_SLOT_ALLREADY_FILLED, {fa2,ps}, info); then @@ -10443,7 +10443,7 @@ algorithm // no equal, fill slot case ((farg as (fa1,_)),exp,ds,((s1 as SLOT(an = (fa2,_))) :: xs),checkTypes,pre,info) equation - false = stringEqual(fa1, fa2); + false = stringEq(fa1, fa2); newslots = fillSlot(farg, exp, ds, xs,checkTypes,pre,info); then (s1 :: newslots); @@ -11988,7 +11988,7 @@ algorithm PrefixUtil.printPrefixStr(crefPrefix) +& " cr: " +& Dump.printComponentRefStr(acr) +& " env: " +& Env.printEnvPathStr(env)); - // System.enableTrace(); + // enableTrace(); then fail(); end matchcontinue; @@ -12659,13 +12659,13 @@ algorithm DAE.ComponentRef c1,c2; case (DAE.CREF_IDENT(ident = n1,subscriptLst = s1),DAE.CREF_IDENT(ident = n2,subscriptLst = s2)) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); eqSubscripts(s1, s2); then (); case (DAE.CREF_QUAL(ident = n1,subscriptLst = s1,componentRef = c1),DAE.CREF_QUAL(ident = n2,subscriptLst = s2,componentRef = c2)) equation - true = stringEqual(n1, n2); + true = stringEq(n1, n2); eqSubscripts(s1, s2); eqCref(c1, c2); then @@ -12825,7 +12825,7 @@ algorithm tps_str = Util.listMap(tps, Types.unparseType); tpsstr = Util.stringDelimitList(tps_str, ", "); pre_str = PrefixUtil.printPrefixStr3(pre); - s = System.stringAppendList({s," (expressions :",estr," types: ",tpsstr,")"}); + s = stringAppendList({s," (expressions :",estr," types: ",tpsstr,")"}); Error.addMessage(Error.UNRESOLVABLE_TYPE, {s,pre_str}); then fail(); diff --git a/Compiler/System.mo b/Compiler/System.mo index 056ead150e7..236f17578b4 100644 --- a/Compiler/System.mo +++ b/Compiler/System.mo @@ -391,68 +391,6 @@ public function platform external "C" annotation(Library = "omcruntime"); end platform; -public function realCeil - input Real inReal; - output Real outReal; - external "C" annotation(Library = "omcruntime"); -end realCeil; - - -public function asin - input Real inReal; - output Real outReal; - external "C" annotation(Library = "omcruntime"); -end asin; - -public function acos - input Real inReal; - output Real outReal; - external "C" annotation(Library = "omcruntime"); -end acos; - -public function atan - input Real inReal; - output Real outReal; - external "C" annotation(Library = "omcruntime"); -end atan; - -public function atan2 - input Real inReal1; - input Real inReal2; - output Real outReal; - external "C" annotation(Library = "omcruntime"); -end atan2; - -public function cosh - input Real inReal; - output Real outReal; - external "C" annotation(Library = "omcruntime"); -end cosh; - -public function log - input Real inReal; - output Real outReal; - external "C" annotation(Library = "omcruntime"); -end log; - -public function log10 - input Real inReal; - output Real outReal; - external "C" annotation(Library = "omcruntime"); -end log10; - -public function sinh - input Real inReal; - output Real outReal; - external "C" annotation(Library = "omcruntime"); -end sinh; - -public function tanh - input Real inReal; - output Real outReal; - external "C" annotation(Library = "omcruntime"); -end tanh; - public function getClassnamesForSimulation output String outString; external "C" annotation(Library = "omcruntime"); @@ -598,53 +536,6 @@ input Integer start; external "C" annotation(Library = "omcruntime"); end tmpTickReset; -public function listAppendUnsafe - replaceable type Type_a subtypeof Any; - input list firstList; - input list secondList; - output list appendedList; - - external "C" annotation(Library = "omcruntime"); -end listAppendUnsafe; - -public function addToRoots -"@author: adrpo - this function binds a name to an external root. - BEWARE! this is a side effect! - addToRoots(0, value) should match - value = getToRoots(0) and the type - of the value should be the same!" - replaceable type Type_a subtypeof Any; - input Integer index "index in the external hash, starting from 0"; - input Type_a anyValue; - external "C" annotation(Library = "omcruntime"); -end addToRoots; - -public function getFromRoots -"@author: adrpo - this function returns an external root for a name - BEWARE! this is a side effect! - addToRoots(0, value) should match - value = getToRoots(0) and the type - of the value should be the same!" - replaceable type Type_a subtypeof Any; - input Integer index "index in the external hash, starting from 0"; - output Type_a anyValue; - external "C" annotation(Library = "omcruntime"); -end getFromRoots; - -public function enableTrace -"@author: adrpo - this function enables the stderr tracing" - - external "C" annotation(Library = "omcruntime"); -end enableTrace; - -public function disableTrace -"this function disables the stderr tracing" - external "C" annotation(Library = "omcruntime"); -end disableTrace; - public function getSendDataLibs "Returns a string containing the compiler flags used for SENDDATALIBS" output String sendDataLibs; @@ -766,41 +657,8 @@ function getTimerStackIndex external "C" annotation(Library = "omcruntime"); end getTimerStackIndex; -function stringAppendList -"@autor: adrpo - This function will append all the strings in the given-as-input - list into a new string. It does so by creating the new - string directly and thus avoiding a lot of stringAppend which - can generate a lot of garbage. This function will pe part of the - new MetaModelica/RML release, later on." - input list listWithStrings; - output String appendedString; - - external "C" appendedString=stringAppendListExt(listWithStrings) annotation(Library = "omcruntime"); -end stringAppendList; - -function refEqual -"@autor: adrpo - This function checks if two MetaModelica references point to the same structure" - replaceable type Type_a subtypeof Any; - input Type_a ref1; - input Type_a ref2; - output Boolean result; - external "C" result = System_refEqual(ref1,ref2) annotation(Library = "omcruntime"); -end refEqual; - -function refInteger -"@autor: adrpo - This function returns the pointer of the given input parameter as integer" - replaceable type Type_a subtypeof Any; - input Type_a reference; - output Integer result; - external "C" annotation(Library = "omcruntime"); -end refInteger; -public function getUUIDStr " -creates the Globally Unique IDentifier and return it as String -" +public function getUUIDStr "creates the Globally Unique IDentifier and return it as String" output String uuidStr; external "C" annotation(Library = "omcruntime"); end getUUIDStr; diff --git a/Compiler/TaskGraph.mo b/Compiler/TaskGraph.mo index e80c81106e3..f4a01ac6558 100644 --- a/Compiler/TaskGraph.mo +++ b/Compiler/TaskGraph.mo @@ -358,7 +358,7 @@ algorithm name = ComponentReference.printComponentRefStr(cr) " Util.string_append_list({\"xd{\",indxs,\"}\"}) => id &" ; //c_name = Util.modelicaStringToCStr(name,true); c_name = name; - //id = System.stringAppendList({BackendDAE.derivativeNamePrefix,c_name}); + //id = stringAppendList({BackendDAE.derivativeNamePrefix,c_name}); id = c_name; cr_1 = ComponentReference.makeCrefIdent(id,DAE.ET_REAL(),{}); varexp = DAE.CREF(cr_1,DAE.ET_REAL()); @@ -394,7 +394,7 @@ algorithm name = ComponentReference.printComponentRefStr(cr) " Util.string_append_list({\"xd{\",indxs,\"}\"}) => id &" ; //c_name = Util.modelicaStringToCStr(name,true); c_name = name; - //id = System.stringAppendList({BackendDAE.derivativeNamePrefix,c_name}); + //id = stringAppendList({BackendDAE.derivativeNamePrefix,c_name}); id = c_name; cr_1 = ComponentReference.makeCrefIdent(id,DAE.ET_REAL(),{}); varexp = DAE.CREF(cr_1,DAE.ET_REAL()); @@ -516,7 +516,7 @@ algorithm case (repl,(DAE.CREF(componentRef = cr) :: es),pos) equation pstr = intString(pos); - str = System.stringAppendList({"xloc[",pstr,"]"}); + str = stringAppendList({"xloc[",pstr,"]"}); cref_ = ComponentReference.makeCrefIdent(str,DAE.ET_REAL(),{}); repl_1 = VarTransform.addReplacement(repl, cr, DAE.CREF(cref_,DAE.ET_REAL())); pos_1 = pos + 1; @@ -549,7 +549,7 @@ algorithm pos_1 = pos + 1; s2 = buildResidualCode2(es, pos_1, repl); pstr = intString(pos); - res = System.stringAppendList({"res[",pstr,"]=",s1,";\n",s2}); + res = stringAppendList({"res[",pstr,"]=",s1,";\n",s2}); then res; case (_,_,_) @@ -876,7 +876,7 @@ algorithm (t1,s1) = buildExpression(e1) "special case for pow" ; ival = realInt(rval); istr = intString(ival); - ts = System.stringAppendList({"pow(%s,",istr,")"}); + ts = stringAppendList({"pow(%s,",istr,")"}); t = TaskGraphExt.newTask(ts); TaskGraphExt.addEdge(t1, t, s1, 0); then @@ -887,7 +887,7 @@ algorithm (t1,s1) = buildExpression(e1); (t2,s2) = buildExpression(e2); ops = ExpressionDump.binopSymbol1(op); - ts = System.stringAppendList({"%s",ops,"%s"}); + ts = stringAppendList({"%s",ops,"%s"}); t = TaskGraphExt.newTask(ts); TaskGraphExt.addEdge(t1, t, s1, 0); TaskGraphExt.addEdge(t2, t, s2, 1); @@ -899,7 +899,7 @@ algorithm (t1,s1) = buildExpression(e1); (t2,s2) = buildExpression(e2); ops = ExpressionDump.binopSymbol1(op); - ts = System.stringAppendList({"%s",ops,"%s"}); + ts = stringAppendList({"%s",ops,"%s"}); t = TaskGraphExt.newTask(ts); TaskGraphExt.addEdge(t1, t, s1, 0); TaskGraphExt.addEdge(t2, t, s2, 1); @@ -910,7 +910,7 @@ algorithm equation (t1,s1) = buildExpression(e1); ops = ExpressionDump.unaryopSymbol(op); - ts = System.stringAppendList({ops,"%s"}); + ts = stringAppendList({ops,"%s"}); t = TaskGraphExt.newTask(ts); TaskGraphExt.addEdge(t1, t, s1, 0); then @@ -920,7 +920,7 @@ algorithm equation (t1,s1) = buildExpression(e1); ops = ExpressionDump.lunaryopSymbol(op); - ts = System.stringAppendList({ops,"%s"}); + ts = stringAppendList({ops,"%s"}); t = TaskGraphExt.newTask(ts); TaskGraphExt.addEdge(t1, t, s1, 0); then @@ -931,7 +931,7 @@ algorithm (t1,s1) = buildExpression(e1); (t2,s2) = buildExpression(e2); ops = ExpressionDump.relopSymbol(relop); - ts = System.stringAppendList({"%s",ops,"%s"}); + ts = stringAppendList({"%s",ops,"%s"}); t = TaskGraphExt.newTask(ts); TaskGraphExt.addEdge(t1, t, s1, 0); TaskGraphExt.addEdge(t2, t, s2, 1); @@ -943,7 +943,7 @@ algorithm (t1,s1) = buildExpression(e1); (t2,s2) = buildExpression(e2); (t3,s3) = buildExpression(e3); - ts = System.stringAppendList({"%s ? %s : %s"}); + ts = stringAppendList({"%s ? %s : %s"}); t = TaskGraphExt.newTask(ts); TaskGraphExt.addEdge(t1, t, s1, 0); TaskGraphExt.addEdge(t2, t, s2, 1); @@ -1032,7 +1032,7 @@ protected function buildCallStr algorithm ns := Util.listFill("%s", n); ns_1 := Util.stringDelimitList(ns, ", "); - res := System.stringAppendList({str,"(",ns_1,")"}); + res := stringAppendList({str,"(",ns_1,")"}); end buildCallStr; protected function addPredecessors diff --git a/Compiler/TplAbsyn.mo b/Compiler/TplAbsyn.mo index 88bb308ebf4..21031c8d664 100644 --- a/Compiler/TplAbsyn.mo +++ b/Compiler/TplAbsyn.mo @@ -638,7 +638,7 @@ algorithm {}, MM_FUN(_, fidLast, iargsL, oargsL, locals, stmts, genInfo) :: accMMDecls) equation - true = stringEqual(fidCalled, fidLast); + true = stringEq(fidCalled, fidLast); failure(GI_TEMPL_FUN() = genInfo); //we can inline only generated helper functions, not regular template functions equality(iargs = iargsL); equality(oargs = oargsL); @@ -2194,7 +2194,7 @@ algorithm // equals with no prefix ... internal only for defined tempates case ((inid,itype), (outid,otype), TEMPL_PACKAGE(astDefs = astdefs)) equation - true = stringEqual(inid, outid); + true = stringEq(inid, outid); TEXT_TYPE() = deAliasedType(itype, astdefs); TEXT_TYPE() = deAliasedType(otype, astdefs); then @@ -3724,7 +3724,7 @@ algorithm // special case when no local statement where added to an empty text case ( ident, TEXT_TYPE(), locals) equation - true = stringEqual(ident, emptyTxt); + true = stringEq(ident, emptyTxt); then locals; @@ -4206,7 +4206,7 @@ algorithm scEnv as (LOCAL_SCOPE(ident = locId, idType = idtype) :: _), _) equation ident = encodeIdent(ident); - true = stringEqual(ident, locId); + true = stringEq(ident, locId); then (MM_IDENT(IDENT(ident)), idtype, scEnv); @@ -4394,7 +4394,7 @@ algorithm case ( path, MM_IDENT(IDENT(txtIdent)), TEXT_TYPE(), intxt) equation - true = stringEqual(txtIdent, intxt); + true = stringEq(txtIdent, intxt); Debug.fprint("failtrace", "Error - trying to use '" +& pathIdentString(path) +& "' Text recursively during self evaluation. Use an additional Text variable if a self addition/duplication is needed, like # b = a # a += 'pref' ... \n"); then false; @@ -4569,7 +4569,7 @@ algorithm case (ident, _, scEnv as (LOCAL_SCOPE(ident = locId, idType = idtype) :: _), _) equation - true = stringEqual(ident, locId); + true = stringEq(ident, locId); then (ident, idtype, scEnv); @@ -4621,7 +4621,7 @@ algorithm extArgs = extargs, itName = itname) ::_ ), astdefs ) equation - true = stringEqual(ident, itname); + true = stringEq(ident, itname); (ident, idtype, scEnv) = resolveIt(scEnv); then (ident, idtype, scEnv); @@ -4712,7 +4712,7 @@ algorithm inmexp as BIND_AS_MATCH( bindIdent = bid ), mtype, _ ) equation - true = stringEqual(id, bid); + true = stringEq(id, bid); then ( mtype, inmexp ); @@ -4721,7 +4721,7 @@ algorithm bindIdent = bid, matchingExp = mexp ), mtype, astDefs ) equation - true = stringEqual(id, bid); + true = stringEq(id, bid); ( valtype, mexp ) = lookupUpdateMExpDotPath(inid, path, mexp, mtype, astDefs); then ( valtype, BIND_AS_MATCH(bid, mexp) ); @@ -4741,7 +4741,7 @@ algorithm inmexp as BIND_MATCH( bindIdent = bid ), mtype, _ ) equation - true = stringEqual(id, bid); + true = stringEq(id, bid); then ( mtype, inmexp ); @@ -4749,7 +4749,7 @@ algorithm inmexp as BIND_MATCH( bindIdent = bid ), mtype, astDefs ) equation - true = stringEqual(id, bid); + true = stringEq(id, bid); reason = "Unresolved path '" +& inid +& "' after first dot - only the first part '" +& id +& "' resolved as a bind match."; valtype = UNRESOLVED_TYPE(reason); then @@ -4942,7 +4942,7 @@ algorithm case ( inid, fieldid,(ident, mexp) :: fms) equation - true = stringEqual(fieldid, ident); + true = stringEq(fieldid, ident); mexp = makeBindAs(inid, mexp); // cannot fail then ( (fieldid, mexp) :: fms ); @@ -4978,7 +4978,7 @@ algorithm bindIdent = bid, matchingExp = mexp ) ) equation - true = stringEqual(inid, bid); + true = stringEq(inid, bid); then inmexp; @@ -4986,7 +4986,7 @@ algorithm bindIdent = bid, matchingExp = mexp ) ) equation - // false = stringEqual(inid, bid); + // false = stringEq(inid, bid); mexp = makeBindAs(inid, mexp); //we should do this to handle multiple path ambiguity ... i.e. when mexpr is (c as REC(fld = a as REC2(fld2 = b))) and c.fld.fl2, a.fld2 and b are used simultanosly, then we will get (c as REC(fld = a as REC2(fld2 = b as c_fld_fld2 as a_fld))) then BIND_AS_MATCH(bid, mexp); @@ -4994,7 +4994,7 @@ algorithm case ( inid, inmexp as BIND_MATCH( bindIdent = bid ) ) equation - true = stringEqual(inid, bid); + true = stringEq(inid, bid); then inmexp; @@ -5049,14 +5049,14 @@ algorithm case ( inid, fieldid, path, (ident, mexp) :: fms, mtype, astDefs ) equation - true = stringEqual(fieldid, ident); + true = stringEq(fieldid, ident); ( valtype, mexp ) = lookupUpdateMExpDotPath(inid, path, mexp, mtype, astDefs); then ( valtype, (ident, mexp) :: fms ); case ( inid, fieldid, path, fm :: fms, mtype, astDefs ) equation - // false = stringEqual(fieldid, ident) ); + // false = stringEq(fieldid, ident) ); ( valtype, fms ) = lookupUpdateMExpDotPathRecord(inid, fieldid, path, fms, mtype, astDefs); then ( valtype, fm :: fms ); @@ -5776,14 +5776,14 @@ algorithm case ( tagident, TI_RECORD_TYPE(fields = fields), typeident ) equation - true = stringEqual(tagident, typeident); + true = stringEq(tagident, typeident); then fields; case ( tagident, TI_RECORD_TYPE(fields = fields), typeident ) equation true = RTOpts.debugFlag("failtrace"); - false = stringEqual(tagident, typeident); + false = stringEq(tagident, typeident); Debug.fprint("failtrace", "Error - getFields failed to match the tag '" +& tagident +& "', the type '" +& typeident +& "' expected.\n"); then fail(); @@ -5821,7 +5821,7 @@ algorithm case ( tagident, TI_RECORD_TYPE(fields = _), typeident ) equation - true = stringEqual(tagident, typeident); + true = stringEq(tagident, typeident); then (); end matchcontinue; end isRecordTag; @@ -6438,7 +6438,7 @@ public function canBeOnOneLine algorithm outCanBeOnOneLine := (listLength(inStringList) <= 4) - and stringLength(System.stringAppendList(inStringList)) <= 10; + and stringLength(stringAppendList(inStringList)) <= 10; end canBeOnOneLine; diff --git a/Compiler/TplMain.mo b/Compiler/TplMain.mo index af3c083519a..a9be8d3f81f 100644 --- a/Compiler/TplMain.mo +++ b/Compiler/TplMain.mo @@ -61,7 +61,7 @@ algorithm print("\nProcessing file '" +& file +& "'\n"); destFile = System.stringReplace(file +& "*", ".tpl*", ".mo"); - false = stringEqual(file, destFile); + false = stringEq(file, destFile); //print(destFile); @@ -115,7 +115,7 @@ algorithm case ( strRet, strShouldBe, printResult, printErrBuf, strLabel, notPassedCnt) equation - true = stringEqual(strRet, strShouldBe); + true = stringEq(strRet, strShouldBe); print("\n**************************************************\n" +& strLabel); strRes = Util.if_(printResult, " returned <<\n" +& strRet +& ">>\n", "\n result not shown \n"); @@ -133,7 +133,7 @@ algorithm case ( strRet, strShouldBe, printResult,printErrBuf, strLabel, notPassedCnt) equation - false = stringEqual(strRet, strShouldBe); + false = stringEq(strRet, strShouldBe); print("\n##################################################\n" +& strLabel ); diff --git a/Compiler/TplParser.mo b/Compiler/TplParser.mo index b2228a5343f..6e22c57aa5a 100644 --- a/Compiler/TplParser.mo +++ b/Compiler/TplParser.mo @@ -6167,7 +6167,7 @@ matchBinding_base: => LIST_MATCH(headMExp :: mrest) | stringConstant:strRevList - => STRING_MATCH(System.stringAppendList(listReverse(strRevList)) + => STRING_MATCH(stringAppendList(listReverse(strRevList)) | literalConstant:(str,litType) => LITERAL_MATCH(str,litType) @@ -6243,7 +6243,7 @@ algorithm case (chars, linfo) equation (chars, linfo, strRevList) = stringConstant(chars, linfo); - str = System.stringAppendList(listReverse(strRevList)); + str = stringAppendList(listReverse(strRevList)); then (chars, linfo, TplAbsyn.STRING_MATCH(str)); case (chars, linfo) diff --git a/Compiler/Types.mo b/Compiler/Types.mo index d4534b988bd..d11c5bd4268 100644 --- a/Compiler/Types.mo +++ b/Compiler/Types.mo @@ -905,7 +905,7 @@ algorithm outLst := matchcontinue(inLst,currComp) equation outLst = removeRedeclareMods(inLst,currComp); s1 = SCode.elementName(comp); - true = stringEqual(s1,currComp); + true = stringEq(s1,currComp); then outLst; case((comp,mod)::inLst,currComp) @@ -933,7 +933,7 @@ algorithm outsubs := matchcontinue(insubs,componentName) case({},_) then {}; case((sub as DAE.NAMEMOD(s1,m1))::insubs,componentName) equation - subs1 = Util.if_(stringEqual(s1,componentName),{},{DAE.NAMEMOD(s1,m1)}); + subs1 = Util.if_(stringEq(s1,componentName),{},{DAE.NAMEMOD(s1,m1)}); subs2 = removeModInSubs(insubs,componentName) "check for multiple mod on same comp"; outsubs = listAppend(subs1,subs2); then @@ -1462,7 +1462,7 @@ algorithm local list names1, names2; equation - res = Util.isPrefixListComp(names1, names2, stringEqual); + res = Util.isPrefixListComp(names1, names2, stringEq); then res; @@ -1582,7 +1582,7 @@ algorithm /* Uncomment for debugging l1 = unparseType(t1); l2 = unparseType(t2); - l1 = System.stringAppendList({"- Types.subtype failed:\n t1=",l1,"\n t2=",l2}); + l1 = stringAppendList({"- Types.subtype failed:\n t1=",l1,"\n t2=",l2}); Debug.fprintln("failtrace", l1); */ then false; @@ -1655,7 +1655,7 @@ algorithm case (((v as DAE.TYPES_VAR(name = n)) :: _),name) equation - true = stringEqual(n, name); + true = stringEq(n, name); then v; @@ -1821,7 +1821,7 @@ algorithm case (((v as DAE.TYPES_VAR(name = n)) :: _),m) equation - true = stringEqual(n, m); + true = stringEq(n, m); then v; @@ -2081,9 +2081,9 @@ algorithm local String s2; equation s1 = Util.stringDelimitList(l, ", "); - s2 = System.stringAppendList(Util.listMap(vs, unparseVar)); + s2 = stringAppendList(Util.listMap(vs, unparseVar)); s2 = Util.if_(s2 ==& "", "", "(" +& s2 +& ")"); - str = System.stringAppendList({"enumeration(",s1,")"}); + str = stringAppendList({"enumeration(",s1,")"}); then str; case ((t as (DAE.T_ARRAY(arrayDim = _),_))) @@ -2091,7 +2091,7 @@ algorithm (ty,dimlst) = flattenArrayTypeOpt(t); tys = unparseType(ty); dims = printDimensionsStr(dimlst); - res = System.stringAppendList({tys,"[",dims,"]"}); + res = stringAppendList({tys,"[",dims,"]"}); then res; case (((t as DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(_),complexVarLst = vs,complexTypeOption = bc)),SOME(path))) @@ -2099,8 +2099,8 @@ algorithm equation name = Absyn.pathString(path); vars = Util.listMap(vs, unparseVar); - vstr = System.stringAppendList(vars); - res = System.stringAppendList({"record ",name,"\n",vstr,"end ", name, ";"}); + vstr = stringAppendList(vars); + res = stringAppendList({"record ",name,"\n",vstr,"end ", name, ";"}); then res; case ((DAE.T_COMPLEX(complexClassType = ci_state,complexVarLst = vs,complexTypeOption = SOME(bc_tp)),_)) @@ -2108,14 +2108,14 @@ algorithm res = Absyn.pathString(ClassInf.getStateName(ci_state)); st_str = ClassInf.printStateStr(ci_state); bc_tp_str = unparseType(bc_tp); - res = System.stringAppendList({"(",res," ",st_str," bc:",bc_tp_str,")"}); + res = stringAppendList({"(",res," ",st_str," bc:",bc_tp_str,")"}); then res; case ((DAE.T_COMPLEX(complexClassType = ci_state,complexVarLst = vs,complexTypeOption = NONE()),_)) equation res = Absyn.pathString(ClassInf.getStateName(ci_state)); st_str = ClassInf.printStateStr(ci_state); - res = System.stringAppendList({res," ",st_str}); + res = stringAppendList({res," ",st_str}); then res; case ((DAE.T_FUNCTION(funcArg = params,funcResultType = restype),_)) @@ -2123,7 +2123,7 @@ algorithm paramstrs = Util.listMap(params, unparseParam); paramstr = Util.stringDelimitList(paramstrs, ", "); restypestr = unparseType(restype); - res = System.stringAppendList({"function(",paramstr,") => ",restypestr}); + res = stringAppendList({"function(",paramstr,") => ",restypestr}); then res; case ((DAE.T_TUPLE(tupleType = tys),_)) @@ -2131,7 +2131,7 @@ algorithm equation tystrs = Util.listMap(tys, unparseType); tystr = Util.stringDelimitList(tystrs, ", "); - res = System.stringAppendList({"(",tystr,")"}); + res = stringAppendList({"(",tystr,")"}); then res; @@ -2141,7 +2141,7 @@ algorithm equation tystrs = Util.listMap(tys, unparseType); tystr = Util.stringDelimitList(tystrs, ", "); - res = Util.stringAppendList({"tuple<",tystr,">"}); + res = stringAppendList({"tuple<",tystr,">"}); then res; @@ -2149,21 +2149,21 @@ algorithm case ((DAE.T_LIST(listType = ty),_)) equation tystr = unparseType(ty); - res = System.stringAppendList({"list<",tystr,">"}); + res = stringAppendList({"list<",tystr,">"}); then res; case ((DAE.T_META_ARRAY(ty),_)) equation tystr = unparseType(ty); - res = System.stringAppendList({"array<",tystr,">"}); + res = stringAppendList({"array<",tystr,">"}); then res; /* MetaModelica list */ case ((DAE.T_POLYMORPHIC(tystr),_)) equation - res = System.stringAppendList({"polymorphic<",tystr,">"}); + res = stringAppendList({"polymorphic<",tystr,">"}); then res; @@ -2181,8 +2181,8 @@ algorithm equation str = Absyn.pathString(p); vars = Util.listMap(vs, unparseVar); - vstr = System.stringAppendList(vars); - res = System.stringAppendList({"metarecord ",str,"\n",vstr,"end ", str, ";"}); + vstr = stringAppendList(vars); + res = stringAppendList({"metarecord ",str,"\n",vstr,"end ", str, ";"}); then res; /* MetaModelica boxed type */ @@ -2198,7 +2198,7 @@ algorithm case ((DAE.T_METAOPTION(ty),_)) equation tystr = unparseType(ty); - res = System.stringAppendList({"Option<",tystr,">"}); + res = stringAppendList({"Option<",tystr,">"}); then res; @@ -2247,7 +2247,7 @@ algorithm equation strlist = Util.listMap(constlist, unparseTupleconst); res = Util.stringDelimitList(strlist, ", "); - res_1 = System.stringAppendList({"(",res,")"}); + res_1 = stringAppendList({"(",res,")"}); then res_1; end matchcontinue; @@ -2274,35 +2274,35 @@ algorithm case ((DAE.T_INTEGER(varLstInt = vars),_)) equation s1 = Util.stringDelimitList(Util.listMap(vars, printVarStr),", "); - str = System.stringAppendList({"Integer(",s1,")"}); + str = stringAppendList({"Integer(",s1,")"}); then str; case ((DAE.T_REAL(varLstReal = vars),_)) equation s1 = Util.stringDelimitList(Util.listMap(vars, printVarStr),", "); - str = System.stringAppendList({"Real(",s1,")"}); + str = stringAppendList({"Real(",s1,")"}); then str; case ((DAE.T_STRING(varLstString = vars),_)) equation s1 = Util.stringDelimitList(Util.listMap(vars, printVarStr),", "); - str = System.stringAppendList({"String(",s1,")"}); + str = stringAppendList({"String(",s1,")"}); then str; case ((DAE.T_BOOL(varLstBool = vars),_)) equation s1 = Util.stringDelimitList(Util.listMap(vars, printVarStr),", "); - str = System.stringAppendList({"Boolean(",s1,")"}); + str = stringAppendList({"Boolean(",s1,")"}); then str; case ((DAE.T_ENUMERATION(names = l, literalVarLst = vars),_)) equation s1 = Util.stringDelimitList(Util.listMap(vars, printVarStr),", "); - str = System.stringAppendList({"Enumeration(",s1,")"}); + str = stringAppendList({"Enumeration(",s1,")"}); then str; @@ -2312,7 +2312,7 @@ algorithm compType = Util.stringDelimitList( Util.listMap(Util.genericOption(bc),printTypeStr), ", "); s1 = Util.stringDelimitList(Util.listMap(vars, printVarStr),", "); compType = Util.if_(stringLength(compType)>0, "::derived From::" +& compType,""); - str = System.stringAppendList({"composite(",s1,") ", compType}); + str = stringAppendList({"composite(",s1,") ", compType}); then str; @@ -2320,7 +2320,7 @@ algorithm equation s1 = ExpressionDump.dimensionString(dim); s2 = printTypeStr(t); - str = System.stringAppendList({"array[", s1,", of type ",s2,"]"}); + str = stringAppendList({"array[", s1,", of type ",s2,"]"}); then str; @@ -2328,14 +2328,14 @@ algorithm equation s1 = printParamsStr(params); s2 = printTypeStr(restype); - str = System.stringAppendList({"function(", s1,") => ",s2}); + str = stringAppendList({"function(", s1,") => ",s2}); then str; case ((DAE.T_TUPLE(tupleType = tys),_)) equation s1 = Util.stringDelimitList(Util.listMap(tys, printTypeStr),", "); - str = System.stringAppendList({"(",s1,")"}); + str = stringAppendList({"(",s1,")"}); then str; @@ -2351,7 +2351,7 @@ algorithm local Type ty; equation s1 = printTypeStr(ty); - str = System.stringAppendList({"list<",s1,">"}); + str = stringAppendList({"list<",s1,">"}); then str; @@ -2360,7 +2360,7 @@ algorithm local Type ty; equation s1 = printTypeStr(ty); - str = System.stringAppendList({"Option<",s1,">"}); + str = stringAppendList({"Option<",s1,">"}); then str; @@ -2369,7 +2369,7 @@ algorithm local Type ty; equation s1 = printTypeStr(ty); - str = System.stringAppendList({"array<",s1,">"}); + str = stringAppendList({"array<",s1,">"}); then str; @@ -2378,14 +2378,14 @@ algorithm local Type ty; equation s1 = printTypeStr(ty); - str = System.stringAppendList({"boxed<",s1,">"}); + str = stringAppendList({"boxed<",s1,">"}); then str; // MetaModelica polymorphic case ((DAE.T_POLYMORPHIC(s1),_)) equation - str = System.stringAppendList({"polymorphic<",s1,">"}); + str = stringAppendList({"polymorphic<",s1,">"}); then str; @@ -2463,14 +2463,14 @@ algorithm case {(n,t)} equation s1 = printTypeStr(t); - str = System.stringAppendList({n," :: ",s1}); + str = stringAppendList({n," :: ",s1}); then str; case (((n,t) :: params)) equation s1 = printTypeStr(t); s2 = printParamsStr(params); - str = System.stringAppendList({n," :: ",s1, " * ",s2}); + str = stringAppendList({n," :: ",s1, " * ",s2}); then str; end matchcontinue; @@ -2495,13 +2495,13 @@ algorithm case DAE.TYPES_VAR(name = n,attributes = attr,protected_ = prot,type_ = typ,binding = DAE.EQBOUND(exp=e)) equation bindStr = ExpressionDump.printExpStr(e); - res = System.stringAppendList({n,"=",bindStr}); + res = stringAppendList({n,"=",bindStr}); then res; case DAE.TYPES_VAR(name = n,attributes = attr,protected_ = prot,type_ = typ,binding = DAE.VALBOUND(valBound=value)) equation valStr = ValuesUtil.valString(value); - res = System.stringAppendList({n,"=",valStr}); + res = stringAppendList({n,"=",valStr}); then res; case(_) then ""; @@ -2525,7 +2525,7 @@ algorithm case DAE.TYPES_VAR(name = n,attributes = attr,protected_ = prot,type_ = typ,binding = bind) equation t = unparseType(typ); - res = System.stringAppendList({t," ",n,";\n"}); + res = stringAppendList({t," ",n,";\n"}); then res; end matchcontinue; @@ -2546,7 +2546,7 @@ algorithm case ((id,ty)) equation tstr = unparseType(ty); - res = System.stringAppendList({id,":",tstr}); + res = stringAppendList({id,":",tstr}); then res; end matchcontinue; @@ -2574,12 +2574,12 @@ algorithm s1 = printTypeStr(typ); vs = SCode.variabilityString(var); s2 = printBindingStr(bind); - str = System.stringAppendList({s1," ",n," ",vs," ",s2}); + str = stringAppendList({s1," ",n," ",vs," ",s2}); then str; case DAE.TYPES_VAR(name = n,attributes = DAE.ATTR(parameter_ = var),protected_ = prot,type_ = typ,binding = bind) equation - str = System.stringAppendList({n}); + str = stringAppendList({n}); then str; end matchcontinue; @@ -2607,7 +2607,7 @@ algorithm str = ExpressionDump.printExpStr(exp); str2 = unparseConst(f); str3 = DAEUtil.printBindingSourceStr(source); - res = System.stringAppendList({"DAE.EQBOUND(",str,", NONE(), ",str2,", ",str3,")"}); + res = stringAppendList({"DAE.EQBOUND(",str,", NONE(), ",str2,", ",str3,")"}); then res; case DAE.EQBOUND(exp = exp,evaluatedExp = SOME(v),constant_ = f,source = source) @@ -2616,14 +2616,14 @@ algorithm str2 = unparseConst(f); v_str = ValuesUtil.valString(v); str3 = DAEUtil.printBindingSourceStr(source); - res = System.stringAppendList({"DAE.EQBOUND(",str,", SOME(",v_str,"), ",str2,", ",str3,")"}); + res = stringAppendList({"DAE.EQBOUND(",str,", SOME(",v_str,"), ",str2,", ",str3,")"}); then res; case DAE.VALBOUND(valBound = v, source = source) equation s = ValuesUtil.unparseValues({v}); str3 = DAEUtil.printBindingSourceStr(source); - res = System.stringAppendList({"DAE.VALBOUND(",s,", ",str3,")"}); + res = stringAppendList({"DAE.VALBOUND(",s,", ",str3,")"}); then res; case(_) then ""; @@ -2759,7 +2759,7 @@ algorithm case ((n,ty)) equation s = unparseType(ty); - res = System.stringAppendList({s," ",n}); + res = stringAppendList({s," ",n}); then res; end matchcontinue; @@ -3253,7 +3253,7 @@ algorithm dimstrs = Util.listMap(dims, intString); dimstr = Util.stringDelimitList(dimstrs, ", "); tystr = getTypeName(ty); - str = System.stringAppendList({tystr,"[",dimstr,"]"}); + str = stringAppendList({tystr,"[",dimstr,"]"}); then str; @@ -4806,7 +4806,7 @@ algorithm equation ty_str = unparseType(ty); const_str = unparseConst(const); - res = System.stringAppendList({"DAE.PROP(",ty_str,", ",const_str,")"}); + res = stringAppendList({"DAE.PROP(",ty_str,", ",const_str,")"}); then res; case DAE.PROP_TUPLE(type_ = ty,tupleConst = const) @@ -4814,7 +4814,7 @@ algorithm equation ty_str = unparseType(ty); const_str = unparseTupleconst(const); - res = System.stringAppendList({"DAE.PROP_TUPLE(",ty_str,", ",const_str,")"}); + res = stringAppendList({"DAE.PROP_TUPLE(",ty_str,", ",const_str,")"}); then res; end matchcontinue; diff --git a/Compiler/UnitAbsynBuilder.mo b/Compiler/UnitAbsynBuilder.mo index 9a3e337b80a..dc580aa95c5 100644 --- a/Compiler/UnitAbsynBuilder.mo +++ b/Compiler/UnitAbsynBuilder.mo @@ -727,7 +727,7 @@ algorithm case(UnitAbsyn.INSTSTORE(st,ht,res),(DAE.T_REAL(DAE.TYPES_VAR(name="unit",binding = DAE.EQBOUND(exp=DAE.SCONST(unitStr)))::_),_),cr) equation unit = str2unit(unitStr,NONE()); - unit = Util.if_(0 == System.strcmp(unitStr,""),UnitAbsyn.UNSPECIFIED(),unit); + unit = Util.if_(0 == stringCompare(unitStr,""),UnitAbsyn.UNSPECIFIED(),unit); (st,indx) = add(unit,st); ht = BaseHashTable.add((cr,indx),ht); then UnitAbsyn.INSTSTORE(st,ht,res); @@ -1128,7 +1128,7 @@ algorithm case((DAE.T_FUNCTION(_,functp,_),_),funcInstId,funcCallExp,store) equation unitStr = getUnitStr(functp); //print("Got unit='"+&unitStr+&"'\n"); - unspec = 0 == System.strcmp(unitStr,""); + unspec = 0 == stringCompare(unitStr,""); unit = str2unit(unitStr,SOME(funcInstId)); unit = Util.if_(unspec,UnitAbsyn.UNSPECIFIED(),unit); @@ -1224,7 +1224,7 @@ algorithm unitStr = getUnitStr(tp); unit = str2unit(unitStr,SOME(funcInstId)); - unit = Util.if_(0 == System.strcmp(unitStr,""),UnitAbsyn.UNSPECIFIED(),unit); + unit = Util.if_(0 == stringCompare(unitStr,""),UnitAbsyn.UNSPECIFIED(),unit); (store,indx) = add(unit,store); (store,indxs) = buildFuncTypeStores2(fargs,funcInstId,store); then (store,indx::indxs); diff --git a/Compiler/Util.mo b/Compiler/Util.mo index 3459f88b9c2..bec542be493 100644 --- a/Compiler/Util.mo +++ b/Compiler/Util.mo @@ -211,12 +211,12 @@ algorithm case(flag,{}) then ""; case(flag,arg::{}) equation - 0 = System.strcmp(flag,arg); + 0 = stringCompare(flag,arg); then ""; case(flag,arg::value::args) equation - 0 = System.strcmp(flag,arg); + 0 = stringCompare(flag,arg); then value; case(flag,arg::args) @@ -4134,8 +4134,8 @@ public function listIntersectionOnTrue "function: listIntersectionOnTrue It returns the intersection of the two lists, using the comparison function passed as argument to determine identity between two elements. Example: - given the function stringEqual(string,string) returning true if the strings are equal - listIntersectionOnTrue({\"a\",\"aa\"},{\"b\",\"aa\"},stringEqual) => {\"aa\"}" + given the function stringEq(string,string) returning true if the strings are equal + listIntersectionOnTrue({\"a\",\"aa\"},{\"b\",\"aa\"},stringEq) => {\"aa\"}" input list inTypeALst1; input list inTypeALst2; input FuncTypeType_aType_aToBoolean inFuncTypeTypeATypeAToBoolean3; @@ -4875,34 +4875,33 @@ algorithm end matchcontinue; end stringContainsChar; +/* adrpo 2010-10-27 this function is now in MetaModelica/RML! public function stringAppendList "function stringAppendList Takes a list of strings and appends them. Example: stringAppendList({\"foo\", \" \", \"bar\"}) => \"foo bar\"" input list inStringLst; output String outString; algorithm - // adrpo: MetaModelica will contain this function! - // for now the code is in System. - outString := System.stringAppendList(inStringLst); + // adrpo: MetaModelica now contains this function. + outString := RML.stringAppendList(inStringLst); // yet another alternative implementation // outString := stringAppendList_tail(inStringLst, ""); - /* alternative implementation - outString:= - matchcontinue (inStringLst) - local - String f,r_1,str; - list r; - case {} then ""; - case {f} then f; - case (f :: r) - equation - r_1 = stringAppendList(r); - str = stringAppend(f, r_1); - then - str; - end matchcontinue; - */ + // alternative implementation + // outString:= matchcontinue (inStringLst) + // local + // String f,r_1,str; + // list r; + // case {} then ""; + // case {f} then f; + // case (f :: r) + // equation + // r_1 = stringAppendList(r); + // str = stringAppend(f, r_1); + // then + // str; + // end matchcontinue; end stringAppendList; +*/ public function stringAppendList_tail " @author adrpo @@ -5106,14 +5105,14 @@ algorithm case ({},_,_) then {}; case ((firstChar :: rest),fromChar,"") // added special case for removal of char. equation - true = stringEqual(firstChar, fromChar); + true = stringEq(firstChar, fromChar); res = stringReplaceChar2(rest, fromChar, ""); then (res); case ((firstChar :: rest),fromChar,toChar) equation - true = stringEqual(firstChar, fromChar); + true = stringEq(firstChar, fromChar); res = stringReplaceChar2(rest, fromChar, toChar); charList2 = stringListStringChar(toChar); res = listAppend(charList2,res); @@ -5122,7 +5121,7 @@ algorithm case ((firstChar :: rest),fromChar,toChar) equation - false = stringEqual(firstChar, fromChar); + false = stringEq(firstChar, fromChar); res = stringReplaceChar2(rest, fromChar, toChar); then (firstChar :: res); @@ -5180,7 +5179,7 @@ algorithm case ((firstChar :: rest),chr,chr_rest) equation - true = stringEqual(firstChar, chr); + true = stringEq(firstChar, chr); chrList = listReverse(chr_rest) "this is needed because it returns the reversed list" ; res = stringCharListString(chrList); res_str = stringSplitAtChar2(rest, chr, {}); @@ -5189,7 +5188,7 @@ algorithm case ((firstChar :: rest),chr,chr_rest) local list res; equation - false = stringEqual(firstChar, chr); + false = stringEq(firstChar, chr); res = stringSplitAtChar2(rest, chr, (firstChar :: chr_rest)); then res; @@ -5384,15 +5383,15 @@ end boolEqual; /* adrpo - 2007-02-19 this function already exists in MMC/RML -public function stringEqual "function: stringEqual +public function stringEq "function: stringEq Takes two strings and returns true if the strings are equal - Example: stringEqual(\"a\",\"a\") => true" + Example: stringEq(\"a\",\"a\") => true" input String inString1; input String inString2; output Boolean outBoolean; algorithm outBoolean:= inString1 ==& intString2; -end stringEqual; +end stringEq; */ public function listFilter @@ -6048,7 +6047,7 @@ public function isEmptyString "function: isEmptyString input String inString; output Boolean outBoolean; algorithm - outBoolean := stringEqual(inString, ""); + outBoolean := stringEq(inString, ""); end isEmptyString; public function isNotEmptyString "function: isNotEmptyString @@ -6056,7 +6055,7 @@ public function isNotEmptyString "function: isNotEmptyString input String inString; output Boolean outBoolean; algorithm - outBoolean := boolNot(stringEqual(inString, "")); + outBoolean := boolNot(stringEq(inString, "")); end isNotEmptyString; public function writeFileOrErrorMsg "function: writeFileOrErrorMsg @@ -6120,11 +6119,11 @@ algorithm String a,b; Integer n1,n; list l1,l2; - case ((a :: _),(b :: _),1) then stringEqual(a, b); + case ((a :: _),(b :: _),1) then stringEq(a, b); case ((a :: l1),(b :: l2),n) equation n1 = n - 1; - true = stringEqual(a, b); + true = stringEq(a, b); true = charListCompare(l1, l2, n1); then true; @@ -6571,7 +6570,7 @@ public function strcmpBool "As strcmp, but has Boolean output as is expected by input String s2; output Boolean b; algorithm - b := if_(System.strcmp(s1,s2) > 0, true, false); + b := if_(stringCompare(s1,s2) > 0, true, false); end strcmpBool; public function stringAppendReverse diff --git a/Compiler/ValuesUtil.mo b/Compiler/ValuesUtil.mo index 49b574bfd48..e227925b024 100644 --- a/Compiler/ValuesUtil.mo +++ b/Compiler/ValuesUtil.mo @@ -240,7 +240,7 @@ algorithm s1 = unparseDescription({v}); s2 = unparseValueNumbers({v}); s3 = unparseValues(vallst); - str = System.stringAppendList({s1,s2,"\n",s3}); + str = stringAppendList({s1,s2,"\n",s3}); then str; case ({}) then ""; @@ -537,7 +537,7 @@ algorithm s1 = unparseDescription(xs); slen = stringLength(sval); slenstr = intString(slen); - str = System.stringAppendList({"# s! 1 ",slenstr,"\n"}); + str = stringAppendList({"# s! 1 ",slenstr,"\n"}); then str; case ((Values.ARRAY(valueLst = vallst) :: xs)) @@ -1982,7 +1982,7 @@ algorithm (); case Values.STRING(string = s) equation - s_1 = System.stringAppendList({"\"",s,"\""}); + s_1 = stringAppendList({"\"",s,"\""}); Print.printBuf(s_1); then (); @@ -2316,7 +2316,7 @@ protected function unparsePtolemySet "function: unparsePtolemySet input Value v2; input String varname; algorithm - Print.printBuf(System.stringAppendList({"DataSet: ",varname,"\n"})); + Print.printBuf(stringAppendList({"DataSet: ",varname,"\n"})); unparsePtolemySet2(v1, v2); end unparsePtolemySet; diff --git a/Compiler/VarTransform.mo b/Compiler/VarTransform.mo index 8842cd9bb29..dcc0a62fbf2 100644 --- a/Compiler/VarTransform.mo +++ b/Compiler/VarTransform.mo @@ -928,7 +928,7 @@ algorithm s2 = ExpressionDump.printExpStr(dst); s3 = ComponentReference.printComponentRefStr(src_1); s4 = ExpressionDump.printExpStr(dst_1); - s = System.stringAppendList( + s = stringAppendList( {"add_replacement(",s1,", ",s2,") -> add_replacement(",s3, ", ",s4,")\n"}); print(s); @@ -1889,7 +1889,7 @@ algorithm equation rkeystr = ComponentReference.printComponentRefStr(rkey); keystr = ComponentReference.printComponentRefStr(key); - 0 = System.strcmp(rkeystr, keystr); + 0 = stringCompare(rkeystr, keystr); then rval; case (TREENODE(value = SOME(TREEVALUE(rkey,rval)),left = left,right = SOME(right)),key) @@ -1897,7 +1897,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Search to the right" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = true; res = treeGet(right, key); then @@ -1907,7 +1907,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Search to the left" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = false; res = treeGet(left, key); then @@ -1940,14 +1940,14 @@ algorithm equation rkeystr = ComponentReference.printComponentRefStr(rkey) "Replace this node" ; keystr = ComponentReference.printComponentRefStr(key); - 0 = System.strcmp(rkeystr, keystr); + 0 = stringCompare(rkeystr, keystr); then TREENODE(SOME(TREEVALUE(rkey,value)),left,right); case (TREENODE(value = SOME(TREEVALUE(rkey,rval)),left = left,right = (right as SOME(t))),key,value) equation keystr = ComponentReference.printComponentRefStr(key) "Insert to right subtree" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = true; t_1 = treeAdd(t, key, value); then @@ -1956,7 +1956,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Insert to right node" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = true; right_1 = treeAdd(TREENODE(NONE(),NONE(),NONE()), key, value); then @@ -1965,7 +1965,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Insert to left subtree" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = false; t_1 = treeAdd(t, key, value); then @@ -1974,7 +1974,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Insert to left node" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = false; left_1 = treeAdd(TREENODE(NONE(),NONE(),NONE()), key, value); then @@ -2009,7 +2009,7 @@ algorithm equation rkeystr = ComponentReference.printComponentRefStr(rkey); keystr = ComponentReference.printComponentRefStr(key); - 0 = System.strcmp(rkeystr, keystr); + 0 = stringCompare(rkeystr, keystr); then rval; case (TREENODE2(value = SOME(TREEVALUE2(rkey,rval)),left = left,right = SOME(right)),key) @@ -2017,7 +2017,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Search to the right" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = true; res = treeGet2(right, key); then @@ -2027,7 +2027,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Search to the left" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = false; res = treeGet2(left, key); then @@ -2059,14 +2059,14 @@ algorithm equation rkeystr = ComponentReference.printComponentRefStr(rkey) "Replace this node" ; keystr = ComponentReference.printComponentRefStr(key); - 0 = System.strcmp(rkeystr, keystr); + 0 = stringCompare(rkeystr, keystr); then TREENODE2(SOME(TREEVALUE2(rkey,value)),left,right); case (TREENODE2(value = SOME(TREEVALUE2(rkey,rval)),left = left,right = (right as SOME(t))),key,value) equation keystr = ComponentReference.printComponentRefStr(key) "Insert to right subtree" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = true; t_1 = treeAdd2(t, key, value); then @@ -2075,7 +2075,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Insert to right node" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = true; right_1 = treeAdd2(TREENODE2(NONE(),NONE(),NONE()), key, value); then @@ -2084,7 +2084,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Insert to left subtree" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = false; t_1 = treeAdd2(t, key, value); then @@ -2093,7 +2093,7 @@ algorithm equation keystr = ComponentReference.printComponentRefStr(key) "Insert to left node" ; rkeystr = ComponentReference.printComponentRefStr(rkey); - cmpval = System.strcmp(rkeystr, keystr); + cmpval = stringCompare(rkeystr, keystr); (cmpval > 0) = false; left_1 = treeAdd2(TREENODE2(NONE(),NONE(),NONE()), key, value); then diff --git a/Compiler/XMLDump.mo b/Compiler/XMLDump.mo index 7cebb1adcdb..257e734b935 100644 --- a/Compiler/XMLDump.mo +++ b/Compiler/XMLDump.mo @@ -618,7 +618,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s1 = Util.xmlEscape(s1); s2 = Util.xmlEscape(s2); - s = System.stringAppendList({s1," = ",s2,"\n"}); + s = stringAppendList({s1," = ",s2,"\n"}); dumpStrOpenTagAttr(ARRAY_EQUATION, EXP_STRING, s); dumpStrOpenTag(MathML); dumpStrOpenTagAttr(MATH, MathMLXmlns, MathMLWeb); @@ -638,7 +638,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s1 = Util.xmlEscape(s1); s2 = Util.xmlEscape(s2); - s = System.stringAppendList({s1," = ",s2,"\n"}); + s = stringAppendList({s1," = ",s2,"\n"}); dumpStrOpenTagAttr(ARRAY_EQUATION, EXP_STRING, s); dumpStrCloseTag(ARRAY_EQUATION); dumpArrayEqns2(es,DAE.BCONST(false),DAE.BCONST(false)); @@ -649,7 +649,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s1 = Util.xmlEscape(s1); s2 = Util.xmlEscape(s2); - s = System.stringAppendList({s1," - (",s2,") = 0\n"}); + s = stringAppendList({s1," - (",s2,") = 0\n"}); dumpStrOpenTagAttr(ARRAY_EQUATION, EXP_STRING, s); dumpStrOpenTag(MathML); dumpStrOpenTagAttr(MATH, MathMLXmlns, MathMLWeb); @@ -673,7 +673,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s1 = Util.xmlEscape(s1); s2 = Util.xmlEscape(s2); - s = System.stringAppendList({s1," - (",s2,") = 0\n"}); + s = stringAppendList({s1," - (",s2,") = 0\n"}); dumpStrOpenTagAttr(ARRAY_EQUATION, EXP_STRING, s); dumpStrCloseTag(ARRAY_EQUATION); dumpArrayEqns2(es,DAE.BCONST(false),DAE.BCONST(true)); @@ -1356,7 +1356,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s1 = Util.xmlEscape(s1); s2 = Util.xmlEscape(s2); - res = System.stringAppendList({s1," = ",s2}); + res = stringAppendList({s1," = ",s2}); dumpStrOpenTagAttr(EQUATION,ID,indexS); Print.printBuf(res); dumpStrOpenTag(MathML); @@ -1376,7 +1376,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s1 = Util.xmlEscape(s1); s2 = Util.xmlEscape(s2); - res = System.stringAppendList({s1," = ",s2}); + res = stringAppendList({s1," = ",s2}); dumpStrOpenTagAttr(EQUATION,ID,indexS); Print.printBuf(res); dumpStrCloseTag(EQUATION); @@ -1388,7 +1388,7 @@ algorithm dumpStrOpenTagAttr(ADDITIONAL_INFO, stringAppend(ARRAY_OF_EQUATIONS,ID_), intString(indx)); dumpStrOpenTag(stringAppend(INVOLVED,VARIABLES_)); dumpStrOpenTag(VARIABLE); - var_str=Util.stringDelimitList(Util.listMap(expl,printExpStr),System.stringAppendList({"\n<",VARIABLE,">"})); + var_str=Util.stringDelimitList(Util.listMap(expl,printExpStr),stringAppendList({"\n<",VARIABLE,">"})); dumpStrCloseTag(VARIABLE); dumpStrCloseTag(stringAppend(INVOLVED,VARIABLES_)); dumpStrCloseTag(ADDITIONAL_INFO); @@ -1399,7 +1399,7 @@ algorithm s1 = ComponentReference.printComponentRefStr(cr); s2 = ExpressionDump.printExpStr(e2); s2 = Util.xmlEscape(s2); - res = System.stringAppendList({s1," := ",s2}); + res = stringAppendList({s1," := ",s2}); dumpStrOpenTagAttr(stringAppend(SOLVED,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrOpenTag(MathML); @@ -1418,7 +1418,7 @@ algorithm s1 = ComponentReference.printComponentRefStr(cr); s2 = ExpressionDump.printExpStr(e2); s2 = Util.stringReplaceChar(s2,">",">"); - res = System.stringAppendList({s1," := ",s2}); + res = stringAppendList({s1," := ",s2}); dumpStrOpenTagAttr(stringAppend(SOLVED,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrCloseTag(stringAppend(SOLVED,EQUATION_)); @@ -1429,7 +1429,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s2 = Util.xmlEscape(s2); is = intString(i); - res = System.stringAppendList({s1," := ",s2}); + res = stringAppendList({s1," := ",s2}); dumpStrOpenTagAttr(stringAppend(WHEN,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrOpenTag(MathML); @@ -1450,7 +1450,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s2 = Util.xmlEscape(s2); is = intString(i); - res = System.stringAppendList({s1," := ",s2}); + res = stringAppendList({s1," := ",s2}); dumpStrOpenTagAttr(stringAppend(WHEN,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrTagContent(stringAppend(stringAppend(WHEN,EQUATION_),ID_),is); @@ -1460,7 +1460,7 @@ algorithm equation s1 = ExpressionDump.printExpStr(e); s1 = Util.xmlEscape(s1); - res = System.stringAppendList({s1," = 0"}); + res = stringAppendList({s1," = 0"}); dumpStrOpenTagAttr(stringAppend(RESIDUAL,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrOpenTag(MathML); @@ -1478,7 +1478,7 @@ algorithm equation s1 = ExpressionDump.printExpStr(e); s1 = Util.xmlEscape(s1); - res = System.stringAppendList({s1," = 0"}); + res = stringAppendList({s1," = 0"}); dumpStrOpenTagAttr(stringAppend(RESIDUAL,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrCloseTag(stringAppend(RESIDUAL,EQUATION_)); @@ -1751,7 +1751,7 @@ algorithm dumpStrOpenTag(MathMLApply); dumpStrOpenTag(MathMLMatrix); dumpStrOpenTag(MathMLMatrixrow); - dumpListSeparator(es, dumpRow, System.stringAppendList({"\n/n<",MathMLMatrixrow,">"})); + dumpListSeparator(es, dumpRow, stringAppendList({"\n/n<",MathMLMatrixrow,">"})); dumpStrCloseTag(MathMLMatrixrow); dumpStrCloseTag(MathMLMatrix); dumpStrCloseTag(MathMLApply); @@ -3154,7 +3154,7 @@ algorithm case (varno,cr,kind,dir,var_type,indx,varFixed,flowPrefix,streamPrefix,"") equation /* - str= System.stringAppendList({"\n"}); then str; */ @@ -3184,7 +3184,7 @@ algorithm Print.printBuf("\">"); then (); /* - str= System.stringAppendList({"\n"}); then str; */ @@ -3611,7 +3611,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s1 = Util.xmlEscape(s1); s2 = Util.xmlEscape(s2); - res = System.stringAppendList({s1," ( ",s2,") = 0"}); + res = stringAppendList({s1," ( ",s2,") = 0"}); dumpStrOpenTagAttr(EQUATION,ID,indexS); Print.printBuf(res); dumpStrOpenTag(MathML); @@ -3635,7 +3635,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s1 = Util.xmlEscape(s1); s2 = Util.xmlEscape(s2); - res = System.stringAppendList({s1," - ( ",s2, " ) = 0"}); + res = stringAppendList({s1," - ( ",s2, " ) = 0"}); dumpStrOpenTagAttr(EQUATION,ID,indexS); Print.printBuf(res); dumpStrCloseTag(EQUATION); @@ -3647,7 +3647,7 @@ algorithm dumpStrOpenTagAttr(ADDITIONAL_INFO, stringAppend(ARRAY_OF_EQUATIONS,ID_), intString(indx)); dumpStrOpenTag(stringAppend(INVOLVED,VARIABLES_)); dumpStrOpenTag(VARIABLE); - var_str=Util.stringDelimitList(Util.listMap(expl,ExpressionDump.printExpStr),System.stringAppendList({"\n<",VARIABLE,">"})); + var_str=Util.stringDelimitList(Util.listMap(expl,ExpressionDump.printExpStr),stringAppendList({"\n<",VARIABLE,">"})); dumpStrCloseTag(VARIABLE); dumpStrCloseTag(stringAppend(INVOLVED,VARIABLES_)); dumpStrCloseTag(ADDITIONAL_INFO); @@ -3658,7 +3658,7 @@ algorithm s1 = ComponentReference.printComponentRefStr(cr); s2 = ExpressionDump.printExpStr(e2); s2 = Util.xmlEscape(s2); - res = System.stringAppendList({s1," - ( ",s2," ) := 0"}); + res = stringAppendList({s1," - ( ",s2," ) := 0"}); dumpStrOpenTagAttr(stringAppend(SOLVED,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrOpenTag(MathML); @@ -3681,7 +3681,7 @@ algorithm s1 = ComponentReference.printComponentRefStr(cr); s2 = ExpressionDump.printExpStr(e2); s2 = Util.xmlEscape(s2); - res = System.stringAppendList({s1," - (",s2,") := 0"}); + res = stringAppendList({s1," - (",s2,") := 0"}); dumpStrOpenTagAttr(stringAppend(SOLVED,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrCloseTag(stringAppend(SOLVED,EQUATION_)); @@ -3692,7 +3692,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s2 = Util.xmlEscape(s2); is = intString(i); - res = System.stringAppendList({s1," - (",s2,") := 0"}); + res = stringAppendList({s1," - (",s2,") := 0"}); dumpStrOpenTagAttr(stringAppend(WHEN,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrOpenTag(MathML); @@ -3717,7 +3717,7 @@ algorithm s2 = ExpressionDump.printExpStr(e2); s2 = Util.xmlEscape(s2); is = intString(i); - res = System.stringAppendList({s1," - (",s2,") := 0"}); + res = stringAppendList({s1," - (",s2,") := 0"}); dumpStrOpenTagAttr(stringAppend(WHEN,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrTagContent(stringAppend(stringAppend(WHEN,EQUATION_),ID_),is); @@ -3727,7 +3727,7 @@ algorithm equation s1 = ExpressionDump.printExpStr(e); s1 = Util.xmlEscape(s1); - res = System.stringAppendList({s1," = 0"}); + res = stringAppendList({s1," = 0"}); dumpStrOpenTagAttr(stringAppend(RESIDUAL,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrOpenTag(MathML); @@ -3745,7 +3745,7 @@ algorithm equation s1 = ExpressionDump.printExpStr(e); s1 = Util.xmlEscape(s1); - res = System.stringAppendList({s1," = 0"}); + res = stringAppendList({s1," = 0"}); dumpStrOpenTagAttr(stringAppend(RESIDUAL,EQUATION_),ID,indexS); Print.printBuf(res); dumpStrCloseTag(stringAppend(RESIDUAL,EQUATION_)); @@ -3795,7 +3795,7 @@ algorithm local Dump.Ident str,cmt; case (SOME(SCode.COMMENT(_,SOME(cmt)))) equation - //str = System.stringAppendList({" \"",cmt,"\""}); + //str = stringAppendList({" \"",cmt,"\""}); str = cmt; then str; diff --git a/Compiler/runtime/System_omc.cpp b/Compiler/runtime/System_omc.cpp index 1052be67c92..31745b57fd6 100644 --- a/Compiler/runtime/System_omc.cpp +++ b/Compiler/runtime/System_omc.cpp @@ -56,16 +56,6 @@ extern const char* System_stringReplace(const char* str, const char* source, con return res; } -extern int System_refEqual(void* a, void* b) -{ - return a == b; -} - -extern int System_hash(unsigned char* str) -{ - return djb2_hash(str); -} - extern int System_stringFind(const char* str, const char* searchStr) { const char *found = strstr(str, searchStr); @@ -83,55 +73,4 @@ extern const char* System_stringFindString(const char* str, const char* searchSt return strdup(found); } -/* Old RML impl. -void *rml_external_roots_trail[1024] = {0}; -rml_uint_t rml_external_roots_trail_size = 1024; -rml_uint_t rml_external_roots_trail_index_max = 0; - -// forward my external roots -void rml_user_gc(struct rml_xgcstate *state) -{ - rml_user_gc_callback(state, rml_external_roots_trail, rml_external_roots_trail_index_max*sizeof(void*)); -} - -RML_BEGIN_LABEL(System__addToRoots) -{ - rml_uint_t i = RML_UNTAGFIXNUM(rmlA0); - - if (rml_trace_enabled) - { - fprintf(stderr, "System__addToRoots\n"); fflush(stderr); - } - - if (i >= rml_external_roots_trail_size) - RML_TAILCALLK(rmlFC); - - rml_external_roots_trail[i] = rmlA1; - - // remember the max - rml_external_roots_trail_index_max = max(rml_external_roots_trail_index_max, i+1); - - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__getFromRoots) -{ - rml_uint_t i = RML_UNTAGFIXNUM(rmlA0); - - if (rml_trace_enabled) - { - fprintf(stderr, "System__getFromRoots\n"); fflush(stderr); - } - - if (i > rml_external_roots_trail_index_max || i >= rml_external_roots_trail_size) - RML_TAILCALLK(rmlFC); - - rmlA0 = rml_external_roots_trail[i]; - - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL -*/ - } diff --git a/Compiler/runtime/System_rml.c b/Compiler/runtime/System_rml.c index d252c396fcc..34ea4c0e531 100644 --- a/Compiler/runtime/System_rml.c +++ b/Compiler/runtime/System_rml.c @@ -134,21 +134,6 @@ static int set_ldflags(char *str) return 0; } -#if defined(_MSC_VER) - -#else -inline -#endif -RML_BEGIN_LABEL(System__hash) -{ - char *str = RML_STRINGDATA(rmlA0); - rml_uint_t hash = (rml_uint_t)djb2_hash(str); - // fprintf(stderr, "hashing: %s into: %d \n", str, hash); fflush(stderr); fflush(stdout); - rmlA0 = RML_PRIM_INT_ABS(RML_IMMEDIATE(RML_TAGFIXNUM(hash))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - RML_BEGIN_LABEL(System__regularFileExists) { char* str = RML_STRINGDATA(rmlA0); @@ -341,11 +326,11 @@ RML_END_LABEL RML_BEGIN_LABEL(System__strcmp) { - char *str = RML_STRINGDATA(rmlA0); - char *str2 = RML_STRINGDATA(rmlA1); - int res = strcmp(str,str2); + char *str0 = RML_STRINGDATA(rmlA0); + char *str1 = RML_STRINGDATA(rmlA1); + int res = strcmp(str0,str1); /* adrpo: 2010-10-07, return -1, 0, +1 so we can pattern match on it directly! */ - if (res>0) res = 1; + if (res>0) res = 1; else if (res<0) res = -1; rmlA0 = (void*) mk_icon(res); RML_TAILCALLK(rmlSC); @@ -773,78 +758,6 @@ RML_BEGIN_LABEL(System__removeFile) } RML_END_LABEL -RML_BEGIN_LABEL(System__realCeil) -{ - rmlA0 = rml_prim_mkreal(ceil(rml_prim_get_real(rmlA0))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - - -RML_BEGIN_LABEL(System__asin) -{ - rmlA0 = rml_prim_mkreal(asin(rml_prim_get_real(rmlA0))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__acos) -{ - rmlA0 = rml_prim_mkreal(acos(rml_prim_get_real(rmlA0))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__atan) -{ - rmlA0 = rml_prim_mkreal(atan(rml_prim_get_real(rmlA0))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__atan2) -{ - rmlA0 = rml_prim_mkreal(atan2(rml_prim_get_real(rmlA0), - rml_prim_get_real(rmlA1))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__cosh) -{ - rmlA0 = rml_prim_mkreal(cosh(rml_prim_get_real(rmlA0))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__log) -{ - rmlA0 = rml_prim_mkreal(log(rml_prim_get_real(rmlA0))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__log10) -{ - rmlA0 = rml_prim_mkreal(log10(rml_prim_get_real(rmlA0))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__sinh) -{ - rmlA0 = rml_prim_mkreal(sinh(rml_prim_get_real(rmlA0))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__tanh) -{ - rmlA0 = rml_prim_mkreal(tanh(rml_prim_get_real(rmlA0))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - double next_realelt(double *arr) { static int curpos; @@ -1208,145 +1121,6 @@ RML_BEGIN_LABEL(System__tmpTickReset) } RML_END_LABEL - - -RML_BEGIN_LABEL(System__listAppendUnsafe) -{ - // call RML__listAppend - RML_TAILCALLQ(RML__listAppend,2); - // this is an alternative -#if 0 - void *lst, *tmp; - rml_uint_t idx = 0; - lst = rmlA0; - - if (rml_trace_enabled) - { - fprintf(stderr, "System.listAppendUnsafe\n"); fflush(stderr); - } - - /* the first list is empty */ - if (RML_GETHDR(rmlA0) != RML_CONSHDR) - { - rmlA0 = rmlA1; /* the first list was empty, return the second list. */ - RML_TAILCALLK(rmlSC); - } - /* the second list is empty */ - if (RML_GETHDR(rmlA1) != RML_CONSHDR) - { - rmlA0 = rmlA0; /* the second list was empty, return the first list. */ - RML_TAILCALLK(rmlSC); - } - - /* find the end of the first list! */ - while( RML_GETHDR(lst) == RML_CONSHDR ) - { - if (RML_GETHDR(tmp = RML_CDR(lst)) != RML_CONSHDR) - break; - else - lst = tmp; /* move to next element */ - } - - struct rml_struct *p = RML_UNTAGPTR(lst); - /* set the cdr of the last element in the first list to the first element in the second list */ - p->data[1] = rmlA1; - for (idx = rml_array_trail_size; &rml_array_trail[idx] >= rmlATP; idx--) - if (rml_array_trail[idx] == lst) /* if found, do not add again */ - { - rmlA0 = rmlA0; /* return the pointer to the first list */ - /* return resulting list */ - RML_TAILCALLK(rmlSC); - } - /* add the address of the list element into the roots to be - * taken into consideration at the garbage collection time - */ - if( rmlATP == &rml_array_trail[0] ) - { - (void)fprintf(stderr, "Array Trail Overflow!\n"); - rml_exit(1); - } - *--rmlATP = lst; - - rmlA0 = rmlA0; /* return the pointer to the first list */ - /* return resulting list */ - RML_TAILCALLK(rmlSC); -#endif - -} -RML_END_LABEL - -void *rml_external_roots_trail[1024] = {0}; -rml_uint_t rml_external_roots_trail_size = 1024; -rml_uint_t rml_external_roots_trail_index_max = 0; - -/* forward my external roots */ -void rml_user_gc(struct rml_xgcstate *state) -{ - rml_user_gc_callback(state, rml_external_roots_trail, rml_external_roots_trail_index_max*sizeof(void*)); -} - -RML_BEGIN_LABEL(System__addToRoots) -{ - rml_uint_t i = RML_UNTAGFIXNUM(rmlA0); - - if (rml_trace_enabled) - { - fprintf(stderr, "System__addToRoots\n"); fflush(stderr); - } - - if (i >= rml_external_roots_trail_size) - RML_TAILCALLK(rmlFC); - - rml_external_roots_trail[i] = rmlA1; - - /* remember the max */ - rml_external_roots_trail_index_max = max(rml_external_roots_trail_index_max, i+1); - - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__getFromRoots) -{ - rml_uint_t i = RML_UNTAGFIXNUM(rmlA0); - - if (rml_trace_enabled) - { - fprintf(stderr, "System__getFromRoots\n"); fflush(stderr); - } - - if (i > rml_external_roots_trail_index_max || i >= rml_external_roots_trail_size) - RML_TAILCALLK(rmlFC); - - rmlA0 = rml_external_roots_trail[i]; - - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - - -RML_BEGIN_LABEL(System__enableTrace) -{ - rml_trace_enabled = 1; - if (rml_trace_enabled) - { - fprintf(stderr, "System__enableTrace\n"); fflush(stderr); - } - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -RML_BEGIN_LABEL(System__disableTrace) -{ - if (rml_trace_enabled) - { - fprintf(stderr, "System__disableTrace\n"); fflush(stderr); - } - rml_trace_enabled = 0; - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - /* is the same for both Windows/Linux */ RML_BEGIN_LABEL(System__systemCall) { @@ -1471,10 +1245,6 @@ RML_BEGIN_LABEL(System__isSameFile) } RML_END_LABEL - - - - RML_BEGIN_LABEL(System__os) { char *envvalue; @@ -1488,8 +1258,6 @@ RML_BEGIN_LABEL(System__os) } RML_END_LABEL - - RML_BEGIN_LABEL(System__getExeExt) { rmlA0 = (void*) mk_scon(".exe"); @@ -1632,8 +1400,6 @@ RML_BEGIN_LABEL(System__groupDelimiter) } RML_END_LABEL - - RML_BEGIN_LABEL(System__pwd) { char buf[MAXPATHLEN]; @@ -1651,11 +1417,6 @@ RML_BEGIN_LABEL(System__pwd) } RML_END_LABEL - - - - - /* RML_BEGIN_LABEL(System__modelicapath) */ /* { */ /* char *path = getenv("OPENMODELICALIBRARY"); */ @@ -1667,7 +1428,6 @@ RML_END_LABEL /* } */ /* RML_END_LABEL */ - /* adrpo@ida added 2005-11-24 */ RML_BEGIN_LABEL(System__setEnv) { @@ -1683,8 +1443,6 @@ RML_BEGIN_LABEL(System__setEnv) } RML_END_LABEL - - RML_BEGIN_LABEL(System__subDirectories) { void *res; @@ -1696,7 +1454,6 @@ RML_BEGIN_LABEL(System__subDirectories) if (directory == NULL) RML_TAILCALLK(rmlFC); - sprintf(pattern, "%s\\*.*", directory); res = (void*)mk_nil(); @@ -1718,7 +1475,6 @@ RML_BEGIN_LABEL(System__subDirectories) } RML_END_LABEL - RML_BEGIN_LABEL(System__moFiles) { void *res; @@ -1730,7 +1486,6 @@ RML_BEGIN_LABEL(System__moFiles) if (directory == NULL) RML_TAILCALLK(rmlFC); - sprintf(pattern, "%s\\*.mo", directory); res = (void*)mk_nil(); @@ -1750,7 +1505,6 @@ RML_BEGIN_LABEL(System__moFiles) } RML_END_LABEL - int fileExistsLocal(char * s){ int ret=-1; WIN32_FIND_DATA FileData; @@ -1927,7 +1681,6 @@ RML_BEGIN_LABEL(System__platform) //} - RML_BEGIN_LABEL(System__enableSendData) { int enable = RML_UNTAGFIXNUM(rmlA0); @@ -1936,7 +1689,6 @@ RML_BEGIN_LABEL(System__enableSendData) else _putenv("enableSendData=0"); - // enableSendData(enable); RML_TAILCALLK(rmlSC); } @@ -1966,7 +1718,6 @@ RML_BEGIN_LABEL(System__setVariableFilter) } RML_END_LABEL - RML_BEGIN_LABEL(System__getFileModificationTime) { char* fileName = RML_STRINGDATA(rmlA0); @@ -1988,7 +1739,6 @@ RML_BEGIN_LABEL(System__getFileModificationTime) } RML_END_LABEL - RML_BEGIN_LABEL(System__getCurrentTimeStr) { time_t t; @@ -2072,7 +1822,6 @@ void reallocdirents(struct dirent ***entries, *entries = newentries; } - /* * compar function is ignored */ @@ -2112,7 +1861,6 @@ int scandir(const char* dirname, #endif /* 0 */ - void System_5finit(void) { char* qthome; @@ -2581,7 +2329,6 @@ int file_select_directories(const struct dirent *entry) } } - RML_BEGIN_LABEL(System__subDirectories) { int i,count; @@ -2682,7 +2429,6 @@ char *path_cat (const char *str1, char *str2,char *fileString) { return result; } - RML_BEGIN_LABEL(System__getPackageFileNames) { char* dir_path = RML_STRINGDATA(rmlA0); @@ -2978,80 +2724,3 @@ RML_BEGIN_LABEL(System__getTimerStackIndex) } RML_END_LABEL -/* - * adrpo: an implementation of stringAppendList in low level C - * this will be part of the new MetaModelica/RML relase - * in the near future. - * NOTE: do not inspire yourself from this function to implement - * new external C function as if you don't understand the - * MetaModelica GC and runtime there'll be trouble :) - */ -RML_BEGIN_LABEL(System__stringAppendList) -{ - /* count the length of elements in the list */ - rml_uint_t len_car = 0; - rml_uint_t len_cur = 0; - rml_uint_t len = 0; - struct rml_string *str = 0; - void *lst = rmlA0; - while( RML_GETHDR(lst) == RML_CONSHDR ) { - len += RML_HDRSTRLEN(RML_GETHDR(RML_CAR(lst))); - lst = RML_CDR(lst); - } - - /* allocate the string */ - str = rml_prim_mkstring(len, 1); - if (len == 0) /* if the list is empty, return empty string! */ - { - str->data[0] = '\0'; /* set the end to 0 */ - rmlA0 = RML_TAGPTR(str); /* set the result to the tagged pointer */ - RML_TAILCALLK(rmlSC); /* return from the function */ - } - - /* re-read the rmlA0 as it might have been moved by the GC */ - lst = rmlA0; - while( RML_GETHDR(lst) == RML_CONSHDR ) { - void* car = RML_CAR(lst); - len_car = RML_HDRSTRLEN(RML_GETHDR(car)); - (void)memcpy( - &str->data[len_cur], - RML_STRINGDATA(car), - len_car); - len_cur += len_car; - lst = RML_CDR(lst); - } - str->data[len_cur] = '\0'; - rmlA0 = RML_TAGPTR(str); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -/* - * adrpo: check if two pointers are equal - */ -RML_BEGIN_LABEL(System__refEqual) -{ - rmlA0 = (rmlA0 == rmlA1) ? RML_TRUE : RML_FALSE; - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -/* - * adrpo: return the pointer of a value as integer - */ -RML_BEGIN_LABEL(System__refInteger) -{ - rmlA0 = RML_TAGFIXNUM((rml_uint_t)rmlA0); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL - -/* - * adrpo: return the constructor of the given value - */ -RML_BEGIN_LABEL(System__getValueConstructor) -{ - rmlA0 = RML_IMMEDIATE(RML_TAGFIXNUM(RML_HDRCTOR(RML_GETHDR(rmlA0)))); - RML_TAILCALLK(rmlSC); -} -RML_END_LABEL diff --git a/Compiler/runtime/systemimpl.c b/Compiler/runtime/systemimpl.c index 367cdda202a..e4c2c7bcb97 100644 --- a/Compiler/runtime/systemimpl.c +++ b/Compiler/runtime/systemimpl.c @@ -89,29 +89,6 @@ extern "C" { #include "rtopts.h" #include "errorext.h" -/* - * adrpo 2008-12-02 - * http://www.cse.yorku.ca/~oz/hash.html - * hash functions which could be useful to replace System__hash: - */ -/*** djb2 hash ***/ -static inline unsigned long djb2_hash(const unsigned char *str) -{ - unsigned long hash = 5381; - int c; - while (c = *str++) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ - return hash; -} - -/*** sdbm hash ***/ -static inline unsigned long sdbm_hash(const unsigned char* str) -{ - unsigned long hash = 0; - int c; - while (c = *str++) hash = c + (hash << 6) + (hash << 16) - hash; - return hash; -} - static modelica_integer SystemImpl__regularFileExists(const char* str) { #if defined(__MINGW32__) || defined(_MSC_VER) diff --git a/c_runtime/meta_modelica_builtin.cpp b/c_runtime/meta_modelica_builtin.cpp index 7ac32fa9a67..9b1daf1e501 100644 --- a/c_runtime/meta_modelica_builtin.cpp +++ b/c_runtime/meta_modelica_builtin.cpp @@ -439,6 +439,76 @@ stringInt_rettype stringInt(modelica_string_t str) return res; } +/******************** String HASH Functions ********************/ +/* + * adrpo 2008-12-02 + * http://www.cse.yorku.ca/~oz/hash.html + * hash functions which could be useful to replace System__hash: + */ +/*** djb2 hash ***/ +static inline unsigned long djb2_hash(const unsigned char *str) +{ + unsigned long hash = 5381; + int c; + while (c = *str++) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + return hash; +} + +/*** sdbm hash ***/ +static inline unsigned long sdbm_hash(const unsigned char* str) +{ + unsigned long hash = 0; + int c; + while (c = *str++) hash = c + (hash << 6) + (hash << 16) - hash; + return hash; +} + +/* adrpo: really bad hash :) */ +stringInt_rettype stringHash(modelica_string_const str) +{ + long res = 0, i=0; + while (str[i]) { res += str[i]; i++; } + return res; +} + +/* adrpo: see the comment above about djb2 hash */ +stringInt_rettype stringHashDjb2(modelica_string_const str) +{ + long res = djb2_hash((const unsigned char*)str); + return res; +} + +/* adrpo: see the comment above about sdbm hash */ +stringInt_rettype stringHashSdbm(modelica_string_const str) +{ + long res = sdbm_hash((const unsigned char*)str); + return res; +} + +/******************** BOXED String HASH Functions ********************/ +/* adrpo: really bad hash :) */ +modelica_metatype boxptr_stringHash(modelica_metatype str) +{ + const char* s = MMC_STRINGDATA(str); + modelica_metatype res = mmc_mk_icon(stringHash(s)); + return res; +} + +/* adrpo: see the comment above about djb2 hash */ +modelica_metatype boxptr_stringHashDjb2(modelica_metatype str) +{ + const char* s = MMC_STRINGDATA(str); + modelica_metatype res = mmc_mk_icon(stringHashDjb2(s)); + return res; +} + +/* adrpo: see the comment above about sdbm hash */ +modelica_metatype boxptr_stringHashSdmb(modelica_metatype str) +{ + const char* s = MMC_STRINGDATA(str); + modelica_metatype res = mmc_mk_icon(stringHashSdbm(s)); + return res; +} stringListStringChar_rettype stringListStringChar(modelica_string_t str) { @@ -540,7 +610,7 @@ stringCompare_rettype stringCompare(modelica_string_t str1, modelica_string_t st return 0; } -stringEqual_rettype stringEqual(modelica_string_t str1, modelica_string_t str2) +stringEq_rettype stringEq(modelica_string_t str1, modelica_string_t str2) { return 0 == strcmp(str1,str2) ? 1 : 0; } diff --git a/c_runtime/meta_modelica_builtin.h b/c_runtime/meta_modelica_builtin.h index f5ff5b53e69..d8acb1f6089 100644 --- a/c_runtime/meta_modelica_builtin.h +++ b/c_runtime/meta_modelica_builtin.h @@ -187,6 +187,9 @@ intStringChar_rettype intStringChar(modelica_integer); /* String Operations */ typedef modelica_integer stringInt_rettype; +typedef modelica_integer stringHash_rettype; +typedef modelica_integer stringHashDjb2_rettype; +typedef modelica_integer stringHashSdbm_rettype; typedef modelica_metatype stringListStringChar_rettype; typedef modelica_string_t listStringCharString_rettype; typedef modelica_string_t stringAppendList_rettype; @@ -194,7 +197,7 @@ typedef modelica_string_const stringAppendListExt_rettype; typedef modelica_string_t stringAppend_rettype; typedef modelica_integer stringLength_rettype; typedef modelica_integer stringCompare_rettype; -typedef modelica_boolean stringEqual_rettype; +typedef modelica_boolean stringEq_rettype; typedef modelica_string_t stringGetStringChar_rettype; typedef modelica_string_t stringUpdateStringChar_rettype; typedef modelica_string_t stringCharListString_rettype; @@ -207,12 +210,18 @@ stringAppendListExt_rettype stringAppendListExt(modelica_metatype); stringAppend_rettype stringAppend(modelica_string_const,modelica_string_const); stringLength_rettype stringLength(modelica_string_const); stringCompare_rettype stringCompare(modelica_string_t,modelica_string_t); -stringEqual_rettype stringEqual(modelica_string_t,modelica_string_t); +stringEq_rettype stringEq(modelica_string_t,modelica_string_t); stringGetStringChar_rettype stringGetStringChar(modelica_string_t,modelica_integer); stringUpdateStringChar_rettype stringUpdateStringChar(modelica_string_t, modelica_string_t, modelica_integer); #define stringCharListString(X) stringAppendList(X) +stringHash_rettype stringHash(modelica_string_const); +stringHashDjb2_rettype stringHashDjb2(modelica_string_const); +stringHashSdbm_rettype stringHashSdbm(modelica_string_const); modelica_metatype boxptr_stringAppend(modelica_metatype,modelica_metatype); +modelica_metatype boxptr_stringHash(modelica_metatype); +modelica_metatype boxptr_stringHashDjb2(modelica_metatype); +modelica_metatype boxptr_stringHashSdmb(modelica_metatype); /* List Operations */ typedef modelica_metatype listReverse_rettype;