소스 검색

minor commandline flags changes (added -debug).

Nicolas Cannasse 19 년 전
부모
커밋
d185e3f9cb
3개의 변경된 파일8개의 추가작업 그리고 7개의 파일을 삭제
  1. 5 4
      genneko.ml
  2. 1 1
      genswf9.ml
  3. 2 2
      main.ml

+ 5 - 4
genneko.ml

@@ -620,7 +620,7 @@ let gen_name ctx acc t =
 
 
 let generate file types hres =
 let generate file types hres =
 	let ctx = {
 	let ctx = {
-		methods = Plugin.defined "neko_methods";
+		methods = Plugin.defined "debug";
 		curclass = "$boot";
 		curclass = "$boot";
 		curmethod = "$init";
 		curmethod = "$init";
 		inits = [];
 		inits = [];
@@ -642,13 +642,14 @@ let generate file types hres =
 	let e = (EBlock (header :: packs @ methods @ boot :: names @ inits @ vars), null_pos) in
 	let e = (EBlock (header :: packs @ methods @ boot :: names @ inits @ vars), null_pos) in
 	let neko_file = Filename.chop_extension file ^ ".neko" in
 	let neko_file = Filename.chop_extension file ^ ".neko" in
 	let ch = IO.output_channel (open_out neko_file) in
 	let ch = IO.output_channel (open_out neko_file) in
-	(if !Plugin.verbose then Nxml.write_fmt else Nxml.write) ch (Nxml.to_xml e);
+	let source = Plugin.defined "neko_source" in
+	(if source then Nxml.write_fmt else Nxml.write) ch (Nxml.to_xml e);
 	IO.close_out ch;
 	IO.close_out ch;
 	let command cmd = try Sys.command cmd with _ -> -1 in
 	let command cmd = try Sys.command cmd with _ -> -1 in
-	if !Plugin.verbose then begin
+	if source then begin
 		if command ("nekoc -p " ^ neko_file) <> 0 then failwith "Failed to print neko code";
 		if command ("nekoc -p " ^ neko_file) <> 0 then failwith "Failed to print neko code";
 		Sys.remove neko_file;
 		Sys.remove neko_file;
 		Sys.rename (Filename.chop_extension file ^ "2.neko") neko_file;
 		Sys.rename (Filename.chop_extension file ^ "2.neko") neko_file;
 	end;
 	end;
 	if command ("nekoc " ^ neko_file) <> 0 then failwith "Neko compilation failure";
 	if command ("nekoc " ^ neko_file) <> 0 then failwith "Neko compilation failure";
-	if not !Plugin.verbose then Sys.remove neko_file
+	if not source then Sys.remove neko_file

+ 1 - 1
genswf9.ml

@@ -1347,7 +1347,7 @@ let generate types hres =
 		curblock = [];
 		curblock = [];
 		block_vars = [];
 		block_vars = [];
 		in_static = false;
 		in_static = false;
-		debug = Plugin.defined "flash_debug";
+		debug = Plugin.defined "debug";
 		last_line = -1;
 		last_line = -1;
 	} in
 	} in
 	List.iter (generate_type ctx) types;
 	List.iter (generate_type ctx) types;

+ 2 - 2
main.ml

@@ -225,6 +225,7 @@ try
 			) lines) @ !excludes;
 			) lines) @ !excludes;
 		),"<filename> : don't generate code for classes listed in this file");
 		),"<filename> : don't generate code for classes listed in this file");
 		("-v",Arg.Unit (fun () -> Plugin.verbose := true),": turn on verbose mode");
 		("-v",Arg.Unit (fun () -> Plugin.verbose := true),": turn on verbose mode");
+		("-debug", define "debug", ": add debug informations to the compiled code");
 		("-prompt", Arg.Unit (fun() -> prompt := true),": prompt on error");
 		("-prompt", Arg.Unit (fun() -> prompt := true),": prompt on error");
 		("-cmd", Arg.String (fun cmd ->
 		("-cmd", Arg.String (fun cmd ->
 			cmds := cmd :: !cmds
 			cmds := cmd :: !cmds
@@ -235,8 +236,7 @@ try
 		),": ensure that overriden methods are declared with 'override'");
 		),": ensure that overriden methods are declared with 'override'");
 		("--no-traces", define "no_traces", ": don't compile trace calls in the program");
 		("--no-traces", define "no_traces", ": don't compile trace calls in the program");
 		("--flash-use-stage", define "flash_use_stage", ": place objects found on the stage of the SWF lib");
 		("--flash-use-stage", define "flash_use_stage", ": place objects found on the stage of the SWF lib");
-		("--flash-debug", define "flash_debug", ": add debug informations to the generated SWF");
-		("--neko-methods", define "neko_methods", ": use class+method instead of filename in neko debug infos");
+		("--neko-source", define "neko_source", ": keep generated neko source");
 		("--gen-hx-classes", Arg.String (fun file ->
 		("--gen-hx-classes", Arg.String (fun file ->
 			gen_hx := true;
 			gen_hx := true;
 			Genswf9.genhx file
 			Genswf9.genhx file