OSDN Git Service

Create habc-link command
authormzp <mzpppp@gmail.com>
Sun, 11 Oct 2009 05:46:17 +0000 (14:46 +0900)
committermzp <mzpppp@gmail.com>
Sun, 11 Oct 2009 05:46:17 +0000 (14:46 +0900)
To create habc-link command, Connect CmdOpt module and Template module.

And add Swf module to swflib. It is facade.

link/main.ml
swflib/OMakefile
swflib/swf.ml [new file with mode: 0644]

index ca9c809..b3477da 100644 (file)
@@ -1,4 +1,5 @@
 open Base
+open Swflib
 open Swflib.SwfType
 
 let input_bytes ch =
@@ -19,6 +20,6 @@ let _ =
          open_in_with path input_bytes in
        let swf =
          Template.make t bytes in
-         swf
+         open_out_with t#output (fun ch -> Swf.write ch swf)
     | _ ->
        failwith "not suppert many files"
index d20f12b..5445e1c 100644 (file)
@@ -24,6 +24,7 @@ FILES[] =
        swfBaseOut
        swfType
        swfOut
+       swf
 
 UseCamlp4(pa_openin pa_oo pa_field)
 PROGRAM=../swflib
diff --git a/swflib/swf.ml b/swflib/swf.ml
new file mode 100644 (file)
index 0000000..0b615f0
--- /dev/null
@@ -0,0 +1,13 @@
+open Base
+open SwfType
+open SwfOut
+open TagOut
+
+type swf = TagOut.t SwfType.t
+
+module M = SwfOut.Make(TagOut)
+
+let write ch swf =
+  M.to_base swf
+  +> SwfBaseOut.to_list
+  +> List.iter (output_byte ch)