23 val ObjFormalComment : PgipTypes.objtype |
23 val ObjFormalComment : PgipTypes.objtype |
24 val ObjClass : PgipTypes.objtype |
24 val ObjClass : PgipTypes.objtype |
25 val ObjTheoremSet : PgipTypes.objtype |
25 val ObjTheoremSet : PgipTypes.objtype |
26 val ObjOracle : PgipTypes.objtype |
26 val ObjOracle : PgipTypes.objtype |
27 val ObjLocale : PgipTypes.objtype |
27 val ObjLocale : PgipTypes.objtype |
28 |
28 |
29 end |
29 end |
30 |
30 |
31 structure PgipIsabelle : PGIP_ISABELLE = |
31 structure PgipIsabelle : PGIP_ISABELLE = |
32 struct |
32 struct |
33 |
33 |
34 val isabelle_pgml_version_supported = "2.0"; |
34 val isabelle_pgml_version_supported = "2.0"; |
35 val isabelle_pgip_version_supported = "2.0" |
35 val isabelle_pgip_version_supported = "2.0" |
36 val systemid = "Isabelle" |
36 val systemid = "Isabelle" |
37 |
37 |
|
38 |
38 (** Accepted commands **) |
39 (** Accepted commands **) |
39 |
40 |
40 local |
41 local |
41 |
42 |
42 (* These element names are a subset of those in pgip_input.ML. |
43 (* These element names are a subset of those in pgip_input.ML. |
43 They must be handled in proof_general_pgip.ML/process_pgip_element. *) |
44 They must be handled in proof_general_pgip.ML/process_pgip_element. *) |
44 |
45 |
45 val accepted_names = |
46 val accepted_names = |
46 (* not implemented: "askconfig", "forget", "restoregoal" *) |
47 (* not implemented: "askconfig", "forget", "restoregoal" *) |
47 ["askpgip","askpgml","askprefs","getpref","setpref", |
48 ["askpgip","askpgml","askprefs","getpref","setpref", |
48 "proverinit","proverexit","startquiet","stopquiet", |
49 "proverinit","proverexit","startquiet","stopquiet", |
49 "pgmlsymbolson", "pgmlsymbolsoff", |
50 "pgmlsymbolson", "pgmlsymbolsoff", |
50 "dostep", "undostep", "redostep", "abortgoal", |
51 "dostep", "undostep", "redostep", "abortgoal", |
51 "askids", "showid", "askguise", |
52 "askids", "showid", "askguise", |
52 "parsescript", |
53 "parsescript", |
53 "showproofstate", "showctxt", "searchtheorems", "setlinewidth", "viewdoc", |
54 "showproofstate", "showctxt", "searchtheorems", "setlinewidth", "viewdoc", |
54 "doitem", "undoitem", "redoitem", "abortheory", |
55 "doitem", "undoitem", "redoitem", "abortheory", |
55 "retracttheory", "loadfile", "openfile", "closefile", |
56 "retracttheory", "loadfile", "openfile", "closefile", |
56 "abortfile", "retractfile", "changecwd", "systemcmd"]; |
57 "abortfile", "retractfile", "changecwd", "systemcmd"]; |
57 |
58 |
58 fun element_async p = |
59 fun element_async p = |
59 false (* single threaded only *) |
60 false (* single threaded only *) |
60 |
61 |
61 fun supported_optional_attrs p = (case p of |
62 fun supported_optional_attrs p = (case p of |
62 "undostep" => ["times"] |
63 "undostep" => ["times"] |
63 (* TODO: we could probably extend these too: |
64 (* TODO: we could probably extend these too: |
64 | "redostep" => ["times"] |
65 | "redostep" => ["times"] |
65 | "undoitem" => ["times"] |
66 | "undoitem" => ["times"] |
66 | "redoitem" => ["times"] *) |
67 | "redoitem" => ["times"] *) |
67 | _ => []) |
68 | _ => []) |
68 in |
69 in |
69 val accepted_inputs = |
70 val accepted_inputs = |
70 (map (fn p=> (p, element_async p, supported_optional_attrs p)) |
71 (map (fn p=> (p, element_async p, supported_optional_attrs p)) |
71 accepted_names); |
72 accepted_names); |
72 end |
73 end |
73 |
74 |
74 |
75 |
75 fun location_of_position pos = |
76 fun location_of_position pos = |
76 let val line = Position.line_of pos |
77 let val line = Position.line_of pos |
77 val (url,descr) = |
78 val (url,descr) = |
78 (case Position.file_of pos of |
79 (case Position.file_of pos of |
79 NONE => (NONE, NONE) |
80 NONE => (NONE, NONE) |
80 | SOME fname => |
81 | SOME fname => |
81 let val path = Path.explode fname in |
82 let val path = Path.explode fname in |
82 case ThyLoad.check_file NONE path of |
83 case ThyLoad.check_file NONE path of |
83 SOME _ => (SOME (PgipTypes.pgipurl_of_path path), NONE) |
84 SOME _ => (SOME (PgipTypes.pgipurl_of_path path), NONE) |
84 | NONE => (NONE, SOME fname) |
85 | NONE => (NONE, SOME fname) |
85 end); |
86 end); |
86 in |
87 in |
87 { descr=descr, url=url, line=line, column=NONE, char=NONE, length=NONE } |
88 { descr=descr, url=url, line=line, column=NONE, char=NONE, length=NONE } |
88 end |
89 end |
89 |
90 |
90 |
91 |
91 val [ObjTheoryBody, |
92 val [ObjTheoryBody, |
92 ObjTheoryDecl, |
93 ObjTheoryDecl, |