let status = ref (new MatitaEngine.status "cic:/matita");;
let history = ref [!status];;
-let include_paths = ["/home/barolo/matitaB/matita/lib"];;
+let include_paths = ref [];;
(* <metasenv>
* <meta number="...">
Http_daemon.respond ~headers:["Content-Type", contenttype] ~code:(`Code 200) ~body:s outchan
;;
-let call_service outchan =
- try
- (ignore(MatitaEngine.assert_ng
- ~include_paths:["/home/barolo/matitaB/matita/lib"] (* ~outch:outchan *)
- "/home/barolo/matitaB/matita/lib/basics/pts.ma");
- prerr_endline "fatto";
- let s = read_file "/home/barolo/matitaB/matita/lib/basics/pts.ma.mad"
- in
- Http_daemon.respond ~headers:["Content-Type", "text/html"] ~code:(`Code 200) ~body:s outchan
- )
- with
- e -> Http_daemon.respond ~code:(`Code 500) outchan
-;;
-
let retrieve (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
cgi # set_header
(read_file filename) in
prerr_endline ("sending:\nBEGIN\n" ^ body ^ "\nEND");
let body = "<file>" ^ body ^ "</file>" in
- let _,baseuri,_,_ =
- Librarian.baseuri_of_script ~include_paths:[] filename
- in
+ let baseuri, incpaths =
+ try
+ let root, baseuri, _fname, _tgt =
+ Librarian.baseuri_of_script ~include_paths:[] filename in
+ let includes =
+ try
+ Str.split (Str.regexp " ")
+ (List.assoc "include_paths" (Librarian.load_root_file (root^"/root")))
+ with Not_found -> []
+ in
+ let rc = root :: includes in
+ List.iter (HLog.debug) rc; baseuri, rc
+ with
+ Librarian.NoRootFor _ | Librarian.FileNotFound _ -> "",[] in
+ include_paths := incpaths;
status := (!status)#set_baseuri baseuri;
cgi#out_channel#output_string body;
cgi#out_channel#commit_work()
let advance0 text =
let (st,new_statements,new_unparsed),(* newtext TODO *) _,parsed_len =
(* try *)
- eval_statement include_paths (*buffer*) !status (`Raw text)
+ eval_statement !include_paths (*buffer*) !status (`Raw text)
(* with End_of_file -> raise Margin *)
in
status := st;