OSDN Git Service

use swflib
authormzp <mzpppp@gmail.com>
Wed, 30 Sep 2009 23:15:12 +0000 (08:15 +0900)
committermzp <mzpppp@gmail.com>
Wed, 30 Sep 2009 23:15:12 +0000 (08:15 +0900)
xml/OMakefile
xml/abc.ml [deleted file]
xml/abcTest.ml [deleted file]
xml/byte.ml [deleted file]
xml/byteTest.ml [deleted file]
xml/code.ml
xml/disasm.ml [deleted file]

index 48d69ea..07cf178 100644 (file)
@@ -10,7 +10,6 @@ UseCamlp4(pa_oo)
 
 FILES[] =
        code
-       disasm
        easyXml
        swfmill
        parsec
@@ -30,9 +29,7 @@ OCamlProgram($(PROGRAM), main $(FILES))
 # ------------------------------
 # Test
 # ------------------------------
-OUnitTest(byte   ,byte parsec)
-OUnitTest(abc    ,abc parsec disasm byte)
-OUnitTest(swfmill,swfmill easyXml abc code byte disasm parsec)
+OUnitTest(swfmill,swfmill easyXml code parsec)
 OUnitTest(code   ,code easyXml)
 
 # ------------------------------
diff --git a/xml/abc.ml b/xml/abc.ml
deleted file mode 100644 (file)
index c60d972..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-open Base
-open Byte
-open ExtString
-
-let array f stream =
-  let n =
-    u30 stream in
-    Parsec.repeat_l n f stream
-
-let carray f stream =
-  let n =
-    u30 stream in
-    Parsec.repeat_l (Int32.sub n 1l) f stream
-
-(* constant pool *)
-let string_info stream =
-  let cs =
-    List.map char_of_int @@ array u8 stream in
-    String.implode cs
-
-let namespace_info stream =
-  let kind =
-    u8 stream in
-  let name =
-    u30 stream in
-    match kind with
-       0x08 ->
-         `Namespace name
-      | 0x16 ->
-         `PackageNamespace name
-      | 0x17 ->
-         `PackageInternaNs name
-      | 0x18 ->
-         `ProtectedNamespace name
-      | 0x19 ->
-         `ExplicitNamespace name
-      | 0x1A ->
-         `StaticProtectedNs name
-      | 0x05 ->
-         `PrivateNs name
-      | _ ->
-         failwith "must not happen"
-
-let ns_set_info stream =
-  {| ns = array u30 stream |}
-
-let multiname_info stream =
-  let kind =
-    u8 stream in
-    match kind with
-       0x07 ->
-         `QName {| ns=u30 stream; name=u30 stream |}
-      | 0x0D ->
-         `QNameA {| ns=u30 stream; name=u30 stream |}
-      | 0x0F ->
-         `RTQName {| name=u30 stream |}
-      | 0x10 ->
-         `RTQNameA {| name=u30 stream |}
-      | 0x11 ->
-         `RTQNameL
-      | 0x12 ->
-         `RTQNameLA
-      | 0x09 ->
-         `Multiname {|name=u30 stream; ns_set=u30 stream|}
-      | 0x0E ->
-         `MultinameA {|name=u30 stream; ns_set=u30 stream|}
-      | 0x1B ->
-         `MultinameL {|ns_set=u30 stream|}
-      | 0x1C ->
-         `MultinameLA {|ns_set=u30 stream|}
-      | _ ->
-         failwith "invalid format"
-
-let constant_pool stream =
-  {| integer  =carray s32 stream;
-     uinteger =carray u32 stream;
-     double   =carray d64 stream;
-     string   =carray string_info stream;
-     namespace=carray namespace_info stream;
-     ns_set   =carray ns_set_info stream;
-     multiname=carray multiname_info stream
-  |}
-
-(* method info *)
-let option_detail stream =
-  let value =
-    u30 stream in
-    match u8 stream with
-       0x03 ->
-         `Int value
-      | 0x04 ->
-         `UInt value
-      | 0x06 ->
-         `Double value
-      | 0x01 ->
-         `String value
-      | 0x0B ->
-         `Bool true
-      | 0x0A ->
-         `Bool false
-      | 0x0C ->
-         `Null
-      | 0x00 ->
-         `Undefined
-      | 0x08 | 0x16 | 0x17 | 0x18 | 0x19 | 0x1A | 0x05 ->
-         `Namespace value
-      | _ ->
-         failwith "invalid format"
-
-let option_info stream =
-  array option_detail stream
-
-let has x y =
-  x land y = y
-
-let method_info stream =
-  let param_count =
-    u30 stream in
-  let return_type =
-    u30 stream in
-  let param_types =
-    Parsec.repeat_l param_count u30 stream in
-  let name =
-    u30 stream in
-  let flags =
-    u8 stream in
-  let options =
-    if has flags 0x08 then
-      Some (option_info stream )
-    else
-      None in
-  let param_names =
-    if has flags 0x80 then
-      Some (Parsec.repeat_l param_count u30 stream)
-    else
-      None in
-    {| param_types     = param_types;
-       return_type     = return_type;
-       name            = name;
-       need_arguments  = has flags 0x01;
-       need_activation = has flags 0x02;
-       need_rest       = has flags 0x04;
-       set_dxns        = has flags 0x40;
-       options         = options;
-       param_names     = param_names
-    |}
-
-(* metadata *)
-let item_info stream =
-  {| key=u30 stream;
-     value=u30 stream |}
-
-let metadata_info stream =
-  {| name  = u30 stream;
-     items = array item_info stream
-  |}
-
-(* 4.8 Traits *)
-let trait_info stream =
-  let name =
-    u30 stream in
-  let kind =
-    u8 stream in
-  let data =
-    match kind land 0x0F with
-       0 | 6 ->
-         let slot_id   = u30 stream in
-         let type_name =
-           u30 stream in
-         let vindex =
-           u30 stream in
-         let vkind =
-           if vindex = 0l then
-             None
-           else
-             Some (u8 stream) in
-         let body =
-           {| slot_id=slot_id; type_name=type_name; vindex=vindex; vkind=vkind|} in
-           if kind = 0 then
-             `Slot body
-           else
-             `Const body
-      | 4 ->
-         `Class {| slot_id=u30 stream; classi=u30 stream |}
-      | 5 ->
-         `Function {| slot_id=u30 stream; functioni=u30 stream |}
-      | 1 | 2 | 3 as k ->
-         let body =
-           {| disp_id=u30 stream; methodi=u30 stream |} in
-           begin match k with
-               1 -> `Method body
-             | 2 -> `Getter body
-             | 3 -> `Setter body
-             | _ -> failwith "must not happen"
-           end
-      | _ ->
-         failwith "invalid format" in
-  let attr =
-    kind lsr 4 in
-  let metadata =
-    if has attr 0x4 then
-      Some (array u30 stream)
-    else
-      None in
-    {| name          = name;
-       data          = data;
-       metadata      = metadata;
-       attr_final    = has attr 0x01;
-       attr_override = has attr 0x02
-    |}
-
-(* 4.7 Instance *)
-let instance_info stream =
-  let name =
-    u30 stream in
-  let super_name =
-    u30 stream in
-  let flags =
-    u8 stream in
-  let protectedNs =
-    if has flags 0x08 then
-      Some (u30 stream)
-    else
-      None in
-  let interface =
-    array u30 stream in
-  let iinit =
-    u30 stream in
-  let traits =
-    array trait_info stream in
-    {| name         = name;
-       super_name   = super_name;
-       is_sealed    = has flags 0x01;
-       is_final     = has flags 0x02;
-       is_interface = has flags 0x04;
-       is_protected = has flags 0x08;
-       protectedNs  = protectedNs;
-       interface    = interface;
-       iinit        = iinit;
-       traits       = traits
-    |}
-
-(* 4.9 Class *)
-let class_info stream =
-  {| cinit = u30 stream; traits = array trait_info stream|}
-
-(* 4.10 Script*)
-let script_info stream =
-  {| init = u30 stream; traits = array trait_info stream |}
-
-(* 4.12 Exception *)
-let exception_info stream =
-  {| from_pos = u30 stream;
-     to_pos   = u30 stream;
-     target   = u30 stream;
-     exc_type = u30 stream;
-     var_name = u30 stream
-  |}
-
-(* 4.11 Method body *)
-let method_body_info stream =
-  let methodi =
-    u30 stream in
-  let max_stack =
-    u30 stream in
-  let local_count =
-    u30 stream in
-  let init_scope_depth =
-    u30 stream in
-  let max_scope_depth =
-    u30 stream in
-  let code =
-    array u8 stream in
-  let exceptions =
-    array exception_info stream in
-  let traits =
-    array trait_info stream in
-    {| methodi          = methodi;
-       max_stack        = max_stack;
-       local_count      = local_count;
-       init_scope_depth = init_scope_depth;
-       max_scope_depth  = max_scope_depth;
-       code             = Parsec.many Disasm.code @@ Stream.of_list code;
-       exceptions       = exceptions;
-       traits           = traits
-    |}
-
-(* 4.2 ABC File *)
-let abcFile stream =
-  let minor_version =
-    u16 stream in
-  let major_version =
-    u16 stream in
-  let constant_pool =
-    constant_pool stream in
-  let methods =
-    array method_info stream in
-  let metadata =
-    array metadata_info stream in
-  let class_count =
-    u30 stream in
-  let instances =
-    Parsec.repeat_l class_count instance_info stream in
-  let classes =
-    Parsec.repeat_l class_count class_info stream in
-  let script =
-    array script_info stream in
-  let method_body =
-    array method_body_info stream in
-    {| minor_version = minor_version;
-       major_version = major_version;
-       constant_pool = constant_pool;
-       methods       = methods;
-       metadata      = metadata;
-       instances     = instances;
-       classes       = classes;
-       script        = script;
-       method_body   = method_body
-    |}
-
-let of_stream stream =
-  abcFile stream
diff --git a/xml/abcTest.ml b/xml/abcTest.ml
deleted file mode 100644 (file)
index e47b05b..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-open Base
-open OUnit
-
-let ok x y =
-  OUnit.assert_equal ~printer:Std.dump x y
-
-let example name =
-  let ch =
-    open_in_bin @@ Printf.sprintf "example/%s.abc" name in
-    Abc.of_stream @@ Byte.of_channel ch
-
-let abc =
-  example "hello"
-
-let cpool =
-  abc#constant_pool
-
-let _ =
-  ("asm module test" >::: [
-     "major/minor version" >::
-       (fun () ->
-         ok 16 abc#minor_version;
-         ok 46 abc#major_version);
-     "cpool" >::: [
-       "integer" >::
-        (fun () -> ok [] cpool#integer);
-       "uinteger" >::
-        (fun () -> ok [] cpool#uinteger);
-       "double" >::
-        (fun () -> ok [] cpool#double);
-       "string" >::
-        (fun () -> ok [""; "Hello,world!!";"print"] cpool#string);
-       "namespace" >::
-        (fun () ->
-           match cpool#namespace with
-               [ns] ->
-                 ok (`Namespace 1l) ns
-             | _ ->
-                 assert_failure "list size is over");
-       "namespace set" >::
-        (fun () ->
-           ok [] cpool#ns_set);
-       "multiname" >::
-        (fun () ->
-           match cpool#multiname with
-               [`QName x;`QName y] ->
-                 ok 1 (Int32.to_int x#ns);
-                 ok 1 (Int32.to_int x#name);
-                 ok 1 (Int32.to_int y#ns);
-                 ok 3 (Int32.to_int y#name);
-             | _  ->
-                 assert_failure "not qname")
-     ];
-   "method signature" >::
-     (fun () ->
-       match abc#methods with
-           [m] ->
-             ok [] m#param_types;
-             ok 0l m#return_type;
-             ok 1l m#name;
-             ok false m#need_activation;
-             ok false m#need_arguments;
-             ok false m#need_rest;
-             ok false m#set_dxns;
-             ok None  m#options;
-             ok None  m#param_names
-         | _   ->
-             assert_failure "over size");
-   "metadata test" >::
-     (fun () ->
-       ok [] abc#metadata);
-   "class and instance size has same size" >::
-     (fun () ->
-        ok (List.length abc#instances) (List.length abc#classes));
-   "instance" >::
-     (fun () ->
-       ok [] abc#instances);
-   "class" >::
-     (fun () ->
-       ok [] abc#classes);
-   "script" >::
-     (fun () ->
-       match abc#script with
-           [s] ->
-             ok 0l s#init;
-             ok [] s#traits
-         | _   ->
-             assert_failure "error");
-   "method body" >::
-     (fun () ->
-        match abc#method_body with
-           [m] ->
-             ok 0l m#methodi;
-             ok [] m#exceptions;
-             ok 1l m#local_count;
-             ok 0l m#init_scope_depth;
-             ok 1l m#max_scope_depth;
-             ok 2l m#max_stack;
-             ok [] m#traits;
-             flip ok m#code [
-               `GetLocal_0;
-               `PushScope;
-               `FindPropStrict 2l;
-               `PushString 2l;
-               `CallPropLex (2l,1l);
-               `Pop;
-               `ReturnVoid ]
-         | _   ->
-             assert_failure "error");
-   ]) +> run_test_tt_main
diff --git a/xml/byte.ml b/xml/byte.ml
deleted file mode 100644 (file)
index d172ac3..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-open Base
-
-let of_channel ch =
-  Stream.from (fun _ ->
-                try
-                  Some (input_byte ch)
-                with End_of_file ->
-                  None)
-
-let (++) x y =
-  (x lsl 8) + y
-
-let byte =
-  Stream.next
-
-let u8 =
-  parser [<c = byte>] -> c
-
-let u16 =
-  parser [<n2 = byte; n1 = byte >] ->
-    n1 ++ n2
-
-let size =
-  Sys.word_size - 24 - 1
-
-let s_extend d =
-  (d lsl size) asr size
-
-let s24 =
-  parser [<n3 = byte; n2 = byte; n1 = byte>] ->
-    s_extend (n1 ++ n2 ++ n3)
-
-let leq n stream =
-  match Stream.peek stream with
-      Some m when m <= n ->
-       Stream.next stream
-    | _ ->
-       raise Stream.Failure
-
-let (+++) x y =
-  Int32.logor (Int32.shift_left x 7) (Int32.logand y 0x7Fl)
-
-let rec read_u30 stream =
-  match stream with parser
-      [<n = leq 0x7F >] ->
-       Int32.of_int n
-    | [<n = byte>] ->
-       (read_u30 stream) +++ (Int32.of_int n)
-    | [<>] ->
-       raise (Stream.Error "invalid format")
-
-let u30 =
-  read_u30
-
-let u32 =
-  read_u30
-
-let s32 =
-  read_u30
-
-let d64 =
-  let shift_or x y =
-    Int64.logor (Int64.shift_left y 8) (Int64.of_int x) in
-    parser
-       [<d = Parsec.repeat 8 byte>] ->
-         Int64.float_of_bits @@ List.fold_right shift_or d 0L
-
-let sample () =
-  Stream.of_list @@ range 0 10
diff --git a/xml/byteTest.ml b/xml/byteTest.ml
deleted file mode 100644 (file)
index 5ff473d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-open OUnit
-open Base
-open Byte
-open TestSupport
-
-let of_list xs =
-  Stream.of_list xs
-
-let ok x y =
-  OUnit.assert_equal ~printer:Std.dump x y
-
-let tests = ("byte.ml" >::: [
-  "u8 is single byte" >::
-    (fun _ ->
-       ok 0 (u8 @@ of_list [0]));
-  "u16 is little endian" >::
-    (fun _ ->
-       ok 0x0100 (u16 @@ of_list [0;1] ));
-  "s24" >::
-    (fun _ ->
-       ok 0x000001 (s24 @@ of_list [1;0;0] );
-       ok ~-1 (s24 @@ of_list [0xFF;0xFF;0xFF] ));
-  "u30 is single byte when value < 0x7F" >::
-    (fun _ ->
-       ok 0l    (u30 @@ of_list [0]);
-       ok 0x7Fl (u30 @@ of_list [0x7F]));
-  "u30 is 2 bytes when value <= 0x7F 0xFF"  >::
-    (fun _ ->
-       ok 0xFFl    (u30 @@ of_list [0xFF;0x01]);
-       ok 0x3F_FFl (u30 @@ of_list [0xFF;0x7F]));
-  "u30 is 3 bytes when value <= 0x7F 0xFF 0xFF" >::
-    (fun _ ->
-       ok 0x7FFFl    (u30 @@ of_list [0xFF;0xFF;0x01]);
-       ok 0x1F_FFFFl (u30 @@ of_list [0xFF;0xFF;0x7F]));
-  "u30 is 4 bytes when value <= 0x7F 0xFF 0xFF 0xFF" >::
-    (fun _ ->
-       ok 0x003F_FFFFl (u30 @@ of_list [0xFF;0xFF;0xFF;0x01]);
-       ok 0x0FFF_FFFFl (u30 @@ of_list [0xFF;0xFF;0xFF;0x7F]));
-  "u30 is 5 bytes when value <= 0x7F 0xFF 0xFF 0xFF 0xFF" >::
-    (fun _ ->
-       ok 0x1FFF_FFFFl (u30 @@ of_list [0xFF;0xFF;0xFF;0xFF;0x01]);
-       ok 0xFFFF_FFFFl (u30 @@ of_list [0xFF;0xFF;0xFF;0xFF;0xF]));
-  "d64 is float(IEEE 754 format)" >::
-    (fun _ ->
-       ok 0.75 (d64 @@ of_list [0;0;0;0;0;0;0xe8;0x3f]))
-]) +> run_test_tt_main
index 6d6a3e4..7194d9c 100644 (file)
@@ -1,11 +1,18 @@
 open Base
 open EasyXml
 
+let label =
+  function
+      Left _ ->
+       failwith "must not happen"
+    | Right adr ->
+       adr
+
 let op name =
   attr name []
 
 let op_a name attrs =
-  attr name @@ List.map (fun (x,y) -> (x,Int32.to_string y)) attrs
+  attr name @@ List.map (fun (x,y) -> (x,string_of_int y)) attrs
 
 let op_i name attrs =
   attr name @@ List.map (fun (x,y) -> (x,string_of_int y)) attrs
@@ -45,8 +52,8 @@ let to_xml = function
       op_a "OpCallSuperVoid" ["name",name; "argc",argc]
   | `CheckFilter ->
       op "OpCheckFilter"
-  | `Coerce name ->
-      op_a "OpCoerce" ["name",name]
+  | `Coerce ->
+      op "OpCoerce"
   | `Coerce_a ->
       op "OpCoerceA"
   | `Coerce_s ->
@@ -141,31 +148,33 @@ let to_xml = function
   | `HasNext2 (object_reg,index_reg) ->
       op_a "OpHasNext2" ["object",object_reg;"index",index_reg]
   | `IfEq target ->
-      op_i "OpIfEq" ["target",target]
+      op_i "OpIfEq" ["target",label target]
   | `IfFalse target ->
-      op_i "OpIfFalse" ["target",target]
+      op_i "OpIfFalse" ["target",label target]
+  | `IfGe target ->
+      op_i "OpIfGe" ["target",label target]
   | `IfGt target ->
-      op_i "OpIfGt" ["target",target]
+      op_i "OpIfGt" ["target",label target]
   | `IfLe target ->
-      op_i "OpIfLe" ["target",target]
+      op_i "OpIfLe" ["target",label target]
   | `IfLt target ->
-      op_i "OpIfLt" ["target",target]
+      op_i "OpIfLt" ["target",label target]
   | `IfNge target ->
-      op_i "OpIfNge" ["target",target]
+      op_i "OpIfNge" ["target",label target]
   | `IfNgt target ->
-      op_i "OpIfNgt" ["target",target]
+      op_i "OpIfNgt" ["target",label target]
   | `IfNle target ->
-      op_i "OpIfNle" ["target",target]
+      op_i "OpIfNle" ["target",label target]
   | `IfNlt target ->
-      op_i "OpIfNgt" ["target",target]
+      op_i "OpIfNgt" ["target",label target]
   | `IfNe target ->
-      op_i "OpIfNe"  ["target",target]
+      op_i "OpIfNe"  ["target",label target]
   | `IfStrictEq target ->
-      op_i "OpIfStrictEq" ["target",target]
+      op_i "OpIfStrictEq" ["target",label target]
   | `IfStrictNe target ->
-      op_i "OpIfStrictNe" ["target",target]
+      op_i "OpIfStrictNe" ["target",label target]
   | `IfTrue target ->
-      op_i "OpIfTrue" ["target",target]
+      op_i "OpIfTrue" ["target",label target]
   | `In ->
       op "OpIn"
   | `IncLocal address ->
@@ -185,10 +194,10 @@ let to_xml = function
   | `IsTypeLate ->
       op "OpIsTypeLate"
   | `Jump target ->
-      op_i "OpJump" ["target",target]
+      op_i "OpJump" ["target",label target]
   | `Kill address ->
       op_a "OpKill" ["address",address]
-  | `Label ->
+  | `Label ->
       op "OpLabel"
   | `LessEquals ->
       op "OpLessEquals"
@@ -240,6 +249,8 @@ let to_xml = function
       op_a "OpPushDouble" ["index",index]
   | `PushFalse ->
       op "OpPushFalse"
+  | `PushNaN ->
+      op "OpPushNaN"
   | `PushInt index ->
       op_a "OpPushInt" ["index",index]
   | `PushNamespace index ->
@@ -302,4 +313,4 @@ let to_xml = function
       op "OpTypeOf"
   | `URShift ->
       op "OpURShift"
-       
+
diff --git a/xml/disasm.ml b/xml/disasm.ml
deleted file mode 100644 (file)
index b0dd4a1..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-open Base
-open Byte
-
-let op n stream =
-  match Stream.peek stream with
-      Some m when m = n ->
-       Stream.next stream
-    | _ ->
-       raise Stream.Failure
-
-let code =
-  parser
-      [< _ = op 0xc5 >] ->
-       `Add_i
-    | [< _ = op 0x86; index = u30 >] ->
-       `AsType index
-    | [< _ = op 0x87 >] ->
-       `AsTypeLate
-    | [< _ = op 0xa8 >] ->
-       `BitAnd
-    | [< _ = op 0x97 >] ->
-       `BitNot
-    | [< _ = op 0xa9 >] ->
-       `BitOr
-    | [< _ = op 0xaa >] ->
-       `BitXor
-    | [< _ = op 0x41; arg_count = u30 >] ->
-       `Call arg_count
-    | [< _ = op 0x43; index = u30; arg_count = u30 >] ->
-       `CallMethod (index,arg_count)
-    | [< _ = op 0x46; index = u30; arg_count = u30 >] ->
-       `CallProperty (index,arg_count)
-    | [< _ = op 0x4c; index = u30; arg_count = u30 >] ->
-       `CallPropLex (index,arg_count)
-    | [< _ = op 0x4f; index = u30; arg_count = u30 >] ->
-       `CallPropVoid (index,arg_count)
-    | [< _ = op 0x44; index = u30; arg_count = u30 >] ->
-       `CallStatic (index,arg_count)
-    | [< _ = op 0x45; index = u30; arg_count = u30 >] ->
-       `CallSuper (index,arg_count)
-    | [< _ = op 0x4e; index = u30; arg_count = u30 >] ->
-       `CallSuperVoid (index,arg_count)
-    | [< _ = op 0x78 >] ->
-       `CheckFilter
-    | [< _ = op 0x80; index = u30 >] ->
-       `Coerce index
-    | [< _ = op 0x82 >] ->
-       `Coerce_a
-    | [< _ = op 0x85 >] ->
-       `Coerce_s
-    | [< _ = op 0x42; arg_count = u30 >] ->
-       `Construct arg_count
-    | [< _ = op 0x4a; index = u30; arg_count = u30 >] ->
-       `ConstructProp (index,arg_count)
-    | [< _ = op 0x49; arg_count = u30 >] ->
-       `ConstructSuper arg_count
-    | [< _ = op 0x76 >] ->
-       `Convert_b
-    | [< _ = op 0x73 >] ->
-       `Convert_i
-    | [< _ = op 0x75 >] ->
-       `Convert_d
-    | [< _ = op 0x77 >] ->
-       `Convert_o
-    | [< _ = op 0x74 >] ->
-       `Convert_u
-    | [< _ = op 0x70 >] ->
-       `Convert_s
-    | [< _ = op 0xef; debug_type = u8; index = u30; reg = u8; extra = u30 >] ->
-       `Debug (debug_type,index,reg,extra)
-    | [< _ = op 0xf1; index = u30 >] ->
-       `DebugFile index
-    | [< _ = op 0xf0; linenum = u30 >] ->
-       `DebugLine linenum
-    | [< _ = op 0x94; index = u30 >] ->
-       `DecLocal index
-    | [< _ = op 0xc3; index = u30 >] ->
-       `DecLocal_i index
-    | [< _ = op 0x93 >] ->
-       `Decrement
-    | [< _ = op 0xc1 >] ->
-       `Decrement_i
-    | [< _ = op 0x6a; name = u30 >] ->
-       `DeleteProperty name
-    | [< _ = op 0xa3 >] ->
-       `Divide
-    | [< _ = op 0x2a >] ->
-       `Dup
-    | [< _ = op 0x06; string = u30 >] ->
-       `Dxns string
-    | [< _ = op 0x07 >] ->
-       `DxnsLate
-    | [< _ = op 0xab >] ->
-       `Equals
-    | [< _ = op 0x72 >] ->
-       `Esc_xattr
-    | [< _ = op 0x71 >] ->
-       `Esc_xelem
-    | [< _ = op 0x5f; _ = u30 >] ->
-       failwith "finddef: undocumented instruction"
-    | [< _ = op 0x5e; name = u30 >] ->
-       `FindProperty name
-    | [< _ = op 0x5d; name = u30 >] ->
-       `FindPropStrict name
-    | [< _ = op 0x59; name = u30 >] ->
-       `GetDescendants name
-    | [< _ = op 0x64 >] ->
-       `GetGlobalScope
-    | [< _ = op 0x6e; slot_id = u30 >] ->
-       `GetGlobalSlot slot_id
-    | [< _ = op 0x60; name = u30 >] ->
-       `GetLex name
-    | [< _ = op 0x62; index = u30 >] ->
-       `GetLocal index
-    | [< _ = op 0xD0 >] ->
-       `GetLocal_0
-    | [< _ = op 0xD1 >] ->
-       `GetLocal_1
-    | [< _ = op 0xD2 >] ->
-       `GetLocal_2
-    | [< _ = op 0xD3 >] ->
-       `GetLocal_3
-    | [< _ = op 0x66; name = u30 >] ->
-       `GetProperty name
-    | [< _ = op 0x65; index = u8 >] ->
-       `GetScopeObject index
-    | [< _ = op 0x6c; slot_id = u30 >] ->
-       `GetSlot slot_id
-    | [< _ = op 0x04; name = u30 >] ->
-       `GetSuper name
-    | [< _ = op 0xb0 >] ->
-       `GreaterEquals 
-    | [< _ = op 0xaf >] ->
-       `GreaterThan
-    | [< _ = op 0x1f >] ->
-       `HasNext
-    | [< _ = op 0x32; object_reg = u32; index_reg = u32 >] ->
-       `HasNext2 (object_reg,index_reg)
-    | [< _ = op 0x13; offset = s24 >] ->
-       `IfEq offset
-    | [< _ = op 0x12; offset = s24 >] ->
-       `IfFalse offset
-    | [< _ = op 0x17; offset = s24 >] ->
-       `IfGt offset
-    | [< _ = op 0x16; offset = s24 >] ->
-       `IfLe offset
-    | [< _ = op 0x15; offset = s24 >] ->
-       `IfLt offset
-    | [< _ = op 0x15; offset = s24 >] ->
-       `IfLt offset
-    | [< _ = op 0x0f; offset = s24 >] ->
-       `IfNge offset
-    | [< _ = op 0x0e; offset = s24 >] ->
-       `IfNgt offset
-    | [< _ = op 0x0d; offset = s24 >] ->
-       `IfNle offset
-    | [< _ = op 0x0c; offset = s24 >] ->
-       `IfNlt offset
-    | [< _ = op 0x14; offset = s24 >] ->
-       `IfNe offset
-    | [< _ = op 0x19; offset = s24 >] ->
-       `IfStrictEq offset
-    | [< _ = op 0x1a; offset = s24 >] ->
-       `IfStrictNe offset
-    | [< _ = op 0x11; offset = s24 >] ->
-       `IfTrue offset
-    | [< _ = op 0xb4 >] ->
-       `In
-    | [< _ = op 0x92; index = u30 >] ->
-       `IncLocal index
-    | [< _ = op 0xc2; index = u30 >] ->
-       `IncLocal_i index
-    | [< _ = op 0x91 >] ->
-       `Increment
-    | [< _ = op 0xc0 >] ->
-       `Increment_i
-    | [< _ = op 0x68; index = u30 >] ->
-       `InitProperty index
-    | [< _ = op 0xb1 >] ->
-       `InstanceOf
-    | [< _ = op 0xb2; index = u30 >] ->
-       `IsType index
-    | [< _ = op 0xb3 >] ->
-       `IsTypeLate
-    | [< _ = op 0x10; offset = s24 >] ->
-       `Jump offset
-    | [< _ = op 0x08; index = u30 >] ->
-       `Kill index
-    | [< _ = op 0x09 >] ->
-       `Label
-    | [< _ = op 0xae >] ->
-       `LessEquals
-    | [< _ = op 0xad >] ->
-       `LessThan
-    | [< _ = op 0x1b; 
-        default_offset = s24; 
-        case_count = u30; 
-        case_offsets = Parsec.repeat_l (Int32.add case_count 1l) s24 >] ->
-       `LookupSwitch (default_offset,case_offsets)
-    | [< _ = op 0xa5 >] ->
-       `LShift
-    | [< _ = op 0xa4 >] ->
-       `Modulo
-    | [< _ = op 0xa2 >] ->
-       `Multiply
-    | [< _ = op 0xc7 >] ->
-       `Multiply_i
-    | [< _ = op 0x90 >] ->
-       `Negate
-    | [< _ = op 0xc4 >] ->
-       `Negate_i
-    | [< _ = op 0x57 >] ->
-       `NewActivation
-    | [< _ = op 0x56; arg_count = u30 >] ->
-       `NewArray arg_count
-    | [< _ = op 0x5a; index = u30 >] ->
-       `NewCatch index
-    | [< _ = op 0x58; index = u30 >] ->
-       `NewClass index
-    | [< _ = op 0x40; index = u30 >] ->
-       `NewFunction index
-    | [< _ = op 0x55; arg_count = u30 >] ->
-       `NewObject arg_count
-    | [< _ = op 0x1e >] ->
-       `NextName
-    | [< _ = op 0x23 >] ->
-       `NextValue
-    | [< _ = op 0x02 >] ->
-       `Nop
-    | [< _ = op 0x96 >] ->
-       `Not
-    | [< _ = op 0x29 >] ->
-       `Pop
-    | [< _ = op 0x1d >] ->
-       `PopScope
-    | [< _ = op 0x24; byte_value = u8 >] ->
-       `PushByte byte_value
-    | [< _ = op 0x2f; index = u30 >] ->
-       `PushDouble index
-    | [< _ = op 0x27 >] ->
-       `PushFalse
-    | [< _ = op 0x2d; index = u30 >] ->
-       `PushInt index
-    | [< _ = op 0x31; index = u30 >] ->
-       `PushNamespace index
-    | [< _ = op 0x28 >] ->
-       `PushNan
-    | [< _ = op 0x20 >] ->
-       `PushNull
-    | [< _ = op 0x30 >] ->
-       `PushScope
-    | [< _ = op 0x25; value = u30 >] ->
-       `PushShort value
-    | [< _ = op 0x2c; index = u30 >] ->
-       `PushString index
-    | [< _ = op 0x26 >] ->
-       `PushTrue
-    | [< _ = op 0x2e; index = u30 >] ->
-       `PushUInt index
-    | [< _ = op 0x21 >] ->
-       `PushUndefined
-    | [< _ = op 0x1c >] ->
-       `PushWith
-    | [< _ = op 0x48 >] ->
-       `ReturnValue
-    | [< _ = op 0x47 >] ->
-       `ReturnVoid
-    | [< _ = op 0xa6 >] ->
-       `RShift
-    | [< _ = op 0x63; index = u30 >] ->
-       `SetLocal index
-    | [< _ = op 0xd4 >] ->
-       `SetLocal_0
-    | [< _ = op 0xd5 >] ->
-       `SetLocal_1
-    | [< _ = op 0xd6 >] ->
-       `SetLocal_2
-    | [< _ = op 0xd7 >] ->
-       `SetLocal_3
-    | [< _ = op 0x6f; slot_index = u30 >] ->
-       `SetGlobalSlot slot_index
-    | [< _ = op 0x61; index = u30 >] ->
-       `SetProperty index
-    | [< _ = op 0x6d; slot_index = u30 >] ->
-       `SetSlot slot_index
-    | [< _ = op 0x05; index = u30 >] ->
-       `SetSuper index
-    | [< _ = op 0xac >] ->
-       `StrictEquals
-    | [< _ = op 0xa1 >] ->
-       `Subtract
-    | [< _ = op 0xc6 >] ->
-       `Subtract_i
-    | [< _ = op 0x2b >] ->
-       `Swap
-    | [< _ = op 0x03 >] ->
-       `Throw
-    | [< _ = op 0x95 >] ->
-       `TypeOf
-    | [< _ = op 0xa7 >] ->
-       `URShift