From 3a3d4e0abefdbd3521fb265d6b4c1ea56229a710 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Tue, 16 Dec 2003 17:34:08 +0000 Subject: [PATCH] - use ocaml-http instead of netclient for http GET requests - renamed Makefile targets so that all and clean have the usual semantics --- helm/graphs/tools/Makefile | 19 ++++++++++++++----- helm/graphs/tools/drawGraph.ml | 7 +++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/helm/graphs/tools/Makefile b/helm/graphs/tools/Makefile index cbcc16946..48f035454 100644 --- a/helm/graphs/tools/Makefile +++ b/helm/graphs/tools/Makefile @@ -7,11 +7,22 @@ PREDICATES = mt OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -thread OCAMLC = ocamlfind ocamlc $(OCAMLOPTIONS) OCAMLOPT = ocamlfind ocamlopt $(OCAMLOPTIONS) +EXECUTABLES = uriSetQueue drawGraph +EXECUTABLES_OPT = $(patsubst %,%.opt,$(EXECUTABLES)) #OBJS=prova.$(PID).svg prova.$(PID).ps prova.$(PID).gif prova.$(PID).ismap prova.$(PID).imap prova.$(PID).html OBJS=prova.$(PID).gif prova.$(PID).ismap prova.$(PID).html -all: $(OBJS) +all: $(EXECUTABLES) +opt: $(EXECUTABLES_OPT) +world: all opt +clean: + rm -f *.cm[aiox] *.cmxa *.[ao] $(EXECUTABLES) $(EXECUTABLES_OPT) + +tmp: $(OBJS) +clean_tmp: + rm -f $(OBJS) prova.$(PID).dot xx.$(PID)00 xx.$(PID)01 xx.$(PID)02 \ + xx.$(PID)02n xx.$(PID)03 log.$(PID) uriSetQueue: uriSetQueue.ml $(OCAMLC) -linkpkg -o $@ $< @@ -19,9 +30,9 @@ uriSetQueue.opt: uriSetQueue.ml $(OCAMLOPT) -linkpkg -o $@ $< drawGraph: drawGraph.ml - $(OCAMLC) -package "unix netclient" -linkpkg -o $@ $< + $(OCAMLC) -linkpkg -o $@ $< drawGraph.opt: drawGraph.ml - $(OCAMLOPT) -package "unix netclient" -linkpkg -o $@ $< + $(OCAMLOPT) -linkpkg -o $@ $< prova.$(PID).dot: prova0.$(PID).dot csplit --prefix=xx.$(PID) prova0.$(PID).dot 1 2 `expr \`wc -l prova0.$(PID).dot | sed 's/\([0123456789]\+\) prova0.$(PID).dot/\1/'\` + 1` @@ -46,5 +57,3 @@ prova.$(PID).ismap: prova.$(PID).dot prova.$(PID).html: prova.$(PID).ismap cat xx.$(PID)00 prova.$(PID).ismap | ./mk_html.pl $(PID) > prova.$(PID).html -clean: - rm -f $(OBJS) prova.$(PID).dot xx.$(PID)00 xx.$(PID)01 xx.$(PID)02 xx.$(PID)02n xx.$(PID)03 log.$(PID) diff --git a/helm/graphs/tools/drawGraph.ml b/helm/graphs/tools/drawGraph.ml index b7abfe901..071438319 100644 --- a/helm/graphs/tools/drawGraph.ml +++ b/helm/graphs/tools/drawGraph.ml @@ -36,9 +36,8 @@ let dir_env_var = "DRAW_GRAPH_DIR";; let wget url fname = prerr_endline (sprintf "DEBUG: wgetting url '%s'" url); - let data = Http_client.Convenience.http_get url in let oc = open_out fname in - output_string oc data; + Http_client.http_get_iter (output_string oc) url; close_out oc ;; @@ -76,7 +75,7 @@ let callback (req: Http_types.request) outchan = let url = req#param "url" in let pid = Unix.getpid () in wget (sprintf "%s¶m.PID=%d" url pid) (sprintf "prova0.%d.dot" pid); - (match Unix.system (sprintf "make PID=%d > log.%d" pid pid) with + (match Unix.system (sprintf "make tmp PID=%d > log.%d" pid pid) with | Unix.WEXITED 0 -> debug_print "HTML successfully generated"; Http_daemon.respond_file (sprintf "prova.%d.html" pid) outchan @@ -93,7 +92,7 @@ let callback (req: Http_types.request) outchan = let pid = req#param "pid" in Http_daemon.respond_file (sprintf "prova.%s.gif" pid) outchan; ignore (Unix.system ( - sprintf "make PID=%s clean; rm -f prova0.%s.dot" pid pid)) + sprintf "make PID=%s clean_tmp; rm -f prova0.%s.dot" pid pid)) | invalid_request -> Http_daemon.respond_error ~status:(`Client_error `Bad_request) outchan) with -- 2.39.2