From 965c74e051e49c41cc8ac43e0a8de4cb9b65026a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Thu, 28 Oct 2010 15:28:22 +0000 Subject: [PATCH] - Fix meta testsuite git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/sjoelund-functiontree@6692 f25d12d1-65f4-0310-ae8a-bbce733d8d8e --- Compiler/Builtin.mo | 4 ++- Compiler/RTOpts.mo | 54 ++++++++++++++--------------- c_runtime/meta_modelica_builtin.cpp | 45 ------------------------ c_runtime/meta_modelica_builtin.h | 22 +++++++----- 4 files changed, 43 insertions(+), 82 deletions(-) diff --git a/Compiler/Builtin.mo b/Compiler/Builtin.mo index 474117f7da4..c85e4cddd00 100644 --- a/Compiler/Builtin.mo +++ b/Compiler/Builtin.mo @@ -2964,6 +2964,7 @@ algorithm env = Env.extendFrameT(env, "realAtan", real2real); env = Env.extendFrameT(env, "realExp", real2real); env = Env.extendFrameT(env, "realLn", real2real); + env = Env.extendFrameT(env, "realLog10", real2real); env = Env.extendFrameT(env, "realFloor", real2real); env = Env.extendFrameT(env, "realSqrt", real2real); @@ -3035,7 +3036,8 @@ algorithm env = Env.extendFrameT(env, "setGlobalRoot", intBoxedNoRetcall); env = Env.extendFrameT(env, "valueConstructor", boxed2int); env = Env.extendFrameT(env, "valueSlots", boxed2int); - env = Env.extendFrameT(env, "valueEq", AA2bool); + env = Env.extendFrameT(env, "valueEq", AA2bool); + env = Env.extendFrameT(env, "referenceEq", AA2bool); then env; case env then env; end matchcontinue; diff --git a/Compiler/RTOpts.mo b/Compiler/RTOpts.mo index 4242b48693f..e39613680b8 100644 --- a/Compiler/RTOpts.mo +++ b/Compiler/RTOpts.mo @@ -46,38 +46,38 @@ public function args input list inStringLst; output list outStringLst; - external "C" outStringLst=RTOpts_args(inStringLst); + external "C" outStringLst=RTOpts_args(inStringLst) annotation(Library = "omcruntime"); end args; public function typeinfo output Boolean outBoolean; - external "C" outBoolean = RTOpts_typeinfo(); + external "C" outBoolean = RTOpts_typeinfo() annotation(Library = "omcruntime"); end typeinfo; public function splitArrays output Boolean outBoolean; - external "C" splitArrays = RTOpts_splitArrays(); + external "C" splitArrays = RTOpts_splitArrays() annotation(Library = "omcruntime"); end splitArrays; public function paramsStruct output Boolean outBoolean; - external "C" outBoolean = RTOpts_paramsStruct(); + external "C" outBoolean = RTOpts_paramsStruct() annotation(Library = "omcruntime"); end paramsStruct; public function modelicaOutput output Boolean outBoolean; - external "C" outBoolean = RTOpts_modelicaOutput(); + external "C" outBoolean = RTOpts_modelicaOutput() annotation(Library = "omcruntime"); end modelicaOutput; public function debugFlag input String inString; output Boolean outBoolean; - external "C" outBoolean=RTOpts_debugFlag(inString); + external "C" outBoolean=RTOpts_debugFlag(inString) annotation(Library = "omcruntime"); end debugFlag; public function setDebugFlag @@ -85,43 +85,43 @@ public function setDebugFlag input Integer value; output Boolean str; - external "C" str = RTOpts_setDebugFlag(inString,value); + external "C" str = RTOpts_setDebugFlag(inString,value) annotation(Library = "omcruntime"); end setDebugFlag; public function noProc output Integer outInteger; - external "C" noProc = RTOpts_noProc(); + external "C" noProc = RTOpts_noProc() annotation(Library = "omcruntime"); end noProc; public function setEliminationLevel input Integer level; - external "C" ; + external "C" annotation(Library = "omcruntime"); end setEliminationLevel; public function eliminationLevel output Integer level; - external "C" level = RTOpts_level(); + external "C" level = RTOpts_level() annotation(Library = "omcruntime"); end eliminationLevel; public function latency output Real outReal; - external "C" outReal = RTOpts_latency(); + external "C" outReal = RTOpts_latency() annotation(Library = "omcruntime"); end latency; public function bandwidth output Real outReal; - external "C" outReal = RTOpts_bandwidth(); + external "C" outReal = RTOpts_bandwidth() annotation(Library = "omcruntime"); end bandwidth; public function simulationCg output Boolean outBoolean; - external "C" outBoolean = RTOpts_simulationCg(); + external "C" outBoolean = RTOpts_simulationCg() annotation(Library = "omcruntime"); end simulationCg; public function simulationCodeTarget @@ -130,25 +130,25 @@ public function simulationCodeTarget usage: omc [+target=gcc|msvc], default to 'gcc'." output String outCodeTarget; - external "C" outCodeTarget = RTOpts_simulationCodeTarget(); + external "C" outCodeTarget = RTOpts_simulationCodeTarget() annotation(Library = "omcruntime"); end simulationCodeTarget; public function classToInstantiate output String modelName; - external "C" modelName = RTOpts_classToInstantiate(); + external "C" modelName = RTOpts_classToInstantiate() annotation(Library = "omcruntime"); end classToInstantiate; public function silent output Boolean outBoolean; - external "C" outBoolean = RTOpts_silent(); + external "C" outBoolean = RTOpts_silent() annotation(Library = "omcruntime"); end silent; public function versionRequest output Boolean outBoolean; - external "C" outBoolean = RTOpts_versionRequest(); + external "C" outBoolean = RTOpts_versionRequest() annotation(Library = "omcruntime"); end versionRequest; public function acceptMetaModelicaGrammar @@ -157,7 +157,7 @@ public function acceptMetaModelicaGrammar usage: omc [+g=Modelica|MetaModelica], default to 'Modelica'." output Boolean outBoolean; - external "C" outBoolean = RTOpts_acceptMetaModelicaGrammar(); + external "C" outBoolean = RTOpts_acceptMetaModelicaGrammar() annotation(Library = "omcruntime"); end acceptMetaModelicaGrammar; public function getAnnotationVersion @@ -168,7 +168,7 @@ public function getAnnotationVersion setAnnotationVersion(\"3.x\"); for annotations: 1.x or 2.x or 3.x" output String annotationVersion; - external "C" annotationVersion = RTOpts_getAnnotationVersion(); + external "C" annotationVersion = RTOpts_getAnnotationVersion() annotation(Library = "omcruntime"); end getAnnotationVersion; public function setAnnotationVersion @@ -176,7 +176,7 @@ public function setAnnotationVersion setAnnotationVersion(\"3.x\"); for annotations: 1.x or 2.x or 3.x" input String annotationVersion; - external "C"; + external "C" annotation(Library = "omcruntime"); end setAnnotationVersion; public function getNoSimplify @@ -186,7 +186,7 @@ public function getNoSimplify or via the API setNoSimplify(true|false);" output Boolean noSimplify; - external "C" noSimplify = RTOpts_getNoSimplify(); + external "C" noSimplify = RTOpts_getNoSimplify() annotation(Library = "omcruntime"); end getNoSimplify; public function setNoSimplify @@ -194,35 +194,35 @@ public function setNoSimplify setAnnotationVersion(\"3.x\"); for annotations: 1.x or 2.x or 3.x" input Boolean noSimplify; - external "C"; + external "C" annotation(Library = "omcruntime"); end setNoSimplify; public function vectorizationLimit "Returns the vectorization limit that is used to determine how large an array can be before it no longer is expanded by Static.crefVectorize." output Integer limit; - external "C" limit = RTOpts_vectorizationLimit(); + external "C" limit = RTOpts_vectorizationLimit() annotation(Library = "omcruntime"); end vectorizationLimit; public function setVectorizationLimit "Sets the vectorization limit, see vectorizationLimit above." input Integer limit; - external "C"; + external "C" annotation(Library = "omcruntime"); end setVectorizationLimit; public function showAnnotations output Boolean show; - external "C" show = RTOpts_showAnnotations(); + external "C" show = RTOpts_showAnnotations() annotation(Library = "omcruntime"); end showAnnotations; public function setShowAnnotations input Boolean show; - external "C"; + external "C" annotation(Library = "omcruntime"); end setShowAnnotations; public function getRunningTestsuite output Boolean runningTestsuite; - external "C" runningTestsuite = RTOpts_getRunningTestsuite(); + external "C" runningTestsuite = RTOpts_getRunningTestsuite() annotation(Library = "omcruntime"); end getRunningTestsuite; end RTOpts; diff --git a/c_runtime/meta_modelica_builtin.cpp b/c_runtime/meta_modelica_builtin.cpp index 9b1daf1e501..1d209cdfb79 100644 --- a/c_runtime/meta_modelica_builtin.cpp +++ b/c_runtime/meta_modelica_builtin.cpp @@ -263,51 +263,6 @@ realMin_rettype realMin(modelica_real r1, modelica_real r2) return r1 < r2 ? r1 : r2; } -realAbs_rettype realAbs(modelica_real r) -{ - return fabs(r); -} - -realNeg_rettype realNeg(modelica_real r) -{ - return -r; -} - -realCos_rettype realCos(modelica_real r) -{ - return cos(r); -} - -realSin_rettype realSin(modelica_real r) -{ - return sin(r); -} - -realAtan_rettype realAtan(modelica_real r) -{ - return atan(r); -} - -realExp_rettype realExp(modelica_real r) -{ - return exp(r); -} - -realLn_rettype realLn(modelica_real r) -{ - return log(r); -} - -realFloor_rettype realFloor(modelica_real r) -{ - return floor(r); -} - -realSqrt_rettype realSqrt(modelica_real r) -{ - return sqrt(r); -} - realLt_rettype realLt(modelica_real r1, modelica_real r2) { return r1 < r2; diff --git a/c_runtime/meta_modelica_builtin.h b/c_runtime/meta_modelica_builtin.h index d8acb1f6089..a2caa12a491 100644 --- a/c_runtime/meta_modelica_builtin.h +++ b/c_runtime/meta_modelica_builtin.h @@ -145,18 +145,20 @@ typedef modelica_real realSin_rettype; typedef modelica_real realAtan_rettype; typedef modelica_real realExp_rettype; typedef modelica_real realLn_rettype; +typedef modelica_real realLog10_rettype; typedef modelica_real realFloor_rettype; typedef modelica_real realSqrt_rettype; -realAbs_rettype realAbs(modelica_real); -realNeg_rettype realNeg(modelica_real); -realCos_rettype realCos(modelica_real); -realSin_rettype realSin(modelica_real); -realAtan_rettype realAtan(modelica_real); -realExp_rettype realExp(modelica_real); -realLn_rettype realLn(modelica_real); -realFloor_rettype realFloor(modelica_real); -realSqrt_rettype realSqrt(modelica_real); +#define realAbs(X) fabs(X) +#define realNeg(X) (-(X)) +#define realCos(X) cos(X) +#define realSin(X) sin(X) +#define realAtan(X) atan(X) +#define realExp(X) exp(X) +#define realLn(X) log(X) +#define realLog10(X) log10(X) +#define realFloor(X) floor(X) +#define realSqrt(X) sqrt(X) typedef modelica_boolean realLt_rettype; typedef modelica_boolean realLe_rettype; @@ -283,6 +285,7 @@ void equality(modelica_metatype, modelica_metatype); /* Weird RML stuff */ typedef modelica_metatype getGlobalRoot_rettype; typedef modelica_integer valueConstructor_rettype; +typedef modelica_boolean referenceEq_rettype; getGlobalRoot_rettype getGlobalRoot(int ix); void setGlobalRoot(int ix, modelica_metatype val); @@ -291,6 +294,7 @@ valueConstructor_rettype valueConstructor(modelica_metatype val); modelica_metatype boxptr_getGlobalRoot(modelica_metatype); void boxptr_setGlobalRoot(modelica_metatype, modelica_metatype); modelica_metatype boxptr_valueConstructor(modelica_metatype); +#define referenceEq(X,Y) ((X) == (Y)) #if defined(__cplusplus) }