Skip to content

Commit

Permalink
changed Interactive.rml to compile with VC7.1
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1949 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
x02lucpo committed Nov 7, 2005
1 parent 995d2b3 commit 8a662e3
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 69 deletions.
139 changes: 71 additions & 68 deletions Compiler/Interactive.rml
Expand Up @@ -479,71 +479,13 @@ with "Ceval.rml"

relation evaluate_graphical_api2: (InteractiveStmts, InteractiveSymbolTable)
=> (string, InteractiveSymbolTable) =

rule set_component_properties(class,comp_ref,final,flow,protected,repl,
variability,[dref1,dref2],causality,p)
=> (resstr,p')
--------------------------------------------
evaluate_graphical_api2(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setComponentProperties",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),
Absyn.CREF(comp_ref),
Absyn.ARRAY([
Absyn.BOOL(final),
Absyn.BOOL(flow),
Absyn.BOOL(protected),
Absyn.BOOL(repl)]),
Absyn.ARRAY([Absyn.STRING(variability)]),
Absyn.ARRAY([Absyn.BOOL(dref1),
Absyn.BOOL(dref2)]),
Absyn.ARRAY([Absyn.STRING(causality)])
],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf))
=> (resstr, SYMBOLTABLE(p',s,ic,iv,cf))

end

(** relation: evaluate_graphical_api
**
** This relation evaluates all primitives in the graphical api.
** NOTE: Do NOT ADD more rules to this relation, instead add them
** to evaluate_graphical_api2, since it wont compile in Visual Studio
** otherwise.
**)

relation evaluate_graphical_api: (InteractiveStmts, InteractiveSymbolTable)
=> (string, InteractiveSymbolTable) =


rule get_source_file(class,p) => resstr
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getSourceFile",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class)],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf))
=> (resstr,st)

rule set_source_file(class,filename,p) => (resstr,newp)
--------------------------------------------
evaluate_graphical_api(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setSourceFile",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),
Absyn.STRING(filename)
],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf))
=> (resstr,SYMBOLTABLE(newp,s,ic,iv,cf))


rule set_extends_modifier_value(class,Absyn.CREF_IDENT(ident,[]),
subident,mod,p)
=> (newp,resstr)
--------------------------------------------
evaluate_graphical_api(
evaluate_graphical_api2(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setExtendsModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),
Expand All @@ -556,7 +498,7 @@ end

rule get_extends_modifier_names(class,ident,p) => resstr
--------------------------------------------
evaluate_graphical_api(
evaluate_graphical_api2(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getExtendsModifierNames",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(ident)],[])))],_
Expand All @@ -565,15 +507,15 @@ end

rule get_extends_modifier_value(class,Absyn.CREF_IDENT(ident,[]),subident,p) => resstr
--------------------------------------------
evaluate_graphical_api(
evaluate_graphical_api2(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getExtendsModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(Absyn.CREF_QUAL(ident,_,subident))],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
rule get_component_modifier_names(class,ident,p) => resstr
--------------------------------------------
evaluate_graphical_api(
evaluate_graphical_api2(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getComponentModifierNames",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(ident)],[])))],_
Expand All @@ -583,7 +525,7 @@ end
rule get_component_modifier_value(class,Absyn.CREF_IDENT(ident,[]),subident,p)
=> resstr
--------------------------------------------
evaluate_graphical_api(
evaluate_graphical_api2(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getComponentModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(Absyn.CREF_QUAL(ident,_,subident))],[])))],_
Expand All @@ -592,13 +534,74 @@ end

rule get_parameter_value(class,Absyn.CREF_IDENT(ident,[]),p) => resstr
--------------------------------------------
evaluate_graphical_api(
evaluate_graphical_api2(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getComponentModifierValue",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),Absyn.CREF(Absyn.CREF_IDENT(ident,_))],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)

rule get_source_file(class,p) => resstr
--------------------------------------------
evaluate_graphical_api2(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("getSourceFile",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class)],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf))
=> (resstr,st)

rule set_source_file(class,filename,p) => (resstr,newp)
--------------------------------------------
evaluate_graphical_api2(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setSourceFile",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),
Absyn.STRING(filename)
],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf))
=> (resstr,SYMBOLTABLE(newp,s,ic,iv,cf))

rule Absyn.cref_to_path(class) => p_class &
set_component_properties(p_class,comp_ref,final,flow,protected,repl,
variability,[dref1,dref2],causality,p)
=> (resstr,p')
--------------------------------------------
evaluate_graphical_api2(
ISTMTS([IEXP(Absyn.CALL(
Absyn.CREF_IDENT("setComponentProperties",_),
Absyn.FUNCTIONARGS([Absyn.CREF(class),
Absyn.CREF(comp_ref),
Absyn.ARRAY([
Absyn.BOOL(final),
Absyn.BOOL(flow),
Absyn.BOOL(protected),
Absyn.BOOL(repl)]),
Absyn.ARRAY([Absyn.STRING(variability)]),
Absyn.ARRAY([Absyn.BOOL(dref1),
Absyn.BOOL(dref2)]),
Absyn.ARRAY([Absyn.STRING(causality)])
],[])))],_
),
st as SYMBOLTABLE(p,s,ic,iv,cf))
=> (resstr, SYMBOLTABLE(p',s,ic,iv,cf))

end

(** relation: evaluate_graphical_api
**
** This relation evaluates all primitives in the graphical api.
** NOTE: Do NOT ADD more rules to this relation, instead add them
** to evaluate_graphical_api2, since it wont compile in Visual Studio
** otherwise.
**)

relation evaluate_graphical_api: (InteractiveStmts, InteractiveSymbolTable)
=> (string, InteractiveSymbolTable) =



rule (* expressions *)
set_parameter_value(class,ident,exp,p) => (p',resstr)
--------------------------------------------
Expand Down Expand Up @@ -1289,7 +1292,7 @@ end
** - dynamic_ref: {inner, outer} - two boolean values.
** - causality: "input" or "output" or ""
**)
relation set_component_properties: (Absyn.ComponentRef, (* class *)
relation set_component_properties: (Absyn.Path, (* class *)
Absyn.ComponentRef, (* component_ref *)
bool, (* final = true *)
bool, (* flow = true *)
Expand All @@ -1302,15 +1305,15 @@ relation set_component_properties: (Absyn.ComponentRef, (* class *)
Absyn.Program)
=> (string, Absyn.Program) =

rule Absyn.cref_to_path(class) => p_class &
rule
build_within(p_class) => within &
get_pathed_class_in_program(p_class,p) => cdef &
set_component_properties_in_class(cdef,varname,final,flow,prot,repl,
variability,dyn_ref,causality)
=> cdef' &
update_program(Absyn.PROGRAM([cdef'],within),p) => newp
-----------------------------------
set_component_properties(class,Absyn.CREF_IDENT(varname,_),
set_component_properties(p_class,Absyn.CREF_IDENT(varname,_),
final,flow,prot,repl,variability,
dyn_ref,causality,p)
=> ("Ok",newp)
Expand Down
2 changes: 1 addition & 1 deletion flat_modelica_parser/src/flatmodelicaTokenTypes.txt
@@ -1,4 +1,4 @@
// $ANTLR 2.7.5 (20050213): flat_modelica_lexer.g -> flatmodelicaTokenTypes.txt$
// $ANTLR 2.7.4: flat_modelica_lexer.g -> flatmodelicaTokenTypes.txt$
flatmodelica // output token vocab name
ALGORITHM="algorithm"=4
AND="and"=5
Expand Down

0 comments on commit 8a662e3

Please sign in to comment.