mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 06:31:27 +00:00
parser.j now generate both header and implementation files
This commit is contained in:
@@ -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 <Foundation/Foundation.h>\n" +
|
||||
"#import <Cocoa/Cocoa.h>\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
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user