Skip to content

Commit

Permalink
- Bump MSL
Browse files Browse the repository at this point in the history
- Build ModelicaExternalC (and the new tables) from the latest MSL sources
  + Note: m:#1143 - there is a bug for the tables in MSL so some tests will fail. I had success with some of them locally.
- Patched MSL to avoid printing warnings for some unused inputs in Tables
- Patched MSL to link against the correct library (ModelicaExternalC) instead of ModelicaStandardTables (this is the same as the beta branch, but trunk does not yet have this fix)
- Changed some tests using tables to use MSL 3.1 since then we can test the old table implementation (which is different)


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16143 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed May 29, 2013
1 parent 338fbe4 commit b776aec
Show file tree
Hide file tree
Showing 16 changed files with 152 additions and 1,630 deletions.
19 changes: 19 additions & 0 deletions Compiler/FrontEnd/Inst.mo
Original file line number Diff line number Diff line change
Expand Up @@ -12705,12 +12705,31 @@ protected
algorithm
(vars,_,_,_,algs,_,_,_) := DAEUtil.splitElements(elts);
invars := List.filter(vars,DAEUtil.isInputVar);
invars := List.select(invars,checkInputUsedAnnotation);
invars := checkExternalDeclInputUsed(invars,decl);
invars := List.select1(invars,checkVarBindingsInputUsed,vars);
(_,invars) := DAEUtil.traverseDAE2(algs,checkExpInputUsed,invars);
List.map1_0(invars,warnUnusedFunctionVar,name);
end checkFunctionInputUsed;

public function checkInputUsedAnnotation "
True if __OpenModelica_UnusedVariable does not exist in the element.
"
input DAE.Element inElement;
output Boolean result;
algorithm
result := match (inElement)
local
Option<SCode.Comment> cmt;
DAE.ComponentRef cr;
case DAE.VAR(componentRef=cr,absynCommentOption = cmt)
equation
result = SCode.optCommentHasBooleanNamedAnnotation(cmt, "__OpenModelica_UnusedVariable");
then not result;
else true;
end match;
end checkInputUsedAnnotation;

protected function warnUnusedFunctionVar
input DAE.Element v;
input String name;
Expand Down
23 changes: 16 additions & 7 deletions SimulationRuntime/c/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ CFLAGS = $(CPPFLAGS) $(CONFIG_CFLAGS) $(EXTRA_CFLAGS)
CXXFLAGS = $(CFLAGS)
FFLAGS = -O -fexceptions
# P.A: before, g77 had -O3 or -O2 but that caused a bug in DDASRT, giving infinite loop.
builddir = ../../build

RUNTIME_HEADERS = $(LIBF2CHEADER) \
./omc_inline.h \
Expand Down Expand Up @@ -70,7 +71,7 @@ RUNTIME_HEADERS_FMU = \
./simulation/solver/solver_main.h \
./util/list.h \

.PHONY : clean all ModelicaExternalC/libModelicaExternalC.a $(LIBF2C)
.PHONY : clean all $(LIBF2C) ModelicaExternalC ModelicaTables

all : install

Expand Down Expand Up @@ -135,19 +136,25 @@ $(SIMOBJSPATHC):%.o: %.c $(SIMHFILESPATH) $(COMMON_HEADERS)
@echo Deps: $(SIMHFILESPATH) $(COMMON_HEADERS)
$(CC) -c $(CFLAGS) -o $@ $< -I$(SIMPATH) -I$(UTILPATH) -I$(MATHPATH) -I$(RESULTSPATH) -I$(SOLVERPATH) -I$(INITIALIZATIONPATH) -Ilinearization/

ModelicaExternalC/libModelicaExternalC.a: $(addprefix ModelicaExternalC/,ModelicaInternal.c ModelicaStrings.c ModelicaTablesImpl.c) $(HFILES)
$(MAKE) -C ModelicaExternalC -f $(EXTERNALCMAKEFILE)

ifeq ($(LIBF2C),)
simulation/libf2c/libf2c.a:
else
simulation/libf2c/libf2c.a:
$(MAKE) -C simulation/libf2c -f ${LIBMAKEFILE}
endif

install: ModelicaExternalC/libModelicaExternalC.a $(LIBSIMULATION) $(LIBRUNTIME) $(LIBFMIRUNTIME) simulation/libf2c/libf2c.a $(ALL_OBJS)
EXTERNALCBUILDDIR = ModelicaExternalC

ModelicaExternalC : $(EXTERNALCBUILDDIR)/Makefile
$(MAKE) -C $(EXTERNALCBUILDDIR)
$(EXTERNALCBUILDDIR)/Makefile : $(EXTERNALCBUILDDIR)/configure $(REGEN)
cd $(EXTERNALCBUILDDIR) && ./configure $(PREFIX) CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)"
make -C $(EXTERNALCBUILDDIR) clean
$(EXTERNALCBUILDDIR)/configure : $(EXTERNALCBUILDDIR)/autogen.sh
cd $(EXTERNALCBUILDDIR) && ./autogen.sh

install: $(LIBSIMULATION) $(LIBRUNTIME) $(LIBFMIRUNTIME) simulation/libf2c/libf2c.a ModelicaExternalC $(ALL_OBJS)
# copy libraries
$(MAKE) -C ModelicaExternalC -f $(EXTERNALCMAKEFILE) install
cp -p $(LIBSIMULATION) $(LIBRUNTIME) $(LIBFMIRUNTIME) \
../interactive/libinteractive.a $(builddir_lib)
test -z "$(LIBF2C)" || cp simulation/libf2c/libf2c.* $(builddir_lib)/
Expand All @@ -160,6 +167,7 @@ install: ModelicaExternalC/libModelicaExternalC.a $(LIBSIMULATION) $(LIBRUNTIME)
../fmi/export/fmu_model_interface.c \
../fmi/import/fmuWrapper.h \
../fmi/import/xmlparser.h $(builddir_inc)
cp -Pp $(EXTERNALCBUILDDIR)/.libs/$(MODELICAEXTERNALC) $(builddir)/lib/omc
# copy java interface stuff
@$(MAKE) -C util/java_interface -f $(LIBMAKEFILE) && \
$(MAKE) -C util/java_interface -f $(LIBMAKEFILE) install || \
Expand All @@ -169,4 +177,5 @@ clean:
rm -f $(ALL_PATHS_CLEAN_OBJS) *.a
$(MAKE) -C ModelicaExternalC -f ${LIBMAKEFILE} clean
$(MAKE) -C simulation/libf2c -f ${LIBMAKEFILE} clean

(! test -f $(TABLEBUILDDIR)/Makefile) || make -C $(TABLEBUILDDIR) distclean
rm -f $(TABLEBUILDDIR)/Makefile $(TABLEBUILDDIR)/configure
4 changes: 4 additions & 0 deletions SimulationRuntime/c/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ LIBSIMULATION=@LIBSIMULATION@
LIBRUNTIME=@LIBRUNTIME@
LIBFMIRUNTIME=@LIBFMIRUNTIME@

REGEN = Makefile.in
MODELICAEXTERNALC = libModelicaExternalC*@SHREXT@*
PREFIX = --prefix="@prefix@" --libdir='$${exec_prefix}/lib/omc'

EXTERNALCMAKEFILE=Makefile

include Makefile.common
Expand Down
3 changes: 3 additions & 0 deletions SimulationRuntime/c/ModelicaExternalC/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MSLCSOURCES=../../../libraries/Modelica\ 3.2.1/Modelica/Resources/C-Sources/
lib_LTLIBRARIES = libModelicaExternalC.la
libModelicaExternalC_la_SOURCES = $(MSLCSOURCES)/ModelicaInternal.c $(MSLCSOURCES)/ModelicaStrings.c $(MSLCSOURCES)/ModelicaStandardTables.c $(MSLCSOURCES)/ModelicaMatIO.c ModelicaTablesImpl.c tables.c
34 changes: 0 additions & 34 deletions SimulationRuntime/c/ModelicaExternalC/Makefile.common

This file was deleted.

18 changes: 0 additions & 18 deletions SimulationRuntime/c/ModelicaExternalC/Makefile.in

This file was deleted.

0 comments on commit b776aec

Please sign in to comment.