Skip to content

Commit

Permalink
Debug traces
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1058 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
levsa committed Dec 17, 2003
1 parent 79e9472 commit 8d69922
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
14 changes: 12 additions & 2 deletions modeq/inst.rml
Expand Up @@ -1129,6 +1129,12 @@ relation add_components_to_env2 : (Env, Mod, Prefix, Connect.Sets, ClassInf.Stat
attr as SCode.ATTR(ad,flow,acc,param,dir),
t,m),cmod))::xs,inst_dims,impl) => env''

(* rule add_components_to_env2(env,mods,pre,csets,ci_state,
xs,inst_dims,impl) => env'
-----------------
add_components_to_env2(env,mods,pre,csets,ci_state,
nocomp::xs,inst_dims,impl) => env' *)


axiom add_components_to_env2(env,_,_,_,_,[],_,_) => env

Expand Down Expand Up @@ -2624,7 +2630,11 @@ rule (*Prefix.prefix_add(n,[],pre) => pre' &*)
parts as SCode.PARTS(els,_,_,_,_,_)),
inst_dims, false)
=> (env', [DAE.EXTFUNCTION(fpath,DAE.DAE(dae), ty, extdecl)])


rule Debug.fprint("failtrace", "#-- implicit_function_instantiation failed\n")
------------------------------------------------------------------------
implicit_function_instantiation(_,_,_,_,_,_,_) => fail

end

(** relation: inst_overloaded_functions
Expand Down Expand Up @@ -4788,4 +4798,4 @@ relation print_compmods:((SCode.Element * Types.Mod) list) => () =
print_compmods(xs)
------------------
print_compmods((el,mod)::xs) => ()
end
end
34 changes: 30 additions & 4 deletions modeq/staticexp.rml
Expand Up @@ -1805,35 +1805,61 @@ end
relation generate_compiled_function: (Env.Env, Absyn.ComponentRef, Exp.Exp, Types.Properties, Interactive.InteractiveSymbolTable option) =>
(Interactive.InteractiveSymbolTable option) =

axiom generate_compiled_function(_,_,_,_,NONE) => NONE
(* axiom generate_compiled_function(_,_,_,_,NONE) => NONE *)

rule Absyn.cref_to_path(fn) => pfn &
rule Debug.fprintln("sei", "generate_compiled_function: start1") &
Absyn.cref_to_path(fn) => pfn &
is_function_in_cflist (cflist,pfn) => true
-----------------------------------------------
generate_compiled_function(env,fn,e,Types.PROP(t,_),SOME(st as Interactive.SYMBOLTABLE(p,_,_,_,cflist))) => SOME(st)

rule Absyn.cref_to_path(fn) => path &
rule Debug.fprintln("sei", "generate_compiled_function: start2") &
Absyn.cref_to_path(fn) => path &
is_function_in_cflist (cflist, path) => false &
SCode.elaborate(p) => p' &
Debug.fprintln("sei", "generate_compiled_function: elaborated") &
(* Inst.instantiate_implicit(p') => d & *)
Lookup.lookup_class(env, path, false) => (cls, env') &
Debug.fprintln("sei", "generate_compiled_function: class looked up") &
Inst.implicit_function_instantiation(env', Types.NOMOD,
Prefix.NOPRE, [], cls, [], false)
=> (env'',d) &
Debug.fprintln("sei", "generate_compiled_function: function instantiated") &
Print.clear_buf() &
ModUtil.string_prefix_params DAE.DAE(d) => d' &
Codegen.generate_functions(d') &
Debug.fprintln("sei", "generate_compiled_function: function generated") &
ModUtil.path_string2 (path,"_") => pathstr &
string_append(pathstr,".c") => filename &
Print.print_buf "#include \"modelica.h\"\n#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h>\n" &
Print.print_buf "\nint main(int argc, char** argv)\n{\n\n if (argc != 3)\n {\n fprintf(stderr,\"# Incorrrect number of arguments\\n\");\n return 1;\n }\n" &
Print.print_buf pathstr &
Print.print_buf "_read_call_write(argv[1],argv[2]);\n return 0;\n}\n" &
Print.write_buf(filename)& Print.clear_buf() &
System.compile_c_file(filename)
System.compile_c_file(filename) &
Debug.fprintln("sei", "generate_compiled_function: compiled")
-----------------------------------------------
generate_compiled_function(env,fn,e,Types.PROP(t,_),SOME(st as Interactive.SYMBOLTABLE(p,a,b,c,cflist))) => SOME(Interactive.SYMBOLTABLE(p,a,b,c,(path,t)::cflist))



rule Debug.fprintln("sei", "generate_compiled_function: start3")
-----------------------------------------------
generate_compiled_function(env,fn,e,Types.PROP(t,_),NONE) => NONE




rule Debug.fprint("failtrace", "- generate_compiled_function failed4\n") &
Dump.print_component_ref_str cr => str1 &
Exp.print_exp_str exp => str2 &
Print.print_buf str1 &
Print.print_buf " -- " &
Print.print_buf str2 &
Print.print_buf "\n"
------------------------------------------------------------------
generate_compiled_function(env,cr,exp,_,_) => fail

end


Expand Down

0 comments on commit 8d69922

Please sign in to comment.