why2doc: raw HTML pages, with no links yet

parent 777b37ac
......@@ -52,6 +52,8 @@ why.conf
/bin/whybench.opt
/bin/whytptp.byte
/bin/whytptp.opt
/bin/why3doc.byte
/bin/why3doc.opt
# /doc/
/doc/version.tex
......@@ -171,6 +173,10 @@ why.conf
/src/util/dynlink_compat.ml
/src/util/rc.ml
# /src/why3doc
/src/why3doc/*.cm*
/src/why3doc/*.annot
# /tests/
/tests/test-claude/
......
......@@ -635,6 +635,50 @@ clean::
install_no_local::
cp -f bin/why3-cpulimit $(BINDIR)
#########
# why3doc
#########
WHY3DOC_FILES = doc_html doc_main
WHY3DOCMODULES = $(addprefix src/why3doc/, $(WHY3DOC_FILES))
WHY3DOCML = $(addsuffix .ml, $(WHY3DOCMODULES))
WHY3DOCMLI = $(addsuffix .mli, $(WHY3DOCMODULES))
WHY3DOCCMO = $(addsuffix .cmo, $(WHY3DOCMODULES))
WHY3DOCCMX = $(addsuffix .cmx, $(WHY3DOCMODULES))
$(WHY3DOCCMO) $(WHY3DOCCMX): INCLUDES += -I src/why3doc
# build targets
byte: bin/why3doc.byte
opt: bin/why3doc.opt
bin/why3doc.opt: src/why.cmxa $(WHY3DOCCMX)
$(if $(QUIET), @echo 'Linking $@' &&) \
$(OCAMLOPT) $(OFLAGS) -o $@ $(EXTCMXA) $^
$(STRIP) $@
bin/why3doc.byte: src/why.cma $(WHY3DOCCMO)
$(if $(QUIET),@echo 'Linking $@' &&) \
$(OCAMLC) $(BFLAGS) -o $@ $(EXTCMA) $^
# depend and clean targets
include .depend.why3doc
.depend.why3doc:
$(OCAMLDEP) -slash -I src -I src/why3doc $(WHY3DOCML) $(WHY3DOCMLI) > $@
depend: .depend.why3doc
clean::
rm -f src/why3doc/*.cm[iox] src/why3doc/*.o
rm -f src/why3doc/*.annot src/why3doc/*~
rm -f bin/why3doc.byte bin/why3doc.opt
rm -f .depend.why3doc
########
# bench
########
......
This diff is collapsed.
open Format
open Why
open Theory
val print_theory : formatter -> theory -> unit
val print_header : formatter -> ?title:string -> ?css:string -> unit -> unit
val print_footer : formatter -> unit -> unit
val style_css : string -> unit
(* write a default CSS in the given file *)
open Format
open Why
open Theory
(* command line parsing *)
let usage_msg = sprintf
"Usage: %s [-L directory] [file...]"
(Filename.basename Sys.argv.(0))
let opt_loadpath = ref []
let opt_output = ref None
let opt_queue = Queue.create ()
let option_list = Arg.align [
"-L", Arg.String (fun s -> opt_loadpath := s :: !opt_loadpath),
"<dir> Add <dir> to the library search path";
"-o", Arg.String (fun s -> opt_output := Some s),
"<dir> Print files in <dir>";
"--output", Arg.String (fun s -> opt_output := Some s),
" same as -o";
]
let add_opt_file x = Queue.add x opt_queue
let () =
Arg.parse option_list add_opt_file usage_msg;
let config = Whyconf.read_config None in
let main = Whyconf.get_main config in
opt_loadpath := List.rev_append !opt_loadpath (Whyconf.loadpath main)
let css =
let css_fname = match !opt_output with
| None -> "style.css"
| Some dir -> Filename.concat dir "style.css"
in
if not (Sys.file_exists css_fname) then Doc_html.style_css css_fname;
css_fname
let do_file env fname =
let m = Env.read_file env fname in
let base =
let f = Filename.basename fname in
let f = try Filename.chop_extension f with _ -> f in
match !opt_output with
| None -> f
| Some dir -> Filename.concat dir f
in
let print_theory s th =
let fhtml = base ^ "." ^ s ^ ".html" in
let c = open_out fhtml in
let fmt = formatter_of_out_channel c in
Doc_html.print_header fmt ~title:s ~css ();
Doc_html.print_theory fmt th;
Doc_html.print_footer fmt ();
close_out c
in
Mnm.iter print_theory m
let () =
try
let env = Env.create_env (Lexer.retrieve !opt_loadpath) in
Queue.iter (do_file env) opt_queue
with e when not (Debug.test_flag Debug.stack_trace) ->
eprintf "%a@." Exn_printer.exn_printer e;
exit 1
(*
Local Variables:
compile-command: "unset LANG; make -C ../.. bin/why3doc.opt"
End:
*)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment