Skip to content

Commit

Permalink
- first compilable version!
Browse files Browse the repository at this point in the history
- testsuite will have to wait a bit :)
  right now most of the tests fail.

git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/MathCoreOSMC@3772 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Dec 13, 2008
1 parent 08da014 commit 5e72615
Show file tree
Hide file tree
Showing 59 changed files with 5,146 additions and 3,491 deletions.
71 changes: 35 additions & 36 deletions Compiler/Absyn.mo
Expand Up @@ -506,11 +506,11 @@ uniontype Equation "Information on one (kind) of equation, different constructor
end EQ_NORETCALL;

record EQ_FAILURE
Equation equ;
EquationItem equ;
end EQ_FAILURE;

record EQ_EQUALITY
Equation equ;
EquationItem equ;
end EQ_EQUALITY;

end Equation;
Expand Down Expand Up @@ -554,11 +554,11 @@ uniontype Algorithm "The Algorithm type describes one algorithm statement in an
end ALG_NORETCALL;

record ALG_FAILURE
Algorithm equ;
AlgorithmItem equ;
end ALG_FAILURE;

record ALG_EQUALITY
Algorithm equ;
AlgorithmItem equ;
end ALG_EQUALITY;

record ALG_RETURN
Expand Down Expand Up @@ -914,38 +914,33 @@ end NamedArg;


uniontype Operator "Expression operators"
record ADD end ADD;

record SUB end SUB;

record MUL end MUL;

record DIV end DIV;

record POW end POW;

record UPLUS end UPLUS;

record UMINUS end UMINUS;

record AND end AND;

record OR end OR;

record NOT end NOT;

record LESS end LESS;

record LESSEQ end LESSEQ;

record GREATER end GREATER;

record GREATEREQ end GREATEREQ;

record EQUAL end EQUAL;

record NEQUAL end NEQUAL;

/* arithmetic operators */
record ADD "addition" end ADD;
record SUB "subtraction" end SUB;
record MUL "multiplication" end MUL;
record DIV "division" end DIV;
record POW "power" end POW;
record UPLUS "unary plus" end UPLUS;
record UMINUS "unary minus" end UMINUS;
/* element-wise arithmetic operators */
record ADD_EW "element-wise addition" end ADD_EW;
record SUB_EW "element-wise subtraction" end SUB_EW;
record MUL_EW "element-wise multiplication" end MUL_EW;
record DIV_EW "element-wise division" end DIV_EW;
record POW_EW "element-wise power" end POW_EW;
record UPLUS_EW "element-wise unary minus" end UPLUS_EW;
record UMINUS_EW "element-wise unary plus" end UMINUS_EW;
/* logical operators */
record AND "logical and" end AND;
record OR "logical or" end OR;
record NOT "logical not" end NOT;
/* relational operators */
record LESS "less than" end LESS;
record LESSEQ "less than or equal" end LESSEQ;
record GREATER "greater than" end GREATER;
record GREATEREQ "greater than or equal" end GREATEREQ;
record EQUAL "relational equal" end EQUAL;
record NEQUAL "relational not equal" end NEQUAL;
end Operator;


Expand Down Expand Up @@ -1088,6 +1083,10 @@ protected import Util;
protected import Print;
protected import ModUtil;

public constant TimeStamp dummyTimeStamp = TIMESTAMP(0.0,0.0);

public constant Info dummyInfo = INFO("",false,0,0,0,0,dummyTimeStamp);

public function getNewTimeStamp "Function: getNewTimeStamp
generate a new timestamp with edittime>buildtime.
"
Expand Down
18 changes: 8 additions & 10 deletions Compiler/Ceval.mo
Expand Up @@ -3378,13 +3378,12 @@ algorithm
Interactive.SYMBOLTABLE(p,sp,ic,iv,(path,t)::cf),
but where to get t? */
local Absyn.Program p_1;
list<Interactive.CompiledCFunction> newCF, newCF_1;
equation
mp = Settings.getModelicaPath();
(pnew, newCF) = ClassLoader.loadClass(path, mp, cf);
(p_1, newCF_1) = Interactive.updateProgram(pnew, p, newCF);
pnew = ClassLoader.loadClass(path, mp);
p_1 = Interactive.updateProgram(pnew, p);
str = Print.getString();
newst = Interactive.SYMBOLTABLE(p_1,aDep,sp,{},iv,newCF_1,lf);
newst = Interactive.SYMBOLTABLE(p_1,aDep,sp,{},iv,cf,lf);
then
(cache,Values.BOOL(true),newst);

Expand All @@ -3407,12 +3406,11 @@ algorithm
lstVarVal = iv,compiledFunctions = cf,
loadedFiles = lf)),msg)
local Absyn.Program p1;
list<Interactive.CompiledCFunction> newCF, newCF_1;
equation
(p1, newCF) = ClassLoader.loadFile(name, cf) "System.regularFileExists(name) => 0 & Parser.parse(name) => p1 &" ;
(newp,newCF_1) = Interactive.updateProgram(p1, p, newCF);
p1 = ClassLoader.loadFile(name) "System.regularFileExists(name) => 0 & Parser.parse(name) => p1 &" ;
newp = Interactive.updateProgram(p1, p);
then
(cache,Values.BOOL(true),Interactive.SYMBOLTABLE(newp,aDep,sp,ic,iv,newCF_1,lf));
(cache,Values.BOOL(true),Interactive.SYMBOLTABLE(newp,aDep,sp,ic,iv,cf,lf));

case (cache,env,Exp.CALL(path = Absyn.IDENT(name = "loadFile"),expLst = {Exp.SCONST(string = name)}),(st as Interactive.SYMBOLTABLE(ast = p,explodedAst = sp,instClsLst = ic,lstVarVal = iv,compiledFunctions = cf)),msg) /* (Values.BOOL(true),Interactive.SYMBOLTABLE(newp,sp,{},iv,cf)) it the rule above have failed then check if file exists without this omc crashes */
equation
Expand Down Expand Up @@ -3936,11 +3934,11 @@ algorithm
cls = Interactive.getPathedClassInProgram(className, p);
refactoredClass = Refactor.refactorGraphicalAnnotation(p, cls);
within_ = Interactive.buildWithin(className);
(p1,newCF) = Interactive.updateProgram(Absyn.PROGRAM({refactoredClass}, within_,ts), p, cf);
p1 = Interactive.updateProgram(Absyn.PROGRAM({refactoredClass}, within_,ts), p);
s1 = Absyn.pathString(className);
retStr=Util.stringAppendList({"Translation of ",s1," successful.\n"});
then
(cache,Values.STRING(retStr),Interactive.SYMBOLTABLE(p1,aDep,sp,ic,iv,newCF,lf));
(cache,Values.STRING(retStr),Interactive.SYMBOLTABLE(p1,aDep,sp,ic,iv,cf,lf));

case (cache,_,_,st,_) local
String errorMsg; Boolean strEmpty;
Expand Down

0 comments on commit 5e72615

Please sign in to comment.