mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-02 03:08:22 +00:00
Merge branch 'master' of git://github.com/280north/cappuccino
This commit is contained in:
commit
7522751fd2
38 files changed
+761
-645
No files matched your search
@@ -207,11 +207,11 @@ if (USER_AGENT.indexOf("Mac") !== -1)
|
||||
|
||||
CPPlatformActionKeyMask = CPCommandKeyMask;
|
||||
|
||||
CPUndoKeyEquivalent = @"Z";
|
||||
CPUndoKeyEquivalent = @"z";
|
||||
CPRedoKeyEquivalent = @"Z";
|
||||
|
||||
CPUndoKeyEquivalentModifierMask = CPCommandKeyMask;
|
||||
CPRedoKeyEquivalentModifierMask = CPCommandKeyMask | CPShiftKeyMask;
|
||||
CPRedoKeyEquivalentModifierMask = CPCommandKeyMask;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -220,8 +220,8 @@ else
|
||||
|
||||
CPPlatformActionKeyMask = CPControlKeyMask;
|
||||
|
||||
CPUndoKeyEquivalent = @"Z";
|
||||
CPRedoKeyEquivalent = @"Y";
|
||||
CPUndoKeyEquivalent = @"z";
|
||||
CPRedoKeyEquivalent = @"y";
|
||||
|
||||
CPUndoKeyEquivalentModifierMask = CPControlKeyMask;
|
||||
CPRedoKeyEquivalentModifierMask = CPControlKeyMask;
|
||||
|
||||
@@ -93,7 +93,7 @@ var _CPMenuBarVisible = NO,
|
||||
|
||||
+ (void)setMenuBarVisible:(BOOL)menuBarShouldBeVisible
|
||||
{
|
||||
if (_CPMenuBarVisible == menuBarShouldBeVisible)
|
||||
if (_CPMenuBarVisible === menuBarShouldBeVisible)
|
||||
return;
|
||||
|
||||
_CPMenuBarVisible = menuBarShouldBeVisible;
|
||||
|
||||
@@ -83,7 +83,7 @@ var _CPCibCustomResourceClassNameKey = @"_CPCibCustomResourceClassNameKey",
|
||||
if ([aCoder respondsToSelector:@selector(bundle)] &&
|
||||
(![aCoder respondsToSelector:@selector(awakenCustomResources)] || [aCoder awakenCustomResources]))
|
||||
if (_className === @"CPImage")
|
||||
return [[CPImage alloc] initWithContentsOfFile:[[aCoder bundle] pathForResource:_resourceName] size:[_properties objectForKey:@"size"]];
|
||||
return [[CPImage alloc] initWithContentsOfFile:[[aCoder bundle] pathForResource:_resourceName] size:_properties.valueForKey(@"size")];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+10
-6
@@ -238,7 +238,7 @@ function pressEnvironment(rootPath, outputFiles, environment, options) {
|
||||
total++;
|
||||
totalBytes += aFileExecutable.code().length
|
||||
}, this);
|
||||
stream.print(sprintf(
|
||||
stream.print(ObjectiveJ.sprintf(
|
||||
"Saved \0green(%f%%\0) (\0blue(%s\0)); Total required files: \0magenta(%d\0) (\0blue(%s\0)) of \0magenta(%d\0) (\0blue(%s\0));",
|
||||
Math.round(((includedBytes - totalBytes) / totalBytes) * -100),
|
||||
bytesToString(totalBytes - includedBytes),
|
||||
@@ -270,13 +270,17 @@ function pressEnvironment(rootPath, outputFiles, environment, options) {
|
||||
stream.print("Stripping extra imports from \0blue(" + path + "\0)");
|
||||
|
||||
var code = executable.code();
|
||||
var dependencies = executable.fileDependencies();
|
||||
var dependencies = executable.fileDependencies(),
|
||||
fileExecutableSearcher = executable.fileExecutableSearcher();
|
||||
for (var i = 0; i < dependencies.length; i++) {
|
||||
var dependency = dependencies[i];
|
||||
var dependencyExecutable = new _OBJJ.FileExecutableSearch(
|
||||
new analyzer.context.global.CFURL(dependency.isLocal() ? FILE.join(FILE.dirname(path), dependency.path()) : dependency.path()),
|
||||
dependency.isLocal()
|
||||
).result();
|
||||
var dependencyExecutable = nil;
|
||||
|
||||
fileExecutableSearcher(dependency.URL(), dependency.isLocal(), function(aFileExecutable)
|
||||
{
|
||||
dependencyExecutable = aFileExecutable;
|
||||
});
|
||||
|
||||
var dependencyPath = dependencyExecutable.path();
|
||||
if (!requiredFiles[dependencyPath]) {
|
||||
stream.print(" -> \0red(" + dependencyPath + "\0)");
|
||||
|
||||
@@ -187,8 +187,16 @@ ObjectiveJRuntimeAnalyzer.prototype.mergeLibraryImports = function()
|
||||
ObjectiveJRuntimeAnalyzer.prototype.executableForImport = function(path, isLocal)
|
||||
{
|
||||
if (isLocal === undefined) isLocal = true;
|
||||
var _OBJJ = this.require("objective-j");
|
||||
return new _OBJJ.FileExecutableSearch(new this.context.global.CFURL(path), isLocal).result();
|
||||
var _OBJJ = this.require("objective-j"),
|
||||
fileExecutable = nil,
|
||||
URL = new this.context.global.CFURL(path);
|
||||
|
||||
_OBJJ.Executable.fileExecutableSearcherForURL(URL)(URL, isLocal, function(/*FileExecutable*/ aFileExecutable)
|
||||
{
|
||||
fileExecutable = aFileExecutable;
|
||||
});
|
||||
|
||||
return fileExecutable;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -34,24 +34,26 @@ var _CPKeyedUnarchiverCannotDecodeObjectOfClassNameOriginalClassesSelector
|
||||
CPKeyedUnarchiverDelegate_unarchiver_cannotDecodeObjectOfClassName_originalClasses_ = 1 << 5;
|
||||
|
||||
var _CPKeyedArchiverNullString = "$null"
|
||||
|
||||
|
||||
_CPKeyedArchiverUIDKey = "CP$UID",
|
||||
|
||||
|
||||
_CPKeyedArchiverTopKey = "$top",
|
||||
_CPKeyedArchiverObjectsKey = "$objects",
|
||||
_CPKeyedArchiverArchiverKey = "$archiver",
|
||||
_CPKeyedArchiverVersionKey = "$version",
|
||||
|
||||
|
||||
_CPKeyedArchiverClassNameKey = "$classname",
|
||||
_CPKeyedArchiverClassesKey = "$classes",
|
||||
_CPKeyedArchiverClassKey = "$class";
|
||||
|
||||
var _CPKeyedUnarchiverArrayClass = Nil,
|
||||
_CPKeyedUnarchiverStringClass = Nil,
|
||||
_CPKeyedUnarchiverDictionaryClass = Nil,
|
||||
_CPKeyedUnarchiverNumberClass = Nil,
|
||||
_CPKeyedUnarchiverDataClass = Nil,
|
||||
_CPKeyedUnarchiverArchiverValueClass = Nil;
|
||||
|
||||
var CPArrayClass = Nil,
|
||||
CPMutableArrayClass = Nil,
|
||||
CPStringClass = Nil,
|
||||
CPDictionaryClass = Nil,
|
||||
CPMutableDictionaryClass = Nil,
|
||||
CPNumberClass = Nil,
|
||||
CPDataClass = Nil,
|
||||
_CPKeyedArchiverValueClass = Nil;
|
||||
|
||||
/*!
|
||||
@class CPKeyedUnarchiver
|
||||
@@ -103,14 +105,14 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
{
|
||||
id _delegate;
|
||||
unsigned _delegateSelectors;
|
||||
|
||||
|
||||
CPData _data;
|
||||
|
||||
CPDictionary _replacementClasses;
|
||||
|
||||
|
||||
CPArray _objects;
|
||||
CPDictionary _archive;
|
||||
|
||||
|
||||
CPDictionary _plistObject;
|
||||
CPArray _plistObjects;
|
||||
}
|
||||
@@ -122,13 +124,15 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
{
|
||||
if (self !== [CPKeyedUnarchiver class])
|
||||
return;
|
||||
|
||||
_CPKeyedUnarchiverArrayClass = [CPArray class];
|
||||
_CPKeyedUnarchiverStringClass = [CPString class];
|
||||
_CPKeyedUnarchiverDictionaryClass = [CPDictionary class];
|
||||
_CPKeyedUnarchiverNumberClass = [CPNumber class];
|
||||
_CPKeyedUnarchiverDataClass = [CPData class];
|
||||
_CPKeyedUnarchiverArchiverValueClass = [_CPKeyedArchiverValue class];
|
||||
|
||||
CPArrayClass = [CPArray class];
|
||||
CPMutableArrayClass = [CPMutableArray class];
|
||||
CPStringClass = [CPString class];
|
||||
CPDictionaryClass = [CPDictionary class];
|
||||
CPMutableDictionaryClass = [CPMutableDictionary class];
|
||||
CPNumberClass = [CPNumber class];
|
||||
CPDataClass = [CPData class];
|
||||
_CPKeyedArchiverValueClass = [_CPKeyedArchiverValue class];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -143,14 +147,14 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
if (self)
|
||||
{
|
||||
_archive = [data plistObject];
|
||||
_objects = [CPArray arrayWithObject:[CPNull null]];
|
||||
|
||||
_objects = [[CPNull null]];
|
||||
|
||||
_plistObject = [_archive objectForKey:_CPKeyedArchiverTopKey];
|
||||
_plistObjects = [_archive objectForKey:_CPKeyedArchiverObjectsKey];
|
||||
|
||||
_replacementClasses = [CPDictionary dictionary];
|
||||
_replacementClasses = new CFMutableDictionary();
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -163,9 +167,9 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
{
|
||||
var unarchiver = [[self alloc] initForReadingWithData:data],
|
||||
object = [unarchiver decodeObjectForKey:@"root"];
|
||||
|
||||
|
||||
[unarchiver finishDecoding];
|
||||
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -189,26 +193,32 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
*/
|
||||
- (BOOL)containsValueForKey:(CPString)aKey
|
||||
{
|
||||
return [_plistObject objectForKey:aKey] != nil;
|
||||
return _plistObject.valueForKey(aKey) != nil;
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (CPDictionary)_decodeDictionaryOfObjectsForKey:(CPString)aKey
|
||||
{
|
||||
var object = [_plistObject objectForKey:aKey];
|
||||
|
||||
if ([object isKindOfClass:_CPKeyedUnarchiverDictionaryClass])
|
||||
var object = _plistObject.valueForKey(aKey),
|
||||
objectClass = object && object.isa;
|
||||
|
||||
if (objectClass === CPDictionaryClass || objectClass === CPMutableDictionaryClass)
|
||||
{
|
||||
var key,
|
||||
keys = [object keyEnumerator],
|
||||
dictionary = [CPDictionary dictionary];
|
||||
|
||||
while (key = [keys nextObject])
|
||||
[dictionary setObject:_CPKeyedUnarchiverDecodeObjectAtIndex(self, [[object objectForKey:key] objectForKey:_CPKeyedArchiverUIDKey]) forKey:key];
|
||||
var keys = object.keys(),
|
||||
index = 0,
|
||||
count = keys.length,
|
||||
dictionary = new CFMutableDictionary();
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var key = keys[index];
|
||||
|
||||
dictionary.setValueForKey(key, _CPKeyedUnarchiverDecodeObjectAtIndex(self, object.valueForKey(key).valueForKey(_CPKeyedArchiverUIDKey)));
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -260,7 +270,7 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
- (CGPoint)decodePointForKey:(CPString)aKey
|
||||
{
|
||||
var object = [self decodeObjectForKey:aKey];
|
||||
|
||||
|
||||
if(object)
|
||||
return CPPointFromString(object);
|
||||
else
|
||||
@@ -275,7 +285,7 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
- (CGRect)decodeRectForKey:(CPString)aKey
|
||||
{
|
||||
var object = [self decodeObjectForKey:aKey];
|
||||
|
||||
|
||||
if(object)
|
||||
return CPRectFromString(object);
|
||||
else
|
||||
@@ -290,7 +300,7 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
- (CGSize)decodeSizeForKey:(CPString)aKey
|
||||
{
|
||||
var object = [self decodeObjectForKey:aKey];
|
||||
|
||||
|
||||
if(object)
|
||||
return CPSizeFromString(object);
|
||||
else
|
||||
@@ -304,23 +314,24 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
*/
|
||||
- (id)decodeObjectForKey:(CPString)aKey
|
||||
{
|
||||
var object = [_plistObject objectForKey:aKey];
|
||||
|
||||
if ([object isKindOfClass:_CPKeyedUnarchiverDictionaryClass])
|
||||
return _CPKeyedUnarchiverDecodeObjectAtIndex(self, [object objectForKey:_CPKeyedArchiverUIDKey]);
|
||||
var object = _plistObject.valueForKey(aKey),
|
||||
objectClass = object && object.isa;
|
||||
|
||||
else if ([object isKindOfClass:_CPKeyedUnarchiverNumberClass] || [object isKindOfClass:_CPKeyedUnarchiverDataClass] || [object isKindOfClass:_CPKeyedUnarchiverStringClass])
|
||||
if (objectClass === CPDictionaryClass || objectClass === CPMutableDictionaryClass)
|
||||
return _CPKeyedUnarchiverDecodeObjectAtIndex(self, object.valueForKey(_CPKeyedArchiverUIDKey));
|
||||
|
||||
else if (objectClass === CPNumberClass || objectClass === CPDataClass || objectClass === CPStringClass)
|
||||
return object;
|
||||
|
||||
else if ([object isKindOfClass:_CPKeyedUnarchiverArrayClass])
|
||||
else if (objectClass === CPArrayClass || objectClass === CPMutableArrayClass)
|
||||
{
|
||||
var index = 0,
|
||||
count = object.length,
|
||||
array = [];
|
||||
|
||||
for (; index < count; ++index)
|
||||
array[index] = _CPKeyedUnarchiverDecodeObjectAtIndex(self, [object[index] objectForKey:_CPKeyedArchiverUIDKey]);
|
||||
|
||||
array[index] = _CPKeyedUnarchiverDecodeObjectAtIndex(self, object[index].valueForKey(_CPKeyedArchiverUIDKey));
|
||||
|
||||
return array;
|
||||
}
|
||||
/* else
|
||||
@@ -337,11 +348,12 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
- (id)decodeBytesForKey:(CPString)aKey
|
||||
{
|
||||
// We get the CPData wrapper, then extract the bytes array
|
||||
var data = [self decodeObjectForKey:aKey];
|
||||
|
||||
if ([data isKindOfClass:[CPData class]])
|
||||
var data = [self decodeObjectForKey:aKey],
|
||||
objectClass = data.isa;
|
||||
|
||||
if (objectClass === CPDataClass)
|
||||
return data.bytes;
|
||||
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -372,19 +384,19 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
- (void)setDelegate:(id)aDelegate
|
||||
{
|
||||
_delegate = aDelegate;
|
||||
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(unarchiver:cannotDecodeObjectOfClassName:originalClasses:)])
|
||||
_delegateSelectors |= _CPKeyedUnarchiverCannotDecodeObjectOfClassNameOriginalClassesSelector;
|
||||
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(unarchiver:didDecodeObject:)])
|
||||
_delegateSelectors |= _CPKeyedUnarchiverDidDecodeObjectSelector;
|
||||
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(unarchiver:willReplaceObject:withObject:)])
|
||||
_delegateSelectors |= _CPKeyedUnarchiverWillReplaceObjectWithObjectSelector;
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(unarchiverWillFinish:)])
|
||||
_delegateSelectors |= _CPKeyedUnarchiverWilFinishSelector;
|
||||
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(unarchiverDidFinish:)])
|
||||
_delegateSelectors |= _CPKeyedUnarchiverDidFinishSelector;
|
||||
|
||||
@@ -394,12 +406,12 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
|
||||
- (void)setClass:(Class)aClass forClassName:(CPString)aClassName
|
||||
{
|
||||
[_replacementClasses setObject:aClass forKey:aClassName];
|
||||
_replacementClasses.setValueForKey(aClassName, aClass);
|
||||
}
|
||||
|
||||
- (Class)classForClassName:(CPString)aClassName
|
||||
{
|
||||
return [_replacementClasses objectForKey:aClassName];
|
||||
return _replacementClasses.valueForKey(aClassName);
|
||||
}
|
||||
|
||||
- (BOOL)allowsKeyedCoding
|
||||
@@ -414,19 +426,20 @@ var _CPKeyedUnarchiverDecodeObjectAtIndex = function(self, anIndex)
|
||||
var object = self._objects[anIndex];
|
||||
|
||||
if (object)
|
||||
if (object == self._objects[0])
|
||||
if (object === self._objects[0])
|
||||
return nil;
|
||||
else
|
||||
return object;
|
||||
|
||||
var object,
|
||||
plistObject = self._plistObjects[anIndex];
|
||||
|
||||
if ([plistObject isKindOfClass:_CPKeyedUnarchiverDictionaryClass])
|
||||
var object,
|
||||
plistObject = self._plistObjects[anIndex],
|
||||
plistObjectClass = plistObject.isa;
|
||||
|
||||
if (plistObjectClass === CPDictionaryClass || plistObjectClass === CPMutableDictionaryClass)
|
||||
{
|
||||
var plistClass = self._plistObjects[[[plistObject objectForKey:_CPKeyedArchiverClassKey] objectForKey:_CPKeyedArchiverUIDKey]],
|
||||
className = [plistClass objectForKey:_CPKeyedArchiverClassNameKey],
|
||||
classes = [plistClass objectForKey:_CPKeyedArchiverClassesKey],
|
||||
var plistClass = self._plistObjects[plistObject.valueForKey(_CPKeyedArchiverClassKey).valueForKey(_CPKeyedArchiverUIDKey)],
|
||||
className = plistClass.valueForKey(_CPKeyedArchiverClassNameKey),
|
||||
classes = plistClass.valueForKey(_CPKeyedArchiverClassesKey),
|
||||
theClass = [self classForClassName:className];
|
||||
|
||||
if (!theClass)
|
||||
@@ -439,7 +452,7 @@ var _CPKeyedUnarchiverDecodeObjectAtIndex = function(self, anIndex)
|
||||
[CPException raise:CPInvalidUnarchiveOperationException reason:@"-[CPKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (" + className + @")"];
|
||||
|
||||
var savedPlistObject = self._plistObject;
|
||||
|
||||
|
||||
self._plistObject = plistObject;
|
||||
|
||||
// Should we only call this on _CPCibClassSwapper? (currently the only class that makes use of this).
|
||||
@@ -451,37 +464,37 @@ var _CPKeyedUnarchiverDecodeObjectAtIndex = function(self, anIndex)
|
||||
var processedObject = [object initWithCoder:self];
|
||||
|
||||
self._plistObject = savedPlistObject;
|
||||
|
||||
|
||||
if (processedObject != object)
|
||||
{
|
||||
if (self._delegateSelectors & _CPKeyedUnarchiverWillReplaceObjectWithObjectSelector)
|
||||
[self._delegate unarchiver:self willReplaceObject:object withObject:processedObject];
|
||||
|
||||
|
||||
object = processedObject;
|
||||
self._objects[anIndex] = processedObject;
|
||||
}
|
||||
|
||||
processedObject = [object awakeAfterUsingCoder:self];
|
||||
|
||||
if (processedObject != object)
|
||||
processedObject = [object awakeAfterUsingCoder:self];
|
||||
|
||||
if (processedObject !== object)
|
||||
{
|
||||
if (self._delegateSelectors & _CPKeyedUnarchiverWillReplaceObjectWithObjectSelector)
|
||||
[self._delegate unarchiver:self willReplaceObject:object withObject:processedObject];
|
||||
|
||||
|
||||
object = processedObject;
|
||||
self._objects[anIndex] = processedObject;
|
||||
}
|
||||
|
||||
|
||||
if (self._delegate)
|
||||
{
|
||||
if (self._delegateSelectors & _CPKeyedUnarchiverDidDecodeObjectSelector)
|
||||
processedObject = [self._delegate unarchiver:self didDecodeObject:object];
|
||||
|
||||
|
||||
if (processedObject != object)
|
||||
{
|
||||
if (self._delegateSelectors & _CPKeyedUnarchiverWillReplaceObjectWithObjectSelector)
|
||||
[self._delegate unarchiver:self willReplaceObject:object withObject:processedObject];
|
||||
|
||||
|
||||
object = processedObject;
|
||||
self._objects[anIndex] = processedObject;
|
||||
}
|
||||
@@ -491,24 +504,23 @@ var _CPKeyedUnarchiverDecodeObjectAtIndex = function(self, anIndex)
|
||||
{
|
||||
self._objects[anIndex] = object = plistObject;
|
||||
|
||||
if ([object class] == _CPKeyedUnarchiverStringClass)
|
||||
if ([object class] === CPStringClass)
|
||||
{
|
||||
if (object == _CPKeyedArchiverNullString)
|
||||
if (object === _CPKeyedArchiverNullString)
|
||||
{
|
||||
self._objects[anIndex] = self._objects[0];
|
||||
|
||||
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
self._objects[anIndex] = object = plistObject;
|
||||
}
|
||||
}
|
||||
|
||||
// If this object is a member of _CPKeyedArchiverValue, then we know
|
||||
|
||||
// If this object is a member of _CPKeyedArchiverValue, then we know
|
||||
// that it is a wrapper for a primitive JavaScript object.
|
||||
if ([object isMemberOfClass:_CPKeyedUnarchiverArchiverValueClass])
|
||||
if (object.isa === _CPKeyedArchiverValueClass)
|
||||
object = [object JSObject];
|
||||
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -60,10 +60,10 @@ function CPMakeRangeCopy(aRange)
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets a range's \c length to 0.
|
||||
@param aRange the range to empty
|
||||
Determines if a range is empty \c length is 0.
|
||||
@param aRange the range to test
|
||||
@group CPRange
|
||||
@return CPRange the empty range (same as the argument)
|
||||
@return YES if the range is empty
|
||||
*/
|
||||
function CPEmptyRange(aRange)
|
||||
{
|
||||
|
||||
@@ -142,7 +142,7 @@ var CPStringRegexSpecialCharacters = [
|
||||
[CPException raise:CPInvalidArgumentException
|
||||
reason:"initWithFormat: the format can't be 'nil'"];
|
||||
|
||||
self = sprintf.apply(this, Array.prototype.slice.call(arguments, 2));
|
||||
self = ObjectiveJ.sprintf.apply(this, Array.prototype.slice.call(arguments, 2));
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ var CPStringRegexSpecialCharacters = [
|
||||
[CPException raise:CPInvalidArgumentException
|
||||
reason:"initWithFormat: the format can't be 'nil'"];
|
||||
|
||||
return sprintf.apply(this, Array.prototype.slice.call(arguments, 2));
|
||||
return ObjectiveJ.sprintf.apply(this, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -199,7 +199,7 @@ var CPStringRegexSpecialCharacters = [
|
||||
if (!format)
|
||||
[CPException raise:CPInvalidArgumentException reason:"initWithFormat: the format can't be 'nil'"];
|
||||
|
||||
return self + sprintf.apply(this, Array.prototype.slice.call(arguments, 2));
|
||||
return self + ObjectiveJ.sprintf.apply(this, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
body {
|
||||
font: 10px Monaco, Courier, "Courier New", monospace, mono;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
div > .fatal, div > .error, div > .warn, div > .info, div > .debug, div > .trace {
|
||||
display: none;
|
||||
overflow: hidden;
|
||||
white-space: pre;
|
||||
padding: 0px 5px 0px 5px;
|
||||
margin-top: 2px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
div[wrap="yes"] > div {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.fatal { background-color: #ffb2b3; }
|
||||
.error { background-color: #ffe2b2; }
|
||||
.warn { background-color: #fdffb2; }
|
||||
.info { background-color: #e4ffb2; }
|
||||
.debug { background-color: #a0e5a0; }
|
||||
.trace { background-color: #99b9ff; }
|
||||
|
||||
.enfatal .fatal, .enerror .error, .enwarn .warn, .eninfo .info, .endebug .debug, .entrace .trace { display: block; }
|
||||
|
||||
div#header {
|
||||
background-color: rgba(240,240,240,0.82);
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
border-bottom: 1px solid rgba(0,0,0,0.33);
|
||||
text-align: center;
|
||||
/*opacity: 0.2;*/
|
||||
}
|
||||
/*
|
||||
div#header:hover {
|
||||
opacity: 1.0;
|
||||
}
|
||||
*/
|
||||
ul#enablers {
|
||||
display: inline-block;
|
||||
margin: 1px 15px 0 15px;
|
||||
padding: 2px 0 2px 0;
|
||||
}
|
||||
|
||||
ul#enablers li {
|
||||
display: inline;
|
||||
padding: 0px 5px 0px 5px;
|
||||
margin-left: 4px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
[enabled="no"] {
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
ul#options {
|
||||
display: inline-block;
|
||||
margin: 0 15px 0px 15px;
|
||||
padding: 0 0px;
|
||||
}
|
||||
|
||||
ul#options li {
|
||||
margin: 0 0 0 0;
|
||||
padding: 0 0 0 0;
|
||||
display: inline;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ filedir ($TOOLS_DOWNLOAD_COMMONJS, ["CommonJS"], function()
|
||||
|
||||
// Deployment
|
||||
|
||||
task ("deploy", ["downloads"], function()
|
||||
task ("deploy", ["downloads", "demos"], function()
|
||||
{
|
||||
var cappuccino_output_path = FILE.join($BUILD_DIR, 'Cappuccino');
|
||||
|
||||
@@ -184,12 +184,65 @@ task ("deploy", ["downloads"], function()
|
||||
rm_rf(starter_zip_output);
|
||||
|
||||
OS.system("cd " + OS.enquote(cappuccino_output_path) + " && zip -ry -8 Starter.zip Starter");
|
||||
});
|
||||
|
||||
// zip the tools pack
|
||||
var tools_zip_output = FILE.join($BUILD_DIR, 'Cappuccino', 'Tools.zip')
|
||||
rm_rf(tools_zip_output);
|
||||
task ("demos", function()
|
||||
{
|
||||
var demosDir = FILE.join($BUILD_DIR, "CappuccinoDemos"),
|
||||
zipDir = FILE.join(demosDir, "demos.zip"),
|
||||
demosQuoted = OS.enquote(demosDir),
|
||||
zipQuoted = OS.enquote(zipDir);
|
||||
|
||||
OS.system("cd " + OS.enquote(cappuccino_output_path) + " && zip -ry -8 Tools.zip Tools");
|
||||
rm_rf(demosDir);
|
||||
FILE.mkdirs(demosDir);
|
||||
|
||||
OS.system("curl -L http://github.com/280north/cappuccino-demos/zipball/master > "+zipQuoted);
|
||||
OS.system("(cd "+demosQuoted+" && unzip "+zipQuoted+" -d demos)");
|
||||
|
||||
require("objective-j");
|
||||
|
||||
function Demo(aPath)
|
||||
{
|
||||
this._path = aPath;
|
||||
this._plist = CFPropertyList.readPropertyListFromFile(FILE.join(aPath, 'Info.plist'));
|
||||
}
|
||||
|
||||
Demo.prototype.plist = function(key)
|
||||
{
|
||||
if (key)
|
||||
return this._plist.valueForKey(key);
|
||||
return this._plist;
|
||||
}
|
||||
|
||||
Demo.prototype.name = function()
|
||||
{
|
||||
return this.plist("CPBundleName");
|
||||
}
|
||||
|
||||
Demo.prototype.path = function()
|
||||
{
|
||||
return this._path;
|
||||
}
|
||||
|
||||
Demo.prototype.excluded = function()
|
||||
{
|
||||
return !!this.plist("CPDemoExcluded");
|
||||
}
|
||||
|
||||
Demo.prototype.toString = function()
|
||||
{
|
||||
return this.name();
|
||||
}
|
||||
|
||||
FILE.glob(FILE.join(demosDir, "demos", "**/Info.plist")).map(function(demoPath){
|
||||
return new Demo(FILE.dirname(demoPath))
|
||||
}).filter(function(demo){
|
||||
return !demo.excluded();
|
||||
}).forEach(function(demo)
|
||||
{
|
||||
var outputPath = FILE.join(demosDir, demo.name().replace(/\s/g, "-")+".zip");
|
||||
OS.system("cd "+OS.enquote(FILE.dirname(demo.path()))+"; zip -ry -8 "+OS.enquote(outputPath)+" "+OS.enquote(demo.path()));
|
||||
});
|
||||
});
|
||||
|
||||
// Testing
|
||||
|
||||
+8
-13
@@ -206,21 +206,19 @@ CFBundle.prototype.load = function(/*BOOL*/ shouldExecute)
|
||||
|
||||
this._loadStatus = CFBundleLoading | CFBundleLoadingInfoPlist;
|
||||
|
||||
var self = this;
|
||||
var self = this,
|
||||
bundleURL = this.bundleURL(),
|
||||
parentURL = new CFURL("..", bundleURL);
|
||||
|
||||
|
||||
var parentURL = new CFURL("..", this.bundleURL());
|
||||
|
||||
//???
|
||||
if (parentURL.absoluteString() === this.bundleURL().absoluteString())
|
||||
if (parentURL.absoluteString() === bundleURL.absoluteString())
|
||||
parentURL = parentURL.schemeAndAuthority();
|
||||
|
||||
StaticResource.resolveResourceAtURL(parentURL, YES, function(aStaticResource)
|
||||
{
|
||||
var resourceName = self.bundleURL().absoluteURL().lastPathComponent();
|
||||
var resourceName = bundleURL.absoluteURL().lastPathComponent();
|
||||
|
||||
self._staticResource = aStaticResource._children[resourceName] ||
|
||||
new StaticResource(resourceName, aStaticResource, YES, NO);
|
||||
new StaticResource(bundleURL, aStaticResource, YES, NO);
|
||||
|
||||
function onsuccess(/*Event*/ anEvent)
|
||||
{
|
||||
@@ -575,13 +573,12 @@ function decompileStaticFile(/*Bundle*/ aBundle, /*String*/ aString, /*String*/
|
||||
var fileURL = new CFURL(text, bundleURL),
|
||||
parent = StaticResource.resourceAtURL(new CFURL(".", fileURL), YES);
|
||||
|
||||
file = new StaticResource(fileURL.lastPathComponent(), parent, NO, YES);
|
||||
file = new StaticResource(fileURL, parent, NO, YES);
|
||||
}
|
||||
|
||||
else if (marker === MARKER_URI)
|
||||
{
|
||||
var URL = new CFURL(text, bundleURL),
|
||||
mappedURL,
|
||||
mappedURLString = stream.getString();
|
||||
|
||||
if (mappedURLString.indexOf("mhtml:") === 0)
|
||||
@@ -596,8 +593,6 @@ function decompileStaticFile(/*Bundle*/ aBundle, /*String*/ aString, /*String*/
|
||||
|
||||
mappedURLString = firstPart + "?" + CFCacheBuster + lastPart;
|
||||
}
|
||||
|
||||
mappedURL = new CFURL(mappedURLString);
|
||||
}
|
||||
|
||||
CFURL.setMappedURLForURL(URL, new CFURL(mappedURLString));
|
||||
@@ -605,7 +600,7 @@ function decompileStaticFile(/*Bundle*/ aBundle, /*String*/ aString, /*String*/
|
||||
// The unresolved directories must not be bundles.
|
||||
var parent = StaticResource.resourceAtURL(new CFURL(".", URL), YES);
|
||||
|
||||
new StaticResource(URL.lastPathComponent(), parent, NO, YES);
|
||||
new StaticResource(URL, parent, NO, YES);
|
||||
}
|
||||
|
||||
else if (marker === MARKER_TEXT)
|
||||
|
||||
@@ -155,7 +155,7 @@ var base64_map_to = [
|
||||
for (var i = 0; i < base64_map_to.length; i++)
|
||||
base64_map_from[base64_map_to[i].charCodeAt(0)] = i;
|
||||
|
||||
GLOBAL(base64_decode_to_array) = function(input, strip)
|
||||
CFData.decodeBase64ToArray = function(input, strip)
|
||||
{
|
||||
if (strip)
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
@@ -184,7 +184,7 @@ GLOBAL(base64_decode_to_array) = function(input, strip)
|
||||
return output;
|
||||
}
|
||||
|
||||
GLOBAL(base64_encode_array) = function(input)
|
||||
CFData.encodeBase64Array = function(input)
|
||||
{
|
||||
var pad = (3 - (input.length % 3)) % 3,
|
||||
length = input.length + pad,
|
||||
@@ -222,23 +222,23 @@ GLOBAL(base64_encode_array) = function(input)
|
||||
return output.join("");
|
||||
}
|
||||
|
||||
GLOBAL(base64_decode_to_string) = function(input, strip)
|
||||
CFData.decodeBase64ToString = function(input, strip)
|
||||
{
|
||||
return bytes_to_string(base64_decode_to_array(input, strip));
|
||||
return CFData.bytesToString(CFData.decodeBase64ToArray(input, strip));
|
||||
}
|
||||
|
||||
GLOBAL(bytes_to_string) = function(bytes)
|
||||
CFData.bytesToString = function(bytes)
|
||||
{
|
||||
// This is relatively efficient, I think:
|
||||
return String.fromCharCode.apply(NULL, bytes);
|
||||
}
|
||||
|
||||
|
||||
GLOBAL(base64_encode_string) = function(input)
|
||||
CFData.encodeBase64String = function(input)
|
||||
{
|
||||
var temp = [];
|
||||
for (var i = 0; i < input.length; i++)
|
||||
temp.push(input.charCodeAt(i));
|
||||
|
||||
return base64_encode_array(temp);
|
||||
return CFData.encodeBase64Array(temp);
|
||||
}
|
||||
@@ -65,6 +65,10 @@ CFDictionary.prototype.containsKey = function(/*String*/ aKey)
|
||||
return hasOwnProperty.apply(this._buckets, [aKey]);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFDictionary.prototype.containsKey.displayName = "CFDictionary.containsKey";
|
||||
#endif
|
||||
|
||||
CFDictionary.prototype.containsValue = function(/*id*/ anObject)
|
||||
{
|
||||
var keys = this._keys,
|
||||
@@ -79,16 +83,31 @@ CFDictionary.prototype.containsValue = function(/*id*/ anObject)
|
||||
return NO;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFDictionary.prototype.containsValue.displayName = "CFDictionary.containsValue";
|
||||
#endif
|
||||
|
||||
|
||||
CFDictionary.prototype.count = function()
|
||||
{
|
||||
return this._count;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFDictionary.prototype.count.displayName = "CFDictionary.count";
|
||||
#endif
|
||||
|
||||
|
||||
CFDictionary.prototype.countOfKey = function(/*String*/ aKey)
|
||||
{
|
||||
return this.containsKey(aKey) ? 1 : 0;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFDictionary.prototype.countOfKey.displayName = "CFDictionary.countOfKey";
|
||||
#endif
|
||||
|
||||
|
||||
CFDictionary.prototype.countOfValue = function(/*id*/ anObject)
|
||||
{
|
||||
var keys = this._keys,
|
||||
@@ -104,11 +123,20 @@ CFDictionary.prototype.countOfValue = function(/*id*/ anObject)
|
||||
return countOfValue;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFDictionary.prototype.countOfValue.displayName = "CFDictionary.countOfValue";
|
||||
#endif
|
||||
|
||||
|
||||
CFDictionary.prototype.keys = function()
|
||||
{
|
||||
return this._keys.slice();
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFDictionary.prototype.keys.displayName = "CFDictionary.keys";
|
||||
#endif
|
||||
|
||||
CFDictionary.prototype.valueForKey = function(/*String*/ aKey)
|
||||
{
|
||||
var buckets = this._buckets;
|
||||
@@ -119,6 +147,10 @@ CFDictionary.prototype.valueForKey = function(/*String*/ aKey)
|
||||
return buckets[aKey];
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFDictionary.prototype.valueForKey.displayName = "CFDictionary.valueForKey";
|
||||
#endif
|
||||
|
||||
CFDictionary.prototype.toString = function()
|
||||
{
|
||||
var string = "{\n",
|
||||
@@ -136,6 +168,10 @@ CFDictionary.prototype.toString = function()
|
||||
return string + "}";
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFDictionary.prototype.toString.displayName = "CFDictionary.toString";
|
||||
#endif
|
||||
|
||||
GLOBAL(CFMutableDictionary) = function(/*CFDictionary*/ aDictionary)
|
||||
{
|
||||
CFDictionary.apply(this, []);
|
||||
@@ -159,6 +195,10 @@ CFMutableDictionary.prototype.addValueForKey = function(/*String*/ aKey, /*Objec
|
||||
this._buckets[aKey] = aValue;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFMutableDictionary.prototype.addValueForKey.displayName = "CFMutableDictionary.addValueForKey";
|
||||
#endif
|
||||
|
||||
CFMutableDictionary.prototype.removeValueForKey = function(/*String*/ aKey)
|
||||
{
|
||||
var indexOfKey = -1;
|
||||
@@ -188,6 +228,10 @@ CFMutableDictionary.prototype.removeValueForKey = function(/*String*/ aKey)
|
||||
delete this._buckets[aKey];
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFMutableDictionary.prototype.removeValueForKey.displayName = "CFMutableDictionary.removeValueForKey";
|
||||
#endif
|
||||
|
||||
CFMutableDictionary.prototype.removeAllValues = function()
|
||||
{
|
||||
this._count = 0;
|
||||
@@ -195,6 +239,10 @@ CFMutableDictionary.prototype.removeAllValues = function()
|
||||
this._buckets = { };
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFMutableDictionary.prototype.removeAllValues.displayName = "CFMutableDictionary.removeAllValues";
|
||||
#endif
|
||||
|
||||
CFMutableDictionary.prototype.replaceValueForKey = function(/*String*/ aKey, /*Object*/ aValue)
|
||||
{
|
||||
if (!this.containsKey(aKey))
|
||||
@@ -203,6 +251,10 @@ CFMutableDictionary.prototype.replaceValueForKey = function(/*String*/ aKey, /*O
|
||||
this._buckets[aKey] = aValue;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFMutableDictionary.prototype.replaceValueForKey.displayName = "CFMutableDictionary.replaceValueForKey";
|
||||
#endif
|
||||
|
||||
CFMutableDictionary.prototype.setValueForKey = function(/*String*/ aKey, /*Object*/ aValue)
|
||||
{
|
||||
if (aValue === nil || aValue === undefined)
|
||||
@@ -214,3 +266,7 @@ CFMutableDictionary.prototype.setValueForKey = function(/*String*/ aKey, /*Objec
|
||||
else
|
||||
this.addValueForKey(aKey, aValue);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
CFMutableDictionary.prototype.setValueForKey.displayName = "CFMutableDictionary.setValueForKey";
|
||||
#endif
|
||||
@@ -564,7 +564,7 @@ CFPropertyList.propertyListFromXML = function(/*String | XMLNode*/ aStringOrXMLN
|
||||
break;
|
||||
|
||||
case PLIST_DATA: object = new CFMutableData();
|
||||
object.bytes = FIRST_CHILD(XMLNode) ? base64_decode_to_array(CHILD_VALUE(XMLNode), YES) : [];
|
||||
object.bytes = FIRST_CHILD(XMLNode) ? CFData.decodeBase64ToArray(CHILD_VALUE(XMLNode), YES) : [];
|
||||
break;
|
||||
|
||||
default: throw new Error("*** " + NODE_NAME(XMLNode) + " tag not recognized in Plist.");
|
||||
|
||||
+88
-20
@@ -204,25 +204,31 @@ GLOBAL(CFURL) = function(/*CFURL|String*/ aURL, /*CFURL*/ aBaseURL)
|
||||
this._baseURL = aBaseURL;
|
||||
}
|
||||
|
||||
CFURL.displayName = "CFURL";
|
||||
|
||||
var URLMap = { };
|
||||
DISPLAY_NAME(CFURL);
|
||||
|
||||
CFURL.prototype.UID = function()
|
||||
{
|
||||
return this._UID;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.UID);
|
||||
|
||||
var URLMap = { };
|
||||
|
||||
CFURL.prototype.mappedURL = function()
|
||||
{
|
||||
return URLMap[this.absoluteString()] || this;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.mappedURL);
|
||||
|
||||
CFURL.setMappedURLForURL = function(/*CFURL*/ fromURL, /*CFURL*/ toURL)
|
||||
{
|
||||
URLMap[fromURL.absoluteString()] = toURL;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.setMappedURLForURL);
|
||||
|
||||
CFURL.prototype.schemeAndAuthority = function()
|
||||
{
|
||||
var string = "",
|
||||
@@ -239,16 +245,25 @@ CFURL.prototype.schemeAndAuthority = function()
|
||||
return string;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.schemeAndAuthority);
|
||||
|
||||
CFURL.prototype.absoluteString = function()
|
||||
{
|
||||
return this.absoluteURL().string();
|
||||
if (this._absoluteString === undefined)
|
||||
this._absoluteString = this.absoluteURL().string();
|
||||
|
||||
return this._absoluteString;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.absoluteString);
|
||||
|
||||
CFURL.prototype.toString = function()
|
||||
{
|
||||
return this.absoluteString();
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.toString);
|
||||
|
||||
function resolveURL(aURL)
|
||||
{
|
||||
aURL = aURL.standardizedURL();
|
||||
@@ -300,7 +315,7 @@ function resolveURL(aURL)
|
||||
|
||||
// If this doesn't start with a "..", then we're simply appending to already standardized paths.
|
||||
if (pathComponents.length && pathComponents[0] === "..")
|
||||
standardizePathComponents(resolvedPathComponents);
|
||||
standardizePathComponents(resolvedPathComponents, YES);
|
||||
|
||||
resolvedParts.pathComponents = resolvedPathComponents;
|
||||
resolvedParts.path = pathFromPathComponents(resolvedPathComponents, pathComponents.length <= 0 || aURL.hasDirectoryPath());
|
||||
@@ -312,7 +327,9 @@ function resolveURL(aURL)
|
||||
|
||||
resolvedURL._parts = resolvedParts;
|
||||
resolvedURL._standardizedURL = resolvedURL;
|
||||
resolvedURL._standardizedString = resolvedString;
|
||||
resolvedURL._absoluteURL = resolvedURL;
|
||||
resolvedURL._absoluteString = resolvedString;
|
||||
|
||||
return resolvedURL;
|
||||
}
|
||||
@@ -330,11 +347,12 @@ function pathFromPathComponents(/*Array*/ pathComponents, /*BOOL*/ isDirectoryPa
|
||||
return path;
|
||||
}
|
||||
|
||||
function standardizePathComponents(/*Array*/ pathComponents)
|
||||
function standardizePathComponents(/*Array*/ pathComponents, /*BOOL*/ inPlace)
|
||||
{
|
||||
var index = 0,
|
||||
resultIndex = 0,
|
||||
count = pathComponents.length;
|
||||
count = pathComponents.length,
|
||||
result = inPlace ? pathComponents : [];
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
@@ -343,21 +361,23 @@ function standardizePathComponents(/*Array*/ pathComponents)
|
||||
if (component === "" || component === ".")
|
||||
continue;
|
||||
|
||||
if (component !== ".." || resultIndex === 0 || pathComponents[resultIndex - 1] === "..")
|
||||
if (component !== ".." || resultIndex === 0 || result[resultIndex - 1] === "..")
|
||||
{
|
||||
//if (resultIndex !== index)
|
||||
pathComponents[resultIndex] = component;
|
||||
result[resultIndex] = component;
|
||||
|
||||
resultIndex++;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (resultIndex > 0 && pathComponents[resultIndex - 1] !== "/")
|
||||
if (resultIndex > 0 && result[resultIndex - 1] !== "/")
|
||||
--resultIndex;
|
||||
}
|
||||
|
||||
pathComponents.length = resultIndex;
|
||||
result.length = resultIndex;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function URLStringFromParts(/*Object*/ parts)
|
||||
@@ -396,15 +416,15 @@ CFURL.prototype.absoluteURL = function()
|
||||
return this._absoluteURL;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.absoluteURL);
|
||||
|
||||
CFURL.prototype.standardizedURL = function()
|
||||
{
|
||||
if (this._standardizedURL === undefined)
|
||||
{
|
||||
var parts = PARTS(this),
|
||||
pathComponents = parts.pathComponents,
|
||||
standardizedPathComponents = pathComponents.slice();
|
||||
|
||||
standardizePathComponents(standardizedPathComponents);
|
||||
standardizedPathComponents = standardizePathComponents(pathComponents, NO);
|
||||
|
||||
var standardizedPath = pathFromPathComponents(standardizedPathComponents, this.hasDirectoryPath());
|
||||
|
||||
@@ -421,7 +441,7 @@ CFURL.prototype.standardizedURL = function()
|
||||
var standardizedURL = new CFURL(URLStringFromParts(standardizedParts), this.baseURL());
|
||||
|
||||
standardizedURL._parts = standardizedParts;
|
||||
standardizedURL._standardizedParts = standardizedURL;
|
||||
standardizedURL._standardizedURL = standardizedURL;
|
||||
|
||||
this._standardizedURL = standardizedURL;
|
||||
}
|
||||
@@ -430,6 +450,8 @@ CFURL.prototype.standardizedURL = function()
|
||||
return this._standardizedURL;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.standardizedURL);
|
||||
|
||||
function CFURLPartsCreateCopy(parts)
|
||||
{
|
||||
var copiedParts = { },
|
||||
@@ -450,6 +472,8 @@ CFURL.prototype.string = function()
|
||||
return this._string;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.string);
|
||||
|
||||
CFURL.prototype.authority = function()
|
||||
{
|
||||
var authority = PARTS(this).authority;
|
||||
@@ -462,6 +486,8 @@ CFURL.prototype.authority = function()
|
||||
return baseURL && baseURL.authority() || "";
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.authority);
|
||||
|
||||
CFURL.prototype.hasDirectoryPath = function()
|
||||
{
|
||||
var hasDirectoryPath = this._hasDirectoryPath;
|
||||
@@ -485,37 +511,55 @@ CFURL.prototype.hasDirectoryPath = function()
|
||||
return this._hasDirectoryPath;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.hasDirectoryPath);
|
||||
|
||||
CFURL.prototype.hostName = function()
|
||||
{
|
||||
return this.authority();
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.hostName);
|
||||
|
||||
CFURL.prototype.fragment = function()
|
||||
{
|
||||
return PARTS(this).fragment;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.fragment);
|
||||
|
||||
CFURL.prototype.lastPathComponent = function()
|
||||
{
|
||||
var pathComponents = this.pathComponents(),
|
||||
pathComponentCount = pathComponents.length;
|
||||
if (this._lastPathComponent === undefined)
|
||||
{
|
||||
var pathComponents = this.pathComponents(),
|
||||
pathComponentCount = pathComponents.length;
|
||||
|
||||
if (!pathComponentCount)
|
||||
return "";
|
||||
if (!pathComponentCount)
|
||||
this._lastPathComponent = "";
|
||||
|
||||
return pathComponents[pathComponentCount - 1];
|
||||
else
|
||||
this._lastPathComponent = pathComponents[pathComponentCount - 1];
|
||||
}
|
||||
|
||||
return this._lastPathComponent;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.lastPathComponent);
|
||||
|
||||
CFURL.prototype.path = function()
|
||||
{
|
||||
return PARTS(this).path;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.path);
|
||||
|
||||
CFURL.prototype.pathComponents = function()
|
||||
{
|
||||
return PARTS(this).pathComponents;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.pathComponents);
|
||||
|
||||
CFURL.prototype.pathExtension = function()
|
||||
{
|
||||
var lastPathComponent = this.lastPathComponent();
|
||||
@@ -530,11 +574,15 @@ CFURL.prototype.pathExtension = function()
|
||||
return index <= 0 ? "" : lastPathComponent.substring(index + 1);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.pathExtension);
|
||||
|
||||
CFURL.prototype.queryString = function()
|
||||
{
|
||||
return PARTS(this).queryString;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.queryString);
|
||||
|
||||
CFURL.prototype.scheme = function()
|
||||
{
|
||||
var scheme = this._scheme;
|
||||
@@ -556,31 +604,43 @@ CFURL.prototype.scheme = function()
|
||||
return scheme;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.scheme);
|
||||
|
||||
CFURL.prototype.user = function()
|
||||
{
|
||||
return PARTS(this).user;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.user);
|
||||
|
||||
CFURL.prototype.password = function()
|
||||
{
|
||||
return PARTS(this).password;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.password);
|
||||
|
||||
CFURL.prototype.portNumber = function()
|
||||
{
|
||||
return PARTS(this).portNumber;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.portNumber);
|
||||
|
||||
CFURL.prototype.domain = function()
|
||||
{
|
||||
return PARTS(this).domain;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.domain);
|
||||
|
||||
CFURL.prototype.baseURL = function()
|
||||
{
|
||||
return this._baseURL;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.baseURL);
|
||||
|
||||
CFURL.prototype.asDirectoryPathURL = function()
|
||||
{
|
||||
if (this.hasDirectoryPath())
|
||||
@@ -589,6 +649,8 @@ CFURL.prototype.asDirectoryPathURL = function()
|
||||
return new CFURL(this.lastPathComponent() + "/", this);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.asDirectoryPathURL);
|
||||
|
||||
function CFURLGetResourcePropertiesForKeys(/*CFURL*/ aURL)
|
||||
{
|
||||
if (!aURL._resourcePropertiesForKeys)
|
||||
@@ -602,11 +664,15 @@ CFURL.prototype.resourcePropertyForKey = function(/*String*/ aKey)
|
||||
return CFURLGetResourcePropertiesForKeys(this).valueForKey(aKey);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.resourcePropertyForKey);
|
||||
|
||||
CFURL.prototype.setResourcePropertyForKey = function(/*String*/ aKey, /*id*/ aValue)
|
||||
{
|
||||
CFURLGetResourcePropertiesForKeys(this).setValueForKey(aKey, aValue);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.setResourcePropertyForKey);
|
||||
|
||||
CFURL.prototype.staticResourceData = function()
|
||||
{
|
||||
var data = new CFMutableData();
|
||||
@@ -615,3 +681,5 @@ CFURL.prototype.staticResourceData = function()
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.staticResourceData);
|
||||
+58
-93
@@ -82,7 +82,7 @@ function _CPLogDispatch(parameters, aLevel, aTitle)
|
||||
aLevel = CPLogDefaultLevel;
|
||||
|
||||
// use sprintf if param 0 is a string and there is more than one param. otherwise just convert param 0 to a string
|
||||
var message = (typeof parameters[0] == "string" && parameters.length > 1) ? sprintf.apply(null, parameters) : String(parameters[0]);
|
||||
var message = (typeof parameters[0] == "string" && parameters.length > 1) ? exports.sprintf.apply(null, parameters) : String(parameters[0]);
|
||||
|
||||
if (_CPLogRegistrations[aLevel])
|
||||
for (var i = 0; i < _CPLogRegistrations[aLevel].length; i++)
|
||||
@@ -103,8 +103,8 @@ var _CPFormatLogMessage = function(aString, aLevel, aTitle)
|
||||
var now = new Date();
|
||||
aLevel = ( aLevel == null ? '' : ' [' + aLevel + ']' );
|
||||
|
||||
if (typeof sprintf == "function")
|
||||
return sprintf("%4d-%02d-%02d %02d:%02d:%02d.%03d %s%s: %s",
|
||||
if (typeof exports.sprintf == "function")
|
||||
return exports.sprintf("%4d-%02d-%02d %02d:%02d:%02d.%03d %s%s: %s",
|
||||
now.getFullYear(), now.getMonth(), now.getDate(),
|
||||
now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds(),
|
||||
aTitle, aLevel, aString);
|
||||
@@ -114,81 +114,6 @@ var _CPFormatLogMessage = function(aString, aLevel, aTitle)
|
||||
|
||||
// Loggers:
|
||||
|
||||
var ANSI_ESC = String.fromCharCode(0x1B);
|
||||
var ANSI_CSI = ANSI_ESC + '[';
|
||||
var ANSI_TEXT_PROP = 'm';
|
||||
var ANSI_RESET = '0';
|
||||
var ANSI_BOLD = '1';
|
||||
var ANSI_FAINT = '2'; // unsupported?
|
||||
var ANSI_NORMAL = '22';
|
||||
var ANSI_ITALIC = '3'; // unsupported?
|
||||
var ANSI_UNDER = '4';
|
||||
var ANSI_UNDER_DBL = '21'; // unsupported?
|
||||
var ANSI_UNDER_OFF = '24';
|
||||
var ANSI_BLINK = '5';
|
||||
var ANSI_BLINK_FAST = '6'; // unsupported?
|
||||
var ANSI_BLINK_OFF = '25';
|
||||
var ANSI_REVERSE = '7';
|
||||
var ANSI_POSITIVE = '27';
|
||||
var ANSI_CONCEAL = '8';
|
||||
var ANSI_REVEAL = '28';
|
||||
var ANSI_FG = '3';
|
||||
var ANSI_BG = '4';
|
||||
var ANSI_FG_INTENSE = '9';
|
||||
var ANSI_BG_INTENSE = '10';
|
||||
var ANSI_BLACK = '0';
|
||||
var ANSI_RED = '1';
|
||||
var ANSI_GREEN = '2';
|
||||
var ANSI_YELLOW = '3';
|
||||
var ANSI_BLUE = '4';
|
||||
var ANSI_MAGENTA = '5';
|
||||
var ANSI_CYAN = '6';
|
||||
var ANSI_WHITE = '7';
|
||||
|
||||
var colorCodeMap = {
|
||||
"black" : ANSI_BLACK,
|
||||
"red" : ANSI_RED,
|
||||
"green" : ANSI_GREEN,
|
||||
"yellow" : ANSI_YELLOW,
|
||||
"blue" : ANSI_BLUE,
|
||||
"magenta" : ANSI_MAGENTA,
|
||||
"cyan" : ANSI_CYAN,
|
||||
"white" : ANSI_WHITE
|
||||
}
|
||||
|
||||
function ANSIControlCode(code, parameters)
|
||||
{
|
||||
if (parameters == undefined)
|
||||
parameters = "";
|
||||
else if (typeof(parameters) == 'object' && (parameters instanceof Array))
|
||||
parameters = parameters.join(';');
|
||||
return ANSI_CSI + String(parameters) + String(code);
|
||||
}
|
||||
|
||||
// simple text helpers:
|
||||
|
||||
function ANSITextApplyProperties(string, properties)
|
||||
{
|
||||
return ANSIControlCode(ANSI_TEXT_PROP, properties) + String(string) + ANSIControlCode(ANSI_TEXT_PROP);
|
||||
}
|
||||
|
||||
GLOBAL(ANSITextColorize) = function(string, color)
|
||||
{
|
||||
if (colorCodeMap[color] == undefined)
|
||||
return string;
|
||||
return ANSITextApplyProperties(string, ANSI_FG + colorCodeMap[color]);
|
||||
}
|
||||
|
||||
// CPLogPrint uses the print() functions present in many non-browser command line JavaScript interpreters
|
||||
var levelColorMap = {
|
||||
"fatal": "red",
|
||||
"error": "red",
|
||||
"warn" : "yellow",
|
||||
"info" : "green",
|
||||
"debug": "cyan",
|
||||
"trace": "blue"
|
||||
}
|
||||
|
||||
// CPLogConsole uses the built in "console" object
|
||||
GLOBAL(CPLogConsole) = function(aString, aLevel, aTitle)
|
||||
{
|
||||
@@ -213,18 +138,46 @@ GLOBAL(CPLogConsole) = function(aString, aLevel, aTitle)
|
||||
}
|
||||
|
||||
#if COMMONJS
|
||||
|
||||
var levelColorMap = {
|
||||
"fatal": "red",
|
||||
"error": "red",
|
||||
"warn" : "yellow",
|
||||
"info" : "green",
|
||||
"debug": "cyan",
|
||||
"trace": "blue"
|
||||
}
|
||||
|
||||
try {
|
||||
var SYSTEM = require("system");
|
||||
var FILE = require("file");
|
||||
if (SYSTEM.args[0])
|
||||
CPLogDefaultTitle = FILE.basename(SYSTEM.args[0]);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
var stream;
|
||||
|
||||
GLOBAL(CPLogPrint) = function(aString, aLevel, aTitle)
|
||||
{
|
||||
if (typeof print != "undefined")
|
||||
{
|
||||
if (aLevel == "fatal" || aLevel == "error" || aLevel == "warn")
|
||||
var message = ANSITextColorize(_CPFormatLogMessage(aString, aLevel, aTitle), levelColorMap[aLevel]);
|
||||
else
|
||||
var message = _CPFormatLogMessage(aString, ANSITextColorize(aLevel, levelColorMap[aLevel]), aTitle);
|
||||
if (stream === undefined) {
|
||||
try {
|
||||
stream = require("term").stream;
|
||||
} catch (e) {
|
||||
stream = null;
|
||||
}
|
||||
}
|
||||
|
||||
require("system").stderr.print(message);
|
||||
if (stream) {
|
||||
if (aLevel == "fatal" || aLevel == "error" || aLevel == "warn")
|
||||
stream.print("\0"+levelColorMap[aLevel]+"(" + _CPFormatLogMessage(aString, aLevel, aTitle) + "\0)");
|
||||
else
|
||||
stream.print(_CPFormatLogMessage(aString, "\0"+levelColorMap[aLevel]+"(" + aLevel + "\0)", aTitle));
|
||||
} else if (typeof print != "undefined") {
|
||||
print(_CPFormatLogMessage(aString, aLevel, aTitle))
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// CPLogAlert uses basic browser alert() functions
|
||||
@@ -276,12 +229,31 @@ GLOBAL(CPLogPopup) = function(aString, aLevel, aTitle)
|
||||
}
|
||||
}
|
||||
|
||||
var CPLogPopupStyle ='<style type="text/css" media="screen"> \
|
||||
body{font:10px Monaco,Courier,"Courier New",monospace,mono;padding-top:15px;} \
|
||||
div > .fatal,div > .error,div > .warn,div > .info,div > .debug,div > .trace{display:none;overflow:hidden;white-space:pre;padding:0px 5px 0px 5px;margin-top:2px;-moz-border-radius:5px;-webkit-border-radius:5px;} \
|
||||
div[wrap="yes"] > div{white-space:normal;} \
|
||||
.fatal{background-color:#ffb2b3;} \
|
||||
.error{background-color:#ffe2b2;} \
|
||||
.warn{background-color:#fdffb2;} \
|
||||
.info{background-color:#e4ffb2;} \
|
||||
.debug{background-color:#a0e5a0;} \
|
||||
.trace{background-color:#99b9ff;} \
|
||||
.enfatal .fatal,.enerror .error,.enwarn .warn,.eninfo .info,.endebug .debug,.entrace .trace{display:block;} \
|
||||
div#header{background-color:rgba(240,240,240,0.82);position:fixed;top:0px;left:0px;width:100%;border-bottom:1px solid rgba(0,0,0,0.33);text-align:center;} \
|
||||
ul#enablers{display:inline-block;margin:1px 15px 0 15px;padding:2px 0 2px 0;} \
|
||||
ul#enablers li{display:inline;padding:0px 5px 0px 5px;margin-left:4px;-moz-border-radius:5px;-webkit-border-radius:5px;} \
|
||||
[enabled="no"]{opacity:0.25;} \
|
||||
ul#options{display:inline-block;margin:0 15px 0px 15px;padding:0 0px;} \
|
||||
ul#options li{margin:0 0 0 0;padding:0 0 0 0;display:inline;} \
|
||||
</style>';
|
||||
|
||||
function _CPLogInitPopup(logWindow)
|
||||
{
|
||||
var doc = logWindow.document;
|
||||
|
||||
// HACK so that head is available below:
|
||||
doc.writeln("<html><head><title></title></head><body></body></html>");
|
||||
doc.writeln("<html><head><title></title>"+CPLogPopupStyle+"</head><body></body></html>");
|
||||
|
||||
doc.title = CPLogDefaultTitle + " Run Log";
|
||||
|
||||
@@ -291,13 +263,6 @@ function _CPLogInitPopup(logWindow)
|
||||
var base = window.location.protocol + "//" + window.location.host + window.location.pathname;
|
||||
base = base.substring(0,base.lastIndexOf("/")+1);
|
||||
|
||||
var link = doc.createElement("link");
|
||||
link.setAttribute("type", "text/css");
|
||||
link.setAttribute("rel", "stylesheet");
|
||||
link.setAttribute("href", base+"Frameworks/Foundation/Resources/log.css");
|
||||
link.setAttribute("media", "screen");
|
||||
head.appendChild(link);
|
||||
|
||||
var div = doc.createElement("div");
|
||||
div.setAttribute("id", "header");
|
||||
body.appendChild(div);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
var objj = null;
|
||||
|
||||
function ObjectiveJLoader() {
|
||||
var loader = {};
|
||||
var factories = {};
|
||||
|
||||
loader.reload = function(topId, path) {
|
||||
if (!objj) objj = require("objective-j");
|
||||
if (!global.ObjectiveJ)
|
||||
global.ObjectiveJ = require("objective-j");
|
||||
|
||||
//print("loading objective-j: " + topId + " (" + path + ")");
|
||||
factories[topId] = objj.make_narwhal_factory(path);
|
||||
factories[topId] = ObjectiveJ.make_narwhal_factory(path);
|
||||
factories[topId].path = path;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
|
||||
function objj_debug_object_format(aReceiver)
|
||||
{
|
||||
return (aReceiver && aReceiver.isa) ? sprintf("<%s %#08x>", GETMETA(aReceiver).name, aReceiver._UID) : String(aReceiver);
|
||||
return (aReceiver && aReceiver.isa) ? exports.sprintf("<%s %#08x>", GETMETA(aReceiver).name, aReceiver._UID) : String(aReceiver);
|
||||
}
|
||||
|
||||
function objj_debug_message_format(aReceiver, aSelector)
|
||||
{
|
||||
return sprintf("[%s %s]", objj_debug_object_format(aReceiver), aSelector);
|
||||
return exports.sprintf("[%s %s]", objj_debug_object_format(aReceiver), aSelector);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+202
-168
@@ -36,9 +36,14 @@ function Executable(/*String*/ aCode, /*Array*/ fileDependencies, /*CFURL|String
|
||||
this._URL = makeAbsoluteURL(aURL || new CFURL("(Anonymous" + (AnonymousExecutableCount++) + ")"));
|
||||
|
||||
this._fileDependencies = fileDependencies;
|
||||
this._fileDependencyLoadStatus = ExecutableUnloadedFileDependencies;
|
||||
|
||||
this._eventDispatcher = new EventDispatcher(this);
|
||||
if (fileDependencies.length)
|
||||
{
|
||||
this._fileDependencyStatus = ExecutableUnloadedFileDependencies;
|
||||
this._fileDependencyCallbacks = [];
|
||||
}
|
||||
else
|
||||
this._fileDependencyStatus = ExecutableLoadedFileDependencies;
|
||||
|
||||
if (this._function)
|
||||
return;
|
||||
@@ -58,6 +63,8 @@ Executable.prototype.URL = function()
|
||||
return this._URL;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.URL);
|
||||
|
||||
Executable.prototype.functionParameters = function()
|
||||
{
|
||||
var functionParameters = ["global", "objj_executeFile", "objj_importFile"];
|
||||
@@ -71,6 +78,8 @@ Executable.prototype.functionParameters = function()
|
||||
return functionParameters;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.functionParameters);
|
||||
|
||||
Executable.prototype.functionArguments = function()
|
||||
{
|
||||
var functionArguments = [global, this.fileExecuter(), this.fileImporter()];
|
||||
@@ -82,6 +91,8 @@ Executable.prototype.functionArguments = function()
|
||||
return functionArguments;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.functionArguments);
|
||||
|
||||
#ifdef COMMONJS
|
||||
Executable.setCommonJSParameters = function()
|
||||
{
|
||||
@@ -135,11 +146,15 @@ Executable.prototype.execute = function()
|
||||
return result;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.execute);
|
||||
|
||||
Executable.prototype.code = function()
|
||||
{
|
||||
return this._code;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.code);
|
||||
|
||||
Executable.prototype.setCode = function(code)
|
||||
{
|
||||
this._code = code;
|
||||
@@ -178,240 +193,259 @@ Executable.prototype.setCode = function(code)
|
||||
#endif
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.setCode);
|
||||
|
||||
Executable.prototype.fileDependencies = function()
|
||||
{
|
||||
return this._fileDependencies;
|
||||
}
|
||||
|
||||
Executable.prototype.scope = function()
|
||||
{
|
||||
return this._scope;
|
||||
}
|
||||
DISPLAY_NAME(Executable.prototype.fileDependencies);
|
||||
|
||||
Executable.prototype.hasLoadedFileDependencies = function()
|
||||
{
|
||||
return this._fileDependencyLoadStatus === ExecutableLoadedFileDependencies;
|
||||
return this._fileDependencyStatus === ExecutableLoadedFileDependencies;
|
||||
}
|
||||
var globalIteration = 0;
|
||||
|
||||
Executable.prototype.loadFileDependencies = function()
|
||||
DISPLAY_NAME(Executable.prototype.hasLoadedFileDependencies);
|
||||
|
||||
var fileDependencyLoadCount = 0,
|
||||
fileDependencyExecutables = [],
|
||||
fileDependencyMarkers = { };
|
||||
|
||||
Executable.prototype.loadFileDependencies = function(aCallback)
|
||||
{
|
||||
#if DEPENDENCY_LOGGING
|
||||
CPLog("DEPENDENCY: initiated by " + this.scope());
|
||||
#endif
|
||||
if (this._fileDependencyLoadStatus !== ExecutableUnloadedFileDependencies)
|
||||
return;
|
||||
var status = this._fileDependencyStatus;
|
||||
|
||||
this._fileDependencyLoadStatus = ExecutableLoadingFileDependencies;
|
||||
if (status === ExecutableLoadedFileDependencies)
|
||||
return aCallback();
|
||||
|
||||
var searchedURLStrings = [{ }, { }],
|
||||
fileExecutableSearches = new CFMutableDictionary(),
|
||||
incompleteFileExecutableSearches = new CFMutableDictionary(),
|
||||
loadingExecutables = { };
|
||||
this._fileDependencyCallbacks.push(aCallback)
|
||||
|
||||
function searchForFileDependencies(/*Executable*/ anExecutable)
|
||||
if (status === ExecutableUnloadedFileDependencies)
|
||||
{
|
||||
var executables = [anExecutable],
|
||||
executableIndex = 0,
|
||||
executableCount = executables.length;
|
||||
if (fileDependencyLoadCount)
|
||||
throw "Can't load";
|
||||
|
||||
for (; executableIndex < executableCount; ++executableIndex)
|
||||
{
|
||||
var executable = executables[executableIndex];
|
||||
|
||||
if (executable.hasLoadedFileDependencies())
|
||||
continue;
|
||||
|
||||
var executableURLString = executable.URL().absoluteString();
|
||||
|
||||
loadingExecutables[executableURLString] = executable;
|
||||
|
||||
var referenceURL = new CFURL(".", executable.URL()),
|
||||
fileDependencies = executable.fileDependencies(),
|
||||
fileDependencyIndex = 0,
|
||||
fileDependencyCount = fileDependencies.length;
|
||||
|
||||
for (; fileDependencyIndex < fileDependencyCount; ++fileDependencyIndex)
|
||||
{
|
||||
var fileDependency = fileDependencies[fileDependencyIndex],
|
||||
isLocal = fileDependency.isLocal(),
|
||||
URL = fileDependency.URL();
|
||||
|
||||
if (isLocal)
|
||||
URL = new CFURL(URL, referenceURL);
|
||||
|
||||
var URLString = URL.absoluteString();
|
||||
|
||||
if (searchedURLStrings[isLocal ? 1 : 0][URLString])
|
||||
continue;
|
||||
|
||||
searchedURLStrings[isLocal ? 1 : 0][URLString] = YES;
|
||||
|
||||
var fileExecutableSearch = new FileExecutableSearch(URL, isLocal),
|
||||
fileExecutableSearchUID = fileExecutableSearch.UID();
|
||||
|
||||
if (fileExecutableSearches.containsKey(fileExecutableSearchUID))
|
||||
continue;
|
||||
|
||||
fileExecutableSearches.setValueForKey(fileExecutableSearchUID, fileExecutableSearch);
|
||||
|
||||
if (fileExecutableSearch.isComplete())
|
||||
{
|
||||
executables.push(fileExecutableSearch.result());
|
||||
++executableCount;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
incompleteFileExecutableSearches.setValueForKey(fileExecutableSearchUID, fileExecutableSearch);
|
||||
|
||||
fileExecutableSearch.addEventListener("complete", function( anEvent)
|
||||
{
|
||||
var fileExecutableSearch = anEvent.fileExecutableSearch;
|
||||
|
||||
incompleteFileExecutableSearches.removeValueForKey(fileExecutableSearch.UID());
|
||||
|
||||
searchForFileDependencies(fileExecutableSearch.result());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (incompleteFileExecutableSearches.count() > 0)
|
||||
#if !DEPENDENCY_LOGGING
|
||||
return;
|
||||
#else
|
||||
{
|
||||
CPLog("DEPENDENCY: more dependencies: ");
|
||||
CPLog(incompleteFileExecutableSearches.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
CPLog("DEPENDENCY: Ended");
|
||||
#endif
|
||||
|
||||
for (var URLString in loadingExecutables)
|
||||
if (hasOwnProperty.call(loadingExecutables, URLString))
|
||||
loadingExecutables[URLString]._fileDependencyLoadStatus = ExecutableLoadedFileDependencies;
|
||||
|
||||
for (var URLString in loadingExecutables)
|
||||
if (hasOwnProperty.call(loadingExecutables, URLString))
|
||||
{
|
||||
var executable = loadingExecutables[URLString];
|
||||
|
||||
executable._eventDispatcher.dispatchEvent(
|
||||
{
|
||||
type:"dependenciesload",
|
||||
executable:executable
|
||||
});
|
||||
}
|
||||
loadFileDependenciesForExecutable(this);
|
||||
}
|
||||
|
||||
searchForFileDependencies(this);
|
||||
}
|
||||
|
||||
Executable.prototype.addEventListener = function(/*String*/ anEventName, /*Function*/ aListener)
|
||||
DISPLAY_NAME(Executable.prototype.loadFileDependencies);
|
||||
|
||||
function loadFileDependenciesForExecutable(/*Executable*/ anExecutable)
|
||||
{
|
||||
this._eventDispatcher.addEventListener(anEventName, aListener);
|
||||
fileDependencyExecutables.push(anExecutable);
|
||||
anExecutable._fileDependencyStatus = ExecutableLoadingFileDependencies;
|
||||
|
||||
var fileDependencies = anExecutable.fileDependencies(),
|
||||
index = 0,
|
||||
count = fileDependencies.length,
|
||||
referenceURL = anExecutable.referenceURL(),
|
||||
referenceURLString = referenceURL.absoluteString(),
|
||||
fileExecutableSearcher = anExecutable.fileExecutableSearcher();
|
||||
|
||||
fileDependencyLoadCount += count;
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var fileDependency = fileDependencies[index],
|
||||
isQuoted = fileDependency.isLocal(),
|
||||
URL = fileDependency.URL(),
|
||||
marker = (isQuoted && (referenceURLString + " ") || "") + URL;
|
||||
|
||||
if (fileDependencyMarkers[marker])
|
||||
{
|
||||
if (--fileDependencyLoadCount === 0)
|
||||
fileExecutableDependencyLoadFinished();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
fileDependencyMarkers[marker] = YES;
|
||||
fileExecutableSearcher(URL, isQuoted, fileExecutableSearchFinished);
|
||||
}
|
||||
}
|
||||
|
||||
Executable.prototype.removeEventListener = function(/*String*/ anEventName, /*Function*/ aListener)
|
||||
function fileExecutableSearchFinished(/*FileExecutable*/ aFileExecutable)
|
||||
{
|
||||
this._eventDispatcher.removeEventListener(anEventName, aListener);
|
||||
--fileDependencyLoadCount;
|
||||
|
||||
if (aFileExecutable._fileDependencyStatus === ExecutableUnloadedFileDependencies)
|
||||
loadFileDependenciesForExecutable(aFileExecutable);
|
||||
|
||||
else if (fileDependencyLoadCount === 0)
|
||||
fileExecutableDependencyLoadFinished();
|
||||
}
|
||||
|
||||
function fileExecutableDependencyLoadFinished()
|
||||
{
|
||||
var index = 0,
|
||||
count = fileDependencyExecutables.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
fileDependencyExecutables[index]._fileDependencyStatus = ExecutableLoadedFileDependencies;
|
||||
|
||||
for (index = 0; index < count; ++index)
|
||||
{
|
||||
var executable = fileDependencyExecutables[index],
|
||||
callbacks = executable._fileDependencyCallbacks,
|
||||
callbackIndex = 0,
|
||||
callbackCount = callbacks.length;
|
||||
|
||||
for (; callbackIndex < callbackCount; ++callbackIndex)
|
||||
callbacks[callbackIndex]();
|
||||
|
||||
executable._fileDependencyCallbacks = [];
|
||||
}
|
||||
}
|
||||
|
||||
Executable.prototype.referenceURL = function()
|
||||
{
|
||||
if (this._referenceURL === undefined)
|
||||
this._referenceURL = new CFURL(".", this.URL());
|
||||
|
||||
return this._referenceURL;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.referenceURL);
|
||||
|
||||
Executable.prototype.fileImporter = function()
|
||||
{
|
||||
return Executable.fileImporterForURL(new CFURL(".", this.URL()));
|
||||
return Executable.fileImporterForURL(this.referenceURL());
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.fileImporter);
|
||||
|
||||
Executable.prototype.fileExecuter = function()
|
||||
{
|
||||
return Executable.fileExecuterForURL(new CFURL(".", this.URL()));
|
||||
return Executable.fileExecuterForURL(this.referenceURL());
|
||||
}
|
||||
|
||||
var cachedFileExecutersForURLStrings = { };
|
||||
DISPLAY_NAME(Executable.prototype.fileExecuter);
|
||||
|
||||
Executable.prototype.fileExecutableSearcher = function()
|
||||
{
|
||||
return Executable.fileExecutableSearcherForURL(this.referenceURL());
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.fileExecutableSearcher);
|
||||
|
||||
var cachedFileExecuters = { };
|
||||
|
||||
Executable.fileExecuterForURL = function(/*CFURL|String*/ aURL)
|
||||
{
|
||||
var referenceURL = makeAbsoluteURL(aURL),
|
||||
referenceURLString = referenceURL.absoluteString(),
|
||||
cachedFileExecuter = cachedFileExecutersForURLStrings[referenceURLString];
|
||||
cachedFileExecuter = cachedFileExecuters[referenceURLString];
|
||||
|
||||
if (!cachedFileExecuter)
|
||||
{
|
||||
cachedFileExecuter = function(/*CFURL*/ aURL, /*BOOL*/ isQuoted, /*BOOL*/ shouldForce)
|
||||
{
|
||||
aURL = new CFURL(aURL, isQuoted ? referenceURL : NULL);
|
||||
Executable.fileExecutableSearcherForURL(referenceURL)(aURL, isQuoted,
|
||||
function(/*FileExecutable*/ aFileExecutable)
|
||||
{
|
||||
if (!aFileExecutable.hasLoadedFileDependencies())
|
||||
throw "No executable loaded for file at URL " + aURL;
|
||||
|
||||
var fileExecutableSearch = new FileExecutableSearch(aURL, isQuoted),
|
||||
fileExecutable = fileExecutableSearch.result();
|
||||
|
||||
if (!fileExecutable.hasLoadedFileDependencies())
|
||||
throw "No executable loaded for file at URL " + aURL;
|
||||
|
||||
fileExecutable.execute(shouldForce);
|
||||
aFileExecutable.execute(shouldForce);
|
||||
});
|
||||
}
|
||||
|
||||
cachedFileExecutersForURLStrings[referenceURLString] = cachedFileExecuter;
|
||||
cachedFileExecuters[referenceURLString] = cachedFileExecuter;
|
||||
}
|
||||
|
||||
return cachedFileExecuter;
|
||||
}
|
||||
|
||||
var cachedImportersForURLStrings = { };
|
||||
DISPLAY_NAME(Executable.fileExecuterForURL);
|
||||
|
||||
var cachedFileImporters = { };
|
||||
|
||||
Executable.fileImporterForURL = function(/*CFURL|String*/ aURL)
|
||||
{
|
||||
var referenceURL = makeAbsoluteURL(aURL),
|
||||
referenceURLString = referenceURL.absoluteString(),
|
||||
cachedImporter = cachedImportersForURLStrings[referenceURLString];
|
||||
cachedFileImporter = cachedFileImporters[referenceURLString];
|
||||
|
||||
if (!cachedImporter)
|
||||
if (!cachedFileImporter)
|
||||
{
|
||||
cachedImporter = function(/*CFURL*/ aURL, /*BOOL*/ isQuoted, /*Function*/ aCallback)
|
||||
cachedFileImporter = function(/*CFURL*/ aURL, /*BOOL*/ isQuoted, /*Function*/ aCallback)
|
||||
{
|
||||
// We make heavy use of URLs throughout this process, so cache them!
|
||||
enableCFURLCaching();
|
||||
|
||||
aURL = new CFURL(aURL, isQuoted ? referenceURL : NULL);
|
||||
|
||||
var fileExecutableSearch = new FileExecutableSearch(aURL, isQuoted);
|
||||
|
||||
function searchComplete(/*FileExecutableSearch*/ aFileExecutableSearch)
|
||||
Executable.fileExecutableSearcherForURL(referenceURL)(aURL, isQuoted,
|
||||
function(/*FileExecutable*/ aFileExecutable)
|
||||
{
|
||||
var fileExecutable = aFileExecutableSearch.result(),
|
||||
executeAndCallback = function ()
|
||||
{
|
||||
fileExecutable.execute();
|
||||
|
||||
// No more need to cache these.
|
||||
disableCFURLCaching();
|
||||
|
||||
if (aCallback)
|
||||
aCallback();
|
||||
}
|
||||
|
||||
if (!fileExecutable.hasLoadedFileDependencies())
|
||||
aFileExecutable.loadFileDependencies(function()
|
||||
{
|
||||
fileExecutable.addEventListener("dependenciesload", executeAndCallback);
|
||||
fileExecutable.loadFileDependencies();
|
||||
}
|
||||
else
|
||||
executeAndCallback();
|
||||
}
|
||||
aFileExecutable.execute();
|
||||
|
||||
if (fileExecutableSearch.isComplete())
|
||||
searchComplete(fileExecutableSearch);
|
||||
else
|
||||
fileExecutableSearch.addEventListener("complete", function(/*Event*/ anEvent)
|
||||
{
|
||||
searchComplete(anEvent.fileExecutableSearch);
|
||||
// No more need to cache these.
|
||||
disableCFURLCaching();
|
||||
|
||||
if (aCallback)
|
||||
aCallback();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
cachedImportersForURLStrings[referenceURLString] = cachedImporter;
|
||||
cachedFileImporters[referenceURLString] = cachedFileImporter;
|
||||
}
|
||||
|
||||
return cachedImporter;
|
||||
return cachedFileImporter;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.fileImporterForURL);
|
||||
|
||||
var cachedFileExecutableSearchers = { },
|
||||
cachedFileExecutableSearchResults = { };
|
||||
|
||||
Executable.fileExecutableSearcherForURL = function(/*CFURL*/ referenceURL)
|
||||
{
|
||||
var referenceURLString = referenceURL.absoluteString(),
|
||||
cachedFileExecutableSearcher = cachedFileExecutableSearchers[referenceURLString],
|
||||
cachedSearchResults = { };
|
||||
|
||||
if (!cachedFileExecutableSearcher)
|
||||
{
|
||||
cachedFileExecutableSearcher = function(/*CFURL*/ aURL, /*BOOL*/ isQuoted, /*Function*/ success)
|
||||
{
|
||||
var cacheUID = (isQuoted && referenceURL || "") + aURL,
|
||||
cachedResult = cachedFileExecutableSearchResults[cacheUID];
|
||||
|
||||
if (cachedResult)
|
||||
return completed(cachedResult);
|
||||
|
||||
var isAbsoluteURL = (aURL instanceof CFURL) && aURL.scheme();
|
||||
|
||||
if (isQuoted || isAbsoluteURL)
|
||||
{
|
||||
if (!isAbsoluteURL)
|
||||
aURL = new CFURL(aURL, referenceURL);
|
||||
|
||||
StaticResource.resolveResourceAtURL(aURL, NO, completed);
|
||||
}
|
||||
else
|
||||
StaticResource.resolveResourceAtURLSearchingIncludeURLs(aURL, completed);
|
||||
|
||||
function completed(/*StaticResource*/ aStaticResource)
|
||||
{
|
||||
if (!aStaticResource)
|
||||
throw new Error("Could not load file at " + aURL);
|
||||
|
||||
cachedFileExecutableSearchResults[cacheUID] = aStaticResource;
|
||||
|
||||
success(new FileExecutable(aStaticResource.URL()));
|
||||
}
|
||||
};
|
||||
|
||||
cachedFileExecutableSearchers[referenceURLString] = cachedFileExecutableSearcher;
|
||||
}
|
||||
|
||||
return cachedFileExecutableSearcher;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(Executable.fileExecutableSearcherForURL);
|
||||
@@ -83,16 +83,15 @@ FileExecutable.prototype.execute = function(/*BOOL*/ shouldForce)
|
||||
Executable.prototype.execute.call(this);
|
||||
}
|
||||
|
||||
FileExecutable.prototype.URL = function()
|
||||
{
|
||||
return this._URL;
|
||||
}
|
||||
DISPLAY_NAME(FileExecutable.prototype.execute);
|
||||
|
||||
FileExecutable.prototype.hasExecuted = function()
|
||||
{
|
||||
return this._hasExecuted;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(FileExecutable.prototype.hasExecuted);
|
||||
|
||||
function decompile(/*String*/ aString, /*CFURL*/ aURL)
|
||||
{
|
||||
var stream = new MarkedStream(aString);
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* FileExecutableSearch.js
|
||||
* Objective-J
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2010, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
var FileExecutableSearchesForPaths = [{ }, { }];
|
||||
|
||||
function FileExecutableSearch(/*CFURL*/ aURL, /*BOOL*/ isQuoted)
|
||||
{
|
||||
// if (isQuoted && !aURL.protocol())
|
||||
// throw "Local searches cannot be relative: " + aPath;
|
||||
var URLString = aURL.absoluteString(),
|
||||
existingSearch = FileExecutableSearchesForPaths[isQuoted ? 1 : 0][URLString];
|
||||
|
||||
if (existingSearch)
|
||||
return existingSearch;
|
||||
|
||||
FileExecutableSearchesForPaths[isQuoted ? 1 : 0][URLString] = this;
|
||||
|
||||
this._UID = objj_generateObjectUID();
|
||||
|
||||
this._URL = aURL;
|
||||
this._isComplete = NO;
|
||||
this._eventDispatcher = new EventDispatcher(this);
|
||||
|
||||
this._result = NULL;
|
||||
|
||||
var self = this;
|
||||
|
||||
function completed(/*String*/ aStaticResource)
|
||||
{
|
||||
if (!aStaticResource)
|
||||
throw new Error("Could not load file at " + aURL);
|
||||
|
||||
self._result = new FileExecutable(aStaticResource.URL());
|
||||
self._isComplete = YES;
|
||||
|
||||
self._eventDispatcher.dispatchEvent(
|
||||
{
|
||||
type:"complete",
|
||||
fileExecutableSearch:self
|
||||
});
|
||||
}
|
||||
|
||||
if (isQuoted)
|
||||
StaticResource.resolveResourceAtURL(aURL, NO, completed);
|
||||
else
|
||||
StaticResource.resolveResourceAtURLSearchingIncludeURLs(aURL, completed);
|
||||
}
|
||||
|
||||
exports.FileExecutableSearch = FileExecutableSearch;
|
||||
|
||||
FileExecutableSearch.prototype.URL = function()
|
||||
{
|
||||
return this._URL;
|
||||
}
|
||||
|
||||
FileExecutableSearch.prototype.result = function()
|
||||
{
|
||||
return this._result;
|
||||
}
|
||||
|
||||
FileExecutableSearch.prototype.UID = function()
|
||||
{
|
||||
return this._UID;
|
||||
}
|
||||
|
||||
FileExecutableSearch.prototype.isComplete = function()
|
||||
{
|
||||
return this._isComplete;
|
||||
}
|
||||
|
||||
FileExecutableSearch.prototype.result = function()
|
||||
{
|
||||
return this._result;
|
||||
}
|
||||
|
||||
FileExecutableSearch.prototype.addEventListener = function(/*String*/ anEventName, /*Function*/ aListener)
|
||||
{
|
||||
this._eventDispatcher.addEventListener(anEventName, aListener);
|
||||
}
|
||||
|
||||
FileExecutableSearch.prototype.removeEventListener = function(/*String*/ anEventName, /*Function*/ aListener)
|
||||
{
|
||||
this._eventDispatcher.removeEventListener(anEventName, aListener);
|
||||
}
|
||||
|
||||
#if DEPENDENCY_LOGGING
|
||||
FileExecutableSearch.prototype.toString = function()
|
||||
{
|
||||
return "<FileExecutableSearch: " + this.path() + ">";
|
||||
}
|
||||
#endif
|
||||
@@ -20,7 +20,13 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#define GLOBAL(object) object
|
||||
#if DEBUG
|
||||
#define DISPLAY_NAME(name) name.displayName = #name
|
||||
#else
|
||||
#define DISPLAY_NAME(name)
|
||||
#endif
|
||||
|
||||
#define GLOBAL(name) name
|
||||
|
||||
#include "DebugOptions.js"
|
||||
#include "json2.js"
|
||||
@@ -40,7 +46,6 @@
|
||||
#include "FileDependency.js"
|
||||
#include "Executable.js"
|
||||
#include "FileExecutable.js"
|
||||
#include "FileExecutableSearch.js"
|
||||
#include "Runtime.js"
|
||||
#if defined(DEBUG) || defined(COMMONJS)
|
||||
#include "Debug.js"
|
||||
|
||||
@@ -40,11 +40,15 @@ MarkedStream.prototype.magicNumber = function()
|
||||
return this._magicNumber;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(MarkedStream.prototype.magicNumber);
|
||||
|
||||
MarkedStream.prototype.version = function()
|
||||
{
|
||||
return this._version;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(MarkedStream.prototype.version);
|
||||
|
||||
MarkedStream.prototype.getMarker = function()
|
||||
{
|
||||
var string = this._string,
|
||||
@@ -68,6 +72,8 @@ MarkedStream.prototype.getMarker = function()
|
||||
return marker;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(MarkedStream.prototype.getMarker);
|
||||
|
||||
MarkedStream.prototype.getString = function()
|
||||
{
|
||||
var string = this._string,
|
||||
@@ -81,10 +87,12 @@ MarkedStream.prototype.getString = function()
|
||||
if (next < 0)
|
||||
return null;
|
||||
|
||||
var size = parseInt(string.substring(location, next)),
|
||||
var size = parseInt(string.substring(location, next), 10),
|
||||
text = string.substr(next + 1, size);
|
||||
|
||||
this._location = next + 1 + size;
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(MarkedStream.prototype.getString);
|
||||
+82
-2
@@ -39,6 +39,8 @@ GLOBAL(objj_ivar) = function(/*String*/ aName, /*String*/ aType)
|
||||
this.type = aType;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_ivar);
|
||||
|
||||
GLOBAL(objj_method) = function(/*String*/ aName, /*IMP*/ anImplementation, /*String*/ types)
|
||||
{
|
||||
this.name = aName;
|
||||
@@ -46,6 +48,8 @@ GLOBAL(objj_method) = function(/*String*/ aName, /*IMP*/ anImplementation, /*Str
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_method);
|
||||
|
||||
GLOBAL(objj_class) = function()
|
||||
{
|
||||
this.isa = NULL;
|
||||
@@ -67,12 +71,16 @@ GLOBAL(objj_class) = function()
|
||||
this._UID = -1;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_class);
|
||||
|
||||
GLOBAL(objj_object) = function()
|
||||
{
|
||||
this.isa = NULL;
|
||||
this._UID = -1;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_object);
|
||||
|
||||
// Working with Classes
|
||||
|
||||
GLOBAL(class_getName) = function(/*Class*/ aClass)
|
||||
@@ -83,6 +91,8 @@ GLOBAL(class_getName) = function(/*Class*/ aClass)
|
||||
return aClass.name;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_getName);
|
||||
|
||||
GLOBAL(class_isMetaClass) = function(/*Class*/ aClass)
|
||||
{
|
||||
if (!aClass)
|
||||
@@ -91,6 +101,8 @@ GLOBAL(class_isMetaClass) = function(/*Class*/ aClass)
|
||||
return ISMETA(aClass);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_isMetaClass);
|
||||
|
||||
GLOBAL(class_getSuperclass) = function(/*Class*/ aClass)
|
||||
{
|
||||
if (aClass == Nil)
|
||||
@@ -99,6 +111,8 @@ GLOBAL(class_getSuperclass) = function(/*Class*/ aClass)
|
||||
return aClass.super_class;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_getSuperclass)
|
||||
|
||||
GLOBAL(class_setSuperclass) = function(/*Class*/ aClass, /*Class*/ aSuperClass)
|
||||
{
|
||||
// Set up the actual class hierarchy.
|
||||
@@ -106,6 +120,8 @@ GLOBAL(class_setSuperclass) = function(/*Class*/ aClass, /*Class*/ aSuperClass)
|
||||
aClass.isa.super_class = aSuperClass.isa;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_setSuperclass);
|
||||
|
||||
GLOBAL(class_addIvar) = function(/*Class*/ aClass, /*String*/ aName, /*String*/ aType)
|
||||
{
|
||||
var thePrototype = aClass.allocator.prototype;
|
||||
@@ -119,6 +135,8 @@ GLOBAL(class_addIvar) = function(/*Class*/ aClass, /*String*/ aName, /*String*/
|
||||
return YES;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_addIvar);
|
||||
|
||||
GLOBAL(class_addIvars) = function(/*Class*/ aClass, /*Array*/ivars)
|
||||
{
|
||||
var index = 0,
|
||||
@@ -138,11 +156,15 @@ GLOBAL(class_addIvars) = function(/*Class*/ aClass, /*Array*/ivars)
|
||||
}
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_addIvars);
|
||||
|
||||
GLOBAL(class_copyIvarList) = function(/*Class*/ aClass)
|
||||
{
|
||||
return aClass.ivars.slice(0);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_copyIvarList);
|
||||
|
||||
//#define class_copyIvarList(aClass) (aClass.ivars.slice(0))
|
||||
|
||||
#define METHOD_DISPLAY_NAME(aClass, aMethod) (ISMETA(aClass) ? '+' : '-') + " [" + class_getName(aClass) + ' ' + method_getName(aMethod) + ']'
|
||||
@@ -157,8 +179,10 @@ GLOBAL(class_addMethod) = function(/*Class*/ aClass, /*SEL*/ aName, /*IMP*/ anIm
|
||||
aClass.method_list.push(method);
|
||||
aClass.method_dtable[aName] = method;
|
||||
|
||||
#if DEBUG
|
||||
// Give this function a "pretty" name for the console.
|
||||
method.method_imp.displayName = METHOD_DISPLAY_NAME(aClass, method);
|
||||
#endif
|
||||
|
||||
// FIXME: Should this be done here?
|
||||
// If this is a root class...
|
||||
@@ -168,6 +192,8 @@ GLOBAL(class_addMethod) = function(/*Class*/ aClass, /*SEL*/ aName, /*IMP*/ anIm
|
||||
return YES;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_addMethod);
|
||||
|
||||
GLOBAL(class_addMethods) = function(/*Class*/ aClass, /*Array*/ methods)
|
||||
{
|
||||
var index = 0,
|
||||
@@ -186,8 +212,10 @@ GLOBAL(class_addMethods) = function(/*Class*/ aClass, /*Array*/ methods)
|
||||
method_list.push(method);
|
||||
method_dtable[method.name] = method;
|
||||
|
||||
#if DEBUG
|
||||
// Give this function a "pretty" name for the console.
|
||||
method.method_imp.displayName = METHOD_DISPLAY_NAME(aClass, method);
|
||||
#endif
|
||||
}
|
||||
|
||||
// If this is a root class...
|
||||
@@ -195,6 +223,8 @@ GLOBAL(class_addMethods) = function(/*Class*/ aClass, /*Array*/ methods)
|
||||
class_addMethods(GETMETA(aClass), methods);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_addMethods);
|
||||
|
||||
GLOBAL(class_getInstanceMethod) = function(/*Class*/ aClass, /*SEL*/ aSelector)
|
||||
{
|
||||
if (!aClass || !aSelector)
|
||||
@@ -205,6 +235,8 @@ GLOBAL(class_getInstanceMethod) = function(/*Class*/ aClass, /*SEL*/ aSelector)
|
||||
return method ? method : NULL;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_getInstanceMethod);
|
||||
|
||||
GLOBAL(class_getClassMethod) = function(/*Class*/ aClass, /*SEL*/ aSelector)
|
||||
{
|
||||
if (!aClass || !aSelector)
|
||||
@@ -215,11 +247,15 @@ GLOBAL(class_getClassMethod) = function(/*Class*/ aClass, /*SEL*/ aSelector)
|
||||
return method ? method : NULL;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_getClassMethod);
|
||||
|
||||
GLOBAL(class_copyMethodList) = function(/*Class*/ aClass)
|
||||
{
|
||||
return aClass.method_list.slice(0);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_copyMethodList);
|
||||
|
||||
GLOBAL(class_replaceMethod) = function(/*Class*/ aClass, /*SEL*/ aSelector, /*IMP*/ aMethodImplementation)
|
||||
{
|
||||
if (!aClass || !aSelector)
|
||||
@@ -236,6 +272,8 @@ GLOBAL(class_replaceMethod) = function(/*Class*/ aClass, /*SEL*/ aSelector, /*IM
|
||||
return method_imp;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_replaceMethod);
|
||||
|
||||
var _class_initialize = function(/*Class*/ aClass)
|
||||
{
|
||||
var meta = GETMETA(aClass);
|
||||
@@ -280,6 +318,8 @@ GLOBAL(class_getMethodImplementation) = function(/*Class*/ aClass, /*SEL*/ aSele
|
||||
return implementation;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_getMethodImplementation);
|
||||
|
||||
// Adding Classes
|
||||
var REGISTERED_CLASSES = { };
|
||||
|
||||
@@ -327,6 +367,8 @@ GLOBAL(objj_allocateClassPair) = function(/*Class*/ superclass, /*String*/ aName
|
||||
return classObject;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_allocateClassPair);
|
||||
|
||||
var CONTEXT_BUNDLE = nil;
|
||||
|
||||
GLOBAL(objj_registerClassPair) = function(/*Class*/ aClass)
|
||||
@@ -337,6 +379,8 @@ GLOBAL(objj_registerClassPair) = function(/*Class*/ aClass)
|
||||
addClassToBundle(aClass, CONTEXT_BUNDLE);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_registerClassPair);
|
||||
|
||||
// Instantiating Classes
|
||||
|
||||
GLOBAL(class_createInstance) = function(/*Class*/ aClass)
|
||||
@@ -352,6 +396,8 @@ GLOBAL(class_createInstance) = function(/*Class*/ aClass)
|
||||
return object;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(class_createInstance);
|
||||
|
||||
// Opera 9.5.1 has a bug where prototypes "inheret" members from instances when "with" is used.
|
||||
// Given that the Opera team is so fond of bug-testing instead of version-testing, we'll go
|
||||
// ahead and do that.
|
||||
@@ -409,6 +455,8 @@ GLOBAL(object_getClassName) = function(/*id*/ anObject)
|
||||
return theClass ? class_getName(theClass) : "";
|
||||
}
|
||||
|
||||
DISPLAY_NAME(object_getClassName);
|
||||
|
||||
//objc_getClassList
|
||||
GLOBAL(objj_lookUpClass) = function(/*String*/ aName)
|
||||
{
|
||||
@@ -417,6 +465,8 @@ GLOBAL(objj_lookUpClass) = function(/*String*/ aName)
|
||||
return theClass ? theClass : Nil;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_lookUpClass);
|
||||
|
||||
GLOBAL(objj_getClass) = function(/*String*/ aName)
|
||||
{
|
||||
var theClass = REGISTERED_CLASSES[aName];
|
||||
@@ -429,6 +479,8 @@ GLOBAL(objj_getClass) = function(/*String*/ aName)
|
||||
return theClass ? theClass : Nil;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_getClass);
|
||||
|
||||
//objc_getRequiredClass
|
||||
GLOBAL(objj_getMetaClass) = function(/*String*/ aName)
|
||||
{
|
||||
@@ -437,6 +489,8 @@ GLOBAL(objj_getMetaClass) = function(/*String*/ aName)
|
||||
return GETMETA(theClass);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_getMetaClass);
|
||||
|
||||
// Working with Instance Variables
|
||||
|
||||
GLOBAL(ivar_getName) = function(anIvar)
|
||||
@@ -444,19 +498,25 @@ GLOBAL(ivar_getName) = function(anIvar)
|
||||
return anIvar.name;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(ivar_getName);
|
||||
|
||||
GLOBAL(ivar_getTypeEncoding) = function(anIvar)
|
||||
{
|
||||
return anIvar.type;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(ivar_getTypeEncoding);
|
||||
|
||||
// Sending Messages
|
||||
|
||||
GLOBAL(objj_msgSend) = function(/*id*/ aReceiver, /*SEL*/ aSelector)
|
||||
{
|
||||
if (aReceiver == nil)
|
||||
return nil;
|
||||
|
||||
CLASS_GET_METHOD_IMPLEMENTATION(var implementation, aReceiver.isa, aSelector);
|
||||
|
||||
var isa = aReceiver.isa;
|
||||
|
||||
CLASS_GET_METHOD_IMPLEMENTATION(var implementation, isa, aSelector);
|
||||
|
||||
switch(arguments.length)
|
||||
{
|
||||
@@ -468,6 +528,8 @@ GLOBAL(objj_msgSend) = function(/*id*/ aReceiver, /*SEL*/ aSelector)
|
||||
return implementation.apply(aReceiver, arguments);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_msgSend);
|
||||
|
||||
GLOBAL(objj_msgSendSuper) = function(/*id*/ aSuper, /*SEL*/ aSelector)
|
||||
{
|
||||
var super_class = aSuper.super_class;
|
||||
@@ -479,6 +541,8 @@ GLOBAL(objj_msgSendSuper) = function(/*id*/ aSuper, /*SEL*/ aSelector)
|
||||
return implementation.apply(aSuper.receiver, arguments);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(objj_msgSendSuper);
|
||||
|
||||
// Working with Methods
|
||||
|
||||
GLOBAL(method_getName) = function(/*Method*/ aMethod)
|
||||
@@ -486,11 +550,15 @@ GLOBAL(method_getName) = function(/*Method*/ aMethod)
|
||||
return aMethod.name;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(method_getName);
|
||||
|
||||
GLOBAL(method_getImplementation) = function(/*Method*/ aMethod)
|
||||
{
|
||||
return aMethod.method_imp;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(method_getImplementation);
|
||||
|
||||
GLOBAL(method_setImplementation) = function(/*Method*/ aMethod, /*IMP*/ anImplementation)
|
||||
{
|
||||
var oldImplementation = aMethod.method_imp;
|
||||
@@ -500,6 +568,8 @@ GLOBAL(method_setImplementation) = function(/*Method*/ aMethod, /*IMP*/ anImplem
|
||||
return oldImplementation;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(method_setImplementation);
|
||||
|
||||
GLOBAL(method_exchangeImplementations) = function(/*Method*/ lhs, /*Method*/ rhs)
|
||||
{
|
||||
var lhs_imp = method_getImplementation(lhs),
|
||||
@@ -509,6 +579,8 @@ GLOBAL(method_exchangeImplementations) = function(/*Method*/ lhs, /*Method*/ rhs
|
||||
method_setImplementation(rhs, lhs_imp);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(method_exchangeImplementations);
|
||||
|
||||
// Working with Selectors
|
||||
|
||||
GLOBAL(sel_getName) = function(aSelector)
|
||||
@@ -516,17 +588,25 @@ GLOBAL(sel_getName) = function(aSelector)
|
||||
return aSelector ? aSelector : "<null selector>";
|
||||
}
|
||||
|
||||
DISPLAY_NAME(sel_getName);
|
||||
|
||||
GLOBAL(sel_getUid) = function(/*String*/ aName)
|
||||
{
|
||||
return aName;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(sel_getUid);
|
||||
|
||||
GLOBAL(sel_isEqual) = function(/*SEL*/ lhs, /*SEL*/ rhs)
|
||||
{
|
||||
return lhs === rhs;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(sel_isEqual);
|
||||
|
||||
GLOBAL(sel_registerName) = function(/*String*/ aName)
|
||||
{
|
||||
return aName;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(sel_registerName);
|
||||
@@ -1,26 +1,28 @@
|
||||
|
||||
var rootResources = { };
|
||||
|
||||
function StaticResource(/*String*/ aName, /*StaticResource*/ aParent, /*BOOL*/ isDirectory, /*BOOL*/ isResolved)
|
||||
function StaticResource(/*CFURL*/ aURL, /*StaticResource*/ aParent, /*BOOL*/ isDirectory, /*BOOL*/ isResolved)
|
||||
{
|
||||
this._parent = aParent;
|
||||
this._eventDispatcher = new EventDispatcher(this);
|
||||
|
||||
this._name = aName;
|
||||
var name = aURL.absoluteURL().lastPathComponent() || aURL.schemeAndAuthority();
|
||||
|
||||
this._name = name;
|
||||
this._URL = aURL; //new CFURL(aName, aParent && aParent.URL().asDirectoryPathURL());
|
||||
this._isResolved = !!isResolved;
|
||||
this._URL = new CFURL(aName, aParent && aParent.URL().asDirectoryPathURL());
|
||||
|
||||
if (isDirectory)
|
||||
this._URL = this._URL.asDirectoryPathURL();
|
||||
|
||||
if (!aParent)
|
||||
rootResources[aName] = this;
|
||||
rootResources[name] = this;
|
||||
|
||||
this._isDirectory = !!isDirectory;
|
||||
this._isNotFound = NO;
|
||||
|
||||
if (aParent)
|
||||
aParent._children[aName] = this;
|
||||
aParent._children[name] = this;
|
||||
|
||||
if (isDirectory)
|
||||
this._children = { };
|
||||
@@ -119,7 +121,7 @@ function rootResourceForAbsoluteURL(/*CFURL*/ anAbsoluteURL)
|
||||
resource = rootResources[schemeAndAuthority];
|
||||
|
||||
if (!resource)
|
||||
resource = new StaticResource(schemeAndAuthority, NULL, YES, YES);
|
||||
resource = new StaticResource(new CFURL(schemeAndAuthority), NULL, YES, YES);
|
||||
|
||||
return resource;
|
||||
}
|
||||
@@ -141,7 +143,7 @@ StaticResource.resourceAtURL = function(/*CFURL|String*/ aURL, /*BOOL*/ resolveA
|
||||
resource = resource._children[name];
|
||||
|
||||
else if (resolveAsDirectoriesIfNecessary)
|
||||
resource = new StaticResource(name, resource, YES, YES);
|
||||
resource = new StaticResource(new CFURL(name, resource.URL()), resource, YES, YES);
|
||||
|
||||
else
|
||||
throw new Error("Static Resource at " + aURL + " is not resolved (\"" + name + "\")");
|
||||
@@ -179,7 +181,7 @@ function resolveResourceComponents(/*StaticResource*/ aResource, /*BOOL*/ isDire
|
||||
// If the child doesn't exist, create and resolve it.
|
||||
if (!child)
|
||||
{
|
||||
child = new StaticResource(name, aResource, index + 1 < count || isDirectory , NO);
|
||||
child = new StaticResource(new CFURL(name, aResource.URL()), aResource, index + 1 < count || isDirectory , NO);
|
||||
child.resolve();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
var formatRegex = new RegExp("([^%]+|%[\\+\\-\\ \\#0]*[0-9\\*]*(.[0-9\\*]+)?[hlL]?[cbBdieEfgGosuxXpn%@])", "g");
|
||||
var tagRegex = new RegExp("(%)([\\+\\-\\ \\#0]*)([0-9\\*]*)((.[0-9\\*]+)?)([hlL]?)([cbBdieEfgGosuxXpn%@])");
|
||||
|
||||
GLOBAL(sprintf) = function(format)
|
||||
exports.sprintf = function(format)
|
||||
{
|
||||
var format = arguments[0],
|
||||
tokens = format.match(formatRegex),
|
||||
|
||||
@@ -38,15 +38,22 @@ instead download a pre-compiled copy of Cappuccino from:
|
||||
|
||||
http://cappuccino.org/download/
|
||||
|
||||
To build Cappuccino from source, simply type "jake" from within the root of the Cappuccino directory.
|
||||
To build Cappuccino from source, check out the most recent stable version from github:
|
||||
|
||||
$ git clone git://github.com/280north/cappuccino.git (git)
|
||||
|
||||
or download the zipball of the most recent source code:
|
||||
|
||||
http://github.com/280north/cappuccino/zipball/master (zip)
|
||||
|
||||
If this is your first build and your system does not have narwhal and jake installed,
|
||||
run the bootstrap script to install it and all of its dependencies:
|
||||
|
||||
$ ./bootstrap.sh
|
||||
|
||||
Then, simply type "jake" from within the root of the Cappuccino directory.
|
||||
This will build a "release" copy of the frameworks. Typing "jake debug" will build a debug version.
|
||||
"jake install" will build Cappuccino and associated tools and install them for general use (similar to
|
||||
downloading the tools from the website).
|
||||
|
||||
If this is your first build and your system does not have jake installed, run the bootstrap script to
|
||||
install it and all of its dependencies:
|
||||
|
||||
$ sudo ./bootstrap.sh
|
||||
"jake install" will build Cappuccino and associated tools and install them for general use.
|
||||
|
||||
Editors
|
||||
------------
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Copyright 2010, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
|
||||
<title>LoadTimeTest</title>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Copyright 2010, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
|
||||
<title>LoadTimeTest</title>
|
||||
|
||||
@@ -9,38 +9,38 @@ var base64TestStrings = [
|
||||
|
||||
@implementation base64Test : OJTestCase
|
||||
|
||||
- (void)test_base64_encode_string
|
||||
- (void)test_CFData_encodeBase64String
|
||||
{
|
||||
for (var i = 0; i < base64TestStrings.length; i++)
|
||||
[self assert:base64_encode_string(base64TestStrings[i][0]) equals:base64TestStrings[i][1]];
|
||||
[self assert:CFData.encodeBase64String(base64TestStrings[i][0]) equals:base64TestStrings[i][1]];
|
||||
}
|
||||
|
||||
- (void)test_base64_encode_array
|
||||
- (void)test_CFData_encodeBase64Array
|
||||
{
|
||||
for (var i = 0; i < base64TestStrings.length; i++)
|
||||
{
|
||||
var input = [];
|
||||
for (var j = 0; j < base64TestStrings[i][0].length; j++)
|
||||
input.push(base64TestStrings[i][0].charCodeAt(j));
|
||||
[self assert:base64_encode_array(input) equals:base64TestStrings[i][1]];
|
||||
[self assert:CFData.encodeBase64Array(input) equals:base64TestStrings[i][1]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)test_base64_decode_to_string
|
||||
- (void)test_CFData_decodeBase64ToString
|
||||
{
|
||||
for (var i = 0; i < base64TestStrings.length; i++)
|
||||
{
|
||||
var result = base64_decode_to_string(base64TestStrings[i][1]),
|
||||
var result = CFData.decodeBase64ToString(base64TestStrings[i][1]),
|
||||
expected = base64TestStrings[i][0];
|
||||
[self assert:result equals:expected];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)test_base64_decode_to_array
|
||||
- (void)test_CFData_decodeBase64ToArray
|
||||
{
|
||||
for (var i = 0; i < base64TestStrings.length; i++)
|
||||
{
|
||||
var result = base64_decode_to_array(base64TestStrings[i][1]),
|
||||
var result = CFData.decodeBase64ToArray(base64TestStrings[i][1]),
|
||||
expected = base64TestStrings[i][0];
|
||||
|
||||
for (var j = 0; j < expected.length || j < result.length; j++)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
// TODO: add many many more of these...
|
||||
var sprintfTestCases = [
|
||||
[["[%@]", "hello world"], "[hello world]"],
|
||||
@@ -12,7 +13,7 @@ var sprintfTestCases = [
|
||||
{
|
||||
for (var i = 0; i < sprintfTestCases.length; i++)
|
||||
{
|
||||
[self assert:sprintf.apply(null, sprintfTestCases[i][0]) equals:sprintfTestCases[i][1]];
|
||||
[self assert:ObjectiveJ.sprintf.apply(null, sprintfTestCases[i][0]) equals:sprintfTestCases[i][1]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Copyright __project.year__, __organization.name__ All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Copyright __project.year__, __organization.name__ All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Copyright __project.year__, __organization.name__ All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Copyright __project.year__, __organization.name__ All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Copyright __project.year__, __organization.name__ All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Copyright __project.year__, __organization.name__ All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
*/
|
||||
|
||||
@import <AppKit/CPColor.j>
|
||||
|
||||
@import <AppKit/CPData.j>
|
||||
|
||||
var NSUnknownColorSpaceModel = -1,
|
||||
NSGrayColorSpaceModel = 0,
|
||||
NSRGBColorSpaceModel = 1,
|
||||
@@ -49,7 +50,7 @@ var NSUnknownColorSpaceModel = -1,
|
||||
// NSComponents data
|
||||
// NSCustomColorSpace NSColorSpace
|
||||
var rgb = [aCoder decodeBytesForKey:@"NSRGB"],
|
||||
string = bytes_to_string(rgb),
|
||||
string = CFData.bytesToString(rgb),
|
||||
components = [string componentsSeparatedByString:@" "],
|
||||
values = [0,0,0,1];
|
||||
|
||||
@@ -63,7 +64,7 @@ var NSUnknownColorSpaceModel = -1,
|
||||
case 4: // [NSColor colorWithDeviceWhite:values[0] alpha:values[1]];
|
||||
|
||||
var bytes = [aCoder decodeBytesForKey:@"NSWhite"],
|
||||
string = bytes_to_string(bytes),
|
||||
string = CFData.bytesToString(bytes),
|
||||
components = [string componentsSeparatedByString:@" "],
|
||||
values = [0,1];
|
||||
|
||||
@@ -75,7 +76,7 @@ var NSUnknownColorSpaceModel = -1,
|
||||
/*
|
||||
case 5:
|
||||
var cmyk = [aCoder decodeBytesForKey:@"NSCMYK"],
|
||||
string = bytes_to_string(rgb),
|
||||
string = CFData.bytesToString(rgb),
|
||||
components = [string componentsSeparatedByString:@" "],
|
||||
values = [0,0,0,0,1];
|
||||
|
||||
|
||||
Reference in new issue
Block a user