1 (* Title: Tools/isac/BridgeJEdit/preliminary-OLD..sml
2 Author: Walther Neuper, JKU Linz
3 (c) due to copyright terms
5 Preliminary code for start transition Libisabelle -- PIDE.
6 Will be distributed to several structures, most of which do not yet exist.
9 signature PRELIMINARY_OLD =
11 (* for keyword ExampleSPARK *)
12 val store_and_show: theory -> Formalise.T list -> theory -> theory;
13 val load_formalisation: theory -> (Fdl_Lexer.T list -> ParseC_OLD.form_model_refs * 'a) ->
14 (theory -> Token.file * theory) * string -> theory -> theory
16 (* for keyword Problem*)
17 (**)val init_specify: ParseC_OLD.problem_headline -> theory -> theory(**)
18 (** )val init_specify: ParseC_OLD.problem -> theory -> theory( **)
21 (** code for keyword ExampleSPARK **)
23 structure Refs_Data = Theory_Data
26 val empty : T = References.empty
28 fun merge (_, refs) = refs
30 structure OMod_Data = Theory_Data
35 fun merge (_, o_model) = o_model
37 structure IMod_Data = Theory_Data
42 fun merge (_, i_model) = i_model
44 structure Ctxt_Data = Theory_Data
46 type T = Proof.context
47 val empty : T = ContextC.empty
49 fun merge (_, ctxt) = ctxt
53 structure Preliminary_OLD(**): PRELIMINARY_OLD(**) =
57 fun store_and_show HACKthy formalise thy =
59 (**)val _(*file_read_correct*) = case formalise of xxx as
60 [(["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y", "Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]", "FunktionsVariable x", "GleichungsVariablen [c, c_2, c_3, c_4]", "AbleitungBiegelinie dy"],
61 ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]))] => hd xxx
62 | _ => error "magic failed: handling file exp_Statics_Biegel_Timischl_7-70.str failed"
64 val formalise = hd formalise (*we expect only one Formalise.T in the list*)
65 val (_(*hdlPIDE*), _, refs, o_model, var_type_ctxt) = Step_Specify.initialisePIDEHACK HACKthy formalise
66 (* ^^ TODO remove with cleanup in nxt_specify_init_calc *)
68 TODO: present "Problem hdlPIDE" via PIDE
73 |> OMod_Data.put o_model
74 |> Ctxt_Data.put var_type_ctxt
78 fun load_formalisation parser (files, _) thy =
80 val ([{lines, pos, ...}: Token.file], thy') = files thy;
83 (ParseC_OLD.read_out_formalise (fst (parser (fst (ParseC_OLD.tokenize_formalise pos (cat_lines lines))))))
87 fun load_formalisation HACKthy parse (get_file: theory -> Token.file * theory, _: string) thy =
89 val (file, thy') = get_file thy;
90 val formalise = #lines file
92 |> ParseC_OLD.tokenize_formalise (#pos file)
96 |> ParseC_OLD.read_out_formalise
97 |> store_and_show HACKthy
98 (**)val _ = @{print} {a = "### load_formalisation \<rightarrow>", formalise = formalise}(**)
103 (*** code for keyword Problem ***)
106 val prefer_input: ThyC.id * Problem.id -> References.T -> O_Model.T -> References.T * O_Model.T
108 fun prefer_input (inthy, inpbl : Problem.id) (thy, pbl, met_id) o_model =
109 if inthy = thy andalso inpbl = pbl
110 then ((thy, pbl, met_id) : References.T, o_model)
111 else ((inthy, inpbl, MethodC.id_empty), [])
113 fun init_specify problem thy =
115 val _ = @{print} {a = "//--- Spark_Commands.init_specify", headline = problem}
116 val (thy_id, pbl_id) = ParseC_OLD.read_out_headline problem (*how handle Position?!?*)
117 val refs' = Refs_Data.get thy
118 val ((_, pbl_id, _), _(*o_model*)) =
119 prefer_input (thy_id, pbl_id) refs' (OMod_Data.get thy)
120 val i_model = I_Model.initPIDE pbl_id
121 (* TODO: present Specification = i_model + refs via PIDE, if specify is done explicitly. *)
123 IMod_Data.put i_model thy (* the Model-items with Descriptor s only *)