4 module Stack = Continuationals.Stack
6 let rt_path () = Helm_registry.get "matita.rt_base_dir"
8 let libdir uid = (rt_path ()) ^ "/users/" ^ uid
10 let utf8_length = Netconversion.ustring_length `Enc_utf8
12 (*** from matitaScript.ml ***)
13 (* let only_dust_RE = Pcre.regexp "^(\\s|\n|%%[^\n]*\n)*$" *)
15 let eval_statement include_paths (* (buffer : GText.buffer) *) status (* script *)
18 let ast,unparsed_text =
21 (* if Pcre.pmatch ~rex:only_dust_RE text then raise Margin; *)
23 GrafiteParser.parsable_statement status
24 (Ulexing.from_utf8_string text) in
25 let ast = MatitaEngine.get_ast status include_paths strm in
27 | `Ast (st, text) -> st, text
29 let floc = match ast with
30 | GrafiteAst.Executable (loc, _)
31 | GrafiteAst.Comment (loc, _) -> loc in
33 let _,lend = HExtlib.loc_of_floc floc in
34 let parsed_text, _parsed_text_len =
35 HExtlib.utf8_parsed_text unparsed_text (HExtlib.floc_of_loc (0,lend)) in
36 let byte_parsed_text_len = String.length parsed_text in
38 String.sub unparsed_text byte_parsed_text_len
39 (String.length unparsed_text - byte_parsed_text_len)
43 MatitaEngine.eval_ast ~include_paths ~do_heavy_checks:false status ("",0,ast)
45 (status, parsed_text, unparsed_txt'),"",(*parsed_text_len*)
46 utf8_length parsed_text
48 (*let save_moo status =
49 let script = MatitaScript.current () in
50 let baseuri = status#baseuri in
51 match script#bos, script#eos with
54 GrafiteTypes.Serializer.serialize ~baseuri:(NUri.uri_of_string baseuri)
56 | _ -> clean_current_baseuri status
59 let sequent_size = ref 40;;
61 let include_paths = ref [];;
65 * <metaname>...</metaname>
72 let _,_,metasenv,subst,_ = s#obj in
73 let render_switch = function
74 | Stack.Open i -> "?" ^ (string_of_int i)
75 | Stack.Closed i -> "<S>?" ^ (string_of_int i) ^ "</S>"
77 let int_of_switch = function
78 | Stack.Open i | Stack.Closed i -> i
80 let sequent = function
82 let meta = List.assoc i metasenv in
83 snd (ApplyTransformation.ntxt_of_cic_sequent
84 ~metasenv ~subst ~map_unicode_to_tex:false !sequent_size s (i,meta))
85 | Stack.Closed _ -> "This goal has already been closed."
87 let render_sequent is_loc acc depth tag (pos,sw) =
88 let metano = int_of_switch sw in
91 (match depth, pos with
92 | 0, 0 -> "<span class=\"activegoal\">" ^ (render_switch sw) ^ "</span>"
94 Printf.sprintf "<span class=\"activegoal\">|<SUB>%d</SUB>: %s</span>" pos (render_switch sw)
95 | 1, pos when Stack.head_tag s#stack = `BranchTag ->
96 Printf.sprintf "<span class=\"passivegoal\">|<SUB>%d</SUB> : %s</span>" pos (render_switch sw)
97 | _ -> render_switch sw)
101 Netencoding.Html.encode ~in_enc:`Enc_utf8 ~prefer_name:false () markup in
102 let markup = "<metaname>" ^ markup ^ "</metaname>" in
104 Netencoding.Html.encode ~in_enc:`Enc_utf8 ~prefer_name:false () (sequent sw)
106 let txt0 = "<goal>" ^ sequent ^ "</goal>" in
107 "<meta number=\"" ^ (string_of_int metano) ^ "\">" ^ markup ^
108 txt0 ^ "</meta>" ^ acc
112 ~env:(render_sequent true) ~cont:(render_sequent false)
113 ~todo:(render_sequent false) "" s#stack) ^
115 (* prerr_endline ("sending metasenv:\n" ^ res); res *)
118 let html_of_matita s =
119 let patt1 = Str.regexp "\005" in
120 let patt2 = Str.regexp "\006" in
121 let patt3 = Str.regexp "<" in
122 let patt4 = Str.regexp ">" in
123 let res = Str.global_replace patt4 ">" s in
124 let res = Str.global_replace patt3 "<" res in
125 let res = Str.global_replace patt2 ">" res in
126 let res = Str.global_replace patt1 "<" res in
130 let heading_nl_RE = Pcre.regexp "^\\s*\n\\s*";;
133 let s = Pcre.replace ~rex:heading_nl_RE s in
135 let nl_pos = String.index s '\n' in
136 String.sub s 0 nl_pos
140 let read_file fname =
141 let chan = open_in fname in
142 let lines = ref [] in
145 lines := input_line chan :: !lines
147 with End_of_file -> close_in chan);
148 String.concat "\n" (List.rev !lines)
151 let load_index outchan =
152 let s = read_file "index.html" in
153 Http_daemon.respond ~headers:["Content-Type", "text/html"] ~code:(`Code 200) ~body:s outchan
156 let load_doc filename outchan =
157 let s = read_file filename in
159 try String.sub filename (String.length filename - 4) 4 = ".png"
160 with Invalid_argument _ -> false
162 let contenttype = if is_png then "image/png" else "text/html" in
163 Http_daemon.respond ~headers:["Content-Type", contenttype] ~code:(`Code 200) ~body:s outchan
166 let retrieve (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
167 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
168 let env = cgi#environment in
170 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
171 let sid = HExtlib.unopt sid in
172 let uid = MatitaAuthentication.user_of_session sid in
176 ~content_type:"text/xml; charset=\"utf-8\""
179 let filename = libdir uid ^ "/" ^ (cgi # argument_value "file") in
180 (* prerr_endline ("reading file " ^ filename); *)
182 Netencoding.Html.encode ~in_enc:`Enc_utf8 ~prefer_name:false ()
183 (html_of_matita (read_file filename)) in
185 (* html_of_matita (read_file filename) in *)
186 (* prerr_endline ("sending:\nBEGIN\n" ^ body ^ "\nEND"); *)
187 let body = "<response><file>" ^ body ^ "</file></response>" in
188 let baseuri, incpaths =
190 let root, baseuri, _fname, _tgt =
191 Librarian.baseuri_of_script ~include_paths:[] filename in
194 Str.split (Str.regexp " ")
195 (List.assoc "include_paths" (Librarian.load_root_file (root^"/root")))
198 let rc = root :: includes in
199 List.iter (HLog.debug) rc; baseuri, rc
201 Librarian.NoRootFor _ | Librarian.FileNotFound _ -> "",[] in
202 include_paths := incpaths;
203 let status = (MatitaAuthentication.get_status sid)#set_baseuri baseuri in
204 let history = [status] in
205 MatitaAuthentication.set_status sid status;
206 MatitaAuthentication.set_history sid history;
209 ~content_type:"text/xml; charset=\"utf-8\""
211 cgi#out_channel#output_string body;
215 ~status:`Internal_server_error
217 ~content_type:"text/html; charset=\"utf-8\""
219 cgi#out_channel#commit_work()
222 let advance0 sid text =
223 let status = MatitaAuthentication.get_status sid in
224 let status = status#reset_disambiguate_db () in
225 let (st,new_statements,new_unparsed),(* newtext TODO *) _,parsed_len =
227 eval_statement !include_paths (*buffer*) status (`Raw text)
229 | HExtlib.Localized (_,e) -> raise e
230 (*| End_of_file -> raise Margin *)
232 let stringbuf = Ulexing.from_utf8_string new_statements in
233 let interpr = GrafiteDisambiguate.get_interpr st#disambiguate_db in
234 let outstr = ref "" in
235 ignore (SmallLexer.mk_small_printer interpr outstr stringbuf);
236 prerr_endline ("baseuri after advance = " ^ st#baseuri);
237 (* prerr_endline ("parser output: " ^ !outstr); *)
238 MatitaAuthentication.set_status sid st;
240 Netencoding.Html.encode ~in_enc:`Enc_utf8 ~prefer_name:false
241 () (html_of_matita !outstr), new_unparsed, st
243 let register (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
244 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
245 let env = cgi#environment in
247 assert (cgi#arguments <> []);
248 let uid = cgi#argument_value "userid" in
249 let userpw = cgi#argument_value "password" in
251 MatitaAuthentication.add_user uid userpw;
252 (* env#set_output_header_field "Location" "/index.html" *)
253 cgi#out_channel#output_string
254 ("<html><head><meta http-equiv=\"refresh\" content=\"2;url=/login.html\">"
255 ^ "</head><body>Redirecting to login page...</body></html>")
257 | MatitaAuthentication.UsernameCollision _ ->
260 ~content_type:"text/html; charset=\"utf-8\""
262 cgi#out_channel#output_string
263 "<html><head></head><body>Error: User id collision!</body></html>"
264 | MatitaFilesystem.SvnError msg ->
267 ~content_type:"text/html; charset=\"utf-8\""
269 cgi#out_channel#output_string
270 ("<html><head></head><body><p>Error: Svn checkout failed!<p><p><textarea>"
271 ^ msg ^ "</textarea></p></body></html>"));
272 cgi#out_channel#commit_work()
275 let login (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
276 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
277 let env = cgi#environment in
279 assert (cgi#arguments <> []);
280 let uid = cgi#argument_value "userid" in
281 let userpw = cgi#argument_value "password" in
282 let pw,_ = MatitaAuthentication.lookup_user uid in
286 let ft = MatitaAuthentication.read_ft uid in
287 let _ = MatitaFilesystem.html_of_library uid ft in
288 let sid = MatitaAuthentication.create_session uid in
289 (* let cookie = Netcgi.Cookie.make "session" (Uuidm.to_string sid) in
290 cgi#set_header ~set_cookies:[cookie] (); *)
291 env#set_output_header_field
292 "Set-Cookie" ("session=" ^ (Uuidm.to_string sid));
293 (* env#set_output_header_field "Location" "/index.html" *)
294 cgi#out_channel#output_string
295 ("<html><head><meta http-equiv=\"refresh\" content=\"2;url=/index.html\">"
296 ^ "</head><body>Redirecting to Matita page...</body></html>")
302 ~content_type:"text/html; charset=\"utf-8\""
304 cgi#out_channel#output_string
305 "<html><head></head><body>Authentication error</body></html>"
308 cgi#out_channel#commit_work()
312 let logout (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
313 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
314 let env = cgi#environment in
316 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
317 let sid = HExtlib.unopt sid in
318 MatitaAuthentication.logout_user sid;
321 ~content_type:"text/html; charset=\"utf-8\""
323 let text = read_file (rt_path () ^ "/logout.html") in
324 cgi#out_channel#output_string text
328 ~status:`Internal_server_error
330 ~content_type:"text/html; charset=\"utf-8\""
332 cgi#out_channel#commit_work()
335 exception File_already_exists;;
337 let save (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
338 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
339 let env = cgi#environment in
341 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
342 let sid = HExtlib.unopt sid in
343 let status = MatitaAuthentication.get_status sid in
344 let uid = MatitaAuthentication.user_of_session sid in
345 assert (cgi#arguments <> []);
346 let locked = cgi#argument_value "locked" in
347 let unlocked = cgi#argument_value "unlocked" in
348 let dir = cgi#argument_value "dir" in
349 let rel_filename = cgi # argument_value "file" in
350 let filename = libdir uid ^ "/" ^ rel_filename in
351 let force = bool_of_string (cgi#argument_value "force") in
353 if ((not force) && (Sys.file_exists filename)) then
354 raise File_already_exists;
357 Unix.mkdir filename 0o744
360 let oc = open_out filename in
361 output_string oc (locked ^ unlocked);
363 if MatitaEngine.eos status unlocked then
365 (* prerr_endline ("serializing proof objects..."); *)
366 GrafiteTypes.Serializer.serialize
367 ~baseuri:(NUri.uri_of_string status#baseuri) status;
368 (* prerr_endline ("adding to the commit queue..."); *)
369 MatitaFilesystem.add_user uid;
370 (* prerr_endline ("done."); *)
373 MatitaAuthentication.set_file_flag uid
374 [rel_filename, Some MatitaFilesystem.MModified];
377 ~content_type:"text/xml; charset=\"utf-8\""
379 cgi#out_channel#output_string "<response>ok</response>"
381 | File_already_exists ->
382 cgi#out_channel#output_string "<response>cancelled</response>"
385 ~status:`Internal_server_error
387 ~content_type:"text/xml; charset=\"utf-8\""
390 let estr = Printexc.to_string e in
391 cgi#out_channel#output_string ("<response>" ^ estr ^ "</response>"));
392 cgi#out_channel#commit_work()
395 let initiate_commit (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
396 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
397 let env = cgi#environment in
399 let errors,out = MatitaFilesystem.do_global_commit () in
402 ~content_type:"text/xml; charset=\"utf-8\""
404 cgi#out_channel#output_string "<commit>";
405 cgi#out_channel#output_string "<response>ok</response>";
406 cgi#out_channel#output_string "<details>" ^ out ^ "</details>";
407 cgi#out_channel#output_string "</commit>"
411 ~status:`Internal_server_error
413 ~content_type:"text/xml; charset=\"utf-8\""
415 cgi#out_channel#commit_work()
418 let svn_update (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
419 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
420 let env = cgi#environment in
421 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
422 let sid = HExtlib.unopt sid in
423 let uid = MatitaAuthentication.user_of_session sid in
425 let files,anomalies,(added,conflict,del,upd,merged) =
426 MatitaFilesystem.update_user uid
428 let anomalies = String.concat "\n" anomalies in
429 let details = Printf.sprintf
431 "%d deleted files\n"^^
432 "%d updated files\n"^^
433 "%d merged files\n"^^
434 "%d conflicting files\n\n" ^^
435 "Anomalies:\n%s") added del upd merged conflict anomalies
437 prerr_endline ("update details:\n" ^ details);
439 Netencoding.Html.encode ~in_enc:`Enc_utf8 ~prefer_name:false () details
441 MatitaAuthentication.set_file_flag uid files;
444 ~content_type:"text/xml; charset=\"utf-8\""
446 cgi#out_channel#output_string "<update>";
447 cgi#out_channel#output_string "<response>ok</response>";
448 cgi#out_channel#output_string ("<details>" ^ details ^ "</details>");
449 cgi#out_channel#output_string "</update>";
453 ~status:`Internal_server_error
455 ~content_type:"text/xml; charset=\"utf-8\""
457 cgi#out_channel#commit_work()
460 (* returns the length of the executed text and an html representation of the
462 let advance (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
463 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
464 let env = cgi#environment in
466 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
467 let sid = HExtlib.unopt sid in
471 ~content_type:"text/xml; charset=\"utf-8\""
474 let text = cgi#argument_value "body" in
475 (* prerr_endline ("body =\n" ^ text); *)
476 let history = MatitaAuthentication.get_history sid in
477 let parsed_len, new_parsed, new_unparsed, new_status = advance0 sid text in
478 MatitaAuthentication.set_history sid (new_status::history);
479 let txt = output_status new_status in
481 "<response><parsed length=\"" ^ (string_of_int parsed_len) ^ "\">" ^
482 new_parsed ^ "</parsed>" ^ txt
485 (* prerr_endline ("sending advance response:\n" ^ body); *)
488 ~content_type:"text/xml; charset=\"utf-8\""
490 cgi#out_channel#output_string body
494 ~status:`Internal_server_error
496 ~content_type:"text/xml; charset=\"utf-8\""
498 cgi#out_channel#commit_work()
501 let gotoBottom (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
502 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
503 let env = cgi#environment in
505 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
506 let sid = HExtlib.unopt sid in
507 let history = MatitaAuthentication.get_history sid in
509 let rec aux parsed_len parsed_txt text =
511 prerr_endline ("evaluating: " ^ first_line text);
512 let plen,new_parsed,new_unparsed,_new_status = advance0 sid text in
513 aux (parsed_len+plen) (parsed_txt ^ new_parsed) new_unparsed
516 let status = MatitaAuthentication.get_status sid in
517 GrafiteTypes.Serializer.serialize
518 ~baseuri:(NUri.uri_of_string status#baseuri) status;
519 if parsed_len > 0 then
520 MatitaAuthentication.set_history sid (status::history);
521 parsed_len, parsed_txt
522 | _ -> parsed_len, parsed_txt
527 ~content_type:"text/xml; charset=\"utf-8\""
530 let text = cgi#argument_value "body" in
531 (* prerr_endline ("body =\n" ^ text); *)
532 let parsed_len, new_parsed = aux 0 "" text in
533 let status = MatitaAuthentication.get_status sid in
534 let txt = output_status status in
536 "<response><parsed length=\"" ^ (string_of_int parsed_len) ^ "\">" ^
537 new_parsed ^ "</parsed>" ^ txt
541 "<response><parsed length=\"" ^ (string_of_int parsed_len) ^ "\" />" ^ txt
544 (* prerr_endline ("sending goto bottom response:\n" ^ body); *)
547 ~content_type:"text/xml; charset=\"utf-8\""
549 cgi#out_channel#output_string body
550 with Not_found -> cgi#set_header ~status:`Internal_server_error
552 ~content_type:"text/xml; charset=\"utf-8\"" ());
553 cgi#out_channel#commit_work()
556 let gotoTop (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
557 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
558 let env = cgi#environment in
559 prerr_endline "executing goto Top";
561 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
562 let sid = HExtlib.unopt sid in
566 ~content_type:"text/xml; charset=\"utf-8\""
569 let status = MatitaAuthentication.get_status sid in
570 let uid = MatitaAuthentication.user_of_session sid in
571 let baseuri = status#baseuri in
572 let new_status = new MatitaEngine.status (Some uid) baseuri in
573 prerr_endline "gototop prima della time travel";
574 NCicLibrary.time_travel new_status;
575 prerr_endline "gototop dopo della time travel";
576 let new_history = [new_status] in
577 MatitaAuthentication.set_history sid new_history;
578 MatitaAuthentication.set_status sid new_status;
579 NCicLibrary.time_travel new_status;
582 ~content_type:"text/xml; charset=\"utf-8\""
584 cgi#out_channel#output_string "<response>ok</response>"
586 (cgi#set_header ~status:`Internal_server_error
588 ~content_type:"text/xml; charset=\"utf-8\"" ();
589 cgi#out_channel#output_string "<response>ok</response>"));
590 cgi#out_channel#commit_work()
593 let retract (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
594 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
595 let env = cgi#environment in
597 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
598 let sid = HExtlib.unopt sid in
602 ~content_type:"text/xml; charset=\"utf-8\""
605 let history = MatitaAuthentication.get_history sid in
606 let new_history,new_status =
608 _::(status::_ as history) ->
610 | [_] -> (prerr_endline "singleton";failwith "retract")
611 | _ -> (prerr_endline "nil"; assert false) in
612 prerr_endline ("prima della time travel");
613 NCicLibrary.time_travel new_status;
614 prerr_endline ("dopo della time travel");
615 MatitaAuthentication.set_history sid new_history;
616 MatitaAuthentication.set_status sid new_status;
617 prerr_endline ("baseuri after retract = " ^ new_status#baseuri);
618 let body = output_status new_status in
621 ~content_type:"text/xml; charset=\"utf-8\""
623 cgi#out_channel#output_string body
624 with _ -> cgi#set_header ~status:`Internal_server_error
626 ~content_type:"text/xml; charset=\"utf-8\"" ());
627 cgi#out_channel#commit_work()
631 let viewLib (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
632 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
633 let env = cgi#environment in
635 let sid = Uuidm.of_string (Netcgi.Cookie.value (env#cookie "session")) in
636 let sid = HExtlib.unopt sid in
640 ~content_type:"text/html; charset=\"utf-8\""
643 let uid = MatitaAuthentication.user_of_session sid in
645 let ft = MatitaAuthentication.read_ft uid in
646 let html = MatitaFilesystem.html_of_library uid ft in
649 ~content_type:"text/html; charset=\"utf-8\""
651 cgi#out_channel#output_string
654 "<title>XML Tree Control</title>\n" ^
655 "<link href=\"treeview/xmlTree.css\" type=\"text/css\" rel=\"stylesheet\">\n" ^
656 "<script src=\"treeview/xmlTree.js\" type=\"text/javascript\"></script>\n" ^
658 html (* ^ "\n</body></html>" *) );
660 let files,anomalies = MatitaFilesystem.stat_user uid in
661 let changed = HExtlib.filter_map
662 (fun (n,fl) -> if (List.mem MatitaFilesystem.Modified fl) then Some n else None) files
664 let changed = String.concat "\n" changed in
665 let anomalies = String.concat "\n" anomalies in
666 prerr_endline ("Changed:\n" ^ changed ^ "\n\nAnomalies:\n" ^ anomalies);
667 cgi#out_channel#commit_work()
671 let resetLib (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
672 let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
673 MatitaAuthentication.reset ();
676 ~content_type:"text/html; charset=\"utf-8\""
679 cgi#out_channel#output_string
681 "<title>Matitaweb Reset</title>\n" ^
682 "<body><H1>Reset completed</H1></body></html>");
683 cgi#out_channel#commit_work()
685 open Netcgi1_compat.Netcgi_types;;
687 (**********************************************************************)
688 (* Create the webserver *)
689 (**********************************************************************)
693 let (opt_list, cmdline_cfg) = Netplex_main.args() in
695 let use_mt = ref true in
698 [ "-mt", Arg.Set use_mt,
699 " Use multi-threading instead of multi-processing"
704 (fun s -> raise (Arg.Bad ("Don't know what to do with: " ^ s)))
705 "usage: netplex [options]";
708 Netplex_mt.mt() (* multi-threading *)
710 Netplex_mp.mp() in (* multi-processing *)
713 { Nethttpd_services.dyn_handler = (fun _ -> process1);
714 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
715 dyn_uri = None; (* not needed *)
716 dyn_translator = (fun _ -> ""); (* not needed *)
717 dyn_accept_all_conditionals = false;
721 { Nethttpd_services.dyn_handler = (fun _ -> advance);
722 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
723 dyn_uri = None; (* not needed *)
724 dyn_translator = (fun _ -> ""); (* not needed *)
725 dyn_accept_all_conditionals = false;
728 { Nethttpd_services.dyn_handler = (fun _ -> retract);
729 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
730 dyn_uri = None; (* not needed *)
731 dyn_translator = (fun _ -> ""); (* not needed *)
732 dyn_accept_all_conditionals = false;
735 { Nethttpd_services.dyn_handler = (fun _ -> gotoBottom);
736 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
737 dyn_uri = None; (* not needed *)
738 dyn_translator = (fun _ -> ""); (* not needed *)
739 dyn_accept_all_conditionals = false;
742 { Nethttpd_services.dyn_handler = (fun _ -> gotoTop);
743 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
744 dyn_uri = None; (* not needed *)
745 dyn_translator = (fun _ -> ""); (* not needed *)
746 dyn_accept_all_conditionals = false;
749 { Nethttpd_services.dyn_handler = (fun _ -> retrieve);
750 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
751 dyn_uri = None; (* not needed *)
752 dyn_translator = (fun _ -> ""); (* not needed *)
753 dyn_accept_all_conditionals = false;
756 { Nethttpd_services.dyn_handler = (fun _ -> register);
757 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
758 dyn_uri = None; (* not needed *)
759 dyn_translator = (fun _ -> ""); (* not needed *)
760 dyn_accept_all_conditionals = false;
763 { Nethttpd_services.dyn_handler = (fun _ -> login);
764 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
765 dyn_uri = None; (* not needed *)
766 dyn_translator = (fun _ -> ""); (* not needed *)
767 dyn_accept_all_conditionals = false;
770 { Nethttpd_services.dyn_handler = (fun _ -> logout);
771 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
772 dyn_uri = None; (* not needed *)
773 dyn_translator = (fun _ -> ""); (* not needed *)
774 dyn_accept_all_conditionals = false;
777 { Nethttpd_services.dyn_handler = (fun _ -> viewLib);
778 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
779 dyn_uri = None; (* not needed *)
780 dyn_translator = (fun _ -> ""); (* not needed *)
781 dyn_accept_all_conditionals = false;
784 { Nethttpd_services.dyn_handler = (fun _ -> resetLib);
785 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
786 dyn_uri = None; (* not needed *)
787 dyn_translator = (fun _ -> ""); (* not needed *)
788 dyn_accept_all_conditionals = false;
791 { Nethttpd_services.dyn_handler = (fun _ -> save);
792 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
793 dyn_uri = None; (* not needed *)
794 dyn_translator = (fun _ -> ""); (* not needed *)
795 dyn_accept_all_conditionals = false;
798 { Nethttpd_services.dyn_handler = (fun _ -> initiate_commit);
799 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
800 dyn_uri = None; (* not needed *)
801 dyn_translator = (fun _ -> ""); (* not needed *)
802 dyn_accept_all_conditionals = false;
805 { Nethttpd_services.dyn_handler = (fun _ -> svn_update);
806 dyn_activation = Nethttpd_services.std_activation `Std_activation_buffered;
807 dyn_uri = None; (* not needed *)
808 dyn_translator = (fun _ -> ""); (* not needed *)
809 dyn_accept_all_conditionals = false;
813 let nethttpd_factory =
814 Nethttpd_plex.nethttpd_factory
815 ~handlers:[ "advance", do_advance
816 ; "retract", do_retract
817 ; "bottom", goto_bottom
820 ; "register", do_register
822 ; "logout", do_logout
823 ; "reset", do_resetlib
824 ; "viewlib", do_viewlib
826 ; "commit", do_commit
827 ; "update", do_update]
829 MatitaInit.initialize_all ();
830 MatitaAuthentication.deserialize ();
833 Netplex_log.logger_factories (* allow all built-in logging styles *)
834 Netplex_workload.workload_manager_factories (* ... all ways of workload management *)
835 [ nethttpd_factory ] (* make this nethttpd available *)
839 Sys.set_signal Sys.sigpipe Sys.Signal_ignore;