diff --git a/CommonJS/bin/flatten b/CommonJS/bin/flatten index 9f5a84c99..42400674b 100755 --- a/CommonJS/bin/flatten +++ b/CommonJS/bin/flatten @@ -132,10 +132,11 @@ ObjectiveJFlattener.prototype.buildApplicationJS = function(applicationRoot) { buffer.push("(function(){"); + buffer.push("var appURL = new CFURL('.', ObjectiveJ.pageURL);") + buffer.push(this.bundleBuffer.join("\n")); buffer.push("var nodeStack = [];"); - buffer.push("var appURL = new CFURL('.', ObjectiveJ.pageURL);") buffer.push("var applicationRoot = ObjectiveJ.StaticResource.resourceAtURL(appURL, true);"); buffer.push("var currentNode = null;"); buffer.push("var newNode;"); @@ -179,7 +180,8 @@ ObjectiveJFlattener.prototype.serializeStaticResources = function(node, depth) { stream.print("Writing bundle: \0cyan("+bundle.path()+"\0)"); print(bundle.infoDictionary()) - this.bundleBuffer.push("var bundle = new CFBundle("+JSON.stringify(this.rootPath.relative(bundle.path()).toString())+");"); + var relative = this.rootPath.relative(bundle.path()).toString(); + this.bundleBuffer.push("var bundle = new CFBundle("+(relative ? JSON.stringify(relative) : "appURL")+");"); this.bundleBuffer.push("bundle._loadStatus = " + (1<<4) + ";"); if (bundle.infoDictionary()) { this.bundleBuffer.push("bundle._infoDictionary = CFPropertyList.propertyListFromString(" + diff --git a/CommonJS/bin/press b/CommonJS/bin/press index 9ad00a671..8b7c28283 100755 --- a/CommonJS/bin/press +++ b/CommonJS/bin/press @@ -238,7 +238,7 @@ function pressEnvironment(rootPath, outputFiles, environment, options) { total++; totalBytes += aFileExecutable.code().length }, this); - stream.print(ObjectiveJ.sprintf( + stream.print(_OBJJ.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), diff --git a/CommonJS/lib/cappuccino/objj-analysis-tools.j b/CommonJS/lib/cappuccino/objj-analysis-tools.j index 3d70a2322..428262391 100644 --- a/CommonJS/lib/cappuccino/objj-analysis-tools.j +++ b/CommonJS/lib/cappuccino/objj-analysis-tools.j @@ -79,7 +79,8 @@ ObjectiveJRuntimeAnalyzer.prototype.initializeGlobalRecorder = function() }); } else if (!currentFile) { - CPLog.warn("currentFile is null. WTF.") + // I don't know why this happens. It shouldn't. + // CPLog.debug("currentFile is null."); } before = after; diff --git a/Objective-J/CFDictionary.js b/Objective-J/CFDictionary.js index 3e4ceeaf7..a9c0ccb74 100644 --- a/Objective-J/CFDictionary.js +++ b/Objective-J/CFDictionary.js @@ -65,9 +65,7 @@ CFDictionary.prototype.containsKey = function(/*String*/ aKey) return hasOwnProperty.apply(this._buckets, [aKey]); } -#if DEBUG -CFDictionary.prototype.containsKey.displayName = "CFDictionary.containsKey"; -#endif +DISPLAY_NAME(CFDictionary.prototype.containsKey); CFDictionary.prototype.containsValue = function(/*id*/ anObject) { @@ -83,30 +81,21 @@ CFDictionary.prototype.containsValue = function(/*id*/ anObject) return NO; } -#if DEBUG -CFDictionary.prototype.containsValue.displayName = "CFDictionary.containsValue"; -#endif - +DISPLAY_NAME(CFDictionary.prototype.containsValue); CFDictionary.prototype.count = function() { return this._count; } -#if DEBUG -CFDictionary.prototype.count.displayName = "CFDictionary.count"; -#endif - +DISPLAY_NAME(CFDictionary.prototype.count); CFDictionary.prototype.countOfKey = function(/*String*/ aKey) { return this.containsKey(aKey) ? 1 : 0; } -#if DEBUG -CFDictionary.prototype.countOfKey.displayName = "CFDictionary.countOfKey"; -#endif - +DISPLAY_NAME(CFDictionary.prototype.countOfKey); CFDictionary.prototype.countOfValue = function(/*id*/ anObject) { @@ -123,19 +112,14 @@ CFDictionary.prototype.countOfValue = function(/*id*/ anObject) return countOfValue; } -#if DEBUG -CFDictionary.prototype.countOfValue.displayName = "CFDictionary.countOfValue"; -#endif - +DISPLAY_NAME(CFDictionary.prototype.countOfValue); CFDictionary.prototype.keys = function() { return this._keys.slice(); } -#if DEBUG -CFDictionary.prototype.keys.displayName = "CFDictionary.keys"; -#endif +DISPLAY_NAME(CFDictionary.prototype.keys); CFDictionary.prototype.valueForKey = function(/*String*/ aKey) { @@ -147,9 +131,7 @@ CFDictionary.prototype.valueForKey = function(/*String*/ aKey) return buckets[aKey]; } -#if DEBUG -CFDictionary.prototype.valueForKey.displayName = "CFDictionary.valueForKey"; -#endif +DISPLAY_NAME(CFDictionary.prototype.valueForKey); CFDictionary.prototype.toString = function() { @@ -168,9 +150,7 @@ CFDictionary.prototype.toString = function() return string + "}"; } -#if DEBUG -CFDictionary.prototype.toString.displayName = "CFDictionary.toString"; -#endif +DISPLAY_NAME(CFDictionary.prototype.toString); GLOBAL(CFMutableDictionary) = function(/*CFDictionary*/ aDictionary) { @@ -195,9 +175,7 @@ CFMutableDictionary.prototype.addValueForKey = function(/*String*/ aKey, /*Objec this._buckets[aKey] = aValue; } -#if DEBUG -CFMutableDictionary.prototype.addValueForKey.displayName = "CFMutableDictionary.addValueForKey"; -#endif +DISPLAY_NAME(CFMutableDictionary.prototype.addValueForKey); CFMutableDictionary.prototype.removeValueForKey = function(/*String*/ aKey) { @@ -228,9 +206,7 @@ CFMutableDictionary.prototype.removeValueForKey = function(/*String*/ aKey) delete this._buckets[aKey]; } -#if DEBUG -CFMutableDictionary.prototype.removeValueForKey.displayName = "CFMutableDictionary.removeValueForKey"; -#endif +DISPLAY_NAME(CFMutableDictionary.prototype.removeValueForKey); CFMutableDictionary.prototype.removeAllValues = function() { @@ -239,9 +215,7 @@ CFMutableDictionary.prototype.removeAllValues = function() this._buckets = { }; } -#if DEBUG -CFMutableDictionary.prototype.removeAllValues.displayName = "CFMutableDictionary.removeAllValues"; -#endif +DISPLAY_NAME(CFMutableDictionary.prototype.removeAllValues); CFMutableDictionary.prototype.replaceValueForKey = function(/*String*/ aKey, /*Object*/ aValue) { @@ -251,9 +225,7 @@ CFMutableDictionary.prototype.replaceValueForKey = function(/*String*/ aKey, /*O this._buckets[aKey] = aValue; } -#if DEBUG -CFMutableDictionary.prototype.replaceValueForKey.displayName = "CFMutableDictionary.replaceValueForKey"; -#endif +DISPLAY_NAME(CFMutableDictionary.prototype.replaceValueForKey); CFMutableDictionary.prototype.setValueForKey = function(/*String*/ aKey, /*Object*/ aValue) { @@ -267,6 +239,4 @@ CFMutableDictionary.prototype.setValueForKey = function(/*String*/ aKey, /*Objec this.addValueForKey(aKey, aValue); } -#if DEBUG -CFMutableDictionary.prototype.setValueForKey.displayName = "CFMutableDictionary.setValueForKey"; -#endif +DISPLAY_NAME(CFMutableDictionary.prototype.setValueForKey); diff --git a/Objective-J/CFURL.js b/Objective-J/CFURL.js index b36ba3270..4c5596100 100644 --- a/Objective-J/CFURL.js +++ b/Objective-J/CFURL.js @@ -121,7 +121,7 @@ function CFURLGetParts(/*CFURL*/ aURL) if (parts.path) { var split = parts.path.split("/"), - pathComponents = parts.pathComponents; + pathComponents = parts.pathComponents, index = 0, count = split.length;