+++ /dev/null
-(******************************************************************************)
-(* *)
-(* PROJECT HELM *)
-(* *)
-(* Claudio Sacerdoti Coen <sacerdot@cs.unibo.it> *)
-(* 06/05/2000 *)
-(* *)
-(* This is the parser that reads the configuration file of helm *)
-(* *)
-(******************************************************************************)
-
-(* this should be the only hard coded constant *)
-let filename =
- let prefix =
- try
- Sys.getenv "HELM_CONFIGURATION_PREFIX"
- with
- Not_found -> ""
- in
- prefix ^ "/local/etc/helm/configuration.xml";;
-
-exception Warnings;;
-
-class warner =
- object
- method warn w =
- print_endline ("WARNING: " ^ w) ;
- (raise Warnings : unit)
- end
-;;
-
-let xml_document () =
- 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
- with
- e ->
- print_endline (Pxp_types.string_of_exn e) ;
- raise e
-;;
-
-exception Impossible;;
-
-let vars = Hashtbl.create 14;;
-
-(* resolve <value-of> tags and returns the string values of the variable tags *)
-let rec resolve =
- let module D = Pxp_document in
- function
- [] -> ""
- | he::tl when he#node_type = D.T_element "value-of" ->
- (match he#attribute "var" with
- Pxp_types.Value var -> Hashtbl.find vars var
- | _ -> raise Impossible
- ) ^ resolve tl
- | he::tl when he#node_type = D.T_data ->
- he#data ^ resolve tl
- | _ -> raise 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)
-;;
-
-let helm_dir = Hashtbl.find vars "helm_dir";;
-let dtd_dir = Hashtbl.find vars "dtd_dir";;
-let servers_file = Hashtbl.find vars "servers_file";;
-let uris_dbm = Hashtbl.find vars "uris_dbm";;
-let dest = Hashtbl.find vars "dest";;
-let indexname = Hashtbl.find vars "indexname";;
-let tmpdir = Hashtbl.find vars "tmpdir";;
-let helm_dir = Hashtbl.find vars "helm_dir";;
-let getter_url = Hashtbl.find vars "getter_url";;
-
-let _ = Hashtbl.clear vars;;
--- /dev/null
+(******************************************************************************)
+(* *)
+(* PROJECT HELM *)
+(* *)
+(* Claudio Sacerdoti Coen <sacerdot@cs.unibo.it> *)
+(* 28/12/2000 *)
+(* *)
+(* This is the parser that reads the configuration file of helm *)
+(* *)
+(******************************************************************************)
+
+(* this should be the only hard coded constant *)
+let filename =
+ let prefix =
+ try
+ Sys.getenv "HELM_CONFIGURATION_PREFIX"
+ with
+ Not_found -> ""
+ in
+ prefix ^ "/local/etc/helm/configuration.xml";;
+
+exception Warnings;;
+
+class warner =
+ object
+ method warn w =
+ print_endline ("WARNING: " ^ w) ;
+ (raise Warnings : unit)
+ end
+;;
+
+let xml_document () =
+ 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
+ with
+ e ->
+ print_endline (Pxp_types.string_of_exn e) ;
+ raise e
+;;
+
+exception Impossible;;
+
+let vars = Hashtbl.create 14;;
+
+(* resolve <value-of> tags and returns the string values of the variable tags *)
+let rec resolve =
+ let module D = Pxp_document in
+ function
+ [] -> ""
+ | he::tl when he#node_type = D.T_element "value-of" ->
+ (match he#attribute "var" with
+ Pxp_types.Value var -> Hashtbl.find vars var
+ | _ -> raise Impossible
+ ) ^ resolve tl
+ | he::tl when he#node_type = D.T_data ->
+ he#data ^ resolve tl
+ | _ -> raise 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)
+;;
+
+let helm_dir = Hashtbl.find vars "helm_dir";;
+let dtd_dir = Hashtbl.find vars "dtd_dir";;
+let servers_file = Hashtbl.find vars "servers_file";;
+let uris_dbm = Hashtbl.find vars "uris_dbm";;
+let dest = Hashtbl.find vars "dest";;
+let indexname = Hashtbl.find vars "indexname";;
+let tmpdir = Hashtbl.find vars "tmpdir";;
+let helm_dir = Hashtbl.find vars "helm_dir";;
+let getter_url = Hashtbl.find vars "getter_url";;
+
+let _ = Hashtbl.clear vars;;