X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fgetter%2Fconfiguration.ml;h=1eb4ab65e6f55adcf014e50e2e5e7519a265521e;hb=d3c72d6856cd185e5b3e9f2e8b928b78c7031ed1;hp=2c7ead3dc70c33b75e39730a90a3b05f26d97961;hpb=5a92117eeff70048d29e91ba24e113155d956e1b;p=helm.git diff --git a/helm/ocaml/getter/configuration.ml b/helm/ocaml/getter/configuration.ml index 2c7ead3dc..1eb4ab65e 100644 --- a/helm/ocaml/getter/configuration.ml +++ b/helm/ocaml/getter/configuration.ml @@ -34,14 +34,22 @@ class warner = ;; let xml_document () = + let error e = + prerr_endline ("Warning: configuration file not found, or incorrect: " ^ + Pxp_types.string_of_exn e) ; + None + in let module Y = Pxp_yacc in try let config = {Y.default_config with Y.warner = new warner} in - Y.parse_document_entity config (Y.from_file filename) Y.default_spec + Some (Y.parse_document_entity config (Y.from_file filename) Y.default_spec) with - e -> - print_endline (Pxp_types.string_of_exn e) ; - raise e + | (Pxp_types.Error _) as e -> error e + | (Pxp_types.At _) as e -> error e + | (Pxp_types.Validation_error _) as e -> error e + | (Pxp_types.WF_error _) as e -> error e + | (Pxp_types.Namespace_error _) as e -> error e + | (Pxp_types.Character_not_supported) as e -> error e ;; exception Impossible;; @@ -65,15 +73,18 @@ let rec resolve = (* we trust the xml file to be valid because of the validating xml parser *) let _ = - List.iter - (function - n -> - match n#node_type with - Pxp_document.T_element var -> - Hashtbl.add vars var (resolve (n#sub_nodes)) - | _ -> raise Impossible - ) - ((xml_document ())#root#sub_nodes) + match xml_document () with + None -> () + | Some d -> + List.iter + (function + n -> + match n#node_type with + Pxp_document.T_element var -> + Hashtbl.add vars var (resolve (n#sub_nodes)) + | _ -> raise Impossible + ) + (d#root#sub_nodes) ;; (* try to read a configuration variable, given its name into the @@ -101,15 +112,8 @@ let read_configuration_var xml_name = flush stdout ; raise Not_found -let helm_dir = read_configuration_var "helm_dir";; -let dtd_dir = read_configuration_var "dtd_dir";; -let style_dir = read_configuration_var_env "style_dir" "HELM_STYLE_DIR";; -let servers_file = read_configuration_var "servers_file";; -let uris_dbm = read_configuration_var "uris_dbm";; -let dest = read_configuration_var "dest";; -let indexname = read_configuration_var "indexname";; -let tmp_dir = read_configuration_var "tmp_dir" -let helm_dir = read_configuration_var "helm_dir";; +(* Zack: no longer used *) +(* let tmp_dir = read_configuration_var_env "tmp_dir" "HELM_TMP_DIR";; *) let getter_url = read_configuration_var_env "getter_url" "HELM_GETTER_URL";; let processor_url = read_configuration_var_env "processor_url" "HELM_PROCESSOR_URL";; let annotations_dir = read_configuration_var_env "annotations_dir" "HELM_ANNOTATIONS_DIR"