Skip to content

Commit

Permalink
Merge branch 'master' into qss
Browse files Browse the repository at this point in the history
  • Loading branch information
lochel committed May 5, 2015
2 parents cce4cff + 56ab447 commit 5b92c2a
Show file tree
Hide file tree
Showing 32 changed files with 1,721 additions and 1,688 deletions.
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="false"/>
<mapAttribute key="org.eclipse.debug.core.environmentVariables">
<mapEntry key="OPENMODELICAHOME" value="${project_loc}/build"/>
<mapEntry key="TMP" value="${env_var:TMP}"/>
<mapEntry key="OMDEV" value="/c/OMDev/"/>
<mapEntry key="OMC_BUILD_FROM" value="mo"/>
<mapEntry key="SystemRoot" value="${env_var:SystemRoot}"/>
<mapEntry key="CLASSPATH" value="${env_var:OMDEV}/bin/antlr/antlr.jar"/>
<mapEntry key="PATH" value="${env_var:OMDEV}/tools/mingw/bin;${env_var:OMDEV}/tools/msys/bin;${env_var:OMDEV}/tools/rml/bin/;${env_var:OMDEV}/tools/msys/local/bin;${env_var:OMDEV}/bin/mico/;c:/windows;c:/windows/system32;"/>
<mapEntry key="OMC_BUILD_STATIC" value="/static"/>
<mapEntry key="COMSPEC" value="${env_var:COMSPEC}"/>
<mapEntry key="TEMP" value="${env_var:TEMP}"/>
<mapEntry key="SystemDrive" value="${env_var:SystemDrive}"/>
<mapEntry key="OPENMODELICALIBRARY" value="${project_loc}\build\lib\omlibrary\"/>
</mapAttribute>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${env_var:OMDEV}\tools\msys\bin\make.exe"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-f Makefile.omdev.mingw ${string_prompt}"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc}"/>
</launchConfiguration>
13 changes: 13 additions & 0 deletions .gitattributes
@@ -0,0 +1,13 @@
*.c text eol=native
*.cpp text eol=native
*.h text eol=native
*.m4 text eol=native
.gitattributes text eol=LF
.gitignore text eol=LF
*.md text eol=native
LICENSE text eol=native
configure.ac text eol=native
Makefile* text eol=native
*.pro text eol=native
*.mo eol=LF
*.g text eol=LF
122 changes: 58 additions & 64 deletions Compiler/FrontEnd/ConnectUtil.mo
Expand Up @@ -34,7 +34,7 @@ encapsulated package ConnectUtil
package: ConnectUtil
description: Connection set management

RCS: $Id$
RCS: $Id: ConnectUtil.mo 25082 2015-03-13 09:40:07Z lochel $

Connections generate connection sets (datatype SET is described in Connect)
which are constructed during instantiation. When a connection
Expand Down Expand Up @@ -3570,69 +3570,63 @@ protected function countConnectorVars
"Given a list of connector variables, this function counts how many potential,
flow and stream variables it contains."
input list<DAE.Var> inVars;
output Integer potentialVars;
output Integer flowVars;
output Integer streamVars;
algorithm
(potentialVars, flowVars, streamVars) := matchcontinue(inVars)
local
DAE.Var v;
list<DAE.Var> rest, vars;
Integer n, p, f, s, p2, f2, s2;
String name;
DAE.Type ty, ty2;

case ({}) then (0, 0, 0);

// A connector inside a connector.
case ((DAE.TYPES_VAR(ty = ty)) :: rest)
equation
// Check that it's a connector.
ty2 = Types.arrayElementType(ty);
true = Types.isConnector(ty2);
// If we have an array of connectors, count how many they are.
n = List.fold(Types.getDimensionSizes(ty), intMul, 1);
// Count the number of different variables inside the connector, and
// then multiply those numbers with the dimensions of the array.
vars = Types.getConnectorVars(ty2);
(p2, f2, s2) = countConnectorVars(vars);
(p, f, s) = countConnectorVars(rest);
then
(p + n * p2, f + n * f2, s + n * s2);

// A flow variable.
case ((v as DAE.TYPES_VAR(attributes = DAE.ATTR(connectorType = SCode.FLOW()))) :: rest)
equation
n = sizeOfVariable(v);
(p, f, s) = countConnectorVars(rest);
then
(p, f + n, s);

// A stream variable.
case ((v as DAE.TYPES_VAR(attributes = DAE.ATTR(connectorType = SCode.STREAM()))) :: rest)
equation
n = sizeOfVariable(v);
(p, f, s) = countConnectorVars(rest);
then
(p, f, s + n);

// A potential variable.
case ((v as DAE.TYPES_VAR(attributes = DAE.ATTR(
direction = Absyn.BIDIR(),
variability = SCode.VAR()))) :: rest)
equation
n = sizeOfVariable(v);
(p, f, s) = countConnectorVars(rest);
then
(p + n, f, s);

// Something else.
case _ :: rest
equation
(p, f, s) = countConnectorVars(rest);
then
(p, f, s);
end matchcontinue;
output Integer potentialVars = 0;
output Integer flowVars = 0;
output Integer streamVars = 0;
protected
DAE.Type ty, ty2;
DAE.Attributes attr;
Integer n, p, f, s;
list<DAE.Var> vars;
algorithm
for var in inVars loop
DAE.TYPES_VAR(ty = ty, attributes = attr) := var;
ty2 := Types.arrayElementType(ty);

// Check if we have a connector inside a connector.
if Types.isConnector(ty2) then
// If we have an array of connectors, count the elements.
n := product(dim for dim in Types.getDimensionSizes(ty));
// Count the number of different variables inside the connector, and then
// multiply those numbers with the dimensions of the array.
vars := Types.getConnectorVars(ty2);
(p, f, s) := countConnectorVars(vars);

// If the variable is input/output we don't count potential variables.
if Absyn.isInputOrOutput(DAEUtil.getAttrDirection(attr)) then
p := 0;
end if;

potentialVars := potentialVars + p * n;
flowVars := flowVars + f * n;
streamVars := streamVars + s * n;
else
_ := match attr
// A flow variable.
case DAE.ATTR(connectorType = SCode.FLOW())
algorithm
flowVars := flowVars + sizeOfVariable(var);
then
();

// A stream variable.
case DAE.ATTR(connectorType = SCode.STREAM())
algorithm
streamVars := streamVars + sizeOfVariable(var);
then
();

// A potential variable.
case DAE.ATTR(direction = Absyn.BIDIR(), variability = SCode.VAR())
algorithm
potentialVars := potentialVars + sizeOfVariable(var);
then
();

else ();
end match;
end if;
end for;
end countConnectorVars;

protected function sizeOfVariableList
Expand Down
176 changes: 88 additions & 88 deletions Compiler/Makefile.omdev.mingw
@@ -1,88 +1,88 @@
# Adrian Pop, adrpo@ida.liu.se, 2006-02-01
# Makefile for compilation of OMC using OMDev-mingw
# OMDev-mingw: http://www.ida.liu.se/~adrpo/omc/omdev/
#
# $Id: Makefile.omdev.mingw.in 1817 2006-02-01 12:21:26Z adrpo $
#
# The path to the OMDev-mingw package MUST BE SET!
#OMDEV=$OMDEV
# Test if the needed variables are there...
.testvariables:
ifndef OMDEV
@echo You have to set the OMDEV variabile pointing to your OMDev package root! Exiting....
@echo Take the OMDev package from: http://www.ida.liu.se/~adrpo/omc/omdev/
@echo For questions or problems email Adrian Pop, adrpo@ida.liu.se
ABORT
endif
srcdir= .
top_builddir= ..
builddir_bin=$(top_builddir)/build/bin
builddir_scripts=$(top_builddir)/build/share/omc/scripts
builddir_lib=$(top_builddir)/build/lib/omc
# adrpo, libsocket should be -lwsock32 but is not needed!
LIBSOCKET = -lwsock32
SHELL = /bin/sh
CC = cc
override CFLAGS += $(USE_CORBA)
USE_CORBA = -DUSE_CORBA
CORBAHOME = $(OMDEV)
SCRIPT_FILES = Compile.bat openmodelica.lefty default_profiling.xsl replace-startValue.* simcodedump.xsl ngspicetoModelica.py
SUBDIRS = runtime Script
.SUFFIXES:
.SUFFIXES: .o .mo .h
.PHONY: all subdirs report vctarget release clean test reallyclean builtin
all : .testvariables release simcode builtin
include Makefile.common
release: .testvariables install
install_scripts:
cd scripts; cp -puf $(SCRIPT_FILES) ../$(builddir_scripts)
install: install_scripts # install_doc
cp OpenModelicaBootstrappingHeader.h $(top_builddir)/build/include/omc/
clean:
@for d in $(SUBDIRS); do \
(cd $$d ; $(MAKE) -f Makefile.omdev.mingw clean) \
done
-cd $(builddir_bin) && rm -f $(SCRIPT_FILES)
reallyclean:
@for d in $(SUBDIRS); do \
(cd $$d ; $(MAKE) -f Makefile.omdev.mingw reallyclean) \
done
report:
@(cd report ; $(MAKE))
ifeq ($(wildcard ../build/bin/omc.exe),)
simcode:
@echo OpenModelica has not been compiled yet. Using previously generated SimCode files.
else
simcode: OpenModelicaBootstrappingHeader.h
$(MAKE) -C Template/ -f Makefile.omdev.mingw
OpenModelicaBootstrappingHeader.h: FrontEnd/Absyn.mo Script/GlobalScript.mo FrontEnd/Values.mo Util/Error.mo Util/Util.mo Util/FMI.mo GenerateOMCHeader.mos
../build/bin/omc +g=MetaModelica GenerateOMCHeader.mos > $@.log || (cat $@.log && false)
@mv $@.new $@
endif
$(SUSANMO): simcode
builtin:
cp FrontEnd/ModelicaBuiltin.mo FrontEnd/MetaModelicaBuiltin.mo $(builddir_lib)
#.PRECIOUS: Makefile.omdev.mingw
#
#Makefile.omdev.mingw: Makefile.omdev.mingw.in
# $(top_builddir)/config.status Makefile.omdev.mingw
# Adrian Pop, adrpo@ida.liu.se, 2006-02-01
# Makefile for compilation of OMC using OMDev-mingw
# OMDev-mingw: http://www.ida.liu.se/~adrpo/omc/omdev/
#
# $Id: Makefile.omdev.mingw.in 1817 2006-02-01 12:21:26Z adrpo $
#

# The path to the OMDev-mingw package MUST BE SET!
#OMDEV=$OMDEV
# Test if the needed variables are there...

.testvariables:
ifndef OMDEV
@echo You have to set the OMDEV variabile pointing to your OMDev package root! Exiting....
@echo Take the OMDev package from: http://www.ida.liu.se/~adrpo/omc/omdev/
@echo For questions or problems email Adrian Pop, adrpo@ida.liu.se
ABORT
endif

srcdir= .
top_builddir= ..
builddir_bin=$(top_builddir)/build/bin
builddir_scripts=$(top_builddir)/build/share/omc/scripts
builddir_lib=$(top_builddir)/build/lib/omc

# adrpo, libsocket should be -lwsock32 but is not needed!
LIBSOCKET = -lwsock32

SHELL = /bin/sh
CC = cc
override CFLAGS += $(USE_CORBA)

USE_CORBA = -DUSE_CORBA
CORBAHOME = $(OMDEV)

SCRIPT_FILES = Compile.bat openmodelica.lefty default_profiling.xsl replace-startValue.* simcodedump.xsl ngspicetoModelica.py

SUBDIRS = runtime Script

.SUFFIXES:
.SUFFIXES: .o .mo .h
.PHONY: all subdirs report vctarget release clean test reallyclean builtin

all : .testvariables release simcode builtin

include Makefile.common

release: .testvariables install

install_scripts:
cd scripts; cp -puf $(SCRIPT_FILES) ../$(builddir_scripts)

install: install_scripts # install_doc
cp OpenModelicaBootstrappingHeader.h $(top_builddir)/build/include/omc/

clean:
@for d in $(SUBDIRS); do \
(cd $$d ; $(MAKE) -f Makefile.omdev.mingw clean) \
done
-cd $(builddir_bin) && rm -f $(SCRIPT_FILES)

reallyclean:
@for d in $(SUBDIRS); do \
(cd $$d ; $(MAKE) -f Makefile.omdev.mingw reallyclean) \
done

report:
@(cd report ; $(MAKE))

ifeq ($(wildcard ../build/bin/omc.exe),)
simcode:
@echo OpenModelica has not been compiled yet. Using previously generated SimCode files.
else
simcode: OpenModelicaBootstrappingHeader.h
$(MAKE) -C Template/ -f Makefile.omdev.mingw
OpenModelicaBootstrappingHeader.h: FrontEnd/Absyn.mo Script/GlobalScript.mo FrontEnd/Values.mo Util/Error.mo Util/Util.mo Util/FMI.mo GenerateOMCHeader.mos
../build/bin/omc +g=MetaModelica GenerateOMCHeader.mos > $@.log || (cat $@.log && false)
@mv $@.new $@
endif
$(SUSANMO): simcode

builtin:
cp FrontEnd/ModelicaBuiltin.mo FrontEnd/MetaModelicaBuiltin.mo $(builddir_lib)

#.PRECIOUS: Makefile.omdev.mingw
#
#Makefile.omdev.mingw: Makefile.omdev.mingw.in
# $(top_builddir)/config.status Makefile.omdev.mingw

0 comments on commit 5b92c2a

Please sign in to comment.