Plasma GitLab Archive
Projects Blog Knowledge

#! /bin/sh
# (*
exec ocaml "$0" "$@"
*) directory ".";;

(* Generate an O'Caml module application_dtd.ml defining
 * variables "dtd_1" and "dtd_2" containing the contents of the files
 * application_1.dtd, and application_2.dtd, resp.
 *)


let fout = open_out "wd_application_dtd.ml" in
List.iter
  (fun (fn, vn) ->
     let fin = open_in fn in
     output_string fout ("let " ^ vn ^ " = \"");
     ( try
	 while true do
	   let line = input_line fin in
	     output_string fout (String.escaped line);
	     output_string fout "\n"
	 done;
	 assert false
       with
	   End_of_file ->
	     ()
     );
     output_string fout "\";;\n\n";
     close_in fin;
  )
  [ "wd_application_1.dtd", "dtd_1";
    "wd_application_2.dtd", "dtd_2";
  ];
close_out fout
;;

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml