Fixed possible but unlikely cause of crashes in JavaScript error handling, and improved log message classes for JS errors (symbolic names instead of magic numbers).
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2308 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
e6cc186157
commit
9781d2b9d1
@ -377,6 +377,7 @@
|
||||
1A472917096B5454000E78D8 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A472916096B5454000E78D8 /* CoreAudio.framework */; };
|
||||
1A472921096B5468000E78D8 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A47291F096B5468000E78D8 /* AudioToolbox.framework */; };
|
||||
1A472922096B5468000E78D8 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A472920096B5468000E78D8 /* AudioUnit.framework */; };
|
||||
1A4D67D91041DCF3001AC80F /* oolite-javascript-errors.plist in Copy Config */ = {isa = PBXBuildFile; fileRef = 1A4D67D81041DCF3001AC80F /* oolite-javascript-errors.plist */; };
|
||||
1A4FB23A0C8D6A9A00DC8E1F /* jsautocfg.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4FB2390C8D6A9A00DC8E1F /* jsautocfg.h */; };
|
||||
1A4FB23C0C8D6AA900DC8E1F /* jsapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4FB23B0C8D6AA900DC8E1F /* jsapi.h */; };
|
||||
1A4FB23F0C8D6AB400DC8E1F /* jspubtd.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4FB23E0C8D6AB400DC8E1F /* jspubtd.h */; };
|
||||
@ -724,6 +725,7 @@
|
||||
dstPath = Config;
|
||||
dstSubfolderSpec = 7;
|
||||
files = (
|
||||
1A4D67D91041DCF3001AC80F /* oolite-javascript-errors.plist in Copy Config */,
|
||||
1ABC04270EF872B7003B740A /* crosshairs.plist in Copy Config */,
|
||||
1A4501E20DBF699A00815C04 /* descriptions.plist in Copy Config */,
|
||||
1AC5452D0D4D298E00C90E5B /* oolite-font.plist in Copy Config */,
|
||||
@ -1059,7 +1061,7 @@
|
||||
083325DC09DDBCDE00F5B8E4 /* OOColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOColor.m; sourceTree = "<group>"; };
|
||||
083DB4D30A70E51E00B419B2 /* OOBrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOBrain.h; sourceTree = "<group>"; };
|
||||
083DB4D40A70E51E00B419B2 /* OOBrain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOBrain.m; sourceTree = "<group>"; };
|
||||
0865432206B8447D000CA0AB /* Oolite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Oolite.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0865432206B8447D000CA0AB /* OoliteDev.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OoliteDev.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0878FD2F086EF845004CB752 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
|
||||
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
||||
1A020E0A0D020AFB00C3F51E /* changedScriptHandlers.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = changedScriptHandlers.plist; sourceTree = "<group>"; };
|
||||
@ -1422,6 +1424,7 @@
|
||||
1A472916096B5454000E78D8 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
|
||||
1A47291F096B5468000E78D8 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; };
|
||||
1A472920096B5468000E78D8 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
|
||||
1A4D67D81041DCF3001AC80F /* oolite-javascript-errors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = "oolite-javascript-errors.plist"; sourceTree = "<group>"; };
|
||||
1A4FB2390C8D6A9A00DC8E1F /* jsautocfg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsautocfg.h; path = xcode/jsautocfg.h; sourceTree = "<group>"; };
|
||||
1A4FB23B0C8D6AA900DC8E1F /* jsapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsapi.h; path = src/jsapi.h; sourceTree = "<group>"; };
|
||||
1A4FB23E0C8D6AB400DC8E1F /* jspubtd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jspubtd.h; path = src/jspubtd.h; sourceTree = "<group>"; };
|
||||
@ -1764,7 +1767,7 @@
|
||||
19C28FACFE9D520D11CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0865432206B8447D000CA0AB /* Oolite.app */,
|
||||
0865432206B8447D000CA0AB /* OoliteDev.app */,
|
||||
1A71E6F30BCE340C00CD5C13 /* libpng.a */,
|
||||
);
|
||||
name = Products;
|
||||
@ -1818,6 +1821,7 @@
|
||||
1A2316DD0B9CFAD700EF0852 /* Config */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A4D67D81041DCF3001AC80F /* oolite-javascript-errors.plist */,
|
||||
1ABC04260EF872B7003B740A /* crosshairs.plist */,
|
||||
1AD0C32F0C463FCB0070BD23 /* autoAImap.plist */,
|
||||
1A020E0A0D020AFB00C3F51E /* changedScriptHandlers.plist */,
|
||||
@ -3030,7 +3034,7 @@
|
||||
name = Oolite;
|
||||
productInstallPath = "$(HOME)/Applications";
|
||||
productName = Oolite;
|
||||
productReference = 0865432206B8447D000CA0AB /* Oolite.app */;
|
||||
productReference = 0865432206B8447D000CA0AB /* OoliteDev.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
1A71E6F20BCE340C00CD5C13 /* libpng-custom */ = {
|
||||
|
225
Resources/Config/oolite-javascript-errors.plist
Normal file
225
Resources/Config/oolite-javascript-errors.plist
Normal file
@ -0,0 +1,225 @@
|
||||
// Identifiers for JavaScript error codes
|
||||
// Automatically generated by JSErrorMunger.m
|
||||
|
||||
{
|
||||
"0" = "notAnError";
|
||||
"1" = "notDefined";
|
||||
"2" = "inactive";
|
||||
"3" = "moreArgsNeeded";
|
||||
"4" = "badChar";
|
||||
"5" = "badType";
|
||||
"6" = "cantLock";
|
||||
"7" = "cantUnlock";
|
||||
"8" = "incompatibleProto";
|
||||
"9" = "noConstructor";
|
||||
"10" = "cantAlias";
|
||||
"11" = "notScriptedFunction";
|
||||
"12" = "badSortArg";
|
||||
"13" = "badAtomicNumber";
|
||||
"14" = "tooManyLiterals";
|
||||
"15" = "cantWatch";
|
||||
"16" = "stackUnderflow";
|
||||
"17" = "needDiet";
|
||||
"18" = "tooManyLocalRoots";
|
||||
"19" = "readOnly";
|
||||
"20" = "badFormal";
|
||||
"21" = "badIterator";
|
||||
"22" = "notFunction";
|
||||
"23" = "notConstructor";
|
||||
"24" = "stackOverflow";
|
||||
"25" = "notExported";
|
||||
"26" = "overRecursed";
|
||||
"27" = "inNotObject";
|
||||
"28" = "badNewResult";
|
||||
"29" = "badSharpDef";
|
||||
"30" = "badSharpUse";
|
||||
"31" = "badInstanceofRHS";
|
||||
"32" = "badBytecode";
|
||||
"33" = "badRadix";
|
||||
"34" = "parenBeforeLet";
|
||||
"35" = "cantConvert";
|
||||
"36" = "cyclicValue";
|
||||
"37" = "permanent";
|
||||
"38" = "cantConvertTo";
|
||||
"39" = "noProperties";
|
||||
"40" = "cantFindClass";
|
||||
"41" = "cantXDRClass";
|
||||
"42" = "bytecodeTooBig";
|
||||
"43" = "unknownFormat";
|
||||
"44" = "tooManyConArgs";
|
||||
"45" = "tooManyFunArgs";
|
||||
"46" = "badQuantifier";
|
||||
"47" = "minTooBig";
|
||||
"48" = "maxTooBig";
|
||||
"49" = "outOfOrder";
|
||||
"50" = "badDestructDecl";
|
||||
"51" = "badDestructAss";
|
||||
"52" = "parenAfterLet";
|
||||
"53" = "curlyAfterLet";
|
||||
"54" = "missingParen";
|
||||
"55" = "untermClass";
|
||||
"56" = "trailingSlash";
|
||||
"57" = "badClassRange";
|
||||
"58" = "badFlag";
|
||||
"59" = "noInput";
|
||||
"60" = "cantOpen";
|
||||
"61" = "badStringMask";
|
||||
"62" = "unmatchedRightParen";
|
||||
"63" = "endOfData";
|
||||
"64" = "seekBeyondStart";
|
||||
"65" = "seekBeyondEnd";
|
||||
"66" = "endSeek";
|
||||
"67" = "whitherWhence";
|
||||
"68" = "badScriptMagic";
|
||||
"69" = "parenBeforeFormal";
|
||||
"70" = "missingFormal";
|
||||
"71" = "parenAfterFormal";
|
||||
"72" = "curlyBeforeBody";
|
||||
"73" = "curlyAfterBody";
|
||||
"74" = "parenBeforeCond";
|
||||
"75" = "parenAfterCond";
|
||||
"76" = "noImportName";
|
||||
"77" = "nameAfterDot";
|
||||
"78" = "bracketInIndex";
|
||||
"79" = "noExportName";
|
||||
"80" = "parenBeforeSwitch";
|
||||
"81" = "parenAfterSwitch";
|
||||
"82" = "curlyBeforeSwitch";
|
||||
"83" = "colonAfterCase";
|
||||
"84" = "whileAfterDo";
|
||||
"85" = "parenAfterFor";
|
||||
"86" = "semiAfterForInit";
|
||||
"87" = "semiAfterForCond";
|
||||
"88" = "parenAfterForCtrl";
|
||||
"89" = "curlyBeforeTry";
|
||||
"90" = "curlyAfterTry";
|
||||
"91" = "parenBeforeCatch";
|
||||
"92" = "catchIdentifier";
|
||||
"93" = "parenAfterCatch";
|
||||
"94" = "curlyBeforeCatch";
|
||||
"95" = "curlyAfterCatch";
|
||||
"96" = "curlyBeforeFinally";
|
||||
"97" = "curlyAfterFinally";
|
||||
"98" = "catchOrFinally";
|
||||
"99" = "parenBeforeWith";
|
||||
"100" = "parenAfterWith";
|
||||
"101" = "curlyInCompound";
|
||||
"102" = "noVariableName";
|
||||
"103" = "colonInCond";
|
||||
"104" = "parenAfterArgs";
|
||||
"105" = "bracketAfterList";
|
||||
"106" = "colonAfterID";
|
||||
"107" = "curlyAfterList";
|
||||
"108" = "parenInParen";
|
||||
"109" = "semiBeforeStmnt";
|
||||
"110" = "noReturnValue";
|
||||
"111" = "duplicateFormal";
|
||||
"112" = "equalAsAssign";
|
||||
"113" = "badImport";
|
||||
"114" = "tooManyDefaults";
|
||||
"115" = "tooManyCases";
|
||||
"116" = "badSwitch";
|
||||
"117" = "badForLeftside";
|
||||
"118" = "catchAfterGeneral";
|
||||
"119" = "catchWithoutTry";
|
||||
"120" = "finallyWithoutTry";
|
||||
"121" = "labelNotFound";
|
||||
"122" = "toughBreak";
|
||||
"123" = "badContinue";
|
||||
"124" = "badReturnOrYield";
|
||||
"125" = "badLabel";
|
||||
"126" = "duplicateLabel";
|
||||
"127" = "varHidesArg";
|
||||
"128" = "badVarInit";
|
||||
"129" = "badLeftsideOfAss";
|
||||
"130" = "badOperand";
|
||||
"131" = "badPropID";
|
||||
"132" = "reservedID";
|
||||
"133" = "syntaxError";
|
||||
"134" = "badSharpVarDef";
|
||||
"135" = "badPrototype";
|
||||
"136" = "missingExponent";
|
||||
"137" = "outOfMemory";
|
||||
"138" = "unterminatedString";
|
||||
"139" = "tooManyParens";
|
||||
"140" = "unterminatedComment";
|
||||
"141" = "unterminatedRegexp";
|
||||
"142" = "badRegexpFlag";
|
||||
"143" = "sharpvarTooBig";
|
||||
"144" = "illegalCharacter";
|
||||
"145" = "badOctal";
|
||||
"146" = "badIndirectCall";
|
||||
"147" = "uncaughtException";
|
||||
"148" = "invalidBackref";
|
||||
"149" = "badBackref";
|
||||
"150" = "precisionRange";
|
||||
"151" = "badGetterOrSetter";
|
||||
"152" = "badArrayLength";
|
||||
"153" = "cantDescribeProps";
|
||||
"154" = "badApplyArgs";
|
||||
"155" = "redeclaredVar";
|
||||
"156" = "undeclaredVar";
|
||||
"157" = "anonNoReturnValue";
|
||||
"158" = "deprecatedUsage";
|
||||
"159" = "badURI";
|
||||
"160" = "getterOnly";
|
||||
"161" = "trailingComma";
|
||||
"162" = "undefinedProp";
|
||||
"163" = "uselessExpr";
|
||||
"164" = "redeclaredParam";
|
||||
"165" = "newRegExpFlagged";
|
||||
"166" = "reservedSlotRange";
|
||||
"167" = "cantDecodePrincipals";
|
||||
"168" = "cantSealObject";
|
||||
"169" = "tooManyCatchVars";
|
||||
"170" = "badXMLMarkup";
|
||||
"171" = "badXMLCharacter";
|
||||
"172" = "badDefaultXMLNamespace";
|
||||
"173" = "badXMLNameSyntax";
|
||||
"174" = "bracketAfterAttrExpr";
|
||||
"175" = "nestingGenerator";
|
||||
"176" = "curlyInXMLExpr";
|
||||
"177" = "badXMLNamespace";
|
||||
"178" = "badXMLAttrName";
|
||||
"179" = "badXMLName";
|
||||
"180" = "badXMLConversion";
|
||||
"181" = "badXMLListConversion";
|
||||
"182" = "badGeneratorSend";
|
||||
"183" = "noAssignInXMLAttr";
|
||||
"184" = "badXMLAttrValue";
|
||||
"185" = "XMLTagNameMismatch";
|
||||
"186" = "badXMLTagSyntax";
|
||||
"187" = "badXMLListSyntax";
|
||||
"188" = "incompatibleMethod";
|
||||
"189" = "cantSetXMLAttrs";
|
||||
"190" = "endOfXMLSource";
|
||||
"191" = "endOfXMLEntity";
|
||||
"192" = "badXMLQname";
|
||||
"193" = "badForEachLoop";
|
||||
"194" = "badXMLListPut";
|
||||
"195" = "unknownXMLEntity";
|
||||
"196" = "badXMLNCR";
|
||||
"197" = "undefinedXMLName";
|
||||
"198" = "duplicateXMLAttr";
|
||||
"199" = "tooManyFunVars";
|
||||
"200" = "arrayInitTooBig";
|
||||
"201" = "regexpTooComplex";
|
||||
"202" = "bufferTooSmall";
|
||||
"203" = "badSurrogateChar";
|
||||
"204" = "UTF8CharTooLarge";
|
||||
"205" = "malformedUTF8Char";
|
||||
"206" = "ooliteDefinedError";
|
||||
"207" = "wrongConstructor";
|
||||
"208" = "badGeneratorReturn";
|
||||
"209" = "badAnonGeneratorReturn";
|
||||
"210" = "nameAfterForParen";
|
||||
"211" = "inAfterForName";
|
||||
"212" = "badIteratorReturn";
|
||||
"213" = "keywordNotNs";
|
||||
"214" = "badGeneratorYield";
|
||||
"215" = "badYieldSyntax";
|
||||
"216" = "arrayCompLeftside";
|
||||
"217" = "yieldFromFilter";
|
||||
"218" = "compileExecedScript";
|
||||
"219" = "nonListXMLMethod";
|
||||
}
|
@ -31,6 +31,7 @@ MA 02110-1301, USA.
|
||||
#import "NSStringOOExtensions.h"
|
||||
#import "OOWeakReference.h"
|
||||
#import "EntityOOJavaScriptExtensions.h"
|
||||
#import "ResourceManager.h"
|
||||
|
||||
#import "OOJSGlobal.h"
|
||||
#import "OOJSMissionVariables.h"
|
||||
@ -108,13 +109,25 @@ static id JSGenericObjectConverter(JSContext *context, JSObject *object);
|
||||
|
||||
static void ReportJSError(JSContext *context, const char *message, JSErrorReport *report)
|
||||
{
|
||||
NSString *severity = nil;
|
||||
NSString *severity = @"error";
|
||||
NSString *messageText = nil;
|
||||
NSString *lineBuf = nil;
|
||||
NSString *messageClass = nil;
|
||||
NSString *highlight = @"*****";
|
||||
NSString *activeScript = nil;
|
||||
|
||||
jschar empty[1] = { 0 };
|
||||
JSErrorReport blankReport =
|
||||
{
|
||||
.filename = "<unspecified file>",
|
||||
.linebuf = "",
|
||||
.uclinebuf = empty,
|
||||
.uctokenptr = empty,
|
||||
.ucmessage = empty
|
||||
};
|
||||
if (EXPECT_NOT(report == NULL)) report = &blankReport;
|
||||
if (EXPECT_NOT(message == NULL || *message == '\0')) message = "<unspecified error>";
|
||||
|
||||
// Type of problem: error, warning or exception? (Strict flag wilfully ignored.)
|
||||
if (report->flags & JSREPORT_EXCEPTION) severity = @"exception";
|
||||
else if (report->flags & JSREPORT_WARNING)
|
||||
@ -122,7 +135,6 @@ static void ReportJSError(JSContext *context, const char *message, JSErrorReport
|
||||
severity = @"warning";
|
||||
highlight = @"-----";
|
||||
}
|
||||
else severity = @"error";
|
||||
|
||||
// The error message itself
|
||||
messageText = [NSString stringWithUTF8String:message];
|
||||
@ -131,8 +143,14 @@ static void ReportJSError(JSContext *context, const char *message, JSErrorReport
|
||||
lineBuf = [NSString stringWithUTF16String:report->uclinebuf];
|
||||
while ([lineBuf hasSuffix:@"\n"] || [lineBuf hasSuffix:@"\r"]) lineBuf = [lineBuf substringToIndex:[lineBuf length] - 1];
|
||||
|
||||
// Get string for error number, for useful log message classes
|
||||
NSDictionary *errorNames = [ResourceManager dictionaryFromFilesNamed:@"oolite-javascript-errors.plist" inFolder:@"Config" andMerge:YES];
|
||||
NSString *errorNumberStr = [NSString stringWithFormat:@"%u", report->errorNumber];
|
||||
NSString *errorName = [errorNames stringForKey:errorNumberStr];
|
||||
if (errorName == nil) errorName = errorNumberStr;
|
||||
|
||||
// Log message class
|
||||
messageClass = [NSString stringWithFormat:@"script.javaScript.%@.%u", severity, report->errorNumber];
|
||||
messageClass = [NSString stringWithFormat:@"script.javaScript.%@.%@", severity, errorName];
|
||||
|
||||
// First line: problem description
|
||||
activeScript = [[OOJSScript currentlyRunningScript] displayName];
|
||||
|
107
tools/JSErrorMunger/JSErrorMunger.m
Normal file
107
tools/JSErrorMunger/JSErrorMunger.m
Normal file
@ -0,0 +1,107 @@
|
||||
/* Tool to convert SpiderMonkey error code table (in js.msg) into a plist for
|
||||
our error reporter. Requires some pre-massaging of js.msg to turn it into
|
||||
an ASCII plist array of arrays.
|
||||
*/
|
||||
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
void Handle1Spec(NSArray *spec);
|
||||
NSString *ConvertName(NSString *name);
|
||||
|
||||
|
||||
int main (int argc, const char * argv[])
|
||||
{
|
||||
[NSAutoreleasePool new];
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf(stderr, "Specify path to js.msg.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
NSString *jsmsg = [NSString stringWithContentsOfFile:[NSString stringWithUTF8String:argv[1]]];
|
||||
if (jsmsg == nil)
|
||||
{
|
||||
fprintf(stderr, "Can't find %s.\n", argv[1]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Hit it with a hammer until it looks like an OpenStep plist array of arrays
|
||||
NSArray *components = [jsmsg componentsSeparatedByString:@")\n"];
|
||||
jsmsg = [components componentsJoinedByString:@"),\n"];
|
||||
|
||||
jsmsg = [[@"(\n" stringByAppendingString:jsmsg] stringByAppendingString:@"())\n"];
|
||||
jsmsg = [[jsmsg componentsSeparatedByString:@"MSG_DEF"] componentsJoinedByString:@""];
|
||||
|
||||
NSString *errorString = nil;
|
||||
NSArray *errors = [NSPropertyListSerialization propertyListFromData:[jsmsg dataUsingEncoding:NSASCIIStringEncoding]
|
||||
mutabilityOption:NSPropertyListImmutable
|
||||
format:NULL
|
||||
errorDescription:&errorString];
|
||||
if (errors == nil)
|
||||
{
|
||||
fprintf(stderr, "Parse error: %s\n\n--\n%s\n", [errorString UTF8String], [jsmsg UTF8String]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("// Identifiers for JavaScript error codes\n// Automatically generated by JSErrorMunger.m\n\n{\n");
|
||||
for (NSArray *spec in errors)
|
||||
{
|
||||
Handle1Spec(spec);
|
||||
}
|
||||
printf("}\n");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void Handle1Spec(NSArray *spec)
|
||||
{
|
||||
if (spec.count < 2) return;
|
||||
|
||||
NSString *name = [spec objectAtIndex:0];
|
||||
NSNumber *index = [spec objectAtIndex:1];
|
||||
|
||||
name = ConvertName(name);
|
||||
|
||||
printf("\t\"%u\" = \"%s\";\n", [index intValue], [name UTF8String]);
|
||||
}
|
||||
|
||||
|
||||
NSString *ConvertName(NSString *name)
|
||||
{
|
||||
NSArray *components = [[name substringFromIndex:6] componentsSeparatedByString:@"_"];
|
||||
NSMutableString *result = [NSMutableString string];
|
||||
|
||||
NSDictionary *specialCases = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"XML", @"XML",
|
||||
@"XMLList", @"XMLLIST",
|
||||
@"XDR", @"XDR",
|
||||
@"RHS", @"RHS",
|
||||
@"LHS", @"LHS",
|
||||
@"ID", @"ID",
|
||||
@"URI", @"URI",
|
||||
@"URL", @"URL",
|
||||
@"newRegExp", @"NEWREGEXP",
|
||||
@"NCR", @"NCR",
|
||||
@"UTF8", @"UTF8",
|
||||
@"NS", @"NS",
|
||||
@"oolite", @"USER",
|
||||
nil];
|
||||
|
||||
for (NSString *comp in components)
|
||||
{
|
||||
NSString *converted = [specialCases objectForKey:comp];
|
||||
if (converted == nil)
|
||||
{
|
||||
if (result.length == 0) converted = [comp lowercaseString];
|
||||
else converted = [comp capitalizedString];
|
||||
}
|
||||
|
||||
[result appendString:converted];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
203
tools/JSErrorMunger/JSErrorMunger.xcodeproj/project.pbxproj
Normal file
203
tools/JSErrorMunger/JSErrorMunger.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,203 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 45;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
8DD76F9A0486AA7600D96B5E /* JSErrorMunger.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* JSErrorMunger.m */; settings = {ATTRIBUTES = (); }; };
|
||||
8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
8DD76F9E0486AA7600D96B5E /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 8;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
08FB7796FE84155DC02AAC07 /* JSErrorMunger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSErrorMunger.m; sourceTree = "<group>"; };
|
||||
08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
8DD76FA10486AA7600D96B5E /* errorMunger */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = errorMunger; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
8DD76F9B0486AA7600D96B5E /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
08FB7794FE84155DC02AAC07 /* errorMungler */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
08FB7795FE84155DC02AAC07 /* Source */,
|
||||
08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
);
|
||||
name = errorMungler;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
08FB7795FE84155DC02AAC07 /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
08FB7796FE84155DC02AAC07 /* JSErrorMunger.m */,
|
||||
);
|
||||
name = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
08FB779EFE84155DC02AAC07 /* Foundation.framework */,
|
||||
);
|
||||
name = "External Frameworks and Libraries";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DD76FA10486AA7600D96B5E /* errorMunger */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8DD76F960486AA7600D96B5E /* errorMunger */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "errorMunger" */;
|
||||
buildPhases = (
|
||||
8DD76F990486AA7600D96B5E /* Sources */,
|
||||
8DD76F9B0486AA7600D96B5E /* Frameworks */,
|
||||
8DD76F9E0486AA7600D96B5E /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = errorMunger;
|
||||
productInstallPath = "$(HOME)/bin";
|
||||
productName = errorMungler;
|
||||
productReference = 8DD76FA10486AA7600D96B5E /* errorMunger */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "JSErrorMunger" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
hasScannedForEncodings = 1;
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* errorMungler */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8DD76F960486AA7600D96B5E /* errorMunger */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8DD76F990486AA7600D96B5E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DD76F9A0486AA7600D96B5E /* JSErrorMunger.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1DEB927508733DD40010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PRODUCT_NAME = errorMunger;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB927608733DD40010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_MODEL_TUNING = G5;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PRODUCT_NAME = errorMunger;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1DEB927908733DD40010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.5;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB927A08733DD40010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.5;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "errorMunger" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB927508733DD40010E9CD /* Debug */,
|
||||
1DEB927608733DD40010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "JSErrorMunger" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB927908733DD40010E9CD /* Debug */,
|
||||
1DEB927A08733DD40010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user