チェンジセット 1964
- コミット日時:
- 2008/12/05 08:28:57 (3 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
ocaml/abc2xml/trunk/classdump/main.ml
r1958 r1964 7 7 match List.nth cpool#namespace @@ (Int32.to_int i - 1) with 8 8 `ExplicitNamespace i -> 9 Printf.sprintf " explicit %s" @@ string cpool i9 Printf.sprintf "[explicit %s]" @@ string cpool i 10 10 | `Namespace i -> 11 11 Printf.sprintf "%s" @@ string cpool i 12 12 | `PackageInternaNs i -> 13 Printf.sprintf " internal %s" @@ string cpool i13 Printf.sprintf "[internal %s]" @@ string cpool i 14 14 | `PackageNamespace i -> 15 Printf.sprintf " package%s" @@ string cpool i15 Printf.sprintf "%s" @@ string cpool i 16 16 | `PrivateNs i -> 17 Printf.sprintf " private %s" @@ string cpool i17 Printf.sprintf "[private %s]" @@ string cpool i 18 18 | `ProtectedNamespace i -> 19 Printf.sprintf " protected %s" @@ string cpool i19 Printf.sprintf "[protected %s]" @@ string cpool i 20 20 | `StaticProtectedNs i -> 21 Printf.sprintf " static protected %s" @@ string cpool i21 Printf.sprintf "[static protected %s]" @@ string cpool i 22 22 23 23 let namespace_set cpool i = … … 28 28 match List.nth cpool#multiname @@ Int32.to_int i - 1 with 29 29 `QName obj -> 30 Printf.sprintf "%s ::%s" (namespace cpool obj#ns) (string cpool obj#name)30 Printf.sprintf "%s.%s" (namespace cpool obj#ns) (string cpool obj#name) 31 31 | `Multiname obj -> 32 Printf.sprintf "%s ::%s" (namespace_set cpool obj#ns_set) (string cpool obj#name)32 Printf.sprintf "%s.%s" (namespace_set cpool obj#ns_set) (string cpool obj#name) 33 33 | _ -> 34 34 failwith "not yet" 35 36 let method_info abc i = 37 let m = 38 List.nth abc#methods @@ Int32.to_int i in 39 multiname abc#constant_pool m#name 40 41 let method_trait trait = 42 match trait#data with 43 `Method obj 44 | `Getter obj 45 | `Setter obj -> 46 [obj#methodi] 47 | _ -> 48 [] 49 50 51 let instance_list abc = 52 let cpool = 53 abc#constant_pool in 54 List.map (fun i -> (multiname cpool i#name, 55 List.map (fun t -> multiname cpool t#name) i#traits)) 56 abc#instances 35 57 36 58 let dump file = 37 59 let abc = 38 60 Abc.of_stream @@ Byte.of_channel @@ open_in_bin file in 39 let cpool = 40 abc#constant_pool in 41 List.map (fun i -> multiname cpool i#name) abc#instances 61 instance_list abc 42 62 43 63 let _ = … … 46 66 match argv with 47 67 _::xs -> 48 xs +> List.iter (List.iter print_endline $ dump) 68 List.iter (List.iter (fun (klass,methods)-> 69 Printf.printf "(%s (%s))\n" klass @@ String.concat " " methods) $ dump) xs 49 70 | [] -> 50 71 failwith "must not happen"

