From: mzp Date: Sun, 11 Oct 2009 05:47:27 +0000 (+0900) Subject: Fix: CmdOpt default value & Template X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=6bc085ee55e118d50300b66bd2e13d77e5797415;p=happyabc%2Fhappyabc.git Fix: CmdOpt default value & Template --- diff --git a/link/cmdOpt.ml b/link/cmdOpt.ml index 288b6f3..69585c6 100644 --- a/link/cmdOpt.ml +++ b/link/cmdOpt.ml @@ -35,7 +35,7 @@ let width = let height = int_option - ~default:600 + ~default:(20 * 600) ~metavar:"" ~short_name:'H' ~long_name:"height" @@ -43,7 +43,7 @@ let height = let main_class = str_option - ~default:"Main" + ~default:"boot.Boot" ~metavar:"" ~short_name:'m' ~long_name:"main" @@ -80,7 +80,7 @@ let blue = let parse argv = let inputs = - OptParser.parse opt_parser argv in + OptParser.parse ~first:1 opt_parser argv in inputs,{| color = (Opt.get red, Opt.get green, Opt.get blue); main_class = Opt.get main_class; diff --git a/link/cmdOptTest.ml b/link/cmdOptTest.ml index 7f028ca..52525d5 100644 --- a/link/cmdOptTest.ml +++ b/link/cmdOptTest.ml @@ -4,12 +4,14 @@ open CmdOpt open ExtString let ok x f y = - assert_equal ~printer:Std.dump x @@ f @@ snd @@ parse @@ Array.of_list @@ String.nsplit y " " + let argv = + Array.of_list @@ String.nsplit ("./foo " ^ y) " " in + assert_equal ~printer:Std.dump x @@ f @@ snd @@ parse argv let _ = begin "cmdOpt.ml" >::: [ "filename" >:: begin fun () -> - assert_equal ["foo"] @@ fst @@ parse [| "foo" |]; - assert_equal ["foo"; "bar"] @@ fst @@ parse [| "foo"; "bar" |] + assert_equal ["foo"] @@ fst @@ parse [| "./foo"; "foo" |]; + assert_equal ["foo"; "bar"] @@ fst @@ parse [| "./foo"; "foo"; "bar" |] end; "size" >:: begin fun () -> ok (100,200) (fun t -> t#size) "-W 100 -H 200"; @@ -19,12 +21,12 @@ let _ = begin "cmdOpt.ml" >::: [ ok (1,2,3) (fun t -> t#color) "--red=1 --green=2 --blue=3" end; "main class" >:: begin fun () -> - ok "Main" (fun t -> t#main_class) ""; - ok "foo" (fun t -> t#main_class) "-m foo"; - ok "foo" (fun t -> t#main_class) "--main=foo" + ok "boot.Boot" (fun t -> t#main_class) ""; + ok "foo" (fun t -> t#main_class) "-m foo"; + ok "foo" (fun t -> t#main_class) "--main=foo" end; "out" >:: begin fun () -> - ok "a.swf" (fun t -> t#output) ""; + ok "a.swf" (fun t -> t#output) ""; ok "foo.swf" (fun t -> t#output) "-o foo.swf"; ok "foo.swf" (fun t -> t#output) "--output=foo.swf" end; diff --git a/link/template.ml b/link/template.ml index 8bdb30b..901ab0d 100644 --- a/link/template.ml +++ b/link/template.ml @@ -13,11 +13,12 @@ let make t abc : TagOut.t SwfType.t = { bottom = snd t#size; }; tags = [ - `FileAttributes { TagOut.is_as3=true; is_metadata=false; use_network=true }; + `FileAttributes { TagOut.is_as3=true; is_metadata=true; use_network=true }; `SetBackgroundColor t#color; `FrameLabel (t#main_class,false); `DoABC(true,"frame",abc); - `SymbolClass [(0, t#main_class)] + `SymbolClass [(0, t#main_class)]; + `ShowFrame; + `End ] } -