OSDN Git Service

Update driver
authormzp <mzpppp@gmail.com>
Sun, 7 Jun 2009 11:50:06 +0000 (20:50 +0900)
committermzp <mzpppp@gmail.com>
Sun, 7 Jun 2009 11:50:06 +0000 (20:50 +0900)
- change default Main class: Main -> main.Main
- add --no_std option

driver/src/cmdOpt.ml
driver/src/cmdOpt.mli
driver/src/main.ml
lib/habc/OMakefile

index 41117eb..5526f42 100644 (file)
@@ -5,8 +5,9 @@ type output_type =
     Ho | Abc | Abcx | Swfx | Swf
 
 type scm = {
-  scm_cmd:    string;
-  includes: string
+  scm_cmd:  string;
+  includes: string;
+  link_std: bool
 }
 
 type abc = {
@@ -85,6 +86,11 @@ let scm =
       ~metavar:"<dir ..>"
       ~short_name:'I'
       ~help:"Add <dir ..> to the list of include directories" () in
+  let no_std =
+    bool_option
+      ~default:true
+      ~long_name:"no_std"
+      ~help:"without std library" () in
   let default =
     Config.default_includes
     +> List.filter Sys.file_exists
@@ -92,6 +98,7 @@ let scm =
     fun () -> {
       scm_cmd  = Opt.get cmd;
       includes = default ^ Config.path_sep ^ Opt.get includes;
+      link_std = Opt.get no_std
     }
 
 let abc =
@@ -134,10 +141,10 @@ let abcx =
       ~help:"stage background color" () in
   let main_class =
     str_option
-      ~default:"Main"
+      ~default:"main.Main"
       ~metavar:"<class>"
       ~long_name:"main_class"
-      ~help:"Main Class of swf" () in
+      ~help:"Specify main Class of swf(e.g. main.Main)" () in
   let template =
     str_option
       ~default:Config.default_template
index 3919f64..f76e44d 100644 (file)
@@ -1,5 +1,13 @@
-type scm = { scm_cmd : string; includes : string; }
-type abc = { abc_cmd : string; }
+type scm = {
+  scm_cmd : string;
+  includes : string;
+  link_std:bool
+}
+
+type abc = {
+  abc_cmd : string;
+}
+
 type abcx = {
   abcx_cmd : string;
   template : string;
index 4bfe24d..8a5dd0a 100644 (file)
@@ -11,13 +11,17 @@ let m4_opt xs =
 
 let rules = [
   one_to_one "scm" "ho"
-    (fun {scm = {scm_cmd=scm_cmd; includes=includes}} input output ->
-       [Printf.sprintf "%s -c -I %s -o %s %s"
-         scm_cmd includes output input ]);
+    (fun {scm = {scm_cmd=scm_cmd; includes=includes; link_std=link_std}} input output ->
+       [Printf.sprintf "%s -c -I %s -o %s %s %s"
+         scm_cmd includes output
+         (if link_std then "std.ho" else "")
+         input ]);
   many_to_one ["scm"] "abc"
-    (fun {scm = {scm_cmd=scm_cmd; includes=includes}} inputs output ->
-       [Printf.sprintf "%s -I %s -o %s %s"
-         scm_cmd includes output @@ String.concat " " inputs ]);
+    (fun {scm = {scm_cmd=scm_cmd; includes=includes;link_std=link_std}} inputs output ->
+       [Printf.sprintf "%s -I %s -o %s %s %s"
+         scm_cmd includes output
+         (if link_std then "std.ho" else "")
+       @@ String.concat " " inputs ]);
   many_to_one ["scm";"ho"] "abc"
     (fun {scm = {scm_cmd=scm_cmd; includes=includes}} inputs output ->
        [Printf.sprintf "%s -I %s -o %s %s"
@@ -58,7 +62,7 @@ let debug verbose str =
   end
 
 let system {general={verbose=verbose}} cmd =
-  let cmd' = 
+  let cmd' =
     Str.global_replace (Str.regexp "\\\\") "/" cmd in
     debug verbose cmd';
     Unix.system cmd'
index 9de64fc..5bc67d1 100644 (file)
@@ -11,7 +11,7 @@ LIBS=$(addsuffix .ho,$(FILES))
 lib: $(LIBS)
 
 %.ho : %.scm $(ROOT)/habc$(EXE) $(ROOT)/habc-scm$(EXE)
-       $(ROOT)/habc$(EXE) --scm=$(absname $(ROOT)/habc-scm$(EXE)) -I . -c $<
+       $(ROOT)/habc$(EXE) --scm=$(absname $(ROOT)/habc-scm$(EXE)) --no_std -I . -c $<
 
 clean:
        ocaml-clean *.ho