Skip to content

Commit

Permalink
- merged in the ndims(A) code from Stefan Vorkoetter <svorkoetter@map…
Browse files Browse the repository at this point in the history
…lesoft.com> in Static.mo

  + many thanks to Stefan for his first contribution!
- merged in the ndims(A) test from Stefan Vorkoetter <svorkoetter@maplesoft.com> in matrices.mos
- added another ndims(A) test based on flattening within matrices.mos
- fixed bug http://bug.modelicacommunity.org/show_bug.cgi?id=80 by casting the pow(x, y) 
  arguments to modelica_real within Codegen.mo
- wrote more about testing in README-OMDev-MINGW.txt and README.Cygwin.or.Linux.txt
- added some missing information in README-BUILD-RELEASE.txt
- added OPENMODELICALIBRARY environment variable to OMDev-MINGW-OpenModelicaBuilder.launch-sample
  as is not really true that everybody has a OpenModelica release available (take Linux for example)
  and an OPENMODELICALIBRARY=/path/to/ModelicaLibrary environment variable set.
- added a space in SimCodegen.mo :)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2613 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 17, 2006
1 parent 650224e commit 1fe2455
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Compiler/Codegen.mo
Expand Up @@ -3697,7 +3697,7 @@ algorithm
equation
(cfn1,var1,tnr1) = generateExpression(e1, tnr, context);
(cfn2,var2,tnr2) = generateExpression(e2, tnr1, context);
var = Util.stringAppendList({"pow(",var1,", ",var2,")"});
var = Util.stringAppendList({"pow((modelica_real)",var1,", (modelica_real)",var2,")"});
cfn = cMergeFn(cfn1, cfn2);
then
(cfn,var,tnr2);
Expand Down
2 changes: 1 addition & 1 deletion Compiler/SimCodegen.mo
Expand Up @@ -7475,7 +7475,7 @@ algorithm
s4 = Exp.printRightparStr(pri1, pri2);
s = stringAppend(s1, s2);
s_1 = stringAppend("pow(", s);
s_2 = stringAppend(s_1, ",");
s_2 = stringAppend(s_1, ", ");
s_3 = stringAppend(s_2, s3);
res = stringAppend(s_3, ")");
res_1 = stringAppend(res, s4);
Expand Down
43 changes: 43 additions & 0 deletions Compiler/Static.mo
Expand Up @@ -2033,6 +2033,47 @@ algorithm
end matchcontinue;
end elabBuiltinSize;

protected function elabBuiltinNDims
"@author Stefan Vorkoetter <svorkoetter@maplesoft.com>
ndims(A) : Returns the number of dimensions k of array expression A, with k >= 0.
"
input Env.Cache inCache;
input Env.Env inEnv;
input list<Absyn.Exp> inAbsynExpLst;
input Boolean inBoolean;
output Env.Cache outCache;
output Exp.Exp outExp;
output Types.Properties outProperties;
algorithm
(outCache,outExp,outProperties):=
matchcontinue (inCache,inEnv,inAbsynExpLst,inBoolean)
local
Exp.Exp arraycrefe,exp;
Types.Const c;
tuple<Types.TType, Option<Absyn.Path>> arrtp;
Boolean c2,impl;
list<Env.Frame> env;
Absyn.Exp arraycr;
Env.Cache cache;
list<Absyn.Exp> expl;
Integer nd;
case (cache,env,{arraycr},impl)
equation
(cache,arraycrefe,Types.PROP(arrtp,_),_) = elabExp(cache,env, arraycr, impl, NONE,true) "ndims(A)" ;
c2 = Types.dimensionsKnown(arrtp);
c = Types.boolConst(c2);
nd = Types.ndims(arrtp);
exp = Exp.ICONST(nd);
then
(cache,exp,Types.PROP((Types.T_INTEGER({}),NONE),c));
case (cache,env,expl,impl)
equation
Debug.fprint("failtrace", "- elab_builtin_ndims failed\n");
then
fail();
end matchcontinue;
end elabBuiltinNDims;

protected function elabBuiltinFill "function: elabBuiltinFill
This function elaborates the builtin operator fill.
Expand Down Expand Up @@ -4121,6 +4162,8 @@ algorithm
matchcontinue (inIdent)
case "size" then elabBuiltinSize; /* impl */

case "ndims" then elabBuiltinNDims;

case "zeros" then elabBuiltinZeros;

case "ones" then elabBuiltinOnes;
Expand Down
93 changes: 48 additions & 45 deletions README-BUILD-RELEASE.txt
Expand Up @@ -9,53 +9,56 @@ The following step-by-step guides explain how to
build the OpenModelica release .msi file on Windows
using the Microsoft Visual Studio .NET 2003

0. Update the version number:
in trunk/Compiler/runtime/settings.c to "x.y.z"
in trunk/Examples/*.onb
in trunk/doc/*.doc + generate .pdfs

1. Please do all the steps in README-WIN32.txt
Also you need to build the simulation runtime from c_runtime
To do this you need to open MSYS terminal, go to trunk/c_runtime
say: make -f Makefile.omdev.mingw

2. Create a drive called M:
subst m: c:\OpenModelicaRelease
[to delete the drive use subst m: /d]

3. Within drive M: copy:
- unpacked trunk\Compiler\VC7\Setup\zips\mingw.tar.gz
-> to M:\MinGW
- unpacked trunk\Compiler\VC7\Setup\zips\ModelicaLib.tar.gz
-> to M:\ModelicaLibrary
- copy C:\bin\cygwin\home\adrpo\dev\OpenModelica\OMNotebook\DrModelica
-> to M:\DrModelica
- build trunk\OMShell then put all the files below:
OMShell.exe, mico2311.dll, msvcp71.dll, msvcr71.dll, QtCore4.dll, QtGui4.dll
into:
M:\OMShell\release\
- build trunk\OMNotebook then put all the files below:
OMNotebook.exe, mico2311.dll, msvcp71.dll, msvcr71.dll, QtCore4.dll, QtGui4.dll
QtNetwork4.dll, QtXml4.dll, commands.xml, modelicacolors.xml, stylesheet.xml
OMNotebookHelp.onb, pltplot.jar (from trunk/Compiler/VC7/Setup/bin/ptplot.jar)
into:
M:\OMNotebook\release\

4. Open the trunk/Compiler/VC7/omc/omc.snl

5. Build the project Ctrl+Shit+B

6. Open Setup, go to a file, right click on it and say->Properties Window
Then, click on Setup and in the Properties change:
ProductName, Title, Version to update version to x.y.z

7. Right Click in Setup choose View->"File System",
then go to Application Folder, RightClick -> Properties Window
change DefaultLocation to c:\OpenModelica[x.y.z]
00. Update the version number:
in trunk/Compiler/runtime/settings.c to "x.y.z"
in trunk/Examples/*.onb
in trunk/doc/*.doc + generate .pdfs

01. Please do all the steps in README-WIN32.txt
Also you need to build the simulation runtime from c_runtime
To do this you need to open MSYS terminal, go to trunk/c_runtime
say: make -f Makefile.omdev.mingw

02. Create a drive called M:
subst m: c:\OpenModelicaRelease
[to delete the drive use subst m: /d]

03. Within drive M: copy:
- unpacked trunk\Compiler\VC7\Setup\zips\mingw.tar.gz
-> to M:\MinGW
- unpacked trunk\Compiler\VC7\Setup\zips\ModelicaLib.tar.gz
-> to M:\ModelicaLibrary
- copy C:\bin\cygwin\home\adrpo\dev\OpenModelica\OMNotebook\DrModelica
-> to M:\DrModelica
- build trunk\OMShell then put all the files below:
OMShell.exe, mico2311.dll, msvcp71.dll, msvcr71.dll, QtCore4.dll, QtGui4.dll
into:
M:\OMShell\release\
- build trunk\OMNotebook then put all the files below:
OMNotebook.exe, mico2311.dll, msvcp71.dll, msvcr71.dll, QtCore4.dll, QtGui4.dll
QtNetwork4.dll, QtXml4.dll, commands.xml, modelicacolors.xml, stylesheet.xml
OMNotebookHelp.onb, pltplot.jar (from trunk/Compiler/VC7/Setup/bin/ptplot.jar)
into:
M:\OMNotebook\release\

04. Open the trunk/Compiler/VC7/omc/omc.snl

05. Build the project Ctrl+Shit+B

06. Open Setup, go to a file, right click on it and say->Properties Window
Then, click on Setup and in the Properties change:
ProductName, Title, Version to update version to x.y.z

07. Right Click in Setup choose View->"File System",
then go to Application Folder, RightClick -> Properties Window
change DefaultLocation to c:\OpenModelica[x.y.z]

8. Right click on Setup and say Build
08. Locate Uninstall.bat in the solution, edit it and replace the
number with the latest product upgrade code.

09. Right click on Setup and say Build

9. You get a Setup.msi into trunk\Compiler\VC7\Setup\Release
10. You get a Setup.msi into trunk\Compiler\VC7\Setup\Release

That's it,
Cheers,
Expand Down
5 changes: 5 additions & 0 deletions README-OMDev-MINGW.txt
Expand Up @@ -65,11 +65,16 @@ Adrian Pop, adrpo@ida.liu.se, 2006-04-06

11. To run the OpenModelica testsuite you have to:
Copy OMDev/tools/mingw to OpenModelica/build/MinGW
If you don't have an OpenModelicaX.Y.Z release installed
then create a directory called OpenModelica/build/ModelicaLibrary
in which you unpack the Modelica Standard Library you
can take from: OpenModelica/Compiler/VC7/Setup/zips/ModelicaLib.tar.gz
To run the testsuite from Eclipse:
- Ctrl+B and type: test
To run the testsuite from MSYS terminal:
- run OMDev/tools/msys/msys.bat and in the terminal you write
>export OPENMODELICAHOME="c:\\path\\to\\your\\OpenModelica\\build"
>export OPENMODELICALIBRARY="c:\\path\\to\\your\\OpenModelica\\build\ModelicaLibrary"
>cd testsuite
testsuite> make

Expand Down

0 comments on commit 1fe2455

Please sign in to comment.