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
+ prerr_endline ("Warning: configuration file not found, or incorrect: " ^ Pxp_types.string_of_exn e) ;
+ None
;;
exception Impossible;;
(* 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
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";;
+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"