buildTimeConf.cmo
matitaclean.cmx: matitacleanLib.cmx matitaMisc.cmx matitaLog.cmx matitaDb.cmx \
buildTimeConf.cmx
-matitacleanLib.cmo: matitaSync.cmi matitaMisc.cmi matitaLog.cmi matitaDb.cmi \
- matitacleanLib.cmi
-matitacleanLib.cmx: matitaSync.cmx matitaMisc.cmx matitaLog.cmx matitaDb.cmx \
- matitacleanLib.cmi
+matitacleanLib.cmo: matitaSync.cmi matitaMisc.cmi matitaLog.cmi \
+ matitaExcPp.cmi matitaDb.cmi matitacleanLib.cmi
+matitacleanLib.cmx: matitaSync.cmx matitaMisc.cmx matitaLog.cmx \
+ matitaExcPp.cmx matitaDb.cmx matitacleanLib.cmi
matitadep.cmo: matitaMisc.cmi matitaLog.cmi matitaExcPp.cmi buildTimeConf.cmo
matitadep.cmx: matitaMisc.cmx matitaLog.cmx matitaExcPp.cmx buildTimeConf.cmx
matitamake.cmo: matitamakeLib.cmi buildTimeConf.cmo
matitaDb.cmo \
matitaSync.cmo \
matitaDisambiguator.cmo \
- matitaEngine.cmo \
matitacleanLib.cmo \
+ matitaEngine.cmo \
matitacLib.cmo
CLEANCMOS = $(CCMOS)
MAKECMOS = $(CCMOS) matitamakeLib.cmo
let debug = false ;;
let debug_print = if debug then prerr_endline else ignore ;;
-type options = { do_heavy_checks: bool ; include_paths: string list }
+type options = {
+ do_heavy_checks: bool ;
+ include_paths: string list ;
+ clean_baseuri: bool
+}
type statement =
(CicNotationPt.term, GrafiteAst.obj, string) GrafiteAst.statement
else
value
in
+ if not (MatitacleanLib.is_empty value) then
+ begin
+ MatitaLog.warn ("baseuri " ^ value ^ " is not empty");
+ if opts.clean_baseuri then
+ begin
+ MatitaLog.message ("cleaning baseuri " ^ value);
+ MatitacleanLib.clean_baseuris [value]
+ end
+ end;
set_option status name value
| GrafiteAst.Drop loc -> raise Drop
| GrafiteAst.Qed loc ->
let eval_comment status c = status
-let eval_ast ?(do_heavy_checks=false) ?(include_paths=[]) status st =
- let opts =
- {do_heavy_checks = do_heavy_checks ; include_paths = include_paths}
+let eval_ast
+ ?(do_heavy_checks=false) ?(include_paths=[]) ?(clean_baseuri=true) status st
+=
+ let opts = {
+ do_heavy_checks = do_heavy_checks ;
+ include_paths = include_paths;
+ clean_baseuri = clean_baseuri }
in
match st with
| GrafiteAst.Executable (_,ex) -> eval_executable opts status ex
| GrafiteAst.Comment (_,c) -> eval_comment status c
-let eval_from_stream ?do_heavy_checks ?include_paths status str cb =
+let eval_from_stream
+ ?do_heavy_checks ?include_paths ?clean_baseuri status str cb
+=
try
while true do
let ast = GrafiteParser.parse_statement str in
cb !status ast;
- status := eval_ast ?do_heavy_checks ?include_paths !status ast
+ status := eval_ast ?do_heavy_checks ?include_paths ?clean_baseuri !status ast
done
with End_of_file -> ()
(* to avoid a long list of recursive functions *)
let _ = eval_from_stream_ref := eval_from_stream
-let eval_from_stream_greedy ?do_heavy_checks ?include_paths status str cb =
+let eval_from_stream_greedy
+ ?do_heavy_checks ?include_paths ?clean_baseuri status str cb
+=
while true do
print_string "matita> ";
flush stdout;
let ast = GrafiteParser.parse_statement str in
cb !status ast;
- status := eval_ast ?do_heavy_checks ?include_paths !status ast
+ status := eval_ast ?do_heavy_checks ?include_paths ?clean_baseuri !status ast
done
;;
-let eval_string ?do_heavy_checks ?include_paths status str =
+let eval_string ?do_heavy_checks ?include_paths ?clean_baseuri status str =
eval_from_stream
- ?do_heavy_checks ?include_paths status (Stream.of_string str) (fun _ _ ->())
+ ?do_heavy_checks ?include_paths ?clean_baseuri status (Stream.of_string str) (fun _ _ ->())
let default_options () =
(*
val eval_string:
?do_heavy_checks:bool ->
?include_paths:string list ->
+ ?clean_baseuri:bool ->
MatitaTypes.status ref -> string -> unit
val eval_from_stream:
?do_heavy_checks:bool ->
?include_paths:string list ->
+ ?clean_baseuri:bool ->
MatitaTypes.status ref -> char Stream.t ->
(MatitaTypes.status -> statement -> unit) ->
unit
val eval_from_stream_greedy:
?do_heavy_checks:bool ->
?include_paths:string list ->
+ ?clean_baseuri:bool ->
MatitaTypes.status ref-> char Stream.t ->
(MatitaTypes.status -> statement -> unit) ->
unit
val eval_ast:
?do_heavy_checks:bool ->
?include_paths:string list ->
+ ?clean_baseuri:bool ->
MatitaTypes.status ->
statement ->
MatitaTypes.status
(match ML.baseuri_of_baseuri_decl (TA.Executable (loc,ex)) with
| None -> ()
| Some u ->
- if not (MatitacleanLib.is_empty u) then
+ if not (ML.is_empty u) then
match
guistuff.ask_confirmation
~title:"Baseuri redefinition"
let paths_to_search_in = ref [];;
let quiet_compilation = ref false;;
+let dont_delete_baseuri = ref false;;
let add_l l = fun s -> l := s :: !l ;;
let set_b b = fun () -> b := true;;
let arg_spec = [
"-I", Arg.String (add_l paths_to_search_in),
"<path> Adds path to the list of searched paths for the include command";
- "-q", Arg.Unit (set_b quiet_compilation), "Turn off verbose compilation"
+ "-q", Arg.Unit (set_b quiet_compilation), "Turn off verbose compilation";
+ "-preserve", Arg.Unit (set_b dont_delete_baseuri),
+ "Turns off automatic baseuri cleaning"
]
let usage =
sprintf "MatitaC v%s\nUsage: matitac [option ...] file\nOptions:"
| fname -> open_in fname)
in
run_script is
- (MatitaEngine.eval_from_stream ~include_paths:!paths_to_search_in);
+ (MatitaEngine.eval_from_stream
+ ~include_paths:!paths_to_search_in
+ ~clean_baseuri:(not !dont_delete_baseuri));
let elapsed = Unix.time () -. time in
let tm = Unix.gmtime elapsed in
let sec =
let rec aux = function
| f::tl ->
let len = Unix.read f buf 0 1024 in
+ if len = 0 then
+ raise CHILD_DEAD;
vt100 (String.sub buf 0 len);
aux tl
| _ -> ()
done;
true
with CHILD_DEAD ->
+ ignore(Sys.signal Sys.sigchld (Sys.Signal_ignore));
let _, status = Unix.waitpid [] !pid in
- match status with
- | Unix.WEXITED 0 ->
- ignore(Sys.signal Sys.sigchld (Sys.Signal_ignore));
- true
- | _ -> false)
+ match status with | Unix.WEXITED 0 -> true | _ -> false)
let build_development_in_bg ?(target="all") refresh_cb development =
%.moo:%.ma
[ ! -e $@ ] || ($(MATITACLEAN) $< 1>/dev/null 2>/dev/null ; rm -f $@)
- ($(MATITAC) -q -I @ROOT@ $< | (grep -v "^make" || true)) || \
+ ($(MATITAC) -preserve -q -I @ROOT@ $< | (grep -v "^make" || true)) || \
($(MATITACLEAN) $< ; exit 1)
@DEPFILE@ @DEPFILESHORT@: $(SRC)