diff --git a/Tools/XcodeCapp/parser.j b/Tools/XcodeCapp/parser.j index ba35a1336..5a808cbe5 100644 --- a/Tools/XcodeCapp/parser.j +++ b/Tools/XcodeCapp/parser.j @@ -26,7 +26,8 @@ var FILE = require("file"); function main(args) { var fileURL = new CFURL(args[1]), - outputURL = new CFURL(args[2]), + outputHeaderURL = new CFURL(args[2]), + outputSourceURL = new CFURL(args[3]), source = FILE.read(fileURL, { charset: "UTF-8" }), flags = ObjectiveJ.Preprocessor.Flags.IncludeDebugSymbols | ObjectiveJ.Preprocessor.Flags.IncludeTypeSignatures, @@ -65,7 +66,8 @@ function main(args) eval(source); - var ObjectiveCSource = ""; + var ObjectiveCSource = "", + ObjectiveCHeader = ""; classes.forEach(function(aClass) { @@ -104,7 +106,7 @@ function main(args) var className = class_getName(aClass), superClassName = superClasses[className]; - ObjectiveCSource += + ObjectiveCHeader += "#import \n" + "#import \n" + "#import \"xcc_general_include.h\"\n" + @@ -114,13 +116,19 @@ function main(args) outlets.join("\n") + "\n" + actions.join("\n") + - "\n@end\n\n"+ + "\n@end\n"; + + ObjectiveCSource += + "#import \"" + outputHeaderURL.absoluteString().replace(/\\/g,'/').replace( /.*\//, '' ) + "\"" + "\n@implementation " + class_getName(aClass) + "\n@end\n"; }); if (ObjectiveCSource.length) - FILE.write(outputURL, ObjectiveCSource, { charset:"UTF-8" }); + FILE.write(outputSourceURL, ObjectiveCSource, { charset:"UTF-8" }); + + if (ObjectiveCHeader.length) + FILE.write(outputHeaderURL, ObjectiveCHeader, { charset:"UTF-8" }); } function NSCompatibleClassName(aClassName, asPointer) @@ -487,4 +495,4 @@ var NSClasses = { "NSWindowController" : YES, "NSWorkspace" : YES, "NSPopover": YES - }; \ No newline at end of file + };