diff --git a/Foundation/CPData.j b/Foundation/CPData.j index a418362e4..e5c339a83 100644 --- a/Foundation/CPData.j +++ b/Foundation/CPData.j @@ -70,6 +70,11 @@ return self; } +- (id)initWithString:(CPString)aString +{ + return [self initWithSerializedPlistObject:aPlistObject]; +} + - (id)initWithSerializedPlistObject:(id)aPlistObject { self = [super init]; @@ -90,6 +95,16 @@ return self; } +- (void)setString:(CPString)aString +{ + return [self setSerializedPlistObject:aString]; +} + +- (CPString)string +{ + return [self serializedPlistObject]; +} + - (int)length { return [[self encodedString] length]; diff --git a/Objective-J/CFPropertyList.js b/Objective-J/CFPropertyList.js index 9bddee856..4082f9cda 100644 --- a/Objective-J/CFPropertyList.js +++ b/Objective-J/CFPropertyList.js @@ -66,9 +66,9 @@ CFPropertyList.readPropertyListFromFile = function(/*String*/ aFilePath) return CFPropertyList.propertyListFromString(FILE.read(aFilePath, { charset:"UTF-8" })); } -CFPropertyList.writePropertyListToFile = function(/*CFPropertyList*/ aPropertyList, /*String*/ aFilePath) +CFPropertyList.writePropertyListToFile = function(/*CFPropertyList*/ aPropertyList, /*String*/ aFilePath, /*Format*/ aFormat) { - return FILE.write(aFilePath, CFPropertyList.stringFromPropertyList(aPropertyList), { charset:"UTF-8" }); + return FILE.write(aFilePath, CFPropertyList.stringFromPropertyList(aPropertyList, aFormat), { charset:"UTF-8" }); } #endif diff --git a/Objective-J/Preprocessor.js b/Objective-J/Preprocessor.js index 3323cf412..8223229b4 100644 --- a/Objective-J/Preprocessor.js +++ b/Objective-J/Preprocessor.js @@ -146,6 +146,13 @@ function preprocess(/*String*/ aString, /*String*/ aPath, /*unsigned*/ flags) return new Preprocessor(aString, aPath, flags).executable(); } +objj_preprocess = preprocess; + +objj_eval = function(/*String*/ aString) +{ + return eval(objj_preprocess(aString).code()); +} + function Preprocessor(/*String*/ aString, /*String*/ aPath, /*unsigned*/ flags) { // Remove the shebang.