X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Fpxp%2Fpxp%2Frtests%2Fcodewriter%2Fcompile.ml;fp=helm%2FDEVEL%2Fpxp%2Fpxp%2Frtests%2Fcodewriter%2Fcompile.ml;h=0000000000000000000000000000000000000000;hb=3ef089a4c58fbe429dd539af6215991ecbe11ee2;hp=1bd6e226674f5c74df69a76015e5c2a56613f078;hpb=1c7fb836e2af4f2f3d18afd0396701f2094265ff;p=helm.git diff --git a/helm/DEVEL/pxp/pxp/rtests/codewriter/compile.ml b/helm/DEVEL/pxp/pxp/rtests/codewriter/compile.ml deleted file mode 100644 index 1bd6e2266..000000000 --- a/helm/DEVEL/pxp/pxp/rtests/codewriter/compile.ml +++ /dev/null @@ -1,131 +0,0 @@ -(* $Id$ - * ---------------------------------------------------------------------- - * - *) - - -open Pxp_document;; -open Pxp_yacc;; -open Pxp_types;; - -let error_happened = ref false;; - -let rec prerr_error e = - prerr_endline (string_of_exn e) -;; - - -class warner = - object - method warn w = - prerr_endline ("WARNING: " ^ w) - end -;; - - -let compile in_filename out_filename print super_root pis comments = - let spec = - let e = new element_impl default_extension in - make_spec_from_mapping - ~super_root_exemplar: e - ~default_pinstr_exemplar: e - ~comment_exemplar: e - ~data_exemplar: (new data_impl default_extension) - ~default_element_exemplar: e - ~element_mapping: (Hashtbl.create 1) - () - in - let config = - { default_config with - encoding = `Enc_utf8; - warner = new warner; - enable_super_root_node = super_root; - enable_pinstr_nodes = pis; - enable_comment_nodes = comments; - } - in - try - let tree = - parse_document_entity - config - (from_file in_filename) - spec - in - - let ch = open_out out_filename in - Pxp_codewriter.write_document ch tree; - output_string ch "(create_document (new Pxp_types.drop_warnings) Pxp_yacc.default_spec) # write (Pxp_types.Out_channel stdout) `Enc_utf8;;\n"; - close_out ch; - - if print then - tree # write (Out_channel stdout) `Enc_utf8; - with - e -> - error_happened := true; - prerr_error e -;; - - -let main() = - let in_file = ref "" in - let out_file = ref "" in - let print_file = ref false in - let super_root = ref false in - let pis = ref false in - let comments = ref false in - Arg.parse - [ "-in", (Arg.String (fun s -> in_file := s)), - " Set the XML file to read"; - "-out", (Arg.String (fun s -> out_file := s)), - " Set the Ocaml file to write"; - "-print", (Arg.Set print_file), - " Print the XML file in standard form"; - "-super-root", Arg.Set super_root, - " Generate a super root node"; - "-pis", Arg.Set pis, - " Generate wrapper nodes for processing instructions"; - "-comments", Arg.Set comments, - " Generate nodes for comments"; - ] - (fun x -> raise (Arg.Bad "Unexpected argument")) - " -usage: compile [ options ] - -List of options:"; - if !in_file = "" then begin - prerr_endline "No input file specified."; - exit 1 - end; - if !out_file = "" then begin - prerr_endline "No output file specified."; - exit 1 - end; - compile !in_file !out_file !print_file !super_root !pis !comments -;; - - -main(); -if !error_happened then exit(1);; - -(* ====================================================================== - * History: - * - * $Log$ - * Revision 1.1 2000/11/17 09:57:35 lpadovan - * Initial revision - * - * Revision 1.4 2000/08/17 01:20:15 gerd - * Update: Also tested whether super root nodes, pinstr nodes - * and comment nodes work. - * Note: comment nodes are not fully tested yet. - * - * Revision 1.3 2000/08/16 23:44:19 gerd - * Updates because of changes of the PXP API. - * - * Revision 1.2 2000/07/16 17:54:15 gerd - * Updated because of PXP interface changes. - * - * Revision 1.1 2000/07/09 00:33:32 gerd - * Initial revision. - * - *)