Skip to content

Commit

Permalink
made some relations public
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1801 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
x02lucpo committed Jun 3, 2005
1 parent 464c131 commit a103f3f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
10 changes: 10 additions & 0 deletions Compiler/Absyn.rml
Expand Up @@ -470,6 +470,7 @@ module Absyn:
relation last_classname: Program => Path
relation class_filename: Class => string
relation set_class_filename: (Class,string) => Class
relation is_package_restriction: Restriction => bool
end


Expand Down Expand Up @@ -875,3 +876,12 @@ relation cref_equal: (ComponentRef, ComponentRef) => bool =

axiom cref_equal(_,_) => false
end
(** relation is_package_restriction
** checks if the provided parameter is a package or not
**)
relation is_package_restriction: Restriction => bool =

axiom is_package_restriction(R_PACKAGE) => true
axiom is_package_restriction(_) => false

end
12 changes: 6 additions & 6 deletions Compiler/Ceval.rml
Expand Up @@ -1047,13 +1047,13 @@ end
-------------------------------
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("clearCache"),[],_,_),st as Interactive.SYMBOLTABLE(p,fp,ic,iv,cf)) => (Values.BOOL(true),newst)

rule Dump.unparse_str(p) => str
rule Dump.unparse_str(p(* ,false *)) => str
-------------------
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("list"),[],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf)) => (Values.STRING(str),st)

rule Static.component_ref_to_path(cr) => path &
Interactive.get_pathed_class_in_program(path,p) => class &
Dump.unparse_str(Absyn.PROGRAM([class],Absyn.TOP)) => str
Dump.unparse_str(Absyn.PROGRAM([class],Absyn.TOP)(* ,false *)) => str
-------------------
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("list"),[Exp.CREF(cr,_)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf)) => (Values.STRING(str),st)

Expand Down Expand Up @@ -1345,15 +1345,15 @@ end

rule Static.component_ref_to_path(cr) => classpath &
Interactive.get_pathed_class_in_program(classpath,p) => class &
Dump.unparse_str(Absyn.PROGRAM([class],Absyn.TOP)) => str &
Dump.unparse_str(Absyn.PROGRAM([class],Absyn.TOP)(* ,true *)) => str &
System.write_file(filename,str)
--------------------------
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("saveModel"),[Exp.SCONST(filename),Exp.CREF(cr,_)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf))
=> (Values.BOOL(true),st)

rule Static.component_ref_to_path(cr) => classpath &
Interactive.get_contained_class_and_file(classpath,p) => (p',filename) &
Dump.unparse_str(p') => str &
Dump.unparse_str(p'(* ,true *)) => str &
System.write_file(filename,str)
--------------------------
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("save"),[Exp.CREF(cr,_)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf))
Expand All @@ -1362,7 +1362,7 @@ end
axiom ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("save"),[Exp.CREF(cr,_)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf))
=> (Values.BOOL(false),st)

rule Dump.unparse_str(p) => str &
rule Dump.unparse_str(p(* ,true *)) => str &
System.write_file(filename,str)
--------------------------
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("saveAll"),[Exp.SCONST(filename)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf))
Expand All @@ -1371,7 +1371,7 @@ end
rule (*Error writing to file *)
Static.component_ref_to_path(cr) => classpath &
Interactive.get_pathed_class_in_program(classpath,p) => class &
Dump.unparse_str(Absyn.PROGRAM([class],Absyn.TOP)) => str &
Dump.unparse_str(Absyn.PROGRAM([class],Absyn.TOP)(* ,true *)) => str &
Print.print_error_buf "Error writing to file.\n"
--------------------------
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("saveModel"),[Exp.SCONST(name),Exp.CREF(cr,_)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf))
Expand Down
7 changes: 7 additions & 0 deletions Compiler/Interactive.rml
Expand Up @@ -182,6 +182,13 @@ module Interactive:
relation get_component_modification: Absyn.Element => string

relation add_to_public: (Absyn.Class, Absyn.ElementItem) => Absyn.Class
relation traverse_classes: (Absyn.Program,
((Absyn.Class * 'a) => (Absyn.Class * 'a)), (* rel-ation to apply*)
'a, (* extra value passed to re-lation*)
bool) (* true = traverse protected elements*)
=> (Absyn.Program* 'a)

relation is_package: (Absyn.ComponentRef, Absyn.Program) => bool
end


Expand Down
3 changes: 1 addition & 2 deletions Compiler/SCode.rml
Expand Up @@ -273,7 +273,6 @@ with "Dump.rml"
with "Debug.rml"
with "Print.rml"
with "Util.rml"

(** relation: elaborate
**
** This relation takes an `Absyn.Program' and constructs a `Program'
Expand All @@ -298,7 +297,7 @@ end

relation elab_class: Absyn.Class => Class =

rule elab_classdef d => d' &
rule elab_classdef d => d' &
elab_restriction(c,r) => r'
---------------------
elab_class(c as Absyn.CLASS(n,p,f,e,r,d,file)) => CLASS(n,p,e,r',d')
Expand Down

0 comments on commit a103f3f

Please sign in to comment.