OSDN Git Service

update open_in_with/open_out_with
authormzp <mzpppp@gmail.com>
Wed, 21 Oct 2009 22:59:30 +0000 (07:59 +0900)
committermzp <mzpppp@gmail.com>
Wed, 21 Oct 2009 22:59:30 +0000 (07:59 +0900)
base/base.ml
xml/swfmill.ml
xml/swfmillTest.ml

index ed4b4aa..6cee499 100644 (file)
@@ -109,20 +109,22 @@ let hex =
   Printf.sprintf "0x%x"
 
 let open_out_with path f =
-  open_out_bin path
-  +> maybe f
-  +> tee (fun _ -> close_out ch)
-  +> function
-      `Val v ->  v
-    | `Error e -> raise e
+  let ch =
+    open_out_bin path in
+    maybe f ch
+    +> tee (fun _ -> close_out ch)
+    +> function
+       `Val v ->  v
+      | `Error e -> raise e
 
 let open_in_with path f =
-  open_in_bin path
-  +> maybe f
-  +> tee (fun _ -> close_in ch)
-  +> function
-      `Val v ->  v
-    | `Error e -> raise e
+  let ch =
+    open_in_bin path in
+    maybe f ch
+    +> tee (fun _ -> close_in ch)
+    +> function
+       `Val v ->  v
+      | `Error e -> raise e
 
 let undefined =  Obj.magic 42
 let undef     = undefined
index c8e5e9e..77bd549 100644 (file)
@@ -35,7 +35,7 @@ let of_namespace ns =
       | ExplicitNamespace name ->
          make "ExplicitNamespace" name
       | StaticProtectedNamespace _ ->
-         todo "this namespace is not support."
+         failwith "this namespace is not support."
       | PrivateNamespace name ->
          make "PrivateNamespace" name
 
index d48d80f..f5dd5a6 100644 (file)
@@ -7,7 +7,7 @@ open Swflib.AbcType
 let example name =
   let ch =
     open_in_bin @@ Printf.sprintf "example/%s.abc" name in
-    Swflib.Abc.disasm @@ Swflib.BytesIn.of_channel ch
+    Swflib.Abc.read @@ Swflib.BytesIn.of_channel ch
 
 let ok x y =
   OUnit.assert_equal ~printer:Xml.to_string_fmt (normalize x) (normalize y)