Skip to content

Commit 0393072

Browse files
author
Jens Frenkel
committed
- add boxptr_intMin
- bugfix setPastOptModules -> postOptModules git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11821 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent f7a3498 commit 0393072

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Compiler/FrontEnd/ModelicaBuiltin.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ function setPastOptModules "example input: lateInline,inlineArrayEqn,removeSimpl
11851185
output Boolean success;
11861186
annotation(__OpenModelica_EarlyInline = true);
11871187
algorithm
1188-
success := setCommandLineOptions("+pastOptModules=" + modules);
1188+
success := setCommandLineOptions("+postOptModules=" + modules);
11891189
annotation(preferredView="text");
11901190
end setPastOptModules;
11911191

SimulationRuntime/c/meta/meta_modelica_builtin.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ modelica_metatype boxptr_intMax(modelica_metatype a,modelica_metatype b)
6969
return mmc_unbox_integer(a) > mmc_unbox_integer(b) ? a : b;
7070
}
7171

72+
73+
modelica_metatype boxptr_intMin(modelica_metatype a,modelica_metatype b)
74+
{
75+
/* We need to unbox because pointers may be unsigned */
76+
return mmc_unbox_integer(a) < mmc_unbox_integer(b) ? a : b;
77+
}
78+
79+
7280
/* String Character Conversion */
7381

7482
modelica_integer stringCharInt(metamodelica_string chr)
@@ -395,7 +403,7 @@ modelica_metatype stringUpdateStringChar(metamodelica_string str, metamodelica_s
395403
unsigned nwords = MMC_HDRSLOTS(header) + 1;
396404
struct mmc_string *p = NULL;
397405
void *res = NULL;
398-
406+
399407
mmc_GC_add_roots((void*)&str, 1, 0, "");
400408
mmc_GC_add_roots((void*)&c, 1, 0, "");
401409

@@ -451,10 +459,10 @@ metamodelica_string_const stringAppend(metamodelica_string_const s1, metamodelic
451459
modelica_metatype listReverse(modelica_metatype lst)
452460
{
453461
modelica_metatype res = NULL;
454-
462+
455463
mmc_GC_add_roots(&lst, 1, 0, "");
456464
mmc_GC_add_roots(&res, 1, 0, "");
457-
465+
458466
res = mmc_mk_nil();
459467
while (!MMC_NILTEST(lst))
460468
{
@@ -466,10 +474,10 @@ modelica_metatype listReverse(modelica_metatype lst)
466474

467475
modelica_metatype listAppend(modelica_metatype lst1,modelica_metatype lst2)
468476
{
469-
477+
470478
mmc_GC_add_roots(&lst1, 1, 0, "listAppend");
471479
mmc_GC_add_roots(&lst2, 1, 0, "listAppend");
472-
480+
473481
{
474482
int length = 0, i = 0;
475483
struct mmc_cons_struct *res = NULL;

SimulationRuntime/c/meta/meta_modelica_builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ typedef const modelica_metatype metamodelica_string_const;
5050

5151
extern metamodelica_string intString(modelica_integer);
5252
extern modelica_metatype boxptr_intMax(modelica_metatype,modelica_metatype);
53+
extern modelica_metatype boxptr_intMin(modelica_metatype,modelica_metatype);
5354

5455
/* String Character Conversion */
5556

0 commit comments

Comments
 (0)