Commit 5fbd9ecb authored by pj2m's avatar pj2m

now able to disable dep2pict

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@6496 7838e531-6607-4d57-9587-6c381814729c
parent 2ad966db
......@@ -3,7 +3,7 @@ LOG_DIR = @LOG_INCLUDE@
LOG_BYTE = $(LOG_DIR) log.cma
LOG_OPT = $(LOG_DIR) log.cmxa
DEP2PICT=@DEP2PICT@
DEP2PICT_DIR = @DEP2PICT_INCLUDE@
DEP2PICT_BYTE = $(DEP2PICT_DIR) dep2pict.cma
DEP2PICT_OPT = $(DEP2PICT_DIR) dep2pict.cmxa
......@@ -59,4 +59,5 @@ infos:
@echo "MESSAGE -> " $(MESSAGE)
@echo "INFO -> " $(INFO)
@echo ""
@echo "use dep2pict -> " $(DEP2PICT)
......@@ -13,6 +13,15 @@ AC_ARG_ENABLE(
[config=$enableval],
[config=yes])
AC_ARG_ENABLE(
[dep2pict],
[AS_HELP_STRING(
[--enable-dep2pict],
[Enable dep2pict (default is yes)])],
[dep2pict=$enableval],
[dep2pict=yes])
if test "$config" = yes ; then
# Look for ocamlfind
......@@ -84,32 +93,41 @@ if test "$config" = yes ; then
fi
rm c_check_log.* >& /dev/null
#Look for Dep2pict
AC_MSG_CHECKING([for dep2pict])
if test -f c_check_dep2pict.ml ; then
if test -w c_check_dep2pict.ml ; then
rm c_check_dep2pict.* >& /dev/null
DEP2PICT="no"
if test "$dep2pict" = yes ; then
#Look for Dep2pict
AC_MSG_CHECKING([for dep2pict])
if test -f c_check_dep2pict.ml ; then
if test -w c_check_dep2pict.ml ; then
rm c_check_dep2pict.* >& /dev/null
else
AC_MSG_ERROR(Cannot remove c_check_dep2pict.ml. Please change its right with chmod 666 c_check_dep2pict.ml)
fi
fi
echo "open Dep2pict;;" > c_check_dep2pict.ml
if (ocamlc -c dep2pict.cma c_check_dep2pict.ml >& /dev/null) ; then
AC_MSG_RESULT(standard)
DEP2PICT="yes"
else
AC_MSG_ERROR(Cannot remove c_check_dep2pict.ml. Please change its right with chmod 666 c_check_dep2pict.ml)
if test "$OCAMLFIND" = no ; then
AC_MSG_WARN(The dep2pict library is missing.)
DEP2PICT="no"
else
if $OCAMLFIND query dep2pict > /dev/null 2>&1 ; then
DEP2PICT_INCLUDE="-I `$OCAMLFIND query dep2pict`"
AC_MSG_RESULT(ocamlfind)
DEP2PICT="yes"
else
AC_MSG_WARN(The dep2pict library is missing.)
DEP2PICT="no"
fi
fi
fi
rm c_check_dep2pict.* >& /dev/null
fi
echo "open Dep2pict;;" > c_check_dep2pict.ml
if (ocamlc -c dep2pict.cma c_check_dep2pict.ml >& /dev/null) ; then
AC_MSG_RESULT(standard)
else
if test "$OCAMLFIND" = no ; then
AC_MSG_ERROR(The dep2pict library is missing.)
else
if $OCAMLFIND query dep2pict > /dev/null 2>&1 ; then
DEP2PICT_INCLUDE="-I `$OCAMLFIND query dep2pict`"
AC_MSG_RESULT(ocamlfind)
else
AC_MSG_ERROR(The dep2pict library is missing.)
fi
fi
fi
rm c_check_dep2pict.* >& /dev/null
AC_SUBST(DEP2PICT)
fi
AC_ARG_ENABLE(
......
......@@ -571,6 +571,7 @@ INFO
MESSAGE
WARNING
DEBUG
DEP2PICT
MENHIR
OCAMLFIND
target_alias
......@@ -615,6 +616,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_config
enable_dep2pict
enable_debug
enable_warning
enable_message
......@@ -1235,6 +1237,7 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-config Enable configuration check (default is yes)
--enable-dep2pict Enable dep2pict (default is yes)
--enable-debug Display debug trace
--enable-warning Display warning trace
--enable-message Display message trace
......@@ -1681,6 +1684,15 @@ else
fi
# Check whether --enable-dep2pict was given.
if test "${enable_dep2pict+set}" = set; then :
enableval=$enable_dep2pict; dep2pict=$enableval
else
dep2pict=yes
fi
if test "$config" = yes ; then
# Look for ocamlfind
......@@ -1840,34 +1852,45 @@ $as_echo "ocamlfind" >&6; }
fi
rm c_check_log.* >& /dev/null
#Look for Dep2pict
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dep2pict" >&5
DEP2PICT="no"
if test "$dep2pict" = yes ; then
#Look for Dep2pict
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dep2pict" >&5
$as_echo_n "checking for dep2pict... " >&6; }
if test -f c_check_dep2pict.ml ; then
if test -w c_check_dep2pict.ml ; then
rm c_check_dep2pict.* >& /dev/null
else
as_fn_error $? "Cannot remove c_check_dep2pict.ml. Please change its right with chmod 666 c_check_dep2pict.ml" "$LINENO" 5
if test -f c_check_dep2pict.ml ; then
if test -w c_check_dep2pict.ml ; then
rm c_check_dep2pict.* >& /dev/null
else
as_fn_error $? "Cannot remove c_check_dep2pict.ml. Please change its right with chmod 666 c_check_dep2pict.ml" "$LINENO" 5
fi
fi
fi
echo "open Dep2pict;;" > c_check_dep2pict.ml
if (ocamlc -c dep2pict.cma c_check_dep2pict.ml >& /dev/null) ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: standard" >&5
echo "open Dep2pict;;" > c_check_dep2pict.ml
if (ocamlc -c dep2pict.cma c_check_dep2pict.ml >& /dev/null) ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: standard" >&5
$as_echo "standard" >&6; }
else
if test "$OCAMLFIND" = no ; then
as_fn_error $? "The dep2pict library is missing." "$LINENO" 5
else
if $OCAMLFIND query dep2pict > /dev/null 2>&1 ; then
DEP2PICT_INCLUDE="-I `$OCAMLFIND query dep2pict`"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ocamlfind" >&5
DEP2PICT="yes"
else
if test "$OCAMLFIND" = no ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The dep2pict library is missing." >&5
$as_echo "$as_me: WARNING: The dep2pict library is missing." >&2;}
DEP2PICT="no"
else
if $OCAMLFIND query dep2pict > /dev/null 2>&1 ; then
DEP2PICT_INCLUDE="-I `$OCAMLFIND query dep2pict`"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ocamlfind" >&5
$as_echo "ocamlfind" >&6; }
else
as_fn_error $? "The dep2pict library is missing." "$LINENO" 5
fi
fi
DEP2PICT="yes"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The dep2pict library is missing." >&5
$as_echo "$as_me: WARNING: The dep2pict library is missing." >&2;}
DEP2PICT="no"
fi
fi
fi
rm c_check_dep2pict.* >& /dev/null
fi
rm c_check_dep2pict.* >& /dev/null
fi
......
......@@ -85,15 +85,24 @@ libgrew.mli : grew_types.mli
libgrew.cma : $(FILES_CMO) parser_byte checker_byte HTMLer_byte libgrew.mli libgrew.ml
rm libgrew.mli
@make libgrew.mli
ocamlc -c $(BYPE_FLAGS) $(FILES_CMO) str.cma -I parser $(PARSER_CMO) -I HTMLer HTMLer.cmo -I checker checker.cmo libgrew.mli
ifeq (@DEP2PICT@,no)
ocamlc -c -pp 'camlp4o pa_macro.cmo' $(BYPE_FLAGS) $(FILES_CMO) str.cma -I parser $(PARSER_CMO) -I HTMLer HTMLer.cmo -I checker checker.cmo libgrew.mli
ocamlc -a -o libgrew.cma $(BYPE_FLAGS) -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\"' -linkall $(FILES_CMO) -I parser $(PARSER_CMO) -I HTMLer HTMLer.cmo -I checker checker.cmo libgrew.ml
else
ocamlc -c -pp 'camlp4o pa_macro.cmo -DDEP2PICT' $(FILES_CMO) str.cma -I parser $(PARSER_CMO) -I HTMLer HTMLer.cmo -I checker checker.cmo libgrew.mli
ocamlc -a -o libgrew.cma -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\" -DDEP2PICT' -linkall $(FILES_CMO) -I parser $(PARSER_CMO) -I HTMLer HTMLer.cmo -I checker checker.cmo libgrew.ml
endif
libgrew.cmxa : $(FILES_CMX) parser_opt checker_opt HTMLer_opt libgrew.mli libgrew.ml
rm libgrew.mli
@make libgrew.mli
ocamlopt -c $(OPT_FLAGS) $(FILES_CMX) str.cmxa -I parser $(PARSER_CMX) -I HTMLer HTMLer.cmx -I checker checker.cmx libgrew.mli
ifeq (@DEP2PICT@,no)
ocamlopt -c -pp 'camlp4o pa_macro.cmo' $(OPT_FLAGS) $(FILES_CMX) str.cmxa -I parser $(PARSER_CMX) -I HTMLer HTMLer.cmx -I checker checker.cmx libgrew.mli
ocamlopt -a -o libgrew.cmxa $(OPT_FLAGS) -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\"' -linkall $(FILES_CMX) -I parser $(PARSER_CMX) -I HTMLer HTMLer.cmx -I checker checker.cmx libgrew.ml
else
ocamlopt -c -pp 'camlp4o pa_macro.cmo -DDEP2PICT' $(FILES_CMX) str.cmxa -I parser $(PARSER_CMX) -I HTMLer HTMLer.cmx -I checker checker.cmx libgrew.mli
ocamlopt -a -o libgrew.cmxa -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\" -DDEP2PICT' -linkall $(FILES_CMX) -I parser $(PARSER_CMX) -I HTMLer HTMLer.cmx -I checker checker.cmx libgrew.ml
endif
DEPENDS_DIR= -I parser -I checker -I HTMLer
......@@ -256,13 +265,25 @@ RULE_CMO = $(RULE_DEP:%=%.cmo)
RULE_CMX = $(RULE_DEP:%=%.cmx)
rule.cmi: $(RULE_CMI) rule.mli
ocamlc -c rule.mli
ifeq (@DEP2PICT@,no)
ocamlc -c -pp 'camlp4o pa_macro.cmo' rule.mli
else
ocamlc -c -pp 'camlp4o pa_macro.cmo -DDEP2PICT' rule.mli
endif
rule.cmo: $(RULE_CMO) rule.cmi rule.ml
ocamlc $(BYTE_FLAGS) -c $(DEPENDS_DIR) $(DEP2PICT_BYTE) rule.ml
ifeq (@DEP2PICT@,no)
ocamlc -pp 'camlp4o pa_macro.cmo' $(BYTE_FLAGS) -c $(DEPENDS_DIR) rule.ml
else
ocamlc -pp 'camlp4o pa_macro.cmo -DDEP2PICT' $(BYTE_FLAGS) -c $(DEPENDS_DIR) $(DEP2PICT_BYTE) rule.ml
endif
rule.cmx: $(RULE_CMX) rule.cmi rule.ml
ocamlopt $(OPT_FLAGS) -c $(DEPENDS_DIR) $(DEP2PICT_OPT) rule.ml
ifeq (@DEP2PICT@,no)
ocamlopt -pp 'camlp4o pa_macro.cmo' $(OPT_FLAGS) -c $(DEPENDS_DIR) rule.ml
else
ocamlopt -pp 'camlp4o pa_macro.cmo -DDEP2PICT' $(OPT_FLAGS) -c $(DEPENDS_DIR) $(DEP2PICT_OPT) rule.ml
endif
################################################################################
......@@ -273,13 +294,25 @@ GRS_CMO = $(GRS_DEP:%=%.cmo)
GRS_CMX = $(GRS_DEP:%=%.cmx)
grs.cmi: $(GRS_CMI) grs.mli
ocamlc -c grs.mli
ifeq (@DEP2PICT@,no)
ocamlc -c -pp 'camlp4o pa_macro.cmo' grs.mli
else
ocamlc -c -pp 'camlp4o pa_macro.cmo -DDEP2PICT' grs.mli
endif
grs.cmo: $(GRS_CMO) grs.cmi grs.ml
ifeq (@DEP2PICT@,no)
ocamlc $(BYTE_FLAGS) -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\"' -c $(DEPENDS_DIR) grs.ml
else
ocamlc $(BYTE_FLAGS) -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\" -DDEP2PICT' -c $(DEPENDS_DIR) grs.ml
endif
grs.cmx: $(GRS_CMX) grs.cmi grs.ml
ifeq (@DEP2PICT@,no)
ocamlopt $(OPT_FLAGS) -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\"' -c $(DEPENDS_DIR) grs.ml
else
ocamlopt $(OPT_FLAGS) -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\" -DDEP2PICT' -c $(DEPENDS_DIR) grs.ml
endif
################################################################################
# others
......
......@@ -30,6 +30,8 @@ module Rewrite_history = struct
) l
)
IFDEF DEP2PICT THEN
(* warning: path are returned in reverse order *)
let save_all_dep ?main_feat ?(init_graph=true) base_name t =
let nfs = ref [] in
......@@ -118,6 +120,7 @@ module Rewrite_history = struct
Html.leave html_ch;
close_out html_ch;
List.rev !stats
end
......
......@@ -9,7 +9,10 @@ module Rewrite_history: sig
bad_nf: Instance.t list;
}
IFDEF DEP2PICT THEN
val save_html: ?main_feat:string -> ?init_graph:bool -> ?header:string -> string -> t -> (string*string list) list
ENDIF
end
......
......@@ -72,6 +72,7 @@ let rewrite ~gr ~grs ~seq =
| exc -> raise (Bug (Printf.sprintf "UNCATCHED EXCEPTION: %s" (Printexc.to_string exc), None))
IFDEF DEP2PICT THEN
let rewrite_to_html ?main_feat input_dir grs output_dir no_init current_grs_file current_grs seq title =
try
let rewrite_to_html_intern ?(no_init=false) grs_file grs seq input output nb_sentence previous next =
......@@ -237,6 +238,9 @@ let rewrite_to_html ?main_feat input_dir grs output_dir no_init current_grs_file
Printf.fprintf out_ch "</td>\n";
Printf.fprintf out_ch "</tr>";
Printf.fprintf out_ch "</table></center>\n";
close_out out_ch;
......
......@@ -48,7 +48,9 @@ val gr : string -> gr
@return a structure {b {i easily}} displayable *)
val rewrite : gr:gr -> grs:grs -> seq:string -> rew_display
IFDEF DEP2PICT THEN
val rewrite_to_html :
?main_feat:string -> string -> string -> string -> bool -> string -> Grs.t -> string -> string -> unit
ENDIF
val get_css_file: string
......@@ -9,7 +9,9 @@ open Command
open Grew_node
open Graph
IFDEF DEP2PICT THEN
open Dep2pict
ENDIF
module Instance = struct
......@@ -40,8 +42,11 @@ module Instance = struct
(* only graph rewrited from the same init graph can be "compared" *)
let compare t1 t2 = Pervasives.compare t1.commands t2.commands
let save_dep_png ?main_feat base t =
ignore (Dep2pict.fromDepStringToPng (Graph.to_dep ?main_feat t.graph) (base^".png"))
IFDEF DEP2PICT THEN
let save_dep_png ?main_feat base t =
ignore (Dep2pict.fromDepStringToPng (Graph.to_dep ?main_feat t.graph) (base^".png"))
ENDIF
end
module Instance_set = Set.Make (Instance)
......
......@@ -23,8 +23,10 @@ module Instance : sig
val from_graph: Graph.t -> t
val get_graph: t -> Graph.t
IFDEF DEP2PICT THEN
(* [save_dep_png base t] writes a file "base.png" with the dep representation of [t] *)
val save_dep_png: ?main_feat: string -> string -> t -> unit
ENDIF
end
module Instance_set : Set.S with type elt = Instance.t
......
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