equal
deleted
inserted
replaced
78 (*avoid further pervasive infix names*) |
78 (*avoid further pervasive infix names*) |
79 |
79 |
80 val trace = Attrib.setup_config_bool @{binding "code_runtime_trace"} (K false); |
80 val trace = Attrib.setup_config_bool @{binding "code_runtime_trace"} (K false); |
81 |
81 |
82 fun exec ctxt verbose code = |
82 fun exec ctxt verbose code = |
83 (if Config.get ctxt trace then tracing code else (); |
83 (if Config.get ctxt trace then tracing code else (); |
84 ML_Context.exec (fn () => Secure.use_text ML_Env.local_context (0, "generated code") verbose code)); |
84 ML_Context.exec (fn () => |
|
85 Secure.use_text ML_Env.local_context |
|
86 {line = 0, file = "generated code", verbose = verbose, debug = false} code)); |
85 |
87 |
86 fun value ctxt (get, put, put_ml) (prelude, value) = |
88 fun value ctxt (get, put, put_ml) (prelude, value) = |
87 let |
89 let |
88 val code = (prelude |
90 val code = (prelude |
89 ^ "\nval _ = Context.set_thread_data (SOME (Context.map_proof (" ^ put_ml |
91 ^ "\nval _ = Context.set_thread_data (SOME (Context.map_proof (" ^ put_ml |
536 |
538 |
537 fun use_file filepath thy = |
539 fun use_file filepath thy = |
538 let |
540 let |
539 val thy' = Loaded_Values.put [] thy; |
541 val thy' = Loaded_Values.put [] thy; |
540 val _ = Context.set_thread_data ((SOME o Context.Theory) thy'); |
542 val _ = Context.set_thread_data ((SOME o Context.Theory) thy'); |
541 val _ = Secure.use_text notifying_context |
543 val _ = |
542 (0, Path.implode filepath) false (File.read filepath); |
544 Secure.use_text notifying_context |
|
545 {line = 0, file = Path.implode filepath, verbose = false, debug = false} |
|
546 (File.read filepath); |
543 val thy'' = Context.the_theory (Context.the_thread_data ()); |
547 val thy'' = Context.the_theory (Context.the_thread_data ()); |
544 val names = Loaded_Values.get thy''; |
548 val names = Loaded_Values.get thy''; |
545 in (names, thy'') end; |
549 in (names, thy'') end; |
546 |
550 |
547 end; |
551 end; |