diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ac7fdea..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "jscocoa"] - path = jscocoa - url = git://github.com/parmanoir/jscocoa.git diff --git a/README.md b/README.md index 65a7c30..2d45766 100644 --- a/README.md +++ b/README.md @@ -152,8 +152,6 @@ Here's what is currently being worked on, what's broken: Checking out the code: ---------------------- $ git clone git://github.com/ccgus/jstalk.git - $ cd jstalk - $ git clone http://github.com/parmanoir/jscocoa.git jscocoa TODO: diff --git a/jscocoa/GC ObjC JSCocoa/ApplicationController.h b/jscocoa/GC ObjC JSCocoa/ApplicationController.h new file mode 100644 index 0000000..556a819 --- /dev/null +++ b/jscocoa/GC ObjC JSCocoa/ApplicationController.h @@ -0,0 +1,20 @@ +// +// ApplicationController.h +// GC ObjC JSCocoa +// +// Created by Patrick Geiller on 22/12/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface ApplicationController : NSObject { + +} + +- (IBAction)runJSTests:(id)sender; +- (IBAction)collect:(id)sender; +- (IBAction)dumpMemory:(id)sender; + +@end diff --git a/jscocoa/GC ObjC JSCocoa/ApplicationController.m b/jscocoa/GC ObjC JSCocoa/ApplicationController.m new file mode 100644 index 0000000..9f60954 --- /dev/null +++ b/jscocoa/GC ObjC JSCocoa/ApplicationController.m @@ -0,0 +1,92 @@ +// +// ApplicationController.m +// GC ObjC JSCocoa +// +// Created by Patrick Geiller on 22/12/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "ApplicationController.h" +#import "JSCocoa.h" + +@implementation ApplicationController + +- (void)applicationDidFinishLaunching:(id)notif +{ + NSLog(@"DONE"); +/* + id c = [JSCocoaController sharedController]; +[[JSCocoa sharedController] setUseAutoCall:NO]; + id mainJSFile = [NSString stringWithFormat:@"%@/Contents/Resources/main.js", [[NSBundle mainBundle] bundlePath]]; + [c evalJSFile:mainJSFile]; +[[JSCocoa sharedController] setUseAutoCall:YES]; +*/ + + + [self performSelector:@selector(runJSTests:) withObject:nil afterDelay:0]; +// objc_assignIvar(); +} + +- (void)test +{ + NSLog(@"test"); +} + +int runCount; +- (IBAction)runJSTests:(id)sender +{ +[[NSGarbageCollector defaultCollector] disable]; + NSLog(@"RUN TESTS"); + id path = [[NSBundle mainBundle] bundlePath]; + path = [NSString stringWithFormat:@"%@/Contents/Resources/Tests", path]; +// NSLog(@"Run %d from %@", runCount, path); + BOOL b = [[JSCocoaController sharedController] runTests:path]; + [[JSCocoaController sharedController] garbageCollect]; + if (!b) { NSLog(@"!!!!!!!!!!!FAIL %d from %@", runCount, path); return; } + runCount++; + NSLog(@">>>>Ran %d", runCount); + + +/* + [[NSGarbageCollector defaultCollector] collectExhaustively]; + objc_collect(OBJC_FULL_COLLECTION); + objc_collect(OBJC_EXHAUSTIVE_COLLECTION); + objc_collect(OBJC_WAIT_UNTIL_DONE); +NSLog(@"GC enabled=%d", [[NSGarbageCollector defaultCollector] isEnabled]); +*/ +} + +- (IBAction)collect:(id)sender +{ +// [JSCocoaController garbageCollect]; + [[JSCocoaController sharedController] garbageCollect]; + [[NSGarbageCollector defaultCollector] collectExhaustively]; + objc_collect(OBJC_FULL_COLLECTION); + objc_collect(OBJC_EXHAUSTIVE_COLLECTION); + objc_collect(OBJC_WAIT_UNTIL_DONE); +} + +- (IBAction)dumpMemory:(id)sender +{ + unsigned int i; + id v = [sender stringValue]; + BOOL scanned = [[NSScanner scannerWithString:v] scanHexInt:&i]; + + if (!scanned) + { + NSLog(@"couldn't scan %@", v); + return; + } + + char buf[17]; + char* source = *(char**)i; + memcpy(buf, source, 16); + buf[17]; + NSLog(@"raw=%s", buf); + NSLog(@"raw=%@", (NSString*)source); + +// NSLog(@"%@-%@ %d=%d", sender, [sender stringValue], scanned, i); +} + + +@end diff --git a/jscocoa/GC ObjC JSCocoa/English.lproj/InfoPlist.strings b/jscocoa/GC ObjC JSCocoa/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..5e45963 Binary files /dev/null and b/jscocoa/GC ObjC JSCocoa/English.lproj/InfoPlist.strings differ diff --git a/jscocoa/GC ObjC JSCocoa/English.lproj/MainMenu.xib b/jscocoa/GC ObjC JSCocoa/English.lproj/MainMenu.xib new file mode 100644 index 0000000..ef7bf64 --- /dev/null +++ b/jscocoa/GC ObjC JSCocoa/English.lproj/MainMenu.xib @@ -0,0 +1,3283 @@ + + + + 1050 + 9G55 + 677 + 949.43 + 353.00 + + YES + + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + NewApplication + + YES + + + About NewApplication + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide NewApplication + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit NewApplication + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 15 + 2 + {{133, 393}, {480, 360}} + 1946157056 + Window + NSWindow + + {3.40282e+38, 3.40282e+38} + + + 256 + + YES + + + 268 + {{211, 161}, {118, 25}} + + YES + + -2080244224 + 134217728 + Run Tests + + LucidaGrande + 1.300000e+01 + 1044 + + + -2038152961 + 163 + + + 400 + 75 + + + + + 268 + {{211, 130}, {118, 25}} + + YES + + -2080244224 + 134217728 + Collect + + + -2038152961 + 163 + + + 400 + 75 + + + + + 268 + {{249, 37}, {96, 32}} + + YES + + 67239424 + 134217728 + Dump + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{135, 44}, {96, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + + + {480, 360} + + + {{0, 0}, {1920, 1178}} + {3.40282e+38, 3.40282e+38} + + + NSFontManager + + + ApplicationController + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + alignLeft: + + + + 442 + + + + alignJustified: + + + + 443 + + + + copyRuler: + + + + 444 + + + + alignCenter: + + + + 445 + + + + toggleRuler: + + + + 446 + + + + alignRight: + + + + 447 + + + + pasteRuler: + + + + 448 + + + + terminate: + + + + 449 + + + + delegate + + + + 451 + + + + runJSTests: + + + + 455 + + + + dumpMemory: + + + + 462 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + YES + + + + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 378 + + + YES + + + + + + 379 + + + YES + + + + + + + + + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + + + 387 + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + + + 452 + + + YES + + + + + + 453 + + + + + 456 + + + YES + + + + + + 457 + + + + + 458 + + + YES + + + + + + 459 + + + + + 460 + + + YES + + + + + + 461 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBEditorWindowLastContentRect + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 371.windowTemplate.maxSize + 372.IBPluginDependency + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 420.IBPluginDependency + 450.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 456.IBPluginDependency + 457.IBPluginDependency + 458.IBPluginDependency + 459.IBPluginDependency + 460.IBPluginDependency + 461.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{187, 434}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{207, 285}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{133, 393}, {480, 360}} + {{133, 393}, {480, 360}} + + {{33, 99}, {480, 360}} + {3.40282e+38, 3.40282e+38} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{437, 242}, {86, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{523, 2}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{219, 102}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{145, 474}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 462 + + + + YES + + ApplicationController + NSObject + + YES + + YES + collect: + dumpMemory: + runJSTests: + + + YES + id + id + id + + + + IBProjectSource + ApplicationController.h + + + + + 0 + ../GC ObjC JSCocoa.xcodeproj + 3 + + diff --git a/jscocoa/GC ObjC JSCocoa/GC ObjC JSCocoa.xcodeproj/TemplateIcon.icns b/jscocoa/GC ObjC JSCocoa/GC ObjC JSCocoa.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/jscocoa/GC ObjC JSCocoa/GC ObjC JSCocoa.xcodeproj/TemplateIcon.icns differ diff --git a/jscocoa/GC ObjC JSCocoa/GC ObjC JSCocoa.xcodeproj/project.pbxproj b/jscocoa/GC ObjC JSCocoa/GC ObjC JSCocoa.xcodeproj/project.pbxproj new file mode 100644 index 0000000..586ea8b --- /dev/null +++ b/jscocoa/GC ObjC JSCocoa/GC ObjC JSCocoa.xcodeproj/project.pbxproj @@ -0,0 +1,349 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; + 3D788F900F01F96300175ADD /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D788F790F01F96300175ADD /* BridgeSupportController.m */; }; + 3D788F910F01F96300175ADD /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D788F7A0F01F96300175ADD /* class.js */; }; + 3D788F940F01F96300175ADD /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D788F870F01F96300175ADD /* JSCocoaController.m */; }; + 3D788F960F01F96300175ADD /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D788F8B0F01F96300175ADD /* JSCocoaFFIClosure.m */; }; + 3D788F970F01F96300175ADD /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D788F8D0F01F96300175ADD /* JSCocoaLib.m */; }; + 3D788F980F01F96300175ADD /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D788F8F0F01F96300175ADD /* JSCocoaPrivateObject.m */; }; + 3D788FD30F01F97D00175ADD /* Tests in Resources */ = {isa = PBXBuildFile; fileRef = 3D788FA90F01F97D00175ADD /* Tests */; }; + 3DD0642C0EFF74D2007655AD /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DD0642B0EFF74D2007655AD /* ApplicationController.m */; }; + 3DD064370EFF7532007655AD /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DD064360EFF7532007655AD /* JavaScriptCore.framework */; }; + 3DD0644C0EFF75C7007655AD /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DD0644B0EFF75C7007655AD /* main.js */; }; + 3DF5BC450F15280300AEDF7D /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DF5BC440F15280300AEDF7D /* JSCocoaFFIArgument.m */; }; + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* GC ObjC JSCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GC ObjC JSCocoa_Prefix.pch"; sourceTree = ""; }; + 3D788F780F01F96300175ADD /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3D788F790F01F96300175ADD /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3D788F7A0F01F96300175ADD /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3D788F810F01F96300175ADD /* JSCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa.h; sourceTree = ""; }; + 3D788F850F01F96300175ADD /* JSCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa_Prefix.pch; sourceTree = ""; }; + 3D788F860F01F96300175ADD /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3D788F870F01F96300175ADD /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3D788F880F01F96300175ADD /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3D788F8A0F01F96300175ADD /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3D788F8B0F01F96300175ADD /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3D788F8C0F01F96300175ADD /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLib.h; sourceTree = ""; }; + 3D788F8D0F01F96300175ADD /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaLib.m; sourceTree = ""; }; + 3D788F8E0F01F96300175ADD /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3D788F8F0F01F96300175ADD /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3D788FA90F01F97D00175ADD /* Tests */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Tests; path = ../Tests; sourceTree = SOURCE_ROOT; }; + 3DD0642A0EFF74D2007655AD /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = ""; }; + 3DD0642B0EFF74D2007655AD /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = ""; }; + 3DD064360EFF7532007655AD /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + 3DD0644B0EFF75C7007655AD /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = ""; }; + 3DF5BC440F15280300AEDF7D /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* GC ObjC JSCocoa.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "GC ObjC JSCocoa.app"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 3DD064370EFF7532007655AD /* JavaScriptCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 3DD0644B0EFF75C7007655AD /* main.js */, + 3DD0642B0EFF74D2007655AD /* ApplicationController.m */, + 3DD0642A0EFF74D2007655AD /* ApplicationController.h */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* GC ObjC JSCocoa.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* GC ObjC JSCocoa */ = { + isa = PBXGroup; + children = ( + 3D788F770F01F96300175ADD /* JSCocoa */, + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = "GC ObjC JSCocoa"; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* GC ObjC JSCocoa_Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 3D788FA90F01F97D00175ADD /* Tests */, + 8D1107310486CEB800E47090 /* Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3DD064360EFF7532007655AD /* JavaScriptCore.framework */, + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3D788F770F01F96300175ADD /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3D788F780F01F96300175ADD /* BridgeSupportController.h */, + 3D788F790F01F96300175ADD /* BridgeSupportController.m */, + 3D788F7A0F01F96300175ADD /* class.js */, + 3D788F810F01F96300175ADD /* JSCocoa.h */, + 3D788F850F01F96300175ADD /* JSCocoa_Prefix.pch */, + 3D788F860F01F96300175ADD /* JSCocoaController.h */, + 3D788F870F01F96300175ADD /* JSCocoaController.m */, + 3D788F880F01F96300175ADD /* JSCocoaFFIArgument.h */, + 3DF5BC440F15280300AEDF7D /* JSCocoaFFIArgument.m */, + 3D788F8A0F01F96300175ADD /* JSCocoaFFIClosure.h */, + 3D788F8B0F01F96300175ADD /* JSCocoaFFIClosure.m */, + 3D788F8C0F01F96300175ADD /* JSCocoaLib.h */, + 3D788F8D0F01F96300175ADD /* JSCocoaLib.m */, + 3D788F8E0F01F96300175ADD /* JSCocoaPrivateObject.h */, + 3D788F8F0F01F96300175ADD /* JSCocoaPrivateObject.m */, + ); + name = JSCocoa; + path = ../JSCocoa; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* GC ObjC JSCocoa */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GC ObjC JSCocoa" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "GC ObjC JSCocoa"; + productInstallPath = "$(HOME)/Applications"; + productName = "GC ObjC JSCocoa"; + productReference = 8D1107320486CEB800E47090 /* GC ObjC JSCocoa.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GC ObjC JSCocoa" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* GC ObjC JSCocoa */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D1107260486CEB800E47090 /* GC ObjC JSCocoa */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D788F910F01F96300175ADD /* class.js in Resources */, + 3DD0644C0EFF75C7007655AD /* main.js in Resources */, + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, + 3D788FD30F01F97D00175ADD /* Tests in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090 /* main.m in Sources */, + 3DD0642C0EFF74D2007655AD /* ApplicationController.m in Sources */, + 3D788F900F01F96300175ADD /* BridgeSupportController.m in Sources */, + 3D788F940F01F96300175ADD /* JSCocoaController.m in Sources */, + 3D788F960F01F96300175ADD /* JSCocoaFFIClosure.m in Sources */, + 3D788F970F01F96300175ADD /* JSCocoaLib.m in Sources */, + 3D788F980F01F96300175ADD /* JSCocoaPrivateObject.m in Sources */, + 3DF5BC450F15280300AEDF7D /* JSCocoaFFIArgument.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 1DDD58150DA1D0A300B32029 /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* 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; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "GC ObjC JSCocoa_Prefix.pch"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = "GC ObjC JSCocoa"; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "GC ObjC JSCocoa_Prefix.pch"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = "GC ObjC JSCocoa"; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_GC = required; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_GC = required; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GC ObjC JSCocoa" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GC ObjC JSCocoa" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/jscocoa/GC ObjC JSCocoa/GC ObjC JSCocoa_Prefix.pch b/jscocoa/GC ObjC JSCocoa/GC ObjC JSCocoa_Prefix.pch new file mode 100644 index 0000000..f1f0dcc --- /dev/null +++ b/jscocoa/GC ObjC JSCocoa/GC ObjC JSCocoa_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'GC ObjC JSCocoa' target in the 'GC ObjC JSCocoa' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/jscocoa/GC ObjC JSCocoa/Info.plist b/jscocoa/GC ObjC JSCocoa/Info.plist new file mode 100644 index 0000000..612b7da --- /dev/null +++ b/jscocoa/GC ObjC JSCocoa/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/jscocoa/GC ObjC JSCocoa/main.js b/jscocoa/GC ObjC JSCocoa/main.js new file mode 100644 index 0000000..d8df913 --- /dev/null +++ b/jscocoa/GC ObjC JSCocoa/main.js @@ -0,0 +1,7 @@ + + + log('>>Collector=' + NSGarbageCollector.defaultCollector()) + log('>>ActiveApp=' + NSWorkspace.sharedWorkspace().activeApplication()) +// NSGarbageCollector.defaultCollector.collectExhaustively + + log(NSApplication) \ No newline at end of file diff --git a/jscocoa/GC ObjC JSCocoa/main.m b/jscocoa/GC ObjC JSCocoa/main.m new file mode 100644 index 0000000..61d6c2f --- /dev/null +++ b/jscocoa/GC ObjC JSCocoa/main.m @@ -0,0 +1,14 @@ +// +// main.m +// GC ObjC JSCocoa +// +// Created by Patrick Geiller on 22/12/08. +// Copyright __MyCompanyName__ 2008. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jscocoa/GUIConsole/BACKUP/NSLogConsole.h b/jscocoa/GUIConsole/BACKUP/NSLogConsole.h new file mode 100644 index 0000000..69a5ca3 --- /dev/null +++ b/jscocoa/GUIConsole/BACKUP/NSLogConsole.h @@ -0,0 +1,73 @@ +// +// NSLogConsole.h +// NSLogConsole +// +// Created by Patrick Geiller on 16/08/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import +#import + + +void NSLogProlog(char* file, int line); + +@class NSLogConsoleView; + +@interface NSLogConsole : NSObject { + + BOOL autoOpens; + + IBOutlet id window; + IBOutlet NSLogConsoleView* webView; + IBOutlet id searchField; + + int original_stderr; + NSString* logPath; + NSFileHandle* fileHandle; + + unsigned long long fileOffset; +} + + ++ (id)sharedConsole; + +- (void)open; +- (void)close; +- (BOOL)isOpen; +- (IBAction)clear:(id)sender; +- (IBAction)searchChanged:(id)sender; +- (id)webView; +- (void)logData:(NSData*)data file:(char*)file lineNumber:(int)line; +- (void)updateLogWithFile:(char*)file lineNumber:(int)line; + + + +@property BOOL autoOpens; + +@end + + +@interface NSWindow(Goodies) +- (void)setBottomCornerRounded:(BOOL)a; +@end + + + +@interface NSLogConsoleView : WebView { + + // A message might trigger console opening, BUT the WebView will take time to load and won't be able to display messages yet. + // Queue them - they will be unqueued when WebView has loaded. + id messageQueue; + + BOOL webViewLoaded; +} + +- (void)logString:(NSString*)string file:(char*)file lineNumber:(int)line; +- (void)clear; +- (void)search:(NSString*)string; + +- (BOOL)drawsBackground; + +@end + diff --git a/jscocoa/GUIConsole/BACKUP/NSLogConsole.html b/jscocoa/GUIConsole/BACKUP/NSLogConsole.html new file mode 100644 index 0000000..2590199 --- /dev/null +++ b/jscocoa/GUIConsole/BACKUP/NSLogConsole.html @@ -0,0 +1,448 @@ + + + + + + + + +
Nothing here yet !
sample commands
+
No results
+
+ + + + +
+ +
+
+ + + +
+
Current application
+
NSWorkspace.sharedWorkspace.activeApplication
+ +
Change current window title
+
NSApplication.sharedApplication.keyWindow.title = 'Hello from Javascript !'
+ +
Move window frame
+
var w = NSApplication.sharedApplication.keyWindow; w.frameOrigin = (NSMakePoint(w.frame.origin.x+10, w.frame.origin.y-10))
+ +
Grow window frame
+
var w = NSApplication.sharedApplication.keyWindow; w.set({frame:NSMakeRect(w.frame.origin.x, w.frame.origin.y, w.frame.size.width+10, w.frame.size.height+10), display:false})
+ +
New window
+
var w = NSWindow.instance({withContentRect:NSMakeRect(100, 100, 200, 605), styleMask:NSTitledWindowMask+NSClosableWindowMask, backing:NSBackingStoreBuffered, defer:false});w.title='New window !'; w.orderFront(null)
+ +
Add buttons to last created window
+
for (var i=0;i!=20; i++) { var b = NSButton.instance({withFrame:NSMakeRect(10, i*30+5, 100, 28)}); b.bezelStyle = i; w.contentView.addSubview(b); }
+
+ + + + + diff --git a/jscocoa/GUIConsole/BACKUP/NSLogConsole.m b/jscocoa/GUIConsole/BACKUP/NSLogConsole.m new file mode 100644 index 0000000..645574c --- /dev/null +++ b/jscocoa/GUIConsole/BACKUP/NSLogConsole.m @@ -0,0 +1,363 @@ +// +// NSLogConsole.m +// NSLogConsole +// +// Created by Patrick Geiller on 16/08/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "NSLogConsole.h" +#import "JSCocoaController.h" + + +BOOL inited = NO; + + +void NSLogPostLog(char* file, int line) +{ + if (!inited) return; + [[NSLogConsole sharedConsole] updateLogWithFile:file lineNumber:line]; +} + + + +@implementation NSLogConsole + +@synthesize autoOpens; + + ++ (id)sharedConsole +{ + static id singleton = NULL; + @synchronized(self) + { + if (!singleton) + { + singleton = [self alloc]; + [singleton init]; + } + } + return singleton; +} + + +- (id)init +{ + id o = [super init]; + autoOpens = YES; + logPath = NULL; +//return o; + // Save stderr + original_stderr = dup(STDERR_FILENO); + + inited = YES; + + logPath = [NSString stringWithFormat:@"%@%@.log.txt", NSTemporaryDirectory(), [[NSBundle mainBundle] bundleIdentifier]]; + [logPath retain]; + + // Create the file — NSFileHandle doesn't do it ! + [@"" writeToFile:logPath atomically:YES encoding:NSUTF8StringEncoding error:nil]; + + fileHandle = [NSFileHandle fileHandleForWritingAtPath:logPath]; + if (!fileHandle) NSLog(@"Opening log at %@ failed", logPath); + [fileHandle retain]; + int fd = [fileHandle fileDescriptor]; + + // Redirect stderr + int err = dup2(fd, STDERR_FILENO); + if (!err) NSLog(@"Couldn't redirect stderr"); + + fileOffset = 0; + return o; +} + + +- (void)dealloc +{ + [logPath release]; + [fileHandle release]; + [super dealloc]; +} + +- (void)open +{ +/* + if (!window) + { + if (![NSBundle loadNibNamed:@"NSLogConsole" owner:self]) + { + NSLog(@"NSLogConsole.nib not loaded"); + return; + } + if ([window respondsToSelector:@selector(setBottomCornerRounded:)]) + [window setBottomCornerRounded:NO]; + } + [window orderFront:self]; +*/ +} +- (void)close +{ + [window orderOut:self]; +} +- (BOOL)isOpen +{ + return [window isVisible]; +} + +- (IBAction)clear:(id)sender +{ + [webView clear]; +} +- (IBAction)searchChanged:(id)sender +{ + [webView search:[sender stringValue]]; +} + +- (void)setWebView:(id)view +{ + webView = view; + [webView retain]; +} + +- (id)webView +{ + return webView; +} + + +- (void)logData:(NSData*)data file:(char*)file lineNumber:(int)line +{ +// if (![window isVisible] && autoOpens) [self open]; + + id str = [[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding]; +// [[NSAlert alertWithMessageText:@"hello" defaultButton:@"Furthe" alternateButton:nil otherButton:nil informativeTextWithFormat:str] runModal]; + + // Write back to original stderr + write(original_stderr, [data bytes], [data length]); + + // Clear search + [searchField setStringValue:@""]; + [webView search:@""]; + // Log string + [webView logString:str file:file lineNumber:line]; + + [str release]; +} + +- (void)updateLogWithFile:(char*)file lineNumber:(int)line +{ +// if (![window isVisible] && autoOpens) [self open]; + // Open a new handle to read new data + id f = [NSFileHandle fileHandleForReadingAtPath:logPath]; + if (!f) NSLog(@"Opening log at %@ failed", logPath); + + // Get file length + [f seekToEndOfFile]; + unsigned long long length = [f offsetInFile]; + + // Read data + [f seekToFileOffset:fileOffset]; + NSData* data = [f readDataToEndOfFile]; + [self logData:data file:file lineNumber:line]; + + // We'll read from that offset next time + fileOffset = length; +} + + +@end + + + + + + + + + + + +@implementation NSLogConsoleView + + +- (void)dealloc +{ + [messageQueue release]; + [super dealloc]; +} + +- (BOOL)drawsBackground +{ + return NO; +} + +- (void)awakeFromNib +{ + messageQueue = [[NSMutableArray alloc] init]; + webViewLoaded = NO; + + // Frame load + [self setFrameLoadDelegate:self]; + + // Load html page + id path = [[NSBundle mainBundle] pathForResource:@"NSLogConsole" ofType:@"html"]; + [[self mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]]]; + + // Navigation notification + [self setPolicyDelegate:self]; +} + +// +// Javascript is available +// Register our custom javascript object in the hosted page +// +- (void)webView:(WebView *)view windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject +{ + [windowScriptObject setValue:self forKey:@"NSLogConsoleView"]; +} + +// +// WebView has finished loading +// +- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame +{ + webViewLoaded = YES; + + // Flush message queue + for (id o in messageQueue) + [self logString:[o valueForKey:@"string"] file:(char*)[[o valueForKey:@"file"] UTF8String] lineNumber:[[o valueForKey:@"line"] intValue]]; + [messageQueue release]; + [[self windowScriptObject] setValue:self forKey:@"myVar"]; +} + +// +// Notify WebView of new message +// +- (void)logString:(NSString*)string file:(char*)file lineNumber:(int)line +{ + // Queue message if WebView has not finished loading + if (!webViewLoaded) + { + id o = [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithString:string], @"string", + [NSString stringWithUTF8String:file], @"file", + [NSNumber numberWithInt:line], @"line", + nil]; + [messageQueue addObject:o]; + return; + } + [[self windowScriptObject] callWebScriptMethod:@"log" withArguments:[NSArray arrayWithObjects:string, + [NSString stringWithUTF8String:file], + [NSNumber numberWithInt:line], + nil]]; +} + + +// +// Open source file in XCode at correct line number +// +- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation + request:(NSURLRequest *)request + frame:(WebFrame *)frame + decisionListener:(id)listener +{ + // Get path, formed by AbsolutePathOnDisk(space)LineNumber + NSString* pathAndLineNumber = [[request URL] path]; + + // From end of string, skip to space before number + char* s = (char*)[pathAndLineNumber UTF8String]; + char* s2 = s+strlen(s)-1; + while (*s2 && *s2 != ' ' && s2 > s) s2--; + if (*s2 != ' ') return NSLog(@"Did not find line number in %@", pathAndLineNumber); + + // Patch a zero to recover path + *s2 = 0; + + // Get line number + int line; + BOOL foundLine = [[NSScanner scannerWithString:[NSString stringWithUTF8String:s2+1]] scanInt:&line]; + if (!foundLine) return NSLog(@"Did not parse line number in %@", pathAndLineNumber); + + // Get path + NSString* path = [NSString stringWithUTF8String:s]; +// NSLog(@"opening line %d of _%@_", line, path); + + // Open in XCode + id source = [NSString stringWithFormat:@"tell application \"Xcode\" \n\ + set doc to open \"%@\" \n\ + set selection to paragraph (%d) of contents of doc \n\ + end tell", path, line]; + id script = [[NSAppleScript alloc] initWithSource:source]; + [script executeAndReturnError:nil]; + [script release]; +} + + +- (void)clear +{ + [[self windowScriptObject] callWebScriptMethod:@"clear" withArguments:nil]; +} + +- (void)search:(NSString*)string +{ + [[self windowScriptObject] callWebScriptMethod:@"search" withArguments:[NSArray arrayWithObjects:string, nil]]; +} + + ++ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector +{ + return NO; +} + + + +// +// Hairy function below. WebView calls ApplicationController (written in JS) +// +- (void)evalJSCocoa:(NSString*)string +{ + id delegate = [[NSApplication sharedApplication] delegate]; + [[delegate inputScript] setStringValue:string]; + [delegate runScript:string]; +} + + +// +// Overlay Help +// +- (void)openHelp +{ + [[self windowScriptObject] callWebScriptMethod:@"openHelp" withArguments:nil]; +} +- (void)closeHelp +{ + [[self windowScriptObject] callWebScriptMethod:@"closeHelp" withArguments:nil]; +} +- (BOOL)isHelpOpen +{ + id result = [[self windowScriptObject] callWebScriptMethod:@"isHelpOpen" withArguments:nil]; + if (![result respondsToSelector:@selector(boolValue)]) return NO; + return [result boolValue]; +} + +// +// Command display +// +- (void)startCommand:(id)command +{ + [[self windowScriptObject] callWebScriptMethod:@"startCommand" withArguments:[NSArray arrayWithObjects:command, nil]]; +} +- (void)endCommand +{ + /*id result = */[[self windowScriptObject] callWebScriptMethod:@"endCommand" withArguments:nil]; +} + + +- (void)performFindPanelAction:(id)sender +{ + + NSLog(@"iiiiiiiiiiiiiiii"); +} + + +@end + diff --git a/jscocoa/GUIConsole/ClassTree.png b/jscocoa/GUIConsole/ClassTree.png new file mode 100644 index 0000000..d34addd Binary files /dev/null and b/jscocoa/GUIConsole/ClassTree.png differ diff --git a/jscocoa/GUIConsole/CocoaNavJS.html b/jscocoa/GUIConsole/CocoaNavJS.html new file mode 100644 index 0000000..41f08a8 --- /dev/null +++ b/jscocoa/GUIConsole/CocoaNavJS.html @@ -0,0 +1,2670 @@ + + + + CocoaNav JS - A Javascript Cocoa Class Browser + + + + + +
+ + +
+
+ +
HUD
+ + + + + + + diff --git a/jscocoa/GUIConsole/CocoaNavJS.js b/jscocoa/GUIConsole/CocoaNavJS.js new file mode 100644 index 0000000..6cc8197 --- /dev/null +++ b/jscocoa/GUIConsole/CocoaNavJS.js @@ -0,0 +1,52 @@ + + defineClass('CocoaNavView < WebView', { + awakeFromNib : ['void', 'void', function() + { + this.setFrameLoadDelegate(this) + this.mainFrame.loadRequest(NSURLRequest.requestWithURL(NSURL.fileURLWithPath(NSBundle.mainBundle.pathForResource_ofType('CocoaNavJS', 'html')))); + this.setPolicyDelegate(this) + }] + ,'webView:didFinishLoadForFrame:' : ['void', 'id', 'id', function (webView, frame) + { + this.refresh(null) + }] + + ,refresh : ['IBAction', function (sender) + { + var list = JSCocoaHelper.classList + this.windowScriptObject.call({webScriptMethod:'loadClassesFromText', withArguments:NSArray.arrayWithObject(list)}) + }] + + ,'webView:decidePolicyForNavigationAction:request:frame:decisionListener:' : ['void', 'id', 'id', 'id', 'id', 'id', function (webview, actionInformation, request, frame, listener ) + { + NSWorkspace.sharedWorkspace.openURL(request.URL) + + }] + + }) + + + + + + defineClass('CocoaNavJSWindow < NSWindow', { + searchField : 'IBOutlet' + ,webView : 'IBOutlet' + ,'performFind:' : ['IBAction', function (sender) + { + this.makeFirstResponder(this.searchField) + }] + ,'searchFieldChanged:' : ['IBAction', function (sender) + { + this.webView.windowScriptObject.call({webScriptMethod:'search', withArguments:NSArray.arrayWithObject(sender.stringValue)}) + + }] + ,'performFindNext:' : ['IBAction', function (sender) + { + this.webView.windowScriptObject.call({webScriptMethod:'nextSearchResult', withArguments:null}) + }] + ,'performFindPrev:' : ['IBAction', function (sender) + { + this.webView.windowScriptObject.call({webScriptMethod:'prevSearchResult', withArguments:null}) + }] + }) diff --git a/jscocoa/GUIConsole/CocoaNavJS.xib b/jscocoa/GUIConsole/CocoaNavJS.xib new file mode 100644 index 0000000..d4bd358 --- /dev/null +++ b/jscocoa/GUIConsole/CocoaNavJS.xib @@ -0,0 +1,1462 @@ + + + + 1050 + 9E17 + 629 + 949.33 + 352.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + ApplicationController + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{196, 151}, {400, 300}} + 1610612736 + CocoaNav JS + CocoaNavJSWindow + + + CA385D1C-0066-4F1F-BCDF-59297CAF2F9E + + + YES + YES + NO + NO + 2 + 1 + + YES + + YES + 632CA28C-759E-49FB-839F-43C65B9F824F + D8F83997-0433-4630-9498-3C3A1A5305F4 + NSToolbarCustomizeToolbarItem + NSToolbarFlexibleSpaceItem + NSToolbarPrintItem + NSToolbarSeparatorItem + NSToolbarShowColorsItem + NSToolbarShowFontsItem + NSToolbarSpaceItem + + + YES + + + 632CA28C-759E-49FB-839F-43C65B9F824F + + Search + + + + + 268 + {{0, 14}, {235, 22}} + + + YES + + 343014976 + 268436480 + + + LucidaGrande + 1.300000e+01 + 1044 + + Class name + + YES + 1 + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + + controlTextColor + + 3 + MAA + + + + 130560 + 0 + search + _searchFieldSearch: + + + 138690815 + 0 + + 400 + 75 + + + 130560 + 0 + clear + + YES + + YES + + YES + AXDescription + NSAccessibilityEncodedAttributesValueType + + + YES + cancel + + + + + _searchFieldCancel: + + + 138690815 + 0 + + 400 + 75 + + 255 + + + + + + {235, 22} + {235, 22} + YES + YES + 0 + YES + 0 + + + + D8F83997-0433-4630-9498-3C3A1A5305F4 + + Refresh + + + + + 268 + {{11, 14}, {25, 25}} + + + YES + + 67239424 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSRefreshTemplate + + + + 400 + 75 + + + + + + {25, 25} + {25, 25} + YES + YES + 0 + YES + 0 + + + NSToolbarCustomizeToolbarItem + Customize + + Customize Toolbar + + + 683671552 + {32, 32} + + YES + + YES + + + + TU0AKgAAEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAICAgbAAAABAAAAAAEBAQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAQEBAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAENDQ0dJSUlW11dXbBpaWnDb29vzyAgIGUPDw8xAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAABsbGyUoKChIHh4ePSkpKUonJycsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDCEJCQoWvr6/i9fX1/fX19f7h4eH82dnZ+YODg9sYGBg8 +AAAAAAAAAAAAAAAAAAAAAAAAAAJFRUV6ZGRkvf39/f/+/v7//////0NDQ7QAAAAEAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8PDx9ISEiH2tra8/7+/v/j4+P/2NjY/7a2tv+ysrL/ +i4uL7j09PeUKCgoSAAAAAAAAAAAAAAAAUVFRlo2NjfTIyMj6x8fH/56env97e3v/ISEhMAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPDw8lRUVFjtDQ0Pb+/v7/4eHh/dDQ0P+NjY3/ +Tk5O6yoqKrIfHx+gGhoarCIiImwAAAABAAAAADg4OGWenp7/y8vL/d3d3f+8vLz/hYWF/0RERE0AAAAA +AAAAAAAAAAAfHx8sAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAj8/P2za2try9/f3/+vr6/7Kysr/ +dnZ2/D4+PvwgICB+EBAQNAICAgcAAAAPERERPQMDAwkQEBASh4eH2MHBwf/o6Oj/39/f/3R0dP88PDxO +AAAAAAAAAAAAAAAAcnJylkNDQ58HBwcIAAAAAAAAAAAAAAAAAAAAAAAAAAAGBgYMfn5+uMvLy/3Hx8f+ +u7u7/5OTk/9CQkL7HRYL7AICAgQAAAAAAAAAAAAAAAAAAAAAAgICBS4uLjOWlpbz6urq/+7u7v+rq6v/ +IyMj0wAAAAAAAAAAAAAAAIGBgZGLi4v/QkJC2Q0NDSYAAAAAAAAAAAAAAAAAAAAAGRkZJF5eXoylpaXz +pqam/4qKiv91dXX/YWFh+iwkHvojEADrJhcGoAgICA0AAAAAAAAAAAAAAAAAAAAAPj4+RJaWlvr19fX/ +6+vr/7W1tfVaWlrlAwMDbAAAAACKioqcoqKi/7+/v/9HR0fnDg4OJwAAAAAAAAAAHR0dK3V1dZ+pqanC ++vr6/9vb2/99fX3+Y2Nj+EhISOgMCAP4JhIA8jgaAPBxNADsNyMMjgcHBwsAAAAAAAAAAAAAAAAMDAwO +m5ub+Orq6v/y8vL/0NDQ7ICAgMtkZGTqcHBwzLOzs//Pz8//0tLS/0xMTNoJCQkhAAAAABoaGjZ/f3+4 +//////j4+P/9/f3/9vb2/0dHR/8oKCjkKSkpoAQCAJUNBQDXVSgA5XY5AOuTSADcOiUOewYGBgoAAAAA +AAAAAB4eHmFlZWX76Ojo/+7u7v/5+fn/5OTk9Li4uO3f39//8PDw/+Hh4f/Ly8v/Ozs7rQICAgMAAAAA +GBgYL3x8fP///////////7S0tP+np6f/QEBA+xUVFXUJCQkkBAQEDgcFA20jEQC7YzIA3n9BAOiiUwDK +NiMObgYGBgoTExNIOzs74bGxsf3Dw8P/1dXV////////////////////////////8/Pz/3R0dOcPDw9H +AAAAAQAAAAAAAAAAVVVVooCAgP/v7+//v7+//2VlZf86OjrLAQEBBgAAAAAAAAAAAAAAABENCVctFwCl +ZTQA1oZFAOCqWgDAMiMTgzExMcKzs7P4wcHB/5+fn//W1tb///////v7+/v//////////729vfOFhYXy +IyMjdAAAAAMAAAABAAAAAAAAAAAAAAAASkpKmlpaWv+RkZH/Nzc38hgYGG4AAAABAAAAAAAAAAAAAAAA +AAAAAAsFAEUwGACbaDcAzXpCAOFnRiLjs7Kx+MTExP+pqan/09PT/3p6evpdXV3rbGxs6l1dXfVXV1fs +UlJSxykpKWMAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAQUFBmiMjI/8cHBysBQUFHQAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAsFAEAuGACfSzAT47y4s/24uLj/lJSU/9TU1P+Dg4PkMzMzzwYGBgw6OjpB +QEBASQ8PDxYbGxshAAAAAgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIimgoKCi4AAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAwJBYS9u7n4r6+v/4GBgf/Pz8//iISB6CYmJqoDAwMK +AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAABUwcHB7qurq/9ubm7/zs7O/5yOgPhlPhbf +MhsCegAAAA0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAwMnCgoKZsvLy++pqan/Wlpa/9LS0v+Nh4Hq +SCYE4IdDAeSbTgDLNxsAhwAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAwMOxoaGobV1dXzq6ur/0ZGRv/Z2dn/ +hoaGxQkEAIY6HgCyaDMA2YVAAOuWSQDZPh4AngAAABEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgYGFEoKCio0tLS86urq/8xMTH/ +4uLi/4+Pj84AAABIAAAAAg8HAGg6HQDKaDIA4YI+APCVRQDsRSEAuAAAABMAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWFhYrNTU1z9ra2vb8/Pz/ +FxcX/+rq6v+amprZAAAASAAAAAIAAAAAAAAAABAIAIY4GwDiaTEA6X46APeVRAD/SyIA0gAAABIAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgICBT8/P4asrKz3 +0dHR//39/f/z8/P/paWl5gUFBVkAAAACAAAAAAAAAAAAAAAAAAAAABIJAKUxFgD6bTMA9no4AP9uLwD/ +KxIAxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBwcO +QUFBmpqamv+pqan/+Pj4/7GxsfIXFxeBAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAHAMogDgD/ +WSkA/zwaAPcuEwCyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAEBAQMnJydWUFBQ85aWlvqoqKjfKioqrQEBAQUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAsFAOUXCQD6IA4AwgQCADMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAgICBBR0dHmi4uLnACAgIHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAgDAMwFAgA9AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE +AAAACQAAABAAAAAYAAAAIAAAACoAAAAxAAAANgAAADkAAAA4AQEBOQAAAC8AAAAnAAAAHQAAABUAAAAO +AAAACgAAAAsAAAAPAAAAFwAAACAAAAAqAAAAMQAAADQAAAAzAAAALQAAACQAAAAbAAAAEgAAAAsAAAAA +AAAAAAAAAAQAAAAJAAAAEAAAABgAAAAgAAAAKgAAADEAAAA2AAAAOQAAADgAAAA1AAAALwAAACcAAAAd +AAAAFQAAAA4AAAAKAAAACwAAAA8AAAAXAAAAIAAAACoAAAAxAAAANAAAADMAAAAtAAAAJAAAABsAAAAS +AAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0BAAADAAAAAQAgAAABAQADAAAAAQAgAAABAgADAAAABAAA +EKoBAwADAAAAAQABAAABBgADAAAAAQACAAABEQAEAAAAAQAAAAgBEgADAAAAAQABAAABFQADAAAAAQAE +AAABFgADAAAAAQD8AAABFwAEAAAAAQAAEAABHAADAAAAAQABAAABUgADAAAAAQABAAABUwADAAAABAAA +ELIAAAAAAAgACAAIAAgAAQABAAEAAQ + + + + + + 3 + MCAwAA + + + + runToolbarCustomizationPalette: + {0, 0} + + YES + YES + -1 + YES + 0 + + + NSToolbarFlexibleSpaceItem + + Flexible Space + + + + + + {1, 5} + {20000, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + NSMenuCheckmark + + + + NSMenuMixedState + + + + + NSToolbarPrintItem + Print + + + + + 750780416 + {32, 32} + + YES + + YES + + + + YES + + YES + imageNameKey + widget + + + YES + + image.ToolbarPrint + + image + + + {32, 32} + 0 + YES + + + + + + + printDocument: + + + YES + YES + -1 + YES + 0 + + + NSToolbarSeparatorItem + + Separator + + + + + + {12, 5} + {12, 1000} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + NSToolbarShowColorsItem + Colors + + Show Color Panel + + + 683671552 + {32, 32} + + YES + + YES + + + + TU0AKgAAEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACCQEOEzkMUylkF5BChyLCWqEq6G+wL/1voSro +ZYciwlFkGJAyOQxTCAkBDgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADkEPXiWEIbtJyTf/Yt9C/370Tf+d/lf/ +tv9c/77+V/+/9E7/u99C/7XJOf9+hCK7QUAOXgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxQHHRZjIY42zEH+RvBI/2r/W/9//2D/ +kf9k/6L/Zv+w/mf/wf9m/9T/Zv/l/2H//v9e/+/ySv/Mwzj+Y1kXjhQRAx0AAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMUCR0adDOgP91f/1n/c/9c/2P/ +aP5i/4P+bv+Y/nL/qP53/7r+d//K/nb/2P5z/+f+bv/5/2f///9i///8W//dwD//dF4coBQPAx0AAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFmM0jj7dc/9Z/4r/ +Yf5//2z+ff9y/nX/iP59/6H+hf+w/on/wf6K/9H+if/g/ob/7/6A////eP//823//uNk///kXf/drT// +Y0cXjgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1BKF41zHv+ +WP+m/2H+mP9s/pb/eP6T/4L+jf+P/or/p/6V/7j+mv/L/p3/2/6a/+f+lv/8/5D///uH//7pe//+3G// +/sxk///MXf/Mizj+QSkOXgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCQYO +IIRau0fwov9d/6//a/6q/3j+qv+H/qj/k/6l/5r+nv+s/qL/wv6q/9T+rP/i/qv/8v+m////n//+8ZX/ +/uGK//7Se//+w23//7hh//CdSv+ETiK7CQUBDgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAw5K1M2yZX/Wv/K/2P+vv90/rz/hP67/5L+uv+f/rr/qf60/7L+sP/K/rr/2/69/+z+u//8/7X/ +//mt//7nov/+2Jb//sqJ//65eP/+q2f//6Re/8htOf85GwxSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAFmRRkD7ftv9d/9f/a/7O/3r+zv+M/s//mv7N/6r+zP+3/s3/wP7F/87+yP/l/s// +9v/N////xP/+7bv//t6t//7Qn//+v5D//q+A//6fbv//lGH/321C/2MrGI8AAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAfh3fCSfTW/2D/4/9v/t//g/7f/5H+3/+k/t//sv7g/8H+3v/Q/t7/ +2P7Z/+3+4P///93///fT//7kxP/+17T//sSo//61l//+pYb//pRz//+FZv/0bU7/hzIiwgAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACihmehT/vn/Yv/z/3L/8f+F//H/lv/z/6f/8/+3//H/ +yf/x/9n/8v/o//D/+P/x///97f/+6dv//tnK//7Iuv/+tqr//qeZ//6WiP/+hXb//3Nl//5jVv+hMyno +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK62w/Vb///9j/v//dP7//4b+//+X/v// +qP7//7f+///L/v//3P7//+////////////L0//7e4P/+zc///ru9//6qrP/+mZv//oiK//51d//+ZWf/ +/1pc/7AvMf0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAolqHoUfX+/2Hu//9x7f7/ +hO3+/5ft/v+m7f7/tu3+/8jt/v/X7P7/5Or+//Xt////6f///tvt//7K3f/+usv//qq7//6YrP/+h5r/ +/neK//9md//+VWj/oSk26AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB91h8JJ0fT/ +Yd///27b/v+A2/7/kdv+/6Hc/v+w2v7/wNv+/8rX/v/V1P7/69z+//7Z////0Pn//sLm//602P/+pcj/ +/pW3//6EqP/+cpb//2WJ//RNcP+HIjTCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +FlBkkD+x3/9a0f//asr+/3rL/v+Kyf7/mcr+/6fH/v+0x/7/u8D+/83F/v/ky/7/8sn///+////+uPD/ +/qng//6d0f/+jsP//n6y//5uov//Xpf/30Jx/2MXLI8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAALKjlTNJLJ/1jG//9huP7/crf+/4G2/v+Ptf7/nLP+/6av/v+xrP7/yLb+/9q3/v/qt/7/ ++7L///+q+//+n+n//pPa//6Fy//+dLz//mWu//9cqP/IN3D/OAwbUgAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAEGCQ4eWIS7RZ3w/1us//9npf7/daX+/4Wj/v+OoP7/l5j+/6qg/v/Apv7/ +0Kj+/+Cn/v/wpP7//5r///+S8//+h+P//njU//5sxf//X7r/8Emd/4QhT7sJAQUOAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0mQV4zd8z+V6D//16T/v9pkf7/dY7+/3+G/v+Nh/7/ +pZH+/7aX/v/Jl/7/2Zb+/+aR/v/3jP///4L+//556//+bN7//mHO//9Zzv/MNo3+QA0pXQAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABUyY446bt3/VoX//156/v9ndv7/ +bm7+/4d3/v+fgv7/roP+/7+G/v/Phf7/3oL+/+18/v//dP///2v2//5h5f//Web/3T2u/2MWSI4AAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwgUHRkwdKA6WN3/ +VWz//1le//9nX/7/gWr+/5Ru/v+ncf7/tnT+/8hy/v/Wb/7/5mr+//Rj////Xf///1j+/90+wv90Gl+g +EwMOHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +BAcWHxciaJMzPMz+RkTw/2hY//98Wv//j2H//6Bh//+uY/7/v2L//9Jg///jXf///Fr//+5H8v/MNcX+ +aBhdkxUEEh4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAACAAAABRMTU3QoI5TMSDPI/2FA3/9+SfT/mVH+/7RW//+8U/7/vUn0/7o+3/+zNcj/ +jSSUzFMSUnMAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAQIAAAkFAAAVCAAAIg8EEkEmFl+UPCGOyE8op+dgK7D3biux/ncrsPd9KKfn +dSGOyFkWX5QbBBJBCAAAIgUAABUCAAAJAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAABgIAABAFAAAcCAAAKQwAADkRAABIFQAAVRgAAF0YAABf +GAAAXRUAAFURAABIDAAAOQgAACkFAAAcAgAAEAAAAAYAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAUAAAAIAAAACwAAAA4AAAAS +AAAAFAAAABUAAAAUAAAAEgAAAA4AAAALAAAACAAAAAUAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0BAAADAAAAAQAgAAABAQADAAAAAQAgAAABAgADAAAABAAA +EKoBAwADAAAAAQABAAABBgADAAAAAQACAAABEQAEAAAAAQAAAAgBEgADAAAAAQABAAABFQADAAAAAQAE +AAABFgADAAAAAQD8AAABFwAEAAAAAQAAEAABHAADAAAAAQABAAABUgADAAAAAQABAAABUwADAAAABAAA +ELIAAAAAAAgACAAIAAgAAQABAAEAAQ + + + + + + + + orderFrontColorPanel: + + + YES + YES + -1 + YES + 0 + + + NSToolbarShowFontsItem + Fonts + + Show Font Panel + + + 683671552 + {32, 32} + + YES + + YES + + + + TU0AKgAAEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAABQfL3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAOFiJQLkdt/wsRG0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACg+X+AuR23/FB8vcAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXIzaALkdt/y5Hbf8XIzaAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQgNICtCZvAuR23/Lkdt/yI1UsAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcLESgJTlY0C5Hbf8uR23/ +JTlY0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQgNIC5Hbf8LERtA +Lkdt/y5Hbf8uR23/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiNVLA +IjVSwAAAAAAoPl/gLkdt/y5Hbf8IDRQwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +CxEbQC5Hbf8FCA0gAAAAACI1UsAuR23/Lkdt/wsRG0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAiNVLAHCxEoAAAAAAAAAAAHzFLsC5Hbf8uR23/FyM2gAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAACxEbQC5Hbf8FCA0gAAAAAAAAAAAXIzaALkdt/y5Hbf8cLESgAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAiNVLAIjVSwAsRG0ALERtACxEbQBwsRKAuR23/Lkdt/yI1UsAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACxEbQC5Hbf8uR23/Lkdt/y5Hbf8uR23/Lkdt/y5Hbf8uR23/ +K0Jm8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiNVLAHCxEoAAAAAAAAAAAAAAAAAAAAAAFCA0g +Lkdt/y5Hbf8uR23/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACxEbQC5Hbf8FCA0gAAAAAAAAAAAAAAAA +AAAAAAAAAAAuR23/Lkdt/y5Hbf8LERtAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiNVLAIjVSwAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAACg+X+AuR23/Lkdt/xEaKWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACxEbQC5Hbf8LERtA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIjVSwC5Hbf8uR23/FyM2gAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUIDSArQmbw +Lkdt/wIEBhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiNVLALkdt/y5Hbf8fMUuwAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACBAYQ +JTlY0C5Hbf8uR23/JTlY0AgNFDAAAAAAAAAAAAAAAAAAAAAADhYiUCg+X+AuR23/Lkdt/y5Hbf8IDRQw +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAP +AAAAFiU5WNUlOVjWIjVRyiI1UcsiNVLMKD5f5gAAADQAAAA2AAAANhEaKYAuR23/JTlY2SI1UcsiNVHK +JTlY1i5Hbf8FCQ0zAAAADwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAACAAAAA8AAAAWAAAAHQAAACIAAAAnAAAALAAAAC8AAAAyAAAANAAAADYAAAA2AAAANAAAADIAAAAv +AAAALAAAACcAAAAiAAAAHQAAABYAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0BAAADAAAAAQAgAAABAQADAAAAAQAgAAABAgADAAAABAAA +EKoBAwADAAAAAQABAAABBgADAAAAAQACAAABEQAEAAAAAQAAAAgBEgADAAAAAQABAAABFQADAAAAAQAE +AAABFgADAAAAAQD8AAABFwAEAAAAAQAAEAABHAADAAAAAQABAAABUgADAAAAAQABAAABUwADAAAABAAA +ELIAAAAAAAgACAAIAAgAAQABAAEAAQ + + + + + + + + orderFrontFontPanel: + + + YES + YES + -1 + YES + 0 + + + NSToolbarSpaceItem + + Space + + + + + + {32, 5} + {32, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + + + YES + + + + + + + + + + + + YES + + + + + + YES + + + + + 256 + + YES + + + 274 + {400, 300} + + + CocoaNavView + + + {400, 300} + + + + {{0, 0}, {1920, 1178}} + CocoaNavJS + + + + + YES + + + cocoaNavWindow + + + + 5 + + + + refresh: + + + + 23 + + + + searchField + + + + 26 + + + + webView + + + + 27 + + + + searchFieldChanged: + + + + 28 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + + 2 + + + YES + + + + + + 6 + + + + + 9 + + + YES + + + + + + + + + + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 19 + + + YES + + + + + + 17 + + + YES + + + + + + 18 + + + + + 22 + + + YES + + + + + + 20 + + + YES + + + + + + 21 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 1.windowTemplate.hasMinSize + 1.windowTemplate.minSize + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency + 2.IBPluginDependency + 20.IBPluginDependency + 21.IBPluginDependency + 6.IBPluginDependency + 9.IBPluginDependency + 9.editorWindowContentRectSynchronizationRect + + + YES + + + + + {{556, 145}, {400, 300}} + + {196, 240} + + + + + + + + + + + + + + + + + + {{448, 218}, {616, 227}} + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 28 + + + + YES + + + + + YES + + YES + + searchInPage: + + + YES + id + + + + + YES + + YES + + + YES + + + + IBUserSource + + + + + + + + + id + + + YES + + YES + + + + + YES + + + + + + IBUserSource + + + + + + + + YES + + YES + + + YES + + + + + + + + + + + + + + 0 + ../JSCocoa.xcodeproj + 3 + + YnBsaXN0MDDUAAEAAgADAAQABQAGAAkAClgkdmVyc2lvblQkdG9wWSRhcmNoaXZlclgkb2JqZWN0cxIA +AYag0QAHAAhdSUIub2JqZWN0ZGF0YYABXxAPTlNLZXllZEFyY2hpdmVyrxD6AAsADAAxADUANgA8AD0A +QgBYAFkAWgBbAHQAeAB8AJMAlACVAJYAlwCYAJkAmgCbAJwAkwC8AL0AvgDIAMkAzQCsANIA1gDXANsA +3gDhAOcA6QDsAO0A7gDxAJQBAgEDAQQBBQEGAQIBGADrAR0BHgEhASUBJgEpASsAlQE6ATsBPADIAUEB +RQFKAU0BTgFPAJYBXwFgAWEBYgFqAWwBewF9AX4ACwGOAAsBjwGpAaoBsQGyAbUBuQECAboBvgHEAcQB +xQCYAdQB1QDIAdsB3wHkAewB9AH1AfYB+QH6AMgB/gIBAgIAmQISAhMAyAIUAhwCHgItAi8CMAALAjgC +OQJPAlACWAJZAloCXQJiAmMCZgJxAnICcwJ8An0CgQKJAooCiwBtAowCjQKRApUClQKWAJsCpQKmAqcA +yAKsArACtQK4ArkCugLGAswCzwLSAAsC3ALgAugC6QLqAugACwLtAu8C8ALxAvQC+AMAAwgDCQMNAxID +EwMYAxkDHgMfAyIDJwMoAz0DQANBA1YDbAOCA4MDhAOFA4YDhwOIA4kDigOLA4wDjQOOA48DkAORA5ID +kwOUA5UDmAObA7YD0QPSA9MD1APVA9YCVQBWA9cD2APZAFUD2gPbA9wD3QPeA98D4APhA+ID4wPkA+UD +6APrA+5VJG51bGzfEBIADQAOAA8AEAARABIAEwAUABUAFgAXABgAGQAaABsAHAAdAB4AHwAgACEAIgAj +ACQAJQAmACcAKAApACoAKwAsAC0ALgAvADBWTlNSb290ViRjbGFzc11OU09iamVjdHNLZXlzXxAPTlND +bGFzc2VzVmFsdWVzXxAZTlNBY2Nlc3NpYmlsaXR5T2lkc1ZhbHVlc11OU0Nvbm5lY3Rpb25zW05TTmFt +ZXNLZXlzW05TRnJhbWV3b3JrXU5TQ2xhc3Nlc0tleXNaTlNPaWRzS2V5c11OU05hbWVzVmFsdWVzXxAZ +TlNBY2Nlc3NpYmlsaXR5Q29ubmVjdG9yc11OU0ZvbnRNYW5hZ2VyXxAQTlNWaXNpYmxlV2luZG93c18Q +D05TT2JqZWN0c1ZhbHVlc18QF05TQWNjZXNzaWJpbGl0eU9pZHNLZXlzWU5TTmV4dE9pZFxOU09pZHNW +YWx1ZXOAAoD5gMKA3ID4gLWAxoAFgNuA3YDHgPaAAIAGgMWA9xAegN7SAA4AMgAzADRbTlNDbGFzc05h +bWWABIADXxAVQXBwbGljYXRpb25Db250cm9sbGVy0gA3ADgAOQA6WCRjbGFzc2VzWiRjbGFzc25hbWWi +ADoAO15OU0N1c3RvbU9iamVjdFhOU09iamVjdF8QEElCQ29jb2FGcmFtZXdvcmvSAA4APgA/AEBaTlMu +b2JqZWN0c4C0oQBBgAfbAEMADgBEAEUARgBHAEgASQBKAEsATABNAE4ATwBQAFEAUgBTAFQAVQBWAFdc +TlNXaW5kb3dWaWV3XE5TU2NyZWVuUmVjdF8QE05TRnJhbWVBdXRvc2F2ZU5hbWVdTlNXaW5kb3dUaXRs +ZVlOU1dURmxhZ3NdTlNXaW5kb3dDbGFzc1xOU1dpbmRvd1JlY3RfEA9OU1dpbmRvd0JhY2tpbmdfEBFO +U1dpbmRvd1N0eWxlTWFza1tOU1ZpZXdDbGFzc4CngLOAsYCygAkSYAAAAIAKgAgQAhAPgAtfEBh7ezE5 +NiwgMTUxfSwgezQwMCwgMzAwfX1bQ29jb2FOYXYgSlNfEBBDb2NvYU5hdkpTV2luZG933QAOAFwAXQBe +AF8AYABhAGIAYwBkAGUAZgBnAGgAaQBqAGsAbABtAG4AKwBqAGwAcgBVAHNfEBdOU1Rvb2xiYXJJQkRl +ZmF1bHRJdGVtc18QH05TVG9vbGJhclNob3dzQmFzZWxpbmVTZXBhcmF0b3JfEBdOU1Rvb2xiYXJJQkFs +bG93ZWRJdGVtc18QH05TVG9vbGJhckF1dG9zYXZlc0NvbmZpZ3VyYXRpb25fEBFOU1Rvb2xiYXJTaXpl +TW9kZV8QGk5TVG9vbGJhcklCSWRlbnRpZmllZEl0ZW1zXxARTlNUb29sYmFyRGVsZWdhdGVfEBlOU1Rv +b2xiYXJQcmVmZXJzVG9CZVNob3duXxAgTlNUb29sYmFyQWxsb3dzVXNlckN1c3RvbWl6YXRpb25fEBpO +U1Rvb2xiYXJJQlNlbGVjdGFibGVJdGVtc18QFE5TVG9vbGJhckRpc3BsYXlNb2RlXxATTlNUb29sYmFy +SWRlbnRpZmllcoCmgKQJgKMIEAGADoAACQiApYAM0gAOAHUAdgB3WU5TLnN0cmluZ4ANXxAkQ0EzODVE +MUMtMDA2Ni00RjFGLUJDREYtNTkyOTdDQUYyRjlF0gA3ADgAeQB6owB6AHsAO18QD05TTXV0YWJsZVN0 +cmluZ1hOU1N0cmluZ9MADgB9AD4AfgB/AIlXTlMua2V5c4BuqQCAAIEAggCDAIQAhQCGAIcAiIAPgBCA +EYASgBOAFIAVgBaAF6kAigCLAIwAjQCOAI8AkACRAJKAGIAsgDyAR4BOgGGAcoB5gJhfEBZOU1Rvb2xi +YXJTaG93Rm9udHNJdGVtXxAWTlNUb29sYmFyU2VwYXJhdG9ySXRlbV8QHU5TVG9vbGJhckN1c3RvbWl6 +ZVRvb2xiYXJJdGVtXxAaTlNUb29sYmFyRmxleGlibGVTcGFjZUl0ZW1fECREOEY4Mzk5Ny0wNDMzLTQ2 +MzAtOTQ5OC0zQzNBMUE1MzA1RjRfEBJOU1Rvb2xiYXJQcmludEl0ZW1fEBJOU1Rvb2xiYXJTcGFjZUl0 +ZW1fECQ2MzJDQTI4Qy03NTlFLTQ5RkItODM5Ri00M0M2NUI5RjgyNEZfEBdOU1Rvb2xiYXJTaG93Q29s +b3JzSXRlbd8QEACdAA4AngCfAKAAoQCiAKMApAClAKYApwCoAKkAqgCrAKwArQArAGoAsABqACsAagC0 +ALUAtgC3ALgAuAC1ALtfEB9OU1Rvb2xiYXJJdGVtVmlzaWJpbGl0eVByaW9yaXR5XxARTlNUb29sYmFy +SXRlbVZpZXdfEBROU1Rvb2xiYXJJdGVtRW5hYmxlZF8QE05TVG9vbGJhckl0ZW1BY3Rpb25fEBhOU1Rv +b2xiYXJJc1VzZXJSZW1vdmFibGVfEBNOU1Rvb2xiYXJJdGVtVGFyZ2V0XxAaTlNUb29sYmFySXRlbUF1 +dG92YWxpZGF0ZXNfEBdOU1Rvb2xiYXJJdGVtSWRlbnRpZmllcl8QGU5TVG9vbGJhckl0ZW1QYWxldHRl +TGFiZWxfEBROU1Rvb2xiYXJJdGVtVG9vbFRpcF8QEE5TVG9vbGJhckl0ZW1UYWdfEBROU1Rvb2xiYXJJ +dGVtTWF4U2l6ZV8QFE5TVG9vbGJhckl0ZW1NaW5TaXplXxASTlNUb29sYmFySXRlbUxhYmVsXxASTlNU +b29sYmFySXRlbUltYWdlEACAK4AACYApCYAACYAZgBqAGxP//////////4AqgCqAGoAcVUZvbnRzXxAP +U2hvdyBGb250IFBhbmVs1QAOAL8AwADBAMIAwwDEAMUAxgDHVk5TU2l6ZVxOU0ltYWdlRmxhZ3NWTlNS +ZXBzV05TQ29sb3KAKIAdEijAAACAHoAmWHszMiwgMzJ90gAOAD4AygDLgCWhAMyAH9IADgA+AM4Az4Ak +ogDQANGAIIAh0gAOANMA1ADVXxAUTlNUSUZGUmVwcmVzZW50YXRpb26AI4AiTxEQuk1NACoAABAIAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAUHy9wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAADhYiUC5Hbf8LERtAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAoPl/gLkdt/xQfL3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAFyM2gC5Hbf8uR23/FyM2gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUIDSArQmbwLkdt/y5Hbf8iNVLAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHCxEoCU5WNAuR23/Lkdt/yU5WNAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUIDSAuR23/CxEbQC5Hbf8uR23/Lkdt +/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIjVSwCI1UsAAAAAAKD5f +4C5Hbf8uR23/CA0UMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsRG0AuR23/BQgN +IAAAAAAiNVLALkdt/y5Hbf8LERtAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIjVS +wBwsRKAAAAAAAAAAAB8xS7AuR23/Lkdt/xcjNoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAsRG0AuR23/BQgNIAAAAAAAAAAAFyM2gC5Hbf8uR23/HCxEoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAIjVSwCI1UsALERtACxEbQAsRG0AcLESgLkdt/y5Hbf8iNVLAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAsRG0AuR23/Lkdt/y5Hbf8uR23/Lkdt/y5Hbf8uR23/Lkdt/ytCZvAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAIjVSwBwsRKAAAAAAAAAAAAAAAAAAAAAABQgNIC5Hbf8uR23/Lkdt +/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsRG0AuR23/BQgNIAAAAAAAAAAAAAAAAAAAAAAAAAAALkdt +/y5Hbf8uR23/CxEbQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIjVSwCI1UsAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAoPl/gLkdt/y5Hbf8RGilgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsRG0AuR23/CxEbQAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAACI1UsAuR23/Lkdt/xcjNoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCA0gK0Jm8C5Hbf8CBAYQAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAIjVSwC5Hbf8uR23/HzFLsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgQGECU5WNAuR23/Lkdt +/yU5WNAIDRQwAAAAAAAAAAAAAAAAAAAAAA4WIlAoPl/gLkdt/y5Hbf8uR23/CA0UMAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAADwAAABYlOVjVJTlY +1iI1UcoiNVHLIjVSzCg+X+YAAAA0AAAANgAAADYRGimALkdt/yU5WNkiNVHLIjVRyiU5WNYuR23/BQkN +MwAAAA8AAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAPAAAA +FgAAAB0AAAAiAAAAJwAAACwAAAAvAAAAMgAAADQAAAA2AAAANgAAADQAAAAyAAAALwAAACwAAAAnAAAA +IgAAAB0AAAAWAAAADwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAANAQAAAwAAAAEAIAAAAQEAAwAAAAEAIAAAAQIAAwAAAAQAABCqAQMAAwAAAAEA +AQAAAQYAAwAAAAEAAgAAAREABAAAAAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEABAAAARYAAwAAAAEA +/AAAARcABAAAAAEAABAAARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAQAABCyAAAAAAAIAAgA +CAAIAAEAAQABAAHSADcAOADYANmjANkA2gA7XxAQTlNCaXRtYXBJbWFnZVJlcFpOU0ltYWdlUmVw0gA3 +ADgA3ADdogDdADtXTlNBcnJhedIANwA4AN8A4KMA4ADdADteTlNNdXRhYmxlQXJyYXnTAA4A4gDjAOQA +5QDmXE5TQ29sb3JTcGFjZVdOU1doaXRlgCcQA0QwIDAA0gA3ADgA6ADCogDCADvSADcAOADqAOuiAOsA +O1dOU0ltYWdlXxAUb3JkZXJGcm9udEZvbnRQYW5lbDpWezAsIDB90gA3ADgA7wDwogDwADtdTlNUb29s +YmFySXRlbd8QEQCdAA4A8gCeAJ8AoAChAKIAowCkAKUApgCnAKgAqQCqAKsArADzAPQAKwBqACsAagAr +AGoA+wD8ACsAtwD+AP8BAAArXxAjTlNUb29sYmFySXRlbU1lbnVGb3JtUmVwcmVzZW50YXRpb26AO4Ay +gAAJgAAJgAAJgC2AL4AAgDGAMIAugABQWVNlcGFyYXRvcld7MTIsIDV9WnsxMiwgMTAwMH3ZAA4BBwEI +AQkBCgELAQwBDQEOAQ8BEAERAGoBEABqARUBFgEXV05TVGl0bGVfEBFOU0tleUVxdWl2TW9kTWFza11O +U0lzU2VwYXJhdG9yWk5TS2V5RXF1aXZcTlNJc0Rpc2FibGVkXU5TTW5lbW9uaWNMb2NZTlNPbkltYWdl +XE5TTWl4ZWRJbWFnZYA6gDMSABAAAAmAMwkSf////4A0gDjTAA4AMgEZARoBGwEcXk5TUmVzb3VyY2VO +YW1lgDeANYA2XxAPTlNNZW51Q2hlY2ttYXJr0gA3ADgBHwEgogEgADtfEBBOU0N1c3RvbVJlc291cmNl +0wAOADIBGQEaARsBJIA3gDWAOV8QEE5TTWVudU1peGVkU3RhdGXSADcAOAEnASiiASgAO1pOU01lbnVJ +dGVt0gA3ADgBKgCUowCUAPAAO98QEACdAA4AngCfAKAAoQCiAKMApAClAKYApwCoAKkAqgCrAKwArQAr +AGoBLwBqACsAagEzATQBNQC3ALgAuAE0ATmAK4AACYBGCYAACYA9gD6AP4AqgCqAPoBAWUN1c3RvbWl6 +ZV8QEUN1c3RvbWl6ZSBUb29sYmFy1QAOAL8AwADBAMIAwwE+AMUBPwDHgCiAQYBCgCbSAA4APgDKAUOA +JaEBRIBD0gAOAD4AzgFHgCSiANABSYAggETSAA4A0wDUAUyAI4BFTxEQuk1NACoAABAIAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAACAgIGwAAAAQAAAAABAQECAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE +BAQFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAABDQ0NHSUlJVtdXV2waWlpw29vb88gICBlDw8PMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb +GxslKCgoSB4eHj0pKSlKJycnLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAMDAwhCQkKFr6+v4vX19f319fX+4eHh/NnZ2fmDg4PbGBgYPAAAAAAAAAAAAAAAAAAAAAAA +AAACRUVFemRkZL39/f3//v7+//////9DQ0O0AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAPDw8fSEhIh9ra2vP+/v7/4+Pj/9jY2P+2trb/srKy/4uLi+49PT3lCgoKEgAAAAAA +AAAAAAAAAFFRUZaNjY30yMjI+sfHx/+enp7/e3t7/yEhITAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAADw8PJUVFRY7Q0ND2/v7+/+Hh4f3Q0ND/jY2N/05OTusqKiqyHx8foBoaGqwi +IiJsAAAAAQAAAAA4ODhlnp6e/8vLy/3d3d3/vLy8/4WFhf9ERERNAAAAAAAAAAAAAAAAHx8fLAAAAAEA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAI/Pz9s2tra8vf39//r6+v+ysrK/3Z2dvw+Pj78ICAgfhAQEDQC +AgIHAAAADxERET0DAwMJEBAQEoeHh9jBwcH/6Ojo/9/f3/90dHT/PDw8TgAAAAAAAAAAAAAAAHJycpZD +Q0OfBwcHCAAAAAAAAAAAAAAAAAAAAAAAAAAABgYGDH5+frjLy8v9x8fH/ru7u/+Tk5P/QkJC+x0WC+wC +AgIEAAAAAAAAAAAAAAAAAAAAAAICAgUuLi4zlpaW8+rq6v/u7u7/q6ur/yMjI9MAAAAAAAAAAAAAAACB +gYGRi4uL/0JCQtkNDQ0mAAAAAAAAAAAAAAAAAAAAABkZGSReXl6MpaWl86ampv+Kior/dXV1/2FhYfos +JB76IxAA6yYXBqAICAgNAAAAAAAAAAAAAAAAAAAAAD4+PkSWlpb69fX1/+vr6/+1tbX1Wlpa5QMDA2wA +AAAAioqKnKKiov+/v7//R0dH5w4ODicAAAAAAAAAAB0dHSt1dXWfqampwvr6+v/b29v/fX19/mNjY/hI +SEjoDAgD+CYSAPI4GgDwcTQA7DcjDI4HBwcLAAAAAAAAAAAAAAAADAwMDpubm/jq6ur/8vLy/9DQ0OyA +gIDLZGRk6nBwcMyzs7P/z8/P/9LS0v9MTEzaCQkJIQAAAAAaGho2f39/uP/////4+Pj//f39//b29v9H +R0f/KCgo5CkpKaAEAgCVDQUA11UoAOV2OQDrk0gA3DolDnsGBgYKAAAAAAAAAAAeHh5hZWVl++jo6P/u +7u7/+fn5/+Tk5PS4uLjt39/f//Dw8P/h4eH/y8vL/zs7O60CAgIDAAAAABgYGC98fHz///////////+0 +tLT/p6en/0BAQPsVFRV1CQkJJAQEBA4HBQNtIxEAu2MyAN5/QQDoolMAyjYjDm4GBgYKExMTSDs7O+Gx +sbH9w8PD/9XV1f////////////////////////////Pz8/90dHTnDw8PRwAAAAEAAAAAAAAAAFVVVaKA +gID/7+/v/7+/v/9lZWX/Ojo6ywEBAQYAAAAAAAAAAAAAAAARDQlXLRcApWU0ANaGRQDgqloAwDIjE4Mx +MTHCs7Oz+MHBwf+fn5//1tbW///////7+/v7//////////+9vb3zhYWF8iMjI3QAAAADAAAAAQAAAAAA +AAAAAAAAAEpKSppaWlr/kZGR/zc3N/IYGBhuAAAAAQAAAAAAAAAAAAAAAAAAAAALBQBFMBgAm2g3AM16 +QgDhZ0Yi47OysfjExMT/qamp/9PT0/96enr6XV1d62xsbOpdXV31V1dX7FJSUscpKSljAAAABgAAAAEA +AAAAAAAAAAAAAAAAAAAAAAAAAEFBQZojIyP/HBwcrAUFBR0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL +BQBALhgAn0swE+O8uLP9uLi4/5SUlP/U1NT/g4OD5DMzM88GBgYMOjo6QUBAQEkPDw8WGxsbIQAAAAIA +AAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACIiIpoKCgouAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAABwMCQWEvbu5+K+vr/+BgYH/z8/P/4iEgegmJiaqAwMDCgAAAAAAAAAAAAAAAQAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAcAAAAVMHBwe6rq6v/bm5u/87Ozv+cjoD4ZT4W3zIbAnoAAAANAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAwMDJwoKCmbLy8vvqamp/1paWv/S0tL/jYeB6kgmBOCHQwHkm04AyzcbAIcA +AAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAwMDDsaGhqG1dXV86urq/9GRkb/2dnZ/4aGhsUJBACGOh4AsmgzANmF +QADrlkkA2T4eAJ4AAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYGBhRKCgoqNLS0vOrq6v/MTEx/+Li4v+Pj4/OAAAASAAAAAIP +BwBoOh0AymgyAOGCPgDwlUUA7EUhALgAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFhYWKzU1Nc/a2tr2/Pz8/xcXF//q6ur/mpqa2QAAAEgA +AAACAAAAAAAAAAAQCACGOBsA4mkxAOl+OgD3lUQA/0siANIAAAASAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICAgU/Pz+GrKys99HR0f/9/f3/8/Pz/6WlpeYF +BQVZAAAAAgAAAAAAAAAAAAAAAAAAAAASCQClMRYA+m0zAPZ6OAD/bi8A/ysSAMQAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwcHDkFBQZqampr/qamp//j4+P+x +sbHyFxcXgQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQBwDKIA4A/1kpAP88GgD3LhMAsgAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEDJycnVlBQUPOW +lpb6qKio3yoqKq0BAQEFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALBQDlFwkA+iAOAMIE +AgAzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAICAgQUdHR5ouLi5wAgICBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAI +AwDMBQIAPQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAkAAAAQAAAAGAAAACAA +AAAqAAAAMQAAADYAAAA5AAAAOAEBATkAAAAvAAAAJwAAAB0AAAAVAAAADgAAAAoAAAALAAAADwAAABcA +AAAgAAAAKgAAADEAAAA0AAAAMwAAAC0AAAAkAAAAGwAAABIAAAALAAAAAAAAAAAAAAAEAAAACQAAABAA +AAAYAAAAIAAAACoAAAAxAAAANgAAADkAAAA4AAAANQAAAC8AAAAnAAAAHQAAABUAAAAOAAAACgAAAAsA +AAAPAAAAFwAAACAAAAAqAAAAMQAAADQAAAAzAAAALQAAACQAAAAbAAAAEgAAAAsAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAANAQAAAwAAAAEAIAAAAQEAAwAAAAEAIAAAAQIAAwAAAAQAABCqAQMAAwAAAAEAAQAAAQYA +AwAAAAEAAgAAAREABAAAAAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEABAAAARYAAwAAAAEA/AAAARcA +BAAAAAEAABAAARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAQAABCyAAAAAAAIAAgACAAIAAEA +AQABAAFfEB9ydW5Ub29sYmFyQ3VzdG9taXphdGlvblBhbGV0dGU63xARAJ0ADgDyAJ4AnwCgAKEAogCj +AKQApQCmAKcAqACpAKoAqwCsAVABUQArAGoAKwBqACsAagFYAVkAKwC3AVsBXAEAACuATYBMgAAJgAAJ +gAAJgEiASYAAgEuASoAugABeRmxleGlibGUgU3BhY2VWezEsIDV9W3syMDAwMCwgMzJ92QAOAQcBCAEJ +AQoBCwEMAQ0BDgEPARABEQBqARAAagEVARYBF4A6gDMJgDMJgDSAONIANwA4AWsAlqMAlgDwADvfEBAA +nQAOAJ4AnwCgAKEAogCjAKQApQCmAKcAqACpAKoAqwCsAK0BbgBqACsAagArAGoBdAF1ACsArAF3AXgB +dQF6gCuAUQmAAAmAAAmAT4BQgACAYIBfgFCAWtIADgB1AHYAl4ANV1JlZnJlc2jYAX8ADgGAAYEBggGD +AYQBhQGGAYcBiAGJAYoAagGMAYZfEA9OU05leHRSZXNwb25kZXJXTlNGcmFtZVZOU0NlbGxYTlN2Rmxh +Z3NZTlNFbmFibGVkWE5TV2luZG93W05TU3VwZXJ2aWV3gFKAXoBTgFURAQwJgFSAUl8QFHt7MTEsIDE0 +fSwgezI1LCAyNX193QGQAA4BkQGSAZMBlAGVAZYBlwGYAZkBmgGbAZwBnQGeAXoBoAGhAZ4BowGkAW4B +pgGnAahbTlNDZWxsRmxhZ3NfEBNOU0FsdGVybmF0ZUNvbnRlbnRzXU5TTm9ybWFsSW1hZ2VfEBJOU1Bl +cmlvZGljSW50ZXJ2YWxeTlNCdXR0b25GbGFnczJfEA9OU0tleUVxdWl2YWxlbnRaTlNDb250ZW50c1lO +U1N1cHBvcnRdTlNDb250cm9sVmlld18QD05TUGVyaW9kaWNEZWxheVxOU0NlbGxGbGFnczJdTlNCdXR0 +b25GbGFncxIEAf4AgF2AXIBaEEsQo4BcgFaAV4BREQGQEggAAAAT/////4bEQP9eUm91bmQgVGV4dHVy +ZWTUAA4AvwGrAawBrQGuAa8BsFZOU05hbWVYTlNmRmxhZ3OAWSNAKgAAAAAAAIBYEQQUXEx1Y2lkYUdy +YW5kZdIANwA4AbMBtKIBtAA7Vk5TRm9udNMADgAyARkBGgEbAbiAN4A1gFtfEBFOU1JlZnJlc2hUZW1w +bGF0ZdIANwA4AbsBvKQBvAG9AYEAO1xOU0J1dHRvbkNlbGxcTlNBY3Rpb25DZWxs0gA3ADgBvwHApQHA +AcEBwgHDADtYTlNCdXR0b25ZTlNDb250cm9sVk5TVmlld1tOU1Jlc3BvbmRlclh7MjUsIDI1fd8QEACd +AA4AngCfAKAAoQCiAKMApAClAKYApwCoAKkAqgCrAKwArQArAGoByQBqACsAagHNAc4BzgC3ALgAuAHO +AdOAK4AACYBxCYAACYBigGOAY4AqgCqAY4BkVVByaW501QAOAL8AwADBAMIAwwHXAdgB2QDHgCiAZRIs +wAAAgGaAJtIADgA+AMoB3YAloQHegGfSAA4APgDOAeGAJKIA0AHjgCCAaNUADgHlAL8B5gHnAegB6QHq +AKwAal8QFE5TQ29yZVVJSW1hZ2VPcHRpb25zXxAPTlNCaXRzUGVyU2FtcGxlWk5TSGFzQWxwaGGAcIBp +gG8J0wAOAH0APgB+Ae4B8YBuogHvAfCAaoBrogHyAfOAbIBtXGltYWdlTmFtZUtleVZ3aWRnZXTSAA4A +dQB2AfiADV8QEmltYWdlLlRvb2xiYXJQcmludFVpbWFnZdIANwA4AfsB/KMB/AH9ADtfEBNOU011dGFi +bGVEaWN0aW9uYXJ5XE5TRGljdGlvbmFyedIANwA4Af8CAKMCAADaADtfEBBOU0NvcmVVSUltYWdlUmVw +XnByaW50RG9jdW1lbnQ63xARAJ0ADgDyAJ4AnwCgAKEAogCjAKQApQCmAKcAqACpAKoAqwCsAgMCBAAr +AGoAKwBqACsAagILAgwAKwC3Ag4CDwEAACuAeIB3gAAJgAAJgAAJgHOAdIAAgHaAdYAugABVU3BhY2VX +ezMyLCA1fdkADgEHAQgBCQEKAQsBDAENAQ4BDwEQAREAagEQAGoBFQEWAReAOoAzCYAzCYA0gDjSADcA +OAIdAJmjAJkA8AA73xAQAJ0ADgCeAJ8AoAChAKIAowCkAKUApgCnAKgAqQCqAKsArACtAiAAagArAGoA +KwBqAiYCJwArAKwCKQIqAicAK4ArgHwJgAAJgAAJgHqAe4AAgJeAloB7gADSAA4AdQB2AJqADVZTZWFy +Y2jYAX8ADgGAAYEBggGDAYQBhQIxAjICMwI0AYoAagGMAjGAfYCVgH6AfwmAVIB9XxAUe3swLCAxNH0s +IHsyMzUsIDIyfX3eAZAADgI6AjsBlgGXAZgBmgI8Aj0CPgI/AkACQQJCAkMCRAJFAZ4BpAIgAkkAbQBq +AksCTAJNAk5fEBJOU0NhbmNlbEJ1dHRvbkNlbGxfEBFOU0JhY2tncm91bmRDb2xvcl8QEE5TVGV4dEJl +emVsU3R5bGVfEBFOU0RyYXdzQmFja2dyb3VuZF8QEk5TU2VhcmNoQnV0dG9uQ2VsbF8QEE5TTWF4aW11 +bVJlY2VudHNfEBNOU1BsYWNlaG9sZGVyU3RyaW5nW05TVGV4dENvbG9yEhRx/kCAlICLgIGAXIBXgHwS +EAAEAAmAiBD/gICAhVpDbGFzcyBuYW1l1QAOAMIA4gJRAlIA5AJUAlUCVgJXW05TQ29sb3JOYW1lXU5T +Q2F0YWxvZ05hbWWAJ4CEEAaAg4CCVlN5c3RlbV8QE3RleHRCYWNrZ3JvdW5kQ29sb3LTAA4A4gDjAOQA +5QJcgCdCMQDVAA4AwgDiAlECUgDkAl8CVQJgAleAJ4CHgIaAgl8QEGNvbnRyb2xUZXh0Q29sb3LTAA4A +4gDjAOQA5QJlgCdCMADcAmcBkAAOAZMBlAGVAZYBmAGZAZoCaAGbAjQCagGdAaAArAGeAm0CIAGmAKwC +bwJwWE5TVGFyZ2V0WE5TQWN0aW9ugH8SAAH+AIBdgFyAiYB8gIoSCERA/1ZzZWFyY2hfEBNfc2VhcmNo +RmllbGRTZWFyY2g63QJnAZAADgGTAZQBlQJ0AZYBmAGZAZoCaAGbAjQCagGdAaAArAGeAngCeQIgAaYA +rAJ7AnBfECNOU0FjY2Vzc2liaWxpdHlPdmVycmlkZGVuQXR0cmlidXRlc4B/gF2AXICNgIyAfICTVWNs +ZWFy0gAOAD4AygJ/gCWhAoCAjtMADgB9AD4AfgKDAoaAbqIChAKFgI+AkKIChwKIgJGAkl1BWERlc2Ny +aXB0aW9uXxApTlNBY2Nlc3NpYmlsaXR5RW5jb2RlZEF0dHJpYnV0ZXNWYWx1ZVR5cGVWY2FuY2VsXxAT +X3NlYXJjaEZpZWxkQ2FuY2VsOtIANwA4Ao4Cj6UCjwKQAb0BgQA7XxARTlNTZWFyY2hGaWVsZENlbGxf +EA9OU1RleHRGaWVsZENlbGzSADcAOAKSApOmApMClAHBAcIBwwA7XU5TU2VhcmNoRmllbGRbTlNUZXh0 +RmllbGRZezIzNSwgMjJ93xAQAJ0ADgCeAJ8AoAChAKIAowCkAKUApgCnAKgAqQCqAKsArACtACsAagKa +AGoAKwBqAp4CnwKgALcAuAC4Ap8CpIArgAAJgKIJgAAJgJmAmoCbgCqAKoCagJxWQ29sb3JzXxAQU2hv +dyBDb2xvciBQYW5lbNUADgC/AMAAwQDCAMMCqQDFAqoAx4AogJ2AnoAm0gAOAD4AygKugCWhAq+An9IA +DgA+AM4CsoAkogDQArSAIICg0gAOANMA1AK3gCOAoU8RELpNTQAqAAAQCAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAIJAQ4TOQxTKWQXkEKHIsJaoSrob7Av/W+hKuhlhyLCUWQYkDI5DFMICQEOAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAOQQ9eJYQhu0nJN/9i30L/fvRN/53+V/+2/1z/vv5X/7/0Tv+730L/tck5/36EIrtB +QA5eAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAADFAcdFmMhjjbMQf5G8Ej/av9b/3//YP+R/2T/ov9m/7D+Z//B/2b/1P9m/+X/Yf/+ +/17/7/JK/8zDOP5jWReOFBEDHQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAxQJHRp0M6A/3V//Wf9z/1z/Y/9o/mL/g/5u/5j+cv+o/nf/uv53/8r+dv/Y +/nP/5/5u//n/Z////2L///xb/93AP/90XhygFA8DHQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWYzSOPt1z/1n/iv9h/n//bP59/3L+df+I/n3/of6F/7D+if/B +/or/0f6J/+D+hv/v/oD///94///zbf/+42T//+Rd/92tP/9jRxeOAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADUEoXjXMe/5Y/6b/Yf6Y/2z+lv94/pP/gv6N/4/+iv+n +/pX/uP6a/8v+nf/b/pr/5/6W//z/kP//+4f//ul7//7cb//+zGT//8xd/8yLOP5BKQ5eAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEJBg4ghFq7R/Ci/13/r/9r/qr/eP6q/4f+qP+T +/qX/mv6e/6z+ov/C/qr/1P6s/+L+q//y/6b///+f//7xlf/+4Yr//tJ7//7Dbf//uGH/8J1K/4ROIrsJ +BQEOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADDkrUzbJlf9a/8r/Y/6+/3T+vP+E +/rv/kv66/5/+uv+p/rT/sv6w/8r+uv/b/r3/7P67//z/tf//+a3//uei//7Ylv/+yon//rl4//6rZ/// +pF7/yG05/zkbDFIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWZFGQPt+2/13/1/9r +/s7/ev7O/4z+z/+a/s3/qv7M/7f+zf/A/sX/zv7I/+X+z//2/83////E//7tu//+3q3//tCf//6/kP/+ +r4D//p9u//+UYf/fbUL/YysYjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB+Hd8JJ +9Nb/YP/j/2/+3/+D/t//kf7f/6T+3/+y/uD/wf7e/9D+3v/Y/tn/7f7g////3f//99P//uTE//7XtP/+ +xKj//rWX//6lhv/+lHP//4Vm//RtTv+HMiLCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAKKGZ6FP++f9i//P/cv/x/4X/8f+W//P/p//z/7f/8f/J//H/2f/y/+j/8P/4//H///3t//7p2//+ +2cr//si6//62qv/+p5n//paI//6Fdv//c2X//mNW/6EzKegAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAArrbD9Vv///2P+//90/v//hv7//5f+//+o/v//t/7//8v+///c/v//7/////////// +8vT//t7g//7Nz//+u73//qqs//6Zm//+iIr//nV3//5lZ///Wlz/sC8x/QAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAACiWoehR9f7/Ye7//3Ht/v+E7f7/l+3+/6bt/v+27f7/yO3+/9fs/v/k +6v7/9e3////p///+2+3//srd//66y//+qrv//pis//6Hmv/+d4r//2Z3//5VaP+hKTboAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH3WHwknR9P9h3///btv+/4Db/v+R2/7/odz+/7Da/v/A +2/7/ytf+/9XU/v/r3P7//tn////Q+f/+wub//rTY//6lyP/+lbf//oSo//5ylv//ZYn/9E1w/4ciNMIA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWUGSQP7Hf/1rR//9qyv7/esv+/4rJ/v+Z +yv7/p8f+/7TH/v+7wP7/zcX+/+TL/v/yyf///7////648P/+qeD//p3R//6Ow//+frL//m6i//9el//f +QnH/YxcsjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsqOVM0ksn/WMb//2G4/v9y +t/7/gbb+/4+1/v+cs/7/pq/+/7Gs/v/Itv7/2rf+/+q3/v/7sv///6r7//6f6f/+k9r//oXL//50vP/+ +Za7//1yo/8g3cP84DBtSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQYJDh5YhLtF +nfD/W6z//2el/v91pf7/haP+/46g/v+XmP7/qqD+/8Cm/v/QqP7/4Kf+//Ck/v//mv///5Lz//6H4//+ +eNT//mzF//9fuv/wSZ3/hCFPuwkBBQ4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAADSZBXjN3zP5XoP//XpP+/2mR/v91jv7/f4b+/42H/v+lkf7/tpf+/8mX/v/Zlv7/5pH+//eM//// +gv7//nnr//5s3v/+Yc7//1nO/8w2jf5ADSldAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAFTJjjjpu3f9Whf//Xnr+/2d2/v9ubv7/h3f+/5+C/v+ug/7/v4b+/8+F/v/e +gv7/7Xz+//90////a/b//mHl//9Z5v/dPa7/YxZIjgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADCBQdGTB0oDpY3f9VbP//WV7//2df/v+Bav7/lG7+/6dx/v+2 +dP7/yHL+/9Zv/v/mav7/9GP///9d////WP7/3T7C/3QaX6ATAw4cAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBxYfFyJokzM8zP5GRPD/aFj//3xa//+P +Yf//oGH//65j/v+/Yv//0mD//+Nd///8Wv//7kfy/8w1xf5oGF2TFQQSHgAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAFExNTdCgjlMxI +M8j/YUDf/35J9P+ZUf7/tFb//7xT/v+9SfT/uj7f/7M1yP+NJJTMUxJScwAAAAUAAAACAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAgAACQUAABUI +AAAiDwQSQSYWX5Q8IY7ITyin52ArsPduK7H+dyuw930op+d1IY7IWRZflBsEEkEIAAAiBQAAFQIAAAkA +AAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEA +AAAGAgAAEAUAABwIAAApDAAAOREAAEgVAABVGAAAXRgAAF8YAABdFQAAVREAAEgMAAA5CAAAKQUAABwC +AAAQAAAABgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAEAAAACAAAABQAAAAgAAAALAAAADgAAABIAAAAUAAAAFQAAABQAAAASAAAADgAAAAsA +AAAIAAAABQAAAAIAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +DQEAAAMAAAABACAAAAEBAAMAAAABACAAAAECAAMAAAAEAAAQqgEDAAMAAAABAAEAAAEGAAMAAAABAAIA +AAERAAQAAAABAAAACAESAAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABAPwAAAEXAAQAAAABAAAQ +AAEcAAMAAAABAAEAAAFSAAMAAAABAAEAAAFTAAMAAAAEAAAQsgAAAAAACAAIAAgACAABAAEAAQABXxAV +b3JkZXJGcm9udENvbG9yUGFuZWw60gAOAD4AzgK8gCSpAJIAigCLAI8AkACNAIwAjgCRgJiAGIAsgGGA +coBHgDyAToB50gAOAD4AygLIgCWjAI4AjQCRgE6AR4B50gAOAD4AygLOgCWg0gA3ADgC0ALRogLRADtZ +TlNUb29sYmFy1wF/AA4C0wGCAtQBhAGFAtUC1gLXAtgC2QLVAttaTlNTdWJ2aWV3c1tOU0ZyYW1lU2l6 +ZYCogLCAqREBAICugKiAr9IADgA+AMoC3oAloQLfgKrXAX8ADgGCAtQBhAAyAYUATQLiAuMC5ALVAuYA +TYCngK0RARKAq4CogKyAp1p7NDAwLCAzMDB9XENvY29hTmF2Vmlld9IANwA4AusC7KQC7AHCAcMAO1xO +U0N1c3RvbVZpZXfSADcAOALuAcKjAcIBwwA7XxAWe3swLCAwfSwgezE5MjAsIDExNzh9fVpDb2NvYU5h +dkpT0gA3ADgC8gLzogLzADtfEBBOU1dpbmRvd1RlbXBsYXRl0gA3ADgC9QL2owL2AvcAO1xOU011dGFi +bGVTZXRVTlNTZXTSAA4APgDKAvqAJaUC+wL8Av0C/gL/gLaAuYC7gL2AwNQADgMBAwIDAwMEAEEAHwMH +XU5TRGVzdGluYXRpb25YTlNTb3VyY2VXTlNMYWJlbIC4gAeAAoC3XmNvY29hTmF2V2luZG930gA3ADgD +CgMLowMLAwwAO18QFE5TTmliT3V0bGV0Q29ubmVjdG9yXk5TTmliQ29ubmVjdG9y1AAOAwEDAgMDAwQC +IABBAxGAuIB8gAeAultzZWFyY2hGaWVsZNQADgMBAwIDAwMEAt8AQQMXgLiAqoAHgLxXd2ViVmlld9QA +DgMBAwIDAwMaAEECIAMdgL+AB4B8gL5fEBNzZWFyY2hGaWVsZENoYW5nZWQ60gA3ADgDIAMhowMhAwwA +O18QFU5TTmliQ29udHJvbENvbm5lY3RvctQADgMBAwIDAwMaAt8BbgMmgL+AqoBRgMFYcmVmcmVzaDrS +AA4APgDOAyqAJK8QEgCSAywCNACMAt8AjQFuAiAAjwBNAI4AVwGJAJEAigCQAEEAi4CYgMOAf4A8gKqA +R4BRgHyAYYCngE6AC4BVgHmAGIBygAeALNIADgAyADMDP4AEgMRdTlNBcHBsaWNhdGlvbtIADgA+AM4D +Q4AkrxASAFcAHwIgAFcATQBXAI4AkQBXAEEAVwBBAW4AVwBXAFcAHwBXgAuAAoB8gAuAp4ALgE6AeYAL +gAeAC4AHgFGAC4ALgAuAAoAL0gAOAD4AzgNYgCSvEBMAkgMsAjQAjALfAI0BbgIgAI8ATQCOAFcAkQGJ +AIoAkABBAB8Ai4CYgMOAf4A8gKqAR4BRgHyAYYCngE6AC4B5gFWAGIBygAeAAoAs0gAOAD4AzgNugCSv +EBMDbwNwA3EDcgNzA3QDdQN2A3cDeAN5A3oDewN8A30DfgN/A4ADgYDIgMmAyoDLgMyAzYDOgM+A0IDR +gNKA04DUgNWA1oDXgNiA2YDaXxAVVG9vbGJhciBJdGVtIChDb2xvcnMpW0FwcGxpY2F0aW9uXxARU2Vh +cmNoIEZpZWxkIENlbGxfEBhUb29sYmFyIEl0ZW0gKEN1c3RvbWl6ZSleQ29jb2EgTmF2IFZpZXdfECxU +b29sYmFyIEZsZXhpYmxlIFNwYWNlIEl0ZW0gKEZsZXhpYmxlIFNwYWNlKV8QJlJvdW5kIFRleHR1cmVk +IEJ1dHRvbiAoUm91bmQgVGV4dHVyZWQpXFNlYXJjaCBGaWVsZF8QFFRvb2xiYXIgSXRlbSAoUHJpbnQp +XENvbnRlbnQgVmlld18QFlRvb2xiYXIgSXRlbSAoUmVmcmVzaClXVG9vbGJhcl8QFVRvb2xiYXIgSXRl +bSAoU2VhcmNoKV8QHEJ1dHRvbiBDZWxsIChSb3VuZCBUZXh0dXJlZClfEBRUb29sYmFyIEl0ZW0gKEZv +bnRzKV8QGlRvb2xiYXIgU3BhY2UgSXRlbSAoU3BhY2UpXxAUV2luZG93IChDb2NvYU5hdiBKUylcRmls +ZSdzIE93bmVyXxAiVG9vbGJhciBTZXBhcmF0b3IgSXRlbSAoU2VwYXJhdG9yKdIADgA+AM4Dl4AkoNIA +DgA+AM4DmoAkoNIADgA+AM4DnYAkrxAYAJIC/QMsAjQC/wCMAt8AjQFuAiAAjwBNAI4AVwGJAJEC/AL+ +AIoAkAL7AEEAHwCLgJiAu4DDgH+AwIA8gKqAR4BRgHyAYYCngE6AC4BVgHmAuYC9gBiAcoC2gAeAAoAs +0gAOAD4AzgO4gCSvEBgDuQO6A7sDvAO9A74DvwPAA8EDwgPDA8QDxQPGA8cDyAPJA8oDywPMA80CiAPP +A9CA34DggOGA4oDjgOSA5YDmgOeA6IDpgOqA64DsgO2A7oDvgPCA8YDygPOAkoD0gPUQChAbE/////// +///9EBUQFxAQEBEQFBANEBMQCRASEBYQGhAcEAsQDhAFEB0QDNIADgA+AMoD54AloNIADgA+AM4D6oAk +oNIADgA+AM4D7YAkoNIANwA4A+8D8KID8AA7Xk5TSUJPYmplY3REYXRhAAgAGQAiACcAMQA6AD8ARABS +AFQAZgJdAmMCrgK1ArwCygLcAvgDBgMSAx4DLAM3A0UDYQNvA4IDlAOuA7gDxQPHA8kDywPNA88D0QPT +A9UD1wPZA9sD3QPfA+ED4wPlA+cD6QPyA/4EAAQCBBoEIwQsBDcEPARLBFQEZwRwBHsEfQSABIIErwS8 +BMkE3wTtBPcFBQUSBSQFOAVEBUYFSAVKBUwFTgVTBVUFVwVZBVsFXQV4BYQFlwXMBeYGCAYiBkQGWAZ1 +BokGpQbIBuUG/AcSBxQHFgcXBxkHGgccBx4HIAchByIHJAcmBy8HOQc7B2IHawdyB4QHjQeaB6IHpAe3 +B7kHuwe9B78HwQfDB8UHxwfJB9wH3gfgB+IH5AfmB+gH6gfsB+4IBwggCEAIXQiECJkIrgjVCO8JMglU +CWgJfwmVCbAJxgnjCf0KGQowCkMKWgpxCoYKmwqdCp8KoQqiCqQKpQqnCqgKqgqsCq4Ktwq5CrsKvQq/ +CsUK1wrsCvMLAAsHCw8LEQsTCxgLGgscCyULLgswCzMLNQs+C0ALRQtHC0kLUgtpC2sLbRwrHDQcOxxO +HFkcYhxnHG8ceBx/HI4cmxyoHLAcshy0HLkcwhzHHNAc1RzdHPQc+x0EHQkdFx1eHYQdhh2IHYodix2N +HY4dkB2RHZMdlR2XHZkdmx2dHZ8doB2qHbIdvR3iHeod/h4MHhceJB4yHjweSR5LHk0eUh5THlUeVh5b +Hl0eXx5sHnsefR5/HoEekx6cHqEetB7BHsMexR7HHtoe4x7oHvMe/B8DH0YfSB9KH0sfTR9OH1AfUR9T +H1UfVx9ZH1sfXR9fH2kffR+SH5Qflh+YH5ofox+lH6gfqh+zH7Ufuh+8H74fxx/JH8swiTCrMPIw9DD2 +MPgw+TD7MPww/jD/MQExAzEFMQcxCTELMQ0xHDEjMS8xVDFWMVgxWTFbMVwxXjFgMWkxcDGzMbUxtzG4 +MboxuzG9Mb4xwDHCMcQxxjHIMcoxzDHVMdcx3zIAMhIyGjIhMioyNDI9MkkySzJNMk8yUTJUMlUyVzJZ +MnAypTKxMscy1TLqMvkzCzMWMyAzLjNAM00zWzNgM2IzZDNmM2gzajNsM24zcDNyM3UzejODM5IzozOq +M7MztTO+M8AzwzPQM9kz3jPlM/Iz9DP2M/g0DDQVNB40KzQ4NEE0TDRVNF80ZjRyNHs0vjTANMI0wzTF +NMY0yDTJNMs0zTTPNNE00zTVNNc03TTyNPQ09jT7NP00/zUINQo1DTUPNRg1GjUfNSE1IzU4NU81YTVs +NW41cDVyNXM1gDWCNYc1iTWLNZA1kjWUNaE1qDWxNbM1yDXONdc13jX0NgE2CjYRNiQ2MzZ6Nnw2fjaA +NoE2gzaENoY2hzaJNos2jTaPNpE2kzaVNps2ozbINso2zDbNNs820DbSNtQ23TbkNyc3KTcrNyw3Ljcv +NzE3Mjc0NzY3ODc6Nzw3PjdAN0k3SzdSN3M3dTd3N3k3ezd8N343gDeXN9A35Tf5OAw4IDg1OEg4Xjhq +OG84cThzOHU4dzh5OHs4gDiBOIM4hTiHOIk4lDipOLU4wzjFOMc4yTjLOM041DjqOPc4+Tj8ORE5EzkV +ORc5GTksOTk5Ozk+OW85eDmBOYM5iDmKOYw5jjmQOZI5lzmeObQ56ToPOhE6EzoVOhc6GTobOh06Izos +Oi46MTozOkA6QjpHOkk6SzpQOlI6VDpiOo46lTqrOrQ6vzrTOuU67jr7Owk7FTsfO2I7ZDtmO2c7aTtq +O2w7bTtvO3E7czt1O3c7eTt7O4I7lTuqO6w7rjuwO7I7uzu9O8A7wjvLO8070jvUO9Y73zvhO+NMoUy5 +TMJMxEzXTNlM20zdTN9M4UzjTOVM50zpTPJM9Ez7TP1M/00BTQpNDE0NTRZNG00lTUJNTU1ZTVtNXU1f +TWJNZE1mTWhNcU1zTXZNeE2VTZdNmU2cTZ5NoE2iTaRNr028TcVNzk3bTeRN604ETg9OGE4dTjBOOU5A +Tk1OU05cTl5OaU5rTm1Ob05xTnNOhE6STptOo06lTqdOqU6rTrpOw07KTuFO8E8BTwNPBU8HTwlPFU8m +TyhPKk8sTy5PNk9HT0lPS09NT09PZU9uT3VPjU+eT6BPok+kT6ZPr0+4T7pP4U/jT+VP50/pT+tP7U/v +T/FP80/1T/dP+U/7T/1P/1ABUANQBVAOUBBQElAgUClQK1BSUFRQVlBYUFpQXFBeUGBQYlBkUGZQaFBq +UGxQblBwUHJQdFB2UH9QgVCqUKxQrlCwULJQtFC2ULhQulC8UL5QwFDCUMRQxlDIUMpQzFDOUNBQ2VDb +UQRRBlEIUQpRDFEOURBRElEUURZRGFEaURxRHlEgUSJRJFEmUShRKlFCUU5RYlF9UYxRu1HkUfFSCFIV +Ui5SNlJOUm1ShFKhUrhSxVLqUvNS9VL2Uv9TAVMCUwtTDVNAU0JTRFNGU0hTSlNMU05TUFNSU1RTVlNY +U1pTXFNeU2BTYlNkU2ZTaFNqU2xTblNwU3lTe1OuU7BTslO0U7ZTuFO6U7xTvlPAU8JTxFPGU8hTylPM +U85T0FPSU9RT1lPYU9pT3FPeU+BT4lPrU+1T71PxU/NT9VP3U/lT+1P9U/9UAVQDVAVUB1QJVAtUDVQW +VBhUGVQiVCRUJVQuVDBUMVQ6VD8AAAAAAAACAgAAAAAAAAPxAAAAAAAAAAAAAAAAAABUTg + + + diff --git a/jscocoa/GUIConsole/Info.plist b/jscocoa/GUIConsole/Info.plist new file mode 100644 index 0000000..99d5096 --- /dev/null +++ b/jscocoa/GUIConsole/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + JSCocoa + CFBundleIconFile + JSCocoa + CFBundleIdentifier + com.inexdo.JSCocoa + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + JSCocoa + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/jscocoa/GUIConsole/JSCocoa.icns b/jscocoa/GUIConsole/JSCocoa.icns new file mode 100644 index 0000000..0e1c8a6 Binary files /dev/null and b/jscocoa/GUIConsole/JSCocoa.icns differ diff --git a/jscocoa/GUIConsole/JSCocoa.xcodeproj/mini.tm_build_errors b/jscocoa/GUIConsole/JSCocoa.xcodeproj/mini.tm_build_errors new file mode 100644 index 0000000..e69de29 diff --git a/jscocoa/GUIConsole/JSCocoa.xcodeproj/project.pbxproj b/jscocoa/GUIConsole/JSCocoa.xcodeproj/project.pbxproj new file mode 100644 index 0000000..e291394 --- /dev/null +++ b/jscocoa/GUIConsole/JSCocoa.xcodeproj/project.pbxproj @@ -0,0 +1,387 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 44; + objects = { + +/* Begin PBXBuildFile section */ + 3D08D07C0E65CED100B81E63 /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D08D07B0E65CED100B81E63 /* main.js */; }; + 3D08D0EE0E65D89500B81E63 /* ClassTree.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D08D0ED0E65D89500B81E63 /* ClassTree.png */; }; + 3D0E37F60ED8BE9400077F66 /* Tests in Resources */ = {isa = PBXBuildFile; fileRef = 3D0E37CF0ED8BE9400077F66 /* Tests */; }; + 3D15F3E10FC01C0A009E31F4 /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F3BA0FC01C0A009E31F4 /* BridgeSupportController.m */; }; + 3D15F3E20FC01C0A009E31F4 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D15F3BB0FC01C0A009E31F4 /* class.js */; }; + 3D15F3ED0FC01C0A009E31F4 /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F3D80FC01C0A009E31F4 /* JSCocoaController.m */; }; + 3D15F3EE0FC01C0A009E31F4 /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F3DA0FC01C0A009E31F4 /* JSCocoaFFIArgument.m */; }; + 3D15F3EF0FC01C0A009E31F4 /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F3DC0FC01C0A009E31F4 /* JSCocoaFFIClosure.m */; }; + 3D15F3F00FC01C0A009E31F4 /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F3DE0FC01C0A009E31F4 /* JSCocoaLib.m */; }; + 3D15F3F10FC01C0A009E31F4 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F3E00FC01C0A009E31F4 /* JSCocoaPrivateObject.m */; }; + 3D45274B0E7A1DA00044D504 /* JSCocoa.icns in Resources */ = {isa = PBXBuildFile; fileRef = 3D45274A0E7A1DA00044D504 /* JSCocoa.icns */; }; + 3D4FAC170E6798FA005874A3 /* NSLogConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D4FAC150E6798FA005874A3 /* NSLogConsole.m */; }; + 3D4FAC1C0E67990F005874A3 /* NSLogConsole.html in Resources */ = {isa = PBXBuildFile; fileRef = 3D4FAC1B0E67990F005874A3 /* NSLogConsole.html */; }; + 3D68A5D10E81698500C2EC5B /* CocoaNavJS.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D68A5CF0E81698500C2EC5B /* CocoaNavJS.js */; }; + 3D68A6FC0E81779F00C2EC5B /* CocoaNavJS.html in Resources */ = {isa = PBXBuildFile; fileRef = 3D68A6FB0E81779F00C2EC5B /* CocoaNavJS.html */; }; + 3D68A85C0E81D61C00C2EC5B /* JSCocoaHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D68A85B0E81D61C00C2EC5B /* JSCocoaHelper.m */; }; + 3D68EA6310AF0AA900E0C357 /* jslint-jscocoa.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D68EA6210AF0AA900E0C357 /* jslint-jscocoa.js */; }; + 3D8858B90E70073F00166DAA /* CocoaNavJS.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D8858B80E70073F00166DAA /* CocoaNavJS.xib */; }; + 3D8858D50E70079200166DAA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D8858D40E70079200166DAA /* MainMenu.xib */; }; + 3D8915680EA8F35C00BE4E70 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D8915670EA8F35C00BE4E70 /* WebKit.framework */; }; + 3DAA879D0E3A0CA8000CDB2A /* ObjCRuntime.bridgesupport in Resources */ = {isa = PBXBuildFile; fileRef = 3DAA879C0E3A0CA8000CDB2A /* ObjCRuntime.bridgesupport */; }; + 3DDED3540E5A17B500324A7D /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DDED3530E5A17B500324A7D /* JavaScriptCore.framework */; }; + 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* JSCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa_Prefix.pch; sourceTree = ""; }; + 3D08D07B0E65CED100B81E63 /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = ""; }; + 3D08D0ED0E65D89500B81E63 /* ClassTree.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ClassTree.png; sourceTree = ""; }; + 3D0E37CF0ED8BE9400077F66 /* Tests */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Tests; path = ../Tests; sourceTree = SOURCE_ROOT; }; + 3D15F3B90FC01C0A009E31F4 /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3D15F3BA0FC01C0A009E31F4 /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3D15F3BB0FC01C0A009E31F4 /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3D15F3D20FC01C0A009E31F4 /* JSCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa.h; sourceTree = ""; }; + 3D15F3D70FC01C0A009E31F4 /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3D15F3D80FC01C0A009E31F4 /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3D15F3D90FC01C0A009E31F4 /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3D15F3DA0FC01C0A009E31F4 /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 3D15F3DB0FC01C0A009E31F4 /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3D15F3DC0FC01C0A009E31F4 /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3D15F3DD0FC01C0A009E31F4 /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLib.h; sourceTree = ""; }; + 3D15F3DE0FC01C0A009E31F4 /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaLib.m; sourceTree = ""; }; + 3D15F3DF0FC01C0A009E31F4 /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3D15F3E00FC01C0A009E31F4 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3D45274A0E7A1DA00044D504 /* JSCocoa.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = JSCocoa.icns; sourceTree = ""; }; + 3D4FAC150E6798FA005874A3 /* NSLogConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSLogConsole.m; sourceTree = ""; }; + 3D4FAC160E6798FA005874A3 /* NSLogConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSLogConsole.h; sourceTree = ""; }; + 3D4FAC1B0E67990F005874A3 /* NSLogConsole.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = NSLogConsole.html; sourceTree = ""; }; + 3D68A5CF0E81698500C2EC5B /* CocoaNavJS.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = CocoaNavJS.js; sourceTree = ""; }; + 3D68A6FB0E81779F00C2EC5B /* CocoaNavJS.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = CocoaNavJS.html; sourceTree = ""; }; + 3D68A85A0E81D61C00C2EC5B /* JSCocoaHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaHelper.h; sourceTree = ""; }; + 3D68A85B0E81D61C00C2EC5B /* JSCocoaHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaHelper.m; sourceTree = ""; }; + 3D68EA6210AF0AA900E0C357 /* jslint-jscocoa.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "jslint-jscocoa.js"; sourceTree = ""; }; + 3D8435220E61A0D200056D71 /* JSCocoa.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSCocoa.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 3D8858B80E70073F00166DAA /* CocoaNavJS.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CocoaNavJS.xib; sourceTree = ""; }; + 3D8858D40E70079200166DAA /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = ""; }; + 3D8915670EA8F35C00BE4E70 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = ""; }; + 3DAA879C0E3A0CA8000CDB2A /* ObjCRuntime.bridgesupport */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ObjCRuntime.bridgesupport; sourceTree = ""; }; + 3DB050AA0EE5AF030047773D /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = ""; }; + 3DDED3530E5A17B500324A7D /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 3DDED3540E5A17B500324A7D /* JavaScriptCore.framework in Frameworks */, + 3D8915680EA8F35C00BE4E70 /* WebKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 3D8435220E61A0D200056D71 /* JSCocoa.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3DB050AA0EE5AF030047773D /* main.js */, + 3D15F3B80FC01C0A009E31F4 /* JSCocoa */, + 3D4FAC140E6798FA005874A3 /* JSConsole */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = JSCocoa; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* JSCocoa_Prefix.pch */, + 3D68A85B0E81D61C00C2EC5B /* JSCocoaHelper.m */, + 3D68A85A0E81D61C00C2EC5B /* JSCocoaHelper.h */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 3D0E37CF0ED8BE9400077F66 /* Tests */, + 3D68A8480E81CFFE00C2EC5B /* JS */, + 3DAA879C0E3A0CA8000CDB2A /* ObjCRuntime.bridgesupport */, + 3D4FAC1B0E67990F005874A3 /* NSLogConsole.html */, + 8D1107310486CEB800E47090 /* Info.plist */, + 3D45274A0E7A1DA00044D504 /* JSCocoa.icns */, + 3D08D0ED0E65D89500B81E63 /* ClassTree.png */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3D8915670EA8F35C00BE4E70 /* WebKit.framework */, + 3DDED3530E5A17B500324A7D /* JavaScriptCore.framework */, + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3D15F3B80FC01C0A009E31F4 /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3D15F3B90FC01C0A009E31F4 /* BridgeSupportController.h */, + 3D15F3BA0FC01C0A009E31F4 /* BridgeSupportController.m */, + 3D15F3BB0FC01C0A009E31F4 /* class.js */, + 3D68EA6210AF0AA900E0C357 /* jslint-jscocoa.js */, + 3D15F3D20FC01C0A009E31F4 /* JSCocoa.h */, + 3D15F3D70FC01C0A009E31F4 /* JSCocoaController.h */, + 3D15F3D80FC01C0A009E31F4 /* JSCocoaController.m */, + 3D15F3D90FC01C0A009E31F4 /* JSCocoaFFIArgument.h */, + 3D15F3DA0FC01C0A009E31F4 /* JSCocoaFFIArgument.m */, + 3D15F3DB0FC01C0A009E31F4 /* JSCocoaFFIClosure.h */, + 3D15F3DC0FC01C0A009E31F4 /* JSCocoaFFIClosure.m */, + 3D15F3DD0FC01C0A009E31F4 /* JSCocoaLib.h */, + 3D15F3DE0FC01C0A009E31F4 /* JSCocoaLib.m */, + 3D15F3DF0FC01C0A009E31F4 /* JSCocoaPrivateObject.h */, + 3D15F3E00FC01C0A009E31F4 /* JSCocoaPrivateObject.m */, + ); + name = JSCocoa; + path = ../JSCocoa; + sourceTree = SOURCE_ROOT; + }; + 3D4FAC140E6798FA005874A3 /* JSConsole */ = { + isa = PBXGroup; + children = ( + 3D4FAC150E6798FA005874A3 /* NSLogConsole.m */, + 3D4FAC160E6798FA005874A3 /* NSLogConsole.h */, + ); + name = JSConsole; + sourceTree = ""; + }; + 3D68A8480E81CFFE00C2EC5B /* JS */ = { + isa = PBXGroup; + children = ( + 3D08D07B0E65CED100B81E63 /* main.js */, + 3D8858D40E70079200166DAA /* MainMenu.xib */, + 3D68A5CF0E81698500C2EC5B /* CocoaNavJS.js */, + 3D8858B80E70073F00166DAA /* CocoaNavJS.xib */, + 3D68A6FB0E81779F00C2EC5B /* CocoaNavJS.html */, + ); + name = JS; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* JSCocoa */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JSCocoa" */; + buildPhases = ( + 8D11072E0486CEB800E47090 /* Frameworks */, + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = JSCocoa; + productInstallPath = "$(HOME)/Applications"; + productName = JSCocoa; + productReference = 3D8435220E61A0D200056D71 /* JSCocoa.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JSCocoa" */; + compatibilityVersion = "Xcode 3.0"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* JSCocoa */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D1107260486CEB800E47090 /* JSCocoa */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3DAA879D0E3A0CA8000CDB2A /* ObjCRuntime.bridgesupport in Resources */, + 3D15F3E20FC01C0A009E31F4 /* class.js in Resources */, + 3D68EA6310AF0AA900E0C357 /* jslint-jscocoa.js in Resources */, + 3D08D07C0E65CED100B81E63 /* main.js in Resources */, + 3D08D0EE0E65D89500B81E63 /* ClassTree.png in Resources */, + 3D4FAC1C0E67990F005874A3 /* NSLogConsole.html in Resources */, + 3D8858B90E70073F00166DAA /* CocoaNavJS.xib in Resources */, + 3D8858D50E70079200166DAA /* MainMenu.xib in Resources */, + 3D45274B0E7A1DA00044D504 /* JSCocoa.icns in Resources */, + 3D68A5D10E81698500C2EC5B /* CocoaNavJS.js in Resources */, + 3D68A6FC0E81779F00C2EC5B /* CocoaNavJS.html in Resources */, + 3D0E37F60ED8BE9400077F66 /* Tests in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090 /* main.m in Sources */, + 3D4FAC170E6798FA005874A3 /* NSLogConsole.m in Sources */, + 3D68A85C0E81D61C00C2EC5B /* JSCocoaHelper.m in Sources */, + 3D15F3E10FC01C0A009E31F4 /* BridgeSupportController.m in Sources */, + 3D15F3ED0FC01C0A009E31F4 /* JSCocoaController.m in Sources */, + 3D15F3EE0FC01C0A009E31F4 /* JSCocoaFFIArgument.m in Sources */, + 3D15F3EF0FC01C0A009E31F4 /* JSCocoaFFIClosure.m in Sources */, + 3D15F3F00FC01C0A009E31F4 /* JSCocoaLib.m in Sources */, + 3D15F3F10FC01C0A009E31F4 /* JSCocoaPrivateObject.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../Documents/xcode projects/Xcode build data/Debug\"", + ); + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSCocoa_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = JSCocoa; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../Documents/xcode projects/Xcode build data/Debug\"", + ); + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSCocoa_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = JSCocoa; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JSCocoa" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JSCocoa" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/jscocoa/GUIConsole/JSCocoaHelper.h b/jscocoa/GUIConsole/JSCocoaHelper.h new file mode 100644 index 0000000..d5c2b22 --- /dev/null +++ b/jscocoa/GUIConsole/JSCocoaHelper.h @@ -0,0 +1,16 @@ +// +// JSCocoaHelper.h +// JSCocoa +// +// Created by Patrick Geiller on 18/09/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface JSCocoaHelper : NSObject { + +} + +@end diff --git a/jscocoa/GUIConsole/JSCocoaHelper.m b/jscocoa/GUIConsole/JSCocoaHelper.m new file mode 100644 index 0000000..470e1af --- /dev/null +++ b/jscocoa/GUIConsole/JSCocoaHelper.m @@ -0,0 +1,56 @@ +// +// JSCocoaHelper.m +// JSCocoa +// +// Created by Patrick Geiller on 18/09/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "JSCocoaHelper.h" + + +@implementation JSCocoaHelper + +/* + + List of registered classes + http://developer.apple.com/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html#//apple_ref/c/func/objc_getClassList + +*/ ++ (NSString*)classList +{ + id list = [NSMutableArray array]; + + int numClasses; + Class * classes = NULL; + + classes = NULL; + numClasses = objc_getClassList(NULL, 0); + + if (numClasses > 0 ) + { + classes = malloc(sizeof(Class) * numClasses); + numClasses = objc_getClassList(classes, numClasses); + + int i; + for (i=0; i +#endif + +#define NSLog(args...) NSLog(args), NSLogPostLog(__FILE__, __LINE__) diff --git a/jscocoa/GUIConsole/MainMenu.xib b/jscocoa/GUIConsole/MainMenu.xib new file mode 100644 index 0000000..d03c390 --- /dev/null +++ b/jscocoa/GUIConsole/MainMenu.xib @@ -0,0 +1,3748 @@ + + + + 1050 + 10C540 + 740 + 1038.25 + 458.00 + + YES + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + 740 + 740 + + + + YES + + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + NewApplication + + YES + + + About JSCocoa + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide JSCocoa + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit JSCocoa + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling… + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 1048576 + 2147483647 + + + submenuAction: + + Format + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Show Colors + C + 1179648 + 2147483647 + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + + + _NSMainMenu + + + 271 + 2 + {{120, 730}, {400, 400}} + 1677721600 + JSCocoa Console + NSWindow + + + 54027CA0-3B55-4423-838A-0FCA71DAD86D + + + YES + NO + NO + NO + 1 + 1 + + YES + + YES + 29D25C1D-3581-4616-8596-E9CF24583548 + 4288161F-93E4-426D-B05A-F6DDF48464E5 + 6529A34C-BFF9-4C1D-A4D3-10205FCE7E51 + 9AB608FB-D8E9-4571-8BAD-907A70294959 + A90634EA-06EC-455D-8A09-B784D8734B17 + B19E8A4C-87DC-42C0-B385-FC17EF2F267E + B389F0E5-89C7-4480-B72F-F8C96304FAAF + NSToolbarCustomizeToolbarItem + NSToolbarFlexibleSpaceItem + NSToolbarSeparatorItem + NSToolbarSpaceItem + + + YES + + + 29D25C1D-3581-4616-8596-E9CF24583548 + + Run Tests + Run Tests + + + + 268 + {{18, 14}, {25, 25}} + YES + + -2080244224 + 134217728 + T + + LucidaGrande + 13 + 1044 + + + -2038152961 + 163 + + + 400 + 75 + + + + + + {25, 25} + {25, 25} + YES + YES + 0 + YES + 0 + + + + 4288161F-93E4-426D-B05A-F6DDF48464E5 + + Class Tree + Class Tree + + + + NSImage + ClassTree + + + + {2.8026e-45, 0} + {2.8026e-45, 0} + YES + YES + -1 + YES + 0 + + + + 6529A34C-BFF9-4C1D-A4D3-10205FCE7E51 + + Clear + Clear Console + + + + 268 + {{28, 14}, {25, 25}} + YES + + -2080244224 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSStopProgressTemplate + + + + 400 + 75 + + + + + + {25, 25} + {25, 25} + YES + YES + 0 + YES + 0 + + + + 9AB608FB-D8E9-4571-8BAD-907A70294959 + + Collect + Garbage Collect + + + + 268 + {{34, 14}, {25, 25}} + YES + + -2080244224 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSRefreshFreestandingTemplate + + + + 400 + 75 + + + + + + {25, 25} + {25, 25} + YES + YES + 0 + YES + 0 + + + + A90634EA-06EC-455D-8A09-B784D8734B17 + + Source + Source + + + + NSImage + NSNetwork + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + + B19E8A4C-87DC-42C0-B385-FC17EF2F267E + + Samples + Samples + + + + NSImage + NSMultipleDocuments + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + + B389F0E5-89C7-4480-B72F-F8C96304FAAF + + Injector + Injector + + + + NSImage + NSAdvanced + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + NSToolbarCustomizeToolbarItem + Customize + Customize + Customize Toolbar + + + NSImage + NSToolbarCustomizeToolbarItemImage + + + runToolbarCustomizationPalette: + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + NSToolbarFlexibleSpaceItem + + Flexible Space + + + + + + {1, 5} + {20000, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + NSToolbarSeparatorItem + + Separator + + + + + + {12, 5} + {12, 1000} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + NSToolbarSpaceItem + + Space + + + + + + {32, 5} + {32, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + + + YES + + + + + + + + + + + + + + YES + + + + + + + + + YES + + + {1.79769e+308, 1.79769e+308} + {400, 200} + + + 256 + + YES + + + 289 + {{250, 4}, {118, 25}} + + YES + + -2080244224 + 134348800 + Run + + LucidaGrande + 11 + 3100 + + + -2038152961 + 163 + + DQ + 400 + 75 + + + + + 290 + {{7, 7}, {235, 19}} + + YES + + -1804468671 + 268567552 + 'Today is ' + NSDate.date + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + + {{0, 34}, {400, 366}} + + + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + + 289 + {{371, 5}, {25, 25}} + + YES + + 67239424 + 134479872 + + + LucidaGrande + 9 + 3614 + + + -2038415105 + 33 + + + 200 + 25 + + + + {400, 400} + + + {{0, 0}, {1920, 1178}} + {400, 276} + {1.79769e+308, 1.79769e+308} + JSCocoaConsole + + + ApplicationController + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + orderFrontColorPanel: + + + + 361 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + terminate: + + + + 369 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + delegate + + + + 376 + + + + clearConsole: + + + + 498 + + + + garbageCollect: + + + + 499 + + + + runTests: + + + + 506 + + + + openSamples: + + + + 507 + + + + openInjector: + + + + 508 + + + + openClassTree: + + + + 509 + + + + runScript: + + + + 523 + + + + initialFirstResponder + + + + 535 + + + + nextKeyView + + + + 536 + + + + nextKeyView + + + + 537 + + + + help: + + + + 538 + + + + webView + + + + 540 + + + + inputScript + + + + 541 + + + + performFind: + + + + 543 + + + + performFindNext: + + + + 544 + + + + performFindPrev: + + + + 545 + + + + openSourceHome: + + + + 547 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + 2 + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 299 + + + YES + + + + + + 300 + + + YES + + + + + + + 344 + + + + + 345 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + + 372 + + + YES + + + + + + + + + 375 + + + + + 411 + + + YES + + + + + + 412 + + + + + 421 + + + YES + + + + + + 422 + + + + + 427 + + + YES + + + + + + + + + + + + + + + + 430 + + + + + 432 + + + + + 433 + + + + + 434 + + + + + 437 + + + + + 439 + + + + + 436 + + + + + 494 + + + YES + + + + + + 492 + + + YES + + + + + + 493 + + + + + 495 + + + YES + + + + + + 496 + + + YES + + + + + + 497 + + + + + 505 + + + YES + + + + + + 503 + + + YES + + + + + + 504 + + + + + 521 + + + + + 525 + + + YES + + + + + + 526 + + + + + 546 + + + + + + + YES + + YES + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 299.IBPluginDependency + 300.IBPluginDependency + 300.editorWindowContentRectSynchronizationRect + 344.IBPluginDependency + 345.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBEditorWindowLastContentRect + 371.IBPluginDependency + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 371.windowTemplate.hasMinSize + 371.windowTemplate.minSize + 372.IBPluginDependency + 375.IBAttributePlaceholdersKey + 411.IBPluginDependency + 412.IBPluginDependency + 421.IBPluginDependency + 422.IBPluginDependency + 427.IBEditorWindowLastContentRect + 427.IBPluginDependency + 427.editorWindowContentRectSynchronizationRect + 434.IBPluginDependency + 436.IBPluginDependency + 437.IBPluginDependency + 439.IBPluginDependency + 492.IBPluginDependency + 493.IBPluginDependency + 494.IBPluginDependency + 495.IBPluginDependency + 496.IBPluginDependency + 497.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 503.IBPluginDependency + 504.IBPluginDependency + 505.IBPluginDependency + 521.CustomClassName + 521.IBPluginDependency + 525.IBPluginDependency + 526.IBPluginDependency + 546.IBPluginDependency + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{423, 972}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{186, 871}, {240, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{192, 735}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{426, 851}, {238, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{435, 715}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{0, 1114}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{231, 634}, {176, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{226, 661}, {400, 400}} + com.apple.InterfaceBuilder.CocoaPlugin + {{226, 661}, {400, 400}} + + {{510, 218}, {400, 400}} + + {400, 200} + com.apple.InterfaceBuilder.CocoaPlugin + + YES + + + YES + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{-108, 1091}, {616, 0}} + com.apple.InterfaceBuilder.CocoaPlugin + {{402, 391}, {616, 227}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + NSLogConsoleView + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{18, 795}, {192, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{150, 775}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + + YES + + + + + YES + + + YES + + + + 553 + + + + YES + + ApplicationController + + YES + + YES + clearConsole: + garbageCollect: + help: + openClassTree: + openInjector: + openSamples: + openSourceHome: + runScript: + runTests: + + + YES + id + id + id + id + id + id + id + id + id + + + + YES + + YES + inputScript + webView + + + YES + id + id + + + + IBUserSource + + + + + FirstResponder + NSObject + + YES + + YES + performFind: + performFindNext: + performFindPrev: + + + YES + id + id + id + + + + IBUserSource + + + + + NSLogConsoleView + WebView + + messageQueue + id + + + IBProjectSource + NSLogConsole.h + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaController.h + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaLib.h + + + + NSWindow + + + + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSBrowser + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSDocument + NSObject + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocument.h + + + + NSDocument + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentScripting.h + + + + NSDocumentController + NSObject + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentController.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMatrix + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSMatrix.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMovieView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMovieView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebEditingDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebFrameLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebJavaPlugIn.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPlugin.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPluginContainer.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPolicyDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebResourceLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebScriptObject.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebUIDelegate.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTableView + NSControl + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSToolbar + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbar.h + + + + NSToolbarItem + NSObject + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + WebView + NSView + + YES + + YES + goBack: + goForward: + makeTextLarger: + makeTextSmaller: + makeTextStandardSize: + reload: + reloadFromOrigin: + stopLoading: + takeStringURLFrom: + toggleContinuousSpellChecking: + toggleSmartInsertDelete: + + + YES + id + id + id + id + id + id + id + id + id + id + id + + + + IBFrameworkSource + WebKit.framework/Headers/WebView.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + JSCocoa.xcodeproj + 3 + + diff --git a/jscocoa/GUIConsole/NSLogConsole.h b/jscocoa/GUIConsole/NSLogConsole.h new file mode 100644 index 0000000..69a5ca3 --- /dev/null +++ b/jscocoa/GUIConsole/NSLogConsole.h @@ -0,0 +1,73 @@ +// +// NSLogConsole.h +// NSLogConsole +// +// Created by Patrick Geiller on 16/08/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import +#import + + +void NSLogProlog(char* file, int line); + +@class NSLogConsoleView; + +@interface NSLogConsole : NSObject { + + BOOL autoOpens; + + IBOutlet id window; + IBOutlet NSLogConsoleView* webView; + IBOutlet id searchField; + + int original_stderr; + NSString* logPath; + NSFileHandle* fileHandle; + + unsigned long long fileOffset; +} + + ++ (id)sharedConsole; + +- (void)open; +- (void)close; +- (BOOL)isOpen; +- (IBAction)clear:(id)sender; +- (IBAction)searchChanged:(id)sender; +- (id)webView; +- (void)logData:(NSData*)data file:(char*)file lineNumber:(int)line; +- (void)updateLogWithFile:(char*)file lineNumber:(int)line; + + + +@property BOOL autoOpens; + +@end + + +@interface NSWindow(Goodies) +- (void)setBottomCornerRounded:(BOOL)a; +@end + + + +@interface NSLogConsoleView : WebView { + + // A message might trigger console opening, BUT the WebView will take time to load and won't be able to display messages yet. + // Queue them - they will be unqueued when WebView has loaded. + id messageQueue; + + BOOL webViewLoaded; +} + +- (void)logString:(NSString*)string file:(char*)file lineNumber:(int)line; +- (void)clear; +- (void)search:(NSString*)string; + +- (BOOL)drawsBackground; + +@end + diff --git a/jscocoa/GUIConsole/NSLogConsole.html b/jscocoa/GUIConsole/NSLogConsole.html new file mode 100644 index 0000000..5544faa --- /dev/null +++ b/jscocoa/GUIConsole/NSLogConsole.html @@ -0,0 +1,449 @@ + + + + + + + + +
Nothing here yet !
sample commands
+
No results
+
+ + + + +
+ +
+
+ + + +
+
Current application
+
NSWorkspace.sharedWorkspace.activeApplication
+ +
Change current window title
+
NSApplication.sharedApplication.keyWindow.title = 'Hello from Javascript !'
+ +
Move window frame
+
var w = NSApplication.sharedApplication.keyWindow; w.frameOrigin = (NSMakePoint(w.frame.origin.x+10, w.frame.origin.y-10))
+ +
Grow window frame
+
var w = NSApplication.sharedApplication.keyWindow; w.set({frame:NSMakeRect(w.frame.origin.x, w.frame.origin.y, w.frame.size.width+10, w.frame.size.height+10), display:false})
+ +
New window
+ +
w = [NSWindow instanceWithContentRect:NSMakeRect(100, 100, 200, 605) styleMask:NSTitledWindowMask+NSClosableWindowMask backing:NSBackingStoreBuffered defer:false]; w.title='New window !'; w.orderFront(null)
+ +
Add buttons to last created window
+
for (var i=0;i!=15; i++) { var b = [NSButton instanceWithFrame:NSMakeRect(10, i*30+5, 100, 28)]; b.bezelStyle = i; w.contentView.addSubview(b); }
+
+ + + + + diff --git a/jscocoa/GUIConsole/NSLogConsole.m b/jscocoa/GUIConsole/NSLogConsole.m new file mode 100644 index 0000000..6778148 --- /dev/null +++ b/jscocoa/GUIConsole/NSLogConsole.m @@ -0,0 +1,385 @@ +// +// NSLogConsole.m +// NSLogConsole +// +// Created by Patrick Geiller on 16/08/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "NSLogConsole.h" +#import "JSCocoaController.h" + + +BOOL inited = NO; + + +void NSLogPostLog(char* file, int line) +{ + if (!inited) return; + [[NSLogConsole sharedConsole] updateLogWithFile:file lineNumber:line]; +} + + + +@implementation NSLogConsole + +@synthesize autoOpens; + + ++ (id)sharedConsole +{ + static id singleton = NULL; + @synchronized(self) + { + if (!singleton) + { + singleton = [self alloc]; + [singleton init]; + } + } + return singleton; +} + + +- (id)init +{ + id o = [super init]; + autoOpens = YES; + logPath = NULL; + inited = YES; + + // Save stderr + original_stderr = dup(STDERR_FILENO); + + logPath = [NSString stringWithFormat:@"%@%@.log.txt", NSTemporaryDirectory(), [[NSBundle mainBundle] bundleIdentifier]]; + [logPath retain]; + + // Create the file — NSFileHandle doesn't do it ! + [@"" writeToFile:logPath atomically:YES encoding:NSUTF8StringEncoding error:nil]; + fileHandle = [NSFileHandle fileHandleForWritingAtPath:logPath]; + if (!fileHandle) NSLog(@"Opening log at %@ failed", logPath); + + [fileHandle retain]; + int fd = [fileHandle fileDescriptor]; + + // Redirect stderr + int err = dup2(fd, STDERR_FILENO); + if (!err) NSLog(@"Couldn't redirect stderr"); + + fileOffset = 0; + + [fileHandle readInBackgroundAndNotify]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dataAvailable:) name:NSFileHandleReadCompletionNotification object: fileHandle]; + return o; +} + +// NSLog will generate an event posted in the next run loop run +- (void)dataAvailable:(NSNotification *)aNotification +{ + [[NSLogConsole sharedConsole] updateLogWithFile:"" lineNumber:0]; +} + + +- (void)dealloc +{ + [logPath release]; + [fileHandle release]; + [super dealloc]; +} + +- (void)open +{ +/* + if (!window) + { + if (![NSBundle loadNibNamed:@"NSLogConsole" owner:self]) + { + NSLog(@"NSLogConsole.nib not loaded"); + return; + } + if ([window respondsToSelector:@selector(setBottomCornerRounded:)]) + [window setBottomCornerRounded:NO]; + } + [window orderFront:self]; +*/ +} +- (void)close +{ + [window orderOut:self]; +} +- (BOOL)isOpen +{ + return [window isVisible]; +} + +- (IBAction)clear:(id)sender +{ + [webView clear]; +} +- (IBAction)searchChanged:(id)sender +{ + [webView search:[sender stringValue]]; +} + +- (void)setWebView:(id)view +{ + webView = view; + [webView retain]; +} + +- (id)webView +{ + return webView; +} + + +- (void)logData:(NSData*)data file:(char*)file lineNumber:(int)line +{ + id str = [[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding] autorelease]; + + // Get out now if we have no data to display + if ([data length] == 0) return; + + // Write back to original stderr + write(original_stderr, [data bytes], [data length]); + + // Clear search + [searchField setStringValue:@""]; + [webView search:@""]; + // Log string + [webView logString:str file:file lineNumber:line]; +} + +- (void)updateLogWithFile:(char*)file lineNumber:(int)line +{ + + +/* + + This method gives this warning + 2009-11-14 18:49:23.793 JSCocoa[6162:a0f] *** -[NSConcreteData initWithBytes:length:copy:freeWhenDone:bytesAreVM:]: absurd length: 18446744073709551615, maximum size: 9223372036854775808 bytes + + +*/ + +// if (![window isVisible] && autoOpens) [self open]; + // Open a new handle to read new data + id f = [NSFileHandle fileHandleForReadingAtPath:logPath]; + if (!f) NSLog(@"Opening log at %@ failed", logPath); +//printf("=====\n"); + // Get file length + [f seekToEndOfFile]; + unsigned long long length = [f offsetInFile]; +// printf("length= %llu\n", length); + + // Read data + [f seekToFileOffset:fileOffset]; + + + unsigned long long length2 = [f offsetInFile]; +// printf("length2= %llu\n", length2); + + NSData* data = [f readDataToEndOfFile]; + [self logData:data file:file lineNumber:line]; + + // We'll read from that offset next time + fileOffset = length; +//printf("+++++\n"); +} + + +@end + + + + + + + + + + + +@implementation NSLogConsoleView + + +- (void)dealloc +{ + [messageQueue release]; + [super dealloc]; +} + +- (BOOL)drawsBackground +{ + return NO; +} + +- (void)awakeFromNib +{ + messageQueue = [[NSMutableArray alloc] init]; + webViewLoaded = NO; + + // Frame load + [self setFrameLoadDelegate:self]; + + // Load html page + id path = [[NSBundle mainBundle] pathForResource:@"NSLogConsole" ofType:@"html"]; + [[self mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]]]; + + // Navigation notification + [self setPolicyDelegate:self]; +} + +// +// Javascript is available +// Register our custom javascript object in the hosted page +// +- (void)webView:(WebView *)view windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject +{ + [windowScriptObject setValue:self forKey:@"NSLogConsoleView"]; +} + +// +// WebView has finished loading +// +- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame +{ + webViewLoaded = YES; + + // Flush message queue + for (id o in messageQueue) + [self logString:[o valueForKey:@"string"] file:(char*)[[o valueForKey:@"file"] UTF8String] lineNumber:[[o valueForKey:@"line"] intValue]]; + [messageQueue release]; + [[self windowScriptObject] setValue:self forKey:@"myVar"]; +} + +// +// Notify WebView of new message +// +- (void)logString:(NSString*)string file:(char*)file lineNumber:(int)line +{ + // Queue message if WebView has not finished loading + if (!webViewLoaded) + { + id o = [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithString:string], @"string", + [NSString stringWithUTF8String:file], @"file", + [NSNumber numberWithInt:line], @"line", + nil]; + [messageQueue addObject:o]; + return; + } + [[self windowScriptObject] callWebScriptMethod:@"log" withArguments:[NSArray arrayWithObjects:string, + [NSString stringWithUTF8String:file], + [NSNumber numberWithInt:line], + nil]]; +} + + +// +// Open source file in XCode at correct line number +// +- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation + request:(NSURLRequest *)request + frame:(WebFrame *)frame + decisionListener:(id)listener +{ + // Get path, formed by AbsolutePathOnDisk(space)LineNumber + NSString* pathAndLineNumber = [[request URL] path]; + + // From end of string, skip to space before number + char* s = (char*)[pathAndLineNumber UTF8String]; + char* s2 = s+strlen(s)-1; + while (*s2 && *s2 != ' ' && s2 > s) s2--; + if (*s2 != ' ') return NSLog(@"Did not find line number in %@", pathAndLineNumber); + + // Patch a zero to recover path + *s2 = 0; + + // Get line number + int line; + BOOL foundLine = [[NSScanner scannerWithString:[NSString stringWithUTF8String:s2+1]] scanInt:&line]; + if (!foundLine) return NSLog(@"Did not parse line number in %@", pathAndLineNumber); + + // Get path + NSString* path = [NSString stringWithUTF8String:s]; +// NSLog(@"opening line %d of _%@_", line, path); + + // Open in XCode + id source = [NSString stringWithFormat:@"tell application \"Xcode\" \n\ + set doc to open \"%@\" \n\ + set selection to paragraph (%d) of contents of doc \n\ + end tell", path, line]; + id script = [[NSAppleScript alloc] initWithSource:source]; + [script executeAndReturnError:nil]; + [script release]; +} + + +- (void)clear +{ + [[self windowScriptObject] callWebScriptMethod:@"clear" withArguments:nil]; +} + +- (void)search:(NSString*)string +{ + [[self windowScriptObject] callWebScriptMethod:@"search" withArguments:[NSArray arrayWithObjects:string, nil]]; +} + + ++ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector +{ + return NO; +} + + + +// +// Hairy function below. WebView calls ApplicationController (written in JS) +// +- (void)evalJSCocoa:(NSString*)string +{ + id delegate = [[NSApplication sharedApplication] delegate]; + [[delegate inputScript] setStringValue:string]; + [delegate runScript:string]; +} + + +// +// Overlay Help +// +- (void)openHelp +{ + [[self windowScriptObject] callWebScriptMethod:@"openHelp" withArguments:nil]; +} +- (void)closeHelp +{ + [[self windowScriptObject] callWebScriptMethod:@"closeHelp" withArguments:nil]; +} +- (BOOL)isHelpOpen +{ + id result = [[self windowScriptObject] callWebScriptMethod:@"isHelpOpen" withArguments:nil]; + if (![result respondsToSelector:@selector(boolValue)]) return NO; + return [result boolValue]; +} + +// +// Command display +// +- (void)startCommand:(id)command +{ + [[self windowScriptObject] callWebScriptMethod:@"startCommand" withArguments:[NSArray arrayWithObjects:command, nil]]; +} +- (void)endCommand +{ + /*id result = */[[self windowScriptObject] callWebScriptMethod:@"endCommand" withArguments:nil]; +} + + +- (void)performFindPanelAction:(id)sender +{ + NSLog(@"performFindPanelAction"); +} + + +@end + diff --git a/jscocoa/GUIConsole/ObjCRuntime.bridgesupport b/jscocoa/GUIConsole/ObjCRuntime.bridgesupport new file mode 100644 index 0000000..a57610c --- /dev/null +++ b/jscocoa/GUIConsole/ObjCRuntime.bridgesupport @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jscocoa/GUIConsole/main.js b/jscocoa/GUIConsole/main.js new file mode 100644 index 0000000..9c2fbd3 --- /dev/null +++ b/jscocoa/GUIConsole/main.js @@ -0,0 +1,93 @@ + + + // + // Application controller, our app delegate + // + class ApplicationController < NSObject + { + IBAction runTests + { + JSCocoaController.log('Running tests …') + + var path = NSBundle.mainBundle.bundlePath + '/Contents/Resources/Tests' + var r = __jsc__.runTests(path) + if (r) log('All tests OK') + } + + IBAction garbageCollect + { + __jsc__.garbageCollect + JSCocoa.logInstanceStats + } + + IBOutlet webView + - (void)awakeFromNib + { + NSLogConsole.sharedConsole + NSLogConsole.sharedConsole.webView = this.webView + + this.webView.window.setBottomCornerRounded(false) +// this.perform({selector:'openClassTree:', withObject:null, afterDelay:0 }) +// this.perform({selector:'runTests:', withObject:null, afterDelay:0 }) + } + + // Running commands + IBOutlet inputScript + IBAction runScript + { + // Take input from our text box outlet + var script = this.inputScript.stringValue + // Check if our first param is the script to be evaluated + if (sender && sender.respondsToSelector('length')) script = sender + + var webView = NSLogConsole.sharedConsole.webView + webView.startCommand(script) + result = eval(String([__jsc__ expandJSMacros:script url:null])) +// result = __jsc__.evalJSString(String(script)) + log(String(result)) + webView.endCommand + } + IBAction clearConsole + { + NSLogConsole.sharedConsole.webView.clear + } + + // Toggle sample commands + IBAction help + { + var webView = NSLogConsole.sharedConsole.webView + if (!webView.isHelpOpen) webView.openHelp + else webView.closeHelp + } + + + + // CocoaNav + IBOutlet cocoaNavWindow + IBAction openClassTree + { + if (!this.cocoaNavWindow) + { + __jsc__.evalJSFile(NSBundle.mainBundle.pathForResource_ofType('CocoaNavJS', 'js')) + NSBundle.loadNibNamed_owner_('CocoaNavJS', this) + } + this.cocoaNavWindow.makeKeyAndOrderFront(this) + } + // Github source homepage + IBAction openSourceHome + { + NSWorkspace.sharedWorkspace.openURL(NSURL.URLWithString('http://github.com/parmanoir/jscocoa/tree/master/')) + } + + // Later : sample list + IBAction openSamples + { + log('SAMPLES') + } + + // Later : inject in apps, like F-Script + IBAction openInjector + { + log('INJECTOR') + } + } diff --git a/jscocoa/GUIConsole/main.m b/jscocoa/GUIConsole/main.m new file mode 100644 index 0000000..e75c3fb --- /dev/null +++ b/jscocoa/GUIConsole/main.m @@ -0,0 +1,30 @@ +// +// main.m +// JSCocoa +// +// Created by Patrick Geiller on 06/07/08. +// Copyright __MyCompanyName__ 2008. All rights reserved. +// + +#import +#import "JSCocoaController.h" + +int main(int argc, char *argv[]) +{ +/* +#ifdef __LP64__ + printf("__LP64__!\n"); +#endif +*/ + id pool = [[NSAutoreleasePool alloc] init]; + + id c = [JSCocoaController new]; + id mainJSFile = [NSString stringWithFormat:@"%@/Contents/Resources/main.js", [[NSBundle mainBundle] bundlePath]]; + [c evalJSFile:mainJSFile]; + + int r = NSApplicationMain(argc, (const char **) argv); + + [pool release]; + + return r; +} diff --git a/jscocoa/JSCocoa/BridgeSupportController.h b/jscocoa/JSCocoa/BridgeSupportController.h new file mode 100644 index 0000000..5dbab0f --- /dev/null +++ b/jscocoa/JSCocoa/BridgeSupportController.h @@ -0,0 +1,43 @@ +// +// BridgeSupportController.h +// JSCocoa +// +// Created by Patrick Geiller on 08/07/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if !TARGET_IPHONE_SIMULATOR && !TARGET_OS_IPHONE +#import +#endif + +@interface BridgeSupportController : NSObject { + + + NSMutableArray* paths; + NSMutableArray* xmlDocuments; + + NSMutableDictionary* hash; + NSMutableDictionary* variadicSelectors; + NSMutableDictionary* variadicFunctions; +} + ++ (id)sharedController; + +- (BOOL)loadBridgeSupport:(NSString*)path; +- (BOOL)isBridgeSupportLoaded:(NSString*)path; +- (NSUInteger)bridgeSupportIndexForString:(NSString*)string; + +- (NSMutableDictionary*)variadicSelectors; +- (NSMutableDictionary*)variadicFunctions; + +/* +- (NSString*)query:(NSString*)name withType:(NSString*)type; +- (NSString*)query:(NSString*)name withType:(NSString*)type inBridgeSupportFile:(NSString*)file; +*/ +- (NSString*)queryName:(NSString*)name; +- (NSString*)queryName:(NSString*)name type:(NSString*)type; + +- (NSArray*)keys; + + +@end diff --git a/jscocoa/JSCocoa/BridgeSupportController.m b/jscocoa/JSCocoa/BridgeSupportController.m new file mode 100644 index 0000000..82976be --- /dev/null +++ b/jscocoa/JSCocoa/BridgeSupportController.m @@ -0,0 +1,254 @@ +// +// BridgeSupportController.m +// JSCocoa +// +// Created by Patrick Geiller on 08/07/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "BridgeSupportController.h" + + +@implementation BridgeSupportController + + ++ (id)sharedController +{ + static id singleton; + @synchronized(self) + { + if (!singleton) + singleton = [[BridgeSupportController alloc] init]; + return singleton; + } + return singleton; +} + +- (id)init +{ + self = [super init]; + + paths = [[NSMutableArray alloc] init]; + xmlDocuments = [[NSMutableArray alloc] init]; + hash = [[NSMutableDictionary alloc] init]; + variadicSelectors = [[NSMutableDictionary alloc] init]; + variadicFunctions = [[NSMutableDictionary alloc] init]; + + return self; +} + +- (void)dealloc +{ + [variadicFunctions release]; + [variadicSelectors release]; + [hash release]; + [paths release]; + [xmlDocuments release]; + + [super dealloc]; +} + +// +// Load a bridgeSupport file into a hash as { name : xmlTagString } +// +- (BOOL)loadBridgeSupport:(NSString*)path +{ + NSError* error = nil; + /* + Adhoc parser + NSXMLDocument is too slow + loading xml document as string then querying on-demand is too slow + can't get CFXMLParserRef to work + don't wan't to delve into expat + -> ad hoc : load file, build a hash of { name : xmlTagString } + */ + NSString* xmlDocument = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; + if (error) return NSLog(@"loadBridgeSupport : %@", error), NO; + + char* c = (char*)[xmlDocument UTF8String]; +#ifdef __OBJC_GC__ + char* originalC = c; + [[NSGarbageCollector defaultCollector] disableCollectorForPointer:originalC]; +#endif + +// double t0 = CFAbsoluteTimeGetCurrent(); + // Start parsing + for (; *c; c++) + { + if (*c == '<') + { + char startTagChar = c[1]; + if (startTagChar == 0) return NO; + + // 'co' constant + // 'cl' class + // 'e' enum + // 'fu' function + // 'st' struct + if ((c[1] == 'c' && (c[2] == 'o' || c[2] == 'l')) || c[1] == 'e' || (c[1] == 'f' && c[2] == 'u') || (c[1] == 's' && c[2] == 't')) + { + // Extract name + char* tagStart = c; + for (; *c && *c != '\''; c++); + c++; + char* c0 = c; + for (; *c && *c != '\''; c++); + + id name = [[NSString alloc] initWithBytes:c0 length:c-c0 encoding:NSUTF8StringEncoding]; + + // Move to tag end + BOOL foundEndTag = NO; + BOOL foundOpenTag = NO; + c++; + for (; *c && !foundEndTag; c++) + { + if (*c == '<') foundOpenTag = YES; + else + if (*c == '/') + { + if (!foundOpenTag) + { + if(c[1] == '>') foundEndTag = YES, c++; + } + else + { + if (startTagChar == c[1]) + { + foundEndTag = YES; + // Skip to end of tag + for (; *c && *c != '>'; c++); + } + } + } + else + // Variadic parsing + if (c[0] == 'v' && c[1] == 'a' && c[2] == 'r') + { + if (strncmp(c, "variadic", 8) == 0) + { + // Skip back to tag start + c0 = c; + for (; *c0 != '<'; c0--); + + // Tag name starts with 'm' : variadic method + // + if (c0[1] == 'm') + { + c = c0; + id variadicMethodName = nil; + // Extract selector name + for (; *c != '>'; c++) + { + if (c[0] == ' ' && c[1] == 's' && c[2] == 'e' && c[3] == 'l') + { + for (; *c && *c != '\''; c++); + c++; + c0 = c; + for (; *c && *c != '\''; c++); + variadicMethodName = [[[NSString alloc] initWithBytes:c0 length:c-c0 encoding:NSUTF8StringEncoding] autorelease]; + } + } + [variadicSelectors setValue:@"true" forKey:variadicMethodName]; +// NSLog(@"SELECTOR %@", name); + } + else + // Variadic function + // + { + [variadicFunctions setValue:@"true" forKey:name]; +// NSLog(@"function %@", name); + } + } + } + } + + c0 = tagStart; + id value = [[NSString alloc] initWithBytes:c0 length:c-c0 encoding:NSUTF8StringEncoding]; + + [hash setValue:value forKey:name]; + [value release]; + [name release]; + } + } + } +// double t1 = CFAbsoluteTimeGetCurrent(); +// NSLog(@"BridgeSupport %@ parsed in %f", [[path lastPathComponent] stringByDeletingPathExtension], t1-t0); +#ifdef __OBJC_GC__ + [[NSGarbageCollector defaultCollector] enableCollectorForPointer:originalC]; +#endif + [paths addObject:path]; + [xmlDocuments addObject:xmlDocument]; + + return YES; +} + + +- (BOOL)isBridgeSupportLoaded:(NSString*)path +{ + NSUInteger idx = [self bridgeSupportIndexForString:path]; + return idx == NSNotFound ? NO : YES; +} + +// +// bridgeSupportIndexForString +// given 'AppKit', return index of '/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/BridgeSupport/AppKitFull.bridgesupport' +// +- (NSUInteger)bridgeSupportIndexForString:(NSString*)string +{ + NSUInteger i, l = [paths count]; + for (i=0; i + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleName + ${PRODUCT_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.inexdo.JSCocoa + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSPrincipalClass + + + diff --git a/jscocoa/JSCocoa/JSCocoa.h b/jscocoa/JSCocoa/JSCocoa.h new file mode 100644 index 0000000..42f6ee3 --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoa.h @@ -0,0 +1,11 @@ +// +// JSCocoa.h +// JSCocoa +// +// Created by Patrick Geiller on 16/12/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + + +#define JSCOCOA +#import "JSCocoaController.h" \ No newline at end of file diff --git a/jscocoa/JSCocoa/JSCocoa.xcodeproj/project.pbxproj b/jscocoa/JSCocoa/JSCocoa.xcodeproj/project.pbxproj new file mode 100644 index 0000000..4ba6661 --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoa.xcodeproj/project.pbxproj @@ -0,0 +1,369 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 3D7AD09410B084F500C1453A /* jslint-jscocoa.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D7AD09310B084F500C1453A /* jslint-jscocoa.js */; }; + 3D9D7F7A0EF81A0100D71763 /* BridgeSupportController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D9D7F700EF81A0100D71763 /* BridgeSupportController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3D9D7F7B0EF81A0100D71763 /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9D7F710EF81A0100D71763 /* BridgeSupportController.m */; }; + 3D9D7F7C0EF81A0100D71763 /* JSCocoaController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D9D7F720EF81A0100D71763 /* JSCocoaController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3D9D7F7D0EF81A0100D71763 /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9D7F730EF81A0100D71763 /* JSCocoaController.m */; }; + 3D9D7F7E0EF81A0100D71763 /* JSCocoaFFIArgument.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D9D7F740EF81A0100D71763 /* JSCocoaFFIArgument.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3D9D7F7F0EF81A0100D71763 /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9D7F750EF81A0100D71763 /* JSCocoaFFIArgument.m */; }; + 3D9D7F800EF81A0100D71763 /* JSCocoaFFIClosure.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D9D7F760EF81A0100D71763 /* JSCocoaFFIClosure.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3D9D7F810EF81A0100D71763 /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9D7F770EF81A0100D71763 /* JSCocoaFFIClosure.m */; }; + 3D9D7F820EF81A0100D71763 /* JSCocoaPrivateObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D9D7F780EF81A0100D71763 /* JSCocoaPrivateObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3D9D7F830EF81A0100D71763 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9D7F790EF81A0100D71763 /* JSCocoaPrivateObject.m */; }; + 3D9D7F890EF81A0900D71763 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D9D7F880EF81A0900D71763 /* class.js */; }; + 3D9D7F8E0EF81A3100D71763 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D9D7F8D0EF81A3100D71763 /* JavaScriptCore.framework */; }; + 3D9D7FBC0EF81CC600D71763 /* JSCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D9D7FBA0EF81CC600D71763 /* JSCocoa.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3DC8AA5B0EFE08F700FC1F31 /* JSCocoaLib.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DC8AA590EFE08F700FC1F31 /* JSCocoaLib.h */; }; + 3DC8AA5C0EFE08F700FC1F31 /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DC8AA5A0EFE08F700FC1F31 /* JSCocoaLib.m */; }; + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; + 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 32DBCF5E0370ADEE00C91783 /* JSCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa_Prefix.pch; sourceTree = ""; }; + 3D7AD09310B084F500C1453A /* jslint-jscocoa.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "jslint-jscocoa.js"; sourceTree = ""; }; + 3D9D7F700EF81A0100D71763 /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3D9D7F710EF81A0100D71763 /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3D9D7F720EF81A0100D71763 /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3D9D7F730EF81A0100D71763 /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3D9D7F740EF81A0100D71763 /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3D9D7F750EF81A0100D71763 /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 3D9D7F760EF81A0100D71763 /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3D9D7F770EF81A0100D71763 /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3D9D7F780EF81A0100D71763 /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3D9D7F790EF81A0100D71763 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3D9D7F880EF81A0900D71763 /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3D9D7F8D0EF81A3100D71763 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + 3D9D7FBA0EF81CC600D71763 /* JSCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa.h; sourceTree = ""; }; + 3DC8AA590EFE08F700FC1F31 /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLib.h; sourceTree = ""; }; + 3DC8AA5A0EFE08F700FC1F31 /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaLib.m; sourceTree = ""; }; + 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8DC2EF5B0486A6940098B216 /* JSCocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JSCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DC2EF560486A6940098B216 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, + 3D9D7F8E0EF81A3100D71763 /* JavaScriptCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 034768DFFF38A50411DB9C8B /* Products */ = { + isa = PBXGroup; + children = ( + 8DC2EF5B0486A6940098B216 /* JSCocoa.framework */, + ); + name = Products; + sourceTree = ""; + }; + 0867D691FE84028FC02AAC07 /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3D9D7FBA0EF81CC600D71763 /* JSCocoa.h */, + 08FB77AEFE84172EC02AAC07 /* Classes */, + 32C88DFF0371C24200C91783 /* Other Sources */, + 089C1665FE841158C02AAC07 /* Resources */, + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, + 034768DFFF38A50411DB9C8B /* Products */, + ); + name = JSCocoa; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 3D9D7F8D0EF81A3100D71763 /* JavaScriptCore.framework */, + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + 3D9D7F880EF81A0900D71763 /* class.js */, + 3D7AD09310B084F500C1453A /* jslint-jscocoa.js */, + 8DC2EF5A0486A6940098B216 /* Info.plist */, + 089C1666FE841158C02AAC07 /* InfoPlist.strings */, + ); + name = Resources; + sourceTree = ""; + }; + 08FB77AEFE84172EC02AAC07 /* Classes */ = { + isa = PBXGroup; + children = ( + 3D9D7F710EF81A0100D71763 /* BridgeSupportController.m */, + 3D9D7F700EF81A0100D71763 /* BridgeSupportController.h */, + 3D9D7F730EF81A0100D71763 /* JSCocoaController.m */, + 3D9D7F720EF81A0100D71763 /* JSCocoaController.h */, + 3D9D7F750EF81A0100D71763 /* JSCocoaFFIArgument.m */, + 3D9D7F740EF81A0100D71763 /* JSCocoaFFIArgument.h */, + 3D9D7F770EF81A0100D71763 /* JSCocoaFFIClosure.m */, + 3D9D7F760EF81A0100D71763 /* JSCocoaFFIClosure.h */, + 3D9D7F790EF81A0100D71763 /* JSCocoaPrivateObject.m */, + 3D9D7F780EF81A0100D71763 /* JSCocoaPrivateObject.h */, + 3DC8AA5A0EFE08F700FC1F31 /* JSCocoaLib.m */, + 3DC8AA590EFE08F700FC1F31 /* JSCocoaLib.h */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 0867D6A5FE840307C02AAC07 /* AppKit.framework */, + D2F7E79907B2D74100F64583 /* CoreData.framework */, + 0867D69BFE84028FC02AAC07 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 32C88DFF0371C24200C91783 /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32DBCF5E0370ADEE00C91783 /* JSCocoa_Prefix.pch */, + ); + name = "Other Sources"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 8DC2EF500486A6940098B216 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D9D7F7A0EF81A0100D71763 /* BridgeSupportController.h in Headers */, + 3D9D7F7C0EF81A0100D71763 /* JSCocoaController.h in Headers */, + 3D9D7F7E0EF81A0100D71763 /* JSCocoaFFIArgument.h in Headers */, + 3D9D7F800EF81A0100D71763 /* JSCocoaFFIClosure.h in Headers */, + 3D9D7F820EF81A0100D71763 /* JSCocoaPrivateObject.h in Headers */, + 3D9D7FBC0EF81CC600D71763 /* JSCocoa.h in Headers */, + 3DC8AA5B0EFE08F700FC1F31 /* JSCocoaLib.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 8DC2EF4F0486A6940098B216 /* JSCocoa */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "JSCocoa" */; + buildPhases = ( + 8DC2EF500486A6940098B216 /* Headers */, + 8DC2EF520486A6940098B216 /* Resources */, + 8DC2EF540486A6940098B216 /* Sources */, + 8DC2EF560486A6940098B216 /* Frameworks */, + 3D9D81610EF8A80600D71763 /* Copy to Library Frameworks (commented) */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = JSCocoa; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = JSCocoa; + productReference = 8DC2EF5B0486A6940098B216 /* JSCocoa.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0867D690FE84028FC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "JSCocoa" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 1; + mainGroup = 0867D691FE84028FC02AAC07 /* JSCocoa */; + productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DC2EF4F0486A6940098B216 /* JSCocoa */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8DC2EF520486A6940098B216 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D9D7F890EF81A0900D71763 /* class.js in Resources */, + 3D7AD09410B084F500C1453A /* jslint-jscocoa.js in Resources */, + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3D9D81610EF8A80600D71763 /* Copy to Library Frameworks (commented) */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy to Library Frameworks (commented)"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#if [ -d \"/Library/Frameworks/JSCocoa.framework\" ]; then\n# rm -R \"/Library/Frameworks/JSCocoa.framework\"\n#fi\n#cp -R \"${TARGET_BUILD_DIR}/JSCocoa.framework\" \"/Library/Frameworks\"\n\n\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DC2EF540486A6940098B216 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D9D7F7B0EF81A0100D71763 /* BridgeSupportController.m in Sources */, + 3D9D7F7D0EF81A0100D71763 /* JSCocoaController.m in Sources */, + 3D9D7F7F0EF81A0100D71763 /* JSCocoaFFIArgument.m in Sources */, + 3D9D7F810EF81A0100D71763 /* JSCocoaFFIClosure.m in Sources */, + 3D9D7F830EF81A0100D71763 /* JSCocoaPrivateObject.m in Sources */, + 3DC8AA5C0EFE08F700FC1F31 /* JSCocoaLib.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C1667FE841158C02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1DEB91AE08733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSCocoa_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + PRODUCT_NAME = JSCocoa; + WRAPPER_EXTENSION = framework; + }; + name = Debug; + }; + 1DEB91AF08733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSCocoa_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + PRODUCT_NAME = JSCocoa; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; + 1DEB91B208733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_GC = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = "@loader_path/../Frameworks"; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH)"; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; + }; + name = Debug; + }; + 1DEB91B308733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_GC = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INSTALL_PATH = "@loader_path/../Frameworks"; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "JSCocoa" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91AE08733DA50010E9CD /* Debug */, + 1DEB91AF08733DA50010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "JSCocoa" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91B208733DA50010E9CD /* Debug */, + 1DEB91B308733DA50010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0867D690FE84028FC02AAC07 /* Project object */; +} diff --git a/jscocoa/JSCocoa/JSCocoaController.h b/jscocoa/JSCocoa/JSCocoaController.h new file mode 100644 index 0000000..f1e5e86 --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoaController.h @@ -0,0 +1,331 @@ +// +// JSCocoa.h +// JSCocoa +// +// Created by Patrick Geiller on 09/07/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// +#if !TARGET_IPHONE_SIMULATOR && !TARGET_OS_IPHONE +#import +#import +#define MACOSX +#import +#endif +#import "BridgeSupportController.h" +#import "JSCocoaPrivateObject.h" +#import "JSCocoaFFIArgument.h" +#import "JSCocoaFFIClosure.h" + + +// JS value container, used by methods wanting a straight JSValue and not a converted JS->ObjC value. +struct JSValueRefAndContextRef +{ + JSValueRef value; + JSContextRef ctx; +}; +typedef struct JSValueRefAndContextRef JSValueRefAndContextRef; + +#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#import "iPhone/libffi/ffi.h" +#import "iPhone/BurksPool.h" +#endif + + +// +// JSCocoaController +// +@interface JSCocoaController : NSObject { + + JSGlobalContextRef ctx; + BOOL ownsContext; + id _delegate; + + // + // Safe dealloc + // - (void)dealloc cannot be overloaded as it is called during JS GC, which forbids new JS code execution. + // As the js dealloc method cannot be called, safe dealloc allows it to be executed during the next run loop cycle + // NOTE : upon destroying a JSCocoaController, safe dealloc is disabled + // + BOOL useSafeDealloc; + + // + // Split call + // Allows calling multi param ObjC messages with a jQuery-like syntax. + // + // obj.do({ this : 'hello', andThat : 'world' }) + // instead of + // obj.dothis_andThat_('hello', 'world') + // + BOOL useSplitCall; + + // JSLint : used for ObjJ syntax, class syntax, return if + BOOL useJSLint; + +} + +@property (assign) id delegate; +@property BOOL useSafeDealloc; +@property BOOL useSplitCall; +@property BOOL useJSLint; +@property BOOL useAutoCall; +@property BOOL callSelectorsMissingTrailingSemicolon; +@property BOOL canSetOnBoxedObjects; + + +- (id)init; +- (id)initWithGlobalContext:(JSGlobalContextRef)ctx; + ++ (id)sharedController; ++ (id)controllerFromContext:(JSContextRef)ctx; ++ (BOOL)hasSharedController; +- (JSGlobalContextRef)ctx; ++ (void)hazardReport; ++ (NSString*)runningArchitecture; ++ (void)updateCustomCallPaths; +- (void)accomodateWebKitInspector; + +// +// Evaluation +// +- (id)eval:(NSString*)script; +- (id)callFunction:(NSString*)name; +- (id)callFunction:(NSString*)name withArguments:(NSArray*)arguments; +- (BOOL)hasFunction:(NSString*)name; +- (BOOL)isSyntaxValid:(NSString*)script; + +- (BOOL)evalJSFile:(NSString*)path; +- (BOOL)evalJSFile:(NSString*)path toJSValueRef:(JSValueRef*)returnValue; +- (JSValueRef)evalJSString:(NSString*)script; +- (JSValueRef)evalJSString:(NSString*)script withScriptPath:(NSString*)path; +- (JSValueRef)callJSFunction:(JSValueRef)function withArguments:(NSArray*)arguments; +- (JSValueRef)callJSFunctionNamed:(NSString*)functionName withArguments:arguments, ... NS_REQUIRES_NIL_TERMINATION; +- (JSValueRef)callJSFunctionNamed:(NSString*)functionName withArgumentsArray:(NSArray*)arguments; +- (JSObjectRef)JSFunctionNamed:(NSString*)functionName; +- (BOOL)hasJSFunctionNamed:(NSString*)functionName; +- (NSString*)expandJSMacros:(NSString*)script path:(NSString*)path; +- (NSString*)expandJSMacros:(NSString*)script path:(NSString*)path errors:(NSMutableArray*)array; +- (BOOL)isSyntaxValid:(NSString*)script error:(NSString**)error; +- (BOOL)setObject:(id)object withName:(id)name; +- (BOOL)setObject:(id)object withName:(id)name attributes:(JSPropertyAttributes)attributes; +- (BOOL)removeObjectWithName:(id)name; +// Get ObjC and raw values from Javascript +- (id)unboxJSValueRef:(JSValueRef)jsValue; +- (BOOL)toBool:(JSValueRef)value; +- (double)toDouble:(JSValueRef)value; +- (int)toInt:(JSValueRef)value; +- (NSString*)toString:(JSValueRef)value; +// Wrapper for unboxJSValueRef +- (id)toObject:(JSValueRef)value; + + +// +// Framework +// +- (BOOL)loadFrameworkWithName:(NSString*)name; +- (BOOL)loadFrameworkWithName:(NSString*)frameworkName inPath:(NSString*)path; + +// +// Garbage collection +// ++ (void)garbageCollect; +- (void)garbageCollect; +- (void)unlinkAllReferences; ++ (void)upJSCocoaPrivateObjectCount; ++ (void)downJSCocoaPrivateObjectCount; ++ (int)JSCocoaPrivateObjectCount; + ++ (void)upJSValueProtectCount; ++ (void)downJSValueProtectCount; ++ (int)JSValueProtectCount; + ++ (void)logInstanceStats; +- (id)instanceStats; ++ (void)logBoxedObjects; + +// +// Class inspection (shortcuts to JSCocoaLib) +// ++ (id)rootclasses; ++ (id)classes; ++ (id)protocols; ++ (id)imageNames; ++ (id)methods; ++ (id)runtimeReport; ++ (id)explainMethodEncoding:(id)encoding; + +// +// Class handling +// ++ (BOOL)overloadInstanceMethod:(NSString*)methodName class:(Class)class jsFunction:(JSValueRefAndContextRef)valueAndContext; ++ (BOOL)overloadClassMethod:(NSString*)methodName class:(Class)class jsFunction:(JSValueRefAndContextRef)valueAndContext; + ++ (BOOL)addClassMethod:(NSString*)methodName class:(Class)class jsFunction:(JSValueRefAndContextRef)valueAndContext encoding:(char*)encoding; ++ (BOOL)addInstanceMethod:(NSString*)methodName class:(Class)class jsFunction:(JSValueRefAndContextRef)valueAndContext encoding:(char*)encoding; + +// Tests +- (int)runTests:(NSString*)path; +- (int)runTests:(NSString*)path withSelector:(SEL)sel; + +// +// Autorelease pool +// ++ (void)allocAutoreleasePool; ++ (void)deallocAutoreleasePool; + +// +// Global boxer : only one JSValueRef for multiple box requests of one pointer +// ++ (JSObjectRef)boxedJSObject:(id)o inContext:(JSContextRef)ctx; ++ (void)downBoxedJSObjectCount:(id)o; + + +// +// Various internals +// ++ (JSObjectRef)jsCocoaPrivateObjectInContext:(JSContextRef)ctx; ++ (NSMutableArray*)parseObjCMethodEncoding:(const char*)typeEncoding; ++ (NSMutableArray*)parseCFunctionEncoding:(NSString*)xml functionName:(NSString**)functionNamePlaceHolder; + ++ (void)ensureJSValueIsObjectAfterInstanceAutocall:(JSValueRef)value inContext:(JSContextRef)ctx; +- (NSString*)formatJSException:(JSValueRef)exception; +- (id)selectorForJSFunction:(JSObjectRef)function; + + +- (const char*)typeEncodingOfMethod:(NSString*)methodName class:(NSString*)className; ++ (const char*)typeEncodingOfMethod:(NSString*)methodName class:(NSString*)className; + + + +@end + + +// +// JSCocoa delegate methods +// + +// +// Error reporting +// +@interface NSObject (JSCocoaControllerDelegateMethods) +- (void) JSCocoa:(JSCocoaController*)controller hadError:(NSString*)error onLineNumber:(NSInteger)lineNumber atSourceURL:(id)url; +- (void) safeDealloc; + +// +// Getting +// +// Check if getting property is allowed +- (BOOL) JSCocoa:(JSCocoaController*)controller canGetProperty:(NSString*)propertyName ofObject:(id)object inContext:(JSContextRef)ctx exception:(JSValueRef*)exception; +// Custom handler for getting properties +// Return a custom JSValueRef to bypass JSCocoa +// Return NULL to let JSCocoa handle getProperty +// Return JSValueMakeNull() to return a Javascript null +- (JSValueRef) JSCocoa:(JSCocoaController*)controller getProperty:(NSString*)propertyName ofObject:(id)object inContext:(JSContextRef)ctx exception:(JSValueRef*)exception; + +// +// Setting +// +// Check if setting property is allowed +- (BOOL) JSCocoa:(JSCocoaController*)controller canSetProperty:(NSString*)propertyName ofObject:(id)object toValue:(JSValueRef)value inContext:(JSContextRef)ctx exception:(JSValueRef*)exception; +// Custom handler for setting properties +// Return YES to indicate you handled setting +// Return NO to let JSCocoa handle setProperty +- (BOOL) JSCocoa:(JSCocoaController*)controller setProperty:(NSString*)propertyName ofObject:(id)object toValue:(JSValueRef)value inContext:(JSContextRef)ctx exception:(JSValueRef*)exception; + +// +// Calling +// +// Check if calling a C function is allowed +- (BOOL) JSCocoa:(JSCocoaController*)controller canCallFunction:(NSString*)functionName argumentCount:(size_t)argumentCount arguments:(JSValueRef*)arguments inContext:(JSContextRef)ctx exception:(JSValueRef*)exception; +// Check if calling an ObjC method is allowed +- (BOOL) JSCocoa:(JSCocoaController*)controller canCallMethod:(NSString*)methodName ofObject:(id)object argumentCount:(size_t)argumentCount arguments:(JSValueRef*)arguments inContext:(JSContextRef)ctx exception:(JSValueRef*)exception; +// Custom handler for calling +// Return YES to indicate you handled calling +// Return NO to let JSCocoa handle calling +- (JSValueRef) JSCocoa:(JSCocoaController*)controller callMethod:(NSString*)methodName ofObject:(id)callee privateObject:(JSCocoaPrivateObject*)thisPrivateObject argumentCount:(size_t)argumentCount arguments:(JSValueRef*)arguments inContext:(JSContextRef)localCtx exception:(JSValueRef*)exception; + +// +// Getting global properties (classes, structures, C function names, enums via OSXObject_getProperty) +// +// Check if getting property is allowed +- (BOOL) JSCocoa:(JSCocoaController*)controller canGetGlobalProperty:(NSString*)propertyName inContext:(JSContextRef)ctx exception:(JSValueRef*)exception; +// Custom handler for getting properties +// Return a custom JSValueRef to bypass JSCocoa +// Return NULL to let JSCocoa handle getProperty +// Return JSValueMakeNull() to return a Javascript null +- (JSValueRef) JSCocoa:(JSCocoaController*)controller getGlobalProperty:(NSString*)propertyName inContext:(JSContextRef)ctx exception:(JSValueRef*)exception; + +// +// Returning values to Javascript +// +// Called before returning any value to Javascript : return a new value or the original one +//- (JSValueRef) JSCocoa:(JSCocoaController*)controller willReturnValue:(JSValueRef)value inContext:(JSContextRef)ctx exception:(JSValueRef*)exception; + +// +// Evaling +// +// Check if file can be loaded +- (BOOL)JSCocoa:(JSCocoaController*)controller canLoadJSFile:(NSString*)path; +// Check if script can be evaluated +- (BOOL)JSCocoa:(JSCocoaController*)controller canEvaluateScript:(NSString*)script; +// Called before evalJSString, used to modify script about to be evaluated +// Return a custom NSString (eg a macro expanded version of the source) +// Return NULL to let JSCocoa handle evaluation +- (NSString*)JSCocoa:(JSCocoaController*)controller willEvaluateScript:(NSString*)script; + +@end + + +// +// JSCocoa shorthand +// +@interface JSCocoa : JSCocoaController +@end + +// +// Boxed object cache : holds one JSObjectRef for each reference to a pointer to an ObjC object +// +@interface BoxedJSObject : NSObject { + JSObjectRef jsObject; +} +- (void)setJSObject:(JSObjectRef)o; +- (JSObjectRef)jsObject; + +@end + +// +// Helpers +// +id NSStringFromJSValue(JSValueRef value, JSContextRef ctx); +//void* malloc_autorelease(size_t size); + +// Convert values between contexts (eg user context and webkit page context) +JSValueRef valueToExternalContext(JSContextRef ctx, JSValueRef value, JSContextRef externalCtx); + +// valueOf() is called by Javascript on objects, eg someObject + ' someString' +JSValueRef valueOfCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception); + +// +// From PyObjC : when to call objc_msgSend_stret, for structure return +// Depending on structure size & architecture, structures are returned as function first argument (done transparently by ffi) or via registers +// + +#if defined(__ppc__) +# define SMALL_STRUCT_LIMIT 4 +#elif defined(__ppc64__) +# define SMALL_STRUCT_LIMIT 8 +#elif defined(__i386__) +# define SMALL_STRUCT_LIMIT 8 +#elif defined(__x86_64__) +# define SMALL_STRUCT_LIMIT 16 +#elif TARGET_OS_IPHONE +// TOCHECK +# define SMALL_STRUCT_LIMIT 4 +#else +# error "Unsupported MACOSX platform" +#endif + + +// Stored in boxedobjects to access a list of methods, properties, ... +#define RuntimeInformationPropertyName "info" + + diff --git a/jscocoa/JSCocoa/JSCocoaController.m b/jscocoa/JSCocoa/JSCocoaController.m new file mode 100644 index 0000000..6c32f14 --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoaController.m @@ -0,0 +1,4946 @@ +// +// JSCocoa.m +// JSCocoa +// +// Created by Patrick Geiller on 09/07/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + + +#import "JSCocoaController.h" +#import "JSCocoaLib.h" + +#pragma mark JS objects forward definitions + +// Global object +static JSValueRef OSXObject_getProperty(JSContextRef, JSObjectRef, JSStringRef, JSValueRef*); +static void OSXObject_getPropertyNames(JSContextRef, JSObjectRef, JSPropertyNameAccumulatorRef); + +// Private JS object callbacks +static void jsCocoaObject_initialize(JSContextRef, JSObjectRef); +static void jsCocoaObject_finalize(JSObjectRef); +static JSValueRef jsCocoaObject_callAsFunction(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef [], JSValueRef*); +//static bool jsCocoaObject_hasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); +static JSValueRef jsCocoaObject_getProperty(JSContextRef, JSObjectRef, JSStringRef, JSValueRef*); +static bool jsCocoaObject_setProperty(JSContextRef, JSObjectRef, JSStringRef, JSValueRef, JSValueRef*); +static bool jsCocoaObject_deleteProperty(JSContextRef, JSObjectRef, JSStringRef, JSValueRef*); +static void jsCocoaObject_getPropertyNames(JSContextRef, JSObjectRef, JSPropertyNameAccumulatorRef); +static JSObjectRef jsCocoaObject_callAsConstructor(JSContextRef, JSObjectRef, size_t, const JSValueRef [], JSValueRef*); +static JSValueRef jsCocoaObject_convertToType(JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception); +static bool jsCocoaObject_hasInstance(JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); + +static JSValueRef jsCocoaInfo_getProperty(JSContextRef, JSObjectRef, JSStringRef, JSValueRef*); +static void jsCocoaInfo_getPropertyNames(JSContextRef, JSObjectRef, JSPropertyNameAccumulatorRef); + +// Set on valueOf callback property of objects +#define JSCocoaInternalAttribute kJSPropertyAttributeDontEnum + +// These will be destroyed when the last JSCocoa instance dies +static JSClassRef OSXObjectClass = NULL; +static JSClassRef jsCocoaObjectClass = NULL; +static JSClassRef jsCocoaFunctionClass= NULL; +static JSClassRef jsCocoaInfoClass = NULL; +static JSClassRef hashObjectClass = NULL; + +// Convenience method to throw a Javascript exception +static void throwException(JSContextRef ctx, JSValueRef* exception, NSString* reason); + + +// iPhone specifics +#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +const JSClassDefinition kJSClassDefinitionEmpty = { 0, 0, + NULL, NULL, + NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; +#import "GDataDefines.h" +#import "GDataXMLNode.h" +#endif + +// Appended to swizzled method names +#define OriginalMethodPrefix @"original" + + + + + + + +// +// JSCocoaController +// +#pragma mark - +#pragma mark JSCocoaController + +@interface JSCocoaController (Private) +- (void) callDelegateForException:(JSValueRef)exception; +@end + +@implementation JSCocoaController + + + +@synthesize delegate=_delegate, useSafeDealloc, useSplitCall, useJSLint; + + // Given a jsFunction, retrieve its closure (jsFunction's pointer address is used as key) + static id closureHash; + // Given a jsFunction, retrieve its selector + static id jsFunctionSelectors; + // Given a jsFunction, retrieve which class it's attached to + static id jsFunctionClasses; + // Given a class, return the parent class implementing JSCocoaHolder method + static id jsClassParents; + // List of all ObjC classes written in Javascript + static id jsClasses; + + // Given a class + methodName, retrieve its jsFunction + static id jsFunctionHash; + + // Split call cache + static id splitCallCache; + + // Shared instance stats + static id sharedInstanceStats = nil; + + // Boxed objects + static id boxedObjects; + + + // Auto call zero arg methods : allow NSWorkspace.sharedWorkspace instead of NSWorkspace.sharedWorkspace() + static BOOL useAutoCall; + // Allow calling obj.method(...) instead of obj.method_(...) + static BOOL callSelectorsMissingTrailingSemicolon; + // Allows setting javascript values on boxed objects (which are collected after nulling all references to them) + static BOOL canSetOnBoxedObjects; + + // If true, all exceptions will be sent to NSLog, event if they're caught later on by some Javascript core + static BOOL logAllExceptions; + // Is speaking when throwing exceptions + static BOOL isSpeaking; + + // Controller count + static int controllerCount = 0; + + // Hash used to quickly check for variadic methods, Original, Super, toString, valueOf ... + NSMutableDictionary* customCallPaths; + BOOL customCallPathsCacheIsClean; + + // Javascript functions defined for ObjC classes are stored in this hash + // __globalJSFunctionRepository__[className][propertyName] + +// +// Init +// +- (id)initWithGlobalContext:(JSGlobalContextRef)_ctx +{ +// NSLog(@"JSCocoa : %x spawning with context %x", self, _ctx); + self = [super init]; + controllerCount++; + + @synchronized(self) + { + if (!sharedInstanceStats) + { + sharedInstanceStats = [NSMutableDictionary new]; + closureHash = [NSMutableDictionary new]; + jsFunctionSelectors = [NSMutableDictionary new]; + jsFunctionClasses = [NSMutableDictionary new]; + jsFunctionHash = [NSMutableDictionary new]; + splitCallCache = [NSMutableDictionary new]; + jsClassParents = [NSMutableDictionary new]; + boxedObjects = [NSMutableDictionary new]; + jsClasses = [NSMutableArray new]; + customCallPathsCacheIsClean = NO; + customCallPaths = nil; + + useAutoCall = YES; + callSelectorsMissingTrailingSemicolon = YES; + canSetOnBoxedObjects= NO; + isSpeaking = YES; + isSpeaking = NO; + logAllExceptions = NO; + } + } + + + // + // OSX object javascript definition + // + JSClassDefinition OSXObjectDefinition = kJSClassDefinitionEmpty; + OSXObjectDefinition.className = "OSX"; + OSXObjectDefinition.getProperty = OSXObject_getProperty; + OSXObjectDefinition.getPropertyNames = OSXObject_getPropertyNames; + if (!OSXObjectClass) + OSXObjectClass = JSClassCreate(&OSXObjectDefinition); + + // + // Private object, used for holding references to objects, classes, structs + // + JSClassDefinition jsCocoaObjectDefinition = kJSClassDefinitionEmpty; + jsCocoaObjectDefinition.className = "JSCocoa box"; + jsCocoaObjectDefinition.initialize = jsCocoaObject_initialize; + jsCocoaObjectDefinition.finalize = jsCocoaObject_finalize; +// jsCocoaObjectDefinition.hasProperty = jsCocoaObject_hasProperty; + jsCocoaObjectDefinition.getProperty = jsCocoaObject_getProperty; + jsCocoaObjectDefinition.setProperty = jsCocoaObject_setProperty; + jsCocoaObjectDefinition.deleteProperty = jsCocoaObject_deleteProperty; + jsCocoaObjectDefinition.getPropertyNames = jsCocoaObject_getPropertyNames; +// jsCocoaObjectDefinition.callAsFunction = jsCocoaObject_callAsFunction; + jsCocoaObjectDefinition.callAsConstructor = jsCocoaObject_callAsConstructor; +// jsCocoaObjectDefinition.hasInstance = jsCocoaObject_hasInstance; + jsCocoaObjectDefinition.convertToType = jsCocoaObject_convertToType; + + if (!jsCocoaObjectClass) + jsCocoaObjectClass = JSClassCreate(&jsCocoaObjectDefinition); + + // + // Second kind of private object, used to hold method and function names + // Separated from the object because "typeof NSDate.date" gave "function" instead of object, preventing enumeration in WebKit inspector + // + JSClassDefinition jsCocoaFunctionDefinition = kJSClassDefinitionEmpty; + jsCocoaFunctionDefinition.className = "JSCocoa box"; + jsCocoaFunctionDefinition.parentClass = jsCocoaObjectClass; + jsCocoaFunctionDefinition.callAsFunction = jsCocoaObject_callAsFunction; + + if (!jsCocoaFunctionClass) + jsCocoaFunctionClass = JSClassCreate(&jsCocoaFunctionDefinition); + + // + // Holds __info in objects + // + JSClassDefinition jsCocoaInfoDefinition = kJSClassDefinitionEmpty; + jsCocoaInfoDefinition.className = "Runtime info"; + jsCocoaInfoDefinition.getProperty = jsCocoaInfo_getProperty; + jsCocoaInfoDefinition.getPropertyNames = jsCocoaInfo_getPropertyNames; + + if (!jsCocoaInfoClass) + jsCocoaInfoClass = JSClassCreate(&jsCocoaInfoDefinition); + + // + // Private Hash of derived classes, storing js values + // + JSClassDefinition jsCocoaHashObjectDefinition = kJSClassDefinitionEmpty; + if (!hashObjectClass) + hashObjectClass = JSClassCreate(&jsCocoaHashObjectDefinition); + + // + // Start context + // + + // Starting from our own context + if (!_ctx) + { + ctx = JSGlobalContextCreate(OSXObjectClass); + } + // Starting from an existing context + else + { + ctx = _ctx; + //JSGlobalContextRetain(ctx); + JSObjectRef o = JSObjectMake(ctx, OSXObjectClass, NULL); + // Set a global var named 'OSX' which will fulfill the usual role of JSCocoa's global object + JSStringRef jsName = JSStringCreateWithUTF8CString("OSX"); + JSObjectSetProperty(ctx, JSContextGetGlobalObject(ctx), jsName, o, kJSPropertyAttributeDontDelete, NULL); + JSStringRelease(jsName); + + [self accomodateWebKitInspector]; + } + +#if !TARGET_IPHONE_SIMULATOR && !TARGET_OS_IPHONE + [self loadFrameworkWithName:@"AppKit"]; + [self loadFrameworkWithName:@"CoreFoundation"]; + [self loadFrameworkWithName:@"Foundation"]; + [self loadFrameworkWithName:@"CoreGraphics" inPath:@"/System/Library/Frameworks/ApplicationServices.framework/Frameworks"]; +#endif + +#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE + [BurksPool setJSFunctionHash:jsFunctionHash]; +#endif + + // Create a reference to ourselves, and make it read only, don't enum, don't delete + [self setObject:self withName:@"__jsc__" attributes:kJSPropertyAttributeReadOnly|kJSPropertyAttributeDontEnum|kJSPropertyAttributeDontDelete]; + + + // Load class kit + if (!_ctx) + { + useJSLint = NO; + id lintPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"jslint-jscocoa" ofType:@"js"]; + if ([[NSFileManager defaultManager] fileExistsAtPath:lintPath]) [self evalJSFile:lintPath]; + id classKitPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"class" ofType:@"js"]; + if ([[NSFileManager defaultManager] fileExistsAtPath:classKitPath]) [self evalJSFile:classKitPath]; + } + + // Add allKeys method to Javascript hash : { a : 1, b : 2, c : 3 }.allKeys() = ['a', 'b', 'c'] + + // Retrieve Javascript function from class.js + JSStringRef jsName = JSStringCreateWithUTF8CString("allKeysInHash"); + JSValueRef fn = JSObjectGetProperty(ctx, JSContextGetGlobalObject(ctx), jsName, NULL); + JSStringRelease(jsName); + + if (fn) + { + // Add it to Object.prototype with dont enum property + JSStringRef scriptJS = JSStringCreateWithUTF8CString("return Object.prototype"); + JSObjectRef fn2 = JSObjectMakeFunction(ctx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSValueRef jsValue = JSObjectCallAsFunction(ctx, fn2, NULL, 0, NULL, NULL); + JSObjectRef jsObject = JSValueToObject(ctx, jsValue, NULL); + JSStringRelease(scriptJS); + + jsName = JSStringCreateWithUTF8CString("allKeys"); + JSObjectSetProperty(ctx, jsObject, jsName, fn, kJSPropertyAttributeDontEnum, NULL); + JSStringRelease(jsName); + } + + // Objects can use their own dealloc, normally used up by JSCocoa + // JSCocoa registers 'safeDealloc' in place of 'dealloc' and calls it in the next run loop cycle. + // (If called during dealloc, this would mean executing JS code during JS GC, which is not possible) + // useSafeDealloc will be turned to NO upon JSCocoaController dealloc + useSafeDealloc = YES; + // Yep ! + useJSLint = YES; + // ObjJ syntax renders split call moot + useSplitCall = NO; + ownsContext = NO; + + [JSCocoa updateCustomCallPaths]; + + return self; +} + +- (id)init +{ + id o = [self initWithGlobalContext:nil]; + ownsContext = YES; + return o; +} + + +// +// Dealloc +// +- (void)cleanUp +{ +// NSLog(@"JSCocoa : %x dying", self); + [self setUseSafeDealloc:NO]; + [self unlinkAllReferences]; + JSGarbageCollect(ctx); + + controllerCount--; + if (controllerCount == 0) + { + if (OSXObjectClass) { + JSClassRelease(OSXObjectClass); + OSXObjectClass = nil; + } + + if (jsCocoaObjectClass) { + JSClassRelease(jsCocoaObjectClass); + jsCocoaObjectClass = nil; + } + if (jsCocoaFunctionClass) { + JSClassRelease(jsCocoaFunctionClass); + jsCocoaFunctionClass = nil; + } + if (jsCocoaInfoClass) { + JSClassRelease(jsCocoaInfoClass); + jsCocoaInfoClass = nil; + } + + if (hashObjectClass) { + JSClassRelease(hashObjectClass); + hashObjectClass = nil; + } + + // We need to nil these all out, since they are static + // and if we make another JSCocoaController after this- they will + // still be around and that's kinda bad (like crashing bad). + [sharedInstanceStats release]; + sharedInstanceStats = nil; + [closureHash release]; + closureHash = nil; + [jsFunctionSelectors release]; + jsFunctionSelectors = nil; + [jsFunctionClasses release]; + jsFunctionClasses = nil; + [jsFunctionHash release]; + jsFunctionHash = nil; + [splitCallCache release]; + splitCallCache = nil; + [jsClassParents release]; + jsClassParents = nil; + [boxedObjects release]; + boxedObjects = nil; + [customCallPaths release]; + customCallPaths = nil; + + + // Remove classes : go backwards to remove child classes first + NSInteger c = [jsClasses count]-1; + while (c >= 0) + { + id class = [[jsClasses objectAtIndex:c] pointerValue]; + objc_disposeClassPair(class); + c--; + } + + [jsClasses release]; + jsClasses = nil; + } + + + if (ownsContext) JSGlobalContextRelease(ctx); +} + +- (oneway void)release +{ + // Each controller adds itself to its Javascript context, therefore retain count will be two when user last calls release. + // We check for this and clean up references then call GC, which will lower retain count to 1. + // Use 'useSafeDealloc' to make sure we're not reentering this one-time code block when GC calls release. + if ([self retainCount] == 2 && useSafeDealloc) + { + [self setUseSafeDealloc:NO]; + [self unlinkAllReferences]; + // This will take retain count from 2 to 1, readying this instance for deallocation + [self garbageCollect]; + } + [super release]; +} + +- (void)dealloc +{ + [self cleanUp]; + [super dealloc]; +} +- (void)finalize +{ + [self cleanUp]; + [super finalize]; +} + + +// +// Shared instance +// +static id JSCocoaSingleton = NULL; + ++ (id)sharedController +{ + @synchronized(self) + { + if (!JSCocoaSingleton) + { + // 1. alloc + // 2. store pointer + // 3. call init + // + // Why ? if init is calling sharedController, the pointer won't have been set and it will call itself over and over again. + // + JSCocoaSingleton = [self alloc]; +// NSLog(@"JSCocoa : allocating shared instance %x", JSCocoaSingleton); + [JSCocoaSingleton init]; + } + } + return JSCocoaSingleton; +} ++ (BOOL)hasSharedController +{ + return !!JSCocoaSingleton; +} + +// Retrieves the __jsc__ variable from a context and unbox it ++ (id)controllerFromContext:(JSContextRef)ctx +{ + JSStringRef jsName = JSStringCreateWithUTF8CString("__jsc__"); + JSValueRef jsValue = JSObjectGetProperty(ctx, JSContextGetGlobalObject(ctx), jsName, NULL); + JSStringRelease(jsName); + id jsc = nil; + [JSCocoaFFIArgument unboxJSValueRef:jsValue toObject:&jsc inContext:ctx]; + // Commented as it falsely reports failure when controller is cleaning up while being deallocated +// if (!jsc) NSLog(@"controllerFromContext couldn't find found the JSCocoaController in ctx %x", ctx); + return jsc; +} + +// Report if we're running a nightly JavascriptCore, with GC ++ (void)hazardReport +{ + Dl_info info; + // Get info about a JavascriptCore symbol + dladdr(dlsym(RTLD_DEFAULT, "JSClassCreate"), &info); + + BOOL runningFromSystemLibrary = [[NSString stringWithUTF8String:info.dli_fname] hasPrefix:@"/System"]; + if (!runningFromSystemLibrary) NSLog(@"***Running a nightly JavascriptCore***"); +#if !TARGET_OS_IPHONE + if ([NSGarbageCollector defaultCollector]) NSLog(@"***Running with ObjC Garbage Collection***"); +#endif +} +// Report what we're running on ++ (NSString*)runningArchitecture +{ +#if defined(__ppc__) + return @"PPC"; +// Unsupported +//#elif defined(__ppc64__) +// return @"PPC64"; +#elif defined(__i386__) + return @"i386"; +#elif defined(__x86_64__) + return @"x86_64"; +#elif TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR + return @"iPhone"; +#elif TARGET_OS_IPHONE && TARGET_IPHONE_SIMULATOR + return @"iPhone Simulator"; +#else + return @"unknown architecture"; +#endif +} + +// Replace the toString function with our own +- (void)accomodateWebKitInspector +{ + // The inspector uses Object's toString to extract the class name and print it, + // we replace that class name with valueOf when called for JSCocoa boxes + char* script = "\ + var _old_toString = Object.prototype.toString \n\ + Object.prototype.toString = function () \n\ + { \n\ + var str = _old_toString.call(this) \n\ + if (!str.match(/JSCocoa/)) \n\ + return str \n\ + return '[Object ' + (this.valueOf()) + ']' \n\ + } \n\ + "; + JSStringRef scriptJS = JSStringCreateWithCFString((CFStringRef)[NSString stringWithUTF8String:script]); + JSEvaluateScript(ctx, scriptJS, NULL, NULL, 1, NULL); + JSStringRelease(scriptJS); +} + + +#pragma mark Script evaluation + +// +// Quick eval of strings and functions returning ObjC objects +// +- (id)eval:(NSString*)script { return [self toObject:[self evalJSString:script]]; } +- (id)callFunction:(NSString*)name { return [self toObject:[self callJSFunctionNamed:name withArgumentsArray:nil]]; } +- (id)callFunction:(NSString*)name withArguments:(NSArray*)arguments { return [self toObject:[self callJSFunctionNamed:name withArgumentsArray:arguments]]; } +- (BOOL)hasFunction:(NSString*)name { return [self hasJSFunctionNamed:name]; } + +- (BOOL)isSyntaxValid:(NSString*)script { return [self isSyntaxValid:script error:nil]; } + + +// +// Eval of strings, functions, files, returning JavascriptCore objects +// +#pragma mark Script evaluation returning JavascriptCore objects + +// +// Evaluate a file +// +- (BOOL)evalJSFile:(NSString*)path toJSValueRef:(JSValueRef*)returnValue +{ + NSError* error; + id script = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; + // Skip .DS_Store and directories + if (script == nil) return NSLog(@"evalJSFile could not open %@ (%@) — Check file encoding (should be UTF8) and file build phase (should be in \"Copy Bundle Resources\")", path, error), NO; + + // + // Delegate canLoadJSFile + // + if (_delegate && [_delegate respondsToSelector:@selector(JSCocoa:canLoadJSFile:)] && ![_delegate JSCocoa:self canLoadJSFile:path]) return NO; + + // Expand macros + script = [self expandJSMacros:script path:path]; + + // + // Delegate canEvaluateScript, willEvaluateScript + // + if (_delegate) + { + if ([_delegate respondsToSelector:@selector(JSCocoa:canEvaluateScript:)] && ![_delegate JSCocoa:self canEvaluateScript:script]) return NO; + if ([_delegate respondsToSelector:@selector(JSCocoa:willEvaluateScript:)]) script = [_delegate JSCocoa:self willEvaluateScript:script]; + } + + if (!customCallPathsCacheIsClean) [JSCocoa updateCustomCallPaths]; + + // Convert script and script URL to js strings + // JSStringRef scriptJS = JSStringCreateWithUTF8CString([script UTF8String]); + // Using CreateWithUTF8 yields wrong results on PPC + JSStringRef scriptJS = JSStringCreateWithCFString((CFStringRef)script); + JSStringRef scriptPath = JSStringCreateWithUTF8CString([path UTF8String]); + + // Eval ! + JSValueRef exception = NULL; + JSValueRef result = JSEvaluateScript(ctx, scriptJS, NULL, scriptPath, 1, &exception); + if (returnValue) *returnValue = result; + // Release + JSStringRelease(scriptPath); + JSStringRelease(scriptJS); + if (exception) + { +// NSLog(@"JSException - %@", [self formatJSException:exception]); + [self callDelegateForException:exception]; + return NO; + } + return YES; +} + + +// +// Evaluate a file, without caring about return result +// +- (BOOL)evalJSFile:(NSString*)path +{ + return [self evalJSFile:path toJSValueRef:nil]; +} + +// +// Evaluate a string +// +- (JSValueRef)evalJSString:(NSString*)script withScriptPath:(NSString*)path +{ + if (!script) return NULL; + + // Expand macros + id expandedScript = [self expandJSMacros:script path:path]; + if (expandedScript) + script = expandedScript; + + // + // Delegate canEvaluateScript, willEvaluateScript + // + if (_delegate) + { + if ([_delegate respondsToSelector:@selector(JSCocoa:canEvaluateScript:)] && ![_delegate JSCocoa:self canEvaluateScript:script]) return NULL; + if ([_delegate respondsToSelector:@selector(JSCocoa:willEvaluateScript:)]) script = [_delegate JSCocoa:self willEvaluateScript:script]; + } + + if (!script) + return NSLog(@"evalJSString has nothing to eval"), NULL; + + if (!customCallPathsCacheIsClean) [JSCocoa updateCustomCallPaths]; + + JSStringRef scriptJS = JSStringCreateWithCFString((CFStringRef)script); + JSValueRef exception = NULL; + JSStringRef scriptPath = path ? JSStringCreateWithUTF8CString([path UTF8String]) : NULL; + JSValueRef result = JSEvaluateScript(ctx, scriptJS, NULL, scriptPath, 1, &exception); + JSStringRelease(scriptJS); + if (path) JSStringRelease(scriptPath); + + if (exception) + { + [self callDelegateForException:exception]; + return NULL; + } + + return result; +} + +// Evaluate a string, no script path +- (JSValueRef)evalJSString:(NSString*)script +{ + return [self evalJSString:script withScriptPath:nil]; +} + + + +// +// Call a Javascript function by function reference (JSValueRef) +// +- (JSValueRef)callJSFunction:(JSValueRef)function withArguments:(NSArray*)arguments +{ + JSObjectRef jsFunction = JSValueToObject(ctx, function, NULL); + // Return if function is not of function type + if (!jsFunction) return NSLog(@"callJSFunction : value is not a function"), NULL; + + // Convert arguments + JSValueRef* jsArguments = NULL; + NSUInteger argumentCount = [arguments count]; + if (argumentCount) + { + jsArguments = malloc(sizeof(JSValueRef)*argumentCount); + for (int i=0; i= '0' && *argsParser <= '9') continue; + else + // Skip ObjC 'const', 'oneway' markers + if (*argsParser == 'r' || *argsParser == 'V') continue; + else + if (*argsParser == '{') + { + // Parse structure encoding + NSInteger count = 0; + [JSCocoaFFIArgument typeEncodingsFromStructureTypeEncoding:[NSString stringWithUTF8String:argsParser] parsedCount:&count]; + + id encoding = [[NSString alloc] initWithBytes:argsParser length:count encoding:NSUTF8StringEncoding]; + id argumentEncoding = [[JSCocoaFFIArgument alloc] init]; + // Set return value + if ([argumentEncodings count] == 0) [argumentEncoding setIsReturnValue:YES]; + [argumentEncoding setStructureTypeEncoding:encoding]; + [argumentEncodings addObject:argumentEncoding]; + [argumentEncoding release]; + + [encoding release]; + argsParser += count-1; + } + else + { + // Custom handling for pointers as they're not one char long. +// char type = *argsParser; + char* typeStart = argsParser; + if (*argsParser == '^') + while (*argsParser && !(*argsParser >= '0' && *argsParser <= '9')) argsParser++; + + id argumentEncoding = [[JSCocoaFFIArgument alloc] init]; + // Set return value + if ([argumentEncodings count] == 0) [argumentEncoding setIsReturnValue:YES]; + + // If pointer, copy pointer type (^i, ^{NSRect}) to the argumentEncoding + if (*typeStart == '^') + { + id encoding = [[NSString alloc] initWithBytes:typeStart length:argsParser-typeStart encoding:NSUTF8StringEncoding]; + [argumentEncoding setPointerTypeEncoding:encoding]; + [encoding release]; + } + else + { + BOOL didSet = [argumentEncoding setTypeEncoding:*typeStart]; + if (!didSet) + { + [argumentEncoding release]; + return nil; + } + // Blocks are '@?', skip '?' + if (typeStart[0] == _C_ID && typeStart[1] == _C_UNDEF) + argsParser++; + } + + [argumentEncodings addObject:argumentEncoding]; + [argumentEncoding release]; + } + if (!*argsParser) break; + } + return argumentEncodings; +} + +// +// This is parsed from BridgeSupport's xml +// ++ (NSMutableArray*)parseCFunctionEncoding:(NSString*)xml functionName:(NSString**)functionNamePlaceHolder +{ + id argumentEncodings = [NSMutableArray array]; + id xmlDocument = [[NSXMLDocument alloc] initWithXMLString:xml options:0 error:nil]; + [xmlDocument autorelease]; + + id rootElement = [xmlDocument rootElement]; + *functionNamePlaceHolder = [[rootElement attributeForName:@"name"] stringValue]; + + // Parse children and return value + NSUInteger i, numChildren = [rootElement childCount]; + id returnValue = NULL; + for (i=0; i introduced because under GC, NSData gets collected early. + +*/ ++ (BOOL)trySplitCall:(id*)_methodName class:(Class)class argumentCount:(size_t*)_argumentCount arguments:(JSValueRef**)_arguments ctx:(JSContextRef)c +{ + id methodName = *_methodName; + size_t argumentCount = *_argumentCount; + JSValueRef* arguments = *_arguments; + if (argumentCount != 1) return NO; + + // Get property array + JSObjectRef o = JSValueToObject(c, arguments[0], NULL); + if (!o) return NO; + JSPropertyNameArrayRef jsNames = JSObjectCopyPropertyNames(c, o); + + // Convert js names to NSString names : { jsName1 : value1, jsName2 : value 2 } -> NSArray[name1, name2] + id names = [NSMutableArray array]; + size_t i, nameCount = JSPropertyNameArrayGetCount(jsNames); + // Length of target selector = length of method + length of each (argument + ':') + NSUInteger targetSelectorLength = [methodName length]; + // Actual arguments + JSValueRef* actualArguments = malloc(sizeof(JSValueRef)*nameCount); + for (i=0; i>>evaling %@", filePath); +// BOOL evaled = [self evalJSFile:filePath]; + + id evaled = nil; + @try + { + evaled = [self performSelector:sel withObject:filePath]; +// NSLog(@">>>EVALED %d, %@", evaled, filePath); + } + @catch (id e) + { + NSLog(@"(Test exception from %@) %@", file, e); + evaled = nil; + } + if (!evaled) + { + id error = [NSString stringWithFormat:@"test %@ failed (Ran %d out of %d tests)", file, count+1, [files count]]; + [JSCocoaController logAndSay:error]; + return NO; + } + count ++; + [self garbageCollect]; + } +#endif + return count; +} +- (int)runTests:(NSString*)path +{ + return [self runTests:path withSelector:@selector(evalJSFile:)]; +} + +#pragma mark Autorelease pool +static id autoreleasePool; ++ (void)allocAutoreleasePool +{ + autoreleasePool = [[NSAutoreleasePool alloc] init]; +} + ++ (void)deallocAutoreleasePool +{ + [autoreleasePool release]; +} + + +#pragma mark Garbage Collection +// +// Collect on top of the run loop, not in some JS function +// ++ (void)garbageCollect { NSLog(@"***Call garbageCollect on an instance***"); JSGarbageCollect(NULL); } +- (void)garbageCollect { JSGarbageCollect(ctx); } + +// +// Make all root Javascript variables point to null +// +- (void)unlinkAllReferences +{ + // Null and delete every reference to every live object +// [self evalJSString:@"for (var i in this) { log('DELETE ' + i); this[i] = null; delete this[i]; }"]; + [self evalJSString:@"for (var i in this) { this[i] = null; delete this[i]; }"]; + // Everything is now collectable ! +} + +// +// Custom dealloc code for objects will be executed here +// +- (void)safeDeallocInstance:(id)sender +{ + // This code might re-box the instance ... + [sender safeDealloc]; + // So, clean it up + [boxedObjects removeObjectForKey:[NSString stringWithFormat:@"%x", sender]]; + // sender is retained by performSelector, object will be destroyed upon function exit +} + +#pragma mark Garbage Collection debug + +// Boxing object, set as a Javascript object's private data +static int JSCocoaPrivateObjectCount = 0; ++ (void)upJSCocoaPrivateObjectCount { JSCocoaPrivateObjectCount++; } ++ (void)downJSCocoaPrivateObjectCount { JSCocoaPrivateObjectCount--; } ++ (int)JSCocoaPrivateObjectCount { return JSCocoaPrivateObjectCount; } + +// Javascript hash, set on classes created with JSCocoaController.createClass +// - used to store js values on instances ( someClassDerivedInJS['someValue'] = 'hello !' ) +static int JSCocoaHashCount = 0; ++ (void)upJSCocoaHashCount { JSCocoaHashCount++; } ++ (void)downJSCocoaHashCount { JSCocoaHashCount--; } ++ (int)JSCocoaHashCount { return JSCocoaHashCount; } + + +// Value protect +static int JSValueProtectCount = 0; ++ (void)upJSValueProtectCount { JSValueProtectCount++; } ++ (void)downJSValueProtectCount { JSValueProtectCount--; } ++ (int)JSValueProtectCount { return JSValueProtectCount; } + +// Instance count +int fullInstanceCount = 0; +int liveInstanceCount = 0; ++ (void)upInstanceCount:(id)o +{ + fullInstanceCount++; + liveInstanceCount++; + + id key = [NSMutableString stringWithFormat:@"%@", [o class]]; + + id existingCount = [sharedInstanceStats objectForKey:key]; + int count = 0; + if (existingCount) count = [existingCount intValue]; + + count++; + [sharedInstanceStats setObject:[NSNumber numberWithInt:count] forKey:key]; +} ++ (void)downInstanceCount:(id)o +{ + liveInstanceCount--; + + id key = [NSMutableString stringWithFormat:@"%@", [o class]]; + + id existingCount = [sharedInstanceStats objectForKey:key]; + if (!existingCount) + { + NSLog(@"downInstanceCount on %@ without an up", o); + return; + } + int count = [existingCount intValue]; + count--; + + if (count) [sharedInstanceStats setObject:[NSNumber numberWithInt:count] forKey:key]; + else [sharedInstanceStats removeObjectForKey:key]; +} ++ (int)liveInstanceCount:(Class)c +{ + id key = [NSMutableString stringWithFormat:@"%@", c]; + + id existingCount = [sharedInstanceStats objectForKey:key]; + if (!existingCount) return 0; + return [existingCount intValue]; +} ++ (id)liveInstanceHash +{ + return sharedInstanceStats; +} + + ++ (void)logInstanceStats +{ + id allKeys = [sharedInstanceStats allKeys]; + NSLog(@"====instanceStats : %ld classes spawned %d instances since launch, %d dead, %d alive====", (long)[allKeys count], fullInstanceCount, fullInstanceCount-liveInstanceCount, liveInstanceCount); + for (id key in allKeys) + NSLog(@"%@=%d", key, [[sharedInstanceStats objectForKey:key] intValue]); + if ([allKeys count]) NSLog(@"===="); +} + ++ (void)logBoxedObjects +{ + NSLog(@"====%ld boxedObjects====", (long)[[boxedObjects allKeys] count]); + NSLog(@"%@", boxedObjects); +} + +#pragma mark Class inspection ++ (id)rootclasses +{ + return [JSCocoaLib rootclasses]; +} ++ (id)classes +{ + return [JSCocoaLib classes]; +} ++ (id)protocols +{ + return [JSCocoaLib protocols]; +} ++ (id)imageNames +{ + return [JSCocoaLib imageNames]; +} ++ (id)methods +{ + return [JSCocoaLib methods]; +} ++ (id)runtimeReport +{ + return [JSCocoaLib runtimeReport]; +} ++ (id)explainMethodEncoding:(id)encoding +{ + id argumentEncodings = [JSCocoaController parseObjCMethodEncoding:[encoding UTF8String]]; + id explication = [NSMutableArray array]; + for (id arg in argumentEncodings) + [explication addObject:[arg typeDescription] + ]; + + return explication; +} + + + + +// JSCocoa : handle setting with callMethod +// object.width = 100 +// -> +// [object setWidth:100] +// +- (BOOL)JSCocoa:(JSCocoaController*)controller setProperty:(NSString*)propertyName ofObject:(id)object toValue:(JSValueRef)value inContext:(JSContextRef)localCtx exception:(JSValueRef*)exception +{ + // FIXME: this doesn't actually work with objc properties, and we can't always rely that this method will exist either... + // it should probably be moved up into the JSCocoa layer. + + NSString* setterName = [NSString stringWithFormat:@"set%@%@:", + [[propertyName substringWithRange:NSMakeRange(0,1)] capitalizedString], + [propertyName substringWithRange:NSMakeRange(1, [propertyName length]-1)]]; + + if ([self JSCocoa:controller callMethod:setterName ofObject:object privateObject:nil argumentCount:1 arguments:&value inContext:localCtx exception:exception]) { + return YES; + } + + return NO; +} +#pragma mark Distant Object Handling (DO) +// +// NSDistantObject call using NSInvocation +// +- (JSValueRef)JSCocoa:(JSCocoaController*)controller callMethod:(NSString*)methodName ofObject:(id)callee privateObject:(JSCocoaPrivateObject*)thisPrivateObject argumentCount:(size_t)argumentCount arguments:(JSValueRef*)arguments inContext:(JSContextRef)localCtx exception:(JSValueRef*)exception +{ + SEL selector = NSSelectorFromString(methodName); + if (class_getInstanceMethod([callee class], selector) || class_getClassMethod([callee class], selector)) { + return nil; + } + + NSMethodSignature *signature = [callee methodSignatureForSelector:selector]; + + if (!signature) { + return nil; + } + + // we need to do all this for NSDistantObject , since JSCocoa doesn't handle it natively. + + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; + [invocation setSelector:selector]; + NSUInteger argIndex = 0; + while (argIndex < argumentCount) { + + id arg = 0x00; + + [JSCocoaFFIArgument unboxJSValueRef:arguments[argIndex] toObject:&arg inContext:localCtx]; + + const char *type = [signature getArgumentTypeAtIndex:argIndex + 2]; + // Structure argument + if (type && type[0] == '{') + { + id structureType = [NSString stringWithUTF8String:type]; + id fullStructureType = [JSCocoaFFIArgument structureFullTypeEncodingFromStructureTypeEncoding:structureType]; + + int size = [JSCocoaFFIArgument sizeOfStructure:structureType]; + JSObjectRef jsObject = JSValueToObject(ctx, arguments[argIndex], NULL); + if (size && fullStructureType && jsObject) + { + // Alloc structure size and let NSData deallocate it + void* source = malloc(size); + memset(source, 0, size); + [NSData dataWithBytesNoCopy:source length:size freeWhenDone:YES]; + + void* p = source; + NSInteger numParsed = [JSCocoaFFIArgument structureFromJSObjectRef:jsObject inContext:ctx inParentJSValueRef:NULL fromCString:(char*)[fullStructureType UTF8String] fromStorage:&p]; + if (numParsed) [invocation setArgument:source atIndex:argIndex+2]; + } + } + else + if ([arg isKindOfClass:[NSNumber class]]) { + +// const char *type = [signature getArgumentTypeAtIndex:argIndex + 2]; + if (strcmp(type, @encode(BOOL)) == 0) { + BOOL b = [arg boolValue]; + [invocation setArgument:&b atIndex:argIndex + 2]; + } + else if (strcmp(type, @encode(unsigned int)) == 0) { + unsigned int i = [arg unsignedIntValue]; + [invocation setArgument:&i atIndex:argIndex + 2]; + } + else if (strcmp(type, @encode(int)) == 0) { + int i = [arg intValue]; + [invocation setArgument:&i atIndex:argIndex + 2]; + } + else if (strcmp(type, @encode(unsigned long)) == 0) { + unsigned long l = [arg unsignedLongValue]; + [invocation setArgument:&l atIndex:argIndex + 2]; + } + else if (strcmp(type, @encode(long)) == 0) { + long l = [arg longValue]; + [invocation setArgument:&l atIndex:argIndex + 2]; + } + else if (strcmp(type, @encode(float)) == 0) { + float f = [arg floatValue]; + [invocation setArgument:&f atIndex:argIndex + 2]; + } + else if (strcmp(type, @encode(double)) == 0) { + double d = [arg doubleValue]; + [invocation setArgument:&d atIndex:argIndex + 2]; + } + else { // just do int for all else. + int i = [arg intValue]; + [invocation setArgument:&i atIndex:argIndex + 2]; + } + + } + else { + [invocation setArgument:&arg atIndex:argIndex + 2]; + } + + argIndex++; + } + + @try { + [invocation invokeWithTarget:callee]; + } + @catch (NSException * e) { + NSLog(@"Exception while calling %@. %@", methodName, [e reason]); + + if ([[e reason] isEqualToString:@"connection went invalid while waiting for a reply"]) { + // whoops? + // also, how do we not look for some funky localized string here? + // also also, can we now make whatever is pointing to this value, nil? + + if (thisPrivateObject) { + NSLog(@"Connection terminated, removing reference to object"); + thisPrivateObject.object = [NSNull null]; + [thisPrivateObject setJSValueRef:JSValueMakeNull(localCtx) ctx:localCtx]; + } + } + } + + JSValueRef jsReturnValue = NULL; + const char *type = [signature methodReturnType]; + if (strcmp(type, @encode(id)) == 0 || strcmp(type, @encode(Class)) == 0) { + id result = 0x00; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument boxObject:result toJSValueRef:&jsReturnValue inContext:localCtx]; + } +/* + case _C_CHR: + case _C_UCHR: + case _C_SHT: + case _C_USHT: + case _C_INT: + case _C_UINT: + case _C_LNG: + case _C_ULNG: + case _C_LNG_LNG: + case _C_ULNG_LNG: + case _C_FLT: + case _C_DBL: +*/ + else if (strcmp(type, @encode(char)) == 0) { + char result; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument toJSValueRef:&jsReturnValue inContext:localCtx typeEncoding:@encode(char)[0] fullTypeEncoding:NULL fromStorage:&result]; + } + else if (strcmp(type, @encode(unsigned char)) == 0) { + unsigned char result; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument toJSValueRef:&jsReturnValue inContext:localCtx typeEncoding:@encode(unsigned char)[0] fullTypeEncoding:NULL fromStorage:&result]; + } + else if (strcmp(type, @encode(short)) == 0) { + short result; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument toJSValueRef:&jsReturnValue inContext:localCtx typeEncoding:@encode(short)[0] fullTypeEncoding:NULL fromStorage:&result]; + } + else if (strcmp(type, @encode(unsigned short)) == 0) { + unsigned short result; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument toJSValueRef:&jsReturnValue inContext:localCtx typeEncoding:@encode(unsigned short)[0] fullTypeEncoding:NULL fromStorage:&result]; + } + else if (strcmp(type, @encode(int)) == 0) { + int result; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument toJSValueRef:&jsReturnValue inContext:localCtx typeEncoding:@encode(int)[0] fullTypeEncoding:NULL fromStorage:&result]; + } + else if (strcmp(type, @encode(unsigned int)) == 0) { + unsigned int result; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument toJSValueRef:&jsReturnValue inContext:localCtx typeEncoding:@encode(unsigned int)[0] fullTypeEncoding:NULL fromStorage:&result]; + } + else if (strcmp(type, @encode(long)) == 0) { + long result; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument toJSValueRef:&jsReturnValue inContext:localCtx typeEncoding:@encode(long)[0] fullTypeEncoding:NULL fromStorage:&result]; + } + else if (strcmp(type, @encode(unsigned long)) == 0) { + unsigned long result; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument toJSValueRef:&jsReturnValue inContext:localCtx typeEncoding:@encode(unsigned long)[0] fullTypeEncoding:NULL fromStorage:&result]; + } + else if (strcmp(type, @encode(float)) == 0) { + float result; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument toJSValueRef:&jsReturnValue inContext:localCtx typeEncoding:@encode(float)[0] fullTypeEncoding:NULL fromStorage:&result]; + } + else if (strcmp(type, @encode(double)) == 0) { + double result; + [invocation getReturnValue:&result]; + if (!result) return JSValueMakeNull(localCtx); + [JSCocoaFFIArgument toJSValueRef:&jsReturnValue inContext:localCtx typeEncoding:@encode(double)[0] fullTypeEncoding:NULL fromStorage:&result]; + } + // Structure return + else if (type && type[0] == '{') + { + id structureType = [NSString stringWithUTF8String:type]; + id fullStructureType = [JSCocoaFFIArgument structureFullTypeEncodingFromStructureTypeEncoding:structureType]; + + int size = [JSCocoaFFIArgument sizeOfStructure:structureType]; + if (size) + { + void* result = malloc(size); + [invocation getReturnValue:result]; + + // structureToJSValueRef will advance the pointer in place, overwriting its original value + void* ptr = result; + NSInteger numParsed = [JSCocoaFFIArgument structureToJSValueRef:&jsReturnValue inContext:localCtx fromCString:(char*)[fullStructureType UTF8String] fromStorage:&ptr]; + if (!numParsed) jsReturnValue = NULL; + free(result); + } + } + if (!jsReturnValue) return JSValueMakeNull(localCtx); + return jsReturnValue; +} + +@end + + + + + + + +#pragma mark Javascript setter functions +// Hold these methods in a derived NSObject class : only derived classes created with a __jsHash (capable of hosting js objects) will get them +@interface JSCocoaMethodHolder : NSObject +@end +// Stored there for convenience. They won't be used by JSCocoaPrivateObject but will be patched in for any derived class +@implementation JSCocoaMethodHolder +- (BOOL)setJSValue:(JSValueRefAndContextRef)valueAndContext forJSName:(JSValueRefAndContextRef)nameAndContext +{ + if (class_getInstanceVariable([self class], "__jsHash")) + { + JSContextRef c = valueAndContext.ctx; + JSStringRef name = JSValueToStringCopy(c, nameAndContext.value, NULL); + + JSObjectRef hash = NULL; + object_getInstanceVariable(self, "__jsHash", (void**)&hash); + if (!hash) + { + // Retrieve controller + id jsc = [JSCocoaController controllerFromContext:c]; + c = [jsc ctx]; + + hash = JSObjectMake(c, hashObjectClass, NULL); + // Same as copyWithZone: + object_setInstanceVariable(self, "__jsHash", (void*)hash); + object_setInstanceVariable(self, "__jsCocoaController", (void*)jsc); + JSValueProtect(c, hash); + [JSCocoaController upJSValueProtectCount]; + [JSCocoaController upJSCocoaHashCount]; + } + + JSObjectSetProperty(c, hash, name, valueAndContext.value, kJSPropertyAttributeNone, NULL); + JSStringRelease(name); + return YES; + } + return NO; +} +- (JSValueRefAndContextRef)JSValueForJSName:(JSValueRefAndContextRef)nameAndContext +{ + JSValueRefAndContextRef valueAndContext = { JSValueMakeNull(nameAndContext.ctx), NULL }; + if (class_getInstanceVariable([self class], "__jsHash")) + { + JSContextRef c = nameAndContext.ctx; + JSStringRef name = JSValueToStringCopy(c, nameAndContext.value, NULL); + + JSObjectRef hash = NULL; + object_getInstanceVariable(self, "__jsHash", (void**)&hash); + if (!hash || !JSObjectHasProperty(c, hash, name)) + { + JSStringRelease(name); + return valueAndContext; + } + valueAndContext.ctx = c; + valueAndContext.value = JSObjectGetProperty(c, hash, name, NULL); + + JSStringRelease(name); + return valueAndContext; + } + return valueAndContext; +} + +- (BOOL)deleteJSValueForJSName:(JSValueRefAndContextRef)nameAndContext +{ + if (class_getInstanceVariable([self class], "__jsHash")) + { + JSContextRef c = nameAndContext.ctx; + JSStringRef name = JSValueToStringCopy(c, nameAndContext.value, NULL); + + JSObjectRef hash = NULL; + object_getInstanceVariable(self, "__jsHash", (void**)&hash); + if (!hash || !JSObjectHasProperty(c, hash, name)) + { + JSStringRelease(name); + return NO; + } + bool r = JSObjectDeleteProperty(c, hash, name, NULL); + JSStringRelease(name); + return r; + } + return NO; +} + + +// Instance count debug ++ (id)allocWithZone:(NSZone*)zone +{ + // Dynamic super call + id parentClass = [JSCocoaController parentObjCClassOfClassName:[NSString stringWithUTF8String:class_getName(self)]]; + id supermetaclass = objc_getMetaClass(class_getName(parentClass)); + struct objc_super superData = { self, supermetaclass }; + id o = objc_msgSendSuper(&superData, @selector(allocWithZone:), zone); + + [JSCocoaController upInstanceCount:o]; + return o; +} + +// Called by -(id)copy +- (id)copyWithZone:(NSZone *)zone +{ + // Dynamic super call + id parentClass = [JSCocoaController parentObjCClassOfClassName:[NSString stringWithUTF8String:class_getName([self class])]]; + struct objc_super superData = { self, parentClass }; + id o = objc_msgSendSuper(&superData, @selector(copyWithZone:), zone); + + // + // Copy hash by making a new copy + // + + // Return if var has no controller + id jsc = nil; + object_getInstanceVariable(self, "__jsCocoaController", (void**)&jsc); + if (!jsc) return o; + + + JSContextRef ctx = [jsc ctx]; + + + JSObjectRef hash1 = NULL; + JSObjectRef hash2 = NULL; + object_getInstanceVariable(self, "__jsHash", (void**)&hash1); + object_getInstanceVariable(o, "__jsHash", (void**)&hash2); + + // Return if hash does not exist + if (!hash1) return o; + + + // Copy hash + JSStringRef scriptJS = JSStringCreateWithUTF8CString("var hash1 = arguments[0]; var hash2 = {}; for (var i in hash1) hash2[i] = hash1[i]; return hash2"); + JSObjectRef fn = JSObjectMakeFunction(ctx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSValueRef result = JSObjectCallAsFunction(ctx, fn, NULL, 1, (JSValueRef*)&hash1, NULL); + JSStringRelease(scriptJS); + + // Convert hash to object + JSObjectRef hashCopy = JSValueToObject(ctx, result, NULL); + object_getInstanceVariable(o, "__jsHash", (void**)&hash2); + + // Same as setJSValue:forJSName: + // Set new hash + object_setInstanceVariable(o, "__jsHash", (void*)hashCopy); + object_setInstanceVariable(o, "__jsCocoaController", (void*)jsc); + JSValueProtect(ctx, hashCopy); + [JSCocoaController upJSValueProtectCount]; + [JSCocoaController upJSCocoaHashCount]; + + [JSCocoaController upInstanceCount:o]; + return o; +} + + +// Dealloc : unprotect js hash +- (void)deallocAndCleanupJS +{ + JSObjectRef hash = NULL; + object_getInstanceVariable(self, "__jsHash", (void**)&hash); + if (hash) + { + id jsc = NULL; + object_getInstanceVariable(self, "__jsCocoaController", (void**)&jsc); + JSValueUnprotect([jsc ctx], hash); + [JSCocoaController downJSCocoaHashCount]; + } + [JSCocoaController downInstanceCount:self]; + + // Dynamic super call + id parentClass = [JSCocoaController parentObjCClassOfClassName:[NSString stringWithUTF8String:class_getName([self class])]]; + struct objc_super superData = { self, parentClass }; + objc_msgSendSuper(&superData, @selector(dealloc)); +} + +// Finalize - same as dealloc +static BOOL __warningSuppressorAsFinalizeIsCalledBy_objc_msgSendSuper = NO; +- (void)finalize +{ + JSObjectRef hash = NULL; + object_getInstanceVariable(self, "__jsHash", (void**)&hash); + if (hash) + { + id jsc = NULL; + object_getInstanceVariable(self, "__jsCocoaController", (void**)&jsc); + JSValueUnprotect([jsc ctx], hash); + [JSCocoaController downJSCocoaHashCount]; + } + [JSCocoaController downInstanceCount:self]; + + // Dynamic super call + id parentClass = [JSCocoaController parentObjCClassOfClassName:[NSString stringWithUTF8String:class_getName([self class])]]; + struct objc_super superData = { self, parentClass }; + objc_msgSendSuper(&superData, @selector(finalize)); + + // Ignore warning about missing [super finalize] as the call IS made via objc_msgSendSuper + if (__warningSuppressorAsFinalizeIsCalledBy_objc_msgSendSuper) [super finalize]; +} + + + +@end + + + + + + +#pragma mark Common instance method +// Class.instance == class.alloc.init + release (jsObject retains object) +// Class.instance( { withA : ... andB : ... } ) == class.alloc.initWithA:... andB:... + release +@implementation NSObject(CommonInstance) ++ (JSValueRef)instanceWithContext:(JSContextRef)ctx argumentCount:(size_t)argumentCount arguments:(JSValueRef*)arguments exception:(JSValueRef*)exception +{ + id methodName = @"init"; + JSValueRef* argumentsToFree = NULL; + // Recover init method + if (argumentCount == 1) + { + id splitMethodName = @"init"; + BOOL isSplitCall = [JSCocoaController trySplitCall:&splitMethodName class:self argumentCount:&argumentCount arguments:&arguments ctx:ctx]; + if (isSplitCall) + { + methodName = splitMethodName; + argumentsToFree = arguments; + } + else return throwException(ctx, exception, @"Instance split call did not find an init method"), NULL; + } +// NSLog(@"=>Called instance on %@ with init=%@", self, methodName); + + // Allocate new instance + id newInstance = [self alloc]; + + // Set it as new object + JSObjectRef thisObject = [JSCocoaController jsCocoaPrivateObjectInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(thisObject); + private.type = @"@"; + [private setObjectNoRetain:newInstance]; + // No — will retain allocated object and trigger "did you forget to call init" warning + // Object will be automatically boxed when returned to Javascript by +// JSObjectRef thisObject = [JSCocoaController boxedJSObject:newInstance inContext:ctx]; + + // Create function object boxing our init method + JSObjectRef function = [JSCocoaController jsCocoaPrivateFunctionInContext:ctx]; + private = JSObjectGetPrivate(function); + private.type = @"method"; + private.methodName = methodName; + + // Call callAsFunction on our new instance with our init method + JSValueRef exceptionFromInitCall = NULL; + JSValueRef returnValue = jsCocoaObject_callAsFunction(ctx, function, thisObject, argumentCount, arguments, &exceptionFromInitCall); + free(argumentsToFree); + if (exceptionFromInitCall) return *exception = exceptionFromInitCall, NULL; + + // Release object + JSObjectRef returnObject = JSValueToObject(ctx, returnValue, NULL); + // We can get nil when initWith... fails. (eg var image = NSImage.instance({withContentsOfFile:'DOESNOTEXIST'}) + // Return nil then. + if (returnObject == nil) return JSValueMakeNull(ctx); + private = JSObjectGetPrivate(returnObject); + id boxedObject = [private object]; + [boxedObject release]; + + // Register our context in there so that safeDealloc finds it. + if ([boxedObject respondsToSelector:@selector(safeDealloc)]) + { + id jsc = [JSCocoaController controllerFromContext:ctx]; + object_setInstanceVariable(boxedObject, "__jsCocoaController", (void*)jsc); + } + return returnValue; +} + + +@end + + + + + + +#pragma mark - +#pragma mark JavascriptCore callbacks +#pragma mark - +#pragma mark JavascriptCore OSX object + +// +// +// Global resolver : main class used as 'this' in Javascript's global scope. Name requests go through here. +// +// +JSValueRef OSXObject_getProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyNameJS, JSValueRef* exception) +{ + NSString* propertyName = (NSString*)JSStringCopyCFString(kCFAllocatorDefault, propertyNameJS); + [NSMakeCollectable(propertyName) autorelease]; + + if ([propertyName isEqualToString:@"__jsc__"]) return NULL; + +// NSLog(@"Asking for global property %@", propertyName); + JSCocoaController* jsc = [JSCocoaController controllerFromContext:ctx]; + id delegate = jsc.delegate; + // + // Delegate canGetGlobalProperty, getGlobalProperty + // + if (delegate) + { + // Check if getting is allowed + if ([delegate respondsToSelector:@selector(JSCocoa:canGetGlobalProperty:inContext:exception:)]) + { + BOOL canGetGlobal = [delegate JSCocoa:jsc canGetGlobalProperty:propertyName inContext:ctx exception:exception]; + if (!canGetGlobal) + { + if (!*exception) throwException(ctx, exception, [NSString stringWithFormat:@"Delegate does not allow getting global property %@", propertyName]); + return NULL; + } + } + // Check if delegate handles getting + if ([delegate respondsToSelector:@selector(JSCocoa:getGlobalProperty:inContext:exception:)]) + { + JSValueRef delegateGetGlobal = [delegate JSCocoa:jsc getGlobalProperty:propertyName inContext:ctx exception:exception]; + if (delegateGetGlobal) return delegateGetGlobal; + } + } + + // + // ObjC class + // + Class objCClass = NSClassFromString(propertyName); + if (objCClass && ![propertyName isEqualToString:@"Object"]) + { + JSValueRef ret = [JSCocoaController boxedJSObject:objCClass inContext:ctx]; + return ret; + } + + id xml; + id type = nil; + // + // Query BridgeSupport for property + // + xml = [[BridgeSupportController sharedController] queryName:propertyName]; + if (xml) + { + id error = nil; + id xmlDocument = [[NSXMLDocument alloc] initWithXMLString:xml options:0 error:&error]; + if (error) return NSLog(@"(OSX_getPropertyCallback) malformed xml while getting property %@ of type %@ : %@", propertyName, type, error), NULL; + [xmlDocument autorelease]; + + type = [[xmlDocument rootElement] name]; + + // + // Function + // + if ([type isEqualToString:@"function"]) + { + JSObjectRef o = [JSCocoaController jsCocoaPrivateFunctionInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(o); + private.type = @"function"; + private.xml = xml; + return o; + } + + // + // Struct + // + else + if ([type isEqualToString:@"struct"]) + { + JSObjectRef o = [JSCocoaController jsCocoaPrivateObjectInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(o); + private.type = @"struct"; + private.xml = xml; + return o; + } + + // + // Constant + // + else + if ([type isEqualToString:@"constant"]) + { + // ##fix : NSZeroPoint, NSZeroRect, NSZeroSize would need special (struct) + type64 handling + // Check if constant's declared_type is NSString* + id declared_type = [[xmlDocument rootElement] attributeForName:@"declared_type"]; + if (!declared_type) declared_type = [[xmlDocument rootElement] attributeForName:@"type"]; + if (!declared_type || !([[declared_type stringValue] isEqualToString:@"NSString*"] + || [[declared_type stringValue] isEqualToString:@"@"] + || [[declared_type stringValue] isEqualToString:@"^{__CFString=}"] + )) + return NSLog(@"(OSX_getPropertyCallback) %@ not a NSString* constant : %@", propertyName, xml), NULL; + + // Grab symbol + void* symbol = dlsym(RTLD_DEFAULT, [propertyName UTF8String]); + if (!symbol) return NSLog(@"(OSX_getPropertyCallback) symbol %@ not found", propertyName), NULL; + + // ObjC objects, like NSApp : pointer to NSApplication.sharedApplication + if ([[declared_type stringValue] isEqualToString:@"@"]) + { + id o = *(id*)symbol; + return [JSCocoaController boxedJSObject:o inContext:ctx]; + } + + // Return symbol as a Javascript string + NSString* str = *(NSString**)symbol; + JSStringRef jsName = JSStringCreateWithUTF8CString([str UTF8String]); + JSValueRef jsString = JSValueMakeString(ctx, jsName); + JSStringRelease(jsName); + return jsString; + } + + // + // Enum + // + else + if ([type isEqualToString:@"enum"]) + { + // Check if constant's declared_type is NSString* + id value = [[xmlDocument rootElement] attributeForName:@"value"]; + if (!value) + { + value = [[xmlDocument rootElement] attributeForName:@"value64"]; + if (!value) + return NSLog(@"(OSX_getPropertyCallback) %@ enum has no value set", propertyName), NULL; + } + + // Try parsing value + double doubleValue = 0; + value = [value stringValue]; + if (![[NSScanner scannerWithString:value] scanDouble:&doubleValue]) return NSLog(@"(OSX_getPropertyCallback) scanning %@ enum failed", propertyName), NULL; + return JSValueMakeNumber(ctx, doubleValue); + } + } + + // Describe ourselves + if ([propertyName isEqualToString:@"toString"] || [propertyName isEqualToString:@"valueOf"]) + { + JSStringRef scriptJS = JSStringCreateWithUTF8CString("return '(JSCocoa global object)'"); + JSObjectRef fn = JSObjectMakeFunction(ctx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSStringRelease(scriptJS); + return fn; + } + + return NULL; +} + + +static void OSXObject_getPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) +{ + // Move to a definition object +/* + NSArray* keys = [[BridgeSupportController sharedController] keys]; + for (id key in keys) + { + JSStringRef jsString = JSStringCreateWithUTF8CString([key UTF8String]); + JSPropertyNameAccumulatorAddName(propertyNames, jsString); + JSStringRelease(jsString); + } +*/ +} + + + + + + +#pragma mark JavascriptCore JSCocoa object + +// +// Below lie the Javascript callbacks for all Javascript objects created by JSCocoa, used to pass ObjC data to and fro Javascript. +// + + +// +// From PyObjC : when to call objc_msgSend_stret, for structure return +// Depending on structure size & architecture, structures are returned as function first argument (done transparently by ffi) or via registers +// +BOOL isUsingStret(id argumentEncodings) +{ + int resultSize = 0; + char returnEncoding = [[argumentEncodings objectAtIndex:0] typeEncoding]; + if (returnEncoding == _C_STRUCT_B) resultSize = [JSCocoaFFIArgument sizeOfStructure:[[argumentEncodings objectAtIndex:0] structureTypeEncoding]]; + if (returnEncoding == _C_STRUCT_B && + //#ifdef __ppc64__ + // ffi64_stret_needs_ptr(signature_to_ffi_return_type(rettype), NULL, NULL) + // + //#else /* !__ppc64__ */ + (resultSize > SMALL_STRUCT_LIMIT + #ifdef __i386__ + /* darwin/x86 ABI is slightly odd ;-) */ + || (resultSize != 1 + && resultSize != 2 + && resultSize != 4 + && resultSize != 8) + #endif + #ifdef __x86_64__ + /* darwin/x86-64 ABI is slightly odd ;-) */ + || (resultSize != 1 + && resultSize != 2 + && resultSize != 4 + && resultSize != 8 + && resultSize != 16 + ) + #endif + ) + //#endif /* !__ppc64__ */ + ) { +// callAddress = objc_msgSend_stret; +// usingStret = YES; + return YES; + } + return NO; +} + +// +// Return the correct objc_msgSend* variety according to encodings +// +void* getObjCCallAddress(id argumentEncodings) +{ + BOOL usingStret = isUsingStret(argumentEncodings); + void* callAddress = objc_msgSend; + if (usingStret) callAddress = objc_msgSend_stret; + + +#if __i386__ // || TARGET_OS_IPHONE no, iPhone uses objc_msgSend + char returnEncoding = [[argumentEncodings objectAtIndex:0] typeEncoding]; + if (returnEncoding == 'f' || returnEncoding == 'd') + { + callAddress = objc_msgSend_fpret; + } +#endif + + return callAddress; +} + +// +// Convert FROM a webView context to a local context (called by valueOf(), toString()) +// +JSValueRef valueFromExternalContext(JSContextRef externalCtx, JSValueRef value, JSContextRef ctx) +{ + int type = JSValueGetType(externalCtx, value); + switch (type) + { + case kJSTypeUndefined: + { + return JSValueMakeUndefined(ctx); + } + + case kJSTypeNull: + { + return JSValueMakeNull(ctx); + } + + case kJSTypeBoolean: + { + bool b = JSValueToBoolean(externalCtx, value); + return JSValueMakeBoolean(ctx, b); + } + + case kJSTypeNumber: + { + double d = JSValueToNumber(externalCtx, value, NULL); + return JSValueMakeNumber(ctx, d); + } + + // Make strings and objects show up only as strings + case kJSTypeString: + case kJSTypeObject: + { + // Add an (externalContext) suffix to distinguish boxed JSValues from a WebView + JSStringRef jsString = JSValueToStringCopy(externalCtx, value, NULL); + + NSString* string = (NSString*)JSStringCopyCFString(kCFAllocatorDefault, jsString); + NSString* idString; + + // Mark only objects as (externalContext), not raw strings + if (type == kJSTypeObject) idString = [NSString stringWithFormat:@"%@ (externalContext)", string]; + else idString = [NSString stringWithFormat:@"%@", string]; + [string release]; + JSStringRelease(jsString); + + jsString = JSStringCreateWithUTF8CString([idString UTF8String]); + JSValueRef returnValue = JSValueMakeString(ctx, jsString); + JSStringRelease(jsString); + + return returnValue; + } + } + return JSValueMakeNull(ctx); +} + +// +// Convert TO a webView context from a local context +// +JSValueRef valueToExternalContext(JSContextRef ctx, JSValueRef value, JSContextRef externalCtx) +{ + int type = JSValueGetType(ctx, value); + switch (type) + { + case kJSTypeUndefined: + { + return JSValueMakeUndefined(externalCtx); + } + + case kJSTypeNull: + { + return JSValueMakeNull(externalCtx); + } + + case kJSTypeBoolean: + { + bool b = JSValueToBoolean(ctx, value); + return JSValueMakeBoolean(externalCtx, b); + } + + case kJSTypeNumber: + { + double d = JSValueToNumber(ctx, value, NULL); + return JSValueMakeNumber(externalCtx, d); + } + + case kJSTypeString: + { + JSStringRef jsString = JSValueToStringCopy(ctx, value, NULL); + JSValueRef returnValue = JSValueMakeString(externalCtx, jsString); + JSStringRelease(jsString); + return returnValue; + } + case kJSTypeObject: + { + JSObjectRef o = JSValueToObject(ctx, value, NULL); + if (!o) return JSValueMakeNull(externalCtx); + JSCocoaPrivateObject* privateObject = JSObjectGetPrivate(o); + if (![privateObject.type isEqualToString:@"externalJSValueRef"]) + { + id object = [privateObject object]; + if ([object isKindOfClass:[NSString class]]) + { + JSStringRef jsName = JSStringCreateWithUTF8CString([object UTF8String]); + JSValueRef jsString = JSValueMakeString(externalCtx, jsName); + JSStringRelease(jsName); + return jsString; + } + if ([object isKindOfClass:[NSNumber class]]) + { + return JSValueMakeNumber(externalCtx, [object doubleValue]); + } +// NSLog(@"Object (%@) converted to undefined", o ); + return JSValueMakeUndefined(externalCtx); + } + return [privateObject jsValueRef]; + } + } + return JSValueMakeNull(externalCtx); +} + +JSValueRef boxedValueFromExternalContext(JSContextRef externalCtx, JSValueRef value, JSContextRef ctx) +{ + if (JSValueGetType(externalCtx, value) < kJSTypeObject) return valueFromExternalContext(externalCtx, value, ctx); + + // If value is function ... + JSStringRef scriptJS= JSStringCreateWithUTF8CString("return (typeof arguments[0]) == 'function' ? true : null"); + JSObjectRef fn = JSObjectMakeFunction(externalCtx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSValueRef result = JSObjectCallAsFunction(externalCtx, fn, NULL, 1, (JSValueRef*)&value, NULL); + JSStringRelease(scriptJS); + + // ... use the function boxer + JSObjectRef o; + if (JSValueIsBoolean(externalCtx, result)) + o = [JSCocoaController jsCocoaPrivateFunctionInContext:ctx]; + else + o = [JSCocoaController jsCocoaPrivateObjectInContext:ctx]; + + JSCocoaPrivateObject* private = JSObjectGetPrivate(o); + private.type = @"externalJSValueRef"; + [private setExternalJSValueRef:value ctx:externalCtx]; + return o; +} + + +// +// valueOf : from a boxed ObjC object, returns a primitive javascript value (number or string) +// that JavascriptCore can use in expressions (eg boxedObject + 'this', boxedObject < 4) +// +// The returned value is temporary and does not affect the boxed object. +// +JSValueRef valueOfCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) +{ + // Holding a native JS value ? Return it + JSCocoaPrivateObject* thisPrivateObject = JSObjectGetPrivate(thisObject); + if ([thisPrivateObject.type isEqualToString:@"jsValueRef"]) + { + return [thisPrivateObject jsValueRef]; + } + + // External jsValueRef from WebView + if ([thisPrivateObject.type isEqualToString:@"externalJSValueRef"]) + { + JSContextRef externalCtx = [thisPrivateObject ctx]; + JSValueRef externalJSValueRef = [thisPrivateObject jsValueRef]; + JSStringRef scriptJS= JSStringCreateWithUTF8CString("return arguments[0].valueOf()"); + JSObjectRef fn = JSObjectMakeFunction(externalCtx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSValueRef result = JSObjectCallAsFunction(externalCtx, fn, NULL, 1, (JSValueRef*)&externalJSValueRef, NULL); + JSStringRelease(scriptJS); + + return valueFromExternalContext(externalCtx, result, ctx); + } + + // NSNumber special case + if ([thisPrivateObject.object isKindOfClass:[NSNumber class]]) + return JSValueMakeNumber(ctx, [thisPrivateObject.object doubleValue]); + + // Convert to string + id toString = [thisPrivateObject description]; + + // Object + if ([thisPrivateObject.type isEqualToString:@"@"]) + { + // Holding an out value ? + if ([thisPrivateObject.object isKindOfClass:[JSCocoaOutArgument class]]) + { + JSValueRef outValue = [(JSCocoaOutArgument*)thisPrivateObject.object outJSValueRefInContext:ctx]; + if (!outValue) + { + JSStringRef jsName = JSStringCreateWithUTF8CString("Unitialized outArgument"); + JSValueRef r = JSValueMakeString(ctx, jsName); + JSStringRelease(jsName); + return r; + } + // Holding an object ? Call valueOf on it + if (JSValueGetType(ctx, outValue) == kJSTypeObject) + return valueOfCallback(ctx, NULL, JSValueToObject(ctx, outValue, NULL), 0, NULL, NULL); + // Return raw JSValueRef + return outValue; + } + else + toString = [NSString stringWithFormat:@"%@", [[thisPrivateObject object] description]]; + } + + // Struct + if ([thisPrivateObject.type isEqualToString:@"struct"]) + { + id structDescription = nil; + id self = [JSCocoaController controllerFromContext:ctx]; + if ([self hasJSFunctionNamed:@"describeStruct"]) + { + JSStringRef scriptJS = JSStringCreateWithUTF8CString("return describeStruct(arguments[0])"); + JSObjectRef fn = JSObjectMakeFunction(ctx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSValueRef jsValue = JSObjectCallAsFunction(ctx, fn, NULL, 1, (JSValueRef*)&thisObject, NULL); + JSStringRelease(scriptJS); + + [JSCocoaFFIArgument unboxJSValueRef:jsValue toObject:&structDescription inContext:ctx]; + } + + toString = [NSString stringWithFormat:@"<%@ %@>", thisPrivateObject.structureName, structDescription]; + } + + // Return a number is the whole string (no spaces, no others chars) is a number + // This emulates the javascript behaviour '4'*2 -> 8 when '4' is a string or an NSString + NSScanner* scan = [NSScanner scannerWithString:toString]; + [scan setCharactersToBeSkipped:nil]; + double v = 0; + [scan scanDouble:&v]; + if ([scan isAtEnd]) + return JSValueMakeNumber(ctx, v); + + // Convert to string and return + JSStringRef jsToString = JSStringCreateWithCFString((CFStringRef)toString); + JSValueRef jsValueToString = JSValueMakeString(ctx, jsToString); + JSStringRelease(jsToString); + return jsValueToString; +} + +// +// initialize +// retain boxed object +// +static void jsCocoaObject_initialize(JSContextRef ctx, JSObjectRef object) +{ + id o = JSObjectGetPrivate(object); + [o retain]; +} + +// +// finalize +// release boxed object +// +static void jsCocoaObject_finalize(JSObjectRef object) +{ + // if dealloc is overloaded, releasing now will trigger JS code and fail + // As we're being called by GC, KJS might assert() in operationInProgress == NoOperation + id private = JSObjectGetPrivate(object); + + // + // If a boxed object is being destroyed, remove it from the cache + // + id boxedObject = [private object]; + if (boxedObject) + { + id key = [NSString stringWithFormat:@"%x", boxedObject]; + // Object may have been already deallocated + id existingBoxedObject = [boxedObjects objectForKey:key]; + if (existingBoxedObject) + { + // Safe dealloc ? + if ([boxedObject retainCount] == 1) + { + if ([boxedObject respondsToSelector:@selector(safeDealloc)]) + { + id jsc = NULL; + object_getInstanceVariable(boxedObject, "__jsCocoaController", (void**)&jsc); + // Call safeDealloc if enabled (will be disabled upon last JSCocoaController release, to make sure the ) + if (jsc) + { + if ([jsc useSafeDealloc]) + [jsc performSelector:@selector(safeDeallocInstance:) withObject:boxedObject afterDelay:0]; + } + else NSLog(@"safeDealloc could not find the context attached to %@.%p - allocate this object with instance, or add a Javascript variable to it (obj.hello = 'world')", [boxedObject class], boxedObject); + } + + } + + [boxedObjects removeObjectForKey:key]; + } + else + { +// BOOL retainObject = [private retainObject]; +// NSLog(@"finalizing an UNBOXED object (retain=%d)", retainObject); + } + } + + // Immediate release if dealloc is not overloaded + [private release]; +#ifdef __OBJC_GC__ + // Mark internal object as collectable + [[NSGarbageCollector defaultCollector] enableCollectorForPointer:private]; +#endif + +} + +/* +// +// Not needed as getProperty can return NULL to indicate property inexistance. +// +// log('doesNotExist' in object) +// getProperty returning undefined would mean the key is defined and has an undefined value. +// getProperty therefore returns NULL and the in operator returns false. +// -> hasProperty not needed. +// +static bool jsCocoaObject_hasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyNameJS) +{ + NSString* propertyName = (NSString*)JSStringCopyCFString(kCFAllocatorDefault, propertyNameJS); + [NSMakeCollectable(propertyName) autorelease]; + NSLog(@"hasProperty %@", propertyName); + return jsCocoaObject_getProperty(ctx, object, propertyNameJS, NULL); + return YES; +} +*/ + +// +// getProperty +// Return property in object's internal Javascript hash if its contains propertyName +// else ... +// Get objC method matching propertyName, autocall it +// else ... +// method may be a split call -> return a private object +// +// At method start, handle special cases for arrays (integers, length) and dictionaries +// +static JSValueRef jsCocoaObject_getProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyNameJS, JSValueRef* exception) +{ + NSString* propertyName = (NSString*)JSStringCopyCFString(kCFAllocatorDefault, propertyNameJS); + [NSMakeCollectable(propertyName) autorelease]; + + JSCocoaPrivateObject* privateObject = JSObjectGetPrivate(object); +// NSLog(@"Asking for property %@ %@(%@)", propertyName, privateObject, privateObject.type); + + // Get delegate + JSCocoaController* jsc = [JSCocoaController controllerFromContext:ctx]; + id delegate = jsc.delegate; + + if ([privateObject.type isEqualToString:@"@"]) + { +call: + // + // Delegate canGetProperty, getProperty + // + if (delegate) + { + // Check if getting is allowed + if ([delegate respondsToSelector:@selector(JSCocoa:canGetProperty:ofObject:inContext:exception:)]) + { + BOOL canGet = [delegate JSCocoa:jsc canGetProperty:propertyName ofObject:privateObject.object inContext:ctx exception:exception]; + if (!canGet) + { + if (!*exception) throwException(ctx, exception, [NSString stringWithFormat:@"Delegate does not allow getting %@.%@", privateObject.object, propertyName]); + return NULL; + } + } + // Check if delegate handles getting + if ([delegate respondsToSelector:@selector(JSCocoa:getProperty:ofObject:inContext:exception:)]) + { + JSValueRef delegateGet = [delegate JSCocoa:jsc getProperty:propertyName ofObject:privateObject.object inContext:ctx exception:exception]; + if (delegateGet) return delegateGet; + } + } + + // Special case for NSMutableArray get and Javascript array methods +// if ([privateObject.object isKindOfClass:[NSArray class]]) + // Use respondsToSelector for custom indexed access + if ([privateObject.object respondsToSelector:@selector(objectAtIndex:)]) + { + id array = privateObject.object; + id scan = [NSScanner scannerWithString:propertyName]; + NSInteger propertyIndex; + // Is asked property an int ? + BOOL convertedToInt = ([scan scanInteger:&propertyIndex]); + if (convertedToInt && [scan isAtEnd]) + { + if (propertyIndex < 0 || propertyIndex >= [array count]) return NULL; + + id o = [array objectAtIndex:propertyIndex]; + JSValueRef value = NULL; + [JSCocoaFFIArgument boxObject:o toJSValueRef:&value inContext:ctx]; + return value; + } + + // If we have 'length', switch it to 'count' + if ([propertyName isEqualToString:@"length"]) propertyName = @"count"; + + // NSArray bridge + id callee = [privateObject object]; + SEL sel = NSSelectorFromString(propertyName); + if ([propertyName rangeOfString:@":"].location == NSNotFound && ![callee respondsToSelector:sel] + && ![propertyName isEqualToString:@"valueOf"] + && ![propertyName isEqualToString:@"toString"] + ) + { + id script = [NSString stringWithFormat:@"return Array.prototype.%@", propertyName]; + JSStringRef scriptJS = JSStringCreateWithUTF8CString([script UTF8String]); + JSObjectRef fn = JSObjectMakeFunction(ctx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSValueRef result = JSObjectCallAsFunction(ctx, fn, NULL, 0, NULL, NULL); + JSStringRelease(scriptJS); + BOOL isJavascriptArrayMethod = result ? !JSValueIsUndefined(ctx, result) : NO; + + // Return the packaged Javascript function + if (isJavascriptArrayMethod) + { +// NSLog(@"*** array method : %@", propertyName); + JSObjectRef o = [JSCocoaController jsCocoaPrivateFunctionInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(o); + private.type = @"jsFunction"; + [private setJSValueRef:result ctx:ctx]; + return o; + } + } + } + + + // Special case for NSMutableDictionary get +// if ([privateObject.object isKindOfClass:[NSDictionary class]]) + // Use respondsToSelector for custom indexed access + if ([privateObject.object respondsToSelector:@selector(objectForKey:)]) + { + id dictionary = privateObject.object; + id o = [dictionary objectForKey:propertyName]; + if (o) + { + JSValueRef value = NULL; + [JSCocoaFFIArgument boxObject:o toJSValueRef:&value inContext:ctx]; + return value; + } + } + + // Special case for JSCocoaMemoryBuffer get + if ([privateObject.object isKindOfClass:[JSCocoaMemoryBuffer class]]) + { + id buffer = privateObject.object; + + id scan = [NSScanner scannerWithString:propertyName]; + NSInteger propertyIndex; + // Is asked property an int ? + BOOL convertedToInt = ([scan scanInteger:&propertyIndex]); + if (convertedToInt && [scan isAtEnd]) + { + if (propertyIndex < 0 || propertyIndex >= [buffer typeCount]) return NULL; + return [buffer valueAtIndex:propertyIndex inContext:ctx]; + } + } + + // Check object's internal property in its jsHash + id callee = [privateObject object]; + if ([callee respondsToSelector:@selector(JSValueForJSName:)]) + { + JSValueRefAndContextRef name = { JSValueMakeString(ctx, propertyNameJS), ctx } ; + JSValueRef hashProperty = [callee JSValueForJSName:name].value; + if (hashProperty && !JSValueIsNull(ctx, hashProperty)) + { + BOOL returnHashValue = YES; + // Make sure to not return hash value if it's native code (valueOf, toString) + if ([propertyName isEqualToString:@"valueOf"] || [propertyName isEqualToString:@"toString"]) + { + id script = [NSString stringWithFormat:@"return arguments[0].toString().indexOf('[native code]') != -1", propertyName]; + JSStringRef scriptJS = JSStringCreateWithUTF8CString([script UTF8String]); + JSObjectRef fn = JSObjectMakeFunction(ctx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSValueRef result = JSObjectCallAsFunction(ctx, fn, NULL, 1, (JSValueRef*)&hashProperty, NULL); + JSStringRelease(scriptJS); + BOOL isNativeCode = result ? JSValueToBoolean(ctx, result) : NO; + returnHashValue = !isNativeCode; +// NSLog(@"isNative(%@)=%d rawJSResult=%x hashProperty=%x returnHashValue=%d", propertyName, isNativeCode, result, hashProperty, returnHashValue); + } + if (returnHashValue) return hashProperty; + } + } +/* + // ## Use javascript override functions, only bridge side. Discarded for now as it doesn't give a way to call the original method + // ## Plus : useful ? as it can be done by setting custom js functions on the boxed objects + // Check if this is a Javascript override + id script = [NSString stringWithFormat:@"__globalJSFunctionRepository__.%@.%@", [callee class], propertyName]; + JSStringRef jsScript = JSStringCreateWithUTF8CString([script UTF8String]); + JSValueRef result = JSEvaluateScript(ctx, jsScript, NULL, NULL, 1, NULL); + JSStringRelease(jsScript); + if (result && JSValueGetType(ctx, result) == kJSTypeObject) + { + NSLog(@"GOT IT %@", propertyName); + JSObjectRef o = [JSCocoaController jsCocoaPrivateFunctionInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(o); + private.type = @"jsFunction"; + [private setJSValueRef:result ctx:ctx]; + return o; + } +*/ + // + // Attempt Zero arg autocall + // Object.alloc().init() -> Object.alloc.init + // + if (useAutoCall) + { + callee = [privateObject object]; + SEL sel = NSSelectorFromString(propertyName); + + BOOL isInstanceCall = [propertyName isEqualToString:@"instance"]; + // Go for zero arg call + if ([propertyName rangeOfString:@":"].location == NSNotFound && ([callee respondsToSelector:sel] || isInstanceCall)) + { + // + // Delegate canCallMethod, callMethod + // + if (delegate) + { + // Check if calling is allowed + if ([delegate respondsToSelector:@selector(JSCocoa:canCallMethod:ofObject:argumentCount:arguments:inContext:exception:)]) + { + BOOL canCall = [delegate JSCocoa:jsc canCallMethod:propertyName ofObject:callee argumentCount:0 arguments:NULL inContext:ctx exception:exception]; + if (!canCall) + { + if (!*exception) throwException(ctx, exception, [NSString stringWithFormat:@"Delegate does not allow calling [%@ %@]", callee, propertyName]); + return NULL; + } + } + // Check if delegate handles calling + if ([delegate respondsToSelector:@selector(JSCocoa:callMethod:ofObject:privateObject:argumentCount:arguments:inContext:exception:)]) + { + JSValueRef delegateCall = [delegate JSCocoa:jsc callMethod:propertyName ofObject:callee privateObject:privateObject argumentCount:0 arguments:NULL inContext:ctx exception:exception]; + if (delegateCall) + return delegateCall; + } + } + + // instance + if (isInstanceCall) + { + // Manually call and box our object + id class = [callee class]; + id instance = [[class alloc] init]; + JSValueRef returnValue; + [JSCocoaFFIArgument boxObject:instance toJSValueRef:&returnValue inContext:ctx]; + // Release it, making the javascript box the sole retainer + // Nulling all references to this object will release the instance during Javascript GC + JSCocoaPrivateObject* private = JSObjectGetPrivate(JSValueToObject(ctx, returnValue, NULL)); + [private.object release]; + + return returnValue; + } + + // Special case for alloc autocall — do not retain alloced result as it might crash (eg [[NSLocale alloc] retain] fails in ObjC) + if ([propertyName isEqualToString:@"alloc"]) + { + id allocatedObject = [callee alloc]; + JSObjectRef jsObject = [JSCocoaController jsCocoaPrivateObjectInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(jsObject); + private.type = @"@"; + [private setObjectNoRetain:allocatedObject]; + return jsObject; + } + + // Get method pointer + Method method = class_getInstanceMethod([callee class], sel); + if (!method) method = class_getClassMethod([callee class], sel); + + // If we didn't find a method, try Distant Object + if (!method) + { + JSValueRef res = [jsc JSCocoa:jsc callMethod:propertyName ofObject:callee privateObject:privateObject argumentCount:0 arguments:NULL inContext:ctx exception:exception]; + if (res) return res; + + throwException(ctx, exception, [NSString stringWithFormat:@"Could not get property[%@ %@]", callee, propertyName]); + return NULL; + } + + // Extract arguments + const char* typeEncoding = method_getTypeEncoding(method); + id argumentEncodings = [JSCocoaController parseObjCMethodEncoding:typeEncoding]; + // Call address + void* callAddress = getObjCCallAddress(argumentEncodings); + + // + // ffi data + // + ffi_cif cif; + ffi_type* args[2]; + void* values[2]; + char* selector; + + selector = (char*)NSSelectorFromString(propertyName); + args[0] = &ffi_type_pointer; + args[1] = &ffi_type_pointer; + values[0] = (void*)&callee; + values[1] = (void*)&selector; + + // Get return value holder + id returnValue = [argumentEncodings objectAtIndex:0]; + + // Allocate return value storage if it's a pointer + if ([returnValue typeEncoding] == '^') + [returnValue allocateStorage]; + + // Setup ffi + ffi_status prep_status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, [returnValue ffi_type], args); + // + // Call ! + // + if (prep_status == FFI_OK) + { + void* storage = [returnValue storage]; + if ([returnValue ffi_type] == &ffi_type_void) storage = NULL; + ffi_call(&cif, callAddress, storage, values); + } + + // Return now if our function returns void + // NO - box it +// if ([returnValue ffi_type] == &ffi_type_void) return NULL; + // Else, convert return value + JSValueRef jsReturnValue = NULL; + BOOL converted = [returnValue toJSValueRef:&jsReturnValue inContext:ctx]; + if (!converted) return throwException(ctx, exception, [NSString stringWithFormat:@"Return value not converted in %@", propertyName]), NULL; + + return jsReturnValue; + } + } + + // Check if we're holding an out value + if ([privateObject.object isKindOfClass:[JSCocoaOutArgument class]]) + { + JSValueRef outValue = [(JSCocoaOutArgument*)privateObject.object outJSValueRefInContext:ctx]; + if (outValue && JSValueGetType(ctx, outValue) == kJSTypeObject) + { + JSObjectRef outObject = JSValueToObject(ctx, outValue, NULL); + JSValueRef possibleReturnValue = JSObjectGetProperty(ctx, outObject, propertyNameJS, NULL); + return possibleReturnValue; + } + } + + // Info object for instances and classes + if ([propertyName isEqualToString:@RuntimeInformationPropertyName]) + { + JSObjectRef o = JSObjectMake(ctx, jsCocoaInfoClass, NULL); + + JSStringRef classNameProperty = JSStringCreateWithUTF8CString("className"); + JSStringRef className = JSStringCreateWithUTF8CString([[[[privateObject object] class] description] UTF8String]); + JSObjectSetProperty(ctx, o, classNameProperty, JSValueMakeString(ctx, className), + kJSPropertyAttributeReadOnly|kJSPropertyAttributeDontEnum|kJSPropertyAttributeDontDelete, NULL); + JSStringRelease(classNameProperty); + JSStringRelease(className); + return o; + } + + + // + // We're asked a property name and at this point we've checked the class's jsarray, autocall. + // If the property we're asked does not start a split call we'll return NULL. + // + // Check if the property is actually a method. + // If NO, replace underscores with colons + // add a ':' suffix + // + // If callee still fails to responds to that, check if propertyName starts a split call. + // If NO, return null + // + id methodName = [NSMutableString stringWithString:propertyName]; + // If responds to selector, OK + if (![callee respondsToSelector:NSSelectorFromString(methodName)] + // non ObjC methods + && ![methodName isEqualToString:@"valueOf"] + && ![methodName isEqualToString:@"Super"] + && ![methodName isEqualToString:@"Original"] +/* && ![methodName isEqualToString:@"instance"]*/) + { + // If setting on boxed objects is allowed, check existence of a property set on the js object - this is a reentrant call + if (canSetOnBoxedObjects) + { + // We need to bypass our get handler to get the js value + static int canSetCheck = 0; + // Return NULL so the get handler will retrieve the js property stored in the js object + if (canSetCheck > 0) + return NULL; + + canSetCheck++; + // Call default handler + JSValueRef jsValueSetOnBoxedObject = JSObjectGetProperty(ctx, object, propertyNameJS, nil); + canSetCheck--; + + // If we have something other than undefined, return it + if (JSValueGetType(ctx, jsValueSetOnBoxedObject) != kJSTypeUndefined) + return jsValueSetOnBoxedObject; + } + + if ([methodName rangeOfString:@"_"].location != NSNotFound) + [methodName replaceOccurrencesOfString:@"_" withString:@":" options:0 range:NSMakeRange(0, [methodName length])]; + + if (callSelectorsMissingTrailingSemicolon && ![methodName hasSuffix:@":"]) [methodName appendString:@":"]; + + if (![callee respondsToSelector:NSSelectorFromString(methodName)]) + { + // Instance check + if ([methodName hasPrefix:@"instance"]) + { + id initMethodName = [NSString stringWithFormat:@"init%@", [methodName substringFromIndex:8]]; + if ([callee instancesRespondToSelector:NSSelectorFromString(initMethodName)]) + { + JSObjectRef o = [JSCocoaController jsCocoaPrivateFunctionInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(o); + private.type = @"method"; + private.methodName = methodName; + return o; + } + } + + // + // This may be a JS function + // + Class class = [callee class]; + JSValueRef result = NULL; + while (class) + { + id script = [NSString stringWithFormat:@"__globalJSFunctionRepository__.%@.%@", class, propertyName]; + JSStringRef jsScript = JSStringCreateWithUTF8CString([script UTF8String]); + result = JSEvaluateScript(ctx, jsScript, NULL, NULL, 1, NULL); + JSStringRelease(jsScript); + // Found ? Break + if (result && JSValueGetType(ctx, result) == kJSTypeObject) break; + + // Go up parent class + class = [class superclass]; + } + // This is a pure JS function call — box it + if (result && JSValueGetType(ctx, result) == kJSTypeObject) + { + JSObjectRef o = [JSCocoaController jsCocoaPrivateFunctionInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(o); + private.type = @"jsFunction"; + [private setJSValueRef:result ctx:ctx]; + return o; + } + + methodName = propertyName; + + // Get the meta class if callee is a class + class = [callee class]; + if (callee == class) + class = objc_getMetaClass(object_getClassName(class)); + // Try split start + BOOL isMaybeSplit = NO; + if ([jsc useSplitCall]) + isMaybeSplit = [JSCocoaController isMaybeSplitCall:methodName forClass:class]; + // If not split and not NSString, return (if NSString, try to convert to JS string in callAsFunction and use native JS methods) + if (!isMaybeSplit && ![callee isKindOfClass:[NSString class]]) + { + return NULL; + } + } + } + + // Get ready for method call + JSObjectRef o = [JSCocoaController jsCocoaPrivateFunctionInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(o); + private.type = @"method"; + private.methodName = methodName; + + return o; + } + + // Struct + rawPointer valueOf + if (/*[privateObject.type isEqualToString:@"struct"] &&*/ ([propertyName isEqualToString:@"valueOf"] || [propertyName isEqualToString:@"toString"])) + { + JSObjectRef o = [JSCocoaController jsCocoaPrivateFunctionInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(o); + private.type = @"method"; + private.methodName = propertyName; + return o; + } + + + // Pointer ops + // * If we have an external Javascript context, query it + // * Handle pointer reference / dereference with JSCocoaFFIArgument + if ([privateObject.type isEqualToString:@"rawPointer"]) + { + BOOL responds = NO; + id methodName = propertyName; + responds = [privateObject respondsToSelector:NSSelectorFromString(propertyName)]; + if (!responds) + { + methodName = [NSString stringWithFormat:@"%@:", methodName]; + responds = [privateObject respondsToSelector:NSSelectorFromString(methodName)]; + } + if ([privateObject.type isEqualToString:@"rawPointer"] && responds) + { + // When calling a method with arguments, this will be used to get the instance on which to call + id callee = privateObject; + privateObject.object = callee; + // Box the private object + privateObject = [[JSCocoaPrivateObject new] autorelease]; + privateObject.object = callee; + privateObject.type = @"@"; + propertyName = methodName; + goto call; + } + } + + // External WebView value + if ([privateObject.type isEqualToString:@"externalJSValueRef"] || [[privateObject rawPointerEncoding] isEqualToString:@"^{OpaqueJSContext=}"]) + { + JSValueRef externalValue = [privateObject jsValueRef]; + JSContextRef externalCtx = externalValue ? [privateObject ctx] : [privateObject rawPointer]; + JSObjectRef externalObject = externalValue ? JSValueToObject(externalCtx, externalValue, NULL) : JSContextGetGlobalObject(externalCtx); + + if (!JSObjectHasProperty(externalCtx, externalObject, propertyNameJS)) return NULL; + JSValueRef r = JSObjectGetProperty(externalCtx, externalObject, propertyNameJS, exception); + // If WebView had an exception, re-throw it in our context + if (exception && *exception) + { + id s = [JSCocoaController formatJSException:*exception inContext:externalCtx]; + throwException(ctx, exception, [NSString stringWithFormat:@"(WebView) %@", s]); + return JSValueMakeNull(ctx); + } + JSValueRef r2 = boxedValueFromExternalContext(externalCtx, r, ctx); + return r2; + } + + + // Structs will get here when being asked javascript attributes (eg 'x' in point.x) +// NSLog(@"Asking for property %@ %@(%@)", propertyName, privateObject, privateObject.type); + + return NULL; +} + + +// +// setProperty +// call setter : propertyName -> setPropertyName +// +static bool jsCocoaObject_setProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyNameJS, JSValueRef jsValue, JSValueRef* exception) +{ + JSCocoaPrivateObject* privateObject = JSObjectGetPrivate(object); + NSString* propertyName = (NSString*)JSStringCopyCFString(kCFAllocatorDefault, propertyNameJS); + [NSMakeCollectable(propertyName) autorelease]; + +// NSLog(@"****SET %@ in ctx %x on object %x (type=%@) method=%@", propertyName, ctx, object, privateObject.type, privateObject.methodName); + + // Get delegate + JSCocoaController* jsc = [JSCocoaController controllerFromContext:ctx]; + id delegate = jsc.delegate; + + if ([privateObject.type isEqualToString:@"@"]) + { + // + // Delegate canSetProperty, setProperty + // + if (delegate) + { + // Check if setting is allowed + if ([delegate respondsToSelector:@selector(JSCocoa:canSetProperty:ofObject:toValue:inContext:exception:)]) + { + BOOL canSet = [delegate JSCocoa:jsc canSetProperty:propertyName ofObject:privateObject.object toValue:jsValue inContext:ctx exception:exception]; + if (!canSet) + { + if (!*exception) throwException(ctx, exception, [NSString stringWithFormat:@"Delegate does not allow setting %@.%@", privateObject.object, propertyName]); + return NULL; + } + } + // Check if delegate handles getting + if ([delegate respondsToSelector:@selector(JSCocoa:setProperty:ofObject:toValue:inContext:exception:)]) + { + BOOL delegateSet = [delegate JSCocoa:jsc setProperty:propertyName ofObject:privateObject.object toValue:jsValue inContext:ctx exception:exception]; + if (delegateSet) return true; + } + } + + // Special case for NSMutableArray set +// if ([privateObject.object isKindOfClass:[NSArray class]]) + if ([privateObject.object respondsToSelector:@selector(replaceObjectAtIndex:withObject:)]) + { + id array = privateObject.object; +// if (![array respondsToSelector:@selector(replaceObjectAtIndex:withObject:)]) return throwException(ctx, exception, @"Calling set on a non mutable array"), false; + id scan = [NSScanner scannerWithString:propertyName]; + NSInteger propertyIndex; + // Is asked property an int ? + BOOL convertedToInt = ([scan scanInteger:&propertyIndex]); + if (convertedToInt && [scan isAtEnd]) + { + if (propertyIndex < 0 || propertyIndex >= [array count]) return false; + + id property = NULL; + if ([JSCocoaFFIArgument unboxJSValueRef:jsValue toObject:&property inContext:ctx]) + { + [array replaceObjectAtIndex:propertyIndex withObject:property]; + return true; + } + else return false; + } + } + + + // Special case for NSMutableDictionary set +// if ([privateObject.object isKindOfClass:[NSDictionary class]]) + if ([privateObject.object respondsToSelector:@selector(setObject:forKey:)]) + { + id dictionary = privateObject.object; +// if (![dictionary respondsToSelector:@selector(setObject:forKey:)]) return throwException(ctx, exception, @"Calling set on a non mutable dictionary"), false; + + id property = NULL; + if ([JSCocoaFFIArgument unboxJSValueRef:jsValue toObject:&property inContext:ctx]) + { + [dictionary setObject:property forKey:propertyName]; + return true; + } + else return false; + } + + + // Special case for JSCocoaMemoryBuffer get + if ([privateObject.object isKindOfClass:[JSCocoaMemoryBuffer class]]) + { + id buffer = privateObject.object; + + id scan = [NSScanner scannerWithString:propertyName]; + NSInteger propertyIndex; + // Is asked property an int ? + BOOL convertedToInt = ([scan scanInteger:&propertyIndex]); + if (convertedToInt && [scan isAtEnd]) + { + if (propertyIndex < 0 || propertyIndex >= [buffer typeCount]) return NULL; + return [buffer setValue:jsValue atIndex:propertyIndex inContext:ctx]; + } + } + + + + // Try shorthand overload : obc[selector] = function + id callee = [privateObject object]; + if ([propertyName rangeOfString:@":"].location != NSNotFound) + { + JSValueRefAndContextRef v = { jsValue, ctx }; + [JSCocoaController overloadInstanceMethod:propertyName class:[callee class] jsFunction:v]; + return true; + } + + + // Can't use capitalizedString on the whole string as it will transform + // myValue + // to Myvalue (thereby destroying camel letters) + // we want MyValue + + // Capitalize only first letter + NSString* setterName = [NSString stringWithFormat:@"set%@%@:", + [[propertyName substringWithRange:NSMakeRange(0,1)] capitalizedString], + [propertyName substringWithRange:NSMakeRange(1, [propertyName length]-1)]]; + + // + // Attempt Zero arg autocall for setter + // Object.alloc().init() -> Object.alloc.init + // + SEL sel = NSSelectorFromString(setterName); + if ([callee respondsToSelector:sel]) + { + // + // Delegate canCallMethod, callMethod + // + if (delegate) + { + // Check if calling is allowed + if ([delegate respondsToSelector:@selector(JSCocoa:canCallMethod:ofObject:argumentCount:arguments:inContext:exception:)]) + { + BOOL canCall = [delegate JSCocoa:jsc canCallMethod:setterName ofObject:callee argumentCount:0 arguments:NULL inContext:ctx exception:exception]; + if (!canCall) + { + if (!*exception) throwException(ctx, exception, [NSString stringWithFormat:@"Delegate does not allow calling [%@ %@]", callee, setterName]); + return NULL; + } + } + // Check if delegate handles calling + if ([delegate respondsToSelector:@selector(JSCocoa:callMethod:ofObject:privateObject:argumentCount:arguments:inContext:exception:)]) + { + JSValueRef delegateCall = [delegate JSCocoa:jsc callMethod:setterName ofObject:callee privateObject:privateObject argumentCount:0 arguments:NULL inContext:ctx exception:exception]; + if (delegateCall) return !!delegateCall; + } + } + + // Get method pointer + Method method = class_getInstanceMethod([callee class], sel); + if (!method) method = class_getClassMethod([callee class], sel); + + // If we didn't find a method, try Distant Object + if (!method) + { + // Last chance before exception : try calling DO + BOOL b = [jsc JSCocoa:jsc setProperty:propertyName ofObject:callee toValue:jsValue inContext:ctx exception:exception]; + if (b) return YES; + + throwException(ctx, exception, [NSString stringWithFormat:@"Could not set property[%@ %@]", callee, propertyName]); + return NULL; + } + + // Extract arguments + const char* typeEncoding = method_getTypeEncoding(method); + id argumentEncodings = [JSCocoaController parseObjCMethodEncoding:typeEncoding]; + if ([[argumentEncodings objectAtIndex:0] typeEncoding] != 'v') return throwException(ctx, exception, [NSString stringWithFormat:@"(in setter) %@ must return void", setterName]), false; + + // Call address + void* callAddress = getObjCCallAddress(argumentEncodings); + + // + // ffi data + // + ffi_cif cif; + ffi_type* args[3]; + void* values[3]; + char* selector; + + selector = (char*)NSSelectorFromString(setterName); + args[0] = &ffi_type_pointer; + args[1] = &ffi_type_pointer; + values[0] = (void*)&callee; + values[1] = (void*)&selector; + + // Get arg (skip return value, instance, selector) + JSCocoaFFIArgument* arg = [argumentEncodings objectAtIndex:3]; + BOOL converted = [arg fromJSValueRef:jsValue inContext:ctx]; + if (!converted) return throwException(ctx, exception, [NSString stringWithFormat:@"(in setter) Argument %c not converted", [arg typeEncoding]]), false; + args[2] = [arg ffi_type]; + values[2] = [arg storage]; + + // Setup ffi + ffi_status prep_status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_void, args); + // + // Call ! + // + if (prep_status == FFI_OK) + { + ffi_call(&cif, callAddress, NULL, values); + } + return true; + } + + if ([callee respondsToSelector:@selector(setJSValue:forJSName:)]) + { + // Set as instance variable +// BOOL set = [callee setJSValue:jsValue forJSName:propertyNameJS]; + JSValueRefAndContextRef value = { JSValueMakeNull(ctx), ctx }; + value.value = jsValue; + + JSValueRefAndContextRef name = { JSValueMakeNull(ctx), ctx } ; + name.value = JSValueMakeString(ctx, propertyNameJS); + BOOL set = [callee setJSValue:value forJSName:name]; + if (set) return true; + } + } + + // External WebView value + if ([privateObject.type isEqualToString:@"externalJSValueRef"] || [[privateObject rawPointerEncoding] isEqualToString:@"^{OpaqueJSContext=}"]) + { + JSValueRef externalValue = [privateObject jsValueRef]; + JSContextRef externalCtx = externalValue ? [privateObject ctx] : [privateObject rawPointer]; + JSObjectRef externalObject = externalValue ? JSValueToObject(externalCtx, externalValue, NULL) : JSContextGetGlobalObject(externalCtx); + if (!externalObject) return false; + + JSValueRef convertedValue = valueToExternalContext(ctx, jsValue, externalCtx); + JSObjectSetProperty(externalCtx, externalObject, propertyNameJS, convertedValue, kJSPropertyAttributeNone, exception); + + // If WebView had an exception, re-throw it in our context + if (exception && *exception) + { + id s = [JSCocoaController formatJSException:*exception inContext:externalCtx]; + throwException(ctx, exception, [NSString stringWithFormat:@"(WebView) %@", s]); + return false; + } + + return true; + } + + // + // From here we return false to have Javascript set values on Javascript objects : valueOf, thisObject, structures + // + + // Special case for autocall : allow current js object to receive a custom valueOf method that will handle autocall + // And a thisObject property holding class for instance autocall + if ([propertyName isEqualToString:@"valueOf"]) return false; + // An out argument allocates pointer storage when calling stuff like gl version. + // JSCocoa needs to set a custom javascript property to recognize out arguments. + if ([propertyName isEqualToString:@"isOutArgument"]) return false; + // Allow general setting on structs + if ([privateObject.type isEqualToString:@"struct"]) return false; + + // Don't throw an exception if setting is allowed + if (canSetOnBoxedObjects) return false; + + // Setter fails AND WARNS if propertyName can't be set + // This happens of non-JSCocoa ObjC objects, eg NSWorkspace.sharedWorspace.someVariable = value + return throwException(ctx, exception, [NSString stringWithFormat:@"(in setter) object %@ does not support setting — Derive from that class to make it able to host any Javascript object ", privateObject.object]), false; +} + + +// +// deleteProperty +// delete property in hash +// +static bool jsCocoaObject_deleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyNameJS, JSValueRef* exception) +{ + NSString* propertyName = (NSString*)JSStringCopyCFString(kCFAllocatorDefault, propertyNameJS); + [NSMakeCollectable(propertyName) autorelease]; + + JSCocoaPrivateObject* privateObject = JSObjectGetPrivate(object); + + if (![privateObject.type isEqualToString:@"@"]) return false; + + id callee = [privateObject object]; + if (![callee respondsToSelector:@selector(setJSValue:forJSName:)]) return false; + JSValueRefAndContextRef name = { JSValueMakeNull(ctx), ctx } ; + name.value = JSValueMakeString(ctx, propertyNameJS); + return [callee deleteJSValueForJSName:name]; +} + + +// +// getPropertyNames +// enumerate dictionary keys +// +static void jsCocoaObject_getPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) +{ + JSCocoaPrivateObject* privateObject = JSObjectGetPrivate(object); + + // If we have a dictionary, add keys from allKeys + if ([privateObject.type isEqualToString:@"@"]) + { + id o = privateObject.object; + // Vend property only for classes + if (o == [o class]) + { + JSStringRef jsString = JSStringCreateWithUTF8CString(RuntimeInformationPropertyName); + JSPropertyNameAccumulatorAddName(propertyNames, jsString); + JSStringRelease(jsString); + } + if ([o isKindOfClass:[NSDictionary class]]) + { + id dictionary = privateObject.object; + id keys = [dictionary allKeys]; + + for (id key in keys) + { + JSStringRef jsString = JSStringCreateWithUTF8CString([key UTF8String]); + JSPropertyNameAccumulatorAddName(propertyNames, jsString); + JSStringRelease(jsString); + } + } + } +} + + + +// +// callAsFunction +// done in two methods. +// jsCocoaObject_callAsFunction is called first and handles +// * C and ObjC calls : calls jsCocoaObject_callAsFunction_ffi +// * Super call : in a derived ObjC class method, call this.Super(arguments) to call the parent method with jsCocoaObject_callAsFunction_ffi +// * js function calls : on an ObjC class, use of pure js functions as methods +// * toString, valueOf +// +// jsCocoaObject_callAsFunction_ffi calls a C function or an ObjC method with provided arguments. +// + +// This uses libffi to call C and ObjC. +static JSValueRef jsCocoaObject_callAsFunction_ffi(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception, NSString* superSelector, Class superSelectorClass, BOOL isVariadic, JSValueRef** argumentsToFree) +{ + JSCocoaPrivateObject* privateObject = JSObjectGetPrivate(function); + JSCocoaPrivateObject* thisPrivateObject = JSObjectGetPrivate(thisObject); + + // Return an exception if calling on NULL + if ([thisPrivateObject object] == NULL && !privateObject.xml) return throwException(ctx, exception, @"jsCocoaObject_callAsFunction : call with null object"), NULL; + + // Function address + void* callAddress = NULL; + + // Number of arguments of called method or function + NSUInteger callAddressArgumentCount = 0; + + // Arguments encoding + // Holds return value encoding as first element + NSMutableArray* argumentEncodings = nil; + + // Calling ObjC ? If NO, we're calling C + BOOL callingObjC = NO; + // Structure return (objc_msgSend_stret) + BOOL usingStret = NO; + // Calling instance... , replaced with init... and released, making the js object sole owner + BOOL callingInstance = NO; + + + // Get delegate + JSCocoaController* jsc = [JSCocoaController controllerFromContext:ctx]; + id delegate = jsc.delegate; + + // + // ObjC setup + // + id callee = NULL, methodName = NULL, functionName = NULL; + + // Calls can be made on boxed ObjC objects AND JSCocoaPrivateObjects + if ([privateObject.type isEqualToString:@"method"] && ([thisPrivateObject.type isEqualToString:@"@"] || [thisPrivateObject.object class] == [JSCocoaPrivateObject class])) + { + callingObjC = YES; + callee = [thisPrivateObject object]; + methodName = superSelector ? superSelector : [NSMutableString stringWithString:privateObject.methodName]; +// NSLog(@"calling %@.%@", callee, methodName); + + // + // Delegate canCallMethod, callMethod + // Called first so it gets a chance to do handle custom messages + // + if (delegate) + { + // Check if calling is allowed + if ([delegate respondsToSelector:@selector(JSCocoa:canCallMethod:ofObject:argumentCount:arguments:inContext:exception:)]) + { + BOOL canCall = [delegate JSCocoa:jsc canCallMethod:methodName ofObject:callee argumentCount:argumentCount arguments:arguments inContext:ctx exception:exception]; + if (!canCall) + { + if (!*exception) throwException(ctx, exception, [NSString stringWithFormat:@"Delegate does not allow calling [%@ %@]", callee, methodName]); + return NULL; + } + } + // Check if delegate handles calling + if ([delegate respondsToSelector:@selector(JSCocoa:callMethod:ofObject:privateObject:argumentCount:arguments:inContext:exception:)]) + { + JSValueRef delegateCall = [delegate JSCocoa:jsc callMethod:methodName ofObject:callee privateObject:thisPrivateObject argumentCount:argumentCount arguments:arguments inContext:ctx exception:exception]; + if (delegateCall) return delegateCall; + } + } + // Special case for alloc autocall — do not retain alloced result as it might crash (eg [[NSLocale alloc] retain] fails in ObjC) + if (!useAutoCall && argumentCount == 0 && [methodName isEqualToString:@"alloc"]) + { + id allocatedObject = [callee alloc]; + JSObjectRef jsObject = [JSCocoaController jsCocoaPrivateObjectInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(jsObject); + private.type = @"@"; + [private setObjectNoRetain:allocatedObject]; + return jsObject; + } + + + // Instance call +/* + if ([callee class] == callee && [methodName isEqualToString:@"instance"]) + { + if (argumentCount > 1) return throwException(ctx, exception, @"Invalid argument count in instance call : must be 0 or 1"), NULL; + return [callee instanceWithContext:ctx argumentCount:argumentCount arguments:arguments exception:exception]; + } +*/ + // Check selector + if (![callee respondsToSelector:NSSelectorFromString(methodName)]) + { + // + // Split call + // set( { value : '5', forKey : 'hello' } ) + // -> setValue:forKey: + // + if ([jsc useSplitCall]) + { + id splitMethodName = privateObject.methodName; + id class = [callee class]; + if (callee == class) + class = objc_getMetaClass(object_getClassName(class)); + BOOL isSplitCall = [JSCocoaController trySplitCall:&splitMethodName class:class argumentCount:&argumentCount arguments:&arguments ctx:ctx]; + if (isSplitCall) + { + methodName = splitMethodName; + // trySplitCall returned new arguments that we'll need to free later on + *argumentsToFree = arguments; + } + } + } + + // Get method pointer + Method method = class_getInstanceMethod([callee class], NSSelectorFromString(methodName)); + if (!method) method = class_getClassMethod([callee class], NSSelectorFromString(methodName)); + + // If we didn't find a method, try an instance call, then try treating object as Javascript string, then try Distant Object + if (!method) + { + // Instance Check + if ([methodName hasPrefix:@"instance"]) + { + id initMethodName = [NSString stringWithFormat:@"init%@", [methodName substringFromIndex:8]]; + id class = [callee class]; + method = class_getInstanceMethod(class, NSSelectorFromString(initMethodName)); + methodName = initMethodName; + callee = [class alloc]; + callingInstance = YES; + } + + if (!method) + { + // (First) Last chance before exception : try treating callee as a Javascript string + if ([callee isKindOfClass:[NSString class]]) + { + id script = [NSString stringWithFormat:@"String.prototype.%@", methodName]; + JSStringRef jsScript = JSStringCreateWithUTF8CString([script UTF8String]); + JSValueRef result = JSEvaluateScript(ctx, jsScript, NULL, NULL, 1, NULL); + JSStringRelease(jsScript); + if (result && JSValueGetType(ctx, result) == kJSTypeObject) + { + JSStringRef string = JSStringCreateWithCFString((CFStringRef)callee); + JSValueRef stringValue = JSValueMakeString(ctx, string); + JSStringRelease(string); + + JSObjectRef functionObject = JSValueToObject(ctx, result, NULL); + JSObjectRef jsThisObject = JSValueToObject(ctx, stringValue, NULL); + JSValueRef r = JSObjectCallAsFunction(ctx, functionObject, jsThisObject, argumentCount, arguments, NULL); + return r; + } + } + + // Last chance before exception : try calling DO + JSValueRef res = [jsc JSCocoa:jsc callMethod:methodName ofObject:callee privateObject:thisPrivateObject argumentCount:argumentCount arguments:arguments inContext:ctx exception:exception]; + if (res) return res; + + return throwException(ctx, exception, [NSString stringWithFormat:@"jsCocoaObject_callAsFunction : method %@ of object %@ not found — remnant of a split call ?", methodName, [callee class]]), NULL; + } + } + + // Extract arguments + const char* typeEncoding = method_getTypeEncoding(method); +// NSLog(@"method %@ encoding=%s", methodName, typeEncoding); + argumentEncodings = [JSCocoaController parseObjCMethodEncoding:typeEncoding]; + if (!argumentEncodings) { + return throwException(ctx, exception, [NSString stringWithFormat:@"jsCocoaObject_callAsFunction could not parse type encodings %s of [%@ %@]", [JSCocoa typeEncodingOfMethod:methodName class:[[callee class] description]], methodName, [callee class]]), NULL; + } + // Function arguments is all arguments minus return value and [instance, selector] params to objc_send + callAddressArgumentCount = [argumentEncodings count]-3; + + // Get call address + callAddress = getObjCCallAddress(argumentEncodings); + } + + // + // C setup + // + if (!callingObjC) + { + if (!privateObject.xml) return throwException(ctx, exception, @"jsCocoaObject_callAsFunction : no xml in object = nothing to call (Autocall problem ? To call argless objCobject.method(), remove the parens if autocall is ON)") , NULL; +// NSLog(@"C encoding=%@", privateObject.xml); + argumentEncodings = [JSCocoaController parseCFunctionEncoding:privateObject.xml functionName:&functionName]; + // Grab symbol + callAddress = dlsym(RTLD_DEFAULT, [functionName UTF8String]); + if (!callAddress) return throwException(ctx, exception, [NSString stringWithFormat:@"Function %@ not found", functionName]), NULL; + // Function arguments is all arguments minus return value + callAddressArgumentCount = [argumentEncodings count]-1; + + // + // Delegate canCallFunction + // + if (delegate) + { + // Check if calling is allowed + if ([delegate respondsToSelector:@selector(JSCocoa:canCallFunction:argumentCount:arguments:inContext:exception:)]) + { + BOOL canCall = [delegate JSCocoa:jsc canCallFunction:functionName argumentCount:argumentCount arguments:arguments inContext:ctx exception:exception]; + if (!canCall) + { + if (!*exception) throwException(ctx, exception, [NSString stringWithFormat:@"Delegate does not allow calling function %@", functionName]); + return NULL; + } + } + } + } + + // + // Variadic call ? + // If argument count doesn't match descripted argument count, + // we may have a variadic call + // + // Possibly account for a missing terminating NULL in ObjC variadic method + // -> allows calling + // [NSArray arrayWithObjects:'hello', 'world'] + // instead of + // [NSArray arrayWithObjects:'hello', 'world', null] + // + BOOL sugarCheckVariadic = NO; + // Check if selector or method names matches a known variadic method. This may be a false positive ... + if (isVariadic) + { + // ... so we check further. + if (methodName) isVariadic = [[JSCocoaController controllerFromContext:ctx] isMethodVariadic:methodName class:[callee class]]; + else isVariadic = [[JSCocoaController controllerFromContext:ctx] isFunctionVariadic:functionName]; + + // Bail if not variadic + if (!isVariadic) + { + return throwException(ctx, exception, [NSString stringWithFormat:@"Bad argument count in %@ : expected %d, got %d", functionName ? functionName : methodName, callAddressArgumentCount, argumentCount]), NULL; + } + // Sugar check : if last object is not NULL, account for it + if (isVariadic && callingObjC && argumentCount && !JSValueIsNull(ctx, arguments[argumentCount-1])) + { + // Will be tested during argument conversion + sugarCheckVariadic = YES; + argumentCount++; + } + } + else + { + if (callAddressArgumentCount != argumentCount) + { + return throwException(ctx, exception, [NSString stringWithFormat:@"Bad argument count in %@ : expected %d, got %d", functionName ? functionName : methodName, callAddressArgumentCount, argumentCount]), NULL; + } + } + + // + // ffi data + // + ffi_cif cif; + ffi_type** args = NULL; + void** values = NULL; + char* selector; + // super call + struct objc_super _super; + void* superPointer; + + // Total number of arguments to ffi_call + NSUInteger effectiveArgumentCount = argumentCount + (callingObjC ? 2 : 0); + if (effectiveArgumentCount > 0) + { + args = malloc(sizeof(ffi_type*)*effectiveArgumentCount); + values = malloc(sizeof(void*)*effectiveArgumentCount); + + // If calling ObjC, setup instance and selector + int i, idx = 0; + if (callingObjC) + { + selector = (char*)NSSelectorFromString(methodName); + args[0] = &ffi_type_pointer; + args[1] = &ffi_type_pointer; + values[0] = (void*)&callee; + values[1] = (void*)&selector; + idx = 2; + + // Super handling + if (superSelector) + { + if (superSelectorClass == nil) return throwException(ctx, exception, [NSString stringWithFormat:@"Null superclass in %@", callee]), NULL; + callAddress = objc_msgSendSuper; + if (usingStret) callAddress = objc_msgSendSuper_stret; + _super.receiver = callee; +#if __LP64__ + _super.super_class = superSelectorClass; +#elif TARGET_IPHONE_SIMULATOR || !TARGET_OS_IPHONE + _super.class = superSelectorClass; +#else + _super.super_class = superSelectorClass; +#endif + superPointer = &_super; + values[0] = &superPointer; +// NSLog(@"superClass=%@ (old=%@) (%@) function=%x", superSelectorClass, [callee superclass], [callee class], function); + } + } + + // Setup arguments, unboxing or converting data + for (i=0; i= callAddressArgumentCount) + { + arg = [[JSCocoaFFIArgument alloc] init]; + [arg setTypeEncoding:'@']; + [arg autorelease]; + } + else + arg = [argumentEncodings objectAtIndex:idx+1]; + + // Convert argument + JSValueRef jsValue = sugarCheckVariadic && i == argumentCount-1 ? JSValueMakeNull(ctx) : arguments[i]; + BOOL shouldConvert = YES; + // Check type o modifiers + if ([arg typeEncoding] == '^') + { + // If holding a JSCocoaOutArgument, allocate custom storage + if (JSValueGetType(ctx, jsValue) == kJSTypeObject) + { + JSStringRef jsName = JSStringCreateWithUTF8CString("isOutArgument"); + BOOL isOutArgument = JSValueToBoolean(ctx, JSObjectGetProperty(ctx, JSValueToObject(ctx, jsValue, NULL), jsName, NULL)); + JSStringRelease(jsName); + if (isOutArgument) + { + id unboxed = nil; + [JSCocoaFFIArgument unboxJSValueRef:jsValue toObject:&unboxed inContext:ctx]; + if (unboxed && [unboxed isKindOfClass:[JSCocoaOutArgument class]]) + { + if (![(JSCocoaOutArgument*)unboxed mateWithJSCocoaFFIArgument:arg]) return throwException(ctx, exception, [NSString stringWithFormat:@"Pointer argument %@ not handled", [arg pointerTypeEncoding]]), NULL; + shouldConvert = NO; + [arg setIsOutArgument:YES]; + } + if (unboxed && [unboxed isKindOfClass:[JSCocoaMemoryBuffer class]]) + { + JSCocoaMemoryBuffer* buffer = unboxed; + [arg setTypeEncoding:[arg typeEncoding] withCustomStorage:[buffer pointerForIndex:0]]; + shouldConvert = NO; + [arg setIsOutArgument:YES]; + } + } + } + + if (shouldConvert) + { + // Allocate default storage + [arg allocateStorage]; + } + + } + + args[idx] = [arg ffi_type]; + if (shouldConvert) + { + BOOL converted = [arg fromJSValueRef:jsValue inContext:ctx]; + if (!converted) + return throwException(ctx, exception, [NSString stringWithFormat:@"Argument %c not converted", [arg typeEncoding]]), NULL; + } + values[idx] = [arg storage]; + } + } + + // Get return value holder + id returnValue = [argumentEncodings objectAtIndex:0]; + + // Allocate return value storage if it's a pointer + if ([returnValue typeEncoding] == '^') + [returnValue allocateStorage]; + + // Setup ffi + ffi_status prep_status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, (unsigned int)effectiveArgumentCount, [returnValue ffi_type], args); + + // + // Call ! + // + if (prep_status == FFI_OK) + { + void* storage = [returnValue storage]; + if ([returnValue ffi_type] == &ffi_type_void) storage = NULL; + + // Catch exceptions when calling ObjC + if (callingObjC) + { + @try + { + ffi_call(&cif, callAddress, storage, values); + } + @catch (NSException* e) + { + if (effectiveArgumentCount > 0) + { + free(args); + free(values); + } + [JSCocoaFFIArgument boxObject:e toJSValueRef:exception inContext:ctx]; + return NULL; + } + } + else + ffi_call(&cif, callAddress, storage, values); + } + + if (effectiveArgumentCount > 0) + { + free(args); + free(values); + } + if (prep_status != FFI_OK) return throwException(ctx, exception, @"ffi_prep_cif failed"), NULL; + + // Return now if our function returns void + // Return null as a JSValueRef to avoid crashing + if ([returnValue ffi_type] == &ffi_type_void) return JSValueMakeNull(ctx); + + // Else, convert return value + JSValueRef jsReturnValue = NULL; + BOOL converted = [returnValue toJSValueRef:&jsReturnValue inContext:ctx]; + if (!converted) return throwException(ctx, exception, [NSString stringWithFormat:@"Return value not converted in %@", methodName?methodName:functionName]), NULL; + + // Instance call : release object to make js object sole owner + if (callingInstance) + { + JSCocoaPrivateObject* private = JSObjectGetPrivate(JSValueToObject(ctx, jsReturnValue, NULL)); + [private.object release]; + } + + return jsReturnValue; +} + +// +// This method handles +// * C and ObjC calls +// * Super call : retrieves the method name to call, thereby giving new arguments to jsCocoaObject_callAsFunction_ffi +// * js function calls : on an ObjC class, use of pure js functions as methods +// * toString, valueOf +// +static JSValueRef jsCocoaObject_callAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + JSCocoaPrivateObject* privateObject = JSObjectGetPrivate(function); + JSValueRef* superArguments = NULL; + id superSelector = NULL; + id superSelectorClass = NULL; + + // Pure JS functions for derived ObjC classes + if ([privateObject jsValueRef]) + { + if ([privateObject.type isEqualToString:@"jsFunction"]) + { + JSObjectRef jsFunction = JSValueToObject(ctx, [privateObject jsValueRef], NULL); + JSValueRef ret = JSObjectCallAsFunction(ctx, jsFunction, thisObject, argumentCount, arguments, exception); + return ret; + } + else + if ([privateObject.type isEqualToString:@"externalJSValueRef"]) + { + JSContextRef externalCtx = [privateObject ctx]; + JSObjectRef jsFunction = JSValueToObject(externalCtx, [privateObject jsValueRef], NULL); + if (!jsFunction) + { + throwException(ctx, exception, [NSString stringWithFormat:@"WebView call : value not a function"]); + return JSValueMakeNull(ctx); + } + + // Retrieve 'this' : either the global external object (window), or a result from previous calll + JSObjectRef externalThisObject; + JSCocoaPrivateObject* privateThis = JSObjectGetPrivate(thisObject); + if ([privateThis jsValueRef]) externalThisObject = JSValueToObject(externalCtx, [privateThis jsValueRef], NULL); + else externalThisObject = JSContextGetGlobalObject(externalCtx); + + if (!externalThisObject) + { + throwException(ctx, exception, [NSString stringWithFormat:@"WebView call : externalThisObject not found"]); + return JSValueMakeNull(ctx); + } + + // Convert arguments to WebView context + JSValueRef* convertedArguments = NULL; + if (argumentCount) convertedArguments = malloc(sizeof(JSValueRef)*argumentCount); + for (int i=0; i", + [self class], + self, + ((id)self == (id)[self class]) ? @"Class" : @"", + [boxedObject class], + boxedObject, + retainCount]; +} + +@end + diff --git a/jscocoa/JSCocoa/JSCocoaFFIArgument.h b/jscocoa/JSCocoa/JSCocoaFFIArgument.h new file mode 100644 index 0000000..911d6d5 --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoaFFIArgument.h @@ -0,0 +1,97 @@ +// +// JSCocoaFFIArgument.h +// JSCocoa +// +// Created by Patrick Geiller on 14/07/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if !TARGET_IPHONE_SIMULATOR && !TARGET_OS_IPHONE +#import +#import +#define MACOSX +#include +#endif +#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#import "iPhone/libffi/ffi.h" +#endif + +@interface JSCocoaFFIArgument : NSObject { + char typeEncoding; + NSString* structureTypeEncoding; + NSString* pointerTypeEncoding; + + void* ptr; + + ffi_type structureType; + + id customData; + BOOL isReturnValue; + BOOL ownsStorage; + BOOL isOutArgument; +} + +- (NSString*)typeDescription; + +- (BOOL)setTypeEncoding:(char)encoding; +- (BOOL)setTypeEncoding:(char)encoding withCustomStorage:(void*)storagePtr; +- (void)setStructureTypeEncoding:(NSString*)encoding; +- (void)setStructureTypeEncoding:(NSString*)encoding withCustomStorage:(void*)storagePtr; +- (void)setPointerTypeEncoding:(NSString*)encoding; + ++ (int)sizeOfTypeEncoding:(char)encoding; ++ (int)alignmentOfTypeEncoding:(char)encoding; + ++ (ffi_type*)ffi_typeForTypeEncoding:(char)encoding; + ++ (int)sizeOfStructure:(NSString*)encoding; + + ++ (NSArray*)typeEncodingsFromStructureTypeEncoding:(NSString*)structureTypeEncoding; ++ (NSArray*)typeEncodingsFromStructureTypeEncoding:(NSString*)structureTypeEncoding parsedCount:(NSInteger*)count; + + ++ (NSString*)structureNameFromStructureTypeEncoding:(NSString*)structureTypeEncoding; ++ (NSString*)structureFullTypeEncodingFromStructureTypeEncoding:(NSString*)structureTypeEncoding; ++ (NSString*)structureFullTypeEncodingFromStructureName:(NSString*)structureName; ++ (NSString*)structureTypeEncodingDescription:(NSString*)structureTypeEncoding; + ++ (BOOL)fromJSValueRef:(JSValueRef)value inContext:(JSContextRef)ctx typeEncoding:(char)typeEncoding fullTypeEncoding:(NSString*)fullTypeEncoding fromStorage:(void*)ptr; + ++ (BOOL)toJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx typeEncoding:(char)typeEncoding fullTypeEncoding:(NSString*)fullTypeEncoding fromStorage:(void*)ptr; + ++ (NSInteger)structureToJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx fromCString:(char*)c fromStorage:(void**)storage; ++ (NSInteger)structureToJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx fromCString:(char*)c fromStorage:(void**)ptr initialValues:(JSValueRef*)initialValues initialValueCount:(NSInteger)initialValueCount convertedValueCount:(NSInteger*)convertedValueCount; ++ (NSInteger)structureFromJSObjectRef:(JSObjectRef)value inContext:(JSContextRef)ctx inParentJSValueRef:(JSValueRef)parentValue fromCString:(char*)c fromStorage:(void**)ptr; + ++ (void)alignPtr:(void**)ptr accordingToEncoding:(char)encoding; ++ (void)advancePtr:(void**)ptr accordingToEncoding:(char)encoding; + + +- (void*)allocateStorage; +- (void*)allocatePointerStorage; +- (void**)storage; +- (void**)rawStoragePointer; +- (char)typeEncoding; +- (NSString*)structureTypeEncoding; +- (id)pointerTypeEncoding; + + +- (void)setIsReturnValue:(BOOL)v; +- (BOOL)isReturnValue; +- (void)setIsOutArgument:(BOOL)v; +- (BOOL)isOutArgument; + +- (BOOL)fromJSValueRef:(JSValueRef)value inContext:(JSContextRef)ctx; +- (BOOL)toJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx; + + ++ (BOOL)boxObject:(id)o toJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx; ++ (BOOL)unboxJSValueRef:(JSValueRef)value toObject:(id*)o inContext:(JSContextRef)ctx; ++ (BOOL)unboxJSArray:(JSObjectRef)value toObject:(id*)o inContext:(JSContextRef)ctx; ++ (BOOL)unboxJSHash:(JSObjectRef)value toObject:(id*)o inContext:(JSContextRef)ctx; + + +- (ffi_type*)ffi_type; + +@end diff --git a/jscocoa/JSCocoa/JSCocoaFFIArgument.m b/jscocoa/JSCocoa/JSCocoaFFIArgument.m new file mode 100644 index 0000000..2558327 --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoaFFIArgument.m @@ -0,0 +1,1346 @@ +// +// JSCocoaFFIArgument.m +// JSCocoa +// +// Created by Patrick Geiller on 14/07/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "JSCocoaFFIArgument.h" +#import "JSCocoaController.h" +#import "JSCocoaPrivateObject.h" +#import + + +#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#import "GDataDefines.h" +#import "GDataXMLNode.h" +#endif + +@implementation JSCocoaFFIArgument + +- (id)init +{ + self = [super init]; + + ptr = NULL; + typeEncoding = 0; + isReturnValue = NO; + ownsStorage = YES; + isOutArgument = NO; + + structureTypeEncoding = nil; + structureType.elements = NULL; + + pointerTypeEncoding = nil; + + // Used to store string data while converting JSStrings to char* + customData = nil; + + return self; +} + +- (void)cleanUp +{ + if (structureTypeEncoding) [structureTypeEncoding release]; + if (pointerTypeEncoding) [pointerTypeEncoding release]; + if (ptr && ownsStorage) free(ptr); + if (customData) [customData release]; + + if (structureType.elements) free(structureType.elements); + ptr = NULL; +} + +- (void)dealloc +{ + [self cleanUp]; + [super dealloc]; +} +- (void)finalize +{ + [self cleanUp]; + [super finalize]; +} + +- (NSString*)description +{ + return [NSString stringWithFormat:@"JSCocoaFFIArgument %x typeEncoding=%c %@ isReturnValue=%d storage=%x", self, + typeEncoding, + (structureTypeEncoding ? structureTypeEncoding : @""), + isReturnValue, ptr]; +} + ++ (NSString*)typeDescriptionForTypeEncoding:(char)typeEncoding fullTypeEncoding:(NSString*)fullTypeEncoding +{ + switch (typeEncoding) + { + case _C_VOID: return @"void"; + case _C_ID: return @"ObjC object"; + case _C_CLASS: return @"ObjC class"; + case _C_CHR: return @"char"; + case _C_UCHR: return @"unsigned char"; + case _C_SHT: return @"short"; + case _C_USHT: return @"unsigned short"; + case _C_INT: return @"int"; + case _C_UINT: return @"unsigned int"; + case _C_LNG: return @"long"; + case _C_ULNG: return @"unsigned long"; + case _C_LNG_LNG: return @"long long"; + case _C_ULNG_LNG:return @"unsigned long long"; + case _C_FLT: return @"float"; + case _C_DBL: return @"double"; + case '{': + { + // Special case for getting raw JSValues to ObjC + BOOL isJSStruct = [fullTypeEncoding hasPrefix:@"{JSValueRefAndContextRef"]; + if (isJSStruct) + { + return @"(JSCocoa structure used to pass JSValueRef without conversion)"; + } + +// if (!JSValueIsObject(ctx, value)) return NO; +// JSObjectRef object = JSValueToObject(ctx, value, NULL); +// void* p = ptr; +// id r = [JSCocoaFFIArgument structureFullTypeEncodingFromStructureTypeEncoding:fullTypeEncoding]; +// if (!r) return [NSString stringWithFormat:@"(unknown structure %@)", fullTypeEncoding]; + return [JSCocoaFFIArgument structureTypeEncodingDescription:fullTypeEncoding]; + } + case _C_SEL: return @"selector"; + case _C_CHARPTR: return @"char*"; + case _C_BOOL: return @"BOOL"; + case _C_PTR: return @"pointer"; + case _C_UNDEF: return @"(function pointer or block?)"; + } + return @"(unknown)"; +} + +- (NSString*)typeDescription +{ + return [[self class] typeDescriptionForTypeEncoding:typeEncoding fullTypeEncoding:structureTypeEncoding]; +} + +#pragma mark Getters / Setters + +// +// Needed because libffi needs at least sizeof(long) as return value storage +// +- (void)setIsReturnValue:(BOOL)v +{ + isReturnValue = v; +} +- (BOOL)isReturnValue +{ + return isReturnValue; +} + +- (void)setIsOutArgument:(BOOL)v +{ + isOutArgument = v; +} +- (BOOL)isOutArgument +{ + return isOutArgument; +} + +- (char)typeEncoding +{ + return typeEncoding; +} + +- (BOOL)setTypeEncoding:(char)encoding +{ + if ([JSCocoaFFIArgument sizeOfTypeEncoding:encoding] == -1) { + NSLog(@"Bad type encoding %c", encoding); + return NO; + }; + + typeEncoding = encoding; + [self allocateStorage]; + + return YES; +} + +- (BOOL)setTypeEncoding:(char)encoding withCustomStorage:(void*)storagePtr +{ + if ([JSCocoaFFIArgument sizeOfTypeEncoding:encoding] == -1) { + NSLog(@"Bad type encoding %c", encoding); + return NO; + }; + + typeEncoding = encoding; + ownsStorage = NO; + ptr = storagePtr; + + return YES; +} + +- (NSString*)structureTypeEncoding +{ + return structureTypeEncoding; +} + +- (void)setStructureTypeEncoding:(NSString*)encoding +{ + [self setStructureTypeEncoding:encoding withCustomStorage:NULL]; +} + +- (void)setStructureTypeEncoding:(NSString*)encoding withCustomStorage:(void*)storagePtr +{ + typeEncoding = '{'; + structureTypeEncoding = [[NSString alloc] initWithString:encoding]; + + if (storagePtr) + { + ownsStorage = NO; + ptr = storagePtr; + } + else [self allocateStorage]; + + id types = [JSCocoaFFIArgument typeEncodingsFromStructureTypeEncoding:encoding]; + NSUInteger elementCount = [types count]; + + // + // Build FFI type + // + structureType.size = 0; + structureType.alignment = 0; + structureType.type = FFI_TYPE_STRUCT; + structureType.elements = malloc(sizeof(ffi_type*)*(elementCount+1)); // +1 is trailing NULL + + int i = 0; + for (id type in types) + { + char charEncoding = *(char*)[type UTF8String]; + structureType.elements[i++] = [JSCocoaFFIArgument ffi_typeForTypeEncoding:charEncoding]; + } + structureType.elements[elementCount] = NULL; +} + +// +// type o handling +// (pointers passed as arguments to a function, function writes values to these arguments) +// +- (void)setPointerTypeEncoding:(NSString*)encoding +{ + typeEncoding = '^'; + pointerTypeEncoding = [[NSString alloc] initWithString:encoding]; +} + +- (id)pointerTypeEncoding +{ + return pointerTypeEncoding; +} + + +- (ffi_type*)ffi_type +{ + if (!typeEncoding) return NULL; + if (pointerTypeEncoding) return &ffi_type_pointer; + + if (typeEncoding == '{') return &structureType; + + return [JSCocoaFFIArgument ffi_typeForTypeEncoding:typeEncoding]; +} + + +#pragma mark Storage + +- (void*)allocateStorage +{ + if (!typeEncoding) return NSLog(@"No type encoding set in %@", self), NULL; + + // NO ! will destroy structureTypeEncoding +// [self cleanUp]; + // Special case for structs + if (typeEncoding == '{') + { +// NSLog(@"allocateStorage: Allocating struct"); + // Some front padding for alignment and tail padding for structure + // ( http://developer.apple.com/documentation/DeveloperTools/Conceptual/LowLevelABI/Articles/IA32.html ) + // Structures are tail-padded to 32-bit multiples. + + // +16 for alignment + // +4 for tail padding +// ptr = malloc([JSCocoaFFIArgument sizeOfStructure:structureTypeEncoding] + 16 + 4); + ptr = malloc([JSCocoaFFIArgument sizeOfStructure:structureTypeEncoding] + 4); + return ptr; + } + + int size = [JSCocoaFFIArgument sizeOfTypeEncoding:typeEncoding]; + + // Bail if we can't handle our type + if (size == -1) return NSLog(@"Can't handle type %c", typeEncoding), NULL; + if (size >= 0) + { + int minimalReturnSize = sizeof(long); + if (isReturnValue && size < minimalReturnSize) size = minimalReturnSize; + ptr = malloc(size); + } +// NSLog(@"Allocated size=%d (%x) for object %@", size, ptr, self); + + return ptr; +} + +// type o : out arguments (eg fn(int* pointerToIntResult)) +- (void*)allocatePointerStorage +{ + typeEncoding = [pointerTypeEncoding UTF8String][1]; + if (typeEncoding == '{') + { + structureTypeEncoding = [pointerTypeEncoding substringFromIndex:1]; + [structureTypeEncoding retain]; + } + [self allocateStorage]; + return ptr; +} + +- (void**)storage +{ + if (typeEncoding == '{') + { +/* + int alignOnSize = 16; + + int address = (int)ptr; + if ((address % alignOnSize) != 0) + address = (address+alignOnSize) & ~(alignOnSize-1); +*/ + if (pointerTypeEncoding) return &ptr; +// return (void**)address; + } + + // Type o : return writable address +// if (pointerTypeEncoding) + if (isOutArgument) + { + return &ptr; + } + + return ptr; +} + +- (void**)rawStoragePointer +{ + return ptr; +} + +// This destroys the original pointer value by modifying it in place : maybe change to returning the new address ? ++ (void)alignPtr:(void**)ptr accordingToEncoding:(char)encoding +{ + int alignOnSize = [JSCocoaFFIArgument alignmentOfTypeEncoding:encoding]; + + long address = (long)*ptr; + if ((address % alignOnSize) != 0) + address = (address+alignOnSize) & ~(alignOnSize-1); +// NSLog(@"alignOf(%c)=%d", encoding, alignOnSize); + + *ptr = (void*)address; +} + +// This destroys the original pointer value by modifying it in place : maybe change to returning the new address ? ++ (void)advancePtr:(void**)ptr accordingToEncoding:(char)encoding +{ + long address = (long)*ptr; + address += [JSCocoaFFIArgument sizeOfTypeEncoding:encoding]; + *ptr = (void*)address; +} + + +#pragma mark Conversion + +// +// Convert from js value +// +- (BOOL)fromJSValueRef:(JSValueRef)value inContext:(JSContextRef)ctx +{ + BOOL r = [JSCocoaFFIArgument fromJSValueRef:value inContext:ctx typeEncoding:typeEncoding fullTypeEncoding:structureTypeEncoding fromStorage:ptr]; + if (!r) + { + NSLog(@"fromJSValueRef FAILED, jsType=%d encoding=%c structureEncoding=%@", JSValueGetType(ctx, value), typeEncoding, structureTypeEncoding); + } + return r; +} + ++ (BOOL)fromJSValueRef:(JSValueRef)value inContext:(JSContextRef)ctx typeEncoding:(char)typeEncoding fullTypeEncoding:(NSString*)fullTypeEncoding fromStorage:(void*)ptr +{ + if (!typeEncoding) return NO; + +// JSType type = JSValueGetType(ctx, value); +// NSLog(@"JSType=%d encoding=%c self=%x", type, typeEncoding, self); + + switch (typeEncoding) + { + case _C_ID: + case _C_CLASS: + { + return [self unboxJSValueRef:value toObject:ptr inContext:ctx]; + } + + case _C_CHR: + case _C_UCHR: + case _C_SHT: + case _C_USHT: + case _C_INT: + case _C_UINT: + case _C_LNG: + case _C_ULNG: + case _C_LNG_LNG: + case _C_ULNG_LNG: + case _C_FLT: + case _C_DBL: + { + double number = JSValueToNumber(ctx, value, NULL); +// unsigned int u = number; +// NSLog(@"type=%d typeEncoding=%c n=%f uint=%d, %d", JSValueGetType(ctx, value), typeEncoding, number, (unsigned int)number, u); + + switch (typeEncoding) + { + case _C_CHR: *(char*)ptr = (char)number; break; + case _C_UCHR: *(unsigned char*)ptr = (unsigned char)number; break; + case _C_SHT: *(short*)ptr = (short)number; break; + case _C_USHT: *(unsigned short*)ptr = (unsigned short)number; break; + case _C_INT: + case _C_UINT: + { +#ifdef __BIG_ENDIAN__ + // Two step conversion : to unsigned int then to int. One step conversion fails on PPC. + unsigned int uint = (unsigned int)number; + *(signed int*)ptr = (signed int)uint; + break; +#endif +#ifdef __LITTLE_ENDIAN__ + *(int*)ptr = (int)number; + break; +#endif + } +/* + case _C_UINT: + { + // Two step conversion : to unsigned int then to int. One step conversion fails on PPC. + int uint = (int)number; + unsigned int u = (unsigned)uint; + NSLog(@"%d %u", uint, u); + *(signed int*)ptr = (signed int)uint; + break; + } +*/ +// case _C_UINT: *(unsigned int*)ptr = (unsigned int)number; break; + case _C_LNG: *(long*)ptr = (long)number; break; + case _C_ULNG: *(unsigned long*)ptr = (unsigned long)number; break; + case _C_LNG_LNG: *(long long*)ptr = (long long)number; break; + case _C_ULNG_LNG: *(unsigned long long*)ptr = (unsigned long long)number; break; + case _C_FLT: *(float*)ptr = (float)number; break; + case _C_DBL: *(double*)ptr = (double)number; break; + } + return YES; + } + case '{': + { + // Special case for getting raw JSValues to ObjC +// BOOL isJSStruct = NSOrderedSame == [fullTypeEncoding compare:@"{JSValueRefAndContextRef" options:0 range:NSMakeRange(0, sizeof("{JSValueRefAndContextRef")-1)]; + BOOL isJSStruct = [fullTypeEncoding hasPrefix:@"{JSValueRefAndContextRef"]; + + if (isJSStruct) + { + // Beware ! This context is not the global context and will be valid only for that call. + // Other uses (closures) use the global context via JSCocoaController. + JSValueRefAndContextRef* jsStruct = (JSValueRefAndContextRef*)ptr; + jsStruct->value = value; + jsStruct->ctx = ctx; + return YES; + } + + if (!JSValueIsObject(ctx, value)) return NO; + JSObjectRef object = JSValueToObject(ctx, value, NULL); + void* p = ptr; + id type = [JSCocoaFFIArgument structureFullTypeEncodingFromStructureTypeEncoding:fullTypeEncoding]; + NSInteger numParsed = [JSCocoaFFIArgument structureFromJSObjectRef:object inContext:ctx inParentJSValueRef:NULL fromCString:(char*)[type UTF8String] fromStorage:&p]; + return numParsed; + } + case _C_SEL: + { + id str = NSStringFromJSValue(value, ctx); + *(SEL*)ptr = NSSelectorFromString(str); + return YES; + } + case _C_CHARPTR: + { + id str = NSStringFromJSValue(value, ctx); + *(char**)ptr = (char*)[str UTF8String]; + return YES; + } + case _C_BOOL: + { + bool b = JSValueToBoolean(ctx, value); + *(BOOL*)ptr = b; + return YES; + } + + case _C_PTR: + { + return [self unboxJSValueRef:value toObject:ptr inContext:ctx]; + } + + } + return NO; +} + + +// +// Convert to js value +// +- (BOOL)toJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx +{ + void* p = ptr; +#ifdef __BIG_ENDIAN__ + long v; + // Return value was padded, need to do some shifting on PPC + if (isReturnValue) + { + int size = [JSCocoaFFIArgument sizeOfTypeEncoding:typeEncoding]; + int paddedSize = sizeof(long); + + if (size > 0 && size < paddedSize && paddedSize == 4) + { + v = *(long*)ptr; + v = CFSwapInt32(v); + p = &v; + } + } +#endif +// if (typeEncoding == '{') p = [self storage]; + id encoding = structureTypeEncoding ? structureTypeEncoding : pointerTypeEncoding; + BOOL r = [JSCocoaFFIArgument toJSValueRef:value inContext:ctx typeEncoding:typeEncoding fullTypeEncoding:encoding fromStorage:p]; + if (!r) NSLog(@"toJSValueRef FAILED"); + return r; +} + + ++ (BOOL)toJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx typeEncoding:(char)typeEncoding fullTypeEncoding:(NSString*)fullTypeEncoding fromStorage:(void*)ptr +{ + if (!typeEncoding) return NO; + +// NSLog(@"toJSValueRef: %c ptr=%x", typeEncoding, ptr); + switch (typeEncoding) + { + case _C_ID: + case _C_CLASS: + { + id objcObject = *(id*)ptr; + return [self boxObject:(id)objcObject toJSValueRef:value inContext:ctx]; + + } + + case _C_VOID: + return YES; + + case _C_CHR: + case _C_UCHR: + case _C_SHT: + case _C_USHT: + case _C_INT: + case _C_UINT: + case _C_LNG: + case _C_ULNG: + case _C_LNG_LNG: + case _C_ULNG_LNG: + case _C_FLT: + case _C_DBL: + { + double number; + switch (typeEncoding) + { + case _C_CHR: number = *(char*)ptr; break; + case _C_UCHR: number = *(unsigned char*)ptr; break; + case _C_SHT: number = *(short*)ptr; break; + case _C_USHT: number = *(unsigned short*)ptr; break; + case _C_INT: number = *(int*)ptr; break; + case _C_UINT: number = *(unsigned int*)ptr; break; + case _C_LNG: number = *(long*)ptr; break; + case _C_ULNG: number = *(unsigned long*)ptr; break; + case _C_LNG_LNG: number = *(long long*)ptr; break; + case _C_ULNG_LNG: number = *(unsigned long long*)ptr; break; + case _C_FLT: number = *(float*)ptr; break; + case _C_DBL: number = *(double*)ptr; break; + } + *value = JSValueMakeNumber(ctx, number); + return YES; + } + + + case '{': + { + // Special case for getting raw JSValues from ObjC to JS + BOOL isJSStruct = [fullTypeEncoding hasPrefix:@"{JSValueRefAndContextRef"]; + if (isJSStruct) + { + JSValueRefAndContextRef* jsStruct = (JSValueRefAndContextRef*)ptr; + *value = jsStruct->value; + return YES; + } + + void* p = ptr; + id type = [JSCocoaFFIArgument structureFullTypeEncodingFromStructureTypeEncoding:fullTypeEncoding]; + // Bail if structure not found + if (!type) return 0; + + JSObjectRef jsObject = [JSCocoaController jsCocoaPrivateObjectInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(jsObject); + private.type = @"struct"; + NSInteger numParsed = [JSCocoaFFIArgument structureToJSValueRef:value inContext:ctx fromCString:(char*)[type UTF8String] fromStorage:&p]; + return numParsed; + } + + case _C_SEL: + { + SEL sel = *(SEL*)ptr; + id str = NSStringFromSelector(sel); +// JSStringRef jsName = JSStringCreateWithUTF8CString([str UTF8String]); + JSStringRef jsName = JSStringCreateWithCFString((CFStringRef)str); + *value = JSValueMakeString(ctx, jsName); + JSStringRelease(jsName); + return YES; + } + case _C_BOOL: + { + BOOL b = *(BOOL*)ptr; + *value = JSValueMakeBoolean(ctx, b); + return YES; + } + case _C_CHARPTR: + { + // Rturn Javascript null if char* is null + char* charPtr = *(char**)ptr; + if (!charPtr) + { + *value = JSValueMakeNull(ctx); + return YES; + } + // Convert to NSString and then to Javascript string + NSString* name = [NSString stringWithUTF8String:charPtr]; + JSStringRef jsName = JSStringCreateWithCFString((CFStringRef)name); + *value = JSValueMakeString(ctx, jsName); + JSStringRelease(jsName); + return YES; + } + + case _C_PTR: + { + JSObjectRef o = [JSCocoaController jsCocoaPrivateObjectInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(o); + private.type = @"rawPointer"; + [private setRawPointer:*(void**)ptr encoding:fullTypeEncoding]; + *value = o; + return YES; + } + } + + return NO; +} + +/* + + *value MUST be NULL to be receive allocated JSValue + + The given pointer is advanced in place : its value will change after the call. + Pass a writeable pointer whose original value you don't care about. + +*/ ++ (NSInteger)structureToJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx fromCString:(char*)c fromStorage:(void**)ptr +{ + return [self structureToJSValueRef:value inContext:ctx fromCString:c fromStorage:ptr initialValues:nil initialValueCount:0 convertedValueCount:nil]; +} + ++ (NSInteger)structureToJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx fromCString:(char*)c fromStorage:(void**)ptr initialValues:(JSValueRef*)initialValues initialValueCount:(NSInteger)initialValueCount convertedValueCount:(NSInteger*)convertedValueCount +{ + // Build new structure object + JSObjectRef jsObject = [JSCocoaController jsCocoaPrivateObjectInContext:ctx]; + JSCocoaPrivateObject* private = JSObjectGetPrivate(jsObject); + private.type = @"struct"; + private.structureName = [JSCocoaFFIArgument structureNameFromStructureTypeEncoding:[NSString stringWithUTF8String:c]]; + if (!*value) *value = jsObject; + + char* c0 = c; + // Skip '{' + c += 1; + // Skip '_' if it's there + if (*c == '_') c++; + // Skip structureName, '=' + c += [private.structureName length]+1; + + int openedBracesCount = 1; + int closedBracesCount = 0; + for (; *c && closedBracesCount != openedBracesCount; c++) + { + if (*c == '{') openedBracesCount++; + if (*c == '}') closedBracesCount++; + // Parse name then type + if (*c == '"') + { + char* c2 = c+1; + while (c2 && *c2 != '"') c2++; + id propertyName = [[[NSString alloc] initWithBytes:c+1 length:(c2-c-1) encoding:NSUTF8StringEncoding] autorelease]; + c = c2; + // Skip '"' + c++; + char encoding = *c; + + JSValueRef valueJS = NULL; + if (encoding == '{') + { + NSInteger numParsed = [self structureToJSValueRef:&valueJS inContext:ctx fromCString:c fromStorage:ptr initialValues:initialValues initialValueCount:initialValueCount convertedValueCount:convertedValueCount]; + c += numParsed; + } + else + { + // Given a pointer to raw C structure data, convert its members to JS values + if (ptr) + { + // Align + [JSCocoaFFIArgument alignPtr:ptr accordingToEncoding:encoding]; + // Get value + [JSCocoaFFIArgument toJSValueRef:&valueJS inContext:ctx typeEncoding:encoding fullTypeEncoding:nil fromStorage:*ptr]; + // Advance ptr + [JSCocoaFFIArgument advancePtr:ptr accordingToEncoding:encoding]; + } + else + // Given no pointer, get values from initialValues array. If not present, create undefined values + { + if (!convertedValueCount) return 0; + if (initialValues && initialValueCount && *convertedValueCount < initialValueCount) valueJS = initialValues[*convertedValueCount]; + else valueJS = JSValueMakeUndefined(ctx); + } + if (convertedValueCount) *convertedValueCount = *convertedValueCount+1; + } + JSStringRef propertyNameJS = JSStringCreateWithCFString((CFStringRef)propertyName); + JSObjectSetProperty(ctx, jsObject, propertyNameJS, valueJS, 0, NULL); + JSStringRelease(propertyNameJS); + } + } + return c-c0-1; +} + ++ (NSInteger)structureFromJSObjectRef:(JSObjectRef)object inContext:(JSContextRef)ctx inParentJSValueRef:(JSValueRef)parentValue fromCString:(char*)c fromStorage:(void**)ptr +{ + id structureName = [JSCocoaFFIArgument structureNameFromStructureTypeEncoding:[NSString stringWithUTF8String:c]]; + char* c0 = c; + // Skip '{' + c += 1; + // Skip '_' if it's there + if (*c == '_') c++; + // Skip structureName, '=' + c += [structureName length]+1; + +// NSLog(@"%@", structureName); + int openedBracesCount = 1; + int closedBracesCount = 0; + for (; *c && closedBracesCount != openedBracesCount; c++) + { + if (*c == '{') openedBracesCount++; + if (*c == '}') closedBracesCount++; + // Parse name then type + if (*c == '"') + { + char* c2 = c+1; + while (c2 && *c2 != '"') c2++; + id propertyName = [[[NSString alloc] initWithBytes:c+1 length:(c2-c-1) encoding:NSUTF8StringEncoding] autorelease]; + c = c2; + + // Skip '"' + c++; + char encoding = *c; + + JSStringRef propertyNameJS = JSStringCreateWithUTF8CString([propertyName UTF8String]); + JSValueRef valueJS = JSObjectGetProperty(ctx, object, propertyNameJS, NULL); + JSStringRelease(propertyNameJS); +// JSObjectRef objectProperty2 = JSValueToObject(ctx, valueJS, NULL); + +// NSLog(@"%c %@ %x %x", encoding, propertyName, valueJS, objectProperty2); + if (encoding == '{') + { + if (JSValueIsObject(ctx, valueJS)) + { + JSObjectRef objectProperty = JSValueToObject(ctx, valueJS, NULL); + NSInteger numParsed = [self structureFromJSObjectRef:objectProperty inContext:ctx inParentJSValueRef:NULL fromCString:c fromStorage:ptr]; + c += numParsed; + } + else return 0; + } + else + { + // Align + [JSCocoaFFIArgument alignPtr:ptr accordingToEncoding:encoding]; + // Get value + [JSCocoaFFIArgument fromJSValueRef:valueJS inContext:ctx typeEncoding:encoding fullTypeEncoding:nil fromStorage:*ptr]; + // Advance ptr + [JSCocoaFFIArgument advancePtr:ptr accordingToEncoding:encoding]; + } + + } + } + return c-c0-1; +} + + + +#pragma mark Encoding size, alignment, FFI + ++ (int)sizeOfTypeEncoding:(char)encoding +{ + switch (encoding) + { + case _C_ID: return sizeof(id); + case _C_CLASS: return sizeof(Class); + case _C_SEL: return sizeof(SEL); + case _C_CHR: return sizeof(char); + case _C_UCHR: return sizeof(unsigned char); + case _C_SHT: return sizeof(short); + case _C_USHT: return sizeof(unsigned short); + case _C_INT: return sizeof(int); + case _C_UINT: return sizeof(unsigned int); + case _C_LNG: return sizeof(long); + case _C_ULNG: return sizeof(unsigned long); + case _C_LNG_LNG: return sizeof(long long); + case _C_ULNG_LNG:return sizeof(unsigned long long); + case _C_FLT: return sizeof(float); + case _C_DBL: return sizeof(double); + case _C_BOOL: return sizeof(BOOL); + case _C_VOID: return sizeof(void); + case _C_PTR: return sizeof(void*); + case _C_CHARPTR: return sizeof(char*); + // Function pointers +// case _C_UNDEF: return sizeof(void*); + // Blocks are encoded with @? + } + return -1; +} + +/* + __alignOf__ returns 8 for double, but its struct align is 4 + + use dummy structures to get struct alignment, each having a byte as first element +*/ +typedef struct { char a; id b; } struct_C_ID; +typedef struct { char a; char b; } struct_C_CHR; +typedef struct { char a; short b; } struct_C_SHT; +typedef struct { char a; int b; } struct_C_INT; +typedef struct { char a; long b; } struct_C_LNG; +typedef struct { char a; long long b; } struct_C_LNG_LNG; +typedef struct { char a; float b; } struct_C_FLT; +typedef struct { char a; double b; } struct_C_DBL; +typedef struct { char a; BOOL b; } struct_C_BOOL; + ++ (int)alignmentOfTypeEncoding:(char)encoding +{ + switch (encoding) + { + case _C_ID: return offsetof(struct_C_ID, b); + case _C_CLASS: return offsetof(struct_C_ID, b); + case _C_SEL: return offsetof(struct_C_ID, b); + case _C_CHR: return offsetof(struct_C_CHR, b); + case _C_UCHR: return offsetof(struct_C_CHR, b); + case _C_SHT: return offsetof(struct_C_SHT, b); + case _C_USHT: return offsetof(struct_C_SHT, b); + case _C_INT: return offsetof(struct_C_INT, b); + case _C_UINT: return offsetof(struct_C_INT, b); + case _C_LNG: return offsetof(struct_C_LNG, b); + case _C_ULNG: return offsetof(struct_C_LNG, b); + case _C_LNG_LNG: return offsetof(struct_C_LNG_LNG, b); + case _C_ULNG_LNG:return offsetof(struct_C_LNG_LNG, b); + case _C_FLT: return offsetof(struct_C_FLT, b); + case _C_DBL: return offsetof(struct_C_DBL, b); + case _C_BOOL: return offsetof(struct_C_BOOL, b); + case _C_PTR: return offsetof(struct_C_ID, b); + case _C_CHARPTR: return offsetof(struct_C_ID, b); + } + return -1; +} + + ++ (ffi_type*)ffi_typeForTypeEncoding:(char)encoding +{ + switch (encoding) + { + case _C_ID: + case _C_CLASS: + case _C_SEL: + case _C_PTR: + case _C_CHARPTR: return &ffi_type_pointer; + + case _C_CHR: return &ffi_type_sint8; + case _C_UCHR: return &ffi_type_uint8; + case _C_SHT: return &ffi_type_sint16; + case _C_USHT: return &ffi_type_uint16; + case _C_INT: + case _C_LNG: return &ffi_type_sint32; + case _C_UINT: + case _C_ULNG: return &ffi_type_uint32; + case _C_LNG_LNG: return &ffi_type_sint64; + case _C_ULNG_LNG: return &ffi_type_uint64; + case _C_FLT: return &ffi_type_float; + case _C_DBL: return &ffi_type_double; + case _C_BOOL: return &ffi_type_sint8; + case _C_VOID: return &ffi_type_void; + } + return NULL; +} + +// +// Type encodings +// http://developer.apple.com/mac/library/documentation/cocoa/conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html +// +// Will change a bit between 32 and 64 bits (NSUInteger I->Q, CGFloat f->d) +// +static NSMutableDictionary* typeEncodings = nil; ++ (NSString*)typeEncodingForType:(NSString*)encoding +{ + if (!typeEncodings) + { + typeEncodings = [NSMutableDictionary new]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(char)] forKey:@"char"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(int)] forKey:@"int"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(short)] forKey:@"short"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(long)] forKey:@"long"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(long long)] forKey:@"long long"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(unsigned char)] forKey:@"unsigned char"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(unsigned int)] forKey:@"unsigned int"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(unsigned short)] forKey:@"unsigned short"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(unsigned long)] forKey:@"unsigned long"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(unsigned long long)] forKey:@"unsigned long long"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(float)] forKey:@"float"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(double)] forKey:@"double"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(bool)] forKey:@"bool"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(void)] forKey:@"void"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(char*)] forKey:@"char*"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(id)] forKey:@"id"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(Class)] forKey:@"Class"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(SEL)] forKey:@"selector"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(BOOL)] forKey:@"BOOL"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(void*)] forKey:@"void*"]; + + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(NSInteger)] forKey:@"NSInteger"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(NSUInteger)] forKey:@"NSUInteger"]; + [typeEncodings setValue:[NSString stringWithUTF8String:@encode(CGFloat)] forKey:@"CGFloat"]; + } + return [typeEncodings valueForKey:encoding]; +} + + +#pragma mark Structure encoding, size + +/* + From + {_NSRect={_NSPoint=ff}{_NSSize=ff}} + + Return + {_NSRect="origin"{_NSPoint="x"f"y"f}"size"{_NSSize="width"f"height"f}} +*/ ++ (NSString*)structureNameFromStructureTypeEncoding:(NSString*)encoding +{ + // Extract structure name + // skip '{' + char* c = (char*)[encoding UTF8String]+1; + // skip '_' if it's there + if (*c == '_') c++; + char* c2 = c; + while (*c2 && *c2 != '=') c2++; + return [[[NSString alloc] initWithBytes:c length:(c2-c) encoding:NSUTF8StringEncoding] autorelease]; +} + ++ (NSMutableArray*)encodingsFromStructureTypeEncoding:(NSString*)encoding +{ + return nil; +} + ++ (NSString*)structureFullTypeEncodingFromStructureTypeEncoding:(NSString*)encoding +{ + id structureName = [JSCocoaFFIArgument structureNameFromStructureTypeEncoding:encoding]; + return [self structureFullTypeEncodingFromStructureName:structureName]; +} + ++ (NSString*)structureFullTypeEncodingFromStructureName:(NSString*)structureName +{ + // Fetch structure type encoding from BridgeSupport +// id xml = [[BridgeSupportController sharedController] query:structureName withType:@"struct"]; + id xml = [[BridgeSupportController sharedController] queryName:structureName type:@"struct"]; + + if (xml == nil) + { + NSLog(@"No structure encoding found for %@", structureName); + return nil; + } + id xmlDocument = [[NSXMLDocument alloc] initWithXMLString:xml options:0 error:nil]; + if (!xmlDocument) return NO; + id rootElement = [xmlDocument rootElement]; +#if __LP64__ + id type = [[rootElement attributeForName:@"type64"] stringValue]; +#else + id type = [[rootElement attributeForName:@"type"] stringValue]; +#endif + [xmlDocument release]; + return type; +} + + ++ (NSArray*)typeEncodingsFromStructureTypeEncoding:(NSString*)structureTypeEncoding +{ + return [self typeEncodingsFromStructureTypeEncoding:structureTypeEncoding parsedCount:nil]; +} + + ++ (NSArray*)typeEncodingsFromStructureTypeEncoding:(NSString*)structureTypeEncoding parsedCount:(NSInteger*)count +{ + id types = [[[NSMutableArray alloc] init] autorelease]; + char* c = (char*)[structureTypeEncoding UTF8String]; + char* c0 = c; + int openedBracesCount = 0; + int closedBracesCount = 0; + for (;*c; c++) + { + if (*c == '{') + { + openedBracesCount++; + while (*c && *c != '=') c++; + if (!*c) continue; + } + if (*c == '}') + { + closedBracesCount++; + + // If we parsed something (c>c0) and have an equal amount of opened and closed braces, we're done + if (c0 != c && openedBracesCount == closedBracesCount) + { + c++; + break; + } + continue; + } + if (*c == '=') continue; + + [types addObject:[NSString stringWithFormat:@"%c", *c]]; + + // Special case for pointers + if (*c == '^') + { + // Skip pointers to pointers (^^^) + while (*c && *c == '^') c++; + + // Skip type, special case for structure + if (*c == '{') + { + int openedBracesCount2 = 1; + int closedBracesCount2 = 0; + c++; + for (; *c && closedBracesCount2 != openedBracesCount2; c++) + { + if (*c == '{') openedBracesCount2++; + if (*c == '}') closedBracesCount2++; + } + c--; + } + else c++; + } + } + if (count) *count = c-c0; + if (closedBracesCount != openedBracesCount) return NSLog(@"Could not parse structure type encodings for %@", structureTypeEncoding), nil; + return types; +} + +// +// Given a structure encoding string, produce a human readable format +// ++ (NSInteger)structureTypeEncodingDescription:(NSString*)structureTypeEncoding inString:(NSMutableString**)str +{ + char* c = (char*)[structureTypeEncoding UTF8String]; + char* c0 = c; + // Skip '{' + c += 1; + // Skip '_' if it's there + if (*c == '_') c++; + // Skip structureName, '=' +// c += [private.structureName length]+1; + id structureName = [self structureNameFromStructureTypeEncoding:structureTypeEncoding]; + c += [structureName length]+1; + + int openedBracesCount = 1; + int closedBracesCount = 0; + int propertyCount = 0; + for (; *c && closedBracesCount != openedBracesCount; c++) + { + if (*c == '{') + { + [*str appendString:@"{"]; + openedBracesCount++; + } + if (*c == '}') + { + [*str appendString:@"}"]; + closedBracesCount++; + } + // Parse name then type + if (*c == '"') + { + propertyCount++; + if (propertyCount > 1) [*str appendString:@", "]; + char* c2 = c+1; + while (c2 && *c2 != '"') c2++; + id propertyName = [[[NSString alloc] initWithBytes:c+1 length:(c2-c-1) encoding:NSUTF8StringEncoding] autorelease]; + c = c2; + // Skip '"' + c++; + char encoding = *c; + [*str appendString:propertyName]; + [*str appendString:@": "]; + +// JSValueRef valueJS = NULL; + if (encoding == '{') + { + [*str appendString:@"{"]; + NSInteger parsed = [self structureTypeEncodingDescription:[NSString stringWithUTF8String:c] inString:str]; + c += parsed; +// NSLog(@"parsed %@ (%d)", substr, [substr length]); + } + else + { + [*str appendString:@"("]; + [*str appendString:[self typeDescriptionForTypeEncoding:encoding fullTypeEncoding:nil]]; + [*str appendString:@")"]; + } + } + } + return c-c0-1; +} ++ (NSString*)structureTypeEncodingDescription:(NSString*)structureTypeEncoding +{ + id fullStructureTypeEncoding = [self structureFullTypeEncodingFromStructureTypeEncoding:structureTypeEncoding]; + if (!fullStructureTypeEncoding) return [NSString stringWithFormat:@"(Could not describe struct %@)", structureTypeEncoding]; + + id str = [NSMutableString stringWithFormat:@"%@{", [self structureNameFromStructureTypeEncoding:fullStructureTypeEncoding]]; + [self structureTypeEncodingDescription:fullStructureTypeEncoding inString:&str]; + [str appendString:@"}"]; + return str; +} + + ++ (int)sizeOfStructure:(NSString*)encoding +{ + id types = [self typeEncodingsFromStructureTypeEncoding:encoding]; + int computedSize = 0; + void** ptr = (void**)&computedSize; + for (id type in types) + { + char charEncoding = *(char*)[type UTF8String]; + // Align + [JSCocoaFFIArgument alignPtr:ptr accordingToEncoding:charEncoding]; + // Advance ptr + [JSCocoaFFIArgument advancePtr:ptr accordingToEncoding:charEncoding]; + } + return computedSize; +} + + +#pragma mark Object boxing / unboxing + +// +// Box +// ++ (BOOL)boxObject:(id)objcObject toJSValueRef:(JSValueRef*)value inContext:(JSContextRef)ctx +{ + // Return null if our pointer is null + if (!objcObject) + { + *value = JSValueMakeNull(ctx); + return YES; + } + // Use a global boxing function to always return the same Javascript object + // when requesting multiple boxings of the same ObjC object + *value = [JSCocoaController boxedJSObject:objcObject inContext:ctx]; + return YES; +} + +// +// Unbox +// ++ (BOOL)unboxJSValueRef:(JSValueRef)value toObject:(id*)o inContext:(JSContextRef)ctx +{ + // + // Boxing + // + // string -> NSString + // null -> nil (no box) + // number -> NSNumber + // [] -> NSMutableArray + // {} -> NSMutableDictionary + // + + // null + if (!value || JSValueIsNull(ctx, value) || JSValueIsUndefined(ctx, value)) + { + *(id*)o = nil; + return YES; + } + + + // string + if (JSValueIsString(ctx, value)) + { + JSStringRef resultStringJS = JSValueToStringCopy(ctx, value, NULL); + NSString* resultString = (NSString*)JSStringCopyCFString(kCFAllocatorDefault, resultStringJS); +// NSLog(@"unboxed=%@", resultString); + JSStringRelease(resultStringJS); + [NSMakeCollectable(resultString) autorelease]; + *(id*)o = resultString; + return YES; + } + + + // number + if (JSValueIsNumber(ctx, value)) + { + double v = JSValueToNumber(ctx, value, NULL); + // Integer + if (fabs(round(v)-v) < 1e-6) + { + if (v < 0) + { + *(id*)o = [NSNumber numberWithInt:(int)v]; +// NSLog(@"int %d", (int)v); + } + else + { + *(id*)o = [NSNumber numberWithUnsignedInt:(unsigned int)v]; +// NSLog(@"UNSIGNED int %d", (unsigned int)v); + } + } + // Double + else + { + *(id*)o = [NSNumber numberWithDouble:v]; +// NSLog(@"double %f", v); + } + return YES; + } + + // bool + if (JSValueIsBoolean(ctx, value)) + { + bool v = JSValueToBoolean(ctx, value); + if (v) *(id*)o = [NSNumber numberWithBool:YES]; + else *(id*)o = nil; + return YES; + } + + // From here we must have a Javascript object (Array, Hash) or a boxed Cocoa object + if (!JSValueIsObject(ctx, value)) + return NO; + + JSObjectRef jsObject = JSValueToObject(ctx, value, NULL); + JSCocoaPrivateObject* private = JSObjectGetPrivate(jsObject); + // Pure js hashes and arrays are converted to NSArray and NSDictionary + if (!private) + { + // Use an anonymous function to test if object is Array or Object (hash) + // (can't use this.constructor==Array.prototype.constructor with JSEvaluateScript it doesn't take thisObject into account) + JSStringRef scriptJS = JSStringCreateWithUTF8CString("return arguments[0].constructor == Array.prototype.constructor"); + JSObjectRef fn = JSObjectMakeFunction(ctx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSValueRef result = JSObjectCallAsFunction(ctx, fn, NULL, 1, (JSValueRef*)&jsObject, NULL); + JSStringRelease(scriptJS); + + BOOL isArray = JSValueToBoolean(ctx, result); + + if (isArray) return [self unboxJSArray:jsObject toObject:o inContext:ctx]; + else return [self unboxJSHash:jsObject toObject:o inContext:ctx]; + } + // ## Hmmm ? CGColorRef is returned as a pointer but CALayer.foregroundColor asks an objc object (@) +/* + if ([private.type isEqualToString:@"rawPointer"]) *(id*)o = [private rawPointer]; + else *(id*)o = [private object]; +*/ + + id obj = [private object]; + + if ([private.type isEqualToString:@"rawPointer"]) *(id*)o = [private rawPointer]; + else if (obj) *(id*)o = obj; + else if ([private.type isEqualToString:@"externalJSValueRef"]) + { + // Convert external jsValues by calling valueOf + JSValueRef v = valueOfCallback(ctx, NULL, JSValueToObject(ctx, value, NULL), 0, NULL, NULL); + return [self unboxJSValueRef:v toObject:o inContext:ctx]; + } + else + { +// NSLog(@"********* %@", private.type); + *(id*)o = nil; + } + + return YES; +} + +// +// Convert ['a', 'b', 1.23] to an NSArray +// ++ (BOOL)unboxJSArray:(JSObjectRef)object toObject:(id*)o inContext:(JSContextRef)ctx +{ + // Get property count + JSValueRef exception = NULL; + JSStringRef lengthJS = JSStringCreateWithUTF8CString("length"); + NSUInteger length = JSValueToNumber(ctx, JSObjectGetProperty(ctx, object, lengthJS, NULL), &exception); + JSStringRelease(lengthJS); + if (exception) return NO; + + // Converted array + id array = [NSMutableArray array]; + // Converted array property + id value; + int i; + // Loop over all properties of the array and call our trusty unboxer. + // He might reenter that function to convert arrays inside that array. + for (i=0; i +#import +#define MACOSX +#import +#endif +#import "JSCocoaFFIArgument.h" + +#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#import "iPhone/libffi/ffi.h" +#endif + + +@interface JSCocoaFFIClosure : NSObject { + + JSValueRef jsFunction; + // ##UNSURE This might cause a crash if we're registered in a non global context that will have been destroyed when we JSValueUnprotect the function + JSContextRef ctx; + + ffi_cif cif; +#if !TARGET_OS_IPHONE + ffi_closure* closure; +#endif + ffi_type** argTypes; + + NSMutableArray* encodings; + + JSObjectRef jsThisObject; + + BOOL isObjC; +} + +- (IMP)setJSFunction:(JSValueRef)fn inContext:(JSContextRef)ctx argumentEncodings:(NSMutableArray*)argumentEncodings objC:(BOOL)objC; +- (void*)functionPointer; +- (void)calledByClosureWithArgs:(void**)args returnValue:(void*)returnValue; + +@end diff --git a/jscocoa/JSCocoa/JSCocoaFFIClosure.m b/jscocoa/JSCocoa/JSCocoaFFIClosure.m new file mode 100644 index 0000000..58d9c1d --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoaFFIClosure.m @@ -0,0 +1,218 @@ +// +// JSCocoaFFIClosure.m +// JSCocoa +// +// Created by Patrick Geiller on 29/07/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "JSCocoaFFIClosure.h" +#import "JSCocoaController.h" +#include // for mmap() + +@implementation JSCocoaFFIClosure + + +// +// Common closure function, calling back closure object +// +void closure_function(ffi_cif* cif, void* resp, void** args, void* userdata) +{ + [(id)userdata calledByClosureWithArgs:args returnValue:resp]; +} + +- (id)init +{ + self = [super init]; + + argTypes = NULL; + encodings = NULL; + jsFunction = NULL; + + return self; +} + +// +// Cleanup : called by dealloc and finalize +// +- (void)cleanUp +{ + if (encodings) [encodings release]; + if (argTypes) free(argTypes); + + if (jsFunction) + { + JSValueUnprotect(ctx, jsFunction); + [JSCocoaController downJSValueProtectCount]; + } + // + // A strange crash reporting ??? as the source address is a deleted closure being called (happens with the bindings mechanism) + // +#if !TARGET_OS_IPHONE + if (munmap(closure, sizeof(closure)) == -1) NSLog(@"ffi closure munmap failed"); +#endif +} +- (void)dealloc +{ +// NSLog(@"deallocing closure %x IMP=%x", self, closure); + [self cleanUp]; + [super dealloc]; +} +- (void)finalize +{ + [self cleanUp]; + [super finalize]; +} + +- (void*)functionPointer +{ +#if !TARGET_OS_IPHONE + return closure; +#else + return NULL; +#endif +} + + + +// +// Bind a js function to closure. We'll jsValueProtect that function from GC. +// +- (IMP)setJSFunction:(JSValueRef)fn inContext:(JSContextRef)context argumentEncodings:(NSMutableArray*)argumentEncodings objC:(BOOL)objC +{ +#if !TARGET_OS_IPHONE + if ([argumentEncodings count] == 0) return NULL; + + encodings = argumentEncodings; + [encodings retain]; + isObjC = objC; + + unsigned int i, argumentCount = (unsigned int)([argumentEncodings count]-1); + argTypes = malloc(sizeof(ffi_type*)*argumentCount); + for (i=0; i 0 && size < paddedSize && paddedSize == 4) + { + v = *(long*)returnValue; + v = CFSwapInt32(v); + *(long*)returnValue = v; + } +#endif + } + + if (effectiveArgumentCount) free(args); +// if (exception) NSLog(@"%@", [[JSCocoaController controllerFromContext:ctx] formatJSException:exception]); + if (exception) + { + @throw [NSException exceptionWithName:@"JSCocoa exception" + reason:[[JSCocoaController controllerFromContext:ctx] formatJSException:exception] + userInfo:nil]; + } +} + + + +@end diff --git a/jscocoa/JSCocoa/JSCocoaLib.h b/jscocoa/JSCocoa/JSCocoaLib.h new file mode 100644 index 0000000..e5c0b30 --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoaLib.h @@ -0,0 +1,98 @@ +// +// JSCocoaLib.h +// JSCocoa +// +// Created by Patrick Geiller on 21/12/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#if !TARGET_IPHONE_SIMULATOR && !TARGET_OS_IPHONE +#import +#endif +#import "JSCocoa.h" + +@class JSCocoaMemoryBuffer; + +@interface JSCocoaOutArgument : NSObject +{ + JSCocoaFFIArgument* arg; + JSCocoaMemoryBuffer* buffer; + int bufferIndex; +} +- (BOOL)mateWithJSCocoaFFIArgument:(JSCocoaFFIArgument*)arg; +- (JSValueRef)outJSValueRefInContext:(JSContextRef)ctx; + +@end + + + +@interface JSCocoaMemoryBuffer : NSObject +{ + void* buffer; + int bufferSize; + // NSString holding types + id typeString; + + // Indicates whether types are aligned. + // types not aligned (DEFAULT) + // size('fcf') = 4 + 1 + 4 = 9 + // types aligned + // size('fcf') = 4 + 4(align) + 4 = 12 + BOOL alignTypes; +} ++ (id)bufferWithTypes:(id)types; +- (id)initWithTypes:(id)types; +//- (id)initWithTypes:(id)types andValues:(id)values; +//- (id)initWithMemoryBuffers:(id)buffers; + +- (void*)pointerForIndex:(NSUInteger)index; +- (char)typeAtIndex:(NSUInteger)index; +- (JSValueRef)valueAtIndex:(NSUInteger)index inContext:(JSContextRef)ctx; +- (BOOL)setValue:(JSValueRef)jsValue atIndex:(NSUInteger)index inContext:(JSContextRef)ctx; +- (NSUInteger)typeCount; + +@end + + +@interface JSCocoaLib : NSObject + ++ (id)rootclasses; ++ (id)classes; ++ (id)protocols; ++ (id)imageNames; ++ (id)methods; ++ (id)runtimeReport; + +@end + + + +@interface NSObject(ClassWalker) ++ (id)__classImage; +- (id)__classImage; ++ (id)__derivationPath; +- (id)__derivationPath; ++ (NSUInteger)__derivationLevel; +- (NSUInteger)__derivationLevel; ++ (id)__ownMethods; +- (id)__ownMethods; ++ (id)__methods; +- (id)__methods; ++ (id)__subclasses; +- (id)__subclasses; ++ (id)__subclassTree; +- (id)__subclassTree; ++ (id)__ownIvars; +- (id)__ownIvars; ++ (id)__ivars; +- (id)__ivars; ++ (id)__ownProperties; +- (id)__ownProperties; ++ (id)__properties; +- (id)__properties; ++ (id)__ownProtocols; +- (id)__ownProtocols; ++ (id)__protocols; +- (id)__protocols; + +@end diff --git a/jscocoa/JSCocoa/JSCocoaLib.m b/jscocoa/JSCocoa/JSCocoaLib.m new file mode 100644 index 0000000..e5af158 --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoaLib.m @@ -0,0 +1,825 @@ +// +// JSCocoaLib.m +// JSCocoa +// +// Created by Patrick Geiller on 21/12/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "JSCocoaLib.h" + + +// +// Handles out arguments of functions and methods. +// eg NSOpenGLGetVersion(int*, int*) asks for two pointers to int. +// JSCocoaOutArgument will alloc the memory through JSCocoaFFIArgument and get the result back to Javascript (check out value in JSCocoaController) +// +@implementation JSCocoaOutArgument + +- (id)init +{ + self = [super init]; + + arg = nil; + buffer = nil; + return self; +} +- (void)cleanUp +{ + [arg release]; + [buffer release]; +} +- (void)dealloc +{ + [self cleanUp]; + [super dealloc]; +} +- (void)finalize +{ + [self cleanUp]; + [super finalize]; +} + + +// +// convert the out value to a JSValue +// +- (JSValueRef)outJSValueRefInContext:(JSContextRef)ctx +{ + JSValueRef jsValue = NULL; + [arg toJSValueRef:&jsValue inContext:ctx]; + return jsValue; +} + +// Called from Javascript to extract the resulting value as an object (valueOfCallback returns a string) +- (JSValueRefAndContextRef)outValue +{ + JSValueRefAndContextRef r; + + id jsc = nil; + object_getInstanceVariable(self, "__jsCocoaController", (void**)&jsc); + if (!jsc) return r; + + r.ctx = [jsc ctx]; + r.value = [self outJSValueRefInContext:r.ctx]; + + return r; +} + + + +// +// JSCocoaOutArgument holds a JSCocoaFFIArgument around. +// it stays alive after ffi_call and can be queried by Javascript for type modifier values. +// +- (BOOL)mateWithJSCocoaFFIArgument:(JSCocoaFFIArgument*)_arg +{ + // If holding a memory buffer, use its pointer + if (buffer) + { + arg = _arg; + [arg retain]; + void* ptr = [buffer pointerForIndex:bufferIndex]; + if (!ptr) return NO; + [arg setTypeEncoding:[arg typeEncoding] withCustomStorage:ptr]; + return YES; + } + + // Standard pointer + void* p = [_arg allocatePointerStorage]; + if (!p) return NO; + + // Zero out storage + *(void**)p = NULL; + + + arg = _arg; + [arg retain]; + return YES; +} + +- (BOOL)mateWithMemoryBuffer:(id)b atIndex:(int)idx +{ + if (!b || ![b isKindOfClass:[JSCocoaMemoryBuffer class]]) return NSLog(@"mateWithMemoryBuffer called without a memory buffer (%@)", b), NO; + buffer = b; + [buffer retain]; + bufferIndex = idx; + return YES; +} + +@end + + + +// +// Instead of malloc(sizeof(float)*4), JSCocoaMemoryBuffer expects 'ffff' as an init string. +// The buffer can be manipulated like an array (buffer[2] = 0.5) +// * it can be filled, calling methods to copy data in it +// - (NSBezierPathElement)elementAtIndex:(NSInteger)index associatedPoints:(NSPointArray)points; +// * it can be used as data source, calling methods to copy data from it +// - (void)setAssociatedPoints:(NSPointArray)points atIndex:(NSInteger)index; +// +@implementation JSCocoaMemoryBuffer + ++ (id)bufferWithTypes:(id)types +{ + return [[[JSCocoaMemoryBuffer alloc] initWithTypes:types] autorelease]; +} + + +- (id)initWithTypes:(id)_types +{ + self = [super init]; + buffer = NULL; + + // Copy types string + typeString = [NSString stringWithString:_types]; + [typeString retain]; + + // Compute buffer size + const char* types = [typeString UTF8String]; + NSUInteger l = [typeString length]; + bufferSize = 0; + for (int i=0; i= [typeString length]) return NULL; + void* pointedValue = buffer; + for (int i=0; i= [typeString length]) return '\0'; + return [typeString UTF8String][idx]; +} + +- (NSUInteger)typeCount +{ + return [typeString length]; +} + +-(BOOL)referenceObject:(id)o usingPointerAtIndex:(NSUInteger)idx +{ + if ([self typeAtIndex:idx] != '^') return NO; + + void* v = *(void**)[self pointerForIndex:idx]; + if (!v) return NO; + *(id*)v = o; + return YES; +} + +- (id)dereferenceObjectAtIndex:(NSUInteger)idx +{ + if ([self typeAtIndex:idx] != '^') return nil; + void* v = *(void**)[self pointerForIndex:idx]; + if (!v) return NULL; + + id o = *(id*)v; + return o; + return *(id*)v; +} + +// +// Using JSValueRefAndContextRef as input to get the current context in which to create the return value +// +- (JSValueRef)valueAtIndex:(NSUInteger)idx inContext:(JSContextRef)ctx +{ + char typeEncoding = [self typeAtIndex:idx]; + void* pointedValue = [self pointerForIndex:idx]; + if (!pointedValue) return JSValueMakeUndefined(ctx); + JSValueRef returnValue; + [JSCocoaFFIArgument toJSValueRef:&returnValue inContext:ctx typeEncoding:typeEncoding fullTypeEncoding:nil fromStorage:pointedValue]; + return returnValue; +} + +- (BOOL)setValue:(JSValueRef)jsValue atIndex:(NSUInteger)idx inContext:(JSContextRef)ctx +{ + char typeEncoding = [self typeAtIndex:idx]; + void* pointedValue = [self pointerForIndex:idx]; + if (!pointedValue) return NO; + [JSCocoaFFIArgument fromJSValueRef:jsValue inContext:ctx typeEncoding:typeEncoding fullTypeEncoding:nil fromStorage:pointedValue]; + return YES; +} + + +@end + + + +@implementation JSCocoaLib + +// +// Class list +// Some classes are skipped as adding them to an array crashes (Zombie, classes derived from Object or NSProxy) +// ++ (NSArray*)classes +{ + int classCount = objc_getClassList(nil, 0); + Class* classList = malloc(sizeof(Class)*classCount); + objc_getClassList(classList, classCount); + + + NSMutableArray* classArray = [NSMutableArray array]; + for (int i=0; i +#import +#endif + +#import +#import +//#import +#import +#import + +// +// Boxing object +// +// type +// @ ObjC object +// struct C struct +// method ObjC method name +// rawPointer raw C pointer (_C_PTR) +// jsFunction Javascript function +// jsValueRef raw jsvalue +// externalJSValueRef EXPERIMENTAL from webView +// + +@interface JSCocoaPrivateObject : NSObject { + + NSString* type; + NSString* xml; + NSString* methodName; + NSString* structureName; + + NSString* declaredType; +// void* ptr; + void* rawPointer; + + id object; + + Method method; + + JSValueRef jsValue; + JSContextRef ctx; + unsigned int externalJSValueIndex; + // (test) when storing JSValues from a WebView, used to retain the WebView's context. + // Disabled for now. Just make sure the WebView has a longer life than the vars + // it's using. + // + // Disabled because retaining the context crashes in 32 bits, but works in 64 bit. + // May be reenabled someday. +// JSContextGroupRef contextGroup; + + BOOL isAutoCall; + BOOL retainObject; + // Disabled because of a crash on i386. Release globalContext last. +// BOOL retainContext; +} + +@property (copy) NSString* type; +@property (copy) NSString* xml; +@property (copy) NSString* methodName; +@property (copy) NSString* structureName; +@property (copy) NSString* declaredType; +@property BOOL isAutoCall; + +//- (void)setPtr:(void*)ptrValue; +//- (void*)ptr; + +- (void)setObject:(id)o; +- (void)setObjectNoRetain:(id)o; +- (BOOL)retainObject; +- (id)object; + +- (void)setMethod:(Method)m; +- (Method)method; + +- (void)setJSValueRef:(JSValueRef)v ctx:(JSContextRef)ctx; +- (JSValueRef)jsValueRef; +- (JSContextRef)ctx; +- (void)setExternalJSValueRef:(JSValueRef)v ctx:(JSContextRef)ctx; + +- (void*)rawPointer; +- (void)setRawPointer:(void*)rp encoding:(id)encoding; +- (id)rawPointerEncoding; + +@end diff --git a/jscocoa/JSCocoa/JSCocoaPrivateObject.m b/jscocoa/JSCocoa/JSCocoaPrivateObject.m new file mode 100644 index 0000000..8b3dc03 --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoaPrivateObject.m @@ -0,0 +1,229 @@ +// +// JSCocoaPrivateObject.m +// JSCocoa +// +// Created by Patrick Geiller on 09/07/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "JSCocoaPrivateObject.h" +#import "JSCocoaController.h" + +@implementation JSCocoaPrivateObject + +@synthesize type, xml, declaredType, methodName, structureName, isAutoCall; + + +- (id)init +{ + self = [super init]; + type = xml = declaredType = methodName = nil; + object = nil; + isAutoCall = NO; + jsValue = NULL; + retainObject = YES; + rawPointer = NULL; + ctx = NULL; +// retainContext = NO; + externalJSValueIndex = 0; + + + [JSCocoaController upJSCocoaPrivateObjectCount]; + return self; +} + +- (void)cleanUp +{ + [JSCocoaController downJSCocoaPrivateObjectCount]; + if (object && retainObject) + { + [JSCocoaController downBoxedJSObjectCount:object]; + [object release]; + } + if (jsValue) + { + if (!externalJSValueIndex) JSValueUnprotect(ctx, jsValue); + [JSCocoaController downJSValueProtectCount]; + + // If holding a value from an external context, remove it from the GC-safe hash and release context. + if (externalJSValueIndex) + { + JSStringRef scriptJS = JSStringCreateWithUTF8CString("delete __gcprotect[arguments[0]]"); + JSObjectRef fn = JSObjectMakeFunction(ctx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSStringRelease(scriptJS); + JSValueRef jsNumber = JSValueMakeNumber(ctx, externalJSValueIndex); + JSValueRef exception = NULL; + JSObjectCallAsFunction(ctx, fn, NULL, 1, (JSValueRef*)&jsNumber, &exception); +// JSGlobalContextRelease((JSGlobalContextRef)ctx); + + if (exception) + NSLog(@"Got an exception while trying to release externalJSValueRef %p of context %p", jsValue, ctx); + } + } +/* + if (retainContext) + { + NSLog(@"releasing %x", ctx); + JSContextGroupRelease(contextGroup); +// JSGlobalContextRelease((JSGlobalContextRef)ctx); + } +*/ + // Release properties + [type release]; + [xml release]; + [methodName release]; + [structureName release]; + [declaredType release]; +} + +- (void)dealloc +{ + [self cleanUp]; + [super dealloc]; +} +- (void)finalize +{ + [self cleanUp]; + [super finalize]; +} + +- (void)setObject:(id)o +{ + object = o; + if (object && [object retainCount] == -1) return; + [object retain]; +} + +- (void)setObjectNoRetain:(id)o +{ + object = o; + retainObject = NO; +} + +- (BOOL)retainObject +{ + return retainObject; +} + + +- (id)object +{ + return object; +} + +- (void)setMethod:(Method)m +{ + method = m; +} +- (Method)method +{ + return method; +} + +- (void)setJSValueRef:(JSValueRef)v ctx:(JSContextRef)c +{ + // While autocalling we'll get a NULL value when boxing a void return type - just skip JSValueProtect + if (!v) + { +// NSLog(@"setJSValueRef: NULL value"); + jsValue = 0; + return; + } + jsValue = v; +// ctx = c; + // Register global context (this would crash the launcher as JSValueUnprotect was called on a destroyed context) + ctx = [[JSCocoaController controllerFromContext:c] ctx]; + JSValueProtect(ctx, jsValue); + [JSCocoaController upJSValueProtectCount]; +} +- (JSValueRef)jsValueRef +{ + return jsValue; +} + +- (JSContextRef)ctx +{ + return ctx; +} + + +- (void)setExternalJSValueRef:(JSValueRef)v ctx:(JSContextRef)c +{ + if (!v) + { + jsValue = 0; + return; + } + jsValue = v; + ctx = c; + + // Register value in a hash to protect it from GC. This sucks but JSValueProtect() fails. + JSStringRef scriptJS = JSStringCreateWithUTF8CString("if (!('__gcprotect' in this)) { __gcprotect = {}; __gcprotectidx = 1; } __gcprotect[__gcprotectidx] = arguments[0]; return __gcprotectidx++ "); + JSObjectRef fn = JSObjectMakeFunction(ctx, NULL, 0, NULL, scriptJS, NULL, 1, NULL); + JSStringRelease(scriptJS); + + JSValueRef exception = NULL; + JSValueRef result = JSObjectCallAsFunction(ctx, fn, NULL, 1, (JSValueRef*)&jsValue, &exception); + if (exception) return; + + // Use hash index as key, will be used to remove value from hash upon deletion. + externalJSValueIndex = (unsigned int)JSValueToNumber(ctx, result, &exception); + if (exception) return; + +// JSGlobalContextRetain((JSGlobalContextRef)ctx); + [JSCocoaController upJSValueProtectCount]; +} + + +- (void*)rawPointer +{ + return rawPointer; +} +- (void)setRawPointer:(void*)rp encoding:(id)encoding +{ + rawPointer = rp; +// NSLog(@"RAWPOINTER=%@", encoding); + declaredType = encoding; + [declaredType retain]; +} + +- (id)rawPointerEncoding +{ + return declaredType; +} + + +- (id)description +{ + id extra = @""; + if ([type isEqualToString:@"rawPointer"]) extra = [NSString stringWithFormat:@" (%x) %@", rawPointer, declaredType]; + return [NSString stringWithFormat:@"<%@: %x holding %@%@>", + [self class], + self, + type, + extra + ]; +} + ++ (id)description +{ + return @""; +} + +- (id)dereferencedObject +{ + if (![type isEqualToString:@"rawPointer"] || !rawPointer) return nil; + return *(void**)rawPointer; +} + +- (BOOL)referenceObject:(id)o +{ + if (![type isEqualToString:@"rawPointer"]) return NO; +// void* v = *(void**)rawPointer; + *(id*)rawPointer = o; + return YES; +} + + +@end + diff --git a/jscocoa/JSCocoa/JSCocoa_Prefix.pch b/jscocoa/JSCocoa/JSCocoa_Prefix.pch new file mode 100644 index 0000000..51d9c38 --- /dev/null +++ b/jscocoa/JSCocoa/JSCocoa_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'JSCocoa' target in the 'JSCocoa' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/jscocoa/JSCocoa/class.js b/jscocoa/JSCocoa/class.js new file mode 100644 index 0000000..142e338 --- /dev/null +++ b/jscocoa/JSCocoa/class.js @@ -0,0 +1,1055 @@ + + // ObjC + var nil = null + var YES = true + var NO = false + + + if ('OSX' in this) + { + var JSCocoaController = OSX.JSCocoaController + var NSApp = null + } + + + function log(str) { __jsc__.log_('' + str) } + // This one is because I can't bring myself to not typing alert. + function alert(str) { log('********USE log(), not alert()*********'), log(str) } + + function dumpHash(o) { var str = ''; for (var i in o) str += i + '=' + o[i] + '\n'; return str } + + // + // ObjC type encodings + // http://developer.apple.com/mac/library/documentation/cocoa/conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html + // + // Used to write ObjC methods in Javascript + // + var types = ['char', 'int', 'short', 'long', 'long long', 'unsigned char', 'unsigned int', 'unsigned short', 'unsigned long', + 'unsigned long long', 'float', 'double', 'bool', 'void', 'char*', 'id', 'Class', 'selector', 'BOOL', 'void*', + 'NSInteger', 'NSUInteger', 'CGFloat']; + var encodings = {} + var l = types.length + // Encodings are architecture dependent and were encoded at compile time, retrieve them now + for (var i=0; i item + // -> id item + encoding = encoding.replace(/\s*<\s*\w+\s*>\s*/, '').toString() + + + // Structure arg +// if (encoding.indexOf(' ') != -1 && encoding.indexOf('*') == -1) + if (encoding.match(/struct \w+/)) + { + var structureName = encoding.split(' ')[1] + var structureEncoding = JSCocoaFFIArgument.structureFullTypeEncodingFromStructureName(structureName) + if (!structureEncoding) throw 'no encoding found for structure ' + structureName + + // + // Remove names of variables to keep only encodings + // + // {_NSPoint="x"f"y"f} + // becomes + // {_NSPoint=ff} + // +// JSCocoaController.log('*' + structureEncoding + '*' + String(String(structureEncoding).replace(/"[^"]+"/gi, "")) + '*') + return String(String(structureEncoding).replace(/"[^"]+"/gi, "")) + } + else + { + if (!(encoding in encodings)) + { + // Pointer to an ObjC object ? + var match = encoding.match(/^(\w+)\s*(\*+)$/) + if (match) + { + var className = match[1] + + // + // this[className]['class'] == this[className] + // can only work if each object is boxed only once : + // both expressions will return the same object, comparing one object to itself + // -> true + // + // BUT if both expressions each use their own box, comparison will come negative + // + var starCount = match[2].toString().length + if (className in this && this[className]['class'] == this[className]) + { + // ** is a pointer to class + return starCount > 1 ? '^@' : '@' + } + else + if (starCount == 1) + { + var rawEncoding = encoding.replace(/\*/, '') + rawEncoding = encodings[rawEncoding] + if (rawEncoding) return '^' + rawEncoding + } + } + // Structure ? + var structureEncoding = JSCocoaFFIArgument.structureFullTypeEncodingFromStructureName(encoding) + if (structureEncoding) return String(String(structureEncoding).replace(/"[^"]+"/gi, "")) + throw 'invalid encoding : "' + encoding + '"' + } + return encodings[encoding] + } + } + + function objc_encoding() + { + var encoding = objc_unary_encoding(arguments[0]) + encoding += '@:' + + for (var i=1; i + // + function describeStruct(o, level) + { + if (level == undefined) level = 0 + // Bail if structure contains a cycle + if (level > 100) return '' + + var str = '' + if (typeof(o) == 'object' || typeof(o) == 'function') + { + str += '{' + var elements = [] + for (var i in o) + elements.push(i + ':' + describeStruct(o[i], level+1)) + str += elements.join(', ') + str += '}' + } + else + str += o + + return str + } + + + // + // type o + // + function outArgument() + { + // Derive to store some javascript data in the internal hash + if (!('outArgument2' in this)) + JSCocoa.createClass_parentClass_('JSCocoaOutArgument2', 'JSCocoaOutArgument') + + var o = JSCocoaOutArgument2.instance + o.isOutArgument = true + if (arguments.length == 2) o.mateWithMemoryBuffer_atIndex_(arguments[0], arguments[1]) + + return o + } + + + function memoryBuffer(types) + { + var o = JSCocoaMemoryBuffer.instanceWithTypes(types) + o.isOutArgument = true + return o + } + + + // + // Dump the call stack with arguments.calle.caller (Called from JSCocoa) + // + // Eric Wendelin's Javascript stacktrace in any browser + // http://eriwen.com/javascript/js-stack-trace/ + // + function dumpCallStack() + { + var maxDumpDepth = 100 + var dumpDepth = 0 + var caller = arguments.callee.caller + // Skip ourselves + caller = caller.caller + + // Build call stack + var stack = [] + while (caller && dumpDepth < maxDumpDepth) + { + var fn = caller.toString() + var fname = fn.substring(fn.indexOf("function") + 9, fn.indexOf("(")) || "anonymous"; + var str = fname + if (caller.arguments.length) + { + str += ' (' + for (var i=0; i 0 && leftCount == rightCount) return { left : i, right : matchIndex } + } + return { left : -1, right : -1 } + } + + function trackRightFromOperator(stream, tokenIndex, operator) + { + var right = operator.right + var lastToken + while (right) + { + lastToken = right + right = right.rightParen || right.right + } + if (!lastToken) return -1 + var l = stream.length-1 + for (; tokenIndex' + transformed) + return transformed + } + + function allKeysInHash(o) + { + var r = [] + for (var i in this) r.push(i) + return r + } diff --git a/jscocoa/JSCocoa/iPhone/BurksPool.h b/jscocoa/JSCocoa/iPhone/BurksPool.h new file mode 100644 index 0000000..30942cf --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/BurksPool.h @@ -0,0 +1,33 @@ +// +// BurksPool.h +// iPhoneTest2 +// +// Created by Patrick Geiller on 19/08/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "../JSCocoaController.h" + + +/* + + Tim Burks http://stackoverflow.com/questions/219653/ruby-on-iphone + + In the iPhone OS, mprotect() will fail if you try to use it to mark writable sections of memory as executable. This breaks bridges like RubyCocoa (and probably MacRuby) that use libffi to create Objective-C method handlers at runtime. I believe that this is by design because it was not always the case. + + Ultimately, this is more a matter of platform politics than technology, but a technical workaround for this exists. Instead of generating custom method handlers at runtime, precompile a pool of reconfigurable ones that are assigned as needed, essentially making the bridging process entirely data-driven. As far as I know, this is not yet being done in RubyCocoa or MacRuby. + + Another significant thing to consider is that the compiled Ruby and RubyCocoa runtimes can be significantly larger than compiled Objective-C apps. If these libraries were available on the iPhone, this wouldn't be an issue, but for now, even if you had RubyCocoa working, you might not want to use it for apps that you distribute. + +*/ +@interface BurksPool : NSObject { + +} + ++ (void)setJSFunctionHash:(id)jsFunctionHash; ++ (IMP)IMPforTypeEncodings:(NSArray*)encodings; ++ (BOOL)addMethod:(NSString*)methodName class:(Class)class jsFunction:(JSValueRefAndContextRef)valueAndContext encodings:(id)encodings; ++ (JSValueRef)callSelector:(SEL)sel ofInstance:(id)o writeContext:(JSContextRef*)_ctx withArguments:(void*)firstArg, ...; ++ (id)flattenEncoding:(id)encodings; + +@end diff --git a/jscocoa/JSCocoa/iPhone/BurksPool.m b/jscocoa/JSCocoa/iPhone/BurksPool.m new file mode 100644 index 0000000..4f13beb --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/BurksPool.m @@ -0,0 +1,224 @@ +// +// BurksPool.m +// iPhoneTest2 +// +// Created by Patrick Geiller on 19/08/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "BurksPool.h" +#import "JSCocoaController.h" +#import "JSCocoaFFIArgument.h" +#import + + +// Parsed instance implementations for class +// IMPs[encoding] = matchingIMP +static id IMPs = nil; +static id methodEncodings = nil; +// Imported from JSCocoaController +static id jsFunctionHash = nil; + + +@implementation BurksPool + + +// +// Instance methods : JSCocoaController's addMethod uses their implementation as callbacks for new methods +// +- (id)id_ +{ + JSContextRef ctx; + JSValueRef r = [BurksPool callSelector:_cmd ofInstance:self writeContext:&ctx withArguments:NULL]; + return [[JSCocoaController controllerFromContext:ctx] toObject:r]; +} + +- (void)v_ +{ + [BurksPool callSelector:_cmd ofInstance:self writeContext:NULL withArguments:NULL]; +} + +- (void)v_id:(id)p1 +{ + [BurksPool callSelector:_cmd ofInstance:self writeContext:NULL withArguments:&p1, NULL]; +} + +- (void)v_id:(id)p1 id:(id)p2 +{ + [BurksPool callSelector:_cmd ofInstance:self writeContext:NULL withArguments:&p1, &p2, NULL]; +} + +- (int)i_id:(id)p1 +{ + JSContextRef ctx; + JSValueRef r = [BurksPool callSelector:_cmd ofInstance:self writeContext:&ctx withArguments:&p1, NULL]; + return [[JSCocoaController controllerFromContext:ctx] toInt:r]; +} + +- (int)i_id:(id)p1 i:(int)p2 +{ + JSContextRef ctx; + JSValueRef r = [BurksPool callSelector:_cmd ofInstance:self writeContext:&ctx withArguments:&p1, &p2, NULL]; + return [[JSCocoaController controllerFromContext:ctx] toInt:r]; +} + +- (id)i_id:(id)p1 id:(id)p2 +{ + JSContextRef ctx; + JSValueRef r = [BurksPool callSelector:_cmd ofInstance:self writeContext:&ctx withArguments:&p1, &p2, NULL]; + return [[JSCocoaController controllerFromContext:ctx] toObject:r]; +} + +- (void)drawRect:(CGRect)p1 +{ + [BurksPool callSelector:_cmd ofInstance:self writeContext:NULL withArguments:&p1, NULL]; +} + + + +// +// From a key (class method), get a JSCocoaPrivateObject containing context + js function +// (called by JSCocoaController) +// ++ (void)setJSFunctionHash:(id)hash +{ + jsFunctionHash = hash; +} + +// +// Call the iPhone js function given a class and method +// ++ (JSValueRef)callSelector:(SEL)sel ofInstance:(id)o writeContext:(JSContextRef*)_ctx withArguments:(void*)firstArg, ... +{ + id keyForClassAndMethod = [NSString stringWithFormat:@"%@ %@", [o class], NSStringFromSelector(sel)]; + id encodings = [methodEncodings objectForKey:keyForClassAndMethod]; + id privateObject = [jsFunctionHash objectForKey:keyForClassAndMethod]; + +// NSLog(@"Call %@ encoding=%@", keyForClassAndMethod, [self flattenEncoding:encodings]); + + if (!encodings) return NSLog(@"No encodings found for %@", keyForClassAndMethod), NULL; + if (!privateObject) return NSLog(@"No js function found for %@", keyForClassAndMethod), NULL; + + JSContextRef ctx = [privateObject ctx]; + if (_ctx) *_ctx = ctx; + + // One to skip return value, 2 to skip common ObjC message parameters (instance, selector) + int effectiveArgumentCount = [encodings count]-1-2; + int idx = 2+1; + + // Convert arguments + JSValueRef* args = NULL; + if (effectiveArgumentCount) + { + args = malloc(effectiveArgumentCount*sizeof(JSValueRef)); + + va_list vaargs; + va_start(vaargs, firstArg); + for (int i=0; i @8@0:4 -> @@:) +// ++ (void)gatherIMPs +{ + IMPs = [[NSMutableDictionary alloc] init]; + unsigned int methodCount; + Method* methods = class_copyMethodList([self class], &methodCount); + for (int i=0; i= 1050 + #define GDATA_FOREACH(element, collection) \ + for (element in collection) + #else + #define GDATA_FOREACH(element, collection) \ + for(id _ ## element ## _enum = [collection objectEnumerator]; \ + (element = [_ ## element ## _enum nextObject]) != nil; ) + #endif +#endif + + +// To simplify support for 64bit (and Leopard in general), we provide the type +// defines for non Leopard SDKs +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 + // NSInteger/NSUInteger and Max/Mins + #ifndef NSINTEGER_DEFINED + #if __LP64__ || NS_BUILD_32_LIKE_64 + typedef long NSInteger; + typedef unsigned long NSUInteger; + #else + typedef int NSInteger; + typedef unsigned int NSUInteger; + #endif + #define NSIntegerMax LONG_MAX + #define NSIntegerMin LONG_MIN + #define NSUIntegerMax ULONG_MAX + #define NSINTEGER_DEFINED 1 + #endif // NSINTEGER_DEFINED +#endif // MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 diff --git a/jscocoa/JSCocoa/iPhone/GDataXMLNode.h b/jscocoa/JSCocoa/iPhone/GDataXMLNode.h new file mode 100644 index 0000000..ac0c6cc --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/GDataXMLNode.h @@ -0,0 +1,173 @@ +/* Copyright (c) 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// These node, element, and document classes implement a subset of the methods +// provided by NSXML. While NSXML behavior is mimicked as much as possible, +// there are important differences. +// +// The biggest difference is that, since this is based on libxml2, there +// is no retain model for the underlying node data. Rather than copy every +// node obtained from a parse tree (which would have a substantial memory +// impact), we rely on weak references, and it is up to the code that +// created a document to retain it for as long as any +// references rely on nodes inside that document tree. + + +#import + +// libxml includes require that the target Header Search Paths contain +// +// /usr/include/libxml2 +// +// and Other Linker Flags contain +// +// -lxml2 + +#import +#import +#import +#import +#import + +#import "GDataDefines.h" + +// Nomenclature for method names: +// +// Node = GData node +// XMLNode = xmlNodePtr +// +// So, for example: +// + (id)nodeConsumingXMLNode:(xmlNodePtr)theXMLNode; + +@class NSArray, NSDictionary, NSError, NSString, NSURL; +@class GDataXMLElement, GDataXMLDocument; + +enum { + GDataXMLInvalidKind = 0, + GDataXMLDocumentKind, + GDataXMLElementKind, + GDataXMLAttributeKind, + GDataXMLNamespaceKind, + GDataXMLProcessingInstructionKind, + GDataXMLCommentKind, + GDataXMLTextKind, + GDataXMLDTDKind, + GDataXMLEntityDeclarationKind, + GDataXMLAttributeDeclarationKind, + GDataXMLElementDeclarationKind, + GDataXMLNotationDeclarationKind +}; + +typedef NSUInteger GDataXMLNodeKind; + +@interface GDataXMLNode : NSObject { +@protected + // NSXMLNodes can have a namespace URI or prefix even if not part + // of a tree; xmlNodes cannot. When we create nodes apart from + // a tree, we'll store the dangling prefix or URI in the xmlNode's name, + // like + // "prefix:name" + // or + // "{http://uri}:name" + // + // We will fix up the node's namespace and name (and those of any children) + // later when adding the node to a tree with addChild: or addAttribute:. + // See fixUpNamespacesForNode:. + + xmlNodePtr xmlNode_; // may also be an xmlAttrPtr or xmlNsPtr + BOOL shouldFreeXMLNode_; // if yes, xmlNode_ will be free'd in dealloc + + // cached values + NSString *cachedName_; + NSArray *cachedChildren_; + NSArray *cachedAttributes_; +} + ++ (GDataXMLElement *)elementWithName:(NSString *)name; ++ (GDataXMLElement *)elementWithName:(NSString *)name stringValue:(NSString *)value; ++ (GDataXMLElement *)elementWithName:(NSString *)name URI:(NSString *)value; + ++ (id)attributeWithName:(NSString *)name stringValue:(NSString *)value; ++ (id)attributeWithName:(NSString *)name URI:(NSString *)attributeURI stringValue:(NSString *)value; + ++ (id)namespaceWithName:(NSString *)name stringValue:(NSString *)value; + ++ (id)textWithStringValue:(NSString *)value; + +- (NSString *)stringValue; +- (void)setStringValue:(NSString *)str; + +- (NSUInteger)childCount; +- (NSArray *)children; +- (GDataXMLNode *)childAtIndex:(unsigned)index; + +- (NSString *)localName; +- (NSString *)name; +- (NSString *)prefix; +- (NSString *)URI; + +- (GDataXMLNodeKind)kind; + +- (NSString *)XMLString; + ++ (NSString *)localNameForName:(NSString *)name; ++ (NSString *)prefixForName:(NSString *)name; + +- (NSArray *)nodesForXPath:(NSString *)xpath error:(NSError **)error; + +@end + + +@interface GDataXMLElement : GDataXMLNode { +} + +- (id)initWithXMLString:(NSString *)str error:(NSError **)error; + +- (NSArray *)namespaces; +- (void)setNamespaces:(NSArray *)namespaces; +- (void)addNamespace:(GDataXMLNode *)aNamespace; + +- (void)addChild:(GDataXMLNode *)child; + +- (NSArray *)elementsForName:(NSString *)name; +- (NSArray *)elementsForLocalName:(NSString *)localName URI:(NSString *)URI; + +- (NSArray *)attributes; +- (GDataXMLNode *)attributeForName:(NSString *)name; +- (GDataXMLNode *)attributeForLocalName:(NSString *)name URI:(NSString *)attributeURI; +- (void)addAttribute:(GDataXMLNode *)attribute; + +- (NSString *)resolvePrefixForNamespaceURI:(NSString *)namespaceURI; + +@end + +@interface GDataXMLDocument : NSObject { +@protected + xmlDoc* xmlDoc_; // strong; always free'd in dealloc +} + +- (id)initWithXMLString:(NSString *)str options:(unsigned int)mask error:(NSError **)error; +- (id)initWithData:(NSData *)data options:(unsigned int)mask error:(NSError **)error; +- (id)initWithRootElement:(GDataXMLElement *)element; + +- (GDataXMLElement *)rootElement; + +- (NSData *)XMLData; + +- (void)setVersion:(NSString *)version; +- (void)setCharacterEncoding:(NSString *)encoding; + +- (NSString *)description; +@end \ No newline at end of file diff --git a/jscocoa/JSCocoa/iPhone/GDataXMLNode.m b/jscocoa/JSCocoa/iPhone/GDataXMLNode.m new file mode 100644 index 0000000..656e2d7 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/GDataXMLNode.m @@ -0,0 +1,1517 @@ +/* Copyright (c) 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#import "GDataXMLNode.h" + +@class NSArray, NSDictionary, NSError, NSString, NSURL; +@class GDataXMLElement, GDataXMLDocument; + + +static const int kGDataXMLParseOptions = (XML_PARSE_NOCDATA | XML_PARSE_NOBLANKS); + + +// isEqual: has the fatal flaw that it doesn't deal well with the received +// being nil. We'll use this utility instead. + +// Static copy of AreEqualOrBothNil from GDataObject.m, so that using +// GDataXMLNode does not require pulling in all of GData. +static BOOL AreEqualOrBothNilPrivate(id obj1, id obj2) { + if (obj1 == obj2) { + return YES; + } + if (obj1 && obj2) { + return [obj1 isEqual:obj2]; + } + return NO; +} + + +// convert NSString* to xmlChar* +// +// the "Get" part implies that ownership remains with str + +static xmlChar* GDataGetXMLString(NSString *str) { + xmlChar* result = (xmlChar *)[str UTF8String]; + return result; +} + +// convert xmlChar* to NSString* +// +// returns an autoreleased NSString* + +static NSString* GDataStringFromXMLString(const xmlChar *chars) { + +#if DEBUG + NSCAssert(chars != NULL, @"GDataXMLNode sees an unexpected empty string"); +#endif + if (chars == NULL) return nil; + + NSString *result = [NSString stringWithUTF8String:(const char *) chars]; + return result; +} + +// Make a fake qualified name we use as local name internally in libxml +// data structures when there's no actual namespace node available to point to +// from an element or attribute node +// +// Returns an autoreleased NSString* + +static NSString *GDataFakeQNameForURIAndName(NSString *theURI, NSString *name) { + + NSString *localName = [GDataXMLNode localNameForName:name]; + NSString *fakeQName = [NSString stringWithFormat:@"{%@}:%@", + theURI, localName]; + return fakeQName; +} + + +// libxml2 offers xmlSplitQName2, but that searches forwards. Since we may +// be searching for a whole URI shoved in as a prefix, like +// {http://foo}:name +// we'll search for the prefix in backwards from the end of the qualified name +// +// returns a copy of qname as the local name if there's no prefix +static xmlChar *SplitQNameReverse(const xmlChar *qname, xmlChar **prefix) { + + // search backwards for a colon + int qnameLen = xmlStrlen(qname); + for (int idx = qnameLen - 1; idx >= 0; idx--) { + + if (qname[idx] == ':') { + + // found the prefix; copy the prefix, if requested + if (prefix != NULL) { + if (idx > 0) { + *prefix = xmlStrsub(qname, 0, idx); + } else { + *prefix = NULL; + } + } + + if (idx < qnameLen - 1) { + // return a copy of the local name + xmlChar *localName = xmlStrsub(qname, idx + 1, qnameLen - idx - 1); + return localName; + } else { + return NULL; + } + } + } + + // no colon found, so the qualified name is the local name + xmlChar *qnameCopy = xmlStrdup(qname); + return qnameCopy; +} + +@interface GDataXMLNode (PrivateMethods) + +// consuming a node implies it will later be freed when the instance is +// dealloc'd; borrowing it implies that ownership and disposal remain the +// job of the supplier of the node + ++ (id)nodeConsumingXMLNode:(xmlNodePtr)theXMLNode; +- (id)initConsumingXMLNode:(xmlNodePtr)theXMLNode; + ++ (id)nodeBorrowingXMLNode:(xmlNodePtr)theXMLNode; +- (id)initBorrowingXMLNode:(xmlNodePtr)theXMLNode; + +// getters of the underlying node +- (xmlNodePtr)XMLNode; +- (xmlNodePtr)XMLNodeCopy; + +// setter/getter of the dealloc flag for the underlying node +- (BOOL)shoudFreeXMLNode; +- (void)setShouldFreeXMLNode:(BOOL)flag; + +@end + +@interface GDataXMLElement (PrivateMethods) + ++ (void)fixUpNamespacesForNode:(xmlNodePtr)nodeToFix + graftingToTreeNode:(xmlNodePtr)graftPointNode; +@end + +@implementation GDataXMLNode + ++ (void)load { + xmlInitParser(); +} + +// Note on convenience methods for making stand-alone element and +// attribute nodes: +// +// Since we're making a node from scratch, we don't +// have any namespace info. So the namespace prefix, if +// any, will just be slammed into the node name. +// We'll rely on the -addChild method below to remove +// the namespace prefix and replace it with a proper ns +// pointer. + ++ (GDataXMLElement *)elementWithName:(NSString *)name { + + xmlNodePtr theNewNode = xmlNewNode(NULL, // namespace + GDataGetXMLString(name)); + if (theNewNode) { + // succeeded + return [self nodeConsumingXMLNode:theNewNode]; + } + return nil; +} + ++ (GDataXMLElement *)elementWithName:(NSString *)name stringValue:(NSString *)value { + + xmlNodePtr theNewNode = xmlNewNode(NULL, // namespace + GDataGetXMLString(name)); + if (theNewNode) { + + xmlNodePtr textNode = xmlNewText(GDataGetXMLString(value)); + if (textNode) { + + xmlNodePtr temp = xmlAddChild(theNewNode, textNode); + if (temp) { + // succeeded + return [self nodeConsumingXMLNode:theNewNode]; + } + } + + // failed; free the node and any children + xmlFreeNode(theNewNode); + } + return nil; +} + ++ (GDataXMLElement *)elementWithName:(NSString *)name URI:(NSString *)theURI { + + // since we don't know a prefix yet, shove in the whole URI; we'll look for + // a proper namespace ptr later when addChild calls fixUpNamespacesForNode + + NSString *fakeQName = GDataFakeQNameForURIAndName(theURI, name); + + xmlNodePtr theNewNode = xmlNewNode(NULL, // namespace + GDataGetXMLString(fakeQName)); + if (theNewNode) { + return [self nodeConsumingXMLNode:theNewNode]; + } + return nil; +} + ++ (id)attributeWithName:(NSString *)name stringValue:(NSString *)value { + + xmlChar *xmlName = GDataGetXMLString(name); + xmlChar *xmlValue = GDataGetXMLString(value); + + xmlAttrPtr theNewAttr = xmlNewProp(NULL, // parent node for the attr + xmlName, xmlValue); + if (theNewAttr) { + return [self nodeConsumingXMLNode:(xmlNodePtr) theNewAttr]; + } + + return nil; +} + ++ (id)attributeWithName:(NSString *)name URI:(NSString *)attributeURI stringValue:(NSString *)value { + + // since we don't know a prefix yet, shove in the whole URI; we'll look for + // a proper namespace ptr later when addChild calls fixUpNamespacesForNode + + NSString *fakeQName = GDataFakeQNameForURIAndName(attributeURI, name); + + xmlChar *xmlName = GDataGetXMLString(fakeQName); + xmlChar *xmlValue = GDataGetXMLString(value); + + xmlAttrPtr theNewAttr = xmlNewProp(NULL, // parent node for the attr + xmlName, xmlValue); + if (theNewAttr) { + return [self nodeConsumingXMLNode:(xmlNodePtr) theNewAttr]; + } + + return nil; +} + ++ (id)textWithStringValue:(NSString *)value { + + xmlNodePtr theNewText = xmlNewText(GDataGetXMLString(value)); + if (theNewText) { + return [self nodeConsumingXMLNode:theNewText]; + } + return nil; +} + ++ (id)namespaceWithName:(NSString *)name stringValue:(NSString *)value { + + xmlChar *href = GDataGetXMLString(value); + xmlChar *prefix; + + if ([name length] > 0) { + prefix = GDataGetXMLString(name); + } else { + // default namespace is represented by a nil prefix + prefix = nil; + } + + xmlNsPtr theNewNs = xmlNewNs(NULL, // parent node + href, prefix); + if (theNewNs) { + return [self nodeConsumingXMLNode:(xmlNodePtr) theNewNs]; + } + return nil; +} + ++ (id)nodeConsumingXMLNode:(xmlNodePtr)theXMLNode { + Class theClass; + + if (theXMLNode->type == XML_ELEMENT_NODE) { + theClass = [GDataXMLElement class]; + } else { + theClass = [GDataXMLNode class]; + } + return [[[theClass alloc] initConsumingXMLNode:theXMLNode] autorelease]; +} + +- (id)initConsumingXMLNode:(xmlNodePtr)theXMLNode { + self = [super init]; + if (self) { + xmlNode_ = theXMLNode; + shouldFreeXMLNode_ = YES; + } + return self; +} + ++ (id)nodeBorrowingXMLNode:(xmlNodePtr)theXMLNode { + Class theClass; + if (theXMLNode->type == XML_ELEMENT_NODE) { + theClass = [GDataXMLElement class]; + } else { + theClass = [GDataXMLNode class]; + } + + return [[[theClass alloc] initBorrowingXMLNode:theXMLNode] autorelease]; +} + +- (id)initBorrowingXMLNode:(xmlNodePtr)theXMLNode { + self = [super init]; + if (self) { + xmlNode_ = theXMLNode; + shouldFreeXMLNode_ = NO; + } + return self; +} + +- (void)releaseCachedValues { + + [cachedName_ release]; + cachedName_ = nil; + + [cachedChildren_ release]; + cachedChildren_ = nil; + + [cachedAttributes_ release]; + cachedAttributes_ = nil; +} + +- (void)dealloc { + + if (xmlNode_ && shouldFreeXMLNode_) { + xmlFreeNode(xmlNode_); + } + + [self releaseCachedValues]; + [super dealloc]; +} + +#pragma mark - + +- (void)setStringValue:(NSString *)str { + if (xmlNode_ != NULL && str != nil) { + + if (xmlNode_->type == XML_NAMESPACE_DECL) { + + // for a namespace node, the value is the namespace URI + xmlNsPtr nsNode = (xmlNsPtr)xmlNode_; + + if (nsNode->href != NULL) xmlFree((char *)nsNode->href); + + nsNode->href = xmlStrdup(GDataGetXMLString(str)); + + } else { + + // attribute or element node + + // do we need to call xmlEncodeSpecialChars? + xmlNodeSetContent(xmlNode_, GDataGetXMLString(str)); + } + } +} + +- (NSString *)stringValue { + + NSString *str = nil; + + if (xmlNode_ != NULL) { + + if (xmlNode_->type == XML_NAMESPACE_DECL) { + + // for a namespace node, the value is the namespace URI + xmlNsPtr nsNode = (xmlNsPtr)xmlNode_; + + str = GDataStringFromXMLString(nsNode->href); + + } else { + + // attribute or element node + xmlChar* chars = xmlNodeGetContent(xmlNode_); + if (chars) { + + str = GDataStringFromXMLString(chars); + + xmlFree(chars); + } + } + } + return str; +} + +- (NSString *)XMLString { + + NSString *str = nil; + + if (xmlNode_ != NULL) { + + xmlBufferPtr buff = xmlBufferCreate(); + if (buff) { + + xmlDocPtr doc = NULL; + int level = 0; + int format = 0; + + int result = xmlNodeDump(buff, doc, xmlNode_, level, format); + + if (result > -1) { + str = [[[NSString alloc] initWithBytes:(xmlBufferContent(buff)) + length:(xmlBufferLength(buff)) + encoding:NSUTF8StringEncoding] autorelease]; + } + xmlBufferFree(buff); + } + } + + // remove leading and trailing whitespace + NSCharacterSet *ws = [NSCharacterSet whitespaceAndNewlineCharacterSet]; + NSString *trimmed = [str stringByTrimmingCharactersInSet:ws]; + return trimmed; +} + +- (NSString *)localName { + NSString *str = nil; + + if (xmlNode_ != NULL) { + + str = GDataStringFromXMLString(xmlNode_->name); + + // if this is part of a detached subtree, str may have a prefix in it + str = [[self class] localNameForName:str]; + } + return str; +} + +- (NSString *)prefix { + + NSString *str = nil; + + if (xmlNode_ != NULL) { + + // the default namespace's prefix is an empty string, though libxml + // represents it as NULL for ns->prefix + str = @""; + + if (xmlNode_->ns != NULL && xmlNode_->ns->prefix != NULL) { + str = GDataStringFromXMLString(xmlNode_->ns->prefix); + } + } + return str; +} + +- (NSString *)URI { + + NSString *str = nil; + + if (xmlNode_ != NULL) { + + if (xmlNode_->ns != NULL && xmlNode_->ns->href != NULL) { + str = GDataStringFromXMLString(xmlNode_->ns->href); + } + } + return str; +} + ++ (NSString *)qualifiedNameForXMLNode:(xmlNodePtr)node { + // internal utility + + NSString *str = nil; + + if (node != NULL) { + if (node->type == XML_NAMESPACE_DECL) { + + // name of a namespace node + xmlNsPtr nsNode = (xmlNsPtr)node; + + // null is the default namespace; one is the loneliest number + if (nsNode->prefix == NULL) { + str = @""; + } + else { + str = GDataStringFromXMLString(nsNode->prefix); + } + + } else if (node->ns != NULL && node->ns->prefix != NULL) { + + // name of a non-namespace node + + // has a prefix + str = [NSString stringWithFormat:@"%s:%s", + (const char *)node->ns->prefix, node->name]; + } else { + // lacks a prefix + str = GDataStringFromXMLString(node->name); + } + } + + return str; +} + +- (NSString *)name { + + if (cachedName_ != nil) { + return cachedName_; + } + + NSString *str = [[self class] qualifiedNameForXMLNode:xmlNode_]; + + cachedName_ = [str retain]; + + return str; +} + ++ (NSString *)localNameForName:(NSString *)name { + if (name != nil) { + + NSRange range = [name rangeOfString:@":"]; + if (range.location != NSNotFound) { + + // found a colon + if (range.location + 1 < [name length]) { + NSString *localName = [name substringFromIndex:(range.location + 1)]; + return localName; + } + } + } + return name; +} + ++ (NSString *)prefixForName:(NSString *)name { + if (name != nil) { + + NSRange range = [name rangeOfString:@":"]; + if (range.location != NSNotFound) { + + NSString *prefix = [name substringToIndex:(range.location)]; + return prefix; + } + } + return nil; +} + +- (NSUInteger)childCount { + + if (cachedChildren_ != nil) { + return [cachedChildren_ count]; + } + + if (xmlNode_ != NULL) { + + unsigned int count = 0; + + xmlNodePtr currChild = xmlNode_->children; + + while (currChild != NULL) { + ++count; + currChild = currChild->next; + } + return count; + } + return 0; +} + +- (NSArray *)children { + + if (cachedChildren_ != nil) { + return cachedChildren_; + } + + if (xmlNode_ != NULL) { + + NSMutableArray *array = [NSMutableArray array]; + + xmlNodePtr currChild = xmlNode_->children; + + while (currChild != NULL) { + GDataXMLNode *node = [GDataXMLNode nodeBorrowingXMLNode:currChild]; + [array addObject:node]; + + currChild = currChild->next; + } + + cachedChildren_ = [array retain]; + + return array; + } + return nil; +} + +- (GDataXMLNode *)childAtIndex:(unsigned)index { + + NSArray *children = [self children]; + + if ([children count] > index) { + + return [children objectAtIndex:index]; + } + return nil; +} + +- (GDataXMLNodeKind)kind { + if (xmlNode_ != NULL) { + xmlElementType nodeType = xmlNode_->type; + switch (nodeType) { + case XML_ELEMENT_NODE: return GDataXMLElementKind; + case XML_ATTRIBUTE_NODE: return GDataXMLAttributeKind; + case XML_TEXT_NODE: return GDataXMLTextKind; + case XML_CDATA_SECTION_NODE: return GDataXMLTextKind; + case XML_ENTITY_REF_NODE: return GDataXMLEntityDeclarationKind; + case XML_ENTITY_NODE: return GDataXMLEntityDeclarationKind; + case XML_PI_NODE: return GDataXMLProcessingInstructionKind; + case XML_COMMENT_NODE: return GDataXMLCommentKind; + case XML_DOCUMENT_NODE: return GDataXMLDocumentKind; + case XML_DOCUMENT_TYPE_NODE: return GDataXMLDocumentKind; + case XML_DOCUMENT_FRAG_NODE: return GDataXMLDocumentKind; + case XML_NOTATION_NODE: return GDataXMLNotationDeclarationKind; + case XML_HTML_DOCUMENT_NODE: return GDataXMLDocumentKind; + case XML_DTD_NODE: return GDataXMLDTDKind; + case XML_ELEMENT_DECL: return GDataXMLElementDeclarationKind; + case XML_ATTRIBUTE_DECL: return GDataXMLAttributeDeclarationKind; + case XML_ENTITY_DECL: return GDataXMLEntityDeclarationKind; + case XML_NAMESPACE_DECL: return GDataXMLNamespaceKind; + case XML_XINCLUDE_START: return GDataXMLProcessingInstructionKind; + case XML_XINCLUDE_END: return GDataXMLProcessingInstructionKind; + case XML_DOCB_DOCUMENT_NODE: return GDataXMLDocumentKind; + } + } + return GDataXMLInvalidKind; +} + +- (NSArray *)nodesForXPath:(NSString *)xpath error:(NSError **)error { + + NSMutableArray *array = nil; + + // xmlXPathNewContext requires a doc for its context, but if our elements + // are created from GDataXMLElement's initWithXMLString there may not be + // a document. (We may later decide that we want to stuff the doc used + // there into a GDataXMLDocument and retain it, but we don't do that now.) + // + // We'll temporarily make a document to use for the xpath context. + + xmlDocPtr tempDoc = NULL; + xmlNodePtr topParent = NULL; + + if (xmlNode_->doc == NULL) { + tempDoc = xmlNewDoc(NULL); + if (tempDoc) { + // find the topmost node of the current tree to make the root of + // our temporary document + topParent = xmlNode_; + while (topParent->parent != NULL) { + topParent = topParent->parent; + } + xmlDocSetRootElement(tempDoc, topParent); + } + } + + if (xmlNode_ != NULL && xmlNode_->doc != NULL) { + + xmlXPathContextPtr xpathCtx = xmlXPathNewContext(xmlNode_->doc); + if (xpathCtx) { + + // anchor at our current node + xpathCtx->node = xmlNode_; + + xmlXPathObjectPtr xpathObj; + xpathObj = xmlXPathEval(GDataGetXMLString(xpath), xpathCtx); + if (xpathObj) { + + // we have some result from the search + array = [NSMutableArray array]; + + xmlNodeSetPtr nodeSet = xpathObj->nodesetval; + if (nodeSet) { + + // add each node in the result set to our array + for (int index = 0; index < nodeSet->nodeNr; index++) { + + xmlNodePtr currNode = nodeSet->nodeTab[index]; + + GDataXMLNode *node = [GDataXMLNode nodeBorrowingXMLNode:currNode]; + if (node) { + [array addObject:node]; + } + } + } + xmlXPathFreeObject(xpathObj); + } + xmlXPathFreeContext(xpathCtx); + } + + if (array == nil) { + + // provide an error + // + // TODO(grobbins) obtain better xpath and libxml errors + const char *msg = xpathCtx->lastError.str1; + NSDictionary *userInfo = nil; + if (msg) { + userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithUTF8String:msg] + forKey:@"error"]; + } + *error = [NSError errorWithDomain:@"com.google.GDataXML" + code:xpathCtx->lastError.code + userInfo:userInfo]; + } + } + + if (tempDoc != NULL) { + xmlUnlinkNode(topParent); + xmlSetTreeDoc(topParent, NULL); + xmlFreeDoc(tempDoc); + } + return array; +} + +- (NSString *)description { + int nodeType = (xmlNode_ ? (int)xmlNode_->type : -1); + + return [NSString stringWithFormat:@"%@ 0x%lX: {type:%d name:%@ xml:\"%@\"}", + [self class], self, nodeType, [self name], [self XMLString]]; +} + +- (id)copyWithZone:(NSZone *)zone { + + xmlNodePtr nodeCopy = [self XMLNodeCopy]; + + if (nodeCopy != NULL) { + return [[GDataXMLNode alloc] initConsumingXMLNode:nodeCopy]; + } + return nil; +} + +- (BOOL)isEqual:(GDataXMLNode *)other { + if (self == other) return YES; + if (![other isKindOfClass:[GDataXMLNode class]]) return NO; + + return [self XMLNode] == [other XMLNode] + || ([self kind] == [other kind] + && AreEqualOrBothNilPrivate([self name], [other name]) + && [[self children] count] == [[other children] count]); + +} + +- (NSUInteger)hash { + return (NSUInteger) (void *) [GDataXMLNode class]; +} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector { + return [super methodSignatureForSelector:selector]; +} + +#pragma mark - + +- (xmlNodePtr)XMLNodeCopy { + if (xmlNode_ != NULL) { + + // Note: libxml will create a new copy of namespace nodes (xmlNs records) + // and attach them to this copy in order to keep namespaces within this + // node subtree copy value. + + xmlNodePtr nodeCopy = xmlCopyNode(xmlNode_, 1); // 1 = recursive + return nodeCopy; + } + return NULL; +} + +- (xmlNodePtr)XMLNode { + return xmlNode_; +} + +- (BOOL)shoudFreeXMLNode { + return shouldFreeXMLNode_; +} + +- (void)setShouldFreeXMLNode:(BOOL)flag { + shouldFreeXMLNode_ = flag; +} + +@end + + + +@implementation GDataXMLElement + +- (id)initWithXMLString:(NSString *)str error:(NSError **)error { + self = [super init]; + if (self) { + + const char *utf8Str = [str UTF8String]; + // NOTE: We are assuming a string length that fits into an int. + // int. + xmlDocPtr doc = xmlReadMemory(utf8Str, (int)strlen(utf8Str), NULL, // URL + NULL, // encoding + kGDataXMLParseOptions); + if (doc == NULL) { + if (error) { + // TODO(grobbins) use xmlSetGenericErrorFunc to capture error + } + } else { + // copy the root node from the doc + xmlNodePtr root = xmlDocGetRootElement(doc); + if (root) { + xmlNode_ = xmlCopyNode(root, 1); // 1: recursive + } + xmlFreeDoc(doc); + } + + + if (xmlNode_ == NULL) { + // failure + if (error) { + *error = [NSError errorWithDomain:@"com.google.GDataXML" + code:-1 + userInfo:nil]; + } + [self release]; + return nil; + } + } + return self; +} + +- (NSArray *)namespaces { + + if (xmlNode_ != NULL && xmlNode_->nsDef != NULL) { + + NSMutableArray *array = [NSMutableArray array]; + + xmlNsPtr currNS = xmlNode_->nsDef; + while (currNS != NULL) { + + // add this prefix/URI to the list, unless it's the implicit xml prefix + if (!xmlStrEqual(currNS->prefix, (const xmlChar *) "xml")) { + GDataXMLNode *node = [GDataXMLNode nodeBorrowingXMLNode:(xmlNodePtr) currNS]; + [array addObject:node]; + } + + currNS = currNS->next; + } + + return array; + } + return nil; +} + +- (void)setNamespaces:(NSArray *)namespaces { + + if (xmlNode_ != NULL) { + + [self releaseCachedValues]; + + // remove previous namespaces + if (xmlNode_->nsDef) { + xmlFreeNsList(xmlNode_->nsDef); + xmlNode_->nsDef = NULL; + } + + // add a namespace for each object in the array + NSEnumerator *enumerator = [namespaces objectEnumerator]; + GDataXMLNode *namespace; + while ((namespace = [enumerator nextObject]) != nil) { + + xmlNsPtr ns = (xmlNsPtr) [namespace XMLNode]; + if (ns) { + (void)xmlNewNs(xmlNode_, ns->href, ns->prefix); + } + } + + // we may need to fix this node's own name; the graft point is where + // the namespace search starts, so that points to this node too + [[self class] fixUpNamespacesForNode:xmlNode_ + graftingToTreeNode:xmlNode_]; + } +} + +- (void)addNamespace:(GDataXMLNode *)aNamespace { + + if (xmlNode_ != NULL) { + + [self releaseCachedValues]; + + xmlNsPtr ns = (xmlNsPtr) [aNamespace XMLNode]; + if (ns) { + (void)xmlNewNs(xmlNode_, ns->href, ns->prefix); + + // we may need to fix this node's own name; the graft point is where + // the namespace search starts, so that points to this node too + [[self class] fixUpNamespacesForNode:xmlNode_ + graftingToTreeNode:xmlNode_]; + } + } +} + +- (void)addChild:(GDataXMLNode *)child { + if ([child kind] == GDataXMLAttributeKind) { + [self addAttribute:child]; + return; + } + + if (xmlNode_ != NULL) { + + [self releaseCachedValues]; + + xmlNodePtr childNodeCopy = [child XMLNodeCopy]; + if (childNodeCopy) { + + xmlNodePtr resultNode = xmlAddChild(xmlNode_, childNodeCopy); + if (resultNode == NULL) { + + // failed to add + xmlFreeNode(childNodeCopy); + + } else { + // added this child subtree successfully; see if it has + // previously-unresolved namespace prefixes that can now be fixed up + [[self class] fixUpNamespacesForNode:childNodeCopy + graftingToTreeNode:xmlNode_]; + } + } + } +} + +- (NSArray *)elementsForName:(NSString *)name { + + NSString *desiredName = name; + + if (xmlNode_ != NULL) { + + NSString *prefix = [[self class] prefixForName:desiredName]; + if (prefix) { + + xmlChar* desiredPrefix = GDataGetXMLString(prefix); + + xmlNsPtr foundNS = xmlSearchNs(xmlNode_->doc, xmlNode_, desiredPrefix); + if (foundNS) { + + // we found a namespace; fall back on elementsForLocalName:URI: + // to get the elements + NSString *desiredURI = GDataStringFromXMLString(foundNS->href); + NSString *localName = [[self class] localNameForName:desiredName]; + + NSArray *array = [self elementsForLocalName:localName URI:desiredURI]; + return array; + } + } + + // no namespace found for the node's prefix; try an exact match + // for the name argument, including any prefix + NSMutableArray *array = [NSMutableArray array]; + + xmlNodePtr currNode = xmlNode_->children; + + while (currNode != NULL) { + + // find all children which are elements with the desired name + if (currNode->type == XML_ELEMENT_NODE) { + + NSString *qName = [[self class] qualifiedNameForXMLNode:currNode]; + if ([qName isEqual:name]) { + + GDataXMLNode *node = [GDataXMLNode nodeBorrowingXMLNode:currNode]; + [array addObject:node]; + } + } + currNode = currNode->next; + } + return array; + } + return nil; +} + +- (NSArray *)elementsForLocalName:(NSString *)localName URI:(NSString *)URI { + + if (xmlNode_ != NULL && xmlNode_->children != NULL) { + + NSMutableArray *array = [NSMutableArray array]; + + xmlNodePtr currChild = xmlNode_->children; + + xmlChar* desiredNSHref = GDataGetXMLString(URI); + xmlChar* desiredLocalName = GDataGetXMLString(localName); + + xmlNsPtr foundNS = xmlSearchNsByHref(xmlNode_->doc, xmlNode_, desiredNSHref); + if (foundNS == NULL) { + NSString *fakeQName = GDataFakeQNameForURIAndName(URI, localName); + desiredLocalName = GDataGetXMLString(fakeQName); + } + + while (currChild != NULL) { + + // find all children which are elements with the desired name and + // namespace, or with the prefixed name and a null namespace + if (currChild->type == XML_ELEMENT_NODE) { + + if (currChild->ns == foundNS + && currChild->name != NULL + && xmlStrEqual(currChild->name, desiredLocalName)) { + + GDataXMLNode *node = [GDataXMLNode nodeBorrowingXMLNode:currChild]; + [array addObject:node]; + } + } + currChild = currChild->next; + } + + // we return nil, not an empty array, according to docs + if ([array count] > 0) { + return array; + } + } + return nil; +} + +- (NSArray *)attributes { + + if (cachedAttributes_ != nil) { + return cachedAttributes_; + } + + if (xmlNode_ != NULL && xmlNode_->properties != NULL) { + + NSMutableArray *array = [NSMutableArray array]; + + xmlAttrPtr prop = xmlNode_->properties; + while (prop != NULL) { + + GDataXMLNode *node = [GDataXMLNode nodeBorrowingXMLNode:(xmlNodePtr) prop]; + [array addObject:node]; + + prop = prop->next; + } + + cachedAttributes_ = [array retain]; + + return array; + } + return nil; +} + +- (void)addAttribute:(GDataXMLNode *)attribute { + + if (xmlNode_ != NULL) { + + [self releaseCachedValues]; + + xmlAttrPtr attrPtr = (xmlAttrPtr) [attribute XMLNode]; + if (attrPtr) { + + // ignore this if an attribute with the name is already present, + // similar to NSXMLNode's addAttribute + xmlAttrPtr oldAttr; + + if (attrPtr->ns == NULL) { + oldAttr = xmlHasProp(xmlNode_, attrPtr->name); + } else { + oldAttr = xmlHasNsProp(xmlNode_, attrPtr->name, attrPtr->ns->href); + } + + if (oldAttr == NULL) { + + xmlNsPtr newPropNS = NULL; + + // if this attribute has a namespace, search for a matching namespace + // on the node we're adding to + if (attrPtr->ns != NULL) { + + newPropNS = xmlSearchNsByHref(xmlNode_->doc, xmlNode_, attrPtr->ns->href); + if (newPropNS == NULL) { + // make a new namespace on the parent node, and use that for the + // new attribute + newPropNS = xmlNewNs(xmlNode_, attrPtr->ns->href, attrPtr->ns->prefix); + } + } + + // copy the attribute onto this node + xmlChar *value = xmlNodeGetContent((xmlNodePtr) attrPtr); + xmlAttrPtr newProp = xmlNewNsProp(xmlNode_, newPropNS, attrPtr->name, value); + if (newProp != NULL) { + // we made the property, so clean up the property's namespace + + [[self class] fixUpNamespacesForNode:(xmlNodePtr)newProp + graftingToTreeNode:xmlNode_]; + } + + if (value != NULL) { + xmlFree(value); + } + } + } + } +} + +- (GDataXMLNode *)attributeForName:(NSString *)name { + + if (xmlNode_ != NULL) { + + xmlAttrPtr attr = xmlHasProp(xmlNode_, GDataGetXMLString(name)); + if (attr == NULL) { + + // can we guarantee that xmlAttrPtrs always have the ns ptr and never + // a namespace as part of the actual attribute name? + + // split the name and its prefix, if any + xmlNsPtr ns = NULL; + NSString *prefix = [[self class] prefixForName:name]; + if (prefix) { + + // find the namespace for this prefix, and search on its URI to find + // the xmlNsPtr + name = [[self class] localNameForName:name]; + ns = xmlSearchNs(xmlNode_->doc, xmlNode_, GDataGetXMLString(prefix)); + } + + const xmlChar* nsURI = ((ns != NULL) ? ns->href : NULL); + attr = xmlHasNsProp(xmlNode_, GDataGetXMLString(name), nsURI); + } + + if (attr) { + return [GDataXMLNode nodeBorrowingXMLNode:(xmlNodePtr) attr]; + } + } + return nil; +} + +- (GDataXMLNode *)attributeForLocalName:(NSString *)localName + URI:(NSString *)attributeURI { + + if (xmlNode_ != NULL) { + + const xmlChar* name = GDataGetXMLString(localName); + const xmlChar* nsURI = GDataGetXMLString(attributeURI); + + xmlAttrPtr attr = xmlHasNsProp(xmlNode_, name, nsURI); + + if (attr == NULL) { + // if the attribute is in a tree lacking the proper namespace, + // the local name may include the full URI as a prefix + NSString *fakeQName = GDataFakeQNameForURIAndName(attributeURI, localName); + const xmlChar* xmlFakeQName = GDataGetXMLString(fakeQName); + + attr = xmlHasProp(xmlNode_, xmlFakeQName); + } + + if (attr) { + return [GDataXMLNode nodeBorrowingXMLNode:(xmlNodePtr) attr]; + } + } + return nil; +} + +- (NSString *)resolvePrefixForNamespaceURI:(NSString *)namespaceURI { + + if (xmlNode_ != NULL) { + + xmlChar* desiredNSHref = GDataGetXMLString(namespaceURI); + + xmlNsPtr foundNS = xmlSearchNsByHref(xmlNode_->doc, xmlNode_, desiredNSHref); + if (foundNS) { + + // we found the namespace + if (foundNS->prefix != NULL) { + NSString *prefix = GDataStringFromXMLString(foundNS->prefix); + return prefix; + } else { + // empty prefix is default namespace + return @""; + } + } + } + return nil; +} + +#pragma mark Namespace fixup routines + ++ (void)deleteNamespacePtr:(xmlNsPtr)namespaceToDelete + fromXMLNode:(xmlNodePtr)node { + + // utilty routine to remove a namespace pointer from an element's + // namespace definition list. This is just removing the nsPtr + // from the singly-linked list, the node's namespace definitions. + xmlNsPtr currNS = node->nsDef; + xmlNsPtr prevNS = NULL; + + while (currNS != NULL) { + xmlNsPtr nextNS = currNS->next; + + if (namespaceToDelete == currNS) { + + // found it; delete it from the head of the node's ns definition list + // or from the next field of the previous namespace + + if (prevNS != NULL) prevNS->next = nextNS; + else node->nsDef = nextNS; + + xmlFreeNs(currNS); + return; + } + prevNS = currNS; + currNS = nextNS; + } +} + ++ (void)fixQualifiedNamesForNode:(xmlNodePtr)nodeToFix + graftingToTreeNode:(xmlNodePtr)graftPointNode { + + // Replace prefix-in-name with proper namespace pointers + // + // This is an inner routine for fixUpNamespacesForNode: + // + // see if this node's name lacks a namespace and is qualified, and if so, + // see if we can resolve the prefix against the parent + // + // The prefix may either be normal, "gd:foo", or a URI + // "{http://blah.com/}:foo" + + if (nodeToFix->ns == NULL) { + xmlNsPtr foundNS = NULL; + + xmlChar* prefix = NULL; + xmlChar* localName = SplitQNameReverse(nodeToFix->name, &prefix); + if (localName != NULL) { + if (prefix != NULL) { + + // if the prefix is wrapped by { and } then it's a URI + int prefixLen = xmlStrlen(prefix); + if (prefixLen > 2 + && prefix[0] == '{' + && prefix[prefixLen - 1] == '}') { + + // search for the namespace by URI + xmlChar* uri = xmlStrsub(prefix, 1, prefixLen - 2); + + if (uri != NULL) { + foundNS = xmlSearchNsByHref(graftPointNode->doc, graftPointNode, uri); + + xmlFree(uri); + } + } + } + + if (foundNS == NULL) { + // search for the namespace by prefix, even if the prefix is nil + // (nil prefix means to search for the default namespace) + foundNS = xmlSearchNs(graftPointNode->doc, graftPointNode, prefix); + } + + if (foundNS != NULL) { + // we found a namespace, so fix the ns pointer and the local name + xmlSetNs(nodeToFix, foundNS); + xmlNodeSetName(nodeToFix, localName); + } + + if (prefix != NULL) { + xmlFree(prefix); + prefix = NULL; + } + + xmlFree(localName); + } + } +} + ++ (void)fixDuplicateNamespacesForNode:(xmlNodePtr)nodeToFix + graftingToTreeNode:(xmlNodePtr)graftPointNode + namespaceSubstitutionMap:(NSMutableDictionary *)nsMap { + + // Duplicate namespace removal + // + // This is an inner routine for fixUpNamespacesForNode: + // + // If any of this node's namespaces are already defined at the graft point + // level, add that namespace to the map of namespace substitutions + // so it will be replaced in the children below the nodeToFix, and + // delete the namespace record + + if (nodeToFix->type == XML_ELEMENT_NODE) { + + // step through the namespaces defined on this node + xmlNsPtr definedNS = nodeToFix->nsDef; + while (definedNS != NULL) { + + // see if this namespace is already defined higher in the tree, + // with both the same URI and the same prefix; if so, add a mapping for + // it + xmlNsPtr foundNS = xmlSearchNsByHref(graftPointNode->doc, graftPointNode, + definedNS->href); + if (foundNS != NULL + && foundNS != definedNS + && xmlStrEqual(definedNS->prefix, foundNS->prefix)) { + + // store a mapping from this defined nsPtr to the one found higher + // in the tree + [nsMap setObject:[NSValue valueWithPointer:foundNS] + forKey:[NSValue valueWithPointer:definedNS]]; + + // remove this namespace from the ns definition list of this node; + // all child elements and attributes referencing this namespace + // now have a dangling pointer and must be updated (that is done later + // in this method) + // + // before we delete this namespace, move our pointer to the + // next one + xmlNsPtr nsToDelete = definedNS; + definedNS = definedNS->next; + + [self deleteNamespacePtr:nsToDelete fromXMLNode:nodeToFix]; + + } else { + // this namespace wasn't a duplicate; move to the next + definedNS = definedNS->next; + } + } + } + + // if this node's namespace is one we deleted, update it to point + // to someplace better + if (nodeToFix->ns != NULL) { + + NSValue *currNS = [NSValue valueWithPointer:nodeToFix->ns]; + NSValue *replacementNS = [nsMap objectForKey:currNS]; + + if (replacementNS != nil) { + xmlNsPtr replaceNSPtr = [replacementNS pointerValue]; + + xmlSetNs(nodeToFix, replaceNSPtr); + } + } +} + + + ++ (void)fixUpNamespacesForNode:(xmlNodePtr)nodeToFix + graftingToTreeNode:(xmlNodePtr)graftPointNode + namespaceSubstitutionMap:(NSMutableDictionary *)nsMap { + + // This is the inner routine for fixUpNamespacesForNode:graftingToTreeNode: + // + // This routine fixes two issues: + // + // Because we can create nodes with qualified names before adding + // them to the tree that declares the namespace for the prefix, + // we need to set the node namespaces after adding them to the tree. + // + // Because libxml adds namespaces to nodes when it copies them, + // we want to remove redundant namespaces after adding them to + // a tree. + // + // If only the Mac's libxml had xmlDOMWrapReconcileNamespaces, it could do + // namespace cleanup for us + + // We only care about fixing names of elements and attributes + if (nodeToFix->type != XML_ELEMENT_NODE + && nodeToFix->type != XML_ATTRIBUTE_NODE) return; + + // Do the fixes + [self fixQualifiedNamesForNode:nodeToFix + graftingToTreeNode:graftPointNode]; + + [self fixDuplicateNamespacesForNode:nodeToFix + graftingToTreeNode:graftPointNode + namespaceSubstitutionMap:nsMap]; + + if (nodeToFix->type == XML_ELEMENT_NODE) { + + // when fixing element nodes, recurse for each child element and + // for each attribute + xmlNodePtr currChild = nodeToFix->children; + while (currChild != NULL) { + [self fixUpNamespacesForNode:currChild + graftingToTreeNode:graftPointNode + namespaceSubstitutionMap:nsMap]; + currChild = currChild->next; + } + + xmlAttrPtr currProp = nodeToFix->properties; + while (currProp != NULL) { + [self fixUpNamespacesForNode:(xmlNodePtr)currProp + graftingToTreeNode:graftPointNode + namespaceSubstitutionMap:nsMap]; + currProp = currProp->next; + } + } +} + ++ (void)fixUpNamespacesForNode:(xmlNodePtr)nodeToFix + graftingToTreeNode:(xmlNodePtr)graftPointNode { + + // allocate the namespace map that will be passed + // down on recursive calls + NSMutableDictionary *nsMap = [NSMutableDictionary dictionary]; + + [self fixUpNamespacesForNode:nodeToFix + graftingToTreeNode:graftPointNode + namespaceSubstitutionMap:nsMap]; +} + +@end + + + +@implementation GDataXMLDocument + +- (id)initWithXMLString:(NSString *)str options:(unsigned int)mask error:(NSError **)error { + + NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding]; + GDataXMLDocument *doc = [self initWithData:data options:mask error:error]; + return doc; +} + +- (id)initWithData:(NSData *)data options:(unsigned int)mask error:(NSError **)error { + + self = [super init]; + if (self) { + + const char *baseURL = NULL; + const char *encoding = NULL; + + // NOTE: We are assuming [data length] fits into an int. + xmlDoc_ = xmlReadMemory([data bytes], (int)[data length], baseURL, encoding, + kGDataXMLParseOptions); // TODO(grobbins) map option values + if (xmlDoc_ == NULL) { + if (error) { + *error = [NSError errorWithDomain:@"com.google.GDataXML" + code:-1 + userInfo:nil]; + // TODO(grobbins) use xmlSetGenericErrorFunc to capture error + [self release]; + } + return nil; + } + } + + return self; +} + +- (id)initWithRootElement:(GDataXMLElement *)element { + + self = [super init]; + if (self) { + + xmlDoc_ = xmlNewDoc(NULL); + + (void) xmlDocSetRootElement(xmlDoc_, [element XMLNodeCopy]); + } + + return self; +} + +- (NSString *)description { + return [NSString stringWithFormat:@"%@ 0x%lX", [self class], self]; +} + +- (void)dealloc { + if (xmlDoc_ != NULL) { + xmlFreeDoc(xmlDoc_); + } + [super dealloc]; +} + +#pragma mark - + +- (GDataXMLElement *)rootElement { + GDataXMLElement *element = nil; + + if (xmlDoc_ != NULL) { + xmlNodePtr rootNode = xmlDocGetRootElement(xmlDoc_); + if (rootNode) { + element = [GDataXMLElement nodeBorrowingXMLNode:rootNode]; + } + } + return element; +} + +- (NSData *)XMLData { + + if (xmlDoc_ != NULL) { + xmlChar *buffer = NULL; + int bufferSize = 0; + + xmlDocDumpMemory(xmlDoc_, &buffer, &bufferSize); + + if (buffer) { + NSData *data = [NSData dataWithBytes:buffer + length:bufferSize]; + xmlFree(buffer); + return data; + } + } + return nil; +} + +- (void)setVersion:(NSString *)version { + + if (xmlDoc_ != NULL) { + if (xmlDoc_->version != NULL) { + // version is a const char* so we must cast + xmlFree((char *) xmlDoc_->version); + xmlDoc_->version = NULL; + } + + if (version != nil) { + xmlDoc_->version = xmlStrdup(GDataGetXMLString(version)); + } + } +} + +- (void)setCharacterEncoding:(NSString *)encoding { + + if (xmlDoc_ != NULL) { + if (xmlDoc_->encoding != NULL) { + // version is a const char* so we must cast + xmlFree((char *) xmlDoc_->encoding); + xmlDoc_->encoding = NULL; + } + + if (encoding != nil) { + xmlDoc_->encoding = xmlStrdup(GDataGetXMLString(encoding)); + } + } +} + +@end diff --git a/jscocoa/JSCocoa/iPhone/libffi/LICENSE b/jscocoa/JSCocoa/iPhone/libffi/LICENSE new file mode 100644 index 0000000..064f4fa --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/LICENSE @@ -0,0 +1,21 @@ +libffi - Copyright (c) 1996-2008 Red Hat, Inc and others. +See source files for details. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/jscocoa/JSCocoa/iPhone/libffi/_original iphone-sysv.S b/jscocoa/JSCocoa/iPhone/libffi/_original iphone-sysv.S new file mode 100644 index 0000000..d86af5f --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/_original iphone-sysv.S @@ -0,0 +1,312 @@ + +// Import TARGET_IPHONE_SIMULATOR definition +#import "TargetConditionals.h" +#if !TARGET_IPHONE_SIMULATOR + + +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 1998, 2008 Red Hat, Inc. + + ARM Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include "fficonfig.h" +#include "ffi.h" +#ifdef HAVE_MACHINE_ASM_H +#include +#else +#ifdef __USER_LABEL_PREFIX__ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ +#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) +#else +#define CNAME(x) x +#endif +#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): +#endif + +#ifdef __ELF__ +#define LSYM(x) .x +#else +#define LSYM(x) x +#endif + +/* We need a better way of testing for this, but for now, this is all + we can do. */ +@ This selects the minimum architecture level required. +//#define __ARM_ARCH__ 3 + +//## +#define __ARM_ARCH__ 6 + + + +#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 4 +#endif + +#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ + || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ + || defined(__ARM_ARCH_5TEJ__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 5 +#endif + +#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ + || defined(__ARM_ARCH_6ZK__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 6 +#endif + +#if __ARM_ARCH__ >= 5 +# define call_reg(x) blx x +#elif defined (__ARM_ARCH_4T__) +# define call_reg(x) mov lr, pc ; bx x +# if defined(__thumb__) || defined(__THUMB_INTERWORK__) +# define __INTERWORKING__ +# endif +#else +# define call_reg(x) mov lr, pc ; mov pc, x +#endif + +/* Conditionally compile unwinder directives. */ +#ifdef __ARM_EABI__ +#define UNWIND +#else +#define UNWIND @ +#endif + + +#if defined(__thumb__) && !defined(__THUMB_INTERWORK__) +.macro ARM_FUNC_START name + .text + .align 0 + .thumb + .thumb_func + ENTRY(\name) + bx pc + nop + .arm + UNWIND .fnstart +/* A hook to tell gdb that we've switched to ARM mode. Also used to call + directly from other local arm routines. */ +_L__\name: +.endm +#else +.macro ARM_FUNC_START name + .text + .align 0 + .arm + ENTRY(\name) + UNWIND .fnstart +.endm +#endif + +.macro RETLDM regs=, cond=, dirn=ia +#if defined (__INTERWORKING__) + .ifc "\regs","" + ldr\cond lr, [sp], #4 + .else + ldm\cond\dirn sp!, {\regs, lr} + .endif + bx\cond lr +#else + .ifc "\regs","" + ldr\cond pc, [sp], #4 + .else + ldm\cond\dirn sp!, {\regs, pc} + .endif +#endif +.endm + + + @ r0: ffi_prep_args + @ r1: &ecif + @ r2: cif->bytes + @ r3: fig->flags + @ sp+0: ecif.rvalue + @ sp+4: fn + + @ This assumes we are using gas. +ARM_FUNC_START ffi_call_SYSV + @ Save registers + stmfd sp!, {r0-r3, fp, lr} + UNWIND .save {r0-r3, fp, lr} + mov fp, sp + + UNWIND .setfp fp, sp + + @ Make room for all of the new args. + sub sp, fp, r2 + + @ Place all of the ffi_prep_args in position + mov ip, r0 + mov r0, sp + @ r1 already set + + @ Call ffi_prep_args(stack, &ecif) + call_reg(ip) + + @ move first 4 parameters in registers + ldmia sp, {r0-r3} + + @ and adjust stack + ldr ip, [fp, #8] + cmp ip, #16 + movhs ip, #16 + add sp, sp, ip + + @ call (fn) (...) + ldr ip, [fp, #28] + call_reg(ip) + + @ Remove the space we pushed for the args + mov sp, fp + + @ Load r2 with the pointer to storage for the return value + ldr r2, [sp, #24] + + @ Load r3 with the return type code + ldr r3, [sp, #12] + + @ If the return value pointer is NULL, assume no return value. + cmp r2, #0 + beq LSYM(Lepilogue) + +@ return INT + cmp r3, #FFI_TYPE_INT +#ifdef __SOFTFP__ + cmpne r3, #FFI_TYPE_FLOAT +#endif + streq r0, [r2] + beq LSYM(Lepilogue) + + @ return INT64 + cmp r3, #FFI_TYPE_SINT64 +#ifdef __SOFTFP__ + cmpne r3, #FFI_TYPE_DOUBLE +#endif + stmeqia r2, {r0, r1} + +#ifndef __SOFTFP__ + beq LSYM(Lepilogue) + +@ return FLOAT + cmp r3, #FFI_TYPE_FLOAT + stfeqs f0, [r2] + beq LSYM(Lepilogue) + +@ return DOUBLE or LONGDOUBLE + cmp r3, #FFI_TYPE_DOUBLE + stfeqd f0, [r2] +#endif + +LSYM(Lepilogue): + RETLDM "r0-r3,fp" + +.ffi_call_SYSV_end: + UNWIND .fnend + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + +/* + unsigned int FFI_HIDDEN + ffi_closure_SYSV_inner (closure, respp, args) + ffi_closure *closure; + void **respp; + void *args; +*/ + +ARM_FUNC_START ffi_closure_SYSV + UNWIND .pad #16 + add ip, sp, #16 + stmfd sp!, {ip, lr} + UNWIND .save {r0, lr} + add r2, sp, #8 + .pad #16 + sub sp, sp, #16 + str sp, [sp, #8] + add r1, sp, #8 + bl ffi_closure_SYSV_inner + cmp r0, #FFI_TYPE_INT + beq .Lretint + + cmp r0, #FFI_TYPE_FLOAT +#ifdef __SOFTFP__ + beq .Lretint +#else + beq .Lretfloat +#endif + + cmp r0, #FFI_TYPE_DOUBLE +#ifdef __SOFTFP__ + beq .Lretlonglong +#else + beq .Lretdouble +#endif + + cmp r0, #FFI_TYPE_LONGDOUBLE +#ifdef __SOFTFP__ + beq .Lretlonglong +#else + beq .Lretlongdouble +#endif + + cmp r0, #FFI_TYPE_SINT64 + beq .Lretlonglong +.Lclosure_epilogue: + add sp, sp, #16 + ldmfd sp, {sp, pc} +.Lretint: + ldr r0, [sp] + b .Lclosure_epilogue +.Lretlonglong: + ldr r0, [sp] + ldr r1, [sp, #4] + b .Lclosure_epilogue + +#ifndef __SOFTFP__ +.Lretfloat: + ldfs f0, [sp] + b .Lclosure_epilogue +.Lretdouble: + ldfd f0, [sp] + b .Lclosure_epilogue +.Lretlongdouble: + ldfd f0, [sp] + b .Lclosure_epilogue +#endif + +.ffi_closure_SYSV_end: + UNWIND .fnend + .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",%progbits +#endif + +#endif diff --git a/jscocoa/JSCocoa/iPhone/libffi/ffi-iphone.c b/jscocoa/JSCocoa/iPhone/libffi/ffi-iphone.c new file mode 100644 index 0000000..3bf0b9c --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/ffi-iphone.c @@ -0,0 +1,315 @@ + +#if !TARGET_IPHONE_SIMULATOR + + +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 1998, 2008 Red Hat, Inc. + + ARM Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include "ffi.h" +#include "ffi_common.h" + +#include + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +void ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { + *(void **) argp = ecif->rvalue; + argp += 4; + } + + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + (i != 0); + i--, p_arg++) + { + size_t z; + + /* Align if necessary */ + if (((*p_arg)->alignment - 1) & (unsigned) argp) { + argp = (char *) ALIGN(argp, (*p_arg)->alignment); + } + + if ((*p_arg)->type == FFI_TYPE_STRUCT) + argp = (char *) ALIGN(argp, 4); + + z = (*p_arg)->size; + if (z < sizeof(int)) + { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + + default: + FFI_ASSERT(0); + } + } + else if (z == sizeof(int)) + { + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + } + else + { + memcpy(argp, *p_argv, z); + } + p_argv++; + argp += z; + } + + return; +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* Round the stack up to a multiple of 8 bytes. This isn't needed + everywhere, but it is on some platforms, and it doesn't harm anything + when it isn't needed. */ + cif->bytes = (cif->bytes + 7) & ~7; + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = (unsigned) FFI_TYPE_SINT64; + break; + + case FFI_TYPE_STRUCT: + if (cif->rtype->size <= 4) + /* A Composite Type not larger than 4 bytes is returned in r0. */ + cif->flags = (unsigned)FFI_TYPE_INT; + else + /* A Composite Type larger than 4 bytes, or whose size cannot + be determined statically ... is stored in memory at an + address passed [in r0]. */ + cif->flags = (unsigned)FFI_TYPE_STRUCT; + break; + + default: + cif->flags = FFI_TYPE_INT; + break; + } + + return FFI_OK; +} + +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + int small_struct = (cif->flags == FFI_TYPE_INT + && cif->rtype->type == FFI_TYPE_STRUCT); + + ecif.cif = cif; + ecif.avalue = avalue; + + unsigned int temp; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && + (cif->flags == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else if (small_struct) + ecif.rvalue = &temp; + else + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, + fn); + + break; + default: + FFI_ASSERT(0); + break; + } + if (small_struct) + memcpy (rvalue, &temp, cif->rtype->size); +} + +/** private members **/ + +static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, + void** args, ffi_cif* cif); + +void ffi_closure_SYSV (ffi_closure *); + +/* This function is jumped to by the trampoline */ + +unsigned int +ffi_closure_SYSV_inner (closure, respp, args) + ffi_closure *closure; + void **respp; + void *args; +{ + // our various things... + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will re-set RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); + + (closure->fun) (cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} + +/*@-exportheader@*/ +static void +ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, + void **avalue, ffi_cif *cif) +/*@=exportheader@*/ +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if ( cif->flags == FFI_TYPE_STRUCT ) { + *rvalue = *(void **) argp; + argp += 4; + } + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) + { + size_t z; + + size_t alignment = (*p_arg)->alignment; + if (alignment < 4) + alignment = 4; + /* Align if necessary */ + if ((alignment - 1) & (unsigned) argp) { + argp = (char *) ALIGN(argp, alignment); + } + + z = (*p_arg)->size; + + /* because we're little endian, this is what it turns into. */ + + *p_argv = (void*) argp; + + p_argv++; + argp += z; + } + + return; +} + +/* How to make a trampoline. */ + +#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ +({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \ + *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \ + *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \ + *(unsigned int*) &__tramp[12] = __ctx; \ + *(unsigned int*) &__tramp[16] = __fun; \ + __clear_cache((&__tramp[0]), (&__tramp[19])); \ + }) + + +/* the cif must already be prep'ed */ + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + FFI_ASSERT (cif->abi == FFI_SYSV); + + FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ + &ffi_closure_SYSV, \ + codeloc); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +#endif \ No newline at end of file diff --git a/jscocoa/JSCocoa/iPhone/libffi/ffi-iphone.h b/jscocoa/JSCocoa/iPhone/libffi/ffi-iphone.h new file mode 100644 index 0000000..cd3f2f3 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/ffi-iphone.h @@ -0,0 +1,393 @@ +/* -----------------------------------------------------------------*-C-*- + libffi @VERSION@ - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html + + and + + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + +#ifndef LIBFFI_H +#define LIBFFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Specify which architecture libffi is configured for. */ +#ifndef armv6 +#define armv6 +#endif + +/* ---- System configuration information --------------------------------- */ + +#include "ffitarget.h" + +#ifndef LIBFFI_ASM + +#include +#include + +/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). + But we can find it either under the correct ANSI name, or under GNU + C's internal name. */ +#ifdef LONG_LONG_MAX +# define FFI_LONG_LONG_MAX LONG_LONG_MAX +#else +# ifdef LLONG_MAX +# define FFI_LONG_LONG_MAX LLONG_MAX +# else +# ifdef __GNUC__ +# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ +# endif +# endif +#endif + +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ + +typedef struct _ffi_type +{ + size_t size; + unsigned short alignment; + unsigned short type; + struct _ffi_type **elements; +} ffi_type; + +#ifndef LIBFFI_HIDE_BASIC_TYPES +#if SCHAR_MAX == 127 +# define ffi_type_uchar ffi_type_uint8 +# define ffi_type_schar ffi_type_sint8 +#else + #error "char size not supported" +#endif + +#if SHRT_MAX == 32767 +# define ffi_type_ushort ffi_type_uint16 +# define ffi_type_sshort ffi_type_sint16 +#elif SHRT_MAX == 2147483647 +# define ffi_type_ushort ffi_type_uint32 +# define ffi_type_sshort ffi_type_sint32 +#else + #error "short size not supported" +#endif + +#if INT_MAX == 32767 +# define ffi_type_uint ffi_type_uint16 +# define ffi_type_sint ffi_type_sint16 +#elif INT_MAX == 2147483647 +# define ffi_type_uint ffi_type_uint32 +# define ffi_type_sint ffi_type_sint32 +#elif INT_MAX == 9223372036854775807 +# define ffi_type_uint ffi_type_uint64 +# define ffi_type_sint ffi_type_sint64 +#else + #error "int size not supported" +#endif + +#if LONG_MAX == 2147483647 +# if FFI_LONG_LONG_MAX != 9223372036854775807 + #error "no 64-bit data type supported" +# endif +#elif LONG_MAX != 9223372036854775807 + #error "long size not supported" +#endif + +#if LONG_MAX == 2147483647 +# define ffi_type_ulong ffi_type_uint32 +# define ffi_type_slong ffi_type_sint32 +#elif LONG_MAX == 9223372036854775807 +# define ffi_type_ulong ffi_type_uint64 +# define ffi_type_slong ffi_type_sint64 +#else + #error "long size not supported" +#endif + +/* These are defined in types.c */ +extern ffi_type ffi_type_void; +extern ffi_type ffi_type_uint8; +extern ffi_type ffi_type_sint8; +extern ffi_type ffi_type_uint16; +extern ffi_type ffi_type_sint16; +extern ffi_type ffi_type_uint32; +extern ffi_type ffi_type_sint32; +extern ffi_type ffi_type_uint64; +extern ffi_type ffi_type_sint64; +extern ffi_type ffi_type_float; +extern ffi_type ffi_type_double; +extern ffi_type ffi_type_pointer; + +#if 0 // @HAVE_LONG_DOUBLE@ +extern ffi_type ffi_type_longdouble; +#else +#define ffi_type_longdouble ffi_type_double +#endif +#endif /* LIBFFI_HIDE_BASIC_TYPES */ + +typedef enum { + FFI_OK = 0, + FFI_BAD_TYPEDEF, + FFI_BAD_ABI +} ffi_status; + +typedef unsigned FFI_TYPE; + +typedef struct { + ffi_abi abi; + unsigned nargs; + ffi_type **arg_types; + ffi_type *rtype; + unsigned bytes; + unsigned flags; +#ifdef FFI_EXTRA_CIF_FIELDS + FFI_EXTRA_CIF_FIELDS; +#endif +} ffi_cif; + +/* ---- Definitions for the raw API -------------------------------------- */ + +#ifndef FFI_SIZEOF_ARG +# if LONG_MAX == 2147483647 +# define FFI_SIZEOF_ARG 4 +# elif LONG_MAX == 9223372036854775807 +# define FFI_SIZEOF_ARG 8 +# endif +#endif + +#ifndef FFI_SIZEOF_JAVA_RAW +# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG +#endif + +typedef union { + ffi_sarg sint; + ffi_arg uint; + float flt; + char data[FFI_SIZEOF_ARG]; + void* ptr; +} ffi_raw; + +#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 +/* This is a special case for mips64/n32 ABI (and perhaps others) where + sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ +typedef union { + signed int sint; + unsigned int uint; + float flt; + char data[FFI_SIZEOF_JAVA_RAW]; + void* ptr; +} ffi_java_raw; +#else +typedef ffi_raw ffi_java_raw; +#endif + + +void ffi_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_raw *avalue); + +void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_raw_size (ffi_cif *cif); + +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ + +void ffi_java_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_java_raw *avalue); + +void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); +void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); +size_t ffi_java_raw_size (ffi_cif *cif); + +/* ---- Definitions for closures ----------------------------------------- */ + +#if FFI_CLOSURES + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); + void *user_data; +} ffi_closure __attribute__((aligned (8))); + +void *ffi_closure_alloc (size_t size, void **code); +void ffi_closure_free (void *); + +ffi_status +ffi_prep_closure (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data); + +ffi_status +ffi_prep_closure_loc (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void*codeloc); + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_raw*,void*); + void *user_data; + +} ffi_raw_closure; + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); + void *user_data; + +} ffi_java_raw_closure; + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc); + +ffi_status +ffi_prep_java_raw_closure (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data, + void *codeloc); + +#endif /* FFI_CLOSURES */ + +/* ---- Public interface definition -------------------------------------- */ + +ffi_status ffi_prep_cif(ffi_cif *cif, + ffi_abi abi, + unsigned int nargs, + ffi_type *rtype, + ffi_type **atypes); + +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue); + +/* Useful for eliminating compiler warnings */ +#define FFI_FN(f) ((void (*)(void))f) + +/* ---- Definitions shared with assembly code ---------------------------- */ + +#endif + +/* If these change, update src/mips/ffitarget.h. */ +#define FFI_TYPE_VOID 0 +#define FFI_TYPE_INT 1 +#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_DOUBLE 3 +#if 0 // @HAVE_LONG_DOUBLE@ +#define FFI_TYPE_LONGDOUBLE 4 +#else +#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +#endif +#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_SINT8 6 +#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_SINT16 8 +#define FFI_TYPE_UINT32 9 +#define FFI_TYPE_SINT32 10 +#define FFI_TYPE_UINT64 11 +#define FFI_TYPE_SINT64 12 +#define FFI_TYPE_STRUCT 13 +#define FFI_TYPE_POINTER 14 + +/* This should always refer to the last type code (for sanity checks) */ +#define FFI_TYPE_LAST FFI_TYPE_POINTER + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/jscocoa/JSCocoa/iPhone/libffi/ffi-iphonesimulator.c b/jscocoa/JSCocoa/iPhone/libffi/ffi-iphonesimulator.c new file mode 100644 index 0000000..44ef8b4 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/ffi-iphonesimulator.c @@ -0,0 +1,480 @@ + +#if TARGET_IPHONE_SIMULATOR + + +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. + Copyright (c) 2002 Ranjit Mathew + Copyright (c) 2002 Bo Thorsen + Copyright (c) 2002 Roger Sayle + Copyright (C) 2008 Free Software Foundation, Inc. + + x86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef __x86_64__ + +#include "ffi.h" +#include "ffi_common.h" + +#include + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +void ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if (ecif->cif->flags == FFI_TYPE_STRUCT) + { + *(void **) argp = ecif->rvalue; + argp += 4; + } + + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + i != 0; + i--, p_arg++) + { + size_t z; + + /* Align if necessary */ + if ((sizeof(int) - 1) & (unsigned) argp) + argp = (char *) ALIGN(argp, sizeof(int)); + + z = (*p_arg)->size; + if (z < sizeof(int)) + { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_SINT32: + *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv); + break; + + case FFI_TYPE_UINT32: + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + break; + + default: + FFI_ASSERT(0); + } + } + else + { + memcpy(argp, *p_argv, z); + } + p_argv++; + argp += z; + } + + return; +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: +#ifdef X86 + case FFI_TYPE_STRUCT: +#endif +#if defined(X86) || defined(X86_DARWIN) + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: +#endif + + case FFI_TYPE_SINT64: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: +//## case FFI_TYPE_LONGDOUBLE: + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_UINT64: + cif->flags = FFI_TYPE_SINT64; + break; + +#ifndef X86 + case FFI_TYPE_STRUCT: + if (cif->rtype->size == 1) + { + cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */ + } + else if (cif->rtype->size == 2) + { + cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */ + } + else if (cif->rtype->size == 4) + { + cif->flags = FFI_TYPE_INT; /* same as int type */ + } + else if (cif->rtype->size == 8) + { + cif->flags = FFI_TYPE_SINT64; /* same as int64 type */ + } + else + { + cif->flags = FFI_TYPE_STRUCT; + } + break; +#endif + + default: + cif->flags = FFI_TYPE_INT; + break; + } + +#ifdef X86_DARWIN + cif->bytes = (cif->bytes + 15) & ~0xF; +#endif + + return FFI_OK; +} + +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); + +#ifdef X86_WIN32 +extern void ffi_call_STDCALL(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); + +#endif /* X86_WIN32 */ + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && + (cif->flags == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, + fn); + break; +#ifdef X86_WIN32 + case FFI_STDCALL: + ffi_call_STDCALL(ffi_prep_args, &ecif, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; +#endif /* X86_WIN32 */ + default: + FFI_ASSERT(0); + break; + } +} + + +/** private members **/ + +static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, + void** args, ffi_cif* cif); +void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) + __attribute__ ((regparm(1))); +unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *) + __attribute__ ((regparm(1))); +void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) + __attribute__ ((regparm(1))); +#ifdef X86_WIN32 +void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) + __attribute__ ((regparm(1))); +#endif + +/* This function is jumped to by the trampoline */ + +unsigned int FFI_HIDDEN +ffi_closure_SYSV_inner (closure, respp, args) + ffi_closure *closure; + void **respp; + void *args; +{ + /* our various things... */ + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will re-set RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); + + (closure->fun) (cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} + +static void +ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, + ffi_cif *cif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if ( cif->flags == FFI_TYPE_STRUCT ) { + *rvalue = *(void **) argp; + argp += 4; + } + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) + { + size_t z; + + /* Align if necessary */ + if ((sizeof(int) - 1) & (unsigned) argp) { + argp = (char *) ALIGN(argp, sizeof(int)); + } + + z = (*p_arg)->size; + + /* because we're little endian, this is what it turns into. */ + + *p_argv = (void*) argp; + + p_argv++; + argp += z; + } + + return; +} + +/* How to make a trampoline. Derived from gcc/config/i386/i386.c. */ + +#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ +({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 10); \ + *(unsigned char*) &__tramp[0] = 0xb8; \ + *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[5] = 0xe9; \ + *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ + }) + +#define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ +({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 10); \ + unsigned short __size = (unsigned short)(SIZE); \ + *(unsigned char*) &__tramp[0] = 0xb8; \ + *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[5] = 0xe8; \ + *(unsigned int*) &__tramp[6] = __dis; /* call __fun */ \ + *(unsigned char *) &__tramp[10] = 0xc2; \ + *(unsigned short*) &__tramp[11] = __size; /* ret __size */ \ + }) + +/* the cif must already be prep'ed */ + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + if (cif->abi == FFI_SYSV) + { + FFI_INIT_TRAMPOLINE (&closure->tramp[0], + &ffi_closure_SYSV, + (void*)codeloc); + } +#ifdef X86_WIN32 + else if (cif->abi == FFI_STDCALL) + { + FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], + &ffi_closure_STDCALL, + (void*)codeloc, cif->bytes); + } +#endif + else + { + return FFI_BAD_ABI; + } + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +/* ------- Native raw API support -------------------------------- */ + +#if !FFI_NO_RAW_API + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc) +{ + int i; + + if (cif->abi != FFI_SYSV) { + return FFI_BAD_ABI; + } + + // we currently don't support certain kinds of arguments for raw + // closures. This should be implemented by a separate assembly language + // routine, since it would require argument processing, something we + // don't do now for performance. + + for (i = cif->nargs-1; i >= 0; i--) + { + FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT); + FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); + } + + + FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, + codeloc); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +static void +ffi_prep_args_raw(char *stack, extended_cif *ecif) +{ + memcpy (stack, ecif->avalue, ecif->cif->bytes); +} + +/* we borrow this routine from libffi (it must be changed, though, to + * actually call the function passed in the first argument. as of + * libffi-1.20, this is not the case.) + */ + +extern void +ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, + unsigned, unsigned *, void (*fn)(void)); + +#ifdef X86_WIN32 +extern void +ffi_call_STDCALL(void (*)(char *, extended_cif *), extended_cif *, unsigned, + unsigned, unsigned *, void (*fn)(void)); +#endif /* X86_WIN32 */ + +void +ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue) +{ + extended_cif ecif; + void **avalue = (void **)fake_avalue; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && + (cif->rtype->type == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; +#ifdef X86_WIN32 + case FFI_STDCALL: + ffi_call_STDCALL(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; +#endif /* X86_WIN32 */ + default: + FFI_ASSERT(0); + break; + } +} + +#endif + +#endif /* __x86_64__ */ + +#endif \ No newline at end of file diff --git a/jscocoa/JSCocoa/iPhone/libffi/ffi-iphonesimulator.h b/jscocoa/JSCocoa/iPhone/libffi/ffi-iphonesimulator.h new file mode 100644 index 0000000..0fd9f80 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/ffi-iphonesimulator.h @@ -0,0 +1,393 @@ +/* -----------------------------------------------------------------*-C-*- + libffi @VERSION@ - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html + + and + + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + +#ifndef LIBFFI_H +#define LIBFFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Specify which architecture libffi is configured for. */ +#ifndef X86_DARWIN +#define X86_DARWIN +#endif + +/* ---- System configuration information --------------------------------- */ + +#include "ffitarget.h" + +#ifndef LIBFFI_ASM + +#include +#include + +/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). + But we can find it either under the correct ANSI name, or under GNU + C's internal name. */ +#ifdef LONG_LONG_MAX +# define FFI_LONG_LONG_MAX LONG_LONG_MAX +#else +# ifdef LLONG_MAX +# define FFI_LONG_LONG_MAX LLONG_MAX +# else +# ifdef __GNUC__ +# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ +# endif +# endif +#endif + +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ + +typedef struct _ffi_type +{ + size_t size; + unsigned short alignment; + unsigned short type; + struct _ffi_type **elements; +} ffi_type; + +#ifndef LIBFFI_HIDE_BASIC_TYPES +#if SCHAR_MAX == 127 +# define ffi_type_uchar ffi_type_uint8 +# define ffi_type_schar ffi_type_sint8 +#else + #error "char size not supported" +#endif + +#if SHRT_MAX == 32767 +# define ffi_type_ushort ffi_type_uint16 +# define ffi_type_sshort ffi_type_sint16 +#elif SHRT_MAX == 2147483647 +# define ffi_type_ushort ffi_type_uint32 +# define ffi_type_sshort ffi_type_sint32 +#else + #error "short size not supported" +#endif + +#if INT_MAX == 32767 +# define ffi_type_uint ffi_type_uint16 +# define ffi_type_sint ffi_type_sint16 +#elif INT_MAX == 2147483647 +# define ffi_type_uint ffi_type_uint32 +# define ffi_type_sint ffi_type_sint32 +#elif INT_MAX == 9223372036854775807 +# define ffi_type_uint ffi_type_uint64 +# define ffi_type_sint ffi_type_sint64 +#else + #error "int size not supported" +#endif + +#if LONG_MAX == 2147483647 +# if FFI_LONG_LONG_MAX != 9223372036854775807 + #error "no 64-bit data type supported" +# endif +#elif LONG_MAX != 9223372036854775807 + #error "long size not supported" +#endif + +#if LONG_MAX == 2147483647 +# define ffi_type_ulong ffi_type_uint32 +# define ffi_type_slong ffi_type_sint32 +#elif LONG_MAX == 9223372036854775807 +# define ffi_type_ulong ffi_type_uint64 +# define ffi_type_slong ffi_type_sint64 +#else + #error "long size not supported" +#endif + +/* These are defined in types.c */ +extern ffi_type ffi_type_void; +extern ffi_type ffi_type_uint8; +extern ffi_type ffi_type_sint8; +extern ffi_type ffi_type_uint16; +extern ffi_type ffi_type_sint16; +extern ffi_type ffi_type_uint32; +extern ffi_type ffi_type_sint32; +extern ffi_type ffi_type_uint64; +extern ffi_type ffi_type_sint64; +extern ffi_type ffi_type_float; +extern ffi_type ffi_type_double; +extern ffi_type ffi_type_pointer; + +#if 1 /* @HAVE_LONG_DOUBLE@ */ +extern ffi_type ffi_type_longdouble; +#else +#define ffi_type_longdouble ffi_type_double +#endif +#endif /* LIBFFI_HIDE_BASIC_TYPES */ + +typedef enum { + FFI_OK = 0, + FFI_BAD_TYPEDEF, + FFI_BAD_ABI +} ffi_status; + +typedef unsigned FFI_TYPE; + +typedef struct { + ffi_abi abi; + unsigned nargs; + ffi_type **arg_types; + ffi_type *rtype; + unsigned bytes; + unsigned flags; +#ifdef FFI_EXTRA_CIF_FIELDS + FFI_EXTRA_CIF_FIELDS; +#endif +} ffi_cif; + +/* ---- Definitions for the raw API -------------------------------------- */ + +#ifndef FFI_SIZEOF_ARG +# if LONG_MAX == 2147483647 +# define FFI_SIZEOF_ARG 4 +# elif LONG_MAX == 9223372036854775807 +# define FFI_SIZEOF_ARG 8 +# endif +#endif + +#ifndef FFI_SIZEOF_JAVA_RAW +# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG +#endif + +typedef union { + ffi_sarg sint; + ffi_arg uint; + float flt; + char data[FFI_SIZEOF_ARG]; + void* ptr; +} ffi_raw; + +#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 +/* This is a special case for mips64/n32 ABI (and perhaps others) where + sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ +typedef union { + signed int sint; + unsigned int uint; + float flt; + char data[FFI_SIZEOF_JAVA_RAW]; + void* ptr; +} ffi_java_raw; +#else +typedef ffi_raw ffi_java_raw; +#endif + + +void ffi_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_raw *avalue); + +void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_raw_size (ffi_cif *cif); + +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ + +void ffi_java_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_java_raw *avalue); + +void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); +void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); +size_t ffi_java_raw_size (ffi_cif *cif); + +/* ---- Definitions for closures ----------------------------------------- */ + +#if FFI_CLOSURES + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); + void *user_data; +} ffi_closure __attribute__((aligned (8))); + +void *ffi_closure_alloc (size_t size, void **code); +void ffi_closure_free (void *); + +ffi_status +ffi_prep_closure (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data); + +ffi_status +ffi_prep_closure_loc (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void*codeloc); + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_raw*,void*); + void *user_data; + +} ffi_raw_closure; + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); + void *user_data; + +} ffi_java_raw_closure; + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc); + +ffi_status +ffi_prep_java_raw_closure (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data, + void *codeloc); + +#endif /* FFI_CLOSURES */ + +/* ---- Public interface definition -------------------------------------- */ + +ffi_status ffi_prep_cif(ffi_cif *cif, + ffi_abi abi, + unsigned int nargs, + ffi_type *rtype, + ffi_type **atypes); + +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue); + +/* Useful for eliminating compiler warnings */ +#define FFI_FN(f) ((void (*)(void))f) + +/* ---- Definitions shared with assembly code ---------------------------- */ + +#endif + +/* If these change, update src/mips/ffitarget.h. */ +#define FFI_TYPE_VOID 0 +#define FFI_TYPE_INT 1 +#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_DOUBLE 3 +#if 0 /* @HAVE_LONG_DOUBLE@ */ +#define FFI_TYPE_LONGDOUBLE 4 +#else +#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +#endif +#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_SINT8 6 +#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_SINT16 8 +#define FFI_TYPE_UINT32 9 +#define FFI_TYPE_SINT32 10 +#define FFI_TYPE_UINT64 11 +#define FFI_TYPE_SINT64 12 +#define FFI_TYPE_STRUCT 13 +#define FFI_TYPE_POINTER 14 + +/* This should always refer to the last type code (for sanity checks) */ +#define FFI_TYPE_LAST FFI_TYPE_POINTER + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/jscocoa/JSCocoa/iPhone/libffi/ffi.h b/jscocoa/JSCocoa/iPhone/libffi/ffi.h new file mode 100644 index 0000000..f47af76 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/ffi.h @@ -0,0 +1,7 @@ + + +#if TARGET_IPHONE_SIMULATOR +#import "ffi-iphonesimulator.h" +#else +#import "ffi-iphone.h" +#endif diff --git a/jscocoa/JSCocoa/iPhone/libffi/ffi_common.h b/jscocoa/JSCocoa/iPhone/libffi/ffi_common.h new file mode 100644 index 0000000..ae72123 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/ffi_common.h @@ -0,0 +1,98 @@ +/* ----------------------------------------------------------------------- + ffi_common.h - Copyright (c) 1996 Red Hat, Inc. + Copyright (C) 2007 Free Software Foundation, Inc + + Common internal definitions and macros. Only necessary for building + libffi. + ----------------------------------------------------------------------- */ + +#ifndef FFI_COMMON_H +#define FFI_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "fficonfig.h" + +/* Do not move this. Some versions of AIX are very picky about where + this is positioned. */ +#ifdef __GNUC__ +//## # define alloca __builtin_alloca +# define MAYBE_UNUSED __attribute__((__unused__)) +#else +# define MAYBE_UNUSED +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +/* Check for the existence of memcpy. */ +#if STDC_HEADERS +# include +#else +# ifndef HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif + +#if defined(FFI_DEBUG) +#include +#endif + +#ifdef FFI_DEBUG +void ffi_assert(char *expr, char *file, int line); +void ffi_stop_here(void); +void ffi_type_test(ffi_type *a, char *file, int line); + +#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) +#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) +#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) +#else +#define FFI_ASSERT(x) +#define FFI_ASSERT_AT(x, f, l) +#define FFI_ASSERT_VALID_TYPE(x) +#endif + +#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) +#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a) + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif); + +/* Extended cif, used in callback from assembly routine */ +typedef struct +{ + ffi_cif *cif; + void *rvalue; + void **avalue; +} extended_cif; + +/* Terse sized type definitions. */ +typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); +typedef signed int SINT8 __attribute__((__mode__(__QI__))); +typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); +typedef signed int SINT16 __attribute__((__mode__(__HI__))); +typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); +typedef signed int SINT32 __attribute__((__mode__(__SI__))); +typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); +typedef signed int SINT64 __attribute__((__mode__(__DI__))); + +typedef float FLOAT32; + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/jscocoa/JSCocoa/iPhone/libffi/fficonfig.h b/jscocoa/JSCocoa/iPhone/libffi/fficonfig.h new file mode 100644 index 0000000..32ae5eb --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/fficonfig.h @@ -0,0 +1,163 @@ +/* fficonfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to the flags needed for the .section .eh_frame directive. */ +#undef EH_FRAME_FLAGS + +/* Define this if you want extra debugging. */ +#undef FFI_DEBUG + +/* Define this is you do not want support for the raw API. */ +#undef FFI_NO_RAW_API + +/* Define this is you do not want support for aggregate types. */ +#undef FFI_NO_STRUCTS + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define if your assembler supports .cfi_* directives. */ +#undef HAVE_AS_CFI_PSEUDO_OP + +/* Define if your assembler supports .register. */ +#undef HAVE_AS_REGISTER_PSEUDO_OP + +/* Define if your assembler and linker support unaligned PC relative relocs. + */ +#undef HAVE_AS_SPARC_UA_PCREL + +/* Define if your assembler supports PC relative relocs. */ +#undef HAVE_AS_X86_PCREL + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define if __attribute__((visibility("hidden"))) is supported. */ +#undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have the long double type and it is bigger than a double */ +#undef HAVE_LONG_DOUBLE + +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mmap' function. */ +#undef HAVE_MMAP + +/* Define if mmap with MAP_ANON(YMOUS) works. */ +#undef HAVE_MMAP_ANON + +/* Define if mmap of /dev/zero works. */ +#undef HAVE_MMAP_DEV_ZERO + +/* Define if read-only mmap of a plain file works. */ +#undef HAVE_MMAP_FILE + +/* Define if .eh_frame sections should be read-only. */ +#undef HAVE_RO_EH_FRAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of `double', as computed by sizeof. */ +#undef SIZEOF_DOUBLE + +/* The size of `long double', as computed by sizeof. */ +#undef SIZEOF_LONG_DOUBLE + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define this if you are using Purify and want to suppress spurious messages. + */ +#undef USING_PURIFY + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + + +#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) .hidden name +#else +#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) +#endif +#else +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) +#else +#define FFI_HIDDEN +#endif +#endif + diff --git a/jscocoa/JSCocoa/iPhone/libffi/ffitarget-iphone.h b/jscocoa/JSCocoa/iPhone/libffi/ffitarget-iphone.h new file mode 100644 index 0000000..a957426 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/ffitarget-iphone.h @@ -0,0 +1,49 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for ARM. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_DEFAULT_ABI = FFI_SYSV, + FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 20 +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/jscocoa/JSCocoa/iPhone/libffi/ffitarget-iphonesimulator.h b/jscocoa/JSCocoa/iPhone/libffi/ffitarget-iphonesimulator.h new file mode 100644 index 0000000..8178d06 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/ffitarget-iphonesimulator.h @@ -0,0 +1,90 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Copyright (C) 2008 Free Software Foundation, Inc. + + Target configuration macros for x86 and x86-64. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +/* ---- System specific configurations ----------------------------------- */ + +#if defined (X86_64) && defined (__i386__) +#undef X86_64 +#define X86 +#endif + +/* ---- Generic type definitions ----------------------------------------- */ + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + + /* ---- Intel x86 Win32 ---------- */ +#ifdef X86_WIN32 + FFI_SYSV, + FFI_STDCALL, + /* TODO: Add fastcall support for the sake of completeness */ + FFI_DEFAULT_ABI = FFI_SYSV, +#endif + + /* ---- Intel x86 and AMD x86-64 - */ +#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__)) + FFI_SYSV, + FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ +#ifdef __i386__ + FFI_DEFAULT_ABI = FFI_SYSV, +#else + FFI_DEFAULT_ABI = FFI_UNIX64, +#endif +#endif + + FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) +#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) + +#if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) +#define FFI_TRAMPOLINE_SIZE 24 +#define FFI_NATIVE_RAW_API 0 +#else +#ifdef X86_WIN32 +#define FFI_TRAMPOLINE_SIZE 13 +#else +#define FFI_TRAMPOLINE_SIZE 10 +#endif +#define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ +#endif + +#endif + diff --git a/jscocoa/JSCocoa/iPhone/libffi/ffitarget.h b/jscocoa/JSCocoa/iPhone/libffi/ffitarget.h new file mode 100644 index 0000000..8864dcb --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/ffitarget.h @@ -0,0 +1,7 @@ + + +#if TARGET_IPHONE_SIMULATOR +#import "ffitarget-iphonesimulator.h" +#else +#import "ffitarget-iphone.h" +#endif diff --git a/jscocoa/JSCocoa/iPhone/libffi/iphone-sysv.S b/jscocoa/JSCocoa/iPhone/libffi/iphone-sysv.S new file mode 100644 index 0000000..7e0f842 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/iphone-sysv.S @@ -0,0 +1,320 @@ +/* This file is mangled from the original to compile using Apple's AS, not GAS */ + +/* Import TARGET_IPHONE_SIMULATOR definition */ +#import "TargetConditionals.h" +#if !TARGET_IPHONE_SIMULATOR + + +#define __SOFTFP__ + +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 1998, 2008 Red Hat, Inc. + + ARM Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include "fficonfig.h" +#include "ffi.h" +#ifdef HAVE_MACHINE_ASM_H +#include +#else +#ifdef __USER_LABEL_PREFIX__ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ +#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) +#else +#define CNAME(x) x +#endif +#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): +#endif + +#ifdef __ELF__ +#define LSYM(x) .x +#else +#define LSYM(x) x +#endif + +/* We need a better way of testing for this, but for now, this is all + we can do. */ +@ This selects the minimum architecture level required. +#define __ARM_ARCH__ 3 + +#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 4 +#endif + +#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ + || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ + || defined(__ARM_ARCH_5TEJ__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 5 +#endif + +#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ + || defined(__ARM_ARCH_6ZK__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 6 +#endif + +#if __ARM_ARCH__ >= 5 +# define call_reg(x) blx x +#elif defined (__ARM_ARCH_4T__) +# define call_reg(x) mov lr, pc ; bx x +# if defined(__thumb__) || defined(__THUMB_INTERWORK__) +# define __INTERWORKING__ +# endif +#else +# define call_reg(x) mov lr, pc ; mov pc, x +#endif + +/* Conditionally compile unwinder directives. */ +#ifdef __ARM_EABI__ +#define UNWIND +#else +#define UNWIND @ +#endif + +/* +#if defined(__thumb__) && !defined(__THUMB_INTERWORK__) +.macro ARM_FUNC_START name + .text + .align 0 + .thumb + .thumb_func + ENTRY(\name) + bx pc + nop + .arm + UNWIND .fnstart +_L__\name: +.endm +#else +.macro ARM_FUNC_START name + .text + .align 0 + .arm + ENTRY(\name) + UNWIND .fnstart +.endm +#endif +*/ +/* +.macro RETLDM regs=, cond=, dirn=ia +#if defined (__INTERWORKING__) + .ifc "\regs","" + ldr\cond lr, [sp], #4 + .else + ldm\cond\dirn sp!, {\regs, lr} + .endif + bx\cond lr +#else + .ifc "\regs","" + ldr\cond pc, [sp], #4 + .else + ldm\cond\dirn sp!, {\regs, pc} + .endif +#endif +.endm +*/ + + @ r0: ffi_prep_args + @ r1: &ecif + @ r2: cif->bytes + @ r3: fig->flags + @ sp+0: ecif.rvalue + @ sp+4: fn + + .text + .align 0 + .globl _ffi_call_SYSV +_ffi_call_SYSV: + UNWIND .fnstart + @ Save registers + stmfd sp!, {r0-r3, fp, lr} + UNWIND .save {r0-r3, fp, lr} + mov fp, sp + + UNWIND .setfp fp, sp + + @ Make room for all of the new args. + sub sp, fp, r2 + + @ Place all of the ffi_prep_args in position + mov ip, r0 + mov r0, sp + @ r1 already set + + @ Call ffi_prep_args(stack, &ecif) + call_reg(ip) + + @ move first 4 parameters in registers + ldmia sp, {r0-r3} + + @ and adjust stack + ldr ip, [fp, #8] + cmp ip, #16 + movhs ip, #16 + add sp, sp, ip + + @ call (fn) (...) + ldr ip, [fp, #28] + call_reg(ip) + + @ Remove the space we pushed for the args + mov sp, fp + + @ Load r2 with the pointer to storage for the return value + ldr r2, [sp, #24] + + @ Load r3 with the return type code + ldr r3, [sp, #12] + + @ If the return value pointer is NULL, assume no return value. + cmp r2, #0 + beq LSYM(Lepilogue) + +@ return INT + cmp r3, #FFI_TYPE_INT +#ifdef __SOFTFP__ + cmpne r3, #FFI_TYPE_FLOAT +#endif + streq r0, [r2] + beq LSYM(Lepilogue) + + @ return INT64 + cmp r3, #FFI_TYPE_SINT64 +#ifdef __SOFTFP__ + cmpne r3, #FFI_TYPE_DOUBLE +#endif + stmeqia r2, {r0, r1} + +#ifndef __SOFTFP__ + beq LSYM(Lepilogue) + +@ return FLOAT + cmp r3, #FFI_TYPE_FLOAT + stfeqs f0, [r2] + beq LSYM(Lepilogue) + +@ return DOUBLE or LONGDOUBLE + cmp r3, #FFI_TYPE_DOUBLE + stfeqd f0, [r2] +#endif + +LSYM(Lepilogue): + ldmia sp!, {r0-r3,fp, pc} + + +.ffi_call_SYSV_end: + UNWIND .fnend +// .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + +/* + unsigned int FFI_HIDDEN + ffi_closure_SYSV_inner (closure, respp, args) + ffi_closure *closure; + void **respp; + void *args; +*/ + + .text + .align 0 + .globl _ffi_closure_SYSV +_ffi_closure_SYSV: + + UNWIND .pad #16 + add ip, sp, #16 + stmfd sp!, {ip, lr} + UNWIND .save {r0, lr} + add r2, sp, #8 +// .pad #16 + sub sp, sp, #16 + str sp, [sp, #8] + add r1, sp, #8 + bl _ffi_closure_SYSV_inner + + cmp r0, #FFI_TYPE_INT + beq .Lretint + + cmp r0, #FFI_TYPE_FLOAT +#ifdef __SOFTFP__ + beq .Lretint +#else + beq .Lretfloat +#endif + + cmp r0, #FFI_TYPE_DOUBLE +#ifdef __SOFTFP__ + beq .Lretlonglong +#else + beq .Lretdouble +#endif + + cmp r0, #FFI_TYPE_LONGDOUBLE +#ifdef __SOFTFP__ + beq .Lretlonglong +#else + beq .Lretlongdouble +#endif + + cmp r0, #FFI_TYPE_SINT64 + beq .Lretlonglong +.Lclosure_epilogue: + add sp, sp, #16 + ldmfd sp, {sp, pc} +.Lretint: + ldr r0, [sp] + b .Lclosure_epilogue +.Lretlonglong: + ldr r0, [sp] + ldr r1, [sp, #4] + b .Lclosure_epilogue + +#ifndef __SOFTFP__ +.Lretfloat: + ldfs f0, [sp] + b .Lclosure_epilogue +.Lretdouble: + ldfd f0, [sp] + b .Lclosure_epilogue +.Lretlongdouble: + ldfd f0, [sp] + b .Lclosure_epilogue +#endif + +.ffi_closure_SYSV_end: + UNWIND .fnend +// .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",%progbits +#endif + + + +#endif \ No newline at end of file diff --git a/jscocoa/JSCocoa/iPhone/libffi/iphonesimulator-darwin.S b/jscocoa/JSCocoa/iPhone/libffi/iphonesimulator-darwin.S new file mode 100644 index 0000000..dee71c1 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/iphonesimulator-darwin.S @@ -0,0 +1,451 @@ + + +// Import TARGET_IPHONE_SIMULATOR definition +#import "TargetConditionals.h" +#if TARGET_IPHONE_SIMULATOR + +/* ----------------------------------------------------------------------- + darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc. + Copyright (C) 2008 Free Software Foundation, Inc. + + X86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef __x86_64__ + +#define LIBFFI_ASM +#include "fficonfig.h" +#include "ffi.h" + +.text + +.globl _ffi_prep_args + + .align 4 +.globl _ffi_call_SYSV + +_ffi_call_SYSV: +.LFB1: + pushl %ebp +.LCFI0: + movl %esp,%ebp +.LCFI1: + subl $8,%esp + /* Make room for all of the new args. */ + movl 16(%ebp),%ecx + subl %ecx,%esp + + movl %esp,%eax + + /* Place all of the ffi_prep_args in position */ + subl $8,%esp + pushl 12(%ebp) + pushl %eax + call *8(%ebp) + + /* Return stack to previous state and call the function */ + addl $16,%esp + + call *28(%ebp) + + /* Load %ecx with the return type code */ + movl 20(%ebp),%ecx + + /* Protect %esi. We're going to pop it in the epilogue. */ + pushl %esi + + /* If the return value pointer is NULL, assume no return value. */ + cmpl $0,24(%ebp) + jne 0f + + /* Even if there is no space for the return value, we are + obliged to handle floating-point values. */ + cmpl $FFI_TYPE_FLOAT,%ecx + jne noretval + fstp %st(0) + + jmp epilogue +0: + .align 4 + call 1f +.Lstore_table: + .long noretval-.Lstore_table /* FFI_TYPE_VOID */ + .long retint-.Lstore_table /* FFI_TYPE_INT */ + .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ + .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ + .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ + .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ + .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ + .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ + .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ + .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ + .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ + .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ + .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ + .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ + .long retint-.Lstore_table /* FFI_TYPE_POINTER */ + .long retstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */ + .long retstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */ +1: + pop %esi + add (%esi, %ecx, 4), %esi + jmp *%esi + + /* Sign/zero extend as appropriate. */ +retsint8: + movsbl %al, %eax + jmp retint + +retsint16: + movswl %ax, %eax + jmp retint + +retuint8: + movzbl %al, %eax + jmp retint + +retuint16: + movzwl %ax, %eax + jmp retint + +retfloat: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstps (%ecx) + jmp epilogue + +retdouble: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstpl (%ecx) + jmp epilogue + +retlongdouble: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstpt (%ecx) + jmp epilogue + +retint64: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + movl %edx,4(%ecx) + jmp epilogue + +retstruct1b: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movb %al,0(%ecx) + jmp epilogue + +retstruct2b: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movw %ax,0(%ecx) + jmp epilogue + +retint: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + +retstruct: + /* Nothing to do! */ + +noretval: +epilogue: + popl %esi + movl %ebp,%esp + popl %ebp + ret + +.LFE1: +.ffi_call_SYSV_end: + + .align 4 +FFI_HIDDEN (ffi_closure_SYSV) +.globl _ffi_closure_SYSV + +_ffi_closure_SYSV: +.LFB2: + pushl %ebp +.LCFI2: + movl %esp, %ebp +.LCFI3: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 8(%ebp), %edx + movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ + movl %ebx, 8(%esp) +.LCFI7: + call L_ffi_closure_SYSV_inner$stub + movl 8(%esp), %ebx + movl -12(%ebp), %ecx + cmpl $FFI_TYPE_INT, %eax + je .Lcls_retint + + /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, + FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ + cmpl $FFI_TYPE_UINT64, %eax + jge 0f + cmpl $FFI_TYPE_UINT8, %eax + jge .Lcls_retint + +0: cmpl $FFI_TYPE_FLOAT, %eax + je .Lcls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lcls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lcls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lcls_retllong + cmpl $FFI_TYPE_SMALL_STRUCT_1B, %eax + je .Lcls_retstruct1b + cmpl $FFI_TYPE_SMALL_STRUCT_2B, %eax + je .Lcls_retstruct2b + cmpl $FFI_TYPE_STRUCT, %eax + je .Lcls_retstruct +.Lcls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.Lcls_retint: + movl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retfloat: + flds (%ecx) + jmp .Lcls_epilogue +.Lcls_retdouble: + fldl (%ecx) + jmp .Lcls_epilogue +.Lcls_retldouble: + fldt (%ecx) + jmp .Lcls_epilogue +.Lcls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lcls_epilogue +.Lcls_retstruct1b: + movsbl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retstruct2b: + movswl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retstruct: + lea -8(%ebp),%esp + movl %ebp, %esp + popl %ebp + ret $4 +.LFE2: + +#if !FFI_NO_RAW_API + +#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) +#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) +#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) +#define CIF_FLAGS_OFFSET 20 + + .align 4 +FFI_HIDDEN (ffi_closure_raw_SYSV) +.globl _ffi_closure_raw_SYSV + +_ffi_closure_raw_SYSV: +.LFB3: + pushl %ebp +.LCFI4: + movl %esp, %ebp +.LCFI5: + pushl %esi +.LCFI6: + subl $36, %esp + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ + movl %edx, 12(%esp) /* user_data */ + leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ + movl %edx, 8(%esp) /* raw_args */ + leal -24(%ebp), %edx + movl %edx, 4(%esp) /* &res */ + movl %esi, (%esp) /* cif */ + call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ + movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ + cmpl $FFI_TYPE_INT, %eax + je .Lrcls_retint + + /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, + FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ + cmpl $FFI_TYPE_UINT64, %eax + jge 0f + cmpl $FFI_TYPE_UINT8, %eax + jge .Lrcls_retint +0: + cmpl $FFI_TYPE_FLOAT, %eax + je .Lrcls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lrcls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lrcls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lrcls_retllong +.Lrcls_epilogue: + addl $36, %esp + popl %esi + popl %ebp + ret +.Lrcls_retint: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue +.Lrcls_retfloat: + flds -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retdouble: + fldl -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retldouble: + fldt -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retllong: + movl -24(%ebp), %eax + movl -20(%ebp), %edx + jmp .Lrcls_epilogue +.LFE3: +#endif + +.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 +L_ffi_closure_SYSV_inner$stub: + .indirect_symbol _ffi_closure_SYSV_inner + hlt ; hlt ; hlt ; hlt ; hlt + + +.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support +EH_frame1: + .set L$set$0,LECIE1-LSCIE1 + .long L$set$0 +LSCIE1: + .long 0x0 + .byte 0x1 + .ascii "zR\0" + .byte 0x1 + .byte 0x7c + .byte 0x8 + .byte 0x1 + .byte 0x10 + .byte 0xc + .byte 0x5 + .byte 0x4 + .byte 0x88 + .byte 0x1 + .align 2 +LECIE1: +.globl _ffi_call_SYSV.eh +_ffi_call_SYSV.eh: +LSFDE1: + .set L$set$1,LEFDE1-LASFDE1 + .long L$set$1 +LASFDE1: + .long LASFDE1-EH_frame1 + .long .LFB1-. + .set L$set$2,.LFE1-.LFB1 + .long L$set$2 + .byte 0x0 + .byte 0x4 + .set L$set$3,.LCFI0-.LFB1 + .long L$set$3 + .byte 0xe + .byte 0x8 + .byte 0x84 + .byte 0x2 + .byte 0x4 + .set L$set$4,.LCFI1-.LCFI0 + .long L$set$4 + .byte 0xd + .byte 0x4 + .align 2 +LEFDE1: +.globl _ffi_closure_SYSV.eh +_ffi_closure_SYSV.eh: +LSFDE2: + .set L$set$5,LEFDE2-LASFDE2 + .long L$set$5 +LASFDE2: + .long LASFDE2-EH_frame1 + .long .LFB2-. + .set L$set$6,.LFE2-.LFB2 + .long L$set$6 + .byte 0x0 + .byte 0x4 + .set L$set$7,.LCFI2-.LFB2 + .long L$set$7 + .byte 0xe + .byte 0x8 + .byte 0x84 + .byte 0x2 + .byte 0x4 + .set L$set$8,.LCFI3-.LCFI2 + .long L$set$8 + .byte 0xd + .byte 0x4 + .align 2 +LEFDE2: + +#if !FFI_NO_RAW_API + +.globl _ffi_closure_raw_SYSV.eh +_ffi_closure_raw_SYSV.eh: +LSFDE3: + .set L$set$10,LEFDE3-LASFDE3 + .long L$set$10 +LASFDE3: + .long LASFDE3-EH_frame1 + .long .LFB3-. + .set L$set$11,.LFE3-.LFB3 + .long L$set$11 + .byte 0x0 + .byte 0x4 + .set L$set$12,.LCFI4-.LFB3 + .long L$set$12 + .byte 0xe + .byte 0x8 + .byte 0x84 + .byte 0x2 + .byte 0x4 + .set L$set$13,.LCFI5-.LCFI4 + .long L$set$13 + .byte 0xd + .byte 0x4 + .byte 0x4 + .set L$set$14,.LCFI6-.LCFI5 + .long L$set$14 + .byte 0x85 + .byte 0x3 + .align 2 +LEFDE3: + +#endif + +#endif /* ifndef __x86_64__ */ + +#endif \ No newline at end of file diff --git a/jscocoa/JSCocoa/iPhone/libffi/prep_cif.c b/jscocoa/JSCocoa/iPhone/libffi/prep_cif.c new file mode 100644 index 0000000..72154b8 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/prep_cif.c @@ -0,0 +1,174 @@ +/* ----------------------------------------------------------------------- + prep_cif.c - Copyright (c) 1996, 1998, 2007 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include "ffi.h" +#include "ffi_common.h" +#include + +/* Round up to FFI_SIZEOF_ARG. */ + +#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) + +/* Perform machine independent initialization of aggregate type + specifications. */ + +static ffi_status initialize_aggregate(ffi_type *arg) +{ + ffi_type **ptr; + + FFI_ASSERT(arg != NULL); + + FFI_ASSERT(arg->elements != NULL); + FFI_ASSERT(arg->size == 0); + FFI_ASSERT(arg->alignment == 0); + + ptr = &(arg->elements[0]); + + while ((*ptr) != NULL) + { + if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type */ + FFI_ASSERT_VALID_TYPE(*ptr); + + arg->size = ALIGN(arg->size, (*ptr)->alignment); + arg->size += (*ptr)->size; + + arg->alignment = (arg->alignment > (*ptr)->alignment) ? + arg->alignment : (*ptr)->alignment; + + ptr++; + } + + /* Structure size includes tail padding. This is important for + structures that fit in one register on ABIs like the PowerPC64 + Linux ABI that right justify small structs in a register. + It's also needed for nested structure layout, for example + struct A { long a; char b; }; struct B { struct A x; char y; }; + should find y at an offset of 2*sizeof(long) and result in a + total size of 3*sizeof(long). */ + arg->size = ALIGN (arg->size, arg->alignment); + + if (arg->size == 0) + return FFI_BAD_TYPEDEF; + else + return FFI_OK; +} + +#ifndef __CRIS__ +/* The CRIS ABI specifies structure elements to have byte + alignment only, so it completely overrides this functions, + which assumes "natural" alignment and padding. */ + +/* Perform machine independent ffi_cif preparation, then call + machine dependent routine. */ + +ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, + ffi_type *rtype, ffi_type **atypes) +{ + unsigned bytes = 0; + unsigned int i; + ffi_type **ptr; + + FFI_ASSERT(cif != NULL); + FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); + + cif->abi = abi; + cif->arg_types = atypes; + cif->nargs = nargs; + cif->rtype = rtype; + + cif->flags = 0; + + /* Initialize the return type if necessary */ + if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the return type */ + FFI_ASSERT_VALID_TYPE(cif->rtype); + + /* x86-64 and s390 stack space allocation is handled in prep_machdep. */ +#if !defined M68K && !defined __x86_64__ && !defined S390 && !defined PA + /* Make space for the return structure pointer */ + if (cif->rtype->type == FFI_TYPE_STRUCT +#ifdef SPARC + && (cif->abi != FFI_V9 || cif->rtype->size > 32) +#endif +#ifdef X86_DARWIN + && (cif->rtype->size > 8) +#endif + ) + bytes = STACK_ARG_SIZE(sizeof(void*)); +#endif + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + + /* Initialize any uninitialized aggregate type definitions */ + if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type, do this + check after the initialization. */ + FFI_ASSERT_VALID_TYPE(*ptr); + +#if !defined __x86_64__ && !defined S390 && !defined PA +#ifdef SPARC + if (((*ptr)->type == FFI_TYPE_STRUCT + && ((*ptr)->size > 16 || cif->abi != FFI_V9)) + || ((*ptr)->type == FFI_TYPE_LONGDOUBLE + && cif->abi != FFI_V9)) + bytes += sizeof(void*); + else +#endif + { + /* Add any padding if necessary */ + if (((*ptr)->alignment - 1) & bytes) + bytes = ALIGN(bytes, (*ptr)->alignment); + + bytes += STACK_ARG_SIZE((*ptr)->size); + } +#endif + } + + cif->bytes = bytes; + + /* Perform machine dependent cif processing */ + return ffi_prep_cif_machdep(cif); +} +#endif /* not __CRIS__ */ + +#if FFI_CLOSURES + +ffi_status +ffi_prep_closure (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data) +{ + return ffi_prep_closure_loc (closure, cif, fun, user_data, closure); +} + +#endif diff --git a/jscocoa/JSCocoa/iPhone/libffi/raw_api.c b/jscocoa/JSCocoa/iPhone/libffi/raw_api.c new file mode 100644 index 0000000..ccd2ace --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/raw_api.c @@ -0,0 +1,254 @@ +/* ----------------------------------------------------------------------- + raw_api.c - Copyright (c) 1999, 2008 Red Hat, Inc. + + Author: Kresten Krab Thorup + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +/* This file defines generic functions for use with the raw api. */ + +#include "ffi.h" +#include "ffi_common.h" + +#if !FFI_NO_RAW_API + +size_t +ffi_raw_size (ffi_cif *cif) +{ + size_t result = 0; + int i; + + ffi_type **at = cif->arg_types; + + for (i = cif->nargs-1; i >= 0; i--, at++) + { +#if !FFI_NO_STRUCTS + if ((*at)->type == FFI_TYPE_STRUCT) + result += ALIGN (sizeof (void*), FFI_SIZEOF_ARG); + else +#endif + result += ALIGN ((*at)->size, FFI_SIZEOF_ARG); + } + + return result; +} + + +void +ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) +{ + unsigned i; + ffi_type **tp = cif->arg_types; + +#if WORDS_BIGENDIAN + + for (i = 0; i < cif->nargs; i++, tp++, args++) + { + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 1); + break; + + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 2); + break; + +#if FFI_SIZEOF_ARG >= 4 + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 4); + break; +#endif + +#if !FFI_NO_STRUCTS + case FFI_TYPE_STRUCT: + *args = (raw++)->ptr; + break; +#endif + + case FFI_TYPE_POINTER: + *args = (void*) &(raw++)->ptr; + break; + + default: + *args = raw; + raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + } + } + +#else /* WORDS_BIGENDIAN */ + +#if !PDP + + /* then assume little endian */ + for (i = 0; i < cif->nargs; i++, tp++, args++) + { +#if !FFI_NO_STRUCTS + if ((*tp)->type == FFI_TYPE_STRUCT) + { + *args = (raw++)->ptr; + } + else +#endif + { + *args = (void*) raw; + raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); + } + } + +#else +#error "pdp endian not supported" +#endif /* ! PDP */ + +#endif /* WORDS_BIGENDIAN */ +} + +void +ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) +{ + unsigned i; + ffi_type **tp = cif->arg_types; + + for (i = 0; i < cif->nargs; i++, tp++, args++) + { + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: + (raw++)->uint = *(UINT8*) (*args); + break; + + case FFI_TYPE_SINT8: + (raw++)->sint = *(SINT8*) (*args); + break; + + case FFI_TYPE_UINT16: + (raw++)->uint = *(UINT16*) (*args); + break; + + case FFI_TYPE_SINT16: + (raw++)->sint = *(SINT16*) (*args); + break; + +#if FFI_SIZEOF_ARG >= 4 + case FFI_TYPE_UINT32: + (raw++)->uint = *(UINT32*) (*args); + break; + + case FFI_TYPE_SINT32: + (raw++)->sint = *(SINT32*) (*args); + break; +#endif + +#if !FFI_NO_STRUCTS + case FFI_TYPE_STRUCT: + (raw++)->ptr = *args; + break; +#endif + + case FFI_TYPE_POINTER: + (raw++)->ptr = **(void***) args; + break; + + default: + memcpy ((void*) raw->data, (void*)*args, (*tp)->size); + raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + } + } +} + +#if !FFI_NATIVE_RAW_API + + +/* This is a generic definition of ffi_raw_call, to be used if the + * native system does not provide a machine-specific implementation. + * Having this, allows code to be written for the raw API, without + * the need for system-specific code to handle input in that format; + * these following couple of functions will handle the translation forth + * and back automatically. */ + +void ffi_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *raw) +{ + void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); + ffi_raw_to_ptrarray (cif, raw, avalue); + ffi_call (cif, fn, rvalue, avalue); +} + +#if FFI_CLOSURES /* base system provides closures */ + +static void +ffi_translate_args (ffi_cif *cif, void *rvalue, + void **avalue, void *user_data) +{ + ffi_raw *raw = (ffi_raw*)alloca (ffi_raw_size (cif)); + ffi_raw_closure *cl = (ffi_raw_closure*)user_data; + + ffi_ptrarray_to_raw (cif, avalue, raw); + (*cl->fun) (cif, rvalue, raw, cl->user_data); +} + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure* cl, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc) +{ + ffi_status status; + + status = ffi_prep_closure_loc ((ffi_closure*) cl, + cif, + &ffi_translate_args, + codeloc, + codeloc); + if (status == FFI_OK) + { + cl->fun = fun; + cl->user_data = user_data; + } + + return status; +} + +#endif /* FFI_CLOSURES */ +#endif /* !FFI_NATIVE_RAW_API */ + +#if FFI_CLOSURES + +/* Again, here is the generic version of ffi_prep_raw_closure, which + * will install an intermediate "hub" for translation of arguments from + * the pointer-array format, to the raw format */ + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure* cl, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data) +{ + return ffi_prep_raw_closure_loc (cl, cif, fun, user_data, cl); +} + +#endif /* FFI_CLOSURES */ + +#endif /* !FFI_NO_RAW_API */ diff --git a/jscocoa/JSCocoa/iPhone/libffi/types.c b/jscocoa/JSCocoa/iPhone/libffi/types.c new file mode 100644 index 0000000..e9859c8 --- /dev/null +++ b/jscocoa/JSCocoa/iPhone/libffi/types.c @@ -0,0 +1,77 @@ +/* ----------------------------------------------------------------------- + types.c - Copyright (c) 1996, 1998 Red Hat, Inc. + + Predefined ffi_types needed by libffi. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +/* Hide the basic type definitions from the header file, so that we + can redefine them here as "const". */ +#define LIBFFI_HIDE_BASIC_TYPES + +#include "ffi.h" +#include "ffi_common.h" + +/* Type definitions */ + +#define FFI_TYPEDEF(name, type, id) \ +struct struct_align_##name { \ + char c; \ + type x; \ +}; \ +const ffi_type ffi_type_##name = { \ + sizeof(type), \ + offsetof(struct struct_align_##name, x), \ + id, NULL \ +} + +/* Size and alignment are fake here. They must not be 0. */ +const ffi_type ffi_type_void = { + 1, 1, FFI_TYPE_VOID, NULL +}; + +FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8); +FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8); +FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16); +FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16); +FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32); +FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32); +FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64); +FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64); + +FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER); + +FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT); +FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE); + +#ifdef __alpha__ +/* Even if we're not configured to default to 128-bit long double, + maintain binary compatibility, as -mlong-double-128 can be used + at any time. */ +/* Validate the hard-coded number below. */ +# if defined(__LONG_DOUBLE_128__) && FFI_TYPE_LONGDOUBLE != 4 +# error FFI_TYPE_LONGDOUBLE out of date +# endif +const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; +#elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE +FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE); +#endif diff --git a/jscocoa/JSCocoa/jslint-jscocoa.js b/jscocoa/JSCocoa/jslint-jscocoa.js new file mode 100644 index 0000000..593e270 --- /dev/null +++ b/jscocoa/JSCocoa/jslint-jscocoa.js @@ -0,0 +1,5678 @@ +// jslint.js +// 2009-05-06 + + +/* +Copyright (c) 2002 Douglas Crockford (www.JSLint.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +The Software shall be used for Good, not Evil. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +/* + JSLINT is a global function. It takes two parameters. + + var myResult = JSLINT(source, option); + + The first parameter is either a string or an array of strings. If it is a + string, it will be split on '\n' or '\r'. If it is an array of strings, it + is assumed that each string represents one line. The source can be a + JavaScript text, or HTML text, or a Konfabulator text. + + The second parameter is an optional object of options which control the + operation of JSLINT. Most of the options are booleans: They are all are + optional and have a default value of false. + + If it checks out, JSLINT returns true. Otherwise, it returns false. + + If false, you can inspect JSLINT.errors to find out the problems. + JSLINT.errors is an array of objects containing these members: + + { + line : The line (relative to 0) at which the lint was found + character : The character (relative to 0) at which the lint was found + reason : The problem + evidence : The text line in which the problem occurred + raw : The raw message before the details were inserted + a : The first detail + b : The second detail + c : The third detail + d : The fourth detail + } + + If a fatal error was found, a null will be the last element of the + JSLINT.errors array. + + You can request a Function Report, which shows all of the functions + and the parameters and vars that they use. This can be used to find + implied global variables and other problems. The report is in HTML and + can be inserted in an HTML . + + var myReport = JSLINT.report(limited); + + If limited is true, then the report will be limited to only errors. +*/ + +/*jslint + evil: true, nomen: false, onevar: false, regexp: false , strict: true +*/ + +/*global JSLINT*/ + +/*members "\b", "\t", "\n", "\f", "\r", "\"", "%", "(begin)", + "(breakage)", "(context)", "(error)", "(global)", "(identifier)", + "(line)", "(loopage)", "(name)", "(onevar)", "(params)", "(scope)", + "(verb)", ")", "++", "--", "\/", ADSAFE, Array, Boolean, COM, Canvas, + CustomAnimation, Date, Debug, E, Error, EvalError, FadeAnimation, + Flash, FormField, Frame, Function, HotKey, Image, JSON, LN10, LN2, LOG10E, + LOG2E, MAX_VALUE, MIN_VALUE, Math, MenuItem, MoveAnimation, + NEGATIVE_INFINITY, Number, Object, Option, PI, POSITIVE_INFINITY, Point, + RangeError, Rectangle, ReferenceError, RegExp, ResizeAnimation, + RotateAnimation, SQRT1_2, SQRT2, ScrollBar, String, Style, SyntaxError, + System, Text, TextArea, Timer, TypeError, URIError, URL, Web, Window, + XMLDOM, XMLHttpRequest, "\\", "]", a, abbr, acronym, active, address, + adsafe, after, alert, aliceblue, animator, antiquewhite, appleScript, + applet, apply, approved, aqua, aquamarine, area, arguments, arity, + autocomplete, azure, b, background, "background-attachment", + "background-color", "background-image", "background-position", + "background-repeat", base, bdo, beep, before, beige, big, bisque, + bitwise, black, blanchedalmond, block, blockquote, blue, blueviolet, + blur, body, border, "border-bottom", "border-bottom-color", + "border-bottom-style", "border-bottom-width", "border-collapse", + "border-color", "border-left", "border-left-color", "border-left-style", + "border-left-width", "border-right", "border-right-color", + "border-right-style", "border-right-width", "border-spacing", + "border-style", "border-top", "border-top-color", "border-top-style", + "border-top-width", "border-width", bottom, br, brown, browser, + burlywood, button, bytesToUIString, c, cadetblue, call, callee, caller, + canvas, cap, caption, "caption-side", cases, center, charAt, charCodeAt, + character, chartreuse, chocolate, chooseColor, chooseFile, chooseFolder, + cite, clear, clearInterval, clearTimeout, clip, close, closeWidget, + closed, cm, code, col, colgroup, color, comment, condition, confirm, + console, constructor, content, convertPathToHFS, convertPathToPlatform, + coral, cornflowerblue, cornsilk, "counter-increment", "counter-reset", + create, crimson, css, cursor, cyan, d, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgreen, darkkhaki, darkmagenta, + darkolivegreen, darkorange, darkorchid, darkred, darksalmon, + darkseagreen, darkslateblue, darkslategray, darkturquoise, darkviolet, + dd, debug, decodeURI, decodeURIComponent, deeppink, deepskyblue, + defaultStatus, defineClass, del, deserialize, dfn, dimgray, dir, + direction, display, div, dl, document, dodgerblue, dt, edition, else, em, + embed, empty, "empty-cells", encodeURI, encodeURIComponent, entityify, + eqeqeq, errors, escape, eval, event, evidence, evil, ex, exec, exps, + fieldset, filesystem, firebrick, first, "first-child", "first-letter", + "first-line", float, floor, floralwhite, focus, focusWidget, font, + "font-face", "font-family", "font-size", "font-size-adjust", + "font-stretch", "font-style", "font-variant", "font-weight", + forestgreen, forin, form, fragment, frame, frames, frameset, from, + fromCharCode, fuchsia, fud, funct, function, g, gainsboro, gc, + getComputedStyle, ghostwhite, gold, goldenrod, gray, green, greenyellow, + h1, h2, h3, h4, h5, h6, hasOwnProperty, head, height, help, history, + honeydew, hotpink, hover, hr, html, i, iTunes, id, identifier, iframe, + img, immed, import, in, include, indent, indexOf, indianred, indigo, + init, input, ins, isAlpha, isApplicationRunning, isDigit, isFinite, + isNaN, ivory, join, kbd, khaki, konfabulatorVersion, label, labelled, + lang, lavender, lavenderblush, lawngreen, laxbreak, lbp, led, left, + legend, lemonchiffon, length, "letter-spacing", li, lib, lightblue, + lightcoral, lightcyan, lightgoldenrodyellow, lightgreen, lightpink, + lightsalmon, lightseagreen, lightskyblue, lightslategray, + lightsteelblue, lightyellow, lime, limegreen, line, "line-height", + linen, link, "list-style", "list-style-image", "list-style-position", + "list-style-type", load, loadClass, location, log, m, magenta, map, + margin, "margin-bottom", "margin-left", "margin-right", "margin-top", + "marker-offset", maroon, match, "max-height", "max-width", md5, media, + mediumaquamarine, mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, + mediumvioletred, menu, message, meta, midnightblue, "min-height", + "min-width", mintcream, mistyrose, mm, moccasin, moveBy, moveTo, name, + navajowhite, navigator, navy, new, newcap, noframes, nomen, noscript, + nud, object, ol, oldlace, olive, olivedrab, on, onblur, onerror, onevar, + onfocus, onload, onresize, onunload, opacity, open, openURL, opener, + opera, optgroup, option, orange, orangered, orchid, outer, outline, + "outline-color", "outline-style", "outline-width", overflow, p, padding, + "padding-bottom", "padding-left", "padding-right", "padding-top", page, + palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, + param, parent, parseFloat, parseInt, passfail, pc, peachpuff, peru, + pink, play, plum, plusplus, pop, popupMenu, position, powderblue, pre, + predef, preferenceGroups, preferences, print, prompt, prototype, pt, + purple, push, px, q, quit, quotes, random, range, raw, reach, readFile, + readUrl, reason, red, regexp, reloadWidget, replace, report, reserved, + resizeBy, resizeTo, resolvePath, resumeUpdates, rhino, right, rosybrown, + royalblue, runCommand, runCommandInBg, saddlebrown, safe, salmon, samp, + sandybrown, saveAs, savePreferences, screen, script, scroll, scrollBy, + scrollTo, seagreen, seal, search, seashell, select, self, serialize, + setInterval, setTimeout, shift, showWidgetPreferences, sidebar, sienna, + silver, skyblue, slateblue, slategray, sleep, slice, small, snow, sort, + span, spawn, speak, split, springgreen, src, status, steelblue, strict, + strong, style, styleproperty, sub, substr, sup, supplant, + suppressUpdates, sync, system, table, "table-layout", tan, tbody, td, + teal, tellWidget, test, "text-align", "text-decoration", "text-indent", + "text-shadow", "text-transform", textarea, tfoot, th, thead, thistle, + title, toLowerCase, toString, toUpperCase, toint32, token, tomato, top, + tr, tt, turquoise, type, u, ul, undef, unescape, "unicode-bidi", + unwatch, updateNow, value, valueOf, var, version, "vertical-align", + violet, visibility, visited, watch, wheat, white, "white-space", + whitesmoke, widget, width, window, "word-spacing", yahooCheckLogin, + yahooLogin, yahooLogout, yellow, yellowgreen, "z-index" +*/ + +// We build the application inside a function so that we produce only a single +// global variable. The function will be invoked, its return value is the JSLINT +// application itself. + +"use strict"; + +function JSLintWithLogs(logs) +{ + var JSLINT + + var fn = function () {} + var logToken = logs.logToken || fn + var logParseStart = logs.logParseStart || fn + var logParseEnd = logs.logParseEnd || fn + var logFunctionStart= logs.logFunctionStart || fn + var logStatement = logs.logStatement || fn + var logFunctionEnd = logs.logFunctionEnd || fn + + // Things we need to replace + var logExtraSyntax = logs.logExtraSyntax || fn + + var logTokenLock = 0 + function disableLogToken() { logTokenLock++ } + function enableLogToken() { logTokenLock-- } + + +JSLINT = (function renamedJSLint () { + + // ## (internal) Guard against inner classes definitions + var parsingClass; + + var adsafe_id, // The widget's ADsafe id. + adsafe_may, // The widget may load approved scripts. + adsafe_went, // ADSAFE.go has been called. + anonname, // The guessed name for anonymous functions. + approved, // ADsafe approved urls. + + atrule = { + 'import' : true, + media : true, + 'font-face': true, + page : true + }, + +// These are members that should not be permitted in third party ads. + + banned = { // the member names that ADsafe prohibits. + apply : true, + 'arguments' : true, + call : true, + callee : true, + caller : true, + constructor : true, + 'eval' : true, + prototype : true, + unwatch : true, + valueOf : true, + watch : true + }, + + +// These are the JSLint boolean options. + + boolOptions = { + adsafe : true, // if ADsafe should be enforced + bitwise : true, // if bitwise operators should not be allowed + browser : true, // if the standard browser globals should be predefined + cap : true, // if upper case HTML should be allowed + css : true, // if CSS workarounds should be tolerated + debug : true, // if debugger statements should be allowed + eqeqeq : true, // if === should be required + evil : true, // if eval should be allowed + forin : true, // if for in statements must filter + fragment : true, // if HTML fragments should be allowed + immed : true, // if immediate invocations must be wrapped in parens + laxbreak : true, // if line breaks should not be checked + newcap : true, // if constructor names must be capitalized + nomen : true, // if names should be checked + on : true, // if HTML event handlers should be allowed + onevar : true, // if only one var statement per function should be allowed + passfail : true, // if the scan should stop on first error + plusplus : true, // if increment/decrement should not be allowed + regexp : true, // if the . should not be allowed in regexp literals + rhino : true, // if the Rhino environment globals should be predefined + undef : true, // if variables should be declared before used + safe : true, // if use of some browser features should be restricted + sidebar : true, // if the System object should be predefined + strict : true, // require the "use strict"; pragma + sub : true, // if all forms of subscript notation are tolerated + white : true, // if strict whitespace rules apply + widget : true // if the Yahoo Widgets globals should be predefined + }, + +// browser contains a set of global names which are commonly provided by a +// web browser environment. + + browser = { + alert : true, + blur : true, + clearInterval : true, + clearTimeout : true, + close : true, + closed : true, + confirm : true, + console : true, + Debug : true, + defaultStatus : true, + document : true, + event : true, + focus : true, + frames : true, + getComputedStyle: true, + history : true, + Image : true, + length : true, + location : true, + moveBy : true, + moveTo : true, + name : true, + navigator : true, + onblur : true, + onerror : true, + onfocus : true, + onload : true, + onresize : true, + onunload : true, + open : true, + opener : true, + opera : true, + Option : true, + parent : true, + print : true, + prompt : true, + resizeBy : true, + resizeTo : true, + screen : true, + scroll : true, + scrollBy : true, + scrollTo : true, + setInterval : true, + setTimeout : true, + status : true, + top : true, + XMLHttpRequest : true + }, + + cssAttributeData, + cssAny, + + cssColorData = { + "aliceblue" : true, + "antiquewhite" : true, + "aqua" : true, + "aquamarine" : true, + "azure" : true, + "beige" : true, + "bisque" : true, + "black" : true, + "blanchedalmond" : true, + "blue" : true, + "blueviolet" : true, + "brown" : true, + "burlywood" : true, + "cadetblue" : true, + "chartreuse" : true, + "chocolate" : true, + "coral" : true, + "cornflowerblue" : true, + "cornsilk" : true, + "crimson" : true, + "cyan" : true, + "darkblue" : true, + "darkcyan" : true, + "darkgoldenrod" : true, + "darkgray" : true, + "darkgreen" : true, + "darkkhaki" : true, + "darkmagenta" : true, + "darkolivegreen" : true, + "darkorange" : true, + "darkorchid" : true, + "darkred" : true, + "darksalmon" : true, + "darkseagreen" : true, + "darkslateblue" : true, + "darkslategray" : true, + "darkturquoise" : true, + "darkviolet" : true, + "deeppink" : true, + "deepskyblue" : true, + "dimgray" : true, + "dodgerblue" : true, + "firebrick" : true, + "floralwhite" : true, + "forestgreen" : true, + "fuchsia" : true, + "gainsboro" : true, + "ghostwhite" : true, + "gold" : true, + "goldenrod" : true, + "gray" : true, + "green" : true, + "greenyellow" : true, + "honeydew" : true, + "hotpink" : true, + "indianred" : true, + "indigo" : true, + "ivory" : true, + "khaki" : true, + "lavender" : true, + "lavenderblush" : true, + "lawngreen" : true, + "lemonchiffon" : true, + "lightblue" : true, + "lightcoral" : true, + "lightcyan" : true, + "lightgoldenrodyellow" : true, + "lightgreen" : true, + "lightpink" : true, + "lightsalmon" : true, + "lightseagreen" : true, + "lightskyblue" : true, + "lightslategray" : true, + "lightsteelblue" : true, + "lightyellow" : true, + "lime" : true, + "limegreen" : true, + "linen" : true, + "magenta" : true, + "maroon" : true, + "mediumaquamarine" : true, + "mediumblue" : true, + "mediumorchid" : true, + "mediumpurple" : true, + "mediumseagreen" : true, + "mediumslateblue" : true, + "mediumspringgreen" : true, + "mediumturquoise" : true, + "mediumvioletred" : true, + "midnightblue" : true, + "mintcream" : true, + "mistyrose" : true, + "moccasin" : true, + "navajowhite" : true, + "navy" : true, + "oldlace" : true, + "olive" : true, + "olivedrab" : true, + "orange" : true, + "orangered" : true, + "orchid" : true, + "palegoldenrod" : true, + "palegreen" : true, + "paleturquoise" : true, + "palevioletred" : true, + "papayawhip" : true, + "peachpuff" : true, + "peru" : true, + "pink" : true, + "plum" : true, + "powderblue" : true, + "purple" : true, + "red" : true, + "rosybrown" : true, + "royalblue" : true, + "saddlebrown" : true, + "salmon" : true, + "sandybrown" : true, + "seagreen" : true, + "seashell" : true, + "sienna" : true, + "silver" : true, + "skyblue" : true, + "slateblue" : true, + "slategray" : true, + "snow" : true, + "springgreen" : true, + "steelblue" : true, + "tan" : true, + "teal" : true, + "thistle" : true, + "tomato" : true, + "turquoise" : true, + "violet" : true, + "wheat" : true, + "white" : true, + "whitesmoke" : true, + "yellow" : true, + "yellowgreen" : true + }, + + cssBorderStyle, + + cssLengthData = { + '%': true, + 'cm': true, + 'em': true, + 'ex': true, + 'in': true, + 'mm': true, + 'pc': true, + 'pt': true, + 'px': true + }, + + escapes = { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '/' : '\\/', + '\\': '\\\\' + }, + + funct, // The current function + functions, // All of the functions + + global, // The global scope + htmltag = { + a: {}, + abbr: {}, + acronym: {}, + address: {}, + applet: {}, + area: {empty: true, parent: ' map '}, + b: {}, + base: {empty: true, parent: ' head '}, + bdo: {}, + big: {}, + blockquote: {}, + body: {parent: ' html noframes '}, + br: {empty: true}, + button: {}, + canvas: {parent: ' body p div th td '}, + caption: {parent: ' table '}, + center: {}, + cite: {}, + code: {}, + col: {empty: true, parent: ' table colgroup '}, + colgroup: {parent: ' table '}, + dd: {parent: ' dl '}, + del: {}, + dfn: {}, + dir: {}, + div: {}, + dl: {}, + dt: {parent: ' dl '}, + em: {}, + embed: {}, + fieldset: {}, + font: {}, + form: {}, + frame: {empty: true, parent: ' frameset '}, + frameset: {parent: ' html frameset '}, + h1: {}, + h2: {}, + h3: {}, + h4: {}, + h5: {}, + h6: {}, + head: {parent: ' html '}, + html: {parent: '*'}, + hr: {empty: true}, + i: {}, + iframe: {}, + img: {empty: true}, + input: {empty: true}, + ins: {}, + kbd: {}, + label: {}, + legend: {parent: ' fieldset '}, + li: {parent: ' dir menu ol ul '}, + link: {empty: true, parent: ' head '}, + map: {}, + menu: {}, + meta: {empty: true, parent: ' head noframes noscript '}, + noframes: {parent: ' html body '}, + noscript: {parent: ' body head noframes '}, + object: {}, + ol: {}, + optgroup: {parent: ' select '}, + option: {parent: ' optgroup select '}, + p: {}, + param: {empty: true, parent: ' applet object '}, + pre: {}, + q: {}, + samp: {}, + script: {empty: true, parent: ' body div frame head iframe p pre span '}, + select: {}, + small: {}, + span: {}, + strong: {}, + style: {parent: ' head ', empty: true}, + sub: {}, + sup: {}, + table: {}, + tbody: {parent: ' table '}, + td: {parent: ' tr '}, + textarea: {}, + tfoot: {parent: ' table '}, + th: {parent: ' tr '}, + thead: {parent: ' table '}, + title: {parent: ' head '}, + tr: {parent: ' table tbody thead tfoot '}, + tt: {}, + u: {}, + ul: {}, + 'var': {} + }, + + ids, // HTML ids + implied, // Implied globals + inblock, + indent, + jsonmode, + lines, + lookahead, + member, + membersOnly, + nexttoken, + noreach, + option, + predefined, // Global variables defined by option + prereg, + prevtoken, + + pseudorule = { + 'first-child': true, + link : true, + visited : true, + hover : true, + active : true, + focus : true, + lang : true, + 'first-letter' : true, + 'first-line' : true, + before : true, + after : true + }, + + rhino = { + defineClass : true, + deserialize : true, + gc : true, + help : true, + load : true, + loadClass : true, + print : true, + quit : true, + readFile : true, + readUrl : true, + runCommand : true, + seal : true, + serialize : true, + spawn : true, + sync : true, + toint32 : true, + version : true + }, + + scope, // The current scope + + sidebar = { + System : true + }, + + src, + stack, + +// standard contains the global names that are provided by the +// ECMAScript standard. + + standard = { + Array : true, + Boolean : true, + Date : true, + decodeURI : true, + decodeURIComponent : true, + encodeURI : true, + encodeURIComponent : true, + Error : true, + 'eval' : true, + EvalError : true, + Function : true, + isFinite : true, + isNaN : true, + JSON : true, + Math : true, + Number : true, + Object : true, + parseInt : true, + parseFloat : true, + RangeError : true, + ReferenceError : true, + RegExp : true, + String : true, + SyntaxError : true, + TypeError : true, + URIError : true + }, + + standard_member = { + E : true, + LN2 : true, + LN10 : true, + LOG2E : true, + LOG10E : true, + PI : true, + SQRT1_2 : true, + SQRT2 : true, + MAX_VALUE : true, + MIN_VALUE : true, + NEGATIVE_INFINITY : true, + POSITIVE_INFINITY : true + }, + + syntax = {}, + tab, + token, + urls, + warnings, + +// widget contains the global names which are provided to a Yahoo +// (fna Konfabulator) widget. + + widget = { + alert : true, + animator : true, + appleScript : true, + beep : true, + bytesToUIString : true, + Canvas : true, + chooseColor : true, + chooseFile : true, + chooseFolder : true, + closeWidget : true, + COM : true, + convertPathToHFS : true, + convertPathToPlatform : true, + CustomAnimation : true, + escape : true, + FadeAnimation : true, + filesystem : true, + Flash : true, + focusWidget : true, + form : true, + FormField : true, + Frame : true, + HotKey : true, + Image : true, + include : true, + isApplicationRunning : true, + iTunes : true, + konfabulatorVersion : true, + log : true, + md5 : true, + MenuItem : true, + MoveAnimation : true, + openURL : true, + play : true, + Point : true, + popupMenu : true, + preferenceGroups : true, + preferences : true, + print : true, + prompt : true, + random : true, + Rectangle : true, + reloadWidget : true, + ResizeAnimation : true, + resolvePath : true, + resumeUpdates : true, + RotateAnimation : true, + runCommand : true, + runCommandInBg : true, + saveAs : true, + savePreferences : true, + screen : true, + ScrollBar : true, + showWidgetPreferences : true, + sleep : true, + speak : true, + Style : true, + suppressUpdates : true, + system : true, + tellWidget : true, + Text : true, + TextArea : true, + Timer : true, + unescape : true, + updateNow : true, + URL : true, + Web : true, + widget : true, + Window : true, + XMLDOM : true, + XMLHttpRequest : true, + yahooCheckLogin : true, + yahooLogin : true, + yahooLogout : true + }, + +// xmode is used to adapt to the exceptions in html parsing. +// It can have these states: +// false .js script file +// html +// outer +// script +// style +// scriptstring +// styleproperty + + xmode, + xquote, + +// unsafe comment or string + ax = /@cc|<\/?|script|\]*s\]|<\s*!|</i, +// unsafe characters that are silently deleted by one or more browsers + cx = /[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/, +// token +// tx = /^\s*([(){}\[.,:;'"~\?\]#@]|==?=?|\/(\*(global|extern|jslint|member|members)?|=|\/)?|\*[\/=]?|\+[+=]?|-[\-=]?|%=?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/, + // ## Allow unicode identifiers as characters having a charcode > 0xc0. + // That's too broad. Maybe check if eval('var supposedIdentifier') throws ? + // added ext >?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z\u00c0-\uffff_$][a-zA-Z0-9\u00c0-\uffff_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/, + + tx = function () + { +// var a = /^\s*([(){}\[.,:;'"~\?\]#@]|==?=?|\/(\*(global|extern|jslint|member|members)?|=|\/)?|\*[\/=]?|\+[+=]?|-[\-=]?|%=?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z\u00c0-\uffff_$][a-zA-Z0-9\u00c0-\uffff_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/ +// var r = "^\\s*([()}.,:;'\"~\\?\\]#@]|\\[\\+\\]|\\[|{\\+}|@implementation|@end|@selector|@|ƒ|{|==?=?|\\/(\\*(global|extern|jslint|member|members)?|=|\\/)?|\\*[\\/=]?|\\+[+=]?|-[\\-=]?|%=?|&[&=]?|\\|[|=]?|>>?>?=?|<([\\/=!]|<=?)?|\\^=?|\\!=?=?|[a-zA-Z\\u00c0-\\uffff_$][a-zA-Z0-9\\u00c0-\\uffff_$]*|[0-9]+([xX][0-9a-fA-F]+|\\.[0-9]*)?([eE][+\\-]?[0-9]+)?)" + var r = "^\\s*([()}.,:;'\"~\\?\\]#]|\\[\\+\\]|\\[|{\\+}|@=|@implementation|@end|@selector|@|ƒ|{|==?=?|\\/(\\*|=|\\/)?|\\*[\\/=]?|\\+[+=]?|-[\\-=]?|%=?|&[&=]?|\\|[|=]?|>>?>?=?|<([\\/=!]|<=?)?|\\^=?|\\!=?=?|[a-zA-Z\\u00c0-\\uffff_$][a-zA-Z0-9\\u00c0-\\uffff_$]*|[0-9]+([xX][0-9a-fA-F]+|\\.[0-9]*)?([eE][+\\-]?[0-9]+)?)" + return new RegExp(r) + + }(), +/* + tx = +^\s*([(){}\[.,:;'"~\?\]#@] +==?=? +\/(\*(global +extern +jslint +member +members)? += +\/)? +\*[\/=]? +\+[+=]? +-[\-=]? +%=? +&[&=]? +\ +[ +=]? +>>?>?=? +<([\/=!] +\!(\[ +--)? +<=?)? +\^=? +\!=?=? +[a-zA-Z\u00c0-\uffff_$][a-zA-Z0-9\u00c0-\uffff_$]* +[0-9]+([xX][0-9a-fA-F]+ +\.[0-9]*)?([eE][+\-]?[0-9]+)?) + +*/ + +// html token + hx = /^\s*(['"=>\/&#]|<(?:\/|\!(?:--)?)?|[a-zA-Z][a-zA-Z0-9_\-]*|[0-9]+|--|.)/, +// characters in strings that need escapement + nx = /[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/, + nxg = /[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, +// outer html token + ox = /[>&]|<[\/!]?|--/, +// star slash + lx = /\*\/|\/\*/, +// identifier +// ix = /^([a-zA-Z_$][a-zA-Z0-9_$]*)$/, + // ## unicode identifier grossfix + ix = /^([A-Z_$\u00c0-\uffff][a-zA-Z0-9_$]*)$/, +// javascript url + jx = /^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i, +// url badness + ux = /&|\+|\u00AD|\.\.|\/\*|%[^;]|base64|url|expression|data|mailto/i, +// style + sx = /^\s*([{:#*%.=,>+\[\]@()"';*]|[a-zA-Z0-9_][a-zA-Z0-9_\-]*|<\/|\/\*)/, + ssx = /^\s*([@#!"'};:\-%.=,+\[\]()*_]|[a-zA-Z][a-zA-Z0-9._\-]*|\/\*?|\d+(?:\.\d+)?|<\/)/, +// attributes characters + qx = /[^a-zA-Z0-9-_\/ ]/, +// query characters for ids + dx = /[\[\]\/\\"'*<>.&:(){}+=#]/, + + rx = { + outer: hx, + html: hx, + style: sx, + styleproperty: ssx + }; + + function F() {} + + if (typeof Object.create !== 'function') { + Object.create = function (o) { + F.prototype = o; + return new F(); + }; + } + + function combine(t, o) { + var n; + for (n in o) { + if (o.hasOwnProperty(n)) { + t[n] = o[n]; + } + } + } + + String.prototype.entityify = function () { + return this. + replace(/&/g, '&'). + replace(//g, '>'); + }; + + String.prototype.isAlpha = function () { + return (this >= 'a' && this <= 'z\uffff') || + (this >= 'A' && this <= 'Z\uffff'); + }; + + + String.prototype.isDigit = function () { + return (this >= '0' && this <= '9'); + }; + + + String.prototype.supplant = function (o) { + return this.replace(/\{([^{}]*)\}/g, function (a, b) { + var r = o[b]; + return typeof r === 'string' || typeof r === 'number' ? r : a; + }); + }; + + String.prototype.name = function () { + +// If the string looks like an identifier, then we can return it as is. +// If the string contains no control characters, no quote characters, and no +// backslash characters, then we can simply slap some quotes around it. +// Otherwise we must also replace the offending characters with safe +// sequences. + + if (ix.test(this)) { + return this; + } + if (nx.test(this)) { + return '"' + this.replace(nxg, function (a) { + var c = escapes[a]; + if (c) { + return c; + } + return '\\u' + ('0000' + a.charCodeAt().toString(16)).slice(-4); + }) + '"'; + } + return '"' + this + '"'; + }; + + + function assume() { + if (!option.safe) { + if (option.rhino) { + combine(predefined, rhino); + } + if (option.browser || option.sidebar) { + combine(predefined, browser); + } + if (option.sidebar) { + combine(predefined, sidebar); + } + if (option.widget) { + combine(predefined, widget); + } + } + } + + +// Produce an error warning. + + function quit(m, l, ch) { + throw { + name: 'JSLintError', + line: l, + character: ch, + message: m + " (" + Math.floor((l / lines.length) * 100) + + "% scanned)." + }; + } + + function warning(m, t, a, b, c, d) { + var ch, l, w; + t = t || nexttoken; + if (t.id === '(end)') { // `~ + t = token; + } + l = t.line || 0; + ch = t.from || 0; + w = { + id: '(error)', + raw: m, + evidence: lines[l] || '', + line: l, + character: ch, + a: a, + b: b, + c: c, + d: d + }; + w.reason = m.supplant(w); + JSLINT.errors.push(w); + if (option.passfail) { + quit('Stopping. ', l, ch); + } +/* + warnings += 1; + if (warnings === 50) { + quit("Too many errors.", l, ch); + } +*/ + return w; + } + + function warningAt(m, l, ch, a, b, c, d) { + return warning(m, { + line: l, + from: ch + }, a, b, c, d); + } + + function error(m, t, a, b, c, d) { + var w = warning(m, t, a, b, c, d); + quit("Stopping, unable to continue.", w.line, w.character); + } + + function errorAt(m, l, ch, a, b, c, d) { + return error(m, { + line: l, + from: ch + }, a, b, c, d); + } + + + +// lexical analysis + + var lex = (function lex() { + var character, from, line, s; + +// Private lex methods + + function nextLine() { + var at; + line += 1; + if (line >= lines.length) { + return false; + } + character = 0; + //## keep tabs +// s = lines[line].replace(/\t/g, tab); + s = lines[line] +/* at = s.search(cx); + if (at >= 0) { + warningAt("Unsafe character.", line, at); + }*/ + return true; + } + +// Produce a token object. The token inherits from a syntax symbol. + + function it(type, value) { + var i, t; + if (type === '(color)') { + t = {type: type}; + } else if (type === '(punctuator)' || + (type === '(identifier)' && syntax.hasOwnProperty(value))) { + t = syntax[value] || syntax['(error)']; + +// Mozilla bug workaround. + + if (!t.id) { + t = syntax[type]; + } + } else { + t = syntax[type]; + } + t = Object.create(t); + if (type === '(string)' || type === '(range)') { + if (jx.test(value)) { + warningAt("Script URL.", line, from); + } + } + if (type === '(identifier)') { + t.identifier = true; + if (option.nomen && value.charAt(0) === '_') { + warningAt("Unexpected '_' in '{a}'.", line, from, value); + } + } + t.value = value; + t.line = line; + t.character = character; + t.from = from; +//alert('NEWTOKEN\ntype=' + type + '\nvalue=' + value + '\nfrom=' + t.from + '\ncharacter=' + t.character) + i = t.id; + if (i !== '(endline)') { + prereg = i && + (('(,=:[!&|?{};'.indexOf(i.charAt(i.length - 1)) >= 0) || + i === 'return'); + } + return t; + } + +// Public lex methods + + return { + init: function (source) { + if (typeof source === 'string') { + lines = source. + replace(/\r\n/g, '\n'). + replace(/\r/g, '\n'). + split('\n'); + } else { + lines = source; + } + line = -1; + nextLine(); + from = 0; + }, + + range: function (begin, end) { + var c, value = ''; + from = character; + if (s.charAt(0) !== begin) { + errorAt("Expected '{a}' and instead saw '{b}'.", + line, character, begin, s.charAt(0)); + } + for (;;) { + s = s.slice(1); + character += 1; + c = s.charAt(0); + switch (c) { + case '': + errorAt("Missing '{a}'.", line, character, c); + break; + case end: + s = s.slice(1); + character += 1; + return it('(range)', value); + case xquote: + case '\\': + case '\'': + case '"': + warningAt("Unexpected '{a}'.", line, character, c); + } + value += c; + } + + }, + +// token -- this is called by advance to get the next token. + + token: function () { + var b, c, captures, d, depth, high, i, l, low, q, t; + + function match(x) { + var r = x.exec(s), r1; + if (r) { + l = r[0].length; + r1 = r[1]; + c = r1.charAt(0); + s = s.substr(l); + character += l; + from = character - r1.length; + return r1; + } + } + + function string(x) { + var c, j, r = ''; + + if (jsonmode && x !== '"') { + warningAt("Strings must use doublequote.", + line, character); + } + + if (xquote === x || (xmode === 'scriptstring' && !xquote)) { + return it('(punctuator)', x); + } + + function esc(n) { + var i = parseInt(s.substr(j + 1, n), 16); + j += n; + if (i >= 32 && i <= 126 && + i !== 34 && i !== 92 && i !== 39) { + warningAt("Unnecessary escapement.", line, character); + } + character += n; + c = String.fromCharCode(i); + } + j = 0; + for (;;) { + while (j >= s.length) { + j = 0; + if (xmode !== 'html' || !nextLine()) { + errorAt("Unclosed string.", line, from); + } + } + c = s.charAt(j); + if (c === x) { + character += 1; + s = s.substr(j + 1); + return it('(string)', r, x); + } + if (c < ' ') { +/* +## Why exit on newlines ? + if (c === '\n' || c === '\r') { + break; + } + warningAt("Control character in string: {a}.", + line, character + j, s.slice(0, j)); +*/ + } else if (c === xquote) { + warningAt("Bad HTML string", line, character + j); + } else if (c === '<') { + if (option.safe && xmode === 'html') { + warningAt("ADsafe string violation.", + line, character + j); + } else if (s.charAt(j + 1) === '/' && (xmode || option.safe)) { + warningAt("Expected '<\\/' and instead saw ' 0) { + character += 1; + s = s.slice(i); + break; + } else { + if (!nextLine()) { + return it('(end)', ''); + } + } + } + t = match(rx[xmode] || tx); + if (!t) { + if (xmode === 'html') { + return it('(error)', s.charAt(0)); + } else { + t = ''; + c = ''; + while (s && s < '!') { + s = s.substr(1); + } + if (s) { + errorAt("Unexpected '{a}'.", + line, character, s.substr(0, 1)); + } + } + } else { + + // identifier + + if (c.isAlpha() || c === '_' || c === '$' /* ## unicode identifier grossfix */|| c >= '\u00c0') { + return it('(identifier)', t); + } + + // number + + if (c.isDigit()) { + if (xmode !== 'style' && !isFinite(Number(t))) { + warningAt("Bad number '{a}'.", + line, character, t); + } + if (xmode !== 'styleproperty' && s.substr(0, 1).isAlpha()) { + warningAt("Missing space after '{a}'.", + line, character, t); + } + if (c === '0') { + d = t.substr(1, 1); + if (d.isDigit()) { + if (token.id !== '.' && xmode !== 'styleproperty') { + warningAt("Don't use extra leading zeros '{a}'.", + line, character, t); + } + } else if (jsonmode && (d === 'x' || d === 'X')) { + warningAt("Avoid 0x-. '{a}'.", + line, character, t); + } + } + if (t.substr(t.length - 1) === '.') { + warningAt( + "A trailing decimal point can be confused with a dot '{a}'.", + line, character, t); + } + return it('(number)', t); + } + switch (t) { + + // string + + case '"': + case "'": + return string(t); + // // comment + + case '//': + if (src || (xmode && xmode !== 'script')) { + warningAt("Unexpected comment.", line, character); + } else if (xmode === 'script' && /<\s*\//i.test(s)) { + warningAt("Unexpected <\/ in comment.", line, character); + } else if ((option.safe || xmode === 'script') && ax.test(s)) { + warningAt("Dangerous comment.", line, character); + } + // ## notify of comment token + var v = lines[line].substr(from, s.length) + var c = lines[line].length-1 + if (!s.match(/\n/)) + c++ + if (!logTokenLock) + { + var t = { type : '(comment)', line : line, from : from, value : v, character : c } + t.rawValue = lines[t.line] ? lines[t.line].substr(t.from, t.character-t.from) : '' + logToken(t) + } + s = ''; + token.comment = true; + break; + + // /* comment + + case '/*': + if (src || (xmode && xmode !== 'script' && xmode !== 'style' && xmode !== 'styleproperty')) { + warningAt("Unexpected comment.", line, character); + } + if (option.safe && ax.test(s)) { + warningAt("ADsafe comment violation.", line, character); + } + var commentLineIndex = 0 + var firstCommentPrefix = '/*' + // First line misses '*' in '/*' + for (;;) { + i = s.search(lx); + if (i >= 0) { + // ## notify of comment token + // Last line of comment +// var h = !commentLineIndex ? from : 0 + var v = firstCommentPrefix+s.substr(0, i+2) + if (!logTokenLock) + { + var t = { type : '(comment)', line : line, from : from, value : v, character: from+v.length } + t.rawValue = lines[t.line] ? lines[t.line].substr(t.from, t.character-t.from) : '' + logToken(t) + } + break; + } + else + { + // ## + // All comment lines but the last one go through here + var c = lines[line].substr(from).length + if (commentLineIndex == 0) c += firstCommentPrefix.length + if (!logTokenLock) + { + var t = { type : '(comment)', line : line, from : from, value : firstCommentPrefix + s, character : c+from } + t.rawValue = lines[t.line] ? lines[t.line].substr(t.from, t.character-t.from) : '' + logToken(t) + logToken( { id : '(endline)' } ) + } + from = 0 + } + if (!nextLine()) { + errorAt("Unclosed comment.", line, character); + } else { + if (option.safe && ax.test(s)) { + warningAt("ADsafe comment violation.", line, character); + } + } + commentLineIndex++ + firstCommentPrefix = '' + } + character += i + 2; + if (s.substr(i, 1) === '/') { + errorAt("Nested comment.", line, character); + } + s = s.substr(i + 2); + token.comment = true; + break; + + // /*global /*extern /*members /*jslint */ + + case '/*global': + case '/*extern': + case '/*members': + case '/*member': + case '/*jslint': + case '*/': + return { + value: t, + type: 'special', + line: line, + character: character, + from: from + }; + + case '': + break; + // / + case '/': + if (prereg) { + depth = 0; + captures = 0; + l = 0; + for (;;) { + b = true; + c = s.charAt(l); + l += 1; + switch (c) { + case '': + errorAt("Unclosed regular expression.", line, from); + return; + case '/': + if (depth > 0) { + warningAt("Unescaped '{a}'.", line, from + l, '/'); + } + c = s.substr(0, l - 1); + q = { + g: true, + i: true, + m: true + }; + while (q[s.charAt(l)] === true) { + q[s.charAt(l)] = false; + l += 1; + } + character += l; + s = s.substr(l); + return it('(regexp)', c); + case '\\': + c = s.charAt(l); + if (c < ' ') { + warningAt("Unexpected control character in regular expression.", line, from + l); + } else if (c === '<') { + warningAt("Unexpected escaped character '{a}' in regular expression.", line, from + l, c); + } + l += 1; + break; + case '(': + depth += 1; + b = false; + if (s.charAt(l) === '?') { + l += 1; + switch (s.charAt(l)) { + case ':': + case '=': + case '!': + l += 1; + break; + default: + warningAt("Expected '{a}' and instead saw '{b}'.", line, from + l, ':', s.charAt(l)); + } + } else { + captures += 1; + } + break; + case ')': + if (depth === 0) { + warningAt("Unescaped '{a}'.", line, from + l, ')'); + } else { + depth -= 1; + } + break; + case ' ': + q = 1; + while (s.charAt(l) === ' ') { + l += 1; + q += 1; + } + if (q > 1) { + warningAt("Spaces are hard to count. Use {{a}}.", line, from + l, q); + } + break; + case '[': + if (s.charAt(l) === '^') { + l += 1; + } + q = false; + klass: do { + c = s.charAt(l); + l += 1; + switch (c) { + case '[': + case '^': + warningAt("Unescaped '{a}'.", line, from + l, c); + q = true; + break; + case '-': + if (q) { + q = false; + } else { + warningAt("Unescaped '{a}'.", line, from + l, '-'); + q = true; + } + break; + case ']': + if (!q) { + warningAt("Unescaped '{a}'.", line, from + l - 1, '-'); + } + break klass; + case '\\': + c = s.charAt(l); + if (c < ' ') { + warningAt("Unexpected control character in regular expression.", line, from + l); + } else if (c === '<') { + warningAt("Unexpected escaped character '{a}' in regular expression.", line, from + l, c); + } + l += 1; + q = true; + break; + case '/': + warningAt("Unescaped '{a}'.", line, from + l - 1, '/'); + q = true; + break; + case '<': + if (xmode === 'script') { + c = s.charAt(l); + if (c === '!' || c === '/') { + warningAt("HTML confusion in regular expression '<{a}'.", line, from + l, c); + } + } + q = true; + break; + default: + q = true; + } + } while (c); + break; + case '.': + if (option.regexp) { + warningAt("Unexpected '{a}'.", line, from + l, c); + } + break; + case ']': + case '?': + case '{': + case '}': + case '+': + case '*': + warningAt("Unescaped '{a}'.", line, from + l, c); + break; + case '<': + if (xmode === 'script') { + c = s.charAt(l); + if (c === '!' || c === '/') { + warningAt("HTML confusion in regular expression '<{a}'.", line, from + l, c); + } + } + } + if (b) { + switch (s.charAt(l)) { + case '?': + case '+': + case '*': + l += 1; + if (s.charAt(l) === '?') { + l += 1; + } + break; + case '{': + l += 1; + c = s.charAt(l); + if (c < '0' || c > '9') { + warningAt("Expected a number and instead saw '{a}'.", line, from + l, c); + } + l += 1; + low = +c; + for (;;) { + c = s.charAt(l); + if (c < '0' || c > '9') { + break; + } + l += 1; + low = +c + (low * 10); + } + high = low; + if (c === ',') { + l += 1; + high = Infinity; + c = s.charAt(l); + if (c >= '0' && c <= '9') { + l += 1; + high = +c; + for (;;) { + c = s.charAt(l); + if (c < '0' || c > '9') { + break; + } + l += 1; + high = +c + (high * 10); + } + } + } + if (s.charAt(l) !== '}') { + warningAt("Expected '{a}' and instead saw '{b}'.", line, from + l, '}', c); + } else { + l += 1; + } + if (s.charAt(l) === '?') { + l += 1; + } + if (low > high) { + warningAt("'{a}' should not be greater than '{b}'.", line, from + l, low, high); + } + } + } + } + c = s.substr(0, l - 1); + character += l; + s = s.substr(l); + return it('(regexp)', c); + } + return it('(punctuator)', t); + + // punctuator + + case '#': + if (xmode === 'html' || xmode === 'styleproperty') { + for (;;) { + c = s.charAt(0); + if ((c < '0' || c > '9') && + (c < 'a' || c > 'f') && + (c < 'A' || c > 'F')) { + break; + } + character += 1; + s = s.substr(1); + t += c; + } + if (t.length !== 4 && t.length !== 7) { + warningAt("Bad hex color '{a}'.", line, + from + l, t); + } + return it('(color)', t); + } + return it('(punctuator)', t); + default: + if (xmode === 'outer' && c === '&') { + character += 1; + s = s.substr(1); + for (;;) { + c = s.charAt(0); + character += 1; + s = s.substr(1); + if (c === ';') { + break; + } + if (!((c >= '0' && c <= '9') || + (c >= 'a' && c <= 'z') || + c === '#')) { + errorAt("Bad entity", line, from + l, + character); + } + } + break; + } + return it('(punctuator)', t); + } + } + } + } + }; + }()); + + + function addlabel(t, type) { + + if (t === 'hasOwnProperty') { + error("'hasOwnProperty' is a really bad name."); + } + if (option.safe && funct['(global)']) { + warning('ADsafe global: ' + t + '.', token); + } + +// Define t in the current function in the current scope. +/* + // ## disabled. I like my redefining. + if (funct.hasOwnProperty(t)) { + warning(funct[t] === true ? + "'{a}' was used before it was defined." : + "'{a}' is already defined.", + nexttoken, t); + } +*/ + funct[t] = type; + if (type === 'label') { + scope[t] = funct; + } else if (funct['(global)']) { + global[t] = funct; +/* + // ## commented out + if (implied.hasOwnProperty(t)) { + // This one won't allow + // Define a function Fn1, use global var SomeVar + // define someVar + // call Fn1 + warning("'{a}' was used before it was defined.", nexttoken, t); + delete implied[t]; + } +*/ + } else { + funct['(scope)'][t] = funct; + } + } + + + function doOption() { + var b, obj, filter, o = nexttoken.value, t, v; + switch (o) { + case '*/': + error("Unbegun comment."); + break; + case '/*global': + case '/*extern': + if (option.safe) { + warning("ADsafe restriction."); + } + obj = predefined; + break; + case '/*members': + case '/*member': + o = '/*members'; + if (!membersOnly) { + membersOnly = {}; + } + obj = membersOnly; + break; + case '/*jslint': + if (option.safe) { + warning("ADsafe restriction."); + } + obj = option; + filter = boolOptions; + } + for (;;) { + t = lex.token(); + if (t.id === ',') { + t = lex.token(); + } + while (t.id === '(endline)') { + t = lex.token(); + } + if (t.type === 'special' && t.value === '*/') { + break; + } + if (t.type !== '(string)' && t.type !== '(identifier)' && + o !== '/*members') { + error("Bad option.", t); + } + if (filter) { + if (filter[t.value] !== true && t.value !== 'indent') { + error("Bad option.", t); + } + v = lex.token(); + if (v.id !== ':') { + error("Expected '{a}' and instead saw '{b}'.", + t, ':', t.value); + } + v = lex.token(); + if (t.value === 'indent') { + b = +v.value; + if (typeof b !== 'number' || !isFinite(b) || b <= 0 || + Math.floor(b) !== b) { + error("Expected a small integer and instead saw '{a}'.", + v, v.value); + } + obj.white = true; + } else if (v.value === 'true') { + b = true; + } else if (v.value === 'false') { + b = false; + } else { + error("Expected '{a}' and instead saw '{b}'.", + t, 'true', t.value); + } + } else { + b = true; + } + obj[t.value] = b; + } + if (filter) { + assume(); + } + } + + +// We need a peek function. If it has an argument, it peeks that much farther +// ahead. It is used to distinguish +// for ( var i in ... +// from +// for ( var i = ... + + function peek(p) { + var i = p || 0, j = 0, t; + + while (j <= i) { + t = lookahead[j]; + if (!t) { + t = lookahead[j] = lex.token(); + } + j += 1; + } + return t; + } + + + +// Produce the next token. It looks for programming errors. + + function advance(id, t) { + switch (token.id) { + case '(number)': + if (nexttoken.id === '.') { + warning("A dot following a number can be confused with a decimal point.", token); + } + break; + case '-': + if (nexttoken.id === '-' || nexttoken.id === '--') { + warning("Confusing minusses."); + } + break; + case '+': + if (nexttoken.id === '+' || nexttoken.id === '++') { + warning("Confusing plusses."); + } + break; + } + if (token.type === '(string)' || token.identifier) { + anonname = token.value; + } + + if (id && nexttoken.id !== id) { + if (t) { + if (nexttoken.id === '(end)') { + warning("Unmatched '{a}'.", t, t.id); + } else { + warning("Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.", + nexttoken, id, t.id, t.line + 1, nexttoken.value); + } + } else if (nexttoken.type !== '(identifier)' || + nexttoken.value !== id) { + warning("Expected '{a}' and instead saw '{b}'.", + nexttoken, id, nexttoken.value); + } + } + prevtoken = token; + token = nexttoken; + for (;;) { + nexttoken = lookahead.shift() || lex.token(); + // ## notify of new token + if (!logTokenLock) + { + nexttoken.rawValue = lines[nexttoken.line] ? lines[nexttoken.line].substr(nexttoken.from, nexttoken.character-nexttoken.from) : '' + logToken(nexttoken) + } + if (nexttoken.id === '(end)' || nexttoken.id === '(error)') { + return; + } + if (nexttoken.type === 'special') { + doOption(); + } else { + if (nexttoken.id !== '(endline)') { + break; + } + } + } + if (!option.evil && nexttoken.value === 'eval') { + warning("eval is evil.", nexttoken); + } + } + +// This is the heart of JSLINT, the Pratt parser. In addition to parsing, it +// is looking for ad hoc lint patterns. We add to Pratt's model .fud, which is +// like nud except that it is only used on the first token of a statement. +// Having .fud makes it much easier to define JavaScript. I retained Pratt's +// nomenclature. + +// .nud Null denotation +// .fud First null denotation +// .led Left denotation +// lbp Left binding power +// rbp Right binding power + +// They are key to the parsing method called Top Down Operator Precedence. +/* +// http://javascript.crockford.com/tdop/tdop.html +;; NUD -- NUll left Denotation (op has nothing to its left (prefix)) +;; LED -- LEft Denotation (op has something to left (postfix or infix)) + +;; LBP -- Left Binding Power (the stickiness to the left) +;; RBP -- Right Binding Power (the stickiness to the right) + +*/ + function parse(rbp, initial) { + var left, o; + + // ## Allow return a, b + function maybeParseCommas() + { + if (rbp > 20 || skipCommas) return + while (nexttoken.value == ',') + { + advance(',') + parse(rbp) + } + } + var skipCommas = initial == 'singleExpression' + if (skipCommas) initial = undefined + + // ## notify of expression parsing start + logParseStart(rbp, initial) + if (nexttoken.id === '(end)') { + error("Unexpected early end of program.", token); + } + advance(); + if (option.safe && predefined[token.value] === true && + (nexttoken.id !== '(' && nexttoken.id !== '.')) { + warning('ADsafe violation.', token); + } + if (initial) { + anonname = 'anonymous'; + funct['(verb)'] = token.value; + } + if (initial === true && token.fud) { + left = token.fud(); + } else { + if (token.nud) { + o = token.exps; + left = token.nud(); + } else { + if (nexttoken.type === '(number)' && token.id === '.') { + warning( +"A leading decimal point can be confused with a dot: '.{a}'.", + token, nexttoken.value); + advance(); + // ## + maybeParseCommas() + // ## notify of expression parsing end + logParseEnd(rbp, initial) + return token; + } else { + error("Expected an identifier and instead saw '{a}'.", + token, token.id); + } + } + + while (rbp < nexttoken.lbp) { + // Don't allow [ on a next line as it might start an ObjC call + if (token.line != nexttoken.line && nexttoken.id == '[') break; + + o = nexttoken.exps; + // ## As we don't force lines to end with a semi colon, break if we encounter a reserved word + if (nexttoken.reserved && nexttoken.line != token.line) break + advance(); + if (token.led) { + left = token.led(left); + } else { +// if (token.line == prevtoken.line) + error("Expected an operator and instead saw '{a}'.", + token, token.id); + } + } + // ## .exps is transfered to o, to check if expression can stand on its own : assignment, ++ (postinc), delete, ... + // Disabled because o.release is a valid call in JSCocoa (when autocall is on) +/* + if (initial && !o && !token.exps) { +//## + warning("Expected an assignment or function call and instead saw an expression.", token); + } +*/ + } + + // ## + maybeParseCommas() + + // ## notify of expression parsing end + logParseEnd(rbp, initial) + + + return left; + } + + +// Functions for conformance of style. + + function abut(left, right) { + left = left || token; + right = right || nexttoken; + if (left.line !== right.line || left.character !== right.from) { + warning("Unexpected space after '{a}'.", right, left.value); + } + } + + + function adjacent(left, right) { + left = left || token; + right = right || nexttoken; + if (option.white || xmode === 'styleproperty' || xmode === 'style') { + if (left.character !== right.from && left.line === right.line) { + warning("Unexpected space after '{a}'.", right, left.value); + } + } + } + + function nospace(left, right) { + left = left || token; + right = right || nexttoken; + if (option.white && !left.comment) { + if (left.line === right.line) { + adjacent(left, right); + } + } + } + + + function nonadjacent(left, right) { + if (option.white) { + left = left || token; + right = right || nexttoken; + if (left.character === right.from) { + warning("Missing space after '{a}'.", + nexttoken, left.value); + } + } + } + + function nobreaknonadjacent(left, right) { + left = left || token; + right = right || nexttoken; + if (!option.laxbreak && left.line !== right.line) { + warning("Bad line breaking before '{a}'.", right, right.id); + } else if (option.white) { + left = left || token; + right = right || nexttoken; + if (left.character === right.from) { + warning("Missing space after '{a}'.", + nexttoken, left.value); + } + } + } + + function indentation(bias) { + var i; + if (option.white && nexttoken.id !== '(end)') { + i = indent + (bias || 0); + if (nexttoken.from !== i) { + warning("Expected '{a}' to have an indentation of {b} instead of {c}.", + nexttoken, nexttoken.value, i, nexttoken.from); + } + } + } + + function nolinebreak(t) { + if (t.line !== nexttoken.line) { + warning("Line breaking error '{a}'.", t, t.value); + } + } + + + function comma() { + if (token.line !== nexttoken.line) { + if (!option.laxbreak) { + warning("Bad line breaking before '{a}'.", token, nexttoken.id); + } + } else if (token.character !== nexttoken.from && option.white) { + warning("Unexpected space after '{a}'.", nexttoken, token.value); + } + advance(','); + nonadjacent(token, nexttoken); + } + + +// Functional constructors for making the symbols that will be inherited by +// tokens. + + function symbol(s, p) { + var x = syntax[s]; + if (!x || typeof x !== 'object') { + syntax[s] = x = { + id: s, + lbp: p, + value: s + }; + } + return x; + } + + + function delim(s) { + return symbol(s, 0); + } + + + function stmt(s, f) { + var x = delim(s); + x.identifier = x.reserved = true; + x.fud = f; + return x; + } + + + function blockstmt(s, f) { + var x = stmt(s, f); + x.block = true; + return x; + } + + + function reserveName(x) { + var c = x.id.charAt(0); + if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { + x.identifier = x.reserved = true; + } + return x; + } + + + function prefix(s, f) { + var x = symbol(s, 150); + reserveName(x); + x.nud = (typeof f === 'function') ? f : function () { + if (option.plusplus && (this.id === '++' || this.id === '--')) { + warning("Unexpected use of '{a}'.", this, this.id); + } + this.right = parse(150); + this.arity = 'unary'; + return this; + }; + return x; + } + + + function type(s, f) { + var x = delim(s); + x.type = s; + x.nud = f; + return x; + } + + + function reserve(s, f) { + var x = type(s, f); + x.identifier = x.reserved = true; + return x; + } + + + function reservevar(s, v) { + return reserve(s, function () { + if (this.id === 'this') { + if (option.safe) { + warning("ADsafe violation.", this); + } + } + return this; + }); + } + + + function infix(s, f, p, w) { + var x = symbol(s, p); + reserveName(x); + x.led = function (left) { + if (!w) { + nobreaknonadjacent(prevtoken, token); + nonadjacent(token, nexttoken); + } + if (typeof f === 'function') { + return f(left, this); + } else { + this.left = left; + this.right = parse(p); + return this; + } + }; + return x; + } + + + function relation(s, f) { + var x = symbol(s, 100); + x.led = function (left) { + nobreaknonadjacent(prevtoken, token); + nonadjacent(token, nexttoken); + var right = parse(100); + if ((left && left.id === 'NaN') || (right && right.id === 'NaN')) { + warning("Use the isNaN function to compare with NaN.", this); + } else if (f) { + f.apply(this, [left, right]); + } + this.left = left; + this.right = right; + return this; + }; + return x; + } + + + function isPoorRelation(node) { + return (node.type === '(number)' && !+node.value) || + (node.type === '(string)' && !node.value) || + node.type === 'true' || + node.type === 'false' || + node.type === 'undefined' || + node.type === 'null'; + } + + + function assignop(s, f) { + symbol(s, 20).exps = true; + return infix(s, function (left, that) { + var l; + that.left = left; + if (option.safe) { + l = left; + do { + if (predefined[l.value] === true) { + warning('ADsafe violation.', l); + } + l = l.left; + } while (l); + } + if (left) { + if (left.id === '.' || left.id === '[') { + if (left.left.value === 'arguments') { + warning('Bad assignment.', that); + } + that.right = parse(19); + return that; + } else if (left.identifier && !left.reserved) { + if (funct[left.value] === 'exception') { + warning("Do not assign to the exception parameter.", left); + } + that.right = parse(19); + return that; + } + if (left === syntax['function']) { + warning( +"Expected an identifier in an assignment and instead saw a function invocation.", + token); + } + } + error("Bad assignment.", that); + }, 20); + } + + function bitwise(s, f, p) { + var x = symbol(s, p); + reserveName(x); + x.led = (typeof f === 'function') ? f : function (left) { + if (option.bitwise) { + warning("Unexpected use of '{a}'.", this, this.id); + } + this.left = left; + this.right = parse(p); + return this; + }; + return x; + } + + function bitwiseassignop(s) { + symbol(s, 20).exps = true; + return infix(s, function (left, that) { + if (option.bitwise) { + warning("Unexpected use of '{a}'.", that, that.id); + } + nonadjacent(prevtoken, token); + nonadjacent(token, nexttoken); + if (left) { + if (left.id === '.' || left.id === '[' || + (left.identifier && !left.reserved)) { + parse(19); + return left; + } + if (left === syntax['function']) { + warning( +"Expected an identifier in an assignment, and instead saw a function invocation.", + token); + } + } + error("Bad assignment.", that); + }, 20); + } + + + function suffix(s, f) { + var x = symbol(s, 150); + x.led = function (left) { + if (option.plusplus) { + warning("Unexpected use of '{a}'.", this, this.id); + } + this.left = left; + return this; + }; + return x; + } + + + function optionalidentifier() { + if (nexttoken.reserved && nexttoken.value !== 'arguments') { + warning("Expected an identifier and instead saw '{a}' (a reserved word).", + nexttoken, nexttoken.id); + } + if (nexttoken.identifier) { + advance(); + return token.value; + } + } + + + function identifier() { + var i = optionalidentifier(); + if (i) { + return i; + } + if (token.id === 'function' && nexttoken.id === '(') { + warning("Missing name in function statement."); + } else { + error("Expected an identifier and instead saw '{a}'.", + nexttoken, nexttoken.value); + } + } + + function reachable(s) { + var i = 0, t; + if (nexttoken.id !== ';' || noreach) { + return; + } + for (;;) { + t = peek(i); + if (t.reach) { + return; + } + if (t.id !== '(endline)') { + if (t.id === 'function') { + warning( +"Inner functions should be listed at the top of the outer function.", t); + break; + } + warning("Unreachable '{a}' after '{b}'.", t, t.value, s); + break; + } + i += 1; + } + } + + + function statement(noindent) { + var i = indent, r, s = scope, t = nexttoken; + +// We don't like the empty statement. + + if (t.id === ';') { + warning("Unnecessary semicolon.", t); + advance(';'); + return; + } + +// Is this a labelled statement? + + if (t.identifier && !t.reserved && peek().id === ':') { + advance(); + advance(':'); + scope = Object.create(s); + addlabel(t.value, 'label'); + if (!nexttoken.labelled) { + warning("Label '{a}' on {b} statement.", + nexttoken, t.value, nexttoken.value); + } + if (jx.test(t.value + ':')) { + warning("Label '{a}' looks like a javascript url.", + t, t.value); + } + nexttoken.label = t.value; + t = nexttoken; + } + +// Parse the statement. + + if (!noindent) { + indentation(); + } + r = parse(0, true); + +// Look for the final semicolon. + if (!t.block) { + // ## Only warn about missing semicolons when next token is on same line and not a closing brace (like in one line closures) + if (nexttoken.id !== ';') { + if (token.line == nexttoken.line && nexttoken.id != '}') + warningAt("Missing semicolon.", token.line, token.from + token.value.length); +//## +// warningAt("Missing semicolon.", token.line, +// token.from + token.value.length); + } else { + abut(token, nexttoken); + advance(';'); + nonadjacent(token, nexttoken); + } + } + +// Restore the indentation. + + indent = i; + scope = s; + return r; + } + + function use_strict() { + if (nexttoken.type === '(string)' && + /^use +strict(?:,.+)?$/.test(nexttoken.value)) { + advance(); + advance(';'); + return true; + } else { + return false; + } + } + + + function statements(begin) { + var a = [], f, p; + if (begin && !use_strict() && option.strict) { + warning('Missing "use strict" statement.', nexttoken); + } + if (option.adsafe) { + switch (begin) { + case 'script': + if (!adsafe_may) { + if (nexttoken.value !== 'ADSAFE' || + peek(0).id !== '.' || + (peek(1).value !== 'id' && + peek(1).value !== 'go')) { + error('ADsafe violation: Missing ADSAFE.id or ADSAFE.go.', + nexttoken); + } + } + if (nexttoken.value === 'ADSAFE' && + peek(0).id === '.' && + peek(1).value === 'id') { + if (adsafe_may) { + error('ADsafe violation.', nexttoken); + } + advance('ADSAFE'); + advance('.'); + advance('id'); + advance('('); + if (nexttoken.value !== adsafe_id) { + error('ADsafe violation: id does not match.', nexttoken); + } + advance('(string)'); + advance(')'); + advance(';'); + adsafe_may = true; + } + break; + case 'lib': + if (nexttoken.value === 'ADSAFE') { + advance('ADSAFE'); + advance('.'); + advance('lib'); + advance('('); + advance('(string)'); + comma(); + f = parse(0); + if (f.id !== 'function') { + error('The second argument to lib must be a function.', f); + } + p = f.funct['(params)']; + if (p && p !== 'lib') { + error("Expected '{a}' and instead saw '{b}'.", + f, 'lib', p); + } + advance(')'); + advance(';'); + return a; + } else { + error("ADsafe lib violation."); + } + } + } + while (!nexttoken.reach && nexttoken.id !== '(end)') { + if (nexttoken.id === ';') { + warning("Unnecessary semicolon."); + advance(';'); + } else { + var s = statement() +// logStatement(s) + a.push(s); + } + } + return a; + } + + + function block(f) { + var a, b = inblock, s = scope, t; + inblock = f; + if (f) { + scope = Object.create(scope); + } + nonadjacent(token, nexttoken); + t = nexttoken; + if (nexttoken.id === '{') { + advance('{'); + if (nexttoken.id !== '}' || token.line !== nexttoken.line) { + indent += option.indent; + if (!f && nexttoken.from === indent + option.indent) { + indent += option.indent; + } + if (!f) { + use_strict(); + } + a = statements(); + indent -= option.indent; + indentation(); + } + advance('}', t); + } else { +//## +// warning("Expected '{a}' and instead saw '{b}'.", +// nexttoken, '{', nexttoken.value); + noreach = true; + a = [statement()]; + noreach = false; + } + funct['(verb)'] = null; + scope = s; + inblock = b; + return a; + } + + +// An identity function, used by string and number tokens. + + function idValue() { + return this; + } + + + function countMember(m) { + // ## Causing errors while linting jslint. Disabled for now. + + if (0 && membersOnly && membersOnly[m] !== true) { + warning("Unexpected /*member '{a}'.", nexttoken, m); + } + if (typeof member[m] === 'number') { + member[m] += 1; + } else { + member[m] = 1; + } + } + + function note_implied(token) { + var name = token.value, line = token.line + 1, a = implied[name]; + if (typeof a === 'function') { + a = false; + } + if (!a) { + a = [line]; + implied[name] = a; + } else if (a[a.length - 1] !== line) { + a.push(line); + } + } + +// CSS parsing. +/* + + function cssName() { + if (nexttoken.identifier) { + advance(); + return true; + } + } + + function cssNumber() { + if (nexttoken.id === '-') { + advance('-'); + advance('(number)'); + } + if (nexttoken.type === '(number)') { + advance(); + return true; + } + } + + function cssString() { + if (nexttoken.type === '(string)') { + advance(); + return true; + } + } + + function cssColor() { + var i, number; + if (nexttoken.identifier) { + if (nexttoken.value === 'rgb') { + advance(); + advance('('); + for (i = 0; i < 3; i += 1) { + number = nexttoken.value; + if (nexttoken.type !== '(number)' || number < 0) { + warning("Expected a positive number and instead saw '{a}'", + nexttoken, number); + advance(); + } else { + advance(); + if (nexttoken.id === '%') { + advance('%'); + if (number > 100) { + warning("Expected a percentage and instead saw '{a}'", + token, number); + } + } else { + if (number > 255) { + warning("Expected a small number and instead saw '{a}'", + token, number); + } + } + } + } + advance(')'); + return true; + } else if (cssColorData[nexttoken.value] === true) { + advance(); + return true; + } + } else if (nexttoken.type === '(color)') { + advance(); + return true; + } + return false; + } + + function cssLength() { + if (nexttoken.id === '-') { + advance('-'); + adjacent(); + } + if (nexttoken.type === '(number)') { + advance(); + if (nexttoken.type !== '(string)' && + cssLengthData[nexttoken.value] === true) { + adjacent(); + advance(); + } else if (+token.value !== 0) { + warning("Expected a linear unit and instead saw '{a}'.", + nexttoken, nexttoken.value); + } + return true; + } + return false; + } + + function cssLineHeight() { + if (nexttoken.id === '-') { + advance('-'); + adjacent(); + } + if (nexttoken.type === '(number)') { + advance(); + if (nexttoken.type !== '(string)' && + cssLengthData[nexttoken.value] === true) { + adjacent(); + advance(); + } + return true; + } + return false; + } + + function cssWidth() { + if (nexttoken.identifier) { + switch (nexttoken.value) { + case 'thin': + case 'medium': + case 'thick': + advance(); + return true; + } + } else { + return cssLength(); + } + } + + function cssMargin() { + if (nexttoken.identifier) { + if (nexttoken.value === 'auto') { + advance(); + return true; + } + } else { + return cssLength(); + } + } + + function cssAttr() { + if (nexttoken.identifier && nexttoken.value === 'attr') { + advance(); + advance('('); + if (!nexttoken.identifier) { + warning("Expected a name and instead saw '{a}'.", + nexttoken, nexttoken.value); + } + advance(); + advance(')'); + return true; + } + return false; + } + + function cssCommaList() { + while (nexttoken.id !== ';') { + if (!cssName() && !cssString()) { + warning("Expected a name and instead saw '{a}'.", + nexttoken, nexttoken.value); + } + if (nexttoken.id !== ',') { + return true; + } + comma(); + } + } + + function cssCounter() { + if (nexttoken.identifier && nexttoken.value === 'counter') { + advance(); + advance('('); + if (!nexttoken.identifier) { + } + advance(); + if (nexttoken.id === ',') { + comma(); + if (nexttoken.type !== '(string)') { + warning("Expected a string and instead saw '{a}'.", + nexttoken, nexttoken.value); + } + advance(); + } + advance(')'); + return true; + } + if (nexttoken.identifier && nexttoken.value === 'counters') { + advance(); + advance('('); + if (!nexttoken.identifier) { + warning("Expected a name and instead saw '{a}'.", + nexttoken, nexttoken.value); + } + advance(); + if (nexttoken.id === ',') { + comma(); + if (nexttoken.type !== '(string)') { + warning("Expected a string and instead saw '{a}'.", + nexttoken, nexttoken.value); + } + advance(); + } + if (nexttoken.id === ',') { + comma(); + if (nexttoken.type !== '(string)') { + warning("Expected a string and instead saw '{a}'.", + nexttoken, nexttoken.value); + } + advance(); + } + advance(')'); + return true; + } + return false; + } + + + function cssShape() { + var i; + if (nexttoken.identifier && nexttoken.value === 'rect') { + advance(); + advance('('); + for (i = 0; i < 4; i += 1) { + if (!cssLength()) { + warning("Expected a number and instead saw '{a}'.", + nexttoken, nexttoken.value); + break; + } + } + advance(')'); + return true; + } + return false; + } + + function cssUrl() { + var url; + if (nexttoken.identifier && nexttoken.value === 'url') { + nexttoken = lex.range('(', ')'); + url = nexttoken.value; + advance(); + if (option.safe && ux.test(url)) { + error("ADsafe URL violation."); + } + urls.push(url); + return true; + } + return false; + } + + cssAny = [cssUrl, function () { + for (;;) { + if (nexttoken.identifier) { + switch (nexttoken.value.toLowerCase()) { + case 'url': + cssUrl(); + break; + case 'expression': + warning("Unexpected expression '{a}'.", + nexttoken, nexttoken.value); + advance(); + break; + default: + advance(); + } + } else { + if (nexttoken.id === ';' || nexttoken.id === '!' || + nexttoken.id === '(end)' || nexttoken.id === '}') { + return true; + } + advance(); + } + } + }]; + + cssBorderStyle = [ + 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'ridge', + 'inset', 'outset' + ]; + + cssAttributeData = { + background: [ + true, 'background-attachment', 'background-color', + 'background-image', 'background-position', 'background-repeat' + ], + 'background-attachment': ['scroll', 'fixed'], + 'background-color': ['transparent', cssColor], + 'background-image': ['none', cssUrl], + 'background-position': [ + 2, [cssLength, 'top', 'bottom', 'left', 'right', 'center'] + ], + 'background-repeat': [ + 'repeat', 'repeat-x', 'repeat-y', 'no-repeat' + ], + 'border': [true, 'border-color', 'border-style', 'border-width'], + 'border-bottom': [true, 'border-bottom-color', 'border-bottom-style', 'border-bottom-width'], + 'border-bottom-color': cssColor, + 'border-bottom-style': cssBorderStyle, + 'border-bottom-width': cssWidth, + 'border-collapse': ['collapse', 'separate'], + 'border-color': ['transparent', 4, cssColor], + 'border-left': [ + true, 'border-left-color', 'border-left-style', 'border-left-width' + ], + 'border-left-color': cssColor, + 'border-left-style': cssBorderStyle, + 'border-left-width': cssWidth, + 'border-right': [ + true, 'border-right-color', 'border-right-style', 'border-right-width' + ], + 'border-right-color': cssColor, + 'border-right-style': cssBorderStyle, + 'border-right-width': cssWidth, + 'border-spacing': [2, cssLength], + 'border-style': [4, cssBorderStyle], + 'border-top': [ + true, 'border-top-color', 'border-top-style', 'border-top-width' + ], + 'border-top-color': cssColor, + 'border-top-style': cssBorderStyle, + 'border-top-width': cssWidth, + 'border-width': [4, cssWidth], + bottom: [cssLength, 'auto'], + 'caption-side' : ['bottom', 'left', 'right', 'top'], + clear: ['both', 'left', 'none', 'right'], + clip: [cssShape, 'auto'], + color: cssColor, + content: [ + 'open-quote', 'close-quote', 'no-open-quote', 'no-close-quote', + cssString, cssUrl, cssCounter, cssAttr + ], + 'counter-increment': [ + cssName, 'none' + ], + 'counter-reset': [ + cssName, 'none' + ], + cursor: [ + cssUrl, 'auto', 'crosshair', 'default', 'e-resize', 'help', 'move', + 'n-resize', 'ne-resize', 'nw-resize', 'pointer', 's-resize', + 'se-resize', 'sw-resize', 'w-resize', 'text', 'wait' + ], + direction: ['ltr', 'rtl'], + display: [ + 'block', 'compact', 'inline', 'inline-block', 'inline-table', + 'list-item', 'marker', 'none', 'run-in', 'table', 'table-caption', + 'table-cell', 'table-column', 'table-column-group', 'table-footer-group', + 'table-header-group', 'table-row', 'table-row-group' + ], + 'empty-cells': ['show', 'hide'], + 'float': ['left', 'none', 'right'], + font: [ + 'caption', 'icon', 'menu', 'message-box', 'small-caption', 'status-bar', + true, 'font-size', 'font-style', 'font-weight', 'font-family' + ], + 'font-family': cssCommaList, + 'font-size': [ + 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', + 'xx-large', 'larger', 'smaller', cssLength + ], + 'font-size-adjust': ['none', cssNumber], + 'font-stretch': [ + 'normal', 'wider', 'narrower', 'ultra-condensed', + 'extra-condensed', 'condensed', 'semi-condensed', + 'semi-expanded', 'expanded', 'extra-expanded' + ], + 'font-style': [ + 'normal', 'italic', 'oblique' + ], + 'font-variant': [ + 'normal', 'small-caps' + ], + 'font-weight': [ + 'normal', 'bold', 'bolder', 'lighter', cssNumber + ], + height: [cssLength, 'auto'], + left: [cssLength, 'auto'], + 'letter-spacing': ['normal', cssLength], + 'line-height': ['normal', cssLineHeight], + 'list-style': [ + true, 'list-style-image', 'list-style-position', 'list-style-type' + ], + 'list-style-image': ['none', cssUrl], + 'list-style-position': ['inside', 'outside'], + 'list-style-type': [ + 'circle', 'disc', 'square', 'decimal', 'decimal-leading-zero', + 'lower-roman', 'upper-roman', 'lower-greek', 'lower-alpha', + 'lower-latin', 'upper-alpha', 'upper-latin', 'hebrew', 'katakana', + 'hiragana-iroha', 'katakana-oroha', 'none' + ], + margin: [4, cssMargin], + 'margin-bottom': cssMargin, + 'margin-left': cssMargin, + 'margin-right': cssMargin, + 'margin-top': cssMargin, + 'marker-offset': [cssLength, 'auto'], + 'max-height': [cssLength, 'none'], + 'max-width': [cssLength, 'none'], + 'min-height': cssLength, + 'min-width': cssLength, + opacity: cssNumber, + outline: [true, 'outline-color', 'outline-style', 'outline-width'], + 'outline-color': ['invert', cssColor], + 'outline-style': [ + 'dashed', 'dotted', 'double', 'groove', 'inset', 'none', + 'outset', 'ridge', 'solid' + ], + 'outline-width': cssWidth, + overflow: ['auto', 'hidden', 'scroll', 'visible'], + padding: [4, cssLength], + 'padding-bottom': cssLength, + 'padding-left': cssLength, + 'padding-right': cssLength, + 'padding-top': cssLength, + position: ['absolute', 'fixed', 'relative', 'static'], + quotes: [8, cssString], + right: [cssLength, 'auto'], + 'table-layout': ['auto', 'fixed'], + 'text-align': ['center', 'justify', 'left', 'right'], + 'text-decoration': ['none', 'underline', 'overline', 'line-through', 'blink'], + 'text-indent': cssLength, + 'text-shadow': ['none', 4, [cssColor, cssLength]], + 'text-transform': ['capitalize', 'uppercase', 'lowercase', 'none'], + top: [cssLength, 'auto'], + 'unicode-bidi': ['normal', 'embed', 'bidi-override'], + 'vertical-align': [ + 'baseline', 'bottom', 'sub', 'super', 'top', 'text-top', 'middle', + 'text-bottom', cssLength + ], + visibility: ['visible', 'hidden', 'collapse'], + 'white-space': ['normal', 'pre', 'nowrap'], + width: [cssLength, 'auto'], + 'word-spacing': ['normal', cssLength], + 'z-index': ['auto', cssNumber] + }; + + function styleAttribute() { + var v; + while (nexttoken.id === '*' || nexttoken.id === '#' || nexttoken.value === '_') { + if (!option.css) { + warning("Unexpected '{a}'.", nexttoken, nexttoken.value); + } + advance(); + } + if (nexttoken.id === '-') { + if (!option.css) { + warning("Unexpected '{a}'.", nexttoken, nexttoken.value); + } + advance('-'); + if (!nexttoken.identifier) { + warning("Expected a non-standard style attribute and instead saw '{a}'.", + nexttoken, nexttoken.value); + } + advance(); + return cssAny; + } else { + if (!nexttoken.identifier) { + warning("Excepted a style attribute, and instead saw '{a}'.", + nexttoken, nexttoken.value); + } else { + if (cssAttributeData.hasOwnProperty(nexttoken.value)) { + v = cssAttributeData[nexttoken.value]; + } else { + v = cssAny; + if (!option.css) { + warning("Unrecognized style attribute '{a}'.", + nexttoken, nexttoken.value); + } + } + } + advance(); + return v; + } + } + + function styleValue(v) { + var i = 0, + n, + once, + match, + round, + start = 0, + vi; + switch (typeof v) { + case 'function': + return v(); + case 'string': + if (nexttoken.identifier && nexttoken.value === v) { + advance(); + return true; + } + return false; + } + for (;;) { + if (i >= v.length) { + return false; + } + vi = v[i]; + i += 1; + if (vi === true) { + break; + } else if (typeof vi === 'number') { + n = vi; + vi = v[i]; + i += 1; + } else { + n = 1; + } + match = false; + while (n > 0) { + if (styleValue(vi)) { + match = true; + n -= 1; + } else { + break; + } + } + if (match) { + return true; + } + } + start = i; + once = []; + for (;;) { + round = false; + for (i = start; i < v.length; i += 1) { + if (!once[i]) { + if (styleValue(cssAttributeData[v[i]])) { + match = true; + round = true; + once[i] = true; + break; + } + } + } + if (!round) { + return match; + } + } + } + + function substyle() { + var v; + for (;;) { + if (nexttoken.id === '}' || nexttoken.id === '(end)' || + xquote && nexttoken.id === xquote) { + return; + } + while (nexttoken.id === ';') { + warning("Misplaced ';'."); + advance(';'); + } + v = styleAttribute(); + advance(':'); + if (nexttoken.identifier && nexttoken.value === 'inherit') { + advance(); + } else { + styleValue(v); + } + while (nexttoken.id !== ';' && nexttoken.id !== '!' && + nexttoken.id !== '}' && nexttoken.id !== '(end)' && + nexttoken.id !== xquote) { + warning("Unexpected token '{a}'.", nexttoken, nexttoken.value); + advance(); + } + if (nexttoken.id === '!') { + advance('!'); + adjacent(); + if (nexttoken.identifier && nexttoken.value === 'important') { + advance(); + } else { + warning("Expected '{a}' and instead saw '{b}'.", + nexttoken, 'important', nexttoken.value); + } + } + if (nexttoken.id === '}' || nexttoken.id === xquote) { + warning("Missing '{a}'.", nexttoken, ';'); + } else { + advance(';'); + } + } + } + + function stylePattern() { + var name; + if (nexttoken.id === '{') { + warning("Expected a style pattern, and instead saw '{a}'.", nexttoken, + nexttoken.id); + } else if (nexttoken.id === '@') { + advance('@'); + name = nexttoken.value; + if (nexttoken.identifier && atrule[name] === true) { + advance(); + return name; + } + warning("Expected an at-rule, and instead saw @{a}.", nexttoken, name); + } + for (;;) { + if (nexttoken.identifier) { + if (!htmltag.hasOwnProperty(nexttoken.value)) { + warning("Expected a tagName, and instead saw {a}.", + nexttoken, nexttoken.value); + } + advance(); + } else { + switch (nexttoken.id) { + case '>': + case '+': + advance(); + if (!nexttoken.identifier || + !htmltag.hasOwnProperty(nexttoken.value)) { + warning("Expected a tagName, and instead saw {a}.", + nexttoken, nexttoken.value); + } + advance(); + break; + case ':': + advance(':'); + if (pseudorule[nexttoken.value] !== true) { + warning("Expected a pseudo, and instead saw :{a}.", + nexttoken, nexttoken.value); + } + advance(); + if (nexttoken.value === 'lang') { + advance('('); + if (!nexttoken.identifier) { + warning("Expected a lang code, and instead saw :{a}.", + nexttoken, nexttoken.value); + } + advance(')'); + } + break; + case '#': + advance('#'); + if (!nexttoken.identifier) { + warning("Expected an id, and instead saw #{a}.", + nexttoken, nexttoken.value); + } + advance(); + break; + case '*': + advance('*'); + break; + case '.': + advance('.'); + if (!nexttoken.identifier) { + warning("Expected a class, and instead saw #.{a}.", + nexttoken, nexttoken.value); + } + advance(); + break; + case '[': + advance('['); + if (!nexttoken.identifier) { + warning("Expected an attribute, and instead saw [{a}].", + nexttoken, nexttoken.value); + } + advance(); + if (nexttoken.id === '=' || nexttoken.id === '~=' || + nexttoken.id === '|=') { + advance(); + if (nexttoken.type !== '(string)') { + warning("Expected a string, and instead saw {a}.", + nexttoken, nexttoken.value); + } + advance(); + } + advance(']'); + break; + default: + error("Expected a CSS selector, and instead saw {a}.", + nexttoken, nexttoken.value); + } + } + if (nexttoken.id === ' fragments and .js files.", token); + } + if (option.fragment) { + if (n !== 'div') { + error("ADsafe violation: Wrap the widget in a div.", token); + } + } else { + error("Use the fragment option.", token); + } + } + option.browser = true; + assume(); + } + + function doAttribute(n, a, v) { + var u, x; + if (a === 'id') { + u = typeof v === 'string' ? v.toUpperCase() : ''; + if (ids[u] === true) { + warning("Duplicate id='{a}'.", nexttoken, v); + } + if (option.adsafe) { + if (adsafe_id) { + if (v.slice(0, adsafe_id.length) !== adsafe_id) { + warning("ADsafe violation: An id must have a '{a}' prefix", + nexttoken, adsafe_id); + } else if (!/^[A-Z]+_[A-Z]+$/.test(v)) { + warning("ADSAFE violation: bad id."); + } + } else { + adsafe_id = v; + if (!/^[A-Z]+_$/.test(v)) { + warning("ADSAFE violation: bad id."); + } + } + } + x = v.search(dx); + if (x >= 0) { + warning("Unexpected character '{a}' in {b}.", token, v.charAt(x), a); + } + ids[u] = true; + } else if (a === 'class' || a === 'type' || a === 'name') { + x = v.search(qx); + if (x >= 0) { + warning("Unexpected character '{a}' in {b}.", token, v.charAt(x), a); + } + ids[u] = true; + } else if (a === 'href' || a === 'background' || + a === 'content' || a === 'data' || + a.indexOf('src') >= 0 || a.indexOf('url') >= 0) { + if (option.safe && ux.test(v)) { + error("ADsafe URL violation."); + } + urls.push(v); + } else if (a === 'for') { + if (option.adsafe) { + if (adsafe_id) { + if (v.slice(0, adsafe_id.length) !== adsafe_id) { + warning("ADsafe violation: An id must have a '{a}' prefix", + nexttoken, adsafe_id); + } else if (!/^[A-Z]+_[A-Z]+$/.test(v)) { + warning("ADSAFE violation: bad id."); + } + } else { + warning("ADSAFE violation: bad id."); + } + } + } else if (a === 'name') { + if (option.adsafe && v.indexOf('_') >= 0) { + warning("ADsafe name violation."); + } + } + } + + function doTag(n, a) { + var i, t = htmltag[n], x; + src = false; + if (!t) { + error("Unrecognized tag '<{a}>'.", + nexttoken, + n === n.toLowerCase() ? n : + n + ' (capitalization error)'); + } + if (stack.length > 0) { + if (n === 'html') { + error("Too many tags.", token); + } + x = t.parent; + if (x) { + if (x.indexOf(' ' + stack[stack.length - 1].name + ' ') < 0) { + error("A '<{a}>' must be within '<{b}>'.", + token, n, x); + } + } else if (!option.adsafe && !option.fragment) { + i = stack.length; + do { + if (i <= 0) { + error("A '<{a}>' must be within '<{b}>'.", + token, n, 'body'); + } + i -= 1; + } while (stack[i].name !== 'body'); + } + } + switch (n) { + case 'div': + if (option.adsafe && stack.length === 1 && !adsafe_id) { + warning("ADSAFE violation: missing ID_."); + } + break; + case 'script': + xmode = 'script'; + advance('>'); + indent = nexttoken.from; + if (a.lang) { + warning("lang is deprecated.", token); + } + if (option.adsafe && stack.length !== 1) { + warning("ADsafe script placement violation.", token); + } + if (a.src) { + if (option.adsafe && (!adsafe_may || !approved[a.src])) { + warning("ADsafe unapproved script source.", token); + } + if (a.type) { + warning("type is unnecessary.", token); + } + } else { + if (adsafe_went) { + error("ADsafe script violation.", token); + } + statements('script'); + } + xmode = 'html'; + advance(''); + styles(); + xmode = 'html'; + advance(''; + } + + function html() { + var a, attributes, e, n, q, t, v, w = option.white, wmode; + xmode = 'html'; + xquote = ''; + stack = null; + for (;;) { + switch (nexttoken.value) { + case '<': + xmode = 'html'; + advance('<'); + attributes = {}; + t = nexttoken; + if (!t.identifier) { + warning("Bad identifier {a}.", t, t.value); + } + n = t.value; + if (option.cap) { + n = n.toLowerCase(); + } + t.name = n; + advance(); + if (!stack) { + stack = []; + doBegin(n); + } + v = htmltag[n]; + if (typeof v !== 'object') { + error("Unrecognized tag '<{a}>'.", t, n); + } + e = v.empty; + t.type = n; + for (;;) { + if (nexttoken.id === '/') { + advance('/'); + if (nexttoken.id !== '>') { + warning("Expected '{a}' and instead saw '{b}'.", + nexttoken, '>', nexttoken.value); + } + break; + } + if (nexttoken.id && nexttoken.id.substr(0, 1) === '>') { + break; + } + if (!nexttoken.identifier) { + if (nexttoken.id === '(end)' || nexttoken.id === '(error)') { + error("Missing '>'.", nexttoken); + } + warning("Bad identifier."); + } + option.white = true; + nonadjacent(token, nexttoken); + a = nexttoken.value; + option.white = w; + advance(); + if (!option.cap && a !== a.toLowerCase()) { + warning("Attribute '{a}' not all lower case.", nexttoken, a); + } + a = a.toLowerCase(); + xquote = ''; + if (attributes.hasOwnProperty(a)) { + warning("Attribute '{a}' repeated.", nexttoken, a); + } + if (a.slice(0, 2) === 'on') { + if (!option.on) { + warning("Avoid HTML event handlers."); + } + xmode = 'scriptstring'; + advance('='); + q = nexttoken.id; + if (q !== '"' && q !== "'") { + error("Missing quote."); + } + xquote = q; + wmode = option.white; + option.white = false; + advance(q); + statements('on'); + option.white = wmode; + if (nexttoken.id !== q) { + error("Missing close quote on script attribute."); + } + xmode = 'html'; + xquote = ''; + advance(q); + v = false; + } else if (a === 'style') { + xmode = 'scriptstring'; + advance('='); + q = nexttoken.id; + if (q !== '"' && q !== "'") { + error("Missing quote."); + } + xmode = 'styleproperty'; + xquote = q; + advance(q); + substyle(); + xmode = 'html'; + xquote = ''; + advance(q); + v = false; + } else { + if (nexttoken.id === '=') { + advance('='); + v = nexttoken.value; + if (!nexttoken.identifier && + nexttoken.id !== '"' && + nexttoken.id !== '\'' && + nexttoken.type !== '(string)' && + nexttoken.type !== '(number)' && + nexttoken.type !== '(color)') { + warning("Expected an attribute value and instead saw '{a}'.", token, a); + } + advance(); + } else { + v = true; + } + } + attributes[a] = v; + doAttribute(n, a, v); + } + doTag(n, attributes); + if (!e) { + stack.push(t); + } + xmode = 'outer'; + advance('>'); + break; + case '') { + error("Missing '{a}'.", nexttoken, '>'); + } + xmode = 'outer'; + advance('>'); + break; + case '' || nexttoken.id === '(end)') { + break; + } + if (nexttoken.id === '--') { + warning("Unexpected --."); + } + } + xmode = 'outer'; + advance('>'); + break; + case ''."); + } + if (nexttoken.id === ''); + break; + case '(end)': + return; + default: + if (nexttoken.id === '(end)') { + error("Missing '{a}'.", nexttoken, + ''); + } else { + advance(); + } + } + if (stack && stack.length === 0 && (option.adsafe || + !option.fragment || nexttoken.id === '(end)')) { + break; + } + } + if (nexttoken.id !== '(end)') { + error("Unexpected material after the end."); + } + } +*/ + +// Build the syntax table by declaring the syntactic elements of the language. + + type('(number)', idValue); + type('(string)', idValue); + + syntax['(identifier)'] = { + type: '(identifier)', + lbp: 0, + identifier: true, + nud: function () { + var v = this.value, + s = scope[v]; + if (typeof s === 'function') { + s = false; + } + +// The name is in scope and defined in the current function. + + if (s && (s === funct || s === funct['(global)'])) { + +// If we are not also in the global scope, change 'unused' to 'var', +// and reject labels. + + if (!funct['(global)']) { + switch (funct[v]) { + case 'unused': + funct[v] = 'var'; + break; + case 'label': + warning("'{a}' is a statement label.", token, v); + break; + } + } + +// The name is not defined in the function. If we are in the global scope, +// then we have an undefined variable. + + } else if (funct['(global)']) { + if (option.undef) { + warning("'{a}' is not defined.", token, v); + } + note_implied(token); + +// If the name is already defined in the current +// function, but not as outer, then there is a scope error. + + } else { + switch (funct[v]) { + case 'closure': + case 'function': + case 'var': + case 'unused': + warning("'{a}' used out of scope.", token, v); + break; + case 'label': + warning("'{a}' is a statement label.", token, v); + break; + case 'outer': + case true: + break; + default: + +// If the name is defined in an outer function, make an outer entry, and if +// it was unused, make it var. + + if (s === true) { + funct[v] = true; + } else if (typeof s !== 'object') { + if (option.undef) { + warning("'{a}' is not defined.", token, v); + } else { + funct[v] = true; + } + note_implied(token); + } else { + switch (s[v]) { + case 'function': + case 'var': + case 'unused': + s[v] = 'closure'; + funct[v] = 'outer'; + break; + case 'closure': + case 'parameter': + funct[v] = 'outer'; + break; + case 'label': + warning("'{a}' is a statement label.", token, v); + } + } + } + } + return this; + }, + led: function () { + error("Expected an operator and instead saw '{a}'.", + nexttoken, nexttoken.value); + } + }; + + type('(regexp)', function () { + return this; + }); + + delim('(endline)'); + delim('(begin)'); + delim('(end)').reach = true; + delim(''); + delim('(error)').reach = true; + delim('}').reach = true; + delim(')'); + delim(']'); + delim('"').reach = true; + delim("'").reach = true; + delim(';'); + delim(':').reach = true; + delim(','); + delim('#'); +// delim('@'); + reserve('else'); + reserve('case').reach = true; + reserve('catch'); + reserve('default').reach = true; + reserve('finally'); + reservevar('arguments'); + reservevar('eval'); + reservevar('false'); + reservevar('Infinity'); + reservevar('NaN'); + reservevar('null'); + reservevar('this'); + reservevar('true'); + reservevar('undefined'); + + + assignop('=', 'assign', 20); + assignop('+=', 'assignadd', 20); + assignop('-=', 'assignsub', 20); + assignop('*=', 'assignmult', 20); + assignop('/=', 'assigndiv', 20).nud = function () { + error("A regular expression literal can be confused with '/='."); + }; + assignop('%=', 'assignmod', 20); + bitwiseassignop('&=', 'assignbitand', 20); + bitwiseassignop('|=', 'assignbitor', 20); + bitwiseassignop('^=', 'assignbitxor', 20); + bitwiseassignop('<<=', 'assignshiftleft', 20); + bitwiseassignop('>>=', 'assignshiftright', 20); + bitwiseassignop('>>>=', 'assignshiftrightunsigned', 20); + + assignop('@=', 'objCSetValueForKey', 20); + + infix('?', function (left, that) { + that.left = left; + that.right = parse(10); + advance(':'); + that['else'] = parse(10); + return that; + }, 30); + + infix('||', 'or', 40); + infix('&&', 'and', 50); + bitwise('|', 'bitor', 70); + bitwise('^', 'bitxor', 80); + bitwise('&', 'bitand', 90); + relation('==', function (left, right) { +/* // ## I don't understand these. + if (option.eqeqeq) { + warning("Expected '{a}' and instead saw '{b}'.", + this, '===', '=='); + } else if (isPoorRelation(left)) { + warning("Use '{a}' to compare with '{b}'.", + this, '===', left.value); + } else if (isPoorRelation(right)) { + warning("Use '{a}' to compare with '{b}'.", + this, '===', right.value); + } +*/ + return this; + }); + relation('==='); + relation('!=', function (left, right) { +/* // ## I don't understand these. +// if (b != true) will throw this error. Why ? + if (option.eqeqeq) { + warning("Expected '{a}' and instead saw '{b}'.", + this, '!==', '!='); + } else if (isPoorRelation(left)) { + warning("Use '{a}' to compare with '{b}'.", + this, '!==', left.value); + } else if (isPoorRelation(right)) { + warning("Use '{a}' to compare with '{b}'.", + this, '!==', right.value); + } +*/ + return this; + }); + relation('!=='); + relation('<'); + relation('>'); + relation('<='); + relation('>='); + bitwise('<<', 'shiftleft', 120); + bitwise('>>', 'shiftright', 120); + bitwise('>>>', 'shiftrightunsigned', 120); + infix('in', 'in', 120); + infix('instanceof', 'instanceof', 120); + infix('+', function (left, that) { + var right = parse(130); +/* +## String constant folding messes up token stream : logToken outputs token stream on the fly. +## Disabled. + if (left && right && left.id === '(string)' && right.id === '(string)') { + left.value += right.value; + left.character = right.character; + if (jx.test(left.value)) { + warning("JavaScript URL.", left); + } + return left; + } +*/ + that.left = left; + that.right = right; + return that; + }, 130); + prefix('+', 'num'); + infix('-', 'sub', 130); + +//## + infix('[+]', 'arrayAdd', 120); + infix('{+}', 'hashAdd', 120); + + // Handle @ prefix for NSStrings + prefix('@', function () + { + advance() + var c = token + if (token.id != '(string)') + warningAt('ObjC string immediate : Expected a Javascript string here', token.line, token.from) + + }) + + // Handle @selector + prefix('@selector', function () + { + var c = token + logExtraSyntax('@selector', token) + token.id = token.value + disableLogToken() + advance('(') + var from = nexttoken.from + var line = nexttoken.line + var selector = '' + while (nexttoken && nexttoken.value != ')' && line == nexttoken.line) + { + advance() + selector += token.value + } + // Wrong but better than nothing +// if (!selector.match(/^[\w:]+/)) +// warningAt('Invalid selector', line, from ) + + var t = { value : selector, type : '(string)', from : from, character : token.character, line : line } + t.rawValue = lines[t.line] ? lines[t.line].substr(t.from, t.character-t.from) : '' + logToken(t) + nexttoken.rawValue = lines[nexttoken.line] ? lines[nexttoken.line].substr(nexttoken.from, nexttoken.character-nexttoken.from) : '' + logToken(nexttoken) + + enableLogToken() + advance(')') + }) + + + prefix('-', 'neg'); + infix('*', 'mult', 140); + infix('/', 'div', 140); + infix('%', 'mod', 140); + + suffix('++', 'postinc'); + prefix('++', 'preinc'); + syntax['++'].exps = true; + + suffix('--', 'postdec'); + prefix('--', 'predec'); + syntax['--'].exps = true; + prefix('delete', function () { + var p = parse(0); + if (!p || (p.id !== '.' && p.id !== '[')) { + warning("Expected '{a}' and instead saw '{b}'.", + nexttoken, '.', nexttoken.value); + } + }).exps = true; + + + prefix('~', function () { + if (option.bitwise) { + warning("Unexpected '{a}'.", this, '~'); + } + parse(150); + return this; + }); + prefix('!', 'not'); + prefix('typeof', 'typeof'); + prefix('new', function () { + var c = parse(155), i; + if (c && c.id !== 'function') { + if (c.identifier) { + c['new'] = true; + switch (c.value) { + case 'Object': + warning("Use the object literal notation {}.", token); + break; + case 'Array': + warning("Use the array literal notation [].", token); + break; + case 'Number': + case 'String': + case 'Boolean': + case 'Math': + warning("Do not use {a} as a constructor.", token, c.value); + break; + case 'Function': + if (!option.evil) { + warning("The Function constructor is eval."); + } + break; + case 'Date': + case 'RegExp': + break; + default: + if (c.id !== 'function') { + i = c.value.substr(0, 1); + if (option.newcap && (i < 'A' || i > 'Z')) { + warning( + "A constructor name should start with an uppercase letter.", + token); + } + } + } + } else { + if (c.id !== '.' && c.id !== '[' && c.id !== '(') { + warning("Bad constructor.", token); + } + } + } else { + warning("Weird construction. Delete 'new'.", this); + } + adjacent(token, nexttoken); +/* + // ## Allow paramless constructors + if (nexttoken.id !== '(') { + warning("Missing '()' invoking a constructor."); + } +*/ + this.first = c; + return this; + }); + syntax['new'].exps = true; + + infix('.', function (left, that) { + adjacent(prevtoken, token); + var m = identifier(); + if (typeof m === 'string') { + countMember(m); + } + that.left = left; + that.right = m; + if (!option.evil && left && left.value === 'document' && + (m === 'write' || m === 'writeln')) { + warning("document.write can be a form of eval.", left); + } + if (option.adsafe) { + if (left && left.value === 'ADSAFE') { + if (m === 'id' || m === 'lib') { + warning("ADsafe violation.", that); + } else if (m === 'go') { + if (xmode !== 'script') { + warning("ADsafe violation.", that); + } else if (adsafe_went || nexttoken.id !== '(' || + peek(0).id !== '(string)' || + peek(0).value !== adsafe_id || + peek(1).id !== ',') { + error("ADsafe violation: go.", that); + } + adsafe_went = true; + adsafe_may = false; + } + } + } + if (option.safe) { + for (;;) { + if (banned[m] === true) { + warning("ADsafe restricted word '{a}'.", token, m); + } + if (predefined[left.value] !== true || + nexttoken.id === '(') { + break; + } + if (standard_member[m] === true) { + if (nexttoken.id === '.') { + warning("ADsafe violation.", that); + } + break; + } + if (nexttoken.id !== '.') { + warning("ADsafe violation.", that); + break; + } + advance('.'); + token.left = that; + token.right = m; + that = token; + m = identifier(); + if (typeof m === 'string') { + countMember(m); + } + } + } + return that; + }, 160, true); + + infix('(', function (left, that) { + var left = token + abut(prevtoken, token); + nospace(); + var n = 0, + p = []; + if (left) { + if (left.type === '(identifier)') { + if (left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)) { + if (left.value !== 'Number' && left.value !== 'String' && + left.value !== 'Boolean' && left.value !== 'Date') { + if (left.value === 'Math') { + warning("Math is not a function.", left); + } else if (option.newcap) { + warning("Missing 'new' prefix when invoking a constructor.", + left); + } + } + } + } else if (left.id === '.') { + if (option.safe && left.left.value === 'Math' && + left.right === 'random') { + warning("ADsafe violation.", left); + } + } + } + if (nexttoken.id !== ')') { + for (;;) { + // ## singleExpression + p[p.length] = parse(10, 'singleExpression'); + n += 1; + if (nexttoken.id !== ',') { + break; + } + comma(); + } + } + var lasttoken = token + advance(')'); + + // ## + var right = token + left.right = right + right.left = left + lasttoken.rightParen = right + + if (option.immed && left.id === 'function' && nexttoken.id !== ')') { + warning("Wrap the entire immediate function invocation in parens.", + that); + } + nospace(prevtoken, token); + if (typeof left === 'object') { + if (left.value === 'parseInt' && n === 1) { + warning("Missing radix parameter.", left); + } + if (!option.evil) { + if (left.value === 'eval' || left.value === 'Function' || + left.value === 'execScript') { + warning("eval is evil.", left); + } else if (p[0] && p[0].id === '(string)' && + (left.value === 'setTimeout' || + left.value === 'setInterval')) { + warning( + "Implied eval is evil. Pass a function instead of a string.", left); + } + } + if (!left.identifier && left.id !== '.' && left.id !== '[' && + left.id !== '(' && left.id !== '&&' && left.id !== '||' && + left.id !== '?') { + warning("Bad invocation.", left); + } + + } + that.left = left; + return that; + }, 155, true).exps = true; + + prefix('(', function () { + var left = token + nospace(); + var v = parse(0); + var lasttoken = token + advance(')', this); + // ## + var right = token + left.right = right + right.left = left + lasttoken.rightParen = right + + nospace(prevtoken, token); + if (option.immed && v.id === 'function') { + if (nexttoken.id === '(') { + warning( +"Move the invocation into the parens that contain the function.", nexttoken); + } else { + warning( +"Do not wrap function literals in parens unless they are to be immediately invoked.", + this); + } + } + return v; + }); + + + // + // ## ObjC call handling + // + function ObjCParams(firstToken) + { + logExtraSyntax('objc', token) +// if (token.value != ']') + + token.isObjCFirstCall = true + token.isObjCCall = true + nexttoken.isObjCCall = true + nexttoken.isObjCFirstParam = true + firstToken.isObjCCallOpener = true + firstToken.isObjCCall = true + + var isObjCSuperCall = (token.value == 'original' || token.value == 'super') + token.isObjCSuperCall = isObjCSuperCall + nexttoken.isObjCSuperCall = isObjCSuperCall + + function advanceParameterName() + { + advance() +// if (!token.value.match(/^[a-zA-Z_]\w*/)) warningAt('Invalid selector name "' + token.value + '"', token.line, token.from) + } + + var instanceToken = token + var firstMessagePart = nexttoken + + var parameterCount = 0 + // Advance parameter name + advanceParameterName() + // Parameter(s) + var jsselector = token.value + if (nexttoken.id == ':') + { + nexttoken.isObjCParameterSeparator = true + parameterCount++ + advance(':') + jsselector += '_' + // Parameter value : any javascript expression, including anon functions + parse(0) + // Remaining parameters + while (nexttoken && nexttoken.value != ']') + { + if (nexttoken.id === '(end)') return warningAt('Unexpected end of ObjC call "' + token.value + '"', token.line, token.from) + // Handle variadic calls : must be comma list, last values before ] + if (nexttoken.value == ',') + { + while (nexttoken.value == ',') + { + advance(',') + parse(0) + } + // We're done for this message + continue + } + parameterCount++ + jsselector += nexttoken.value + '_' + nexttoken.isObjCCall = true + nexttoken.isObjCMultiCall = true + advanceParameterName() + // Next token must be a semicolon + if (nexttoken.id != ':') warning("ObjC message missing last paramater") + nexttoken.isObjCParameterSeparator = true + advance(':') + // Parameter value + parse(0) + } + } + + if (parameterCount) + firstMessagePart.objCJSSelector = jsselector + + if (nexttoken.value != ']') warning('ObjC call not closed') + nexttoken.isObjCCallCloser = true + nexttoken.isObjCCall = true + nexttoken.isObjCSuperCall = isObjCSuperCall + instanceToken.objCParameterCountOpener = parameterCount + nexttoken.objCParameterCountCloser = parameterCount + // Mark expression as valid standalone (skip warning in parse(), 'Expected an assignment or function call and instead saw an expression') + nexttoken.exps = true + } + + infix('[', function (left, that) { + var firstToken = token + nospace(); + var e = parse(0), s; + if (e && e.type === '(string)') { + if (option.safe && banned[e.value] === true) { + warning("ADsafe restricted word '{a}'.", that, e.value); + } + countMember(e.value); + if (!option.sub && ix.test(e.value)) { + s = syntax[e.value]; + if (!s || !s.reserved) { + warning("['{a}'] is better written in dot notation.", + e, e.value); + } + } + } else if (!e || (e.type !== '(number)' && + (e.id !== '+' || e.arity !== 'unary'))) { + if (option.safe) { + warning('ADsafe subscripting.'); + } + } + + // ## Parse an ObjC message (as a statement) + if (nexttoken.value != ']') + ObjCParams(firstToken) + advance(']', that); + + // Mark each token as siblings of each other + token.left = firstToken + firstToken.right = token + + nospace(prevtoken, token); + that.left = left; + that.right = e; + return that; + }, 160, true); + + prefix('[', function () { + var firstToken = token + // Doesn't seem to be used + this.first = []; + // Empty array + if (nexttoken.id === ']') { + advance(']'); + return; + } + var b = token.line !== nexttoken.line; + // Indentation check + if (b) { + indent += option.indent; + if (nexttoken.from === indent + option.indent) { + indent += option.indent; + } + } + for (;;) { + // Indentation check + if (b && token.line !== nexttoken.line) { + indentation(); + } + parse(10); + if (nexttoken.id === ',') { + comma(); + if (nexttoken.id === ',') { + warning("Extra comma.", token); + } else if (nexttoken.id === ']') { + warning("Extra comma.", token); + break; + } + } else { + if (b) { + indent -= option.indent; + indentation(); + } + break; + } + } + + +//alert(dumpHashNoFunction(token) + '\n*****************\n' + dumpHashNoFunction(nexttoken)) + // ## Parse an ObjC message (as an assign expression) + if (nexttoken.value != ']') + ObjCParams(firstToken) + advance(']', this); + + // Mark each token as siblings of each other + token.left = firstToken + firstToken.right = token + + // ## as [+] can push an array immediate : a [+] ['b'] + return this; + }, 160); + + (function (x) { + x.nud = function () { + + // ## firstToken + var firstToken = token + + var b, i, s, seen = {}; + b = token.line !== nexttoken.line; + if (b) { + indent += option.indent; + if (nexttoken.from === indent + option.indent) { + indent += option.indent; + } + } + for (;;) { + if (nexttoken.id === '}') { + break; + } + if (b) { + indentation(); + } + i = optionalidentifier(true); + if (!i) { + if (nexttoken.id === '(string)') { + i = nexttoken.value; + if (ix.test(i)) { + s = syntax[i]; + } + advance(); + } else if (nexttoken.id === '(number)') { + i = nexttoken.value.toString(); + advance(); + } else { + error("Expected '{a}' and instead saw '{b}'.", + nexttoken, '}', nexttoken.value); + } + } + if (seen[i] === true) { + warning("Duplicate member '{a}'.", nexttoken, i); + } + seen[i] = true; + countMember(i); + advance(':'); + nonadjacent(token, nexttoken); + // ## Don't allow comma expressions (a, b, c) + parse(10, 'singleExpression'); + if (nexttoken.id === ',') { + comma(); + if (nexttoken.id === ',' || nexttoken.id === '}') { + warning("Extra comma.", token); + } + } else { + break; + } + } + if (b) { + indent -= option.indent; + indentation(); + } + advance('}', this); + + // ## + token.left = firstToken + firstToken.right = token + return this + + return; + }; + x.fud = function () { + error("Expected to see a statement and instead saw a block.", token); + }; + }(delim('{'))); + + + function varstatement(prefix) { + +// JavaScript does not have block scope. It only has function scope. So, +// declaring a variable in a block can have unexpected consequences. + + var name, value; + + if (funct['(onevar)'] && option.onevar) { + warning("Too many var statements."); + } else if (!funct['(global)']) { + funct['(onevar)'] = true; + } + this.first = []; + for (;;) { + nonadjacent(token, nexttoken); + addlabel(identifier(), 'unused'); + if (prefix) { + break; + } + name = token; + this.first.push(token); + if (nexttoken.id === '=') { + nonadjacent(token, nexttoken); + advance('='); + nonadjacent(token, nexttoken); + if (peek(0).id === '=' && nexttoken.identifier) { + error("Variable {a} was not declared correctly.", + nexttoken, nexttoken.value); + } + // ## 'var' + value = parse(0, 'singleExpression'); + name.first = value; + } + if (nexttoken.id !== ',') { + break; + } + comma(); + } + return this; + } + + + stmt('var', varstatement); + + stmt('new', function () { + warning("'new' should not be used as a statement."); + }); + + + function functionparams() { + var i, t = nexttoken, p = []; + advance('('); + nospace(); + if (nexttoken.id === ')') { + advance(')'); + nospace(prevtoken, token); + return; + } + for (;;) { + i = identifier(); + p.push(i); + addlabel(i, 'parameter'); + if (nexttoken.id === ',') { + comma(); + } else { + advance(')', t); + nospace(prevtoken, token); + return p.join(', '); + } + } + } + + function doFunction(i) { + var s = scope; + scope = Object.create(s); + funct = { + '(name)' : i || '"' + anonname + '"', + '(line)' : nexttoken.line + 1, + '(context)' : funct, + '(breakage)': 0, + '(loopage)' : 0, + '(scope)' : scope + }; + token.funct = funct; + + // ## + var startToken = token + logFunctionStart(token) + + functions.push(funct); + if (i) { + addlabel(i, 'function'); + } + // ## May omit params + if (nexttoken.value == '(') + funct['(params)'] = functionparams(); + block(false); + scope = s; + funct = funct['(context)']; + // ## + logFunctionEnd(startToken, token) + } + + + // ## + var functionBlockFunction = function () { + if (inblock) { + // ## Allowed ! +// warning("Function statements cannot be placed in blocks. Use a function expression or move the statement to the top of the outer function.", token); + } + var i = identifier(); + adjacent(token, nexttoken); + addlabel(i, 'unused'); + doFunction(i); + if (nexttoken.id === '(' && nexttoken.line === token.line) { + error( +"Function statements are not invocable. Wrap the whole function invocation in parens."); + } + } + blockstmt('function', functionBlockFunction); + blockstmt('ƒ', functionBlockFunction); + + // ## + var functionPrefixFunction = function () { + var i = optionalidentifier(); + if (i) { + adjacent(token, nexttoken); + } else { + nonadjacent(token, nexttoken); + } + doFunction(i); + if (funct['(loopage)'] && nexttoken.id !== '(') { + warning("Be careful when making functions within a loop. Consider putting the function in a closure."); + } + return this; + } + + prefix('function', functionPrefixFunction); + prefix('ƒ', functionPrefixFunction); + + blockstmt('if', function () { + var t = nexttoken; + advance('('); + nonadjacent(this, t); + nospace(); + parse(20); + if (nexttoken.id === '=') { + warning("Expected a conditional expression and instead saw an assignment."); + advance('='); + parse(20); + } + advance(')', t); + nospace(prevtoken, token); + block(true); + if (nexttoken.id === 'else') { + nonadjacent(token, nexttoken); + advance('else'); + if (nexttoken.id === 'if' || nexttoken.id === 'switch') { + statement(true); + } else { + block(true); + } + } + return this; + }); + + blockstmt('try', function () { + var b, e, s; + if (option.adsafe) { + warning("ADsafe try violation.", this); + } + block(false); + if (nexttoken.id === 'catch') { + advance('catch'); + nonadjacent(token, nexttoken); + advance('('); + s = scope; + scope = Object.create(s); + e = nexttoken.value; + if (nexttoken.type !== '(identifier)') { + warning("Expected an identifier and instead saw '{a}'.", + nexttoken, e); + } else { + addlabel(e, 'exception'); + } + advance(); + advance(')'); + block(false); + b = true; + scope = s; + } + if (nexttoken.id === 'finally') { + advance('finally'); + block(false); + return; + } else if (!b) { + error("Expected '{a}' and instead saw '{b}'.", + nexttoken, 'catch', nexttoken.value); + } + }); + + blockstmt('while', function () { + var t = nexttoken; + funct['(breakage)'] += 1; + funct['(loopage)'] += 1; + advance('('); + nonadjacent(this, t); + nospace(); + parse(20); + if (nexttoken.id === '=') { + warning("Expected a conditional expression and instead saw an assignment."); + advance('='); + parse(20); + } + advance(')', t); + nospace(prevtoken, token); + block(true); + funct['(breakage)'] -= 1; + funct['(loopage)'] -= 1; + }).labelled = true; + + reserve('with'); + + blockstmt('switch', function () { + var t = nexttoken, + g = false; + funct['(breakage)'] += 1; + advance('('); + nonadjacent(this, t); + nospace(); + this.condition = parse(20); + advance(')', t); + nospace(prevtoken, token); + nonadjacent(token, nexttoken); + t = nexttoken; + advance('{'); + nonadjacent(token, nexttoken); + indent += option.indent; + this.cases = []; + for (;;) { + switch (nexttoken.id) { + case 'case': + switch (funct['(verb)']) { + case 'break': + case 'case': + case 'continue': + case 'return': + case 'switch': + case 'throw': + break; + default: + warning( + "Expected a 'break' statement before 'case'.", + token); + } + indentation(-option.indent); + advance('case'); + this.cases.push(parse(20)); + g = true; + advance(':'); + funct['(verb)'] = 'case'; + break; + case 'default': + switch (funct['(verb)']) { + case 'break': + case 'continue': + case 'return': + case 'throw': + break; + default: + warning( + "Expected a 'break' statement before 'default'.", + token); + } + indentation(-option.indent); + advance('default'); + g = true; + advance(':'); + break; + case '}': + indent -= option.indent; + indentation(); + advance('}', t); + if (this.cases.length === 1 || this.condition.id === 'true' || + this.condition.id === 'false') { + warning("This 'switch' should be an 'if'.", this); + } + funct['(breakage)'] -= 1; + funct['(verb)'] = undefined; + return; + case '(end)': + error("Missing '{a}'.", nexttoken, '}'); + return; + default: + if (g) { + switch (token.id) { + case ',': + error("Each value should have its own case label."); + return; + case ':': + statements(); + break; + default: + error("Missing ':' on a case clause.", token); + } + } else { + error("Expected '{a}' and instead saw '{b}'.", + nexttoken, 'case', nexttoken.value); + } + } + } + }).labelled = true; + + stmt('debugger', function () { + if (!option.debug) { + warning("All 'debugger' statements should be removed."); + } + }); + + stmt('do', function () { + funct['(breakage)'] += 1; + funct['(loopage)'] += 1; + block(true); + advance('while'); + var t = nexttoken; + nonadjacent(token, t); + advance('('); + nospace(); + parse(20); + if (nexttoken.id === '=') { + warning("Expected a conditional expression and instead saw an assignment."); + advance('='); + parse(20); + } + advance(')', t); + nospace(prevtoken, token); + funct['(breakage)'] -= 1; + funct['(loopage)'] -= 1; + }).labelled = true; + + blockstmt('for', function () { + var s, t = nexttoken; + funct['(breakage)'] += 1; + funct['(loopage)'] += 1; + advance('('); + nonadjacent(this, t); + nospace(); + if (peek(nexttoken.id === 'var' ? 1 : 0).id === 'in') { + if (nexttoken.id === 'var') { + advance('var'); + varstatement(true); + } else { + switch (funct[nexttoken.value]) { + case 'unused': + funct[nexttoken.value] = 'var'; + break; + case 'var': + break; + default: + warning("Bad for in variable '{a}'.", + nexttoken, nexttoken.value); + } + advance(); + } + advance('in'); + parse(20); + advance(')', t); + s = block(true); + if (!option.forin && (s.length > 1 || typeof s[0] !== 'object' || + s[0].value !== 'if')) { + warning("The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.", this); + } + funct['(breakage)'] -= 1; + funct['(loopage)'] -= 1; + return this; + } else { + if (nexttoken.id !== ';') { + if (nexttoken.id === 'var') { + advance('var'); + varstatement(); + } else { + for (;;) { + parse(0, 'for'); + if (nexttoken.id !== ',') { + break; + } + comma(); + } + } + } + nolinebreak(token); + advance(';'); + if (nexttoken.id !== ';') { + parse(20); + if (nexttoken.id === '=') { + warning("Expected a conditional expression and instead saw an assignment."); + advance('='); + parse(20); + } + } + nolinebreak(token); + advance(';'); + if (nexttoken.id === ';') { + error("Expected '{a}' and instead saw '{b}'.", + nexttoken, ')', ';'); + } + if (nexttoken.id !== ')') { + for (;;) { + parse(0, 'for'); + if (nexttoken.id !== ',') { + break; + } + comma(); + } + } + advance(')', t); + nospace(prevtoken, token); + block(true); + funct['(breakage)'] -= 1; + funct['(loopage)'] -= 1; + } + }).labelled = true; + + + stmt('break', function () { + var v = nexttoken.value; + if (funct['(breakage)'] === 0) { + warning("Unexpected '{a}'.", nexttoken, this.value); + } + // ## Allow missing semicolon + if (this.line !== nexttoken.line) return + nolinebreak(this); + if (nexttoken.id !== ';') { + if (token.line === nexttoken.line) { + if (funct[v] !== 'label') { + warning("'{a}' is not a statement label.", nexttoken, v); + } else if (scope[v] !== funct) { + warning("'{a}' is out of scope.", nexttoken, v); + } + advance(); + } + } + reachable('break'); + }); + + + stmt('continue', function () { + var v = nexttoken.value; + if (funct['(breakage)'] === 0) { + warning("Unexpected '{a}'.", nexttoken, this.value); + } + // ## Allow missing semicolon + if (this.line !== nexttoken.line) return + nolinebreak(this); + if (nexttoken.id !== ';') { + if (token.line === nexttoken.line) { + if (funct[v] !== 'label') { + warning("'{a}' is not a statement label.", nexttoken, v); + } else if (scope[v] !== funct) { + warning("'{a}' is out of scope.", nexttoken, v); + } + advance(); + } + } + reachable('continue'); + }); + + + stmt('return', function () { + // ## Allow 'return' without semicolon +// nolinebreak(this); + + if (nexttoken.id === '(regexp)') { + warning("Wrap the /regexp/ literal in parens to disambiguate the slash operator."); + } + + // Ruby-like if return : everything must fit on the line + // return exp if (exp) + // return exp unless (exp) + function isIfReturn() + { + var b = (nexttoken.id == 'if' || nexttoken.value == 'unless') && token.line == nexttoken.line + returnToken.isIfReturn = b + return b + } + function parseIfReturn() + { + logExtraSyntax('ifReturn', token) + if (nexttoken.id == 'if') advance('if') + else advance('unless') + token.isIfReturnOpener = token + // Manually mark unless as reserved + token.reserved = true + advance('(') + parse(20) + advance(')') + token.isIfReturnCloser = token + } + + var returnToken = token + // Maybe if return + if (isIfReturn()) { + parseIfReturn() + } + else + if (nexttoken.id !== ';' && !nexttoken.reach /*## only parse what's on current line */ && token.line == nexttoken.line) { + nonadjacent(token, nexttoken); + parse(20); +/* + // ## Allow multiple expression return + // return a(), b(), 'hello' + while (nexttoken.value == ',') + { + advance(',') + parse(20) + } +*/ + // ## Maybe if return + if (isIfReturn()) parseIfReturn() + } + + reachable('return'); + }); + + + stmt('throw', function () { + nolinebreak(this); + nonadjacent(token, nexttoken); + parse(20); + reachable('throw'); + }); + + // ## JSCocoa class syntax + function parseObjJClass(style) { + // Protect against inner definitions + if (parsingClass) return warningAt('Inner classes are not of this world', token.line, token.from) + parsingClass = true + + logExtraSyntax('class', token) + token.isObjCClassStart = true + advance() + var className = token + if (className.type != '(identifier)') warningAt('Class name must be an identifier', token.line, token.from) + // If we have a '<', we're deriving from the following class. + // If not, we're just adding methods to the class. + if (nexttoken.value == '<' || nexttoken.value == ':') + { + if (style == '@implementation') advance(':') + else advance('<') + var parentClassName = token + advance() + if (token.type != '(identifier)') warningAt('Parent class name must be an identifier', token.line, token.from) + } + else + // Category + if (nexttoken.value == '(') + { + advance('(') + token.isObjCCategory = true + advance() + if (token.type != '(identifier)') warningAt('Category name must be an identifier', token.line, token.from) + advance(')') + } + // Parse class params + if (style == '@implementation' && nexttoken.value == '{') + { + advance('{') + token.isObjCVarList = true + // Pretty basic for now : skipping everything + while (nexttoken && nexttoken.value != '}') + { + if (nexttoken.id === '(end)') return warningAt('Unexpected end of ObjC call "' + token.value + '"', token.line, token.from) + advance() + } + advance('}') + } + + if (style != '@implementation') advance('{') + + var validTokens = { '-' : true, '+' : true, 'IBOutlet' : true, 'IBAction' : true, 'swizzle' : true, 'Swizzle' : true, 'Key' : true, 'function' : true, 'ƒ' : true } + + var parsingClassDefinition = true + while (validTokens[nexttoken.value] && parsingClassDefinition) + { + nexttoken.isObjCClassItemStart = true + var dataHolder = nexttoken + function type() + { + var line = nexttoken.line + advance('(') + var type = '' + var typeTokenCount = 0 + var startToken = nexttoken + while (nexttoken && nexttoken.value != ')' && nexttoken.line == line) + { + advance() + type += token.value + typeTokenCount++ + } + if (!typeTokenCount) warningAt('Missing parameter type', token.line, token.from) + var endToken = token + if (endToken.line != token.line) warningAt('Parameter must be defined on one line', token.line, token.from) + type = lines[startToken.line].substr(startToken.from, endToken.character-startToken.from) + encodings.push("'" + type + "'") + advance(')') + } + + // Advance type + advance() + // Advance method swizzler + if (token.value.toLowerCase() == 'swizzle') token.reserved = true, advance() + + // Method + if (token.value == '-' || token.value == '+') + { + var methodName = '' + var encodings = [] + var paramNames = [] + // Advance return type + type() + + nexttoken.isObjCCall = true + advance() + methodName += token.value + + var needToParseNameAndType = false + while (nexttoken && (nexttoken.value == ':' || needToParseNameAndType)) + { + advance(':') + methodName += ':' + type() + // param name + advance() + paramNames.push(token.value) + needToParseNameAndType = false + if (nexttoken.type == '(identifier)') + { + needToParseNameAndType = true + nexttoken.isObjCCall = true + advance() + methodName += token.value + } + } + dataHolder.objCMethodName = methodName + dataHolder.objCMethodEncodings = encodings + dataHolder.objCMethodParamNames = paramNames + + block(false) + } + // Outlet + else if (token.value == 'IBOutlet') + { + token.reserved = true + // Outlet name + advance() + // Outlet setter name may have been redefined + if (nexttoken.value == '(') + { + advance('(') + advance() + if (token.type != '(identifier)') warningAt('Outlet param must be an identifier', token.line, token.from) + advance(')') + block(0) + } + } + // Action : name + possible parameter name + else if (token.value == 'IBAction') + { + token.reserved = true + // Action name + advance() + // Param name may have been redefined + if (nexttoken.value == '(') + { + advance('(') + advance() + if (token.type != '(identifier)') warningAt('Outlet param must be an identifier', token.line, token.from) + advance(')') + } + block(0) + } + // Key + else if (token.value == 'Key') + { + token.reserved = true + // Key name + advance() + if (token.type != '(identifier)') warningAt('Key param must be an identifier', token.line, token.from) + } + // Javascript function + else if (token.value == 'function' || token.value == 'ƒ') + { + var jsfn = token + jsfn.isClassJSFunction = true + var i = identifier() + jsfn.jsFunctionName = token + doFunction(i) + } + else + { + warningAt('missing valid token handler for "' + token.value + '" while parsing JSCocoa class', token.line, token.from) + parsingClassDefinition = false + } + } + + if (style == '@implementation') + { + // Advance only checks token.id, @end is stored in token.value + if (nexttoken.value == '@end') nexttoken.id = nexttoken.value + advance('@end') + } + else advance('}') + parsingClass = false + } + stmt('class', parseObjJClass); + + stmt('@implementation', function () { + parseObjJClass('@implementation') + }) + + + reserve('void'); + +// Superfluous reserved words + +// reserve('class'); + reserve('const'); + reserve('enum'); + reserve('export'); + reserve('extends'); + reserve('float'); + reserve('goto'); + reserve('import'); + reserve('let'); + // ## We use this for ObjJ super call +// reserve('super'); + + function jsonValue() { + function jsonObject() { + var o = {}, t = nexttoken; + advance('{'); + if (nexttoken.id !== '}') { + for (;;) { + if (nexttoken.id === '(end)') { + error("Missing '}' to match '{' from line {a}.", + nexttoken, t.line + 1); + } else if (nexttoken.id === '}') { + warning("Unexpected comma.", token); + break; + } else if (nexttoken.id === ',') { + error("Unexpected comma.", nexttoken); + } else if (nexttoken.id !== '(string)') { + warning("Expected a string and instead saw {a}.", + nexttoken, nexttoken.value); + } + if (o[nexttoken.value] === true) { + warning("Duplicate key '{a}'.", + nexttoken, nexttoken.value); + } else if (nexttoken.value === '__proto__') { + warning("Stupid key '{a}'.", + nexttoken, nexttoken.value); + } else { + o[nexttoken.value] = true; + } + advance(); +//## + advance(':'); + jsonValue(); + if (nexttoken.id !== ',') { + break; + } + advance(','); + } + } + advance('}'); + } + + function jsonArray() { + var t = nexttoken; + advance('['); + + if (nexttoken.id !== ']') { + for (;;) { + if (nexttoken.id === '(end)') { + error("Missing ']' to match '[' from line {a}.", + nexttoken, t.line + 1); + } else if (nexttoken.id === ']') { + warning("Unexpected comma.", token); + break; + } else if (nexttoken.id === ',') { + error("Unexpected comma.", nexttoken); + } + jsonValue(); + if (nexttoken.id !== ',') { + break; + } + advance(','); + } + } + advance(']'); + } + switch (nexttoken.id) { + case '{': + jsonObject(); + break; + case '[': + jsonArray(); + break; + case 'true': + case 'false': + case 'null': + case '(number)': + case '(string)': + advance(); + break; + case '-': + advance('-'); + if (token.character !== nexttoken.from) { + warning("Unexpected space after '-'.", token); + } + adjacent(token, nexttoken); + advance('(number)'); + break; + default: + error("Expected a JSON value.", nexttoken); + } + } + + +// The actual JSLINT function itself. + + var itself = function (s, o) { + var a, i; + JSLINT.errors = []; + predefined = Object.create(standard); + if (o) { + a = o.predef; + if (a instanceof Array) { + for (i = 0; i < a.length; i += 1) { + predefined[a[i]] = true; + } + } + if (o.adsafe) { + o.safe = true; + } + if (o.safe) { + o.browser = false; + o.css = false; + o.debug = false; + o.eqeqeq = true; + o.evil = false; + o.forin = false; + o.nomen = true; + o.on = false; + o.rhino = false; + o.safe = true; + o.sidebar = false; + o.strict = true; + o.sub = false; + o.undef = true; + o.widget = false; + predefined.Date = false; + predefined['eval'] = false; + predefined.Function = false; + predefined.Object = false; + predefined.ADSAFE = true; + predefined.lib = true; + } + option = o; + } else { + option = {}; + } + option.indent = option.indent || 4; + adsafe_id = ''; + adsafe_may = false; + adsafe_went = false; + approved = {}; + if (option.approved) { + for (i = 0; i < option.approved.length; i += 1) { + approved[option.approved[i]] = option.approved[i]; + } + } else { + approved.test = 'test'; + } + tab = ''; + for (i = 0; i < option.indent; i += 1) { + tab += ' '; + } + indent = 0; + global = Object.create(predefined); + scope = global; + funct = { + '(global)': true, + '(name)': '(global)', + '(scope)': scope, + '(breakage)': 0, + '(loopage)': 0 + }; + functions = []; + ids = {}; + urls = []; + src = false; + xmode = false; + stack = null; + member = {}; + membersOnly = null; + implied = {}; + inblock = false; + lookahead = []; + jsonmode = false; + warnings = 0; + lex.init(s); + prereg = true; + + // ## (internal) Guard against Inner class + parsingClass = false + + prevtoken = token = nexttoken = syntax['(begin)']; + assume(); + + try { + advance(); + if (nexttoken.value.charAt(0) === '<') { + html(); + if (option.adsafe && !adsafe_went) { + warning("ADsafe violation: Missing ADSAFE.go.", this); + } + } else { + switch (nexttoken.id) { +/* + // ## Don't handle json values as they interfere with ObjC messaging + case '{': + case '[': + option.laxbreak = true; + jsonmode = true; + jsonValue(); + break;*/ +/* + // ## Don't handle css classes as @implementation is valid ObjJ syntax + case '@': + case '*': + case '#': + case '.': + case ':': + xmode = 'style'; + advance(); + if (token.id !== '@' || !nexttoken.identifier || + nexttoken.value !== 'charset') { + error('A css file should begin with @charset "UTF-8";'); + } + advance(); + if (nexttoken.type !== '(string)' && + nexttoken.value !== 'UTF-8') { + error('A css file should begin with @charset "UTF-8";'); + } + advance(); + advance(';'); + styles(); + break; +*/ + default: + if (option.adsafe && option.fragment) { + error("Expected '{a}' and instead saw '{b}'.", + nexttoken, '
', nexttoken.value); + } + statements('lib'); + } + } + advance('(end)'); + } catch (e) { + if (e) { + JSLINT.errors.push({ + reason : e.message, + line : e.line || nexttoken.line, + // ## fails on alert(' + character : e.character || (nexttoken ? nexttoken.from : 0) + }, null); + } + } + return JSLINT.errors.length === 0; + }; + + function to_array(o) { + var a = [], k; + for (k in o) { + if (o.hasOwnProperty(k)) { + a.push(k); + } + } + return a; + } + +// Report generator. + + itself.report = function (option, sep) { + var a = [], c, e, f, i, k, l, m = '', n, o = [], s, v, + cl, ex, va, un, ou, gl, la; + + function detail(h, s, sep) { + if (s.length) { + o.push('
' + h + ' ' + + s.sort().join(sep || ', ') + '
'); + } + } + + s = to_array(implied); + + k = JSLINT.errors.length; + if (k || s.length > 0) { + o.push('
Error:'); + if (s.length > 0) { + s.sort(); + for (i = 0; i < s.length; i += 1) { + s[i] = '' + s[i] + ' ' + + implied[s[i]].join(' ') + + ''; + } + o.push('

Implied global: ' + s.join(', ') + '

'); + c = true; + } + for (i = 0; i < k; i += 1) { + c = JSLINT.errors[i]; + if (c) { + e = c.evidence || ''; + o.push('

Problem' + (isFinite(c.line) ? ' at line ' + (c.line + 1) + + ' character ' + (c.character + 1) : '') + + ': ' + c.reason.entityify() + + '

' + + (e && (e.length > 80 ? e.slice(0, 77) + '...' : + e).entityify()) + '

'); + } + } + o.push('
'); + if (!c) { + return o.join(''); + } + } + + if (!option) { + + o.push('
'); + + if (urls.length > 0) { + detail("URLs
", urls, '
'); + } + + s = to_array(scope); + if (s.length === 0) { + if (jsonmode) { + if (k === 0) { + o.push('

JSON: good.

'); + } else { + o.push('

JSON: bad.

'); + } + } else { + o.push('
No new global variables introduced.
'); + } + } else { + o.push('
Global ' + s.sort().join(', ') + '
'); + } + + for (i = 0; i < functions.length; i += 1) { + f = functions[i]; + cl = []; + ex = []; + va = []; + un = []; + ou = []; + gl = []; + la = []; + for (k in f) { + if (f.hasOwnProperty(k) && k.charAt(0) !== '(') { + v = f[k]; + switch (v) { + case 'closure': + cl.push(k); + break; + case 'exception': + ex.push(k); + break; + case 'var': + va.push(k); + break; + case 'unused': + un.push(k); + break; + case 'label': + la.push(k); + break; + case 'outer': + ou.push(k); + break; + case true: + gl.push(k); + break; + } + } + } + o.push('
' + f['(line)'] + ' ' + + (f['(name)'] || '') + '(' + + (f['(params)'] || '') + ')
'); + detail('Closure', cl); + detail('Variable', va); + detail('Exception', ex); + detail('Outer', ou); + detail('Global', gl); + detail('Unused', un); + detail('Label', la); + } + a = []; + for (k in member) { + if (typeof member[k] === 'number') { + a.push(k); + } + } + if (a.length) { + a = a.sort(); + m = '
/*members ';
+                l = 10;
+                for (i = 0; i < a.length; i += 1) {
+                    k = a[i];
+                    n = k.name();
+                    if (l + n.length > 72) {
+                        o.push(m + '
'); + m = ' '; + l = 1; + } + l += n.length + 2; + if (member[k] === 1) { + n = '' + n + ''; + } + if (i < a.length - 1) { + n += ', '; + } + m += n; + } + o.push(m + '
*/
'); + } + o.push('
'); + } + return o.join(''); + }; + + itself.edition = '2009-05-06'; + + return itself; + +}); + + return JSLINT +} \ No newline at end of file diff --git a/jscocoa/JSCocoaLauncher OLD/English.lproj/InfoPlist.strings b/jscocoa/JSCocoaLauncher OLD/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..5e45963 Binary files /dev/null and b/jscocoa/JSCocoaLauncher OLD/English.lproj/InfoPlist.strings differ diff --git a/jscocoa/JSCocoaLauncher OLD/English.lproj/MainMenu.xib b/jscocoa/JSCocoaLauncher OLD/English.lproj/MainMenu.xib new file mode 100644 index 0000000..628b201 --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/English.lproj/MainMenu.xib @@ -0,0 +1,3343 @@ + + + + 1050 + 9G55 + 677 + 949.43 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + NewApplication + + YES + + + About NewApplication + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide NewApplication + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit NewApplication + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + NSFontManager + + + ApplicationController + + + 271 + 2 + {{196, 70}, {630, 440}} + 603979776 + JSCocoa Launcher + NSWindow + + {3.40282e+38, 3.40282e+38} + {350, 250} + + + 256 + + YES + + + -2147482359 + + {{608, -53}, {16, 16}} + + 20746 + 1.600000e+01 + 1.000000e+02 + + + + 274 + + YES + + + 2304 + + YES + + + 290 + {630, 181} + + ListView + + + {{1, 1}, {630, 414}} + + + + + 3 + MQA + + 4 + + + + -2147483392 + {{616, 1}, {15, 399}} + + + _doScroller: + 1.000000e+00 + 9.682875e-01 + + + + -2147483392 + {{1, 400}, {615, 15}} + + 1 + + _doScroller: + 9.775449e-01 + + + {{-1, 25}, {632, 416}} + + + 562 + + + + + + + 290 + {{5, 6}, {476, 14}} + + YES + + 68288064 + 272761856 + n jscocoas, n2 running + + LucidaGrande + 1.100000e+01 + 3100 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 289 + {{486, 0}, {122, 25}} + + YES + + -1543373312 + 134381568 + Kill All Running + + + -2038152961 + 163 + + + 400 + 75 + + + + {630, 440} + + + {{0, 0}, {1920, 1178}} + {350, 272} + {3.40282e+38, 3.40282e+38} + JSCocoaLauncher + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + alignLeft: + + + + 442 + + + + alignJustified: + + + + 443 + + + + copyRuler: + + + + 444 + + + + alignCenter: + + + + 445 + + + + toggleRuler: + + + + 446 + + + + alignRight: + + + + 447 + + + + pasteRuler: + + + + 448 + + + + terminate: + + + + 449 + + + + delegate + + + + 451 + + + + window + + + + 526 + + + + progressIndicator + + + + 528 + + + + scrollViewContent + + + + 552 + + + + scrollView + + + + 553 + + + + statusText + + + + 554 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 378 + + + YES + + + + + + 379 + + + YES + + + + + + + + + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + + + 387 + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + + + 492 + + + YES + + + + + + 493 + + + YES + + + + + + + + + 527 + + + + + 542 + + + YES + + + + + + + + 543 + + + + + 544 + + + + + 545 + + + + + 546 + + + YES + + + + + + 547 + + + + + 548 + + + YES + + + + + + 549 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 420.IBPluginDependency + 450.IBPluginDependency + 492.IBEditorWindowLastContentRect + 492.IBWindowTemplateEditedContentRect + 492.NSWindowTemplate.visibleAtLaunch + 492.windowTemplate.hasMinSize + 492.windowTemplate.minSize + 493.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 527.IBPluginDependency + 542.IBPluginDependency + 543.IBPluginDependency + 544.IBPluginDependency + 545.IBPluginDependency + 546.IBPluginDependency + 547.IBPluginDependency + 548.IBPluginDependency + 549.IBPluginDependency + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{187, 434}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{605, 286}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + {{437, 242}, {86, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{523, 2}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{656, 152}, {630, 440}} + {{656, 152}, {630, 440}} + + + {350, 250} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + {{617, 103}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{145, 474}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 560 + + + + YES + + ApplicationController + + YES + + YES + progressIndicator + scrollView + scrollViewContent + statusText + window + + + YES + id + id + id + id + id + + + + IBUserSource + + + + + + 0 + ../JSCocoaLauncher.xcodeproj + 3 + + diff --git a/jscocoa/JSCocoaLauncher OLD/English.lproj/RowView.xib b/jscocoa/JSCocoaLauncher OLD/English.lproj/RowView.xib new file mode 100644 index 0000000..0386b05 --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/English.lproj/RowView.xib @@ -0,0 +1,549 @@ + + + + 1050 + 9G55 + 677 + 949.43 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + ApplicationController + + + FirstResponder + + + NSApplication + + + + 290 + + YES + + + 266 + {{7, 15}, {206, 14}} + + YES + + 68288064 + 272761856 + FileName + + LucidaGrande + 1.100000e+01 + 3100 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 268 + {{7, 3}, {64, 11}} + + YES + + 68288064 + 272892928 + 2009 01 01 + + LucidaGrande + 9.000000e+00 + 3614 + + + + + 1 + MC4zODk1MTMxMyAwLjM4OTUxMzEzIDAuMzg5NTEzMTMAA + + + + + + 266 + {{73, 3}, {184, 11}} + + YES + + 68288064 + 272892928 + File Description File Description File Description File Description. + + + + + 1 + MC4zODk1MTMxMyAwLjM4OTUxMzEzIDAuMzg5NTEzMTMAA + + + + + + 265 + {{324, 6}, {18, 19}} + + YES + 5.281690e-01 + YES + + -2080244224 + 134217728 + Round Rect Button + + LucidaGrande + 1.200000e+01 + 16 + + + -935051009 + 164 + + NSImage + NSRevealFreestandingTemplate + + + + 400 + 75 + + + + + 265 + {{309, 10}, {10, 10}} + + YES + + -2080244224 + 134217728 + + + LucidaGrande + 1.300000e+01 + 1044 + + + -934526721 + 70 + + NSImage + NSRightFacingTriangleTemplate + + + + 400 + 75 + + + + + 265 + {{285, 6}, {18, 19}} + + YES + + -1.000000e+00 + 1.000000e+00 + + 1 + MCAwIDAgMC40NwA + + + + YES + + + 1.000000e+00 + 7.874012e-03 + 7.874012e-03 + 1.000000e+00 + + + 6.741571e-02 + 6.094156e-02 + 5.457659e-02 + 1.000000e+00 + + YES + + + YES + + -2080244224 + 134217728 + + + + -934526721 + 164 + + NSImage + NSStopProgressTemplate + + + + 400 + 75 + + + + + 10 + {{0, -2}, {350, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + {350, 30} + + NSView + + + + + YES + + + rowView + + + + 6 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + + + + + + + 7 + + + YES + + + + + + 8 + + + + + 9 + + + YES + + + + + + 10 + + + + + 11 + + + YES + + + + + + 12 + + + + + 15 + + + YES + + + + + + 16 + + + + + 17 + + + + + 18 + + + YES + + + + + + 19 + + + + + 20 + + + YES + + + + + + 21 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 15.IBAttributePlaceholdersKey + 15.IBPluginDependency + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBAttributePlaceholdersKey + 18.IBPluginDependency + 18.IBViewIntegration.shadowBlurRadius + 18.IBViewIntegration.shadowColor + 18.IBViewIntegration.shadowOffsetHeight + 18.IBViewIntegration.shadowOffsetWidth + 19.IBPluginDependency + 20.IBAttributePlaceholdersKey + 20.IBPluginDependency + 20.IBViewIntegration.shadowBlurRadius + 20.IBViewIntegration.shadowColor + 20.IBViewIntegration.shadowOffsetHeight + 20.IBViewIntegration.shadowOffsetWidth + 21.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{722, 306}, {350, 30}} + com.apple.InterfaceBuilder.CocoaPlugin + {628, 654} + {{357, 416}, {480, 272}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Reveal in Finder + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Run + + + com.apple.InterfaceBuilder.CocoaPlugin + + + 3 + MCAwLjY4MDAwMDAxAA + + + + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + Kill + + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 27 + + + + YES + + ApplicationController + + rowView + id + + + IBUserSource + + + + + + 0 + ../JSCocoaLauncher.xcodeproj + 3 + + diff --git a/jscocoa/JSCocoaLauncher OLD/Info.plist b/jscocoa/JSCocoaLauncher OLD/Info.plist new file mode 100644 index 0000000..30938da --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/Info.plist @@ -0,0 +1,47 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.inexdo.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + CFBundleDocumentTypes + + + NSDocumentClass + JSCocoaDocument + CFBundleTypeExtensions + + jscocoa + + CFBundleTypeMIMETypes + + text/jscocoa + + CFBundleTypeName + JSCocoa standalone file + CFBundleTypeRole + Viewer + + + + diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaLauncher.js b/jscocoa/JSCocoaLauncher OLD/JSCocoaLauncher.js new file mode 100644 index 0000000..b124002 --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaLauncher.js @@ -0,0 +1,344 @@ + + /* + Querying Metadata With Spotlight + http://developer.apple.com/technotes/tn2007/tn2192.html + */ + + + + Class('JSCocoaDocument < NSDocument').definition = function () + { + Method('readFromURL:ofType:error:').encoding('bool id id id').fn = function(url, type, error) + { +// log(url) +// NSTask.launchedTaskWithLaunchPath_arguments('/Users/mini/Documents/xcode projects/Xcode build data/Debug/JSCocoaLauncher.app/Contents/MacOS/JSCocoaLauncher', NSArray.arrayWithObject('HELLO')) + + var existingTask = processes[url] + if (existingTask) existingTask.terminate + + var file = url.path.stringByReplacingOccurrencesOf({string:"\"", withString:"\\\""}) + + var process = '/Users/mini/Documents/xcode projects/Xcode build data/Debug/JSCocoaSandbox.app/Contents/MacOS/JSCocoaSandbox' + var task = NSTask.launchedTaskWithLaunchPath_arguments(process, NSArray.arrayWithObject(file)) + + processes[url] = task + + + this.perform({selector: 'closeRightAfterOpening:', withObject: null, afterDelay: 0}) + return true + } + IBAction('closeRightAfterOpening').fn = function () + { + this.close + } + } + + + + + + + + + + + Class('ApplicationController < NSObject').definition = function () + { + Method('applicationDidFinishLaunching:').encoding('void id').fn = function (notification) + { + appDelegate = this + + // Reparent progress indicator + var themeView = this.window.contentView.superview + themeView.addSubview(this.progressIndicator) + // Set correct height and unhide it + var frame = this.progressIndicator.frame + frame.origin.y = themeView.subviews[0].frame.origin.y+1 + this.progressIndicator.frame = frame + this.progressIndicator.hidden = false + // Animate + this.progressIndicator.startAnimation(null) + + // Window square corners + light bottom gradient + this.window.bottomCornerRounded = false + this.window['_setUsesLightBottomGradient:'](true) + this.window.isVisible = true + + + // Load a rowView to get its height + NSBundle.loadNibNamed_owner('RowView', this) + this.rowHeight = this.rowView.frame.size.height + + // Globals + rowHeight = appDelegate.rowHeight + scrollView = this.scrollView + scrollViewContent = this.scrollViewContent + + + // Start query + var query = NSMetadataQuery.instance() +// var descriptors = NSArray.arrayWithObject(NSSortDescriptor.instance({withKey:'kMDItemFSName', ascending:true})) +// query.setSortDescriptors(descriptors) + + + NSNotificationCenter.defaultCenter.add({observer:NSApplication.sharedApplication.delegate, selector:'notified:', name:null, object:query}) + + +// mdfind "(kMDItemDisplayName = 'jscocoa*'cdw) && (kMDItemFSName = '*.jscocoa'c)" +// query.setPredicate(NSPredicate.predicateWithFormat("(kMDItemFSName like [cd]'*\.jscocoa')")) +// query.setPredicate(NSPredicate.predicateWithFormat("(kMDItemDisplayName like[cdw] '*jscocoa*') and (kMDItemFSName like[c] \"*\.jscocoa\")")) +// query.setPredicate(NSPredicate.predicateWithFormat("(kMDItemFSName like[cdw] '*jscocoa*')")) + query.setPredicate(NSPredicate.predicateWithFormat("(kMDItemDisplayName like[cdw] '*jscocoa*')")) + query.startQuery + + +/* +log('====') +log('scrollView=' + this.scrollView) +log('scrollViewContent=' + this.scrollViewContent) +log('====') + +var parentView = this.window.contentView +parentView = this.scrollViewContent + + + + +this.parentView = parentView + +*/ +/* + NSBundle.loadNibNamed_owner('RowView', this) +parentView.addSubview(this.rowView) +this.rowView.frame = NSMakeRect(0, h*1, w, h) +*/ +/* +var frame = parentView.frame +log('parentView height=' + frame.size.height + ' ' + h*2) +//frame.size.height = h*2 +frame.size.height = 20000 +parentView.frame = frame +log(parentView.superview) +log(parentView.superview.superview) +log('contentView=' + parentView.superview.superview.contentView) +*/ +/* +for (var i=0; i<5; i++) +{ + NSBundle.loadNibNamed_owner('RowView', this) +// log('height=' + this.rowView.frame.size.height) + + var w = this.rowView.frame.size.width + var h = this.rowView.frame.size.height + parentView.addSubview(this.rowView) + this.rowView.frame = NSMakeRect(0, h*i, w, h) + +} +*/ + + + +// globalTEST = this.rowView + + } + Method('applicationWillTerminate:').encoding('void id').fn = function (notification) + { + log('DIE') + // Kill sub processes + jsc.system('killall -9 JSCocoaSandbox') + // previousApplicationDelegate.applicationWillTerminate(notification) + } + Method('notified:').encoding('void id').fn = function (notification) + { + if (notification.name == 'NSMetadataQueryDidFinishGatheringNotification') + { + this.progressIndicator.stopAnimation(null) + this.progressIndicator.hidden = true + +log('*********results**********') + var l = notification.object.results.length +// for (var i=0; i 1 ? 's' : '') + +// var f = this.parentView.frame +// f.size.height = resultCount*20 +// this.parentView.frame = f + // + +// NON RESTRIX A HOME -> SINON LES VOLUMES SON SOYRA TROUVE ! + + log('GOT NOTIFICATION' + notification) + log('count=' + notification.object.results.length) +/* + for (var i=0; i 1 ? 's' : '') + + } + + var discardFrameChanged = false + function listFrameChanged(list) + { + if (!scrollView) return + // STRUCT +// log('notify frame change ' + scrollView + ' rect=' + scrollView.documentVisibleRect) + + var from = Math.floor(scrollView.documentVisibleRect.origin.y/rowHeight) + var to = from + Math.ceil(scrollView.documentVisibleRect.size.height/rowHeight) + if (to > results.length) to = results.length +// log('displaying from ' + from + ' to ' + to + ' (' + (to-from) + ')') + + if (discardFrameChanged) + { + discardFrameChanged = false + return + } + + + + + + +if (views.length) return + + +log('DRAW') + var usedViews = [] +// from = 0 +// to = 1200 +// to = 12 + for (var i=from; istart add') +// log('superview=' + v.superview + ' parent=' + scrollView + ' ?=' + (v.superview==scrollView)) +// scrollView.addSubview(v) +// log('=>END ADD') + } + discardFrameChanged = true + + for (var i=0; i +#endif + +//#define NSLog(args...) NSLog(args), NSLogPostLog(__FILE__, __LINE__) diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/ApplicationController.h b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/ApplicationController.h new file mode 100644 index 0000000..baf1c5c --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/ApplicationController.h @@ -0,0 +1,18 @@ +// +// ApplicationController.h +// JSCocoaSandbox +// +// Created by Patrick Geiller on 02/11/08. +// Copyright __MyCompanyName__ 2008. All rights reserved. +// + +#import +#import "JSCocoaController.h" + + +@interface ApplicationController : NSObject { + + id jsCocoaController; +} + +@end diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/ApplicationController.m b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/ApplicationController.m new file mode 100644 index 0000000..0c701dc --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/ApplicationController.m @@ -0,0 +1,79 @@ +// +// ApplicationController.m +// JSCocoaSandbox +// +// Created by Patrick Geiller on 02/11/08. +// Copyright __MyCompanyName__ 2008. All rights reserved. +// + +#import "ApplicationController.h" +#import "NSLogConsole.h" + + +@implementation ApplicationController + + +- (void)applicationDidFinishLaunching:(NSNotification *)notification +{ + // Start console + [NSLogConsole sharedConsole]; + + [[NSView alloc] retain]; + +NSLog(@"1"); + + // Create 'refresh' menu item + id item = [[NSMenuItem alloc] initWithTitle:@"Refresh" action:@selector(refreshJSCocoa:) keyEquivalent:@"r"]; + id menu = [[NSApplication sharedApplication] mainMenu]; + menu = [[menu itemAtIndex:0] submenu]; + // Insert separator + [menu insertItem:[NSMenuItem separatorItem] atIndex:[menu numberOfItems]-2]; + // Insert refresh + [menu insertItem:item atIndex:[menu numberOfItems]-2]; + + // Create 'view source' menu item + + TODO + + + jsCocoaController = [JSCocoaController sharedController]; + // Load class construction kit + id classJSFile = [NSString stringWithFormat:@"%@/Contents/Resources/class.js", [[NSBundle mainBundle] bundlePath]]; + [jsCocoaController evalJSFile:classJSFile]; + + // Check argument count + id args = [[NSProcessInfo processInfo] arguments]; + if ([args count] < 2) + { + NSLog(@"JSCocoaSandbox : no file to launch — launch with JSCocoaLauncher"); + return; + } + id mainJSFile = [args objectAtIndex:[args count]-1]; +// mainJSFile = @"/Users/mini/Software Inexdo/JSCocoa/test.jscocoa"; + id pathParts = [mainJSFile pathComponents]; + // Update console name + id title = [pathParts objectAtIndex:[pathParts count]-1]; + [[NSLogConsole sharedConsole] setWindowTitle:title]; + + // Load file + [jsCocoaController evalJSFile:mainJSFile]; + + [NSApp activateIgnoringOtherApps:YES]; +} + +- (void)applicationWillTerminate:(NSNotification *)notification +{ + [jsCocoaController release]; +} + +- (void)refreshJSCocoa:(id)notif +{ + NSLog(@"REFRESH"); + id args = [[NSProcessInfo processInfo] arguments]; + id path = [args objectAtIndex:[args count]-1]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL fileURLWithPath:path]]; +// [NSApp terminate:nil]; +} + + +@end diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/English.lproj/InfoPlist.strings b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..5e45963 Binary files /dev/null and b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/English.lproj/InfoPlist.strings differ diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/English.lproj/MainMenu.xib b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/English.lproj/MainMenu.xib new file mode 100644 index 0000000..b7dc823 --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/English.lproj/MainMenu.xib @@ -0,0 +1,3028 @@ + + + + 1050 + 9F33 + 672 + 949.34 + 352.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + NewApplication + + YES + + + About NewApplication + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide NewApplication + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit NewApplication + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + NSFontManager + + + ApplicationController + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + alignLeft: + + + + 442 + + + + alignJustified: + + + + 443 + + + + copyRuler: + + + + 444 + + + + alignCenter: + + + + 445 + + + + toggleRuler: + + + + 446 + + + + alignRight: + + + + 447 + + + + pasteRuler: + + + + 448 + + + + terminate: + + + + 449 + + + + delegate + + + + 451 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 378 + + + YES + + + + + + 379 + + + YES + + + + + + + + + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + + + 387 + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 450.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{187, 434}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{207, 285}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + {{437, 242}, {86, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{523, 2}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{219, 102}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{145, 474}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 453 + + + + YES + + ApplicationController + NSObject + + jsCocoaController + id + + + IBProjectSource + ApplicationController.h + + + + NSWindow + + IBProjectSource + ../../JSCocoa/NSLogConsole.h + + + + + 0 + ../JSCocoaSandbox.xcodeproj + 3 + + diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/English.lproj/NSLogConsole.xib b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/English.lproj/NSLogConsole.xib new file mode 100644 index 0000000..f4dc1ac --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/English.lproj/NSLogConsole.xib @@ -0,0 +1,457 @@ + + + + 1050 + 9F33 + 672 + 949.34 + 352.00 + + YES + + + + YES + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + NSLogConsole + + + FirstResponder + + + NSApplication + + + 271 + 2 + {{100, 500}, {450, 400}} + 1610612736 + Console + NSWindow + + {3.40282e+38, 3.40282e+38} + {250, 150} + + + 256 + + YES + + + 292 + {{7, 3}, {52, 25}} + + YES + + -2080244224 + 134348800 + Clear + + LucidaGrande + 1.100000e+01 + 3100 + + + -2038152961 + 163 + + + 400 + 75 + + + + + 291 + {{215, 7}, {223, 19}} + + YES + + 343014976 + 268567552 + + + Search + + YES + 1 + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + 130560 + 0 + search + _searchFieldSearch: + + + 138690815 + 0 + + 400 + 75 + + + 130560 + 0 + clear + + YES + + YES + + YES + AXDescription + NSAccessibilityEncodedAttributesValueType + + + YES + cancel + + + + + _searchFieldCancel: + + + 138690815 + 0 + + 400 + 75 + + 255 + + + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.url + public.url-name + + + {{0, 33}, {450, 367}} + + + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + {450, 400} + + + {{0, 0}, {1920, 1178}} + {250, 172} + {3.40282e+38, 3.40282e+38} + NSLogConsole + + + + + YES + + + window + + + + 8 + + + + webView + + + + 9 + + + + clear: + + + + 10 + + + + searchChanged: + + + + 12 + + + + searchField + + + + 13 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 2 + + + YES + + + + + + + + 3 + + + YES + + + + + + 4 + + + + + 5 + + + YES + + + + + + 6 + + + + + 7 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 1.windowTemplate.hasMinSize + 1.windowTemplate.minSize + 2.IBPluginDependency + 3.IBPluginDependency + 4.IBPluginDependency + 5.IBPluginDependency + 6.IBPluginDependency + 7.CustomClassName + 7.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{21, 722}, {450, 400}} + com.apple.InterfaceBuilder.CocoaPlugin + {{21, 722}, {450, 400}} + + {196, 240} + {{369, 426}, {350, 400}} + + {250, 150} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + NSLogConsoleView + com.apple.WebKitIBPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 15 + + + + YES + + NSLogConsole + NSObject + + YES + + YES + clear: + searchChanged: + + + YES + id + id + + + + YES + + YES + searchField + webView + window + + + YES + id + NSLogConsoleView + id + + + + IBProjectSource + NSLogConsole.h + + + + NSLogConsoleView + WebView + + messageQueue + id + + + + + NSWindow + + + + + 0 + ../JSCocoaLauncher.xcodeproj + 3 + + diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/Info.plist b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/Info.plist new file mode 100644 index 0000000..612b7da --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/JSCocoaSandbox.xcodeproj/TemplateIcon.icns b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/JSCocoaSandbox.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..6738569 Binary files /dev/null and b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/JSCocoaSandbox.xcodeproj/TemplateIcon.icns differ diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/JSCocoaSandbox.xcodeproj/project.pbxproj b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/JSCocoaSandbox.xcodeproj/project.pbxproj new file mode 100644 index 0000000..a14bf14 --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/JSCocoaSandbox.xcodeproj/project.pbxproj @@ -0,0 +1,358 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; + 3DBAA1210EC15AF400A573F4 /* NSLogConsole.html in Resources */ = {isa = PBXBuildFile; fileRef = 3DBAA11E0EC15AF400A573F4 /* NSLogConsole.html */; }; + 3DBAA1220EC15AF400A573F4 /* NSLogConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DBAA1200EC15AF400A573F4 /* NSLogConsole.m */; }; + 3DBAA1290EC15B4500A573F4 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBAA1280EC15B4500A573F4 /* WebKit.framework */; }; + 3DBAA13D0EC15BC100A573F4 /* NSLogConsole.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3DBAA13B0EC15BC100A573F4 /* NSLogConsole.xib */; }; + 3DEEE7DE0EBD34D100F54419 /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DEEE7D40EBD34D100F54419 /* BridgeSupportController.m */; }; + 3DEEE7DF0EBD34D100F54419 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DEEE7D50EBD34D100F54419 /* class.js */; }; + 3DEEE7E00EBD34D100F54419 /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DEEE7D70EBD34D100F54419 /* JSCocoaController.m */; }; + 3DEEE7E10EBD34D100F54419 /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DEEE7D90EBD34D100F54419 /* JSCocoaFFIArgument.m */; }; + 3DEEE7E20EBD34D100F54419 /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DEEE7DB0EBD34D100F54419 /* JSCocoaFFIClosure.m */; }; + 3DEEE7E30EBD34D100F54419 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DEEE7DD0EBD34D100F54419 /* JSCocoaPrivateObject.m */; }; + 3DF5754E0EAD23C9001018F7 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DF5754D0EAD23C9001018F7 /* JavaScriptCore.framework */; }; + 3DF575700EAD5613001018F7 /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DF5756F0EAD5613001018F7 /* ApplicationController.m */; }; + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* JSCocoaSandbox_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaSandbox_Prefix.pch; sourceTree = ""; }; + 3DBAA11E0EC15AF400A573F4 /* NSLogConsole.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = NSLogConsole.html; sourceTree = ""; }; + 3DBAA11F0EC15AF400A573F4 /* NSLogConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSLogConsole.h; sourceTree = ""; }; + 3DBAA1200EC15AF400A573F4 /* NSLogConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSLogConsole.m; sourceTree = ""; }; + 3DBAA1280EC15B4500A573F4 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = ""; }; + 3DBAA13C0EC15BC100A573F4 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/NSLogConsole.xib; sourceTree = ""; }; + 3DEEE7D30EBD34D100F54419 /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3DEEE7D40EBD34D100F54419 /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3DEEE7D50EBD34D100F54419 /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3DEEE7D60EBD34D100F54419 /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3DEEE7D70EBD34D100F54419 /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3DEEE7D80EBD34D100F54419 /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3DEEE7D90EBD34D100F54419 /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 3DEEE7DA0EBD34D100F54419 /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3DEEE7DB0EBD34D100F54419 /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3DEEE7DC0EBD34D100F54419 /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3DEEE7DD0EBD34D100F54419 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3DF5754D0EAD23C9001018F7 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + 3DF5756E0EAD5613001018F7 /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = ""; }; + 3DF5756F0EAD5613001018F7 /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* JSCocoaSandbox.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSCocoaSandbox.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 3DF5754E0EAD23C9001018F7 /* JavaScriptCore.framework in Frameworks */, + 3DBAA1290EC15B4500A573F4 /* WebKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* JSCocoaSandbox.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* JSCocoaSandbox */ = { + isa = PBXGroup; + children = ( + 3DEEE7D20EBD34D100F54419 /* JSCocoa */, + 3DBAA10D0EC15AE100A573F4 /* NSLogConsole */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = JSCocoaSandbox; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* JSCocoaSandbox_Prefix.pch */, + 3DF5756F0EAD5613001018F7 /* ApplicationController.m */, + 3DF5756E0EAD5613001018F7 /* ApplicationController.h */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 8D1107310486CEB800E47090 /* Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 3DBAA13B0EC15BC100A573F4 /* NSLogConsole.xib */, + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3DBAA1280EC15B4500A573F4 /* WebKit.framework */, + 3DF5754D0EAD23C9001018F7 /* JavaScriptCore.framework */, + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3DBAA10D0EC15AE100A573F4 /* NSLogConsole */ = { + isa = PBXGroup; + children = ( + 3DBAA11E0EC15AF400A573F4 /* NSLogConsole.html */, + 3DBAA1200EC15AF400A573F4 /* NSLogConsole.m */, + 3DBAA11F0EC15AF400A573F4 /* NSLogConsole.h */, + ); + name = NSLogConsole; + path = ../../JSCocoa; + sourceTree = ""; + }; + 3DEEE7D20EBD34D100F54419 /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3DEEE7D30EBD34D100F54419 /* BridgeSupportController.h */, + 3DEEE7D40EBD34D100F54419 /* BridgeSupportController.m */, + 3DEEE7D50EBD34D100F54419 /* class.js */, + 3DEEE7D60EBD34D100F54419 /* JSCocoaController.h */, + 3DEEE7D70EBD34D100F54419 /* JSCocoaController.m */, + 3DEEE7D80EBD34D100F54419 /* JSCocoaFFIArgument.h */, + 3DEEE7D90EBD34D100F54419 /* JSCocoaFFIArgument.m */, + 3DEEE7DA0EBD34D100F54419 /* JSCocoaFFIClosure.h */, + 3DEEE7DB0EBD34D100F54419 /* JSCocoaFFIClosure.m */, + 3DEEE7DC0EBD34D100F54419 /* JSCocoaPrivateObject.h */, + 3DEEE7DD0EBD34D100F54419 /* JSCocoaPrivateObject.m */, + ); + name = JSCocoa; + path = ../../JSCocoa; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* JSCocoaSandbox */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JSCocoaSandbox" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = JSCocoaSandbox; + productInstallPath = "$(HOME)/Applications"; + productName = JSCocoaSandbox; + productReference = 8D1107320486CEB800E47090 /* JSCocoaSandbox.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JSCocoaSandbox" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* JSCocoaSandbox */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D1107260486CEB800E47090 /* JSCocoaSandbox */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3DEEE7DF0EBD34D100F54419 /* class.js in Resources */, + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, + 3DBAA1210EC15AF400A573F4 /* NSLogConsole.html in Resources */, + 3DBAA13D0EC15BC100A573F4 /* NSLogConsole.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090 /* main.m in Sources */, + 3DF575700EAD5613001018F7 /* ApplicationController.m in Sources */, + 3DEEE7DE0EBD34D100F54419 /* BridgeSupportController.m in Sources */, + 3DEEE7E00EBD34D100F54419 /* JSCocoaController.m in Sources */, + 3DEEE7E10EBD34D100F54419 /* JSCocoaFFIArgument.m in Sources */, + 3DEEE7E20EBD34D100F54419 /* JSCocoaFFIClosure.m in Sources */, + 3DEEE7E30EBD34D100F54419 /* JSCocoaPrivateObject.m in Sources */, + 3DBAA1220EC15AF400A573F4 /* NSLogConsole.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 1DDD58150DA1D0A300B32029 /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; + 3DBAA13B0EC15BC100A573F4 /* NSLogConsole.xib */ = { + isa = PBXVariantGroup; + children = ( + 3DBAA13C0EC15BC100A573F4 /* English */, + ); + name = NSLogConsole.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* 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; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSCocoaSandbox_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = JSCocoaSandbox; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSCocoaSandbox_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = JSCocoaSandbox; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* 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; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* 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; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JSCocoaSandbox" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JSCocoaSandbox" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/JSCocoaSandbox_Prefix.pch b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/JSCocoaSandbox_Prefix.pch new file mode 100644 index 0000000..d191327 --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/JSCocoaSandbox_Prefix.pch @@ -0,0 +1,11 @@ +// +// Prefix header for all source files of the 'JSCocoaSandbox' target in the 'JSCocoaSandbox' project +// + +#ifdef __OBJC__ + #import +#endif + + +//#import "NSLogConsole.h" +#define NSLog(args...) NSLog(args), NSLogPostLog(__FILE__, __LINE__) diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/NSLogConsole.h b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/NSLogConsole.h new file mode 100644 index 0000000..84d204d --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/NSLogConsole.h @@ -0,0 +1,71 @@ +// +// NSLogConsole.h +// NSLogConsole +// +// Created by Patrick Geiller on 16/08/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import +#import + + +void NSLogProlog(char* file, int line); +void NSLogPostLog(char* file, int line); + +@class NSLogConsoleView; + +@interface NSLogConsole : NSObject { + + BOOL autoOpens; + + IBOutlet id window; + IBOutlet NSLogConsoleView* webView; + IBOutlet id searchField; + + int original_stderr; + NSString* logPath; + NSFileHandle* fileHandle; + + unsigned long long fileOffset; +} + + ++ (id)sharedConsole; + +- (void)open; +- (void)close; +- (BOOL)isOpen; +- (IBAction)clear:(id)sender; +- (IBAction)searchChanged:(id)sender; +- (id)window; + +- (void)logData:(NSData*)data file:(char*)file lineNumber:(int)line; +- (void)updateLogWithFile:(char*)file lineNumber:(int)line; + +@property BOOL autoOpens; + +@end + + +@interface NSWindow(Goodies) +- (void)setBottomCornerRounded:(BOOL)a; +@end + + + +@interface NSLogConsoleView : WebView { + + // A message might trigger console opening, BUT the WebView will take time to load and won't be able to display messages yet. + // Queue them - they will be unqueued when WebView has loaded. + id messageQueue; + + BOOL webViewLoaded; +} + +- (void)logString:(NSString*)string file:(char*)file lineNumber:(int)line; +- (void)clear; +- (void)search:(NSString*)string; + +@end + diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/NSLogConsole.html b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/NSLogConsole.html new file mode 100644 index 0000000..9d06f11 --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/NSLogConsole.html @@ -0,0 +1,299 @@ + + + + + + + + +
No messages
+
No results
+
+ + + + + +
+ +
+
+ + + + diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/NSLogConsole.m b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/NSLogConsole.m new file mode 100644 index 0000000..4d32aea --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/NSLogConsole.m @@ -0,0 +1,297 @@ +// +// NSLogConsole.m +// NSLogConsole +// +// Created by Patrick Geiller on 16/08/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "NSLogConsole.h" +#import + + +BOOL inited = NO; + + +void NSLogPostLog(char* file, int line) +{ + if (!inited) return; + [[NSLogConsole sharedConsole] updateLogWithFile:file lineNumber:line]; +} + + + +@implementation NSLogConsole + +@synthesize autoOpens; + + ++ (id)sharedConsole +{ + static id singleton = NULL; + @synchronized(self) + { + if (!singleton) + { + singleton = [self alloc]; + [singleton init]; + } + } + return singleton; +} + + +- (id)init +{ + id o = [super init]; + autoOpens = YES; + logPath = NULL; + + // Save stderr + original_stderr = dup(STDERR_FILENO); + + +//fflush? + + inited = YES; + + logPath = [NSString stringWithFormat:@"%@%@.log.txt", NSTemporaryDirectory(), [[NSBundle mainBundle] bundleIdentifier]]; + [logPath retain]; + + // Create the file — NSFileHandle doesn't do it ! + [@"" writeToFile:logPath atomically:YES encoding:NSUTF8StringEncoding error:nil]; + + fileHandle = [NSFileHandle fileHandleForWritingAtPath:logPath]; + if (!fileHandle) NSLog(@"Opening log at %@ failed", logPath); + [fileHandle retain]; + int fd = [fileHandle fileDescriptor]; + + // Redirect stderr + int err = dup2(fd, STDERR_FILENO); + if (!err) NSLog(@"Couldn't redirect stderr"); + + fileOffset = 0; + return o; +} + + +- (void)dealloc +{ + [logPath release]; + [fileHandle release]; + [super dealloc]; +} + +- (void)open +{ + if (!window) + { + if (![NSBundle loadNibNamed:@"NSLogConsole" owner:self]) + { + NSLog(@"NSLogConsole.nib not loaded"); + return; + } + if ([window respondsToSelector:@selector(setBottomCornerRounded:)]) + [window setBottomCornerRounded:NO]; + } + [window orderFront:self]; +} +- (void)close +{ + [window orderOut:self]; +} +- (BOOL)isOpen +{ + return [window isVisible]; +} + +- (IBAction)clear:(id)sender +{ + [webView clear]; +} +- (IBAction)searchChanged:(id)sender +{ + [webView search:[sender stringValue]]; +} + + +- (void)logData:(NSData*)data file:(char*)file lineNumber:(int)line +{ + if (![window isVisible] && autoOpens) [self open]; + + id str = [[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding]; +// [[NSAlert alertWithMessageText:@"hello" defaultButton:@"Furthe" alternateButton:nil otherButton:nil informativeTextWithFormat:str] runModal]; + + // Write back to original stderr + write(original_stderr, [data bytes], [data length]); + // Clear search + [searchField setStringValue:@""]; + [webView search:@""]; + // Log string + [webView logString:str file:file lineNumber:line]; + + [str release]; +} + +- (void)updateLogWithFile:(char*)file lineNumber:(int)line +{ + if (![window isVisible] && autoOpens) [self open]; + + // Open a new handle to read new data + id f = [NSFileHandle fileHandleForReadingAtPath:logPath]; + if (!f) NSLog(@"Opening log at %@ failed", logPath); + + // Get file length + [f seekToEndOfFile]; + unsigned long long length = [f offsetInFile]; + + // Read data + [f seekToFileOffset:fileOffset]; + NSData* data = [f readDataToEndOfFile]; + [self logData:data file:file lineNumber:line]; + + // We'll read from that offset next time + fileOffset = length; +} + +- (id)window +{ + return window; +} + +@end + + + + + + + + + + + +@implementation NSLogConsoleView + + +- (void)dealloc +{ + [messageQueue release]; + [super dealloc]; +} + +- (BOOL)drawsBackground +{ + return NO; +} + +- (void)awakeFromNib +{ + messageQueue = [[NSMutableArray alloc] init]; + webViewLoaded = NO; + + // Frame load + [self setFrameLoadDelegate:self]; + + // Load html page + id path = [[NSBundle mainBundle] pathForResource:@"NSLogConsole" ofType:@"html"]; + [[self mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]]]; + + // Navigation notification + [self setPolicyDelegate:self]; +} + +// +// Javascript is available +// Register our custom javascript object in the hosted page +// +- (void)webView:(WebView *)view windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject +{ + [windowScriptObject setValue:self forKey:@"NSLogConsoleView"]; +} + +// +// WebView has finished loading +// +- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame +{ + webViewLoaded = YES; + + // Flush message queue + for (id o in messageQueue) + [self logString:[o valueForKey:@"string"] file:(char*)[[o valueForKey:@"file"] UTF8String] lineNumber:[[o valueForKey:@"line"] intValue]]; + [messageQueue release]; +} + +// +// Notify WebView of new message +// +- (void)logString:(NSString*)string file:(char*)file lineNumber:(int)line +{ + // Queue message if WebView has not finished loading + if (!webViewLoaded) + { + id o = [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithString:string], @"string", + [NSString stringWithUTF8String:file], @"file", + [NSNumber numberWithInt:line], @"line", + nil]; + [messageQueue addObject:o]; + return; + } + [[self windowScriptObject] callWebScriptMethod:@"log" withArguments:[NSArray arrayWithObjects:string, + [NSString stringWithUTF8String:file], + [NSNumber numberWithInt:line], + nil]]; +} + +// +// Open source file in XCode at correct line number +// +- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation + request:(NSURLRequest *)request + frame:(WebFrame *)frame + decisionListener:(id)listener +{ + // Get path, formed by AbsolutePathOnDisk(space)LineNumber + NSString* pathAndLineNumber = [[request URL] path]; + + // From end of string, skip to space before number + char* s = (char*)[pathAndLineNumber UTF8String]; + char* s2 = s+strlen(s)-1; + while (*s2 && *s2 != ' ' && s2 > s) s2--; + if (*s2 != ' ') return NSLog(@"Did not find line number in %@", pathAndLineNumber); + + // Patch a zero to recover path + *s2 = 0; + + // Get line number + int line; + BOOL foundLine = [[NSScanner scannerWithString:[NSString stringWithUTF8String:s2+1]] scanInt:&line]; + if (!foundLine) return NSLog(@"Did not parse line number in %@", pathAndLineNumber); + + // Get path + NSString* path = [NSString stringWithUTF8String:s]; +// NSLog(@"opening line %d of _%@_", line, path); + + // Open in XCode + id source = [NSString stringWithFormat:@"tell application \"Xcode\" \n\ + set doc to open \"%@\" \n\ + set selection to paragraph (%d) of contents of doc \n\ + end tell", path, line]; + id script = [[NSAppleScript alloc] initWithSource:source]; + [script executeAndReturnError:nil]; + [script release]; +} + + +- (void)clear +{ + [[self windowScriptObject] callWebScriptMethod:@"clear" withArguments:nil]; +} + +- (void)search:(NSString*)string +{ + [[self windowScriptObject] callWebScriptMethod:@"search" withArguments:[NSArray arrayWithObjects:string, nil]]; +} +@end + diff --git a/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/main.m b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/main.m new file mode 100644 index 0000000..2e5abc6 --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/JSCocoaSandbox/main.m @@ -0,0 +1,14 @@ +// +// main.m +// JSCocoaSandbox +// +// Created by Patrick Geiller on 02/11/08. +// Copyright __MyCompanyName__ 2008. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jscocoa/JSCocoaLauncher OLD/main.m b/jscocoa/JSCocoaLauncher OLD/main.m new file mode 100644 index 0000000..bf5514d --- /dev/null +++ b/jscocoa/JSCocoaLauncher OLD/main.m @@ -0,0 +1,23 @@ +// +// main.m +// JSCocoaLauncher +// +// Created by Patrick Geiller on 25/10/08. +// Copyright __MyCompanyName__ 2008. All rights reserved. +// + +#import +#import "JSCocoaController.h" + +int main(int argc, char *argv[]) +{ + [JSCocoaController allocAutoreleasePool]; + + // Load jscocoa list + id mainJSFile = [NSString stringWithFormat:@"%@/Contents/Resources/JSCocoaLauncher.js", [[NSBundle mainBundle] bundlePath]]; + [[JSCocoaController sharedController] evalJSFile:mainJSFile]; + + int r = NSApplicationMain(argc, (const char **) argv); + + return r; +} diff --git a/jscocoa/JSCocoaLauncher/Console.tiff b/jscocoa/JSCocoaLauncher/Console.tiff new file mode 100644 index 0000000..2a0becf Binary files /dev/null and b/jscocoa/JSCocoaLauncher/Console.tiff differ diff --git a/jscocoa/JSCocoaLauncher/English.lproj/InfoPlist.strings b/jscocoa/JSCocoaLauncher/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..5e45963 Binary files /dev/null and b/jscocoa/JSCocoaLauncher/English.lproj/InfoPlist.strings differ diff --git a/jscocoa/JSCocoaLauncher/English.lproj/MainMenu.xib b/jscocoa/JSCocoaLauncher/English.lproj/MainMenu.xib new file mode 100644 index 0000000..58dd0e0 --- /dev/null +++ b/jscocoa/JSCocoaLauncher/English.lproj/MainMenu.xib @@ -0,0 +1,3855 @@ + + + + 1050 + 9G55 + 677 + 949.43 + 353.00 + + YES + + + + + YES + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + NewApplication + + YES + + + About JSCocoa Launcher + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide JSCocoa Launcher + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit JSCocoa Launcher + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 15 + 2 + {{335, 223}, {739, 527}} + 1946157056 + JSCocoa Launcher + NSWindow + + {3.40282e+38, 3.40282e+38} + + + 256 + + YES + + + 4372 + + YES + + + 2304 + + YES + + + 256 + {170, 527} + + YES + + + -2147483392 + {{-26, 0}, {16, 17}} + + + YES + + 1.670000e+02 + 1.600000e+01 + 1.000000e+03 + + 75628032 + 0 + + + LucidaGrande + 1.100000e+01 + 3100 + + + 3 + MC4zMzMzMzI5OQA + + + 6 + System + headerTextColor + + 3 + MAA + + + + + 337772096 + 2048 + Text Cell + + LucidaGrande + 1.300000e+01 + 1044 + + + + 6 + System + controlBackgroundColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + + + 3 + YES + YES + + + + 3.000000e+00 + + 6 + System + _sourceListBackgroundColor + + 1 + MC44MzkyMTU3IDAuODY2NjY2NjcgMC44OTgwMzkyMgA + + + + 6 + System + gridColor + + 3 + MC41AA + + + 2.000000e+01 + -1035993088 + 4 + 15 + 0 + YES + 1 + 1.400000e+01 + + + {170, 527} + + + + + 4 + + + + -2147483392 + {{148, 1}, {15, 416}} + + + _doScroller: + 9.965754e-01 + + + + -2147483392 + {{1, 417}, {147, 15}} + + 1 + + _doScroller: + 9.759036e-01 + + + {{-1, 0}, {170, 527}} + + + 560 + + + + QSAAAEEgAABBoAAAQaAAAA + + + + 20 + {{166, 0}, {5, 527}} + + {0, 0} + + 67239424 + 0 + Box + + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 274 + + YES + + + 4364 + + YES + + + 2304 + + YES + + + 4352 + {555, 204} + + YES + + + 256 + {555, 17} + + + + + + 256 + {{555, 0}, {16, 17}} + + + + YES + + 2.100000e+02 + 4.000000e+01 + 1.000000e+03 + + 75628032 + 0 + Name + + + 3 + MC4zMzMzMzI5OQA + + + + + 337772096 + 2048 + Text Cell + + + + + + 3 + YES + YES + + + + 3.390000e+02 + 4.000000e+01 + 1.000000e+03 + + 75628032 + 0 + Description + + + + + + 337772096 + 2048 + Text Cell + + + + + + 3 + YES + YES + + + + 3.000000e+00 + 2.000000e+00 + + + 1 + MC41NTgwMDAyNyAwLjcwNjg5OTUyIDAuODcyNjU5MjEAA + + 1.700000e+01 + -767557632 + 4 + 15 + 0 + YES + + + {{0, 17}, {555, 204}} + + + + + 4 + + + + 256 + {{555, 17}, {15, 204}} + + + _doScroller: + 3.700000e+01 + 1.947368e-01 + + + + 256 + {{-100, -100}, {367, 15}} + + 1 + + _doScroller: + 9.918919e-01 + + + + 2304 + + YES + + + {555, 17} + + + + + 4 + + + + {570, 221} + + + 16 + + + + + + QSAAAEEgAABBmAAAQZgAAA + + + + 4388 + + YES + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + + {{0, 60}, {570, 237}} + + + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + + 290 + {570, 60} + + NSView + + + {{0, 230}, {570, 297}} + + NSView + + + {{169, 0}, {570, 527}} + + + + {739, 527} + + + {{0, 0}, {1440, 878}} + {3.40282e+38, 3.40282e+38} + + + NSFontManager + + + ApplicationController + + + + YES + name + + YES + YES + + YES + YES + children + + + + YES + name + kMDItemDisplayName + kMDItemContentModificationDate + + YES + + YES + YES + YES + YES + YES + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + alignLeft: + + + + 442 + + + + alignJustified: + + + + 443 + + + + copyRuler: + + + + 444 + + + + alignCenter: + + + + 445 + + + + toggleRuler: + + + + 446 + + + + alignRight: + + + + 447 + + + + pasteRuler: + + + + 448 + + + + terminate: + + + + 449 + + + + value: arrangedObjects.name + + + + + + value: arrangedObjects.name + value + arrangedObjects.name + 2 + + + 473 + + + + contentArray: sidebarItems + + + + + + contentArray: sidebarItems + contentArray + sidebarItems + 2 + + + 476 + + + + window + + + + 477 + + + + contentArray: jscocoaItems + + + + + + contentArray: jscocoaItems + contentArray + jscocoaItems + 2 + + + 519 + + + + sidebarItemsList + + + + 521 + + + + jscocoaItemsList + + + + 522 + + + + value: arrangedObjects.kMDItemDisplayName + + + + + + value: arrangedObjects.kMDItemDisplayName + value + arrangedObjects.kMDItemDisplayName + 2 + + + 525 + + + + value: arrangedObjects.kMDItemContentModificationDate + + + + + + value: arrangedObjects.kMDItemContentModificationDate + value + arrangedObjects.kMDItemContentModificationDate + 2 + + + 527 + + + + jscocoaSourceCodeView + + + + 547 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + YES + + + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 378 + + + YES + + + + + + 379 + + + YES + + + + + + + + + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + + + 387 + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 459 + + + + + 461 + + + YES + + + + + + + + 462 + + + + + 463 + + + + + 464 + + + YES + + + + + + 466 + + + YES + + + + + + 469 + + + + + 471 + + + Sidebar items + + + 518 + + + .jscocoa files + + + 538 + + + + + 545 + + + YES + + + + + + + 509 + + + YES + + + + + + + + + 510 + + + + + 511 + + + + + 512 + + + YES + + + + + + + 513 + + + + + 514 + + + YES + + + + + + 515 + + + YES + + + + + + 516 + + + + + 517 + + + + + 544 + + + YES + + + + + + + 543 + + + + + 542 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBEditorWindowLastContentRect + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 371.windowTemplate.maxSize + 372.IBPluginDependency + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 420.IBPluginDependency + 459.IBPluginDependency + 461.IBPluginDependency + 462.IBPluginDependency + 463.IBPluginDependency + 464.CustomClassName + 464.IBPluginDependency + 466.IBPluginDependency + 469.IBPluginDependency + 471.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 509.IBPluginDependency + 510.IBPluginDependency + 511.IBPluginDependency + 512.IBPluginDependency + 513.IBPluginDependency + 514.IBPluginDependency + 515.IBPluginDependency + 516.IBPluginDependency + 517.IBPluginDependency + 518.IBPluginDependency + 538.IBPluginDependency + 542.IBPluginDependency + 543.IBPluginDependency + 544.IBPluginDependency + 545.IBPluginDependency + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{393, 42}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{187, 434}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{553, 212}, {197, 73}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{207, 285}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{503, 242}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{292, 273}, {739, 527}} + {{292, 273}, {739, 527}} + + {{33, 99}, {480, 360}} + {3.40282e+38, 3.40282e+38} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{437, 242}, {86, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{523, 2}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + SourceList + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + {{219, 102}, {259, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{351, 82}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{145, 474}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 567 + + + + YES + + ApplicationController + + YES + + YES + jscocoaItemsList + jscocoaSourceCodeView + sidebarItemsList + window + + + YES + id + id + id + id + + + + IBUserSource + + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaController.h + + + + + 0 + ../JSCocoaLauncher.xcodeproj + 3 + + diff --git a/jscocoa/JSCocoaLauncher/GoogleGroups.tiff b/jscocoa/JSCocoaLauncher/GoogleGroups.tiff new file mode 100644 index 0000000..8ccbb0b Binary files /dev/null and b/jscocoa/JSCocoaLauncher/GoogleGroups.tiff differ diff --git a/jscocoa/JSCocoaLauncher/Info.plist b/jscocoa/JSCocoaLauncher/Info.plist new file mode 100644 index 0000000..771bedb --- /dev/null +++ b/jscocoa/JSCocoaLauncher/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.inexdo.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/jscocoa/JSCocoaLauncher/JSCocoaLauncher.xcodeproj/TemplateIcon.icns b/jscocoa/JSCocoaLauncher/JSCocoaLauncher.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/jscocoa/JSCocoaLauncher/JSCocoaLauncher.xcodeproj/TemplateIcon.icns differ diff --git a/jscocoa/JSCocoaLauncher/JSCocoaLauncher.xcodeproj/project.pbxproj b/jscocoa/JSCocoaLauncher/JSCocoaLauncher.xcodeproj/project.pbxproj new file mode 100644 index 0000000..a3ecba1 --- /dev/null +++ b/jscocoa/JSCocoaLauncher/JSCocoaLauncher.xcodeproj/project.pbxproj @@ -0,0 +1,353 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; + 3D0D36FB0F93F85F00697133 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D0D36FA0F93F85F00697133 /* WebKit.framework */; }; + 3D0D37130F93FA5900697133 /* source code view.html in Resources */ = {isa = PBXBuildFile; fileRef = 3D0D37120F93FA5900697133 /* source code view.html */; }; + 3D9CEAB10F8620E2004EB118 /* launcher.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D9CEAB00F8620E2004EB118 /* launcher.js */; }; + 3D9CEB220F862115004EB118 /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9CEAFB0F862115004EB118 /* BridgeSupportController.m */; }; + 3D9CEB230F862115004EB118 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D9CEAFC0F862115004EB118 /* class.js */; }; + 3D9CEB2E0F862115004EB118 /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9CEB190F862115004EB118 /* JSCocoaController.m */; }; + 3D9CEB2F0F862115004EB118 /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9CEB1B0F862115004EB118 /* JSCocoaFFIArgument.m */; }; + 3D9CEB300F862115004EB118 /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9CEB1D0F862115004EB118 /* JSCocoaFFIClosure.m */; }; + 3D9CEB310F862115004EB118 /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9CEB1F0F862115004EB118 /* JSCocoaLib.m */; }; + 3D9CEB320F862115004EB118 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9CEB210F862115004EB118 /* JSCocoaPrivateObject.m */; }; + 3D9CEB440F86216A004EB118 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D9CEB430F86216A004EB118 /* JavaScriptCore.framework */; }; + 3DF6A5F10F86ECB40011A48D /* Console.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3DF6A5F00F86ECB40011A48D /* Console.tiff */; }; + 3DF6A5F50F86ED530011A48D /* iPhoneSimulator.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3DF6A5F40F86ED530011A48D /* iPhoneSimulator.tiff */; }; + 3DF6A5FF0F86EDD50011A48D /* GoogleGroups.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3DF6A5FE0F86EDD50011A48D /* GoogleGroups.tiff */; }; + 3DF6A6340F86EF660011A48D /* URL.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3DF6A6330F86EF660011A48D /* URL.tiff */; }; + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* JSCocoaLauncher_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLauncher_Prefix.pch; sourceTree = ""; }; + 3D0D36FA0F93F85F00697133 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = ""; }; + 3D0D37120F93FA5900697133 /* source code view.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "source code view.html"; sourceTree = ""; }; + 3D9CEAB00F8620E2004EB118 /* launcher.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = launcher.js; sourceTree = ""; }; + 3D9CEAFA0F862115004EB118 /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3D9CEAFB0F862115004EB118 /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3D9CEAFC0F862115004EB118 /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3D9CEB130F862115004EB118 /* JSCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa.h; sourceTree = ""; }; + 3D9CEB180F862115004EB118 /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3D9CEB190F862115004EB118 /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3D9CEB1A0F862115004EB118 /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3D9CEB1B0F862115004EB118 /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 3D9CEB1C0F862115004EB118 /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3D9CEB1D0F862115004EB118 /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3D9CEB1E0F862115004EB118 /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLib.h; sourceTree = ""; }; + 3D9CEB1F0F862115004EB118 /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaLib.m; sourceTree = ""; }; + 3D9CEB200F862115004EB118 /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3D9CEB210F862115004EB118 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3D9CEB430F86216A004EB118 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + 3DF6A5F00F86ECB40011A48D /* Console.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Console.tiff; sourceTree = ""; }; + 3DF6A5F40F86ED530011A48D /* iPhoneSimulator.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = iPhoneSimulator.tiff; sourceTree = ""; }; + 3DF6A5FE0F86EDD50011A48D /* GoogleGroups.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = GoogleGroups.tiff; sourceTree = ""; }; + 3DF6A6330F86EF660011A48D /* URL.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = URL.tiff; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* JSCocoaLauncher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSCocoaLauncher.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 3D9CEB440F86216A004EB118 /* JavaScriptCore.framework in Frameworks */, + 3D0D36FB0F93F85F00697133 /* WebKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* JSCocoaLauncher.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* JSCocoaLauncher */ = { + isa = PBXGroup; + children = ( + 3D9CEAF90F862115004EB118 /* JSCocoa */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = JSCocoaLauncher; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* JSCocoaLauncher_Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 3D0D37120F93FA5900697133 /* source code view.html */, + 3D9CEAB00F8620E2004EB118 /* launcher.js */, + 3DF6A6330F86EF660011A48D /* URL.tiff */, + 3DF6A5FE0F86EDD50011A48D /* GoogleGroups.tiff */, + 3DF6A5F00F86ECB40011A48D /* Console.tiff */, + 3DF6A5F40F86ED530011A48D /* iPhoneSimulator.tiff */, + 8D1107310486CEB800E47090 /* Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3D0D36FA0F93F85F00697133 /* WebKit.framework */, + 3D9CEB430F86216A004EB118 /* JavaScriptCore.framework */, + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3D9CEAF90F862115004EB118 /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3D9CEAFA0F862115004EB118 /* BridgeSupportController.h */, + 3D9CEAFB0F862115004EB118 /* BridgeSupportController.m */, + 3D9CEAFC0F862115004EB118 /* class.js */, + 3D9CEB130F862115004EB118 /* JSCocoa.h */, + 3D9CEB180F862115004EB118 /* JSCocoaController.h */, + 3D9CEB190F862115004EB118 /* JSCocoaController.m */, + 3D9CEB1A0F862115004EB118 /* JSCocoaFFIArgument.h */, + 3D9CEB1B0F862115004EB118 /* JSCocoaFFIArgument.m */, + 3D9CEB1C0F862115004EB118 /* JSCocoaFFIClosure.h */, + 3D9CEB1D0F862115004EB118 /* JSCocoaFFIClosure.m */, + 3D9CEB1E0F862115004EB118 /* JSCocoaLib.h */, + 3D9CEB1F0F862115004EB118 /* JSCocoaLib.m */, + 3D9CEB200F862115004EB118 /* JSCocoaPrivateObject.h */, + 3D9CEB210F862115004EB118 /* JSCocoaPrivateObject.m */, + ); + name = JSCocoa; + path = ../JSCocoa; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* JSCocoaLauncher */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JSCocoaLauncher" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = JSCocoaLauncher; + productInstallPath = "$(HOME)/Applications"; + productName = JSCocoaLauncher; + productReference = 8D1107320486CEB800E47090 /* JSCocoaLauncher.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JSCocoaLauncher" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* JSCocoaLauncher */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D1107260486CEB800E47090 /* JSCocoaLauncher */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D9CEB230F862115004EB118 /* class.js in Resources */, + 3D9CEAB10F8620E2004EB118 /* launcher.js in Resources */, + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, + 3DF6A5F10F86ECB40011A48D /* Console.tiff in Resources */, + 3DF6A5F50F86ED530011A48D /* iPhoneSimulator.tiff in Resources */, + 3DF6A5FF0F86EDD50011A48D /* GoogleGroups.tiff in Resources */, + 3DF6A6340F86EF660011A48D /* URL.tiff in Resources */, + 3D0D37130F93FA5900697133 /* source code view.html in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090 /* main.m in Sources */, + 3D9CEB220F862115004EB118 /* BridgeSupportController.m in Sources */, + 3D9CEB2E0F862115004EB118 /* JSCocoaController.m in Sources */, + 3D9CEB2F0F862115004EB118 /* JSCocoaFFIArgument.m in Sources */, + 3D9CEB300F862115004EB118 /* JSCocoaFFIClosure.m in Sources */, + 3D9CEB310F862115004EB118 /* JSCocoaLib.m in Sources */, + 3D9CEB320F862115004EB118 /* JSCocoaPrivateObject.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 1DDD58150DA1D0A300B32029 /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* 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; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSCocoaLauncher_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = JSCocoaLauncher; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSCocoaLauncher_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = JSCocoaLauncher; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* 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; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* 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; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JSCocoaLauncher" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JSCocoaLauncher" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/jscocoa/JSCocoaLauncher/JSCocoaLauncher_Prefix.pch b/jscocoa/JSCocoaLauncher/JSCocoaLauncher_Prefix.pch new file mode 100644 index 0000000..a82aac5 --- /dev/null +++ b/jscocoa/JSCocoaLauncher/JSCocoaLauncher_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'JSCocoaLauncher' target in the 'JSCocoaLauncher' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/jscocoa/JSCocoaLauncher/URL.tiff b/jscocoa/JSCocoaLauncher/URL.tiff new file mode 100644 index 0000000..5479244 Binary files /dev/null and b/jscocoa/JSCocoaLauncher/URL.tiff differ diff --git a/jscocoa/JSCocoaLauncher/iPhoneSimulator.tiff b/jscocoa/JSCocoaLauncher/iPhoneSimulator.tiff new file mode 100644 index 0000000..00f355d Binary files /dev/null and b/jscocoa/JSCocoaLauncher/iPhoneSimulator.tiff differ diff --git a/jscocoa/JSCocoaLauncher/launcher.js b/jscocoa/JSCocoaLauncher/launcher.js new file mode 100644 index 0000000..a417923 --- /dev/null +++ b/jscocoa/JSCocoaLauncher/launcher.js @@ -0,0 +1,299 @@ + + +/* + + forum : includ possibilité de run JSCocoa code + + +*/ + + JSCocoa.hazardReport + + + + class ApplicationController < NSObject + { + + - (void)awakeFromNib + { + this.sidebarItemsList.delegate = this + + var cell = ImageAndTextCell.instance() + this.sidebarItemsList.tableColumns[0].dataCell = cell + + // + // Icons + // + var images = { 'Mac' : NSImage.imageNamed('NSComputer') + ,'Console' : NSImage.imageNamed('Console') + ,'iPhoneSimulator' : NSImage.imageNamed('iPhoneSimulator') + ,'GoogleGroups' : NSImage.imageNamed('GoogleGroups') + ,'URL' : NSImage.imageNamed('URL') + } + images['Mac'].size = new NSSize(16, 16) + images['URL'].size = new NSSize(16, 16) + + // + // Sidebar items + // + this.willChangeValueForKey('sidebarItems') + this.items = [ { name : 'SAMPLES', isGroupItem : true + ,children : [ { name : 'Mac OS', image : images['Mac'] } + ,{ name : 'iPhone Simulator', image : images['iPhoneSimulator'] } + ,{ name : 'Console', image : images['Console'] } ] } + ,{ name : 'TRADE', isGroupItem : true + ,children : [ { name : 'Download samples' }, { name : 'Upload a sample' } ] } + ,{ name : 'DISCUSS', isGroupItem : true + ,children : [ { name : 'Report Bug' }, { name : 'Request Feature' }, { name : 'Google Group', image : images['GoogleGroups'] } ] } + ,{ name : 'VISIT', isGroupItem : true + ,children : [ { name : 'Source', image : images['URL'], id : 'source' }, { name : 'Homepage', image : images['URL'], id : 'home' } ] } + ] + this.didChangeValueForKey('sidebarItems') + + // Expand + this.sidebarItemsList.expandItem(this.sidebarItemsList.itemAtRow(3)) + this.sidebarItemsList.expandItem(this.sidebarItemsList.itemAtRow(2)) + this.sidebarItemsList.expandItem(this.sidebarItemsList.itemAtRow(1)) + this.sidebarItemsList.expandItem(this.sidebarItemsList.itemAtRow(0)) + // Select + this.sidebarItemsList.select({rowIndexes:NSIndexSet.indexSetWithIndex(1), byExtendingSelection:NO }) + + + // + // Position window + // + var windowFrame = this.window.frame + var screenFrame = NSScreen.mainScreen.visibleFrame + this.window.setFrameOrigin(new NSPoint((screenFrame.size.width-windowFrame.size.width)/2, (screenFrame.size.height-windowFrame.size.height)*2/3)) + + + // + // Hash of views, holding name : NSView + // + this.views = {} + + var query = NSMetadataQuery.instance() +// var descriptors = NSArray.arrayWithObject(NSSortDescriptor.instance({withKey:'kMDItemFSName', ascending:true})) +// query.setSortDescriptors(descriptors) + + + NSNotificationCenter.defaultCenter.add({observer:this, selector:'notified:', name:null, object:query}) + + +// mdfind "(kMDItemDisplayName = 'jscocoa*'cdw) && (kMDItemFSName = '*.jscocoa'c)" +// query.setPredicate(NSPredicate.predicateWithFormat("(kMDItemFSName like [cd]'*\.jscocoa')")) +// query.setPredicate(NSPredicate.predicateWithFormat("(kMDItemDisplayName like[cdw] '*jscocoa*') and (kMDItemFSName like[c] \"*\.jscocoa\")")) +// query.setPredicate(NSPredicate.predicateWithFormat("(kMDItemFSName like[cdw] '*jscocoa*')")) + query.setPredicate(NSPredicate.predicateWithFormat("(kMDItemDisplayName like '*\.jscocoa')")) + query.startQuery + this.query = query +// log('QUERY========' + query) + + + // + // Set ourselves as jscocoa items list delegate + // + this.jscocoaItemsList.delegate = this + + // + // Load source code view + // + this.jscocoaSourceCodeView.mainFrameURL = (NSBundle.mainBundle.pathFor({ resource : 'source code view', ofType : 'html' })) + } + - (void)notified:(id)n + { +// log('NOTIFIED' + n.object.results.length) +// if (n.object.results.length) log(n.object.results[0].attributes) + this.willChangeValueForKey('jscocoaItems') + this.jscocoaItemsFromSpotlight = n.object.results + this.didChangeValueForKey('jscocoaItems') + } + +// valueForUndefinedKey +// NSMetadataItem + + - (id)sidebarItems + { + return this.items + } + - (id)jscocoaItems + { + return this.jscocoaItemsFromSpotlight +// return [ { name : 'Blah.jscocoa' }, { name : 'Hopla yougla' } ] + } + + - (BOOL)outlineView:(NSOutlineView*)outlineView isGroupItem:(id)item + { + return item.representedObject.isGroupItem + } + + - (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item + { + this.selectedItem = null + var canSelect = !item.representedObject.isGroupItem + if (canSelect) this.selectedItem = item +// log('canSelect ' + item.representedObject.name) +// if (canSelect) this.switchToView(item.representedObject.id) + return canSelect + } + - (void)outlineViewSelectionDidChange:(NSNotification *)notification + { +// log(notification.object + '!!!!!!!!!!') +// return + if (!this.selectedItem) return + this.switchToView(this.selectedItem.representedObject.id) + } + - (BOOL)outlineView:(NSOutlineView *)outlineView shouldCollapseItem:(id)item + { + return NO + } + + - (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item + { + return NO + } + + - (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item + { + cell.object = item.representedObject + } + +- (void)tableViewSelectionDidChange:(NSNotification *)notification +{ +// log('tableViewSelectionDidChange + ' + notification.object) + if (!this.jscocoaItemsFromSpotlight) return + var row = notification.object.selectedRow +// log('selectedIndex=' + row) + var item = this.jscocoaItemsFromSpotlight[row] + log('selectedObject=' + item.valueForKey('kMDItemFSName')) + log('selectedObject=' + item.valueForKey('kMDItemPath')) +} +/* +- (BOOL)selectionShouldChangeInTableView:(NSTableView *)tableView +{ + log('selectionShouldChangeInTableView') + return YES +} +- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row +{ + log('tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row') + return YES +} +- (BOOL)tableView:(NSTableView *)tableView shouldSelectTableColumn:(NSTableColumn *)tableColumn +{ + log('tableView:(NSTableView *)tableView shouldSelectTableColumn:(NSTableColumn *)tableColumn') + return YES; +} +*/ + + + + js function switchToView(viewName) + { + log('NEW VIEW ' + viewName) +// log('DEBUG CHECK ' + this.sidebarItems) +// __jsc__.garbageCollect + + var view = this.views[viewName] + if (!view) + { + log('asking to build ' + viewName) + if (viewName == 'source') + { + var view = WebView.instance({ withFrame : NSMakeRect(200, 0, 400, 400) }) + log('view=' + view) + this.window.contentView.addSubview(view) + // Breaks on Debugger() — adobe 10 ? + view.mainFrameURL = 'http://yahoo.com' + view.mainFrameURL = 'http://reddit.com' + log('built ' + view) + } + if (viewName == 'home') + { + var view = WebView.instance({ withFrame : NSMakeRect(250, 50, 400, 400) }) + this.window.contentView.addSubview(view) + view.mainFrameURL = 'http://google.com' + log('built ' + view) + } + + if (view) this.views[viewName] = view + } + + if (this.currentView) + this.currentView.hidden = YES + + if (!view) return + + view.hidden = NO + this.currentView = view + } + + IBOutlet sidebarItemsList + IBOutlet jscocoaItemsList + IBOutlet window + + + IBOutlet jscocoaSourceCodeView + } + + + // + // Sidebar items source list + // + class SourceList < NSOutlineView + { + // Don't display disclosure triangle + - (NSRect)frameOfOutlineCellAtRow:(NSInteger)row + { + return new NSRect(0, 0, 0, 0) + } + } + + // + // Sidebar items source list cell + // From Apple's SourceView + // + class ImageAndTextCell < NSTextFieldCell + { + - (id)init + { + var r = this.Super(arguments) + this.font = NSFont.systemFontOfSize(NSFont.smallSystemFontSize) + return r + } + - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView + { + var x = 0 + if (this.object.image) + { + this.object.image.composite({toPoint:NSMakePoint(cellFrame.origin.x, cellFrame.origin.y+18), operation:NSCompositeSourceOver}) + x += 18 + } + + arguments[0] = new NSRect(cellFrame.origin.x+x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height) + this.Super(arguments) + } + } + + // + // Custom Split View + // + class NSSplitView + { + Swizzle- (void)drawDividerInRect:(NSRect)rect + { + // Draw gradient + var color1 = NSColor.colorWithDevice({ white : 1, alpha : 1 }) + var color2 = NSColor.colorWithDevice({ white : 0.85, alpha : 1 }) + var gradient = NSGradient.instance({withStartingColor : color1, endingColor : color2 }) + gradient.drawIn({rect : rect, angle : 90}) + + // Draw top and bottom lines + NSColor.colorWithDevice({ red : 0, green : 0, blue : 0, alpha : 0.4 }).set + NSBezierPath.bezierPathWithRect(new NSRect(rect.origin.x, rect.origin.y, rect.size.width, 1)).fill + NSBezierPath.bezierPathWithRect(new NSRect(rect.origin.x, rect.origin.y+rect.size.height-1, rect.size.width, 1)).fill + + // Call original method to draw know + this.Original(arguments) + } + } diff --git a/jscocoa/JSCocoaLauncher/main.m b/jscocoa/JSCocoaLauncher/main.m new file mode 100644 index 0000000..1c42e45 --- /dev/null +++ b/jscocoa/JSCocoaLauncher/main.m @@ -0,0 +1,20 @@ +// +// main.m +// JSCocoaLauncher +// +// Created by Patrick Geiller on 01/04/09. +// Copyright __MyCompanyName__ 2009. All rights reserved. +// + +#import +#import "JSCocoa.h" + +int main(int argc, char *argv[]) +{ + [JSCocoa allocAutoreleasePool]; + [NSAutoreleasePool new]; + id jsc = [JSCocoa sharedController]; + [jsc evalJSFile:[[NSBundle mainBundle] pathForResource:@"launcher" ofType:@"js"]]; + + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jscocoa/JSCocoaLauncher/source code view.html b/jscocoa/JSCocoaLauncher/source code view.html new file mode 100644 index 0000000..26c43a9 --- /dev/null +++ b/jscocoa/JSCocoaLauncher/source code view.html @@ -0,0 +1,14 @@ + + + + + + + + +

Hello from source code view !

+ + + + diff --git a/jscocoa/JSLocalizedString/ApplicationController.h b/jscocoa/JSLocalizedString/ApplicationController.h new file mode 100644 index 0000000..ad984a9 --- /dev/null +++ b/jscocoa/JSLocalizedString/ApplicationController.h @@ -0,0 +1,23 @@ +// +// ApplicationController.h +// JSLocalizedString +// +// Created by Patrick Geiller on 18/02/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface ApplicationController : NSObject { + + int bookCount; + IBOutlet id label; + +} + +- (IBAction)add:(id)sender; +- (IBAction)remove:(id)sender; +- (IBAction)openInternational:(id)sender; + +@end diff --git a/jscocoa/JSLocalizedString/ApplicationController.m b/jscocoa/JSLocalizedString/ApplicationController.m new file mode 100644 index 0000000..1daf362 --- /dev/null +++ b/jscocoa/JSLocalizedString/ApplicationController.m @@ -0,0 +1,53 @@ +// +// ApplicationController.m +// JSLocalizedString +// +// Created by Patrick Geiller on 18/02/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "ApplicationController.h" +#import "JSCocoa.h" + + +@implementation ApplicationController + +- (id)init +{ + self = [super init]; + bookCount = 0; + return self; +} + +- (void)awakeFromNib +{ + id str = JSLocalizedString(@"BookCount", [NSNumber numberWithInt:bookCount], nil); + NSLog(@"init %d %@", bookCount, str); + if (!str) str = @"***Localization not found***"; + [label setStringValue:str]; +} + +- (IBAction)add:(id)sender +{ + bookCount++; + id str = JSLocalizedString(@"BookCount", [NSNumber numberWithInt:bookCount], nil); + NSLog(@"add %d %@", bookCount, str); + if (!str) str = @"***Localization not found***"; + [label setStringValue:str]; +} +- (IBAction)remove:(id)sender +{ + if (bookCount > 0) bookCount--; + id str = JSLocalizedString(@"BookCount", [NSNumber numberWithInt:bookCount], nil); + NSLog(@"remove %d", bookCount); + if (!str) str = @"***Localization not found***"; + [label setStringValue:str]; +} + +- (IBAction)openInternational:(id)sender +{ + system("open /System/Library/PreferencePanes/Localization.prefPane"); +} + + +@end diff --git a/jscocoa/JSLocalizedString/English.lproj/InfoPlist.strings b/jscocoa/JSLocalizedString/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..5e45963 Binary files /dev/null and b/jscocoa/JSLocalizedString/English.lproj/InfoPlist.strings differ diff --git a/jscocoa/JSLocalizedString/English.lproj/MainMenu.xib b/jscocoa/JSLocalizedString/English.lproj/MainMenu.xib new file mode 100644 index 0000000..9f1fbd9 --- /dev/null +++ b/jscocoa/JSLocalizedString/English.lproj/MainMenu.xib @@ -0,0 +1,3311 @@ + + + + 1050 + 9G55 + 677 + 949.43 + 353.00 + + YES + + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + NewApplication + + YES + + + About NewApplication + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide NewApplication + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit NewApplication + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 7 + 2 + {{335, 677}, {365, 73}} + 1946157056 + JSLocalizedString + NSWindow + + {3.40282e+38, 3.40282e+38} + + + 256 + + YES + + + 268 + {{14, 10}, {32, 25}} + + YES + + -2080244224 + 134217728 + Round Textured + + LucidaGrande + 1.300000e+01 + 1044 + + + -2033958657 + 163 + + NSImage + NSAddTemplate + + + + 400 + 75 + + + + + 268 + {{218, 10}, {132, 25}} + + YES + + -2080244224 + 134217728 + Open International + + + -2033434369 + 163 + + + 400 + 75 + + + + + 268 + {{54, 10}, {32, 25}} + + YES + + -2080244224 + 134217728 + + + + -2033434369 + 163 + + NSImage + NSRemoveTemplate + + + + 400 + 75 + + + + + 268 + {{11, 45}, {342, 17}} + + YES + + 68288064 + 272630784 + Label + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + {365, 73} + + + {{0, 0}, {1440, 878}} + {3.40282e+38, 3.40282e+38} + JSLocalizedString + + + NSFontManager + + + ApplicationController + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + alignLeft: + + + + 442 + + + + alignJustified: + + + + 443 + + + + copyRuler: + + + + 444 + + + + alignCenter: + + + + 445 + + + + toggleRuler: + + + + 446 + + + + alignRight: + + + + 447 + + + + pasteRuler: + + + + 448 + + + + terminate: + + + + 449 + + + + delegate + + + + 457 + + + + label + + + + 458 + + + + add: + + + + 459 + + + + remove: + + + + 460 + + + + openInternational: + + + + 465 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + YES + + + + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 378 + + + YES + + + + + + 379 + + + YES + + + + + + + + + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + + + 387 + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + YES + + + + + + 451 + + + + + 452 + + + YES + + + + + + 453 + + + + + 454 + + + YES + + + + + + 455 + + + + + 456 + + + + + 463 + + + YES + + + + + + 464 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBEditorWindowLastContentRect + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 371.windowTemplate.maxSize + 372.IBPluginDependency + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 420.IBPluginDependency + 450.IBPluginDependency + 451.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 454.IBPluginDependency + 455.IBPluginDependency + 456.IBPluginDependency + 463.IBPluginDependency + 464.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{187, 434}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{496, 280}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{335, 677}, {365, 73}} + {{335, 677}, {365, 73}} + + {{33, 99}, {480, 360}} + {3.40282e+38, 3.40282e+38} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{437, 242}, {86, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{523, 2}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{508, 97}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{145, 474}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 465 + + + + YES + + ApplicationController + NSObject + + YES + + YES + add: + openInternational: + remove: + + + YES + id + id + id + + + + label + id + + + IBProjectSource + ApplicationController.h + + + + + 0 + ../JSLocalizedString.xcodeproj + 3 + + diff --git a/jscocoa/JSLocalizedString/English.lproj/strings.js b/jscocoa/JSLocalizedString/English.lproj/strings.js new file mode 100644 index 0000000..b78df56 --- /dev/null +++ b/jscocoa/JSLocalizedString/English.lproj/strings.js @@ -0,0 +1,20 @@ + + + log('In English') + +/* + // Register a hash + var strings = { 'BookCount' : 'hello' } + registerLocalizedStrings(strings) +*/ + + // Register in main hash + localizedStrings['BookCount'] = 'Book Count' + + localizedStrings['BookCount'] = function (count) + { + if (count == 0) return 'No books found !' + if (count == 1) return 'One book' + return count + ' books' + } + diff --git a/jscocoa/JSLocalizedString/German.lproj/strings.js b/jscocoa/JSLocalizedString/German.lproj/strings.js new file mode 100644 index 0000000..9d4fbf4 --- /dev/null +++ b/jscocoa/JSLocalizedString/German.lproj/strings.js @@ -0,0 +1,12 @@ + + + log('Auf Deutsch') + + + localizedStrings['BookCount'] = function (count) + { + if (count == 0) return 'Keine Bücher gefunden !' + if (count == 1) return 'Ein Buch' + return count + ' Bücher' + } + diff --git a/jscocoa/JSLocalizedString/Info.plist b/jscocoa/JSLocalizedString/Info.plist new file mode 100644 index 0000000..612b7da --- /dev/null +++ b/jscocoa/JSLocalizedString/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/jscocoa/JSLocalizedString/JSLocalizedString.xcodeproj/TemplateIcon.icns b/jscocoa/JSLocalizedString/JSLocalizedString.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/jscocoa/JSLocalizedString/JSLocalizedString.xcodeproj/TemplateIcon.icns differ diff --git a/jscocoa/JSLocalizedString/JSLocalizedString.xcodeproj/project.pbxproj b/jscocoa/JSLocalizedString/JSLocalizedString.xcodeproj/project.pbxproj new file mode 100644 index 0000000..b828ef8 --- /dev/null +++ b/jscocoa/JSLocalizedString/JSLocalizedString.xcodeproj/project.pbxproj @@ -0,0 +1,355 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; + 3D4BC69C0F4BB21300C09AFC /* strings.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D4BC69B0F4BB21300C09AFC /* strings.js */; }; + 3D4BC6B80F4BB27500C09AFC /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D4BC6B70F4BB27500C09AFC /* ApplicationController.m */; }; + 3DAB54AE0F4BACE10005FABC /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DAB54870F4BACE10005FABC /* BridgeSupportController.m */; }; + 3DAB54BA0F4BACE10005FABC /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DAB54A50F4BACE10005FABC /* JSCocoaController.m */; }; + 3DAB54BB0F4BACE10005FABC /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DAB54A70F4BACE10005FABC /* JSCocoaFFIArgument.m */; }; + 3DAB54BC0F4BACE10005FABC /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DAB54A90F4BACE10005FABC /* JSCocoaFFIClosure.m */; }; + 3DAB54BD0F4BACE10005FABC /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DAB54AB0F4BACE10005FABC /* JSCocoaLib.m */; }; + 3DAB54BE0F4BACE10005FABC /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DAB54AD0F4BACE10005FABC /* JSCocoaPrivateObject.m */; }; + 3DAB54D70F4BB0130005FABC /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAB54D60F4BB0130005FABC /* JavaScriptCore.framework */; }; + 3DD12CB50F66CF9800C523B7 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DAB54880F4BACE10005FABC /* class.js */; }; + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* JSLocalizedString_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSLocalizedString_Prefix.pch; sourceTree = ""; }; + 3D4BC6980F4BB20800C09AFC /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = English; path = English.lproj/strings.js; sourceTree = ""; }; + 3D4BC69D0F4BB21D00C09AFC /* German */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = German; path = German.lproj/strings.js; sourceTree = ""; }; + 3D4BC6B60F4BB27500C09AFC /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = ""; }; + 3D4BC6B70F4BB27500C09AFC /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = ""; }; + 3DAB54860F4BACE10005FABC /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3DAB54870F4BACE10005FABC /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3DAB54880F4BACE10005FABC /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3DAB549F0F4BACE10005FABC /* JSCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa.h; sourceTree = ""; }; + 3DAB54A30F4BACE10005FABC /* JSCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa_Prefix.pch; sourceTree = ""; }; + 3DAB54A40F4BACE10005FABC /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3DAB54A50F4BACE10005FABC /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3DAB54A60F4BACE10005FABC /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3DAB54A70F4BACE10005FABC /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 3DAB54A80F4BACE10005FABC /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3DAB54A90F4BACE10005FABC /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3DAB54AA0F4BACE10005FABC /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLib.h; sourceTree = ""; }; + 3DAB54AB0F4BACE10005FABC /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaLib.m; sourceTree = ""; }; + 3DAB54AC0F4BACE10005FABC /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3DAB54AD0F4BACE10005FABC /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3DAB54D60F4BB0130005FABC /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* JSLocalizedString.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSLocalizedString.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 3DAB54D70F4BB0130005FABC /* JavaScriptCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 3D4BC6B60F4BB27500C09AFC /* ApplicationController.h */, + 3D4BC6B70F4BB27500C09AFC /* ApplicationController.m */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* JSLocalizedString.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* JSLocalizedString */ = { + isa = PBXGroup; + children = ( + 3DAB54850F4BACE10005FABC /* JSCocoa */, + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = JSLocalizedString; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* JSLocalizedString_Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 3D4BC69B0F4BB21300C09AFC /* strings.js */, + 8D1107310486CEB800E47090 /* Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3DAB54D60F4BB0130005FABC /* JavaScriptCore.framework */, + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3DAB54850F4BACE10005FABC /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3DAB54860F4BACE10005FABC /* BridgeSupportController.h */, + 3DAB54870F4BACE10005FABC /* BridgeSupportController.m */, + 3DAB54880F4BACE10005FABC /* class.js */, + 3DAB549F0F4BACE10005FABC /* JSCocoa.h */, + 3DAB54A30F4BACE10005FABC /* JSCocoa_Prefix.pch */, + 3DAB54A40F4BACE10005FABC /* JSCocoaController.h */, + 3DAB54A50F4BACE10005FABC /* JSCocoaController.m */, + 3DAB54A60F4BACE10005FABC /* JSCocoaFFIArgument.h */, + 3DAB54A70F4BACE10005FABC /* JSCocoaFFIArgument.m */, + 3DAB54A80F4BACE10005FABC /* JSCocoaFFIClosure.h */, + 3DAB54A90F4BACE10005FABC /* JSCocoaFFIClosure.m */, + 3DAB54AA0F4BACE10005FABC /* JSCocoaLib.h */, + 3DAB54AB0F4BACE10005FABC /* JSCocoaLib.m */, + 3DAB54AC0F4BACE10005FABC /* JSCocoaPrivateObject.h */, + 3DAB54AD0F4BACE10005FABC /* JSCocoaPrivateObject.m */, + ); + name = JSCocoa; + path = ../JSCocoa; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* JSLocalizedString */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JSLocalizedString" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = JSLocalizedString; + productInstallPath = "$(HOME)/Applications"; + productName = JSLocalizedString; + productReference = 8D1107320486CEB800E47090 /* JSLocalizedString.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JSLocalizedString" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* JSLocalizedString */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D1107260486CEB800E47090 /* JSLocalizedString */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3DD12CB50F66CF9800C523B7 /* class.js in Resources */, + 3D4BC69C0F4BB21300C09AFC /* strings.js in Resources */, + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090 /* main.m in Sources */, + 3DAB54AE0F4BACE10005FABC /* BridgeSupportController.m in Sources */, + 3DAB54BA0F4BACE10005FABC /* JSCocoaController.m in Sources */, + 3DAB54BB0F4BACE10005FABC /* JSCocoaFFIArgument.m in Sources */, + 3DAB54BC0F4BACE10005FABC /* JSCocoaFFIClosure.m in Sources */, + 3DAB54BD0F4BACE10005FABC /* JSCocoaLib.m in Sources */, + 3DAB54BE0F4BACE10005FABC /* JSCocoaPrivateObject.m in Sources */, + 3D4BC6B80F4BB27500C09AFC /* ApplicationController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 1DDD58150DA1D0A300B32029 /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; + 3D4BC69B0F4BB21300C09AFC /* strings.js */ = { + isa = PBXVariantGroup; + children = ( + 3D4BC6980F4BB20800C09AFC /* English */, + 3D4BC69D0F4BB21D00C09AFC /* German */, + ); + name = strings.js; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* 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; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSLocalizedString_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = JSLocalizedString; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSLocalizedString_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = JSLocalizedString; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* 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; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* 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; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JSLocalizedString" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JSLocalizedString" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/jscocoa/JSLocalizedString/JSLocalizedString_Prefix.pch b/jscocoa/JSLocalizedString/JSLocalizedString_Prefix.pch new file mode 100644 index 0000000..bca28bd --- /dev/null +++ b/jscocoa/JSLocalizedString/JSLocalizedString_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'JSLocalizedString' target in the 'JSLocalizedString' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/jscocoa/JSLocalizedString/main.m b/jscocoa/JSLocalizedString/main.m new file mode 100644 index 0000000..889150f --- /dev/null +++ b/jscocoa/JSLocalizedString/main.m @@ -0,0 +1,21 @@ +// +// main.m +// JSLocalizedString +// +// Created by Patrick Geiller on 18/02/09. +// Copyright __MyCompanyName__ 2009. All rights reserved. +// + +#import +#import "JSCocoa.h" + +int main(int argc, char *argv[]) +{ + [[NSAutoreleasePool alloc] init]; + id c = [JSCocoaController sharedController]; + + id path = [[NSBundle mainBundle] pathForResource:@"strings" ofType:@"js"]; +// NSLog(@"%@", path); + [c evalJSFile:path]; + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jscocoa/JSLocalizedString/strings.js b/jscocoa/JSLocalizedString/strings.js new file mode 100644 index 0000000..e0f479f --- /dev/null +++ b/jscocoa/JSLocalizedString/strings.js @@ -0,0 +1,637 @@ + + function log(str) { JSCocoaController.log('' + str) } + + function dumpHash(o) { var str = ''; for (var i in o) str += i + '=' + o[i] + '\n'; return str } + + // A global variable named __jsc__ set by JSCocoaController in each context +// var jsc = JSCocoaController.hasSharedController ? JSCocoaController.sharedController : null + var jsc = __jsc__ + + /* + + Pretty print of ObjC type encodings + http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_13_section_9.html#//apple_ref/doc/uid/TP30001163-CH9-113054 + + */ + + + var encodings = { + 'id' : '@' + ,'class' : '#' + ,'selector' : ':' + ,'char' : 'c' + ,'uchar' : 'C' + ,'short' : 's' + ,'ushort' : 'S' + ,'int' : 'i' + ,'uint' : 'I' + ,'long' : 'l' + ,'ulong' : 'L' + ,'longlong' : 'q' + ,'ulonglong' : 'Q' + ,'float' : 'f' + ,'double' : 'd' + ,'bool' : 'B' + ,'void' : 'v' + ,'undef' : '?' + ,'pointer' : '^' + ,'charpointer' : '*' + } + var reverseEncodings = {} + for (var e in encodings) reverseEncodings[encodings[e]] = e + + + function objc_unary_encoding(encoding) + { + // Structure arg + if (encoding.indexOf(' ') != -1) + { + var structureName = encoding.split(' ')[1] + var structureEncoding = JSCocoaFFIArgument.structureFullTypeEncodingFromStructureName(structureName) + if (!structureEncoding) throw 'no encoding found for structure ' + structureName + + // + // Remove names of variables to keep only encodings + // + // {_NSPoint="x"f"y"f} + // becomes + // {_NSPoint=ff} + // +// JSCocoaController.log('*' + structureEncoding + '*' + String(String(structureEncoding).replace(/"[^"]+"/gi, "")) + '*') + return String(String(structureEncoding).replace(/"[^"]+"/gi, "")) + } + else + { + if (!(encoding in encodings)) + { + // Pointer to an ObjC object ? + var match = encoding.match(/^(\w+)\s*\*$/) + if (match) + { + var className = match[1] + if (className in this && this[className]['class'] == this[className]) return '@' + } + // Structure ? + var structureEncoding = JSCocoaFFIArgument.structureFullTypeEncodingFromStructureName(encoding) + if (structureEncoding) return String(String(structureEncoding).replace(/"[^"]+"/gi, "")) + throw 'invalid encoding : "' + encoding + '"' + } + return encodings[encoding] + } + } + + function objc_encoding() + { + var encoding = objc_unary_encoding(arguments[0]) + encoding += '@:' + + for (var i=1; i 100) return '' + + var str = '' + + if (typeof(o) == 'object' || typeof(o) == 'function') + { + str += '{' + var elements = [] + for (var i in o) + elements.push(i + ':' + describeStruct(o[i], level+1)) + str += elements.join(', ') + str += '}' + } + else + str += o + + return str + } + + + // + // type o + // + function outArgument() + { + var o = JSCocoaOutArgument.instance() + if (arguments.length == 2) o.mateWith({ memoryBuffer : arguments[0], atIndex : arguments[1] }) + return o + } + + function memoryBuffer(types) + { +// return JSCocoaMemoryBuffer.instance() + return JSCocoaMemoryBuffer.instance({ withTypes : types }) + } + + + // + // Dump the call stack with arguments.calle.caller (Called from JSCocoa) + // + // Eric Wendelin's Javascript stacktrace in any browser + // http://eriwen.com/javascript/js-stack-trace/ + // + function dumpCallStack() + { + var maxDumpDepth = 100 + var dumpDepth = 0 + var caller = arguments.callee.caller + // Skip ourselves + caller = caller.caller + + // Build call stack + var stack = [] + while (caller && dumpDepth < maxDumpDepth) + { + var fn = caller.toString() + var fname = fn.substring(fn.indexOf("function") + 9, fn.indexOf("(")) || "anonymous"; + var str = fname + if (caller.arguments.length) + { + str += ' (' + for (var i=0; i +#import "JSCocoaController.h" + +@interface ApplicationController : NSObject { + +} + +@end diff --git a/jscocoa/Multiple JSCocoa instances/ApplicationController.m b/jscocoa/Multiple JSCocoa instances/ApplicationController.m new file mode 100644 index 0000000..159697b --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/ApplicationController.m @@ -0,0 +1,26 @@ +// +// ApplicationController.m +// Multiple JSCocoa instances +// +// Created by Patrick Geiller on 22/01/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "ApplicationController.h" + + +@implementation ApplicationController + + +id classController = nil; + +//- (void)applicationDidFinishLaunching:(id)notif +- (void)awakeFromNib +{ + classController = [[JSCocoa alloc] init]; + + id path = [[NSBundle mainBundle] pathForResource:@"classCode" ofType:@"js"]; + [classController evalJSFile:path]; +} + +@end diff --git a/jscocoa/Multiple JSCocoa instances/English.lproj/Credits.rtf b/jscocoa/Multiple JSCocoa instances/English.lproj/Credits.rtf new file mode 100644 index 0000000..46576ef --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/English.lproj/Credits.rtf @@ -0,0 +1,29 @@ +{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} +{\colortbl;\red255\green255\blue255;} +\paperw9840\paperh8400 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\b\fs24 \cf0 Engineering: +\b0 \ + Some people\ +\ + +\b Human Interface Design: +\b0 \ + Some other people\ +\ + +\b Testing: +\b0 \ + Hopefully not nobody\ +\ + +\b Documentation: +\b0 \ + Whoever\ +\ + +\b With special thanks to: +\b0 \ + Mom\ +} diff --git a/jscocoa/Multiple JSCocoa instances/English.lproj/InfoPlist.strings b/jscocoa/Multiple JSCocoa instances/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..5e45963 Binary files /dev/null and b/jscocoa/Multiple JSCocoa instances/English.lproj/InfoPlist.strings differ diff --git a/jscocoa/Multiple JSCocoa instances/English.lproj/MainMenu.xib b/jscocoa/Multiple JSCocoa instances/English.lproj/MainMenu.xib new file mode 100644 index 0000000..e40ddcb --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/English.lproj/MainMenu.xib @@ -0,0 +1,3026 @@ + + + + 1050 + 9G55 + 677 + 949.43 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + NewApplication + + YES + + + About NewApplication + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide NewApplication + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit NewApplication + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + NSFontManager + + + ApplicationController + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 371 + + + + openDocument: + + + + 372 + + + + printDocument: + + + + 373 + + + + addFontTrait: + + + + 420 + + + + addFontTrait: + + + + 421 + + + + modifyFont: + + + + 422 + + + + orderFrontFontPanel: + + + + 423 + + + + modifyFont: + + + + 424 + + + + raiseBaseline: + + + + 425 + + + + lowerBaseline: + + + + 426 + + + + copyFont: + + + + 427 + + + + subscript: + + + + 428 + + + + superscript: + + + + 429 + + + + tightenKerning: + + + + 430 + + + + underline: + + + + 431 + + + + orderFrontColorPanel: + + + + 432 + + + + useAllLigatures: + + + + 433 + + + + loosenKerning: + + + + 434 + + + + pasteFont: + + + + 435 + + + + unscript: + + + + 436 + + + + useStandardKerning: + + + + 437 + + + + useStandardLigatures: + + + + 438 + + + + turnOffLigatures: + + + + 439 + + + + turnOffKerning: + + + + 440 + + + + alignLeft: + + + + 441 + + + + alignJustified: + + + + 442 + + + + copyRuler: + + + + 443 + + + + alignCenter: + + + + 444 + + + + toggleRuler: + + + + 445 + + + + alignRight: + + + + 446 + + + + pasteRuler: + + + + 447 + + + + terminate: + + + + 448 + + + + delegate + + + + 450 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 374 + + + YES + + + + + + 375 + + + YES + + + + + + + 376 + + + YES + + + + + + 377 + + + YES + + + + + + 378 + + + YES + + + + + + + + + + + + + 379 + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + + + 387 + + + YES + + + + + + + + + + + + + + + + + + + + + 388 + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + YES + + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + YES + + + + + + + + + + 405 + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + YES + + + + + + + + 411 + + + + + 412 + + + + + 413 + + + + + 414 + + + YES + + + + + + + + + 415 + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 449 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 374.IBPluginDependency + 375.IBPluginDependency + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 449.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{197, 734}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{316, 791}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{11, 977}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{328, 608}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{460, 588}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{155, 774}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 450 + + + + YES + + ApplicationController + NSObject + + IBProjectSource + ApplicationController.h + + + + + 0 + ../Multiple JSCocoa instances.xcodeproj + 3 + + diff --git a/jscocoa/Multiple JSCocoa instances/English.lproj/MyDocument.xib b/jscocoa/Multiple JSCocoa instances/English.lproj/MyDocument.xib new file mode 100644 index 0000000..4f0b578 --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/English.lproj/MyDocument.xib @@ -0,0 +1,512 @@ + + + + 1050 + 9G55 + 677 + 949.43 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + MyDocument + + + FirstResponder + + + 15 + 2 + {{133, 373}, {464, 275}} + 1886912512 + Window + NSWindow + View + {3.40282e+38, 3.40282e+38} + {94, 86} + + + 256 + + YES + + + 268 + {{20, 232}, {96, 22}} + + YES + + -1804468671 + 272630784 + + + LucidaGrande + 1.300000e+01 + 1044 + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + + + + 268 + {{140, 232}, {96, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + + + + + + 268 + {{348, 232}, {96, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + + + + + + 268 + {{120, 237}, {15, 17}} + + YES + + 68288064 + 272630784 + + + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + + + + + + 268 + {{250, 231}, {87, 25}} + + YES + + -2080244224 + 134217728 + = + + + -2038152961 + 163 + + + 400 + 75 + + + + + 268 + {{20, 17}, {424, 205}} + + YES + + -1805517311 + 272629760 + + + + YES + + + + + + {464, 275} + + + {{0, 0}, {1440, 878}} + {94, 108} + {3.40282e+38, 3.40282e+38} + + + NSApplication + + + + + YES + + + delegate + + + + 17 + + + + window + + + + 18 + + + + textField1 + + + + 100031 + + + + textField2 + + + + 100032 + + + + textField3 + + + + 100033 + + + + clicked: + + + + 100034 + + + + textField4 + + + + 100037 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + 5 + + + YES + + + + Window + + + 6 + + + YES + + + + + + + + + + + -3 + + + Application + + + 100021 + + + YES + + + + + + 100022 + + + + + 100023 + + + YES + + + + + + 100024 + + + + + 100025 + + + YES + + + + + + 100026 + + + + + 100027 + + + YES + + + + + + 100028 + + + + + 100029 + + + YES + + + + + + 100030 + + + + + 100035 + + + YES + + + + + + 100036 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 100021.IBPluginDependency + 100022.IBPluginDependency + 100023.IBPluginDependency + 100024.IBPluginDependency + 100025.IBPluginDependency + 100026.IBPluginDependency + 100027.IBPluginDependency + 100028.IBPluginDependency + 100029.IBPluginDependency + 100030.IBPluginDependency + 100035.IBPluginDependency + 100036.IBPluginDependency + 5.IBEditorWindowLastContentRect + 5.IBWindowTemplateEditedContentRect + 5.ImportedFromIB2 + 5.editorWindowContentRectSynchronizationRect + 5.windowTemplate.hasMinSize + 5.windowTemplate.minSize + 6.IBPluginDependency + 6.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{133, 373}, {464, 275}} + {{133, 373}, {464, 275}} + + {{201, 387}, {507, 413}} + + {94, 86} + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 100037 + + + + YES + + MyDocument + NSDocument + + clicked: + id + + + YES + + YES + textField1 + textField2 + textField3 + textField4 + + + YES + id + id + id + id + + + + IBProjectSource + MyDocument.h + + + + + 0 + ../Multiple JSCocoa instances.xcodeproj + 3 + + diff --git a/jscocoa/Multiple JSCocoa instances/Info.plist b/jscocoa/Multiple JSCocoa instances/Info.plist new file mode 100644 index 0000000..3cabef5 --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + ???? + + CFBundleTypeIconFile + + CFBundleTypeName + DocumentType + CFBundleTypeOSTypes + + ???? + + CFBundleTypeRole + Editor + NSDocumentClass + MyDocument + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/jscocoa/Multiple JSCocoa instances/Multiple JSCocoa instances.xcodeproj/TemplateIcon.icns b/jscocoa/Multiple JSCocoa instances/Multiple JSCocoa instances.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/jscocoa/Multiple JSCocoa instances/Multiple JSCocoa instances.xcodeproj/TemplateIcon.icns differ diff --git a/jscocoa/Multiple JSCocoa instances/Multiple JSCocoa instances.xcodeproj/project.pbxproj b/jscocoa/Multiple JSCocoa instances/Multiple JSCocoa instances.xcodeproj/project.pbxproj new file mode 100644 index 0000000..494f95f --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/Multiple JSCocoa instances.xcodeproj/project.pbxproj @@ -0,0 +1,379 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58280DA1D0D100B32029 /* MyDocument.xib */; }; + 1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */; }; + 3D3B503B0F1A366900D60188 /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D3B50240F1A366900D60188 /* BridgeSupportController.m */; }; + 3D3B503C0F1A366900D60188 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D3B50250F1A366900D60188 /* class.js */; }; + 3D3B503F0F1A366900D60188 /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D3B50320F1A366900D60188 /* JSCocoaController.m */; }; + 3D3B50400F1A366900D60188 /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D3B50340F1A366900D60188 /* JSCocoaFFIArgument.m */; }; + 3D3B50410F1A366900D60188 /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D3B50360F1A366900D60188 /* JSCocoaFFIClosure.m */; }; + 3D3B50420F1A366900D60188 /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D3B50380F1A366900D60188 /* JSCocoaLib.m */; }; + 3D3B50430F1A366900D60188 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D3B503A0F1A366900D60188 /* JSCocoaPrivateObject.m */; }; + 3D3B50570F1A369B00D60188 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3B50560F1A369B00D60188 /* JavaScriptCore.framework */; }; + 3D3B52140F1BA03400D60188 /* documentCode.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D3B52130F1BA03400D60188 /* documentCode.js */; }; + 3DB064E80F28CE360043C238 /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB064E70F28CE360043C238 /* ApplicationController.m */; }; + 3DB065150F28CEF10043C238 /* classCode.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DB065140F28CEF10043C238 /* classCode.js */; }; + 8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */; }; + 8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165FFE840EACC02AAC07 /* InfoPlist.strings */; }; + 8D15AC310486D014006FF6A4 /* MyDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */; settings = {ATTRIBUTES = (); }; }; + 8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 089C1660FE840EACC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 1DDD58290DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MyDocument.xib; sourceTree = ""; }; + 1DDD582B0DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyDocument.m; sourceTree = ""; }; + 2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyDocument.h; sourceTree = ""; }; + 2A37F4B0FDCFA73011CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = ""; }; + 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32DBCF750370BD2300C91783 /* Multiple JSCocoa instances_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Multiple JSCocoa instances_Prefix.pch"; sourceTree = ""; }; + 3D3B50230F1A366900D60188 /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3D3B50240F1A366900D60188 /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3D3B50250F1A366900D60188 /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3D3B502C0F1A366900D60188 /* JSCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa.h; sourceTree = ""; }; + 3D3B50300F1A366900D60188 /* JSCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa_Prefix.pch; sourceTree = ""; }; + 3D3B50310F1A366900D60188 /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3D3B50320F1A366900D60188 /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3D3B50330F1A366900D60188 /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3D3B50340F1A366900D60188 /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 3D3B50350F1A366900D60188 /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3D3B50360F1A366900D60188 /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3D3B50370F1A366900D60188 /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLib.h; sourceTree = ""; }; + 3D3B50380F1A366900D60188 /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaLib.m; sourceTree = ""; }; + 3D3B50390F1A366900D60188 /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3D3B503A0F1A366900D60188 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3D3B50560F1A369B00D60188 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + 3D3B52130F1BA03400D60188 /* documentCode.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = documentCode.js; sourceTree = ""; }; + 3DB064E60F28CE360043C238 /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = ""; }; + 3DB064E70F28CE360043C238 /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = ""; }; + 3DB065140F28CEF10043C238 /* classCode.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = classCode.js; sourceTree = ""; }; + 8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8D15AC370486D014006FF6A4 /* Multiple JSCocoa instances.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Multiple JSCocoa instances.app"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D15AC330486D014006FF6A4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */, + 3D3B50570F1A369B00D60188 /* JavaScriptCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1058C7A6FEA54F5311CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A8FEA54F5311CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */, + 13E42FBA07B3F13500E4EEF1 /* CoreData.framework */, + 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FB0FE9D524F11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D15AC370486D014006FF6A4 /* Multiple JSCocoa instances.app */, + ); + name = Products; + sourceTree = ""; + }; + 2A37F4AAFDCFA73011CA2CEA /* Multiple JSCocoa instances */ = { + isa = PBXGroup; + children = ( + 3D3B50220F1A366900D60188 /* JSCocoa */, + 2A37F4ABFDCFA73011CA2CEA /* Classes */, + 2A37F4AFFDCFA73011CA2CEA /* Other Sources */, + 2A37F4B8FDCFA73011CA2CEA /* Resources */, + 2A37F4C3FDCFA73011CA2CEA /* Frameworks */, + 19C28FB0FE9D524F11CA2CBB /* Products */, + ); + name = "Multiple JSCocoa instances"; + sourceTree = ""; + }; + 2A37F4ABFDCFA73011CA2CEA /* Classes */ = { + isa = PBXGroup; + children = ( + 3DB064E60F28CE360043C238 /* ApplicationController.h */, + 3DB064E70F28CE360043C238 /* ApplicationController.m */, + 3DB065140F28CEF10043C238 /* classCode.js */, + 3D3B52130F1BA03400D60188 /* documentCode.js */, + 2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */, + 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */, + ); + name = Classes; + sourceTree = ""; + }; + 2A37F4AFFDCFA73011CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32DBCF750370BD2300C91783 /* Multiple JSCocoa instances_Prefix.pch */, + 2A37F4B0FDCFA73011CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 2A37F4B8FDCFA73011CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */, + 8D15AC360486D014006FF6A4 /* Info.plist */, + 089C165FFE840EACC02AAC07 /* InfoPlist.strings */, + 1DDD58280DA1D0D100B32029 /* MyDocument.xib */, + 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */, + ); + name = Resources; + sourceTree = ""; + }; + 2A37F4C3FDCFA73011CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3D3B50560F1A369B00D60188 /* JavaScriptCore.framework */, + 1058C7A6FEA54F5311CA2CBB /* Linked Frameworks */, + 1058C7A8FEA54F5311CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3D3B50220F1A366900D60188 /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3D3B50230F1A366900D60188 /* BridgeSupportController.h */, + 3D3B50240F1A366900D60188 /* BridgeSupportController.m */, + 3D3B50250F1A366900D60188 /* class.js */, + 3D3B502C0F1A366900D60188 /* JSCocoa.h */, + 3D3B50300F1A366900D60188 /* JSCocoa_Prefix.pch */, + 3D3B50310F1A366900D60188 /* JSCocoaController.h */, + 3D3B50320F1A366900D60188 /* JSCocoaController.m */, + 3D3B50330F1A366900D60188 /* JSCocoaFFIArgument.h */, + 3D3B50340F1A366900D60188 /* JSCocoaFFIArgument.m */, + 3D3B50350F1A366900D60188 /* JSCocoaFFIClosure.h */, + 3D3B50360F1A366900D60188 /* JSCocoaFFIClosure.m */, + 3D3B50370F1A366900D60188 /* JSCocoaLib.h */, + 3D3B50380F1A366900D60188 /* JSCocoaLib.m */, + 3D3B50390F1A366900D60188 /* JSCocoaPrivateObject.h */, + 3D3B503A0F1A366900D60188 /* JSCocoaPrivateObject.m */, + ); + name = JSCocoa; + path = ../JSCocoa; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D15AC270486D014006FF6A4 /* Multiple JSCocoa instances */ = { + isa = PBXNativeTarget; + buildConfigurationList = C05733C708A9546B00998B17 /* Build configuration list for PBXNativeTarget "Multiple JSCocoa instances" */; + buildPhases = ( + 8D15AC2B0486D014006FF6A4 /* Resources */, + 8D15AC300486D014006FF6A4 /* Sources */, + 8D15AC330486D014006FF6A4 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Multiple JSCocoa instances"; + productInstallPath = "$(HOME)/Applications"; + productName = "Multiple JSCocoa instances"; + productReference = 8D15AC370486D014006FF6A4 /* Multiple JSCocoa instances.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2A37F4A9FDCFA73011CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "Multiple JSCocoa instances" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 2A37F4AAFDCFA73011CA2CEA /* Multiple JSCocoa instances */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D15AC270486D014006FF6A4 /* Multiple JSCocoa instances */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D15AC2B0486D014006FF6A4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D3B52140F1BA03400D60188 /* documentCode.js in Resources */, + 3DB065150F28CEF10043C238 /* classCode.js in Resources */, + 3D3B503C0F1A366900D60188 /* class.js in Resources */, + 8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */, + 8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */, + 1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */, + 1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D15AC300486D014006FF6A4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D15AC310486D014006FF6A4 /* MyDocument.m in Sources */, + 8D15AC320486D014006FF6A4 /* main.m in Sources */, + 3D3B503B0F1A366900D60188 /* BridgeSupportController.m in Sources */, + 3D3B503F0F1A366900D60188 /* JSCocoaController.m in Sources */, + 3D3B50400F1A366900D60188 /* JSCocoaFFIArgument.m in Sources */, + 3D3B50410F1A366900D60188 /* JSCocoaFFIClosure.m in Sources */, + 3D3B50420F1A366900D60188 /* JSCocoaLib.m in Sources */, + 3D3B50430F1A366900D60188 /* JSCocoaPrivateObject.m in Sources */, + 3DB064E80F28CE360043C238 /* ApplicationController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C165FFE840EACC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C1660FE840EACC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 1DDD58280DA1D0D100B32029 /* MyDocument.xib */ = { + isa = PBXVariantGroup; + children = ( + 1DDD58290DA1D0D100B32029 /* English */, + ); + name = MyDocument.xib; + sourceTree = ""; + }; + 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 1DDD582B0DA1D0D100B32029 /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; + 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */ = { + isa = PBXVariantGroup; + children = ( + 2A37F4BAFDCFA73011CA2CEA /* English */, + ); + name = Credits.rtf; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C05733C808A9546B00998B17 /* 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; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Multiple JSCocoa instances_Prefix.pch"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = "Multiple JSCocoa instances"; + }; + name = Debug; + }; + C05733C908A9546B00998B17 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Multiple JSCocoa instances_Prefix.pch"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = "Multiple JSCocoa instances"; + }; + name = Release; + }; + C05733CC08A9546B00998B17 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_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; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Debug; + }; + C05733CD08A9546B00998B17 /* 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; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C05733C708A9546B00998B17 /* Build configuration list for PBXNativeTarget "Multiple JSCocoa instances" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C05733C808A9546B00998B17 /* Debug */, + C05733C908A9546B00998B17 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "Multiple JSCocoa instances" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C05733CC08A9546B00998B17 /* Debug */, + C05733CD08A9546B00998B17 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2A37F4A9FDCFA73011CA2CEA /* Project object */; +} diff --git a/jscocoa/Multiple JSCocoa instances/Multiple JSCocoa instances_Prefix.pch b/jscocoa/Multiple JSCocoa instances/Multiple JSCocoa instances_Prefix.pch new file mode 100644 index 0000000..4e60927 --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/Multiple JSCocoa instances_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'Multiple JSCocoa instances' target in the 'Multiple JSCocoa instances' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/jscocoa/Multiple JSCocoa instances/MyDocument.h b/jscocoa/Multiple JSCocoa instances/MyDocument.h new file mode 100644 index 0000000..d21e3b5 --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/MyDocument.h @@ -0,0 +1,25 @@ +// +// MyDocument.h +// Multiple JSCocoa instances +// +// Created by Patrick Geiller on 11/01/09. +// Copyright __MyCompanyName__ 2009 . All rights reserved. +// + + +#import +#import "JSCocoa.h" + +@interface MyDocument : NSDocument +{ + JSCocoa* jsc; + + IBOutlet id textField1; + IBOutlet id textField2; + IBOutlet id textField3; + IBOutlet id textField4; +} + +- (IBAction)clicked:(id)sender; + +@end diff --git a/jscocoa/Multiple JSCocoa instances/MyDocument.m b/jscocoa/Multiple JSCocoa instances/MyDocument.m new file mode 100644 index 0000000..45a4099 --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/MyDocument.m @@ -0,0 +1,111 @@ +// +// MyDocument.m +// Multiple JSCocoa instances +// +// Created by Patrick Geiller on 11/01/09. +// Copyright __MyCompanyName__ 2009 . All rights reserved. +// + +#import "MyDocument.h" + +@implementation MyDocument + +- (id)init +{ + self = [super init]; + if (self) { + + // Add your subclass-specific initialization here. + // If an error occurs here, send a [self release] message and return nil. + +// NSLog(@"new document"); + } + return self; +} + +- (void)dealloc +{ + NSLog(@"kill document"); + [jsc release]; + [super dealloc]; +} + +- (IBAction)clicked:(id)sender +{ +// NSLog(@"clicked"); +// NSLog(@"hasJSFunctionNamed('click')=%d", [jsc hasJSFunctionNamed:@"click"]); +// NSLog(@"hasJSFunctionNamed('clicked')=%d", [jsc hasJSFunctionNamed:@"clicked"]); + + if ([jsc hasJSFunctionNamed:@"click"]) [jsc callJSFunctionNamed:@"click" withArguments:nil]; +} + + +- (NSString *)windowNibName +{ + // Override returning the nib file name of the document + // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead. + return @"MyDocument"; +} + +- (void)close +{ + // + [jsc removeObjectWithName:@"document"]; + [jsc unlinkAllReferences]; + [jsc garbageCollect]; + + [super close]; +} + + +- (void)windowControllerDidLoadNib:(NSWindowController *) aController +{ + [super windowControllerDidLoadNib:aController]; + + // Start JSCocoa + + jsc = [[JSCocoa alloc] init]; + + // Set our custom variables + [jsc setObject:textField1 withName:@"field1"]; + [jsc setObject:textField2 withName:@"field2"]; + [jsc setObject:textField3 withName:@"field3"]; + [jsc setObject:textField4 withName:@"field4"]; + NSLog(@"retainCount=%d", [self retainCount]); + [jsc setObject:self withName:@"document"]; + NSLog(@"retainCount=%d", [self retainCount]); + + // Load script + id path = [[NSBundle mainBundle] pathForResource:@"documentCode" ofType:@"js"]; + [jsc evalJSFile:path]; +} + +- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError +{ + // Insert code here to write your document to data of the specified type. If the given outError != NULL, ensure that you set *outError when returning nil. + + // You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead. + + // For applications targeted for Panther or earlier systems, you should use the deprecated API -dataRepresentationOfType:. In this case you can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead. + + if ( outError != NULL ) { + *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; + } + return nil; +} + +- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError +{ + // Insert code here to read your document from the given data of the specified type. If the given outError != NULL, ensure that you set *outError when returning NO. + + // You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead. + + // For applications targeted for Panther or earlier systems, you should use the deprecated API -loadDataRepresentation:ofType. In this case you can also choose to override -readFromFile:ofType: or -loadFileWrapperRepresentation:ofType: instead. + + if ( outError != NULL ) { + *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; + } + return YES; +} + +@end diff --git a/jscocoa/Multiple JSCocoa instances/classCode.js b/jscocoa/Multiple JSCocoa instances/classCode.js new file mode 100644 index 0000000..4e90f54 --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/classCode.js @@ -0,0 +1,22 @@ +/* + + Class code shared by all + +*/ + + + var magic = 0 + + Class('SharedAdder < NSObject').definition = function () + { + Method('add:and:').encoding('int int int').fn = function(a, b) + { + log('Objc class method adding ' + a + ' and ' + b) + log(NSMakeRect(1, 1, 1, 1)); + return a+b+magic + } + } + + + +// log('SharedAdder=' + SharedAdder) diff --git a/jscocoa/Multiple JSCocoa instances/documentCode.js b/jscocoa/Multiple JSCocoa instances/documentCode.js new file mode 100644 index 0000000..7db2877 --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/documentCode.js @@ -0,0 +1,32 @@ +/* + + Code loaded in each document, each having its own global variables + +*/ + + +//log('hello from document ' + document) + + field1.stringValue = Math.round(Math.random()*100) + field2.stringValue = Math.round(Math.random()*100) + function click() + { + var a = parseFloat(field1.stringValue) + var b = parseFloat(field2.stringValue) + var result = a + b + var result = sharedAdder.add_and(a, b) + field3.stringValue = result + + field4.stringValue = ((new Date).getTime()) + ' Added ' + field1 + ' and ' + field2 + ' to ' + field3 + '\n' + field4.stringValue + } + +// log(SharedAdder) + var sharedAdder = SharedAdder.instance() + + var magic = -1000 +/* + log(jsc) + log(__jsc__) + log('HAS=' + ('NSObject2' in this)) + defineClass(actuallyCreateOne) +*/ \ No newline at end of file diff --git a/jscocoa/Multiple JSCocoa instances/main.m b/jscocoa/Multiple JSCocoa instances/main.m new file mode 100644 index 0000000..97b9852 --- /dev/null +++ b/jscocoa/Multiple JSCocoa instances/main.m @@ -0,0 +1,14 @@ +// +// main.m +// Multiple JSCocoa instances +// +// Created by Patrick Geiller on 11/01/09. +// Copyright __MyCompanyName__ 2009 . All rights reserved. +// + +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jscocoa/NSLogConsole from JSCocoa/NSLogConsole.h b/jscocoa/NSLogConsole from JSCocoa/NSLogConsole.h new file mode 100644 index 0000000..64cb986 --- /dev/null +++ b/jscocoa/NSLogConsole from JSCocoa/NSLogConsole.h @@ -0,0 +1,75 @@ +// +// NSLogConsole.h +// NSLogConsole +// +// Created by Patrick Geiller on 16/08/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import +#import + + +void NSLogProlog(char* file, int line); +void NSLogPostLog(char* file, int line); + +@class NSLogConsoleView; + +@interface NSLogConsole : NSObject { + + BOOL autoOpens; + + IBOutlet id window; + IBOutlet NSLogConsoleView* webView; + IBOutlet id searchField; + + int original_stderr; + NSString* logPath; + NSFileHandle* fileHandle; + + unsigned long long fileOffset; + + // Window title + NSString* windowTitle; +} + + ++ (id)sharedConsole; + +- (void)open; +- (void)close; +- (BOOL)isOpen; +- (IBAction)clear:(id)sender; +- (IBAction)searchChanged:(id)sender; +- (id)window; + +- (void)logData:(NSData*)data file:(char*)file lineNumber:(int)line; +- (void)updateLogWithFile:(char*)file lineNumber:(int)line; + +@property BOOL autoOpens; +@property (copy) NSString* windowTitle; + +@end + + +@interface NSWindow(Goodies) +- (void)setBottomCornerRounded:(BOOL)a; +@end + + + +@interface NSLogConsoleView : WebView { + + // A message might trigger console opening, BUT the WebView will take time to load and won't be able to display messages yet. + // Queue them - they will be unqueued when WebView has loaded. + id messageQueue; + + BOOL webViewLoaded; +} + +- (void)logString:(NSString*)string file:(char*)file lineNumber:(int)line; +- (void)clear; +- (void)search:(NSString*)string; + +@end + diff --git a/jscocoa/NSLogConsole from JSCocoa/NSLogConsole.html b/jscocoa/NSLogConsole from JSCocoa/NSLogConsole.html new file mode 100644 index 0000000..481a5f9 --- /dev/null +++ b/jscocoa/NSLogConsole from JSCocoa/NSLogConsole.html @@ -0,0 +1,310 @@ + + + + + + + + +
No messages
+
No results
+
+ + + + + +
+ +
+
+ + + + diff --git a/jscocoa/NSLogConsole from JSCocoa/NSLogConsole.m b/jscocoa/NSLogConsole from JSCocoa/NSLogConsole.m new file mode 100644 index 0000000..d0a8ef5 --- /dev/null +++ b/jscocoa/NSLogConsole from JSCocoa/NSLogConsole.m @@ -0,0 +1,326 @@ +// +// NSLogConsole.m +// NSLogConsole +// +// Created by Patrick Geiller on 16/08/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "NSLogConsole.h" +#import + + +BOOL inited = NO; + + +void NSLogPostLog(char* file, int line) +{ + if (!inited) return; + [[NSLogConsole sharedConsole] updateLogWithFile:file lineNumber:line]; +} + + + +@implementation NSLogConsole + +@synthesize autoOpens, windowTitle; + + ++ (id)sharedConsole +{ + static id singleton = NULL; + @synchronized(self) + { + if (!singleton) + { + singleton = [self alloc]; + [singleton init]; + } + } + return singleton; +} + +// +// Init : should only be called once by sharedConsole +// +- (id)init +{ + id o = [super init]; + autoOpens = YES; + logPath = NULL; + inited = YES; + + // Save stderr + original_stderr = dup(STDERR_FILENO); + + logPath = [NSString stringWithFormat:@"%@%@.log.txt", NSTemporaryDirectory(), [[NSBundle mainBundle] bundleIdentifier]]; + [logPath retain]; + + // Create the file — NSFileHandle doesn't do it ! + [@"" writeToFile:logPath atomically:YES encoding:NSUTF8StringEncoding error:nil]; + fileHandle = [NSFileHandle fileHandleForWritingAtPath:logPath]; + if (!fileHandle) NSLog(@"Opening log at %@ failed", logPath); + + [fileHandle retain]; + int fd = [fileHandle fileDescriptor]; + + // Redirect stderr + int err = dup2(fd, STDERR_FILENO); + if (!err) NSLog(@"Couldn't redirect stderr"); + + fileOffset = 0; + + [fileHandle readInBackgroundAndNotify]; +// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dataAvailable:) name:NSFileHandleReadCompletionNotification object: fileHandle]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dataAvailable2:) name:nil object:nil]; + + return o; +} + +// NSLog will generate an event posted in the next run loop run +- (void)dataAvailable:(NSNotification *)aNotification +{ +// NSData *data = [[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem]; + [[NSLogConsole sharedConsole] updateLogWithFile:"" lineNumber:0]; +} + +- (void)dataAvailable2:(NSNotification *)aNotification +{ +// NSData *data = [[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem]; +// NSLog(@"%@", aNotification); + printf("****************\n"); + printf("%s\n", [[aNotification description] UTF8String]); +} + + +- (void)dealloc +{ + [windowTitle release]; + [logPath release]; + [fileHandle release]; + [super dealloc]; +} + +- (void)open +{ + if (!window) + { + if (![NSBundle loadNibNamed:@"NSLogConsole" owner:self]) + { + NSLog(@"NSLogConsole.nib not loaded"); + return; + } + if ([window respondsToSelector:@selector(setBottomCornerRounded:)]) + [window setBottomCornerRounded:NO]; + } + if (windowTitle) [window setTitle:windowTitle]; + [window orderFront:self]; +} +- (void)close +{ + [window orderOut:self]; +} +- (BOOL)isOpen +{ + return [window isVisible]; +} + +- (IBAction)clear:(id)sender +{ + [webView clear]; +} +- (IBAction)searchChanged:(id)sender +{ + [webView search:[sender stringValue]]; +} + +- (id)window +{ + return window; +} + +// +// Read log data from handle +// +- (void)updateLogWithFile:(char*)file lineNumber:(int)line +{ + if (![window isVisible] && autoOpens) [self open]; + + + // Open a new handle to read new data + id f = [NSFileHandle fileHandleForReadingAtPath:logPath]; + if (!f) NSLog(@"Opening log at %@ failed", logPath); + + // Get file length + [f seekToEndOfFile]; + unsigned long long length = [f offsetInFile]; + + // Read data + [f seekToFileOffset:fileOffset]; + NSData* data = [f readDataToEndOfFile]; + [self logData:data file:file lineNumber:line]; + + // We'll read from that offset next time + fileOffset = length; +} + +// +// Log data to webview and original stderr +// +- (void)logData:(NSData*)data file:(char*)file lineNumber:(int)line +{ + if (![window isVisible] && autoOpens) [self open]; + + id str = [[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding]; +// [[NSAlert alertWithMessageText:@"hello" defaultButton:@"Furthe" alternateButton:nil otherButton:nil informativeTextWithFormat:str] runModal]; + // Write back to original stderr + write(original_stderr, [data bytes], [data length]); + // Clear search + [searchField setStringValue:@""]; + [webView search:@""]; + // Log string + [webView logString:str file:file lineNumber:line]; + + [str release]; +} + + + +@end + + + + + + + + + + + +@implementation NSLogConsoleView + + +- (void)dealloc +{ + [messageQueue release]; + [super dealloc]; +} + +- (BOOL)drawsBackground +{ + return NO; +} + +- (void)awakeFromNib +{ + messageQueue = [[NSMutableArray alloc] init]; + webViewLoaded = NO; + + // Frame load + [self setFrameLoadDelegate:self]; + + // Load html page + id path = [[NSBundle mainBundle] pathForResource:@"NSLogConsole" ofType:@"html"]; + [[self mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]]]; + + // Navigation notification + [self setPolicyDelegate:self]; +} + +// +// Javascript is available +// Register our custom javascript object in the hosted page +// +- (void)webView:(WebView *)view windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject +{ + [windowScriptObject setValue:self forKey:@"NSLogConsoleView"]; +} + +// +// WebView has finished loading +// +- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame +{ + webViewLoaded = YES; + + // Flush message queue + for (id o in messageQueue) + [self logString:[o valueForKey:@"string"] file:(char*)[[o valueForKey:@"file"] UTF8String] lineNumber:[[o valueForKey:@"line"] intValue]]; + [messageQueue release]; +} + +// +// Notify WebView of new message +// +- (void)logString:(NSString*)string file:(char*)file lineNumber:(int)line +{ + // Queue message if WebView has not finished loading + if (!webViewLoaded) + { + id o = [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithString:string], @"string", + [NSString stringWithUTF8String:file], @"file", + [NSNumber numberWithInt:line], @"line", + nil]; + [messageQueue addObject:o]; + return; + } + [[self windowScriptObject] callWebScriptMethod:@"log" withArguments:[NSArray arrayWithObjects:string, + [NSString stringWithUTF8String:file], + [NSNumber numberWithInt:line], + nil]]; +} + +// +// Open source file in XCode at correct line number +// +- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation + request:(NSURLRequest *)request + frame:(WebFrame *)frame + decisionListener:(id)listener +{ + // Get path, formed by AbsolutePathOnDisk(space)LineNumber + NSString* pathAndLineNumber = [[request URL] path]; + + // From end of string, skip to space before number + char* s = (char*)[pathAndLineNumber UTF8String]; + char* s2 = s+strlen(s)-1; + while (*s2 && *s2 != ' ' && s2 > s) s2--; + if (*s2 != ' ') return NSLog(@"Did not find line number in %@", pathAndLineNumber); + + // Patch a zero to recover path + *s2 = 0; + + // Get line number + int line; + BOOL foundLine = [[NSScanner scannerWithString:[NSString stringWithUTF8String:s2+1]] scanInt:&line]; + if (!foundLine) return NSLog(@"Did not parse line number in %@", pathAndLineNumber); + + // Get path + NSString* path = [NSString stringWithUTF8String:s]; +// NSLog(@"opening line %d of _%@_", line, path); + + // Open in XCode + id source = [NSString stringWithFormat:@"tell application \"Xcode\" \n\ + set doc to open \"%@\" \n\ + set selection to paragraph (%d) of contents of doc \n\ + end tell", path, line]; + id script = [[NSAppleScript alloc] initWithSource:source]; + [script executeAndReturnError:nil]; + [script release]; +} + + +- (void)clear +{ + [[self windowScriptObject] callWebScriptMethod:@"clear" withArguments:nil]; +} + +- (void)search:(NSString*)string +{ + [[self windowScriptObject] callWebScriptMethod:@"search" withArguments:[NSArray arrayWithObjects:string, nil]]; +} + + +@end + diff --git a/jscocoa/ProcessViewer/English.lproj/InfoPlist.strings b/jscocoa/ProcessViewer/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..cc2655a Binary files /dev/null and b/jscocoa/ProcessViewer/English.lproj/InfoPlist.strings differ diff --git a/jscocoa/ProcessViewer/English.lproj/MainMenu.nib/designable.nib b/jscocoa/ProcessViewer/English.lproj/MainMenu.nib/designable.nib new file mode 100644 index 0000000..5a3f91b --- /dev/null +++ b/jscocoa/ProcessViewer/English.lproj/MainMenu.nib/designable.nib @@ -0,0 +1,2428 @@ + + + + 0 + 9F33 + 629 + 949.34 + 352.00 + + YES + + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + NSApplication + + + FirstResponder + + + + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + + NSMenuMixedState + + submenuAction: + + + + YES + + + About NewApplication + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide NewApplication + h + 1048576 + 2147483647 + + + + + + Hide Others + + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit NewApplication + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + Smart Copy/Paste + + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + + 1048576 + 2147483647 + + + 2 + + + + Smart Links + + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Show Colors + C + 1179648 + 2147483647 + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + Show Toolbar + + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 271 + 2 + {{153, 335}, {800, 400}} + 1946157056 + JS Core Animation + ProcessWindow + + + + 256 + + YES + + + 274 + {800, 400} + + + ProcessView + + + {800, 400} + + + + {{0, 0}, {1920, 1178}} + + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + orderFrontColorPanel: + + + + 361 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + terminate: + + + + 369 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 299 + + + YES + + + + + + 300 + + + YES + + + + + + + 344 + + + + + 345 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + YES + + + + + + 375 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 299.IBPluginDependency + 300.IBPluginDependency + 300.editorWindowContentRectSynchronizationRect + 344.IBPluginDependency + 345.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBPluginDependency + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 372.IBPluginDependency + 375.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + + + + + + + + {{493, 955}, {216, 23}} + + + + + + + + + {{522, 812}, {146, 23}} + + + + + + + {{436, 809}, {64, 6}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{608, 612}, {275, 83}} + + + + + + + + + + + {{187, 434}, {243, 243}} + + + + + + + + + + + + + + + {{608, 612}, {167, 43}} + + + + + + + + + + + + + + + + + {{608, 612}, {241, 103}} + + + + + + + + + + + {{469, 816}, {197, 73}} + + + {74, 862} + {{123, 889}, {478, 20}} + + + {{475, 832}, {234, 43}} + + + + + {{231, 634}, {176, 43}} + + + + + + + + + {{608, 612}, {215, 63}} + + + + + + + + {{342, 244}, {800, 400}} + + {{342, 244}, {800, 400}} + + + + + + + + + {{23, 794}, {245, 183}} + + + + + + + + + + + + + + + + + + + + + {{145, 474}, {199, 203}} + + + + + + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 411 + + + + YES + + + 0 + ../../JSCoreAnimation.xcodeproj + 3 + + YnBsaXN0MDDUAAEAAgADAAQABQAGAAkAClgkdmVyc2lvblQkdG9wWSRhcmNoaXZlclgkb2JqZWN0cxIA +AYag0QAHAAhdSUIub2JqZWN0ZGF0YYABXxAPTlNLZXllZEFyY2hpdmVyrxECFgALAAwAMQA1ADYAPAA9 +AEIAWABZAFoAWwALAGkAbQB1AHYAdwB8AHUACwCAAIIAgwCEAIcAiwC1ALsAywDSANMA2ADZANoA3QDh +AOIA5QDmAOoA7gD1APkA+gD7AP8BBgELAQwBDQEOARIBGgEbARwBIAEnASsBLAEtATEBOAE9AT4BPwFD +AUsBTwFQAVEBUgFWAV0BYQFiAWMBZwFuAXIBcwF0AXgBgQGFAYYBhwGIAYwBkwGUAZUBlgGaAaEBogGj +AaQBqAGvAbABsQGyAbYBvQG+Ab8BwwHKAcsBzAHNAdEB2AHcAd0B3gHfAeMB6gHuAe8B8AH0AfsB/AH9 +Af4CAgIJAg0CDgIPAhACFAIbAhwCHQIeAiICKQIqAisCLAIwAjcCOAI5AjoCQAJHAkgCSQJNAlYCVwJY +AlkCXQJlAmYCZwJoAmwCcwJ0AnUCeQKAAoECggKDAocCjgKPApACkQKVApwCnQKeAp8CowKqAqsCrAKt +ArECuAK5AroCvgLFAsYCxwLIAswC0wLUAtUC1gLaAuEC4gLjAuQC6ALvAvAC8QL1AvwC/QL+AwIDCQMK +AwsDDAMQAxcDGAMZAxoDHgMlAyYDJwMoA38DgAOFA4cDkgOTA5oDmwOpA7QDtQO2A7oDuwPEA80D0gPT +A9YD1wPYA+YD7wP2A/cD+AQBA7UECgQTBBwEHQQeBCUEJgQvA7UENAQ1BDoEOwRFA7UETgRXA7UEWARo +BHEEegSDA7UEhASMBJMElASbBJwEpASlBKYDtQSvBLgDtQS5BL8DtQTIBNEDtQTSBNcE3gTfA7UE6AO1 +BPEE+gO1BPsE/wUABQMFBQVcBbQGDAYNBg4GDwYQBhEGEgYTBhQGFQYWBhcGGAYZBhoGGwYcBh0GHgYf +BiAGIQYiBiMGJAYlBiYGJwYoBikGKgYrBiwGLQYuBi8GMAYxBjIGMwY0BjUGNgY3BjgGOQY6BjsGPAY9 +Bj4GPwZABkEGQgZDBkQGRQZGBkcGSAZJBkoGSwZMBk0GTgZPBlAGUQZSBlMGVAZVBlYGVwZYBlkGWgZb +BlwGXQZeBl8GYAZhBmQGZwbmB2UHZgdnB2gHaQdqB2sHbAdtB24HbwdwB3EHcgdzB3QHdQd2B3cHeAd5 +B3oHewd8B30Hfgd/B4AHgQeCB4MHhAeFB4YHhweIB4kHigeLB4wHjQeOB48HkAeRB5IHkweUB5UHlgeX +B5gHmQeaB5sHnAedB54HnwegB6EHogejB6QHpQemB6cHqAepB6oHqwesB60HrgevB7AHsQeyB7MHtAe1 +B7YHtwe4B7kHuge7B7wHvQe+B78HwAfBB8IHwwfEB8UHxgfHB8gHyQfKB8sHzAfNB84HzwfQB9EH0gfT +B9QH1QfWB9cH2AfZB9oH2wfcB90H3gffB+AH4QfkB+cH6lUkbnVsbN8QEgANAA4ADwAQABEAEgATABQA +FQAWABcAGAAZABoAGwAcAB0AHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArACwALQAuAC8AMFZOU1Jv +b3RWJGNsYXNzXU5TT2JqZWN0c0tleXNfEA9OU0NsYXNzZXNWYWx1ZXNfEBlOU0FjY2Vzc2liaWxpdHlP +aWRzVmFsdWVzXU5TQ29ubmVjdGlvbnNbTlNOYW1lc0tleXNbTlNGcmFtZXdvcmtdTlNDbGFzc2VzS2V5 +c1pOU09pZHNLZXlzXU5TTmFtZXNWYWx1ZXNfEBlOU0FjY2Vzc2liaWxpdHlDb25uZWN0b3JzXU5TRm9u +dE1hbmFnZXJfEBBOU1Zpc2libGVXaW5kb3dzXxAPTlNPYmplY3RzVmFsdWVzXxAXTlNBY2Nlc3NpYmls +aXR5T2lkc0tleXNZTlNOZXh0T2lkXE5TT2lkc1ZhbHVlc4ACgQIVgOSBAZOBAhSAGoEBO4AFgQGSgQGU +gQE8gQISgACABoEBOoECExEBnYEBldIADgAyADMANFtOU0NsYXNzTmFtZYAEgANdTlNBcHBsaWNhdGlv +btIANwA4ADkAOlgkY2xhc3Nlc1okY2xhc3NuYW1logA6ADteTlNDdXN0b21PYmplY3RYTlNPYmplY3Rf +EBBJQkNvY29hRnJhbWV3b3Jr0gAOAD4APwBAWk5TLm9iamVjdHOAGaEAQYAH2wBDAA4ARABFAEYARwBI +AEkASgBLAEwATQBOAE8AUABRAFIAUwBUAFUAVgArXE5TV2luZG93Vmlld1xOU1NjcmVlblJlY3RfEBNO +U0ZyYW1lQXV0b3NhdmVOYW1lXU5TV2luZG93VGl0bGVZTlNXVEZsYWdzXU5TV2luZG93Q2xhc3NcTlNX +aW5kb3dSZWN0XxAPTlNXaW5kb3dCYWNraW5nXxARTlNXaW5kb3dTdHlsZU1hc2tbTlNWaWV3Q2xhc3OA +C4AYgBaAF4AJEnQAAACACoAIEAIRAQ+AAF8QGHt7MTUzLCAzMzV9LCB7ODAwLCA0MDB9fV8QEUpTIENv +cmUgQW5pbWF0aW9uXVByb2Nlc3NXaW5kb3fXAFwADgBdAF4AXwBgAGEAYgBjAGQAZQBmAGIAaF8QD05T +TmV4dFJlc3BvbmRlclpOU1N1YnZpZXdzWE5TdkZsYWdzW05TRnJhbWVTaXplWE5TV2luZG93W05TU3Vw +ZXJ2aWV3gAyAFYANEQEAgBOADIAU0gAOAD4AagBrgBKhAGyADtcAXAAOAF4AXwBgADIAYQBNAG8AcABx +AGIAcwBNgAuAEREBEoAPgAyAEIALWns4MDAsIDQwMH1bUHJvY2Vzc1ZpZXfSADcAOAB4AHmkAHkAegB7 +ADtcTlNDdXN0b21WaWV3Vk5TVmlld1tOU1Jlc3BvbmRlctIANwA4AH0AfqMAfgB/ADteTlNNdXRhYmxl +QXJyYXlXTlNBcnJhedIANwA4AIEAeqMAegB7ADtfEBZ7ezAsIDB9LCB7MTkyMCwgMTE3OH19UNIANwA4 +AIUAhqIAhgA7XxAQTlNXaW5kb3dUZW1wbGF0ZdIANwA4AIgAiaMAiQCKADtcTlNNdXRhYmxlU2V0VU5T +U2V00gAOAD4AagCNgBKvECcAjgCPAJAAkQCSAJMAlACVAJYAlwCYAJkAmgCbAJwAnQCeAJ8AoAChAKIA +owCkAKUApgCnAKgAqQCqAKsArACtAK4ArwCwALEAsgCzALSAG4AogC2AM4A3gDyAQYBHgEyAUYBXgFyA +YYBmgGqAb4B1gHqAf4CFgIqAj4CUgJiAnYCigKaAq4CwgLWAuoC+gMOAyIDNgNGA1YDagN/TAA4AtgC3 +ALgAuQC6WE5TU291cmNlV05TTGFiZWyAJ4AcgCbYAA4AvAC9AL4AvwDAAMEAwgDDAMQAxQBQAMcAyADJ +AMpXTlNUaXRsZV8QEU5TS2V5RXF1aXZNb2RNYXNrWk5TS2V5RXF1aXZdTlNNbmVtb25pY0xvY1lOU09u +SW1hZ2VcTlNNaXhlZEltYWdlVk5TTWVudYAlgB4SABAAAIAXEn////+AH4AjgB3UAA4AvADMAM0AzgDP +ANAA0VZOU05hbWVbTlNNZW51SXRlbXOA54DugPGA8FpDbGVhciBNZW510wAOADIA1ADVANYA115OU1Jl +c291cmNlTmFtZYAigCCAIVdOU0ltYWdlXxAPTlNNZW51Q2hlY2ttYXJr0gA3ADgA2wDcogDcADtfEBBO +U0N1c3RvbVJlc291cmNl0wAOADIA1ADVANYA4IAigCCAJF8QEE5TTWVudU1peGVkU3RhdGXSADcAOADj +AOSiAOQAO1pOU01lbnVJdGVtXxAVY2xlYXJSZWNlbnREb2N1bWVudHM60gA3ADgA5wDoowDoAOkAO18Q +FU5TTmliQ29udHJvbENvbm5lY3Rvcl5OU05pYkNvbm5lY3RvctMADgC2ALcAuADsAO2AJ4ApgCzYAA4A +vAC9AL4AvwDAAMEAwgDDAPAAxQBQAMcAyADJAPSAJYArgBeAH4AjgCrTAA4AvADNAM4A9wD4gOeBAQqB +AQtvEBIAQwB1AHMAdABvAG0AaQB6AGUAIABUAG8AbwBsAGIAYQByICZfEB9ydW5Ub29sYmFyQ3VzdG9t +aXphdGlvblBhbGV0dGU60wAOALYAtwC4AP0A/oAngC6AMtgADgC8AL0AvgC/AMAAwQDCAMMBAQDFAQIA +xwDIAMkBBYAlgDCAMYAfgCOAL9QADgC8AMwAzQDOAQgBCQEKgOeA+IEBA4D5XxATSGlkZSBOZXdBcHBs +aWNhdGlvblFoVWhpZGU60wAOALYAtwC4ARABEYAngDSANtgADgC8AL0AvgC/AMAAwQDCAMMBFAEVAQIA +xwDIAMkBBYAlgDUSABgAAIAxgB+AI4AvW0hpZGUgT3RoZXJzXxAWaGlkZU90aGVyQXBwbGljYXRpb25z +OtMADgC2ALcAuAEeAR+AJ4A4gDvYAA4AvAC9AL4AvwDAAMEAwgDDASIAxQBQAMcAyADJASaAJYA6gBeA +H4AjgDnTAA4AvADNAM4BKQEqgOeBARGBARNWRGVsZXRlV2RlbGV0ZTrTAA4AtgC3ALgBLwEwgCeAPYBA +2AAOALwAvQC+AL8AwADBAMIAwwEzAMUAUADHAMgAyQE3gCWAP4AXgB+AI4A+1AAOALwAzADNAM4BOgE7 +ATyA54EBBIEBBoEBBV8QEkJyaW5nIEFsbCB0byBGcm9udF8QD2FycmFuZ2VJbkZyb250OtMADgC2ALcA +uAFBAUKAJ4BCgEbYAA4AvAC9AL4AvwDAAMEAwgDDAUUBRgFHAMcAyADJAUqAJYBEEgASAACARYAfgCOA +Q9MADgC8AM0AzgFNAU6A54EBKoEBLFtTaG93IENvbG9yc1FDXxAVb3JkZXJGcm9udENvbG9yUGFuZWw6 +0wAOALYAtwC4AVQBVYAngEiAS9cADgC8AL4AvwDAAMEAwgDDAVgAUADHAMgAyQFcgCWASoAXgB+AI4BJ +0wAOALwAzQDOAV8BYIDngOuA7F8QD1JldmVydCB0byBTYXZlZF8QFnJldmVydERvY3VtZW50VG9TYXZl +ZDrTAA4AtgC3ALgBZQFmgCeATYBQ2AAOALwAvQC+AL8AwADBAMIAwwFpAMUAUADHAMgAyQFtgCWAT4AX +gB+AI4BO0wAOALwAzQDOAXABcYDngOWA5l1TdG9wIFNwZWFraW5nXXN0b3BTcGVha2luZzrTAA4AtgC3 +ALgBdgF3gCeAUoBW2QAOALwAvQC+AL8AwADBAMIBeQDDAXsAxQF8AMcAyADJAX8BgFVOU1RhZ4AlgFSA +VYAfgCOAUxAB0wAOALwAzQDOAYMBhIDngQEkgQEmXxAQU21hcnQgQ29weS9QYXN0ZVFmXxAYdG9nZ2xl +U21hcnRJbnNlcnREZWxldGU60wAOALYAtwC4AYoBi4AngFiAW9gADgC8AL0AvgC/AMAAwQDCAMMBjgDF +AY8AxwDIAMkBJoAlgFmAWoAfgCOAOVRVbmRvUXpVdW5kbzrTAA4AtgC3ALgBmAGZgCeAXYBg2AAOALwA +vQC+AL8AwADBAMIAwwGcAMUBnQDHAMgAyQE3gCWAXoBfgB+AI4A+WE1pbmltaXplUW1fEBNwZXJmb3Jt +TWluaWF0dXJpemU60wAOALYAtwC4AaYBp4AngGKAZdgADgC8AL0AvgC/AMAAwQDCAMMBqgDFAasAxwDI +AMkBJoAlgGOAZIAfgCOAOVNDdXRReFRjdXQ60wAOALYAtwC4AbQBtYAngGeAadgADgC8AL0AvgC/AMAA +wQDCAMMBuADFAFAAxwDIAMkBbYAlgGiAF4AfgCOATl5TdGFydCBTcGVha2luZ15zdGFydFNwZWFraW5n +OtMADgC2ALcAuAHBAcKAJ4BrgG7YAA4AvAC9AL4AvwDAAMEAwgDDAcUAxQHGAMcAyADJASaAJYBsgG2A +H4AjgDlaU2VsZWN0IEFsbFFhWnNlbGVjdEFsbDrTAA4AtgC3ALgBzwHQgCeAcIB02AAOALwAvQC+AL8A +wADBAMIAwwHTAMUB1ADHAMgAyQHXgCWAcoBzgB+AI4Bx0wAOALwAzQDOAdoB24DngQE0gQE2XxATTmV3 +QXBwbGljYXRpb24gSGVscFE/WXNob3dIZWxwOtMADgC2ALcAuAHhAeKAJ4B2gHnZAA4AvAC9AL4AvwDA +AMEAwgF5AMMB5QDFAXwAxwDIAMkB6QGAgCWAeIBVgB+AI4B30wAOALwAzQDOAewB7YDngQEXgQEZZQBG +AGkAbgBkICZfEBdwZXJmb3JtRmluZFBhbmVsQWN0aW9uOtMADgC2ALcAuAHyAfOAJ4B7gH7YAA4AvAC9 +AL4AvwDAAMEAwgDDAfYAxQH3AMcAyADJAVyAJYB8gH2AH4AjgElUU2F2ZVFzXXNhdmVEb2N1bWVudDrT +AA4AtgC3ALgCAAIBgCeAgICE2AAOALwAvQC+AL8AwADBAMIAwwIEAMUCBQDHAMgAyQIIgCWAgoCDgB+A +I4CB0wAOALwAzQDOAgsCDIDngOmA6m4AUwBoAG8AdwAgAFMAcABlAGwAbABpAG4AZyAmUTpfEA9zaG93 +R3Vlc3NQYW5lbDrTAA4AtgC3ALgCEgITgCeAhoCJ2AAOALwAvQC+AL8AwADBAMIAwwIWAUYCFwDHAMgA +yQFcgCWAh4CIgB+AI4BJaABTAGEAdgBlACAAQQBzICZRU18QD3NhdmVEb2N1bWVudEFzOtMADgC2ALcA +uAIgAiGAJ4CLgI7YAA4AvAC9AL4AvwDAAMEAwgDDAiQAxQIlAMcAyADJAemAJYCMgI2AH4AjgHdfEBFK +dW1wIHRvIFNlbGVjdGlvblFqXxAdY2VudGVyU2VsZWN0aW9uSW5WaXNpYmxlQXJlYTrTAA4AtgC3ALgC +LgIvgCeAkICT2AAOALwAvQC+AL8AwADBAMIAwwIyAMUCMwDHAMgAyQFcgCWAkYCSgB+AI4BJVUNsb3Nl +UXddcGVyZm9ybUNsb3NlOtQADgI7ALYAtwC4AB8CPgI/XU5TRGVzdGluYXRpb26AJ4ACgJWAl9cADgC8 +AL4AvwDAAMEAwgDDAkIAUADHAMgAyQEFgCWAloAXgB+AI4AvXxAUQWJvdXQgTmV3QXBwbGljYXRpb25f +EB1vcmRlckZyb250U3RhbmRhcmRBYm91dFBhbmVsOtMADgC2ALcAuAJLAkyAJ4CZgJzZAA4CTgC8AL0A +vgC/AMAAwQDCAMMAUAJRAUYCUgDHAMgAyQFcWU5TVG9vbFRpcIAlgBeAmoCbgB+AI4BJXVBhZ2UgU2V0 +dXAuLi5RUF5ydW5QYWdlTGF5b3V0OtMADgC2ALcAuAJbAlyAJ4CegKHZAA4AvAC9AL4AvwDAAMEAwgF5 +AMMCXwFGAmAAxwDIAMkBfwJkgCWAn4CggB+AI4BTEANbU21hcnQgTGlua3NRR18QHXRvZ2dsZUF1dG9t +YXRpY0xpbmtEZXRlY3Rpb2460wAOALYAtwC4AmoCa4AngKOApdgADgC8AL0AvgC/AMAAwQDCAMMCbgDF +AFAAxwDIAMkBBYAlgKSAF4AfgCOAL1hTaG93IEFsbF8QFnVuaGlkZUFsbEFwcGxpY2F0aW9uczrTAA4A +tgC3ALgCdwJ4gCeAp4Cq2AAOALwAvQC+AL8AwADBAMIAwwJ7AMUCfADHAMgAyQFcgCWAqICpgB+AI4BJ +ZgBQAHIAaQBuAHQgJlFwVnByaW50OtMADgC2ALcAuAKFAoaAJ4CsgK/ZAA4AvAC9AL4AvwDAAMEAwgF5 +AMMCiQDFAooAxwDIAMkBfwBVgCWArYCugB+AI4BTXFNtYXJ0IFF1b3Rlc1FnXxAhdG9nZ2xlQXV0b21h +dGljUXVvdGVTdWJzdGl0dXRpb2460wAOALYAtwC4ApMClIAngLGAtNgADgC8AL0AvgC/AMAAwQDCAMMC +lwDFApgAxwDIAMkBJoAlgLKAs4AfgCOAOVRDb3B5UWNVY29weTrTAA4AtgC3ALgCoQKigCeAtoC52AAO +ALwAvQC+AL8AwADBAMIAwwKlAMUCpgDHAMgAyQFcgCWAt4C4gB+AI4BJU05ld1FuXG5ld0RvY3VtZW50 +OtMADgC2ALcAuAKvArCAJ4C7gL3YAA4AvAC9AL4AvwDAAMEAwgDDArMAxQBQAMcAyADJAgiAJYC8gBeA +H4AjgIFfEBtDaGVjayBTcGVsbGluZyBXaGlsZSBUeXBpbmdfEB50b2dnbGVDb250aW51b3VzU3BlbGxD +aGVja2luZzrTAA4AtgC3ALgCvAK9gCeAv4DC2AAOALwAvQC+AL8AwADBAMIAwwLAAMUCwQDHAMgAyQEm +gCWAwIDBgB+AI4A5VVBhc3RlUXZWcGFzdGU60wAOALYAtwC4AsoCy4AngMSAx9gADgC8AL0AvgC/AMAA +wQDCAMMCzgDFAs8AxwDIAMkCCIAlgMWAxoAfgCOAgV5DaGVjayBTcGVsbGluZ1E7XmNoZWNrU3BlbGxp +bmc60wAOALYAtwC4AtgC2YAngMmAzNgADgC8AL0AvgC/AMAAwQDCAMMC3AEVAt0AxwDIAMkA9IAlgMqA +y4AfgCOAKlxTaG93IFRvb2xiYXJRdF8QE3RvZ2dsZVRvb2xiYXJTaG93bjrTAA4AtgC3ALgC5gLngCeA +zoDQ2AAOALwAvQC+AL8AwADBAMIAwwLqAMUAUADHAMgAyQE3gCWAz4AXgB+AI4A+VFpvb21ccGVyZm9y +bVpvb2060wAOALYAtwC4AvMC9IAngNKA1NgADgC8AL0AvgC/AMAAwQDCAMMC9wDFAFAAxwDIAMkCCIAl +gNOAF4AfgCOAgV8QG0NoZWNrIEdyYW1tYXIgV2l0aCBTcGVsbGluZ18QFnRvZ2dsZUdyYW1tYXJDaGVj +a2luZzrTAA4AtgC3ALgDAAMBgCeA1oDZ2AAOALwAvQC+AL8AwADBAMIAwwMEAMUDBQDHAMgAyQFcgCWA +14DYgB+AI4BJZQBPAHAAZQBuICZRb11vcGVuRG9jdW1lbnQ60wAOALYAtwC4Aw4DD4AngNuA3tgADgC8 +AL0AvgC/AMAAwQDCAMMDEgDFAxMAxwDIAMkBBYAlgNyA3YAfgCOAL18QE1F1aXQgTmV3QXBwbGljYXRp +b25RcVp0ZXJtaW5hdGU60wAOALYAtwC4AxwDHYAngOCA49gADgC8AL0AvgC/AMAAwQDCAMMDIAFGAyEA +xwDIAMkBJoAlgOGA4oAfgCOAOVRSZWRvUVpVcmVkbzrSAA4APgMpAyqBATmvEFQBwQFtAEEBdgMvAggC +dwBNAVwDNAIuAzYBBQE3AeEDOgD0AzwB8gM+AS8DHAJbAqEC2ANEAmoC5gNHARADSQNKAj4BpgKvA04D +TwFKAhIBZQNTAR4BQQMOAdcBJgKTAsoA/QF/AoUCIADsA2ACAANiA2MDZANlA2YCvANoA2kDagHpAc8D +bQG0AwADcALzAksDcwN0A3UBVABsA3gBmADKA3sAuQGKA36Aa4BOgAeAUoDogIGAp4ALgEmA7YCQgPSA +L4A+gHaBAQeAKoDzgHuBAQiAPYDggJ6AtoDJgP+Ao4DOgQEBgDSBATiBARCAlYBigLuBAQ6BAS+AQ4CG +gE2A+oA4gEKA24BxgDmAsYDEgC6AU4CsgIuAKYEBLYCAgPuBARqBAQKBAR6A/oC/gQEcgQEzgQEWgHeA +cIEBMYBngNaBASeA0oCZgPKBARSBASOASIAOgQEhgF2AHYEBKYAcgFiBARVWU3BlZWNo0gAOAD4AagOC +gBKiAbQBZYBngE3SADcAOAOGAMKiAMIAO9oADgC8AL0DiAC+A4kAvwDAAMEAwgDDAFAAxQOMAFADjADH +AMgAyQE3XU5TSXNTZXBhcmF0b3JcTlNJc0Rpc2FibGVkgCWAFwmAFwmAH4AjgD5fEBRTcGVsbGluZyBh +bmQgR3JhbW1hctIADgA+AGoDlYASpAIAAsoCrwLzgICAxIC7gNJURmlsZdIADgA+AGoDnYASqwKhAwAD +NANzAi4B8gISAVQDPAJLAneAtoDWgO2A8oCQgHuAhoBIgPOAmYCn2gAOA6oAvAC9AL4AvwDAAMEAwgOr +AMMAygDPAMUAUADHAMgAyQFcA7NZTlNTdWJtZW51WE5TQWN0aW9ugCWAHYDugBeAH4AjgEmA71tPcGVu +IFJlY2VudF5zdWJtZW51QWN0aW9uOtIADgA+AGoDuIASoQC5gBxfEBZfTlNSZWNlbnREb2N1bWVudHNN +ZW512gAOALwAvQOIAL4DiQC/AMAAwQDCAMMAUADFA4wAUAOMAMcAyADJAVyAJYAXCYAXCYAfgCOASdoA +DgC8AL0DiAC+A4kAvwDAAMEAwgDDAFAAxQOMAFADjADHAMgAyQFcgCWAFwmAFwmAH4AjgEnUAA4AvADM +AM0AzgPPA9AD0YDngPWA94D2WFNlcnZpY2Vz0gAOAD4AagPVgBKgXxAPX05TU2VydmljZXNNZW51Xk5l +d0FwcGxpY2F0aW9u0gAOAD4AagPagBKrAj4DUwNiA2YDRANHAP0BEAJqA2QDDoCVgPqA+4D+gP+BAQGA +LoA0gKOBAQKA29oADgC8AL0DiAC+A4kAvwDAAMEAwgDDAFAAxQOMAFADjADHAMgAyQEFgCWAFwmAFwmA +H4AjgC/YAA4AvAC9AL4AvwDAAMEAwgDDA/EAxQPyAMcAyADJAQWAJYD8gP2AH4AjgC9sAFAAcgBlAGYA +ZQByAGUAbgBjAGUAcyAmUSzaAA4AvAC9A4gAvgOJAL8AwADBAMIAwwBQAMUDjABQA4wAxwDIAMkBBYAl +gBcJgBcJgB+AI4Av2gAOA6oAvAC9AL4AvwDAAMEAwgOrAMMDNgPPAMUAUADHAMgAyQEFBAmAJYD0gPWA +F4AfgCOAL4EBANoADgC8AL0DiAC+A4kAvwDAAMEAwgDDAFAAxQOMAFADjADHAMgAyQEFgCWAFwmAFwmA +H4AjgC/aAA4AvAC9A4gAvgOJAL8AwADBAMIAwwBQAMUDjABQA4wAxwDIAMkBBYAlgBcJgBcJgB+AI4Av +XF9OU0FwcGxlTWVudVZXaW5kb3fSAA4APgBqBCCAEqQBmALmAy8BL4BdgM6A6IA9Xl9OU1dpbmRvd3NN +ZW512gAOA6oAvAC9AL4AvwDAAMEAwgOrAMMBBQEIAMUAUADHAMgAyQM+BC6AJYAvgPiAF4AfgCOBAQiB +AQnUAA4AvADMAM0AzgQxBDIEM4DngQEMgQE3gQENVFZpZXfSAA4APgBqBDeAEqIC2ADsgMmAKVlBTWFp +bk1lbnXSAA4APgBqBD2AEqcDOgNOA0oDewNPA20DaYEBB4EBDoEBEIEBKYEBL4EBMYEBM9oADgOqALwA +vQC+AL8AwADBAMIDqwDDAVwBXwDFAFAAxwDIAMkDPgRNgCWASYDrgBeAH4AjgQEIgQEP2gAOA6oAvAC9 +AL4AvwDAAMEAwgOrAMMBJgEpAMUAUADHAMgAyQM+BFaAJYA5gQERgBeAH4AjgQEIgQESVEVkaXTSAA4A +PgBqBFqAEq0BigMcA3QBpgKTArwBHgHBA34DagN4A3UDcIBYgOCBARSAYoCxgL+AOIBrgQEVgQEWgQEh +gQEjgQEn2gAOALwAvQOIAL4DiQC/AMAAwQDCAMMAUADFA4wAUAOMAMcAyADJASaAJYAXCYAXCYAfgCOA +OdoADgC8AL0DiAC+A4kAvwDAAMEAwgDDAFAAxQOMAFADjADHAMgAyQEmgCWAFwmAFwmAH4AjgDnaAA4D +qgC8AL0AvgC/AMAAwQDCA6sAwwHpAewAxQBQAMcAyADJASYEgoAlgHeBAReAF4AfgCOAOYEBGFRGaW5k +0gAOAD4AagSGgBKlAeEDYwNoA2UCIIB2gQEagQEcgQEegIvZAA4AvAC9AL4AvwDAAMEAwgF5AMMEjgDF +AooAxwDIAMkB6QBVgCWBARuAroAfgCOAd1lGaW5kIE5leHTZAA4AvAC9AL4AvwDAAMEAwgF5AMMElgFG +AmAAxwDIAMkB6QJkgCWBAR2AoIAfgCOAd11GaW5kIFByZXZpb3Vz2QAOALwAvQC+AL8AwADBAMIBeQDD +BJ4AxQSfAMcAyADJAekEo4AlgQEfgQEggB+AI4B3EAdfEBZVc2UgU2VsZWN0aW9uIGZvciBGaW5kUWXa +AA4DqgC8AL0AvgC/AMAAwQDCA6sAwwIIAgsAxQBQAMcAyADJASYEroAlgIGA6YAXgB+AI4A5gQEi2gAO +A6oAvAC9AL4AvwDAAMEAwgOrAMMBfwGDAMUAUADHAMgAyQEmBLeAJYBTgQEkgBeAH4AjgDmBASVdU3Vi +c3RpdHV0aW9uc9IADgA+AGoEu4ASowF2AoUCW4BSgKyAntoADgOqALwAvQC+AL8AwADBAMIDqwDDAW0B +cADFAFAAxwDIAMkBJgTHgCWAToDlgBeAH4AjgDmBASjaAA4DqgC8AL0AvgC/AMAAwQDCA6sAwwFKAU0A +xQBQAMcAyADJAz4E0IAlgEOBASqAF4AfgCOBAQiBAStWRm9ybWF00gAOAD4AagTUgBKiA2ABQYEBLYBC +2AAOALwAvQC+AL8AwADBAMIAwwTZAMUC3QDHAMgAyQFKgCWBAS6Ay4AfgCOAQ1pTaG93IEZvbnRz2gAO +A6oAvAC9AL4AvwDAAMEAwgOrAMMA9AD3AMUAUADHAMgAyQM+BOeAJYAqgQEKgBeAH4AjgQEIgQEw2gAO +A6oAvAC9AL4AvwDAAMEAwgOrAMMBNwE6AMUAUADHAMgAyQM+BPCAJYA+gQEEgBeAH4AjgQEIgQEy2gAO +A6oAvAC9AL4AvwDAAMEAwgOrAMMB1wHaAMUAUADHAMgAyQM+BPmAJYBxgQE0gBeAH4AjgQEIgQE1VEhl +bHDSAA4APgBqBP2AEqEBz4BwW19OU01haW5NZW510gAOADIAMwA0gASAA9IANwA4BQQAf6IAfwA70gAO +AD4DKQUHgQE5rxBUASYDcAAfAX8BNwN4AVwAQQNOAVwBXANEAzoDbQHpAz4DTwFcAVwAHwE3ASYBfwFc +APQBBQEFATcBBQEFAB8DPgEFASYCCAM+Az4DewFcAW0BBQEmAUoBBQNpA0oBJgIIAQUDdQF/AekA9AFK +AggBBQHpAQUB6QEFASYB6QM+ASYDagHXAz4BbQFcASYCCAFcAVwBJgEmAVwATQEmATcDNAM+AMoBJgEm +gDmBASeAAoBTgD6BASGASYAHgQEOgEmASYD/gQEHgQExgHeBAQiBAS+ASYBJgAKAPoA5gFOASYAqgC+A +L4A+gC+AL4ACgQEIgC+AOYCBgQEIgQEIgQEpgEmAToAvgDmAQ4AvgQEzgQEQgDmAgYAvgQEjgFOAd4Aq +gEOAgYAvgHeAL4B3gC+AOYB3gQEIgDmBARaAcYEBCIBOgEmAOYCBgEmASYA5gDmASYALgDmAPoDtgQEI +gB2AOYA50gAOAD4DKQVegQE5rxBVAcEBbQBBAXYDLwJ3AggATQFcAzQCLgM2AQUBNwHhAzoA9AM8AfID +PgMcAS8CoQJbAtgDRANKAmoDRwAfA0kBEAFKA04CPgNPAaYC5gISAWUCrwNTAR4BQQMOASYB1wKTAOwA +/QF/AoUCIANgAsoCAANiA2MDZANlA2YCvANoA2kDagMAA3MDbQHPAVQDcABsAksB6QN0A3UBtALzA3gB +mADKA3sAuQGKA36Aa4BOgAeAUoDogKeAgYALgEmA7YCQgPSAL4A+gHaBAQeAKoDzgHuBAQiA4IA9gLaA +noDJgP+BARCAo4EBAYACgQE4gDSAQ4EBDoCVgQEvgGKAzoCGgE2Au4D6gDiAQoDbgDmAcYCxgCmALoBT +gKyAi4EBLYDEgICA+4EBGoEBAoEBHoD+gL+BARyBATOBARaA1oDygQExgHCASIEBJ4AOgJmAd4EBFIEB +I4BngNKBASGAXYAdgQEpgByAWIEBFdIADgA+AykFtoEBOa8QVQW3BbgFuQW6BbsFvAW9Bb4FvwXABcEF +wgXDBcQFxQXGBccFyAXJBcoFywXMBc0FzgXPBdAF0QXSBdMF1AXVBdYF1wXYBdkF2gXbBdwF3QXeBd8F +4AXhBeIF4wXkBeUF5gXnBegF6QXqBesF7AXtBe4F7wXwBfEF8gXzBfQF9QX2BfcF+AX5BfoF+wX8Bf0F +/gX/BgAGAQYCBgMGBAYFBgYGBwYIBgkGCgYLgQE9gQE+gQE/gQFAgQFBgQFCgQFDgQFEgQFFgQFGgQFH +gQFIgQFJgQFKgQFLgQFMgQFNgQFOgQFPgQFQgQFRgQFSgQFTgQFUgQFVgQFWgQFXgQFYgQFZgQFagQFb +gQFcgQFdgQFegQFfgQFggQFhgQFigQFjgQFkgQFlgQFmgQFngQFogQFpgQFqgQFrgQFsgQFtgQFugQFv +gQFwgQFxgQFygQFzgQF0gQF1gQF2gQF3gQF4gQF5gQF6gQF7gQF8gQF9gQF+gQF/gQGAgQGBgQGCgQGD +gQGEgQGFgQGGgQGHgQGIgQGJgQGKgQGLgQGMgQGNgQGOgQGPgQGQgQGRXxAWTWVudSBJdGVtIChTZWxl +Y3QgQWxsKV1NZW51IChTcGVlY2gpXxAaV2luZG93IChKUyBDb3JlIEFuaW1hdGlvbilfEBxNZW51IEl0 +ZW0gKFNtYXJ0IENvcHkvUGFzdGUpW1NlcGFyYXRvci02UTZfEBtNZW51IChTcGVsbGluZyBhbmQgR3Jh +bW1hcilcQ29udGVudCBWaWV3W01lbnUgKEZpbGUpXxAXTWVudSBJdGVtIChPcGVuIFJlY2VudClTMS0x +XxAPTWVudSAoU2VydmljZXMpXxAVTWVudSAoTmV3QXBwbGljYXRpb24pXU1lbnUgKFdpbmRvdylvEBEA +TQBlAG4AdQAgAEkAdABlAG0AIAAoAEYAaQBuAGQgJgApXxAaTWVudSBJdGVtIChOZXdBcHBsaWNhdGlv +bilbTWVudSAoVmlldylTMi0xUTNYTWFpbk1lbnVfEBBNZW51IEl0ZW0gKFJlZG8pXxAeTWVudSBJdGVt +IChCcmluZyBBbGwgdG8gRnJvbnQpUTlfEBdNZW51IEl0ZW0gKFNtYXJ0IExpbmtzKV8QGE1lbnUgSXRl +bSAoU2hvdyBUb29sYmFyKV8QFE1lbnUgSXRlbSAoU2VydmljZXMpXxAQTWVudSBJdGVtIChFZGl0KV8Q +FE1lbnUgSXRlbSAoU2hvdyBBbGwpWVNlcGFyYXRvclxGaWxlJ3MgT3duZXJbQXBwbGljYXRpb25fEBdN +ZW51IEl0ZW0gKEhpZGUgT3RoZXJzKV1NZW51IChGb3JtYXQpXxAQTWVudSBJdGVtIChGaWxlKV8QIE1l +bnUgSXRlbSAoQWJvdXQgTmV3QXBwbGljYXRpb24pXxAQTWVudSBJdGVtIChWaWV3KV8QD01lbnUgSXRl +bSAoQ3V0KV8QEE1lbnUgSXRlbSAoWm9vbSlROF8QGU1lbnUgSXRlbSAoU3RvcCBTcGVha2luZylfECdN +ZW51IEl0ZW0gKENoZWNrIFNwZWxsaW5nIFdoaWxlIFR5cGluZylbU2VwYXJhdG9yLTFfEBJNZW51IEl0 +ZW0gKERlbGV0ZSlfEBdNZW51IEl0ZW0gKFNob3cgQ29sb3JzKVQxMTExW01lbnUgKEVkaXQpUTJfEBBN +ZW51IEl0ZW0gKENvcHkpbxAeAE0AZQBuAHUAIABJAHQAZQBtACAAKABDAHUAcwB0AG8AbQBpAHoAZQAg +AFQAbwBvAGwAYgBhAHIgJgApXxAfTWVudSBJdGVtIChIaWRlIE5ld0FwcGxpY2F0aW9uKV8QFE1lbnUg +KFN1YnN0aXR1dGlvbnMpXxAYTWVudSBJdGVtIChTbWFydCBRdW90ZXMpXxAdTWVudSBJdGVtIChKdW1w +IHRvIFNlbGVjdGlvbilfEBZNZW51IEl0ZW0gKFNob3cgRm9udHMpXxAaTWVudSBJdGVtIChDaGVjayBT +cGVsbGluZylvEBoATQBlAG4AdQAgAEkAdABlAG0AIAAoAFMAaABvAHcAIABTAHAAZQBsAGwAaQBuAGcg +JgApUzEyMV8QFU1lbnUgSXRlbSAoRmluZCBOZXh0KVtTZXBhcmF0b3ItMl8QIk1lbnUgSXRlbSAoVXNl +IFNlbGVjdGlvbiBmb3IgRmluZClbU2VwYXJhdG9yLTNfEBFNZW51IEl0ZW0gKFBhc3RlKV8QGU1lbnUg +SXRlbSAoRmluZCBQcmV2aW91cylRMV8QEE1lbnUgSXRlbSAoRmluZClvEBEATQBlAG4AdQAgAEkAdABl +AG0AIAAoAE8AcABlAG4gJgApUTdfEBJNZW51IEl0ZW0gKFdpbmRvdylfEB9NZW51IEl0ZW0gKE5ld0Fw +cGxpY2F0aW9uIEhlbHApUjEwXxASTWVudSBJdGVtIChTcGVlY2gpXFByb2Nlc3MgVmlld1E1W01lbnUg +KEZpbmQpW1NlcGFyYXRvci00XxAZTWVudSBJdGVtIChTdWJzdGl0dXRpb25zKV8QGk1lbnUgSXRlbSAo +U3RhcnQgU3BlYWtpbmcpXxAnTWVudSBJdGVtIChDaGVjayBHcmFtbWFyIFdpdGggU3BlbGxpbmcpXxAg +TWVudSBJdGVtIChTcGVsbGluZyBhbmQgR3JhbW1hcilfEBRNZW51IEl0ZW0gKE1pbmltaXplKV8QEk1l +bnUgKE9wZW4gUmVjZW50KV8QEk1lbnUgSXRlbSAoRm9ybWF0KV8QFk1lbnUgSXRlbSAoQ2xlYXIgTWVu +dSlfEBBNZW51IEl0ZW0gKFVuZG8pW1NlcGFyYXRvci010gAOAD4DKQZjgQE5oNIADgA+AykGZoEBOaDS +AA4APgMpBmmBATmvEHwAmQCaAKkAngCrAE0BXAIuATcAqgHhAzoAjgM+AS8CWwKhA0QCagEQAK0CrwCb +A08AlQFlA1MBHgFBAJ8B1wLKAoUA7AD9ALMAoANgA2IDYwNlAKQDaANzAKwDbQFUA3AAbACRAKYDdACQ +AJIDeAChA3sAuQCUAK4AsgN+AcEAmAFtAEEBdgCxAy8CCAJ3AJcDNACdAzYBBQC0AI8A9AM8AfIDHACi +AtgDSgLmA0cAHwNJAJwCPgGmA04BSgISAw4BJgKTAX8AsAIgAgADZANmArwBtANpA2oB6QHPAwAAlgCl +AksC8wCnAK8DdQCoAZgAygCTAYoAo4BcgGGAq4B1gLWAC4BJgJCAPoCwgHaBAQeAG4EBCIA9gJ6AtoD/ +gKOANIC+gLuAZoEBL4BHgE2A+oA4gEKAeoBxgMSArIApgC6A2oB/gQEtgPuBARqBAR6AlIEBHIDygLqB +ATGASIEBJ4AOgDOAnYEBFIAtgDeBASGAhYEBKYAcgEGAw4DVgQEVgGuAV4BOgAeAUoDRgOiAgYCngFGA +7YBvgPSAL4DfgCiAKoDzgHuA4ICKgMmBARCAzoEBAYACgQE4gGqAlYBigQEOgEOAhoDbgDmAsYBTgM2A +i4CAgQECgP6Av4BngQEzgQEWgHeAcIDWgEyAmICZgNKAooDIgQEjgKaAXYAdgDyAWICP0gAOAD4DKQbo +gQE5rxB8BukG6gbrBuwG7QbuBu8G8AbxBvIG8wb0BvUG9gb3BvgG+Qb6BvsG/Ab9Bv4G/wcABwEHAgcD +BwQHBQcGBwcHCAcJBwoHCwcMBw0HDgcPBxAHEQcSBxMHFAcVBxYHFwcYBxkHGgcbBxwHHQceBx8HIAch +ByIHIwckByUHJgcnBygHKQcqBysHLActBy4HLwcwBzEHMgczBzQHNQc2BzcHOAc5BzoHOwc8Bz0HPgc/ +B0AHQQdCB0MHRAdFB0YHRwdIB0kHSgdLB0wHTQdOB08HUAdRB1IHUwdUB1UHVgdXB1gHWQdaB1sHXAdd +B14HXwdgB2EHYgdjB2SBAZaBAZeBAZiBAZmBAZqBAZuBAZyBAZ2BAZ6BAZ+BAaCBAaGBAaKBAaOBAaSB +AaWBAaaBAaeBAaiBAamBAaqBAauBAayBAa2BAa6BAa+BAbCBAbGBAbKBAbOBAbSBAbWBAbaBAbeBAbiB +AbmBAbqBAbuBAbyBAb2BAb6BAb+BAcCBAcGBAcKBAcOBAcSBAcWBAcaBAceBAciBAcmBAcqBAcuBAcyB +Ac2BAc6BAc+BAdCBAdGBAdKBAdOBAdSBAdWBAdaBAdeBAdiBAdmBAdqBAduBAdyBAd2BAd6BAd+BAeCB +AeGBAeKBAeOBAeSBAeWBAeaBAeeBAeiBAemBAeqBAeuBAeyBAe2BAe6BAe+BAfCBAfGBAfKBAfOBAfSB +AfWBAfaBAfeBAfiBAfmBAfqBAfuBAfyBAf2BAf6BAf+BAgCBAgGBAgKBAgOBAgSBAgWBAgaBAgeBAgiB +AgmBAgqBAguBAgyBAg2BAg6BAg+BAhCBAhEQJRDkEQFkEPERAXURAXQQURBJEBgQ4BDREDgQfxAdEAUR +AWIQUhCDEJYQkRDiENsQ6REBJxEBbBDDEOwQyhEBWREBahBqEMkRAV8RASoQhhEBcRDmEQFYEIEQ0BDd +EI4Q1RBPEN4QExBwENMRAXcRAXARAWUQzhEBbxDrENgRAWsRASsQfhEBaRDhEQF2ENYQxhDfENQRAXMR +AV4RAVsQXBDIEE4RAWMQfBEBaBCCEDkQ5xEBbREBKBBKEEsQ1xD1EQEpENkQ7xCQEQGcE//////////9 +EOgQOhDHEFMRASwQUBCIEM0QxREBXRDwENIQzBCVEI8QyxDEEGcQ2hDcEG8QSBDjEFcQTREBWhEBchEB +bhEBXBBWEBcQfRAnEM8QwdIADgA+AGoH44ASoNIADgA+AykH5oEBOaDSAA4APgMpB+mBATmg0gA3ADgH +6wfsogfsADteTlNJQk9iamVjdERhdGEACAAZACIAJwAxADoAPwBEAFIAVABmBJYEnATnBO4E9QUDBRUF +MQU/BUsFVwVlBXAFfgWaBagFuwXNBecF8QX+BgAGAwYFBggGCwYNBhAGEgYVBhgGGwYeBiAGIgYlBigG +KwYuBjcGQwZFBkcGVQZeBmcGcgZ3BoYGjwaiBqsGtga4BrsGvQbqBvcHBAcaBygHMgdAB00HXwdzB38H +gQeDB4UHhweJB44HkAeSB5QHlweZB7QHyAfWB/MIBQgQCBkIJQguCDoIPAg+CEAIQwhFCEcISQhSCFQI +VwhZCHYIeAh6CH0IfwiBCIMIhQiQCJwIpQiuCLsIwgjOCNcI3gjtCPUI/gkFCR4JHwkoCS0JQAlJCVAJ +XQljCWwJbgm/CcEJwwnFCccJyQnLCc0JzwnRCdMJ1QnXCdkJ2wndCd8J4QnjCeUJ5wnpCesJ7QnvCfEJ +8wn1CfcJ+Qn7Cf0J/woBCgMKBQoHCgkKCwoNChoKIworCi0KLwoxClIKWgpuCnkKhwqRCp4KpQqnCqkK +rgqwCrUKtwq5CrsKzArTCt8K4QrjCuUK5wryCv8LDgsQCxILFAscCy4LNws8C08LXAteC2ALYgt1C34L +gwuOC6YLrwu2C84L3QvqC+wL7gvwDBEMEwwVDBcMGQwbDB0MKgwsDC8MMgxZDHsMiAyKDIwMjgyvDLEM +swy1DLcMuQy7DMwMzgzQDNMM1QzrDO0M8w0ADQINBA0GDScNKQ0rDTANMg00DTYNOA1EDV0Nag1sDW4N +cA2RDZMNlQ2XDZkNmw2dDaoNrA2vDbINuQ3BDc4N0A3SDdQN9Q33DfkN+w39Df8OAQ4SDhQOFw4aDh0O +Mg5EDlEOUw5VDlcOeA56DnwOgQ6DDoUOhw6JDpYOmA6bDp4Oqg6sDsQO0Q7TDtUO1w70DvYO+A76DvwO +/g8ADw0PDw8RDxMPJQ8+D0sPTQ9PD1EPcg90D3YPeA96D3wPfg+LD40Pjw+RD58PrQ+6D7wPvg/AD+UP +6w/tD+8P8Q/zD/UP9w/5EAYQCBALEA4QIRAjED4QSxBNEE8QURByEHQQdhB4EHoQfBB+EIMQhRCLEJgQ +mhCcEJ4QvxDBEMMQxRDHEMkQyxDUENYQ7BD5EPsQ/RD/ESARIhEkESYRKBEqESwRMBEyETcRRBFGEUgR +ShFrEW0RbxFxEXMRdRF3EYYRlRGiEaQRphGoEckRyxHNEc8R0RHTEdUR4BHiEe0R+hH8Ef4SABIhEiMS +JRInEikSKxItEjoSPBI/EkISWBJaEmQScRJzEnUSdxKcEp4SoBKiEqQSphKoErUStxK6Er0SyBLiEu8S +8RLzEvUTFhMYExoTHBMeEyATIhMnEykTNxNEE0YTSBNKE2sTbRNvE3ETcxN1E3cThBOGE4gTihOnE6kT +uxPIE8oTzBPOE+8T8RPzE/UT9xP5E/sUDBQOFCAULRQvFDEUMxRUFFYUWBRaFFwUXhRgFHQUdhSWFKMU +pRSnFKkUyhTMFM4U0BTSFNQU1hTcFN4U7BT9FQsVDRUPFREVExUwFTIVNBU2FTgVOhU8FVMVcxWAFYIV +hBWGFasVtRW3FbkVuxW9Fb8VwRXDFdEV0xXiFe8V8RXzFfUWGhYcFh4WIBYiFiQWJhYoFjQWNhZWFmMW +ZRZnFmkWihaMFo4WkBaSFpQWlhafFrgWxRbHFskWyxbsFu4W8BbyFvQW9hb4FwUXBxcOFxsXHRcfFyEX +RhdIF0oXTBdOF1AXUhdfF2EXhReSF5QXlheYF7kXuxe9F78XwRfDF8UXyhfMF9IX3xfhF+MX5RgGGAgY +ChgMGA4YEBgSGBYYGBglGDIYNBg2GDgYWRhbGF0YXxhhGGMYZRiDGKQYsRizGLUYtxjYGNoY3BjeGOAY +4hjkGOoY7BjzGQAZAhkEGQYZJxkpGSsZLRkvGTEZMxlCGUQZUxlgGWIZZBlmGYcZiRmLGY0ZjxmRGZMZ +oBmiGbgZxRnHGckZyxnsGe4Z8BnyGfQZ9hn4Gf0aChoXGhkaGxodGj4aQBpCGkQaRhpIGkoaaBqBGo4a +kBqSGpQatRq3Grkauxq9Gr8awRrMGs4a3BrpGusa7RrvGxAbEhsUGxYbGBsaGxwbMhs0Gz8bTBtOG1Ab +UhtzG3Ubdxt5G3sbfRt/G4QbhhuMG5UbmBxDHEUcRxxJHEscTRxPHFEcUxxVHFccWRxbHF0cXxxhHGQc +ZhxoHGocbRxvHHEccxx1HHcceRx7HH0cgByCHIUciByKHIwcjhyRHJQclhyYHJocnByeHKAcohykHKYc +qByqHKwcrhywHLIctBy3HLkcuxy+HMEcxBzGHMgcyxzOHNEc0xzVHNgc2hzcHN8c4RzjHOUc6BzrHO0c +7xzyHPQc9hz5HPsc/R0AHQcdEB0SHRcdGR0bHSQdKR1SHWAdbR1vHXEdch10HXUddx15HXsdkh2bHZ0d +ph2oHaodrB2uHbMdvB2+HdUd1x3ZHdsd3R3fHeEd4x3lHecd6R3rHhQeHh4nHikeKx4tHi8eMR4zHjUe +Nx5DHlIeWx5dHmAeYh57HqQeph6oHqkeqx6sHq4esB6yHtse3R7fHuAe4h7jHuUe5x7pHvoe/B7+HwAf +Ah8LHxQfFh8XHykfOB9BH0MfWh9cH14fYB9iH2QfZx9pH2sfbR9wH3Ifmx+dH58foB+iH6MfpR+nH6kf +yh/MH84f0B/SH9Qf1h/vH/EgGiAcIB4gHyAhICIgJCAmICggUSBTIFUgVyBZIFsgXSBfIGIgiyCNII8g +kCCSIJMglSCXIJkgwiDEIMYgxyDJIMogzCDOINAg3SDkIO0g7yD4IPog/CD+IQAhDyE4ITohPCE+IUAh +QiFEIUchSiFbIV0hYCFjIWYhayF0IXYheyF9IX8hiSGSIZQhoyGmIakhrCGvIbIhtSG4IeEh4yHlIech +6SHrIe0h8CHzIhwiHiIgIiMiJSInIikiLCIvIjQiPSI/IloiXCJeImEiYyJlImciaSJrIm4icSJ0Inci +eiKjIqUipyKoIqoiqyKtIq8isSLaItwi3iLfIuEi4iLkIuYi6CMRIxMjFSMYIxojHCMeIyAjIyMoIzEj +MyM+I0AjQyNGI0kjSyNwI3IjdSN3I3kjeyN9I4cjrCOuI7EjsyO1I7cjuSPHI+wj7iPxI/Qj9iP4I/oj +/CQVJBckQCRCJEQkRiRIJEokTCROJFEkeiR8JH4kgSSDJIUkhySJJIwkmiSjJKUkrCSuJLAksiTbJN0k +3yThJOMk5STnJOkk7CUVJRclGSUcJR4lICUiJSUlKCUvJTglOiU/JUIlRCVlJWclaiVsJW4lcCVyJX0l +piWoJaolrSWvJbElsyW2Jbkl4iXkJeYl6SXrJe0l7yXyJfUmHiYgJiImJSYnJikmKyYuJjEmNiY/JkEm +RCZGJlImWyZdJl8maCZtJnYmeSckJyYnKScrJy0nLycyJzQnNic5JzsnPSc/J0InRSdHJ0onTSdPJ1En +UydVJ1cnWSdbJ10nXydhJ2MnZSdnJ2knbCduJ3Ancid1J3gneyd9J38ngSeDJ4UnhyeKJ40njyeRJ5Mn +lieYJ5onnCeeJ6AnoiekJ6YnqCeqJ6wnriexJ7Mntie4J7snvSe/J8EnwyfFJ8cnySfLJ80nzyfRJ9Mn +1SfYJ9on3CfeJ+cn6iiXKJkomyidKJ8ooSijKKUopyipKKsorSivKLEosyi1KLgouii8KL4owSjDKMUo +xyjJKMsozSjQKNIo1SjXKNoo3CjeKOEo4yjmKOgo6ijsKO4o8CjyKPQo9ij4KPoo/Cj+KQApAikEKQYp +CCkLKQ0pDykRKRQpFykaKRwpHikhKSQpJykpKSspLikwKTIpNSk3KTkpOyk+KUEpQylFKUgpSilMKU8p +USlTKVYpXyliKg8qEioVKhgqGyoeKiEqJConKioqLSowKjMqNio5KjwqPypCKkUqSCpLKk4qUSpUKlcq +WipdKmAqYypmKmkqbCpvKnIqdSp4KnsqfiqBKoQqhyqKKo0qkCqTKpYqmSqcKp8qoiqlKqgqqyquKrEq +tCq3KroqvSrAKsMqxirJKswqzyrSKtUq2CrbKt4q4SrkKucq6irtKvAq8yr2Kvkq/Cr/KwIrBSsIKwsr +DisnKzUrUitxK30rfyudK6ortivQK9Qr5iv+LAwsMSxOLFosXixgLGksfCydLJ8suSzULOss/i0VLR8t +LC04LVItYC1zLZYtqS27Lc4t0C3sLhYuIi43LlEuVi5iLmQudy62Ltgu7y8KLyovQy9gL5cvmy+zL78v +5C/wMAQwIDAiMDUwWjBcMHEwkzCWMKswuDC6MMYw0jDuMQsxNTFYMW8xhDGZMbIxxTHRMdox3THeMecx +6jHrMfQx9zLyMvQy9jL4Mvoy/DL+MwAzAjMEMwYzCDMLMw0zEDMSMxQzFjMYMxozHDMeMyAzIjMlMycz +KTMrMy0zLzMxMzMzNTM3MzkzOzM9Mz8zQjNEM0czSjNMM08zUTNTM1YzWDNbM10zXzNhM2QzZjNoM2sz +bTNwM3IzdDN2M3gzezN9M38zgTODM4UzhzOJM4szjTOPM5EzkzOVM5czmTObM50znzOhM6MzpTOnM6oz +rDOvM7EztDO2M7gzujO9M78zwTPDM8UzxzPJM8szzTPPM9Iz1DPWM9gz2zPeM+Az4jPkM+Yz6DPqM+wz +7jPwM/Mz9TP3M/kz+zP9M/80CDQLNQY1CTUMNQ81EjUVNRg1GzUeNSE1JDUnNSo1LTUwNTM1NjU5NTw1 +PzVCNUU1SDVLNU41UTVUNVc1WjVdNWA1YzVmNWk1bDVvNXI1dTV4NXs1fjWBNYQ1hzWKNY01kDWTNZY1 +mTWcNZ81ojWlNag1qzWuNbE1tDW3Nbo1vTXANcM1xjXJNcw1zzXSNdU12DXbNd414TXkNec16jXtNfA1 +8zX2Nfk1/DX/NgI2BTYINgs2DjYRNhQ2FzYaNh02IDYjNiY2KTYsNi82MjY1Njg2OzY+NkE2RDZHNko2 +TTZQNlM2VjZZNlw2XzZiNmU2aDZrNm42cTZ0Nnc2ejZ8Nn42gTaDNoY2iTaLNo02jzaRNpM2lTaXNpk2 +mzaeNqA2ojakNqY2qDaqNqw2rzayNrQ2tja4Nrs2vjbANsI2xTbINso2zTbPNtI21DbWNtg22jbcNt42 +4DbiNuQ25jbpNuw27zbxNvQ29jb4Nvs2/jcANwM3BTcINwo3DDcONxA3EzcWNxk3GzcdNx83IjckNyc3 +KTcrNy03MDczNzU3Nzc5Nzs3PjdAN0I3RDdHN1A3UjdUN1Y3WDdbN103XzdhN2M3ZjdoN2o3bDduN3A3 +cjd0N3Y3eDd6N3w3fjeAN4I3hDeHN4o3jTeQN5I3lDeWN5g3mjecN6U3pzeoN7E3tDe1N743wTfCN8s3 +0AAAAAAAAAICAAAAAAAAB+0AAAAAAAAAAAAAAAAAADffA + + + diff --git a/jscocoa/ProcessViewer/English.lproj/MainMenu.nib/keyedobjects.nib b/jscocoa/ProcessViewer/English.lproj/MainMenu.nib/keyedobjects.nib new file mode 100644 index 0000000..12b6dee Binary files /dev/null and b/jscocoa/ProcessViewer/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/jscocoa/ProcessViewer/Info.plist b/jscocoa/ProcessViewer/Info.plist new file mode 100644 index 0000000..ea3ecb1 --- /dev/null +++ b/jscocoa/ProcessViewer/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.JSCoreAnimation + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/jscocoa/ProcessViewer/JSCoreAnimation.xcodeproj/project.pbxproj b/jscocoa/ProcessViewer/JSCoreAnimation.xcodeproj/project.pbxproj new file mode 100644 index 0000000..a4577e0 --- /dev/null +++ b/jscocoa/ProcessViewer/JSCoreAnimation.xcodeproj/project.pbxproj @@ -0,0 +1,344 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 44; + objects = { + +/* Begin PBXBuildFile section */ + 3D15F53C0FC024A7009E31F4 /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F5150FC024A7009E31F4 /* BridgeSupportController.m */; }; + 3D15F53D0FC024A7009E31F4 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D15F5160FC024A7009E31F4 /* class.js */; }; + 3D15F5480FC024A7009E31F4 /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F5330FC024A7009E31F4 /* JSCocoaController.m */; }; + 3D15F5490FC024A7009E31F4 /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F5350FC024A7009E31F4 /* JSCocoaFFIArgument.m */; }; + 3D15F54A0FC024A7009E31F4 /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F5370FC024A7009E31F4 /* JSCocoaFFIClosure.m */; }; + 3D15F54B0FC024A7009E31F4 /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F5390FC024A7009E31F4 /* JSCocoaLib.m */; }; + 3D15F54C0FC024A7009E31F4 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D15F53B0FC024A7009E31F4 /* JSCocoaPrivateObject.m */; }; + 3D4CC7490E9B7CB600EF1F25 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D4CC7480E9B7CB600EF1F25 /* JavaScriptCore.framework */; }; + 3D68AD510E841E1800C2EC5B /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D68AD500E841E1800C2EC5B /* main.js */; }; + 3D68EDE210AF201200E0C357 /* jslint-jscocoa.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D68EDE110AF201200E0C357 /* jslint-jscocoa.js */; }; + 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* JSCoreAnimation_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCoreAnimation_Prefix.pch; sourceTree = ""; }; + 3D15F5140FC024A7009E31F4 /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3D15F5150FC024A7009E31F4 /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3D15F5160FC024A7009E31F4 /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3D15F52D0FC024A7009E31F4 /* JSCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa.h; sourceTree = ""; }; + 3D15F5320FC024A7009E31F4 /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3D15F5330FC024A7009E31F4 /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3D15F5340FC024A7009E31F4 /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3D15F5350FC024A7009E31F4 /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 3D15F5360FC024A7009E31F4 /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3D15F5370FC024A7009E31F4 /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3D15F5380FC024A7009E31F4 /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLib.h; sourceTree = ""; }; + 3D15F5390FC024A7009E31F4 /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaLib.m; sourceTree = ""; }; + 3D15F53A0FC024A7009E31F4 /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3D15F53B0FC024A7009E31F4 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3D4CC7480E9B7CB600EF1F25 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + 3D68AD500E841E1800C2EC5B /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = SOURCE_ROOT; }; + 3D68EDE110AF201200E0C357 /* jslint-jscocoa.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "jslint-jscocoa.js"; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* JSCoreAnimation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSCoreAnimation.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 3D4CC7490E9B7CB600EF1F25 /* JavaScriptCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* JSCoreAnimation.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* JSCoreAnimation */ = { + isa = PBXGroup; + children = ( + 3D15F5130FC024A7009E31F4 /* JSCocoa */, + 3D68AD4F0E841E0300C2EC5B /* JS Source */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = JSCoreAnimation; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* JSCoreAnimation_Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 8D1107310486CEB800E47090 /* Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3D4CC7480E9B7CB600EF1F25 /* JavaScriptCore.framework */, + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3D15F5130FC024A7009E31F4 /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3D15F5140FC024A7009E31F4 /* BridgeSupportController.h */, + 3D15F5150FC024A7009E31F4 /* BridgeSupportController.m */, + 3D15F5160FC024A7009E31F4 /* class.js */, + 3D68EDE110AF201200E0C357 /* jslint-jscocoa.js */, + 3D15F52D0FC024A7009E31F4 /* JSCocoa.h */, + 3D15F5320FC024A7009E31F4 /* JSCocoaController.h */, + 3D15F5330FC024A7009E31F4 /* JSCocoaController.m */, + 3D15F5340FC024A7009E31F4 /* JSCocoaFFIArgument.h */, + 3D15F5350FC024A7009E31F4 /* JSCocoaFFIArgument.m */, + 3D15F5360FC024A7009E31F4 /* JSCocoaFFIClosure.h */, + 3D15F5370FC024A7009E31F4 /* JSCocoaFFIClosure.m */, + 3D15F5380FC024A7009E31F4 /* JSCocoaLib.h */, + 3D15F5390FC024A7009E31F4 /* JSCocoaLib.m */, + 3D15F53A0FC024A7009E31F4 /* JSCocoaPrivateObject.h */, + 3D15F53B0FC024A7009E31F4 /* JSCocoaPrivateObject.m */, + ); + name = JSCocoa; + path = ../JSCocoa; + sourceTree = SOURCE_ROOT; + }; + 3D68AD4F0E841E0300C2EC5B /* JS Source */ = { + isa = PBXGroup; + children = ( + 3D68AD500E841E1800C2EC5B /* main.js */, + ); + name = "JS Source"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* JSCoreAnimation */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JSCoreAnimation" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = JSCoreAnimation; + productInstallPath = "$(HOME)/Applications"; + productName = JSCoreAnimation; + productReference = 8D1107320486CEB800E47090 /* JSCoreAnimation.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JSCoreAnimation" */; + compatibilityVersion = "Xcode 3.0"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* JSCoreAnimation */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D1107260486CEB800E47090 /* JSCoreAnimation */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D15F53D0FC024A7009E31F4 /* class.js in Resources */, + 3D68AD510E841E1800C2EC5B /* main.js in Resources */, + 3D68EDE210AF201200E0C357 /* jslint-jscocoa.js in Resources */, + 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090 /* main.m in Sources */, + 3D15F53C0FC024A7009E31F4 /* BridgeSupportController.m in Sources */, + 3D15F5480FC024A7009E31F4 /* JSCocoaController.m in Sources */, + 3D15F5490FC024A7009E31F4 /* JSCocoaFFIArgument.m in Sources */, + 3D15F54A0FC024A7009E31F4 /* JSCocoaFFIClosure.m in Sources */, + 3D15F54B0FC024A7009E31F4 /* JSCocoaLib.m in Sources */, + 3D15F54C0FC024A7009E31F4 /* JSCocoaPrivateObject.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { + isa = PBXVariantGroup; + children = ( + 29B97319FDCFA39411CA2CEA /* English */, + ); + name = MainMenu.nib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSCoreAnimation_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = JSCoreAnimation; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = JSCoreAnimation_Prefix.pch; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = JSCoreAnimation; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_GC = supported; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_GC = supported; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JSCoreAnimation" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JSCoreAnimation" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/jscocoa/ProcessViewer/JSCoreAnimation_Prefix.pch b/jscocoa/ProcessViewer/JSCoreAnimation_Prefix.pch new file mode 100644 index 0000000..0f4e830 --- /dev/null +++ b/jscocoa/ProcessViewer/JSCoreAnimation_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'JSCoreAnimation' target in the 'JSCoreAnimation' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/jscocoa/ProcessViewer/main.js b/jscocoa/ProcessViewer/main.js new file mode 100644 index 0000000..a1bd111 --- /dev/null +++ b/jscocoa/ProcessViewer/main.js @@ -0,0 +1,483 @@ + + // Load Core Animation + __jsc__.loadFrameworkWithName('QuartzCore') + + // + // Window class, transparent background + // + class ProcessWindow < NSWindow + { + - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag + { + arguments[1] = NSBorderlessWindowMask + var r = this.Super(arguments) + r.backgroundColor = NSColor.clearColor + r.opaque = false + r.movableByWindowBackground = true + return r + } + } + + // + // Layer class, derived only to hold js values + // Any class derived from an existing ObjC class gets a new instance variable, + // a Javascript hash, used to hold any Javascript value (or boxed ObjC object) + // + class AppLayer < CALayer + { + } + + // + // Core Animation view + // + class ProcessView < NSView + { + // + // On awake, build window + // + - (void)awakeFromNib + { + this.wantsLayer = true + var color = CGColorCreateGenericRGB(0, 0, 0, 0.85) + this.layer.backgroundColor = color + CGColorRelease(color) + this.layer.cornerRadius = 5 + this.perform({selector:'postAwake', withObject:null, afterDelay:0}) + } + // + // After awake, build everything else + // + - (void)postAwake + { + this.containerLayer = CALayer.layer + // Stick on middle top on resize + this.containerLayer.autoresizingMask = kCALayerMinYMargin + kCALayerMaxYMargin + kCALayerMinXMargin + kCALayerMaxXMargin + this.layer.addSublayer(this.containerLayer) + + this.buildUI + + transform = CATransform3DMakeRotation(0, 1, 0, 0) + var zDistance = 600 + transform.m34 = 1.0 / -zDistance + this.containerLayer.sublayerTransform = transform + + this.containerLayer.position = CGPointMake(this.frame.size.width/2, this.frame.size.height/2) + + // Get applications + var apps = NSFileManager.defaultManager.contentsOfDirectory({atPath:'/Applications', error:null}) + this.apps = apps.filteredArrayUsingPredicate(NSPredicate.predicateWithFormat("SELF ENDSWITH[c] '.app'")) + + var gridRatio = 5.5 + + // Looking for column count to match an aspect ratio ... + // columnCount = rowCount*aspectRatio + // appCount = (apps.length =) surface area + // columnCount*rowCount*aspectRatio = area + var columnCount = Math.round(Math.sqrt(this.apps.length*gridRatio)) + var y = (this.apps.length/columnCount)/2 + var x = 0 + var startX = -columnCount/2 + var rowCount = Math.ceil(this.apps.length/columnCount) + y = rowCount-1 + + var startY = -80 + + var roundness = 0.8 + + var halfAngleSpan = Math.asin(roundness) + var angleSpan = halfAngleSpan*2 + var circleCircumference = 2*Math.PI*1 + var arcLength = angleSpan*circleCircumference/(2*Math.PI) + + var projectedArcLength = -2*Math.cos(halfAngleSpan+Math.PI/2) + + var w = this.frame.size.width*Math.PI/projectedArcLength +w /= 3.6 + this.iconSize = arcLength*w/(columnCount-1) + + var zOffset = -(1-Math.cos(angleSpan/2))*w + + this.originalFrameWidth = this.frame.size.width + + // Holds applicationPath : layer + this.appHash = {} + + // Build app arc + for (var i=0; i= columnCount) + { + x = 0 + y-- + } + } + // Register for workspace notifications : we'll use application launch and terminate + var n = NSWorkspace.sharedWorkspace.notificationCenter + n.add({observer:this, selector:'workspaceNotifies:', name:null, object:null}) + + // Start displaying active apps after a short delay + this.perform({selector:'updateLaunchedApplicationsList', withObject:null, afterDelay:0.4}) + + } + // + // Build window title and window buttons as CALayers + // + - (void)buildUI + { + var style = NSMutableDictionary.dictionary + style['font'] = 'HelveticaNeue-Bold' + style['fontSize'] = 14 + + var parentLayer = this.layer + function buildCircle(str, x, y) + { + // Circle layer + var circleRadius = 16 + var c = CALayer.layer + c.bounds = CGRectMake(0, 0, circleRadius, circleRadius) + c.position = CGPointMake(x, y) + c.borderColor = CGColorGetConstantColor(kCGColorWhite) + c.borderWidth = 2 + c.cornerRadius = circleRadius/2 + parentLayer.addSublayer(c) + // Inner text layer (x, - , +) + var t = CATextLayer.layer + t.string = str + t.style = style + var s = t.preferredFrameSize + t.bounds = CGRectMake(0, 0, s.width, s.height) + t.position = CGPointMake(circleRadius/2+1, circleRadius/2+1) + c.addSublayer(t) + + // Stick on top on resize + c.autoresizingMask = kCALayerMinYMargin + } + var y = this.frame.size.height-16 + var x = 16 + buildCircle('x', x+0, y) + buildCircle('-', x+20, y) + buildCircle('+', x+40, y) + + // Application title + var t = CATextLayer.layer + t.style = style + t.string = 'A Javascript Process Viewer' + var s = t.preferredFrameSize + t.bounds = CGRectMake(0, 0, s.width, s.height) + t.position = CGPointMake(this.frame.size.width/2, y) + parentLayer.addSublayer(t) + // Stick on middle top on resize + t.autoresizingMask = kCALayerMinYMargin + kCALayerMinXMargin + kCALayerMaxXMargin + + // Kill button + var t = CATextLayer.layer + t.opacity = 0 + t.string = ' Kill ' + t.style = style + var s = t.preferredFrameSize + t.bounds = CGRectMake(0, 0, s.width, s.height) + t.position = CGPointMake(this.frame.size.width/2, 35) + t.borderColor = CGColorGetConstantColor(kCGColorWhite) + t.borderWidth = 2 + t.cornerRadius = 9 + parentLayer.addSublayer(t) + // Stick on middle bottom on resize + t.autoresizingMask = kCALayerMaxYMargin + kCALayerMinXMargin + kCALayerMaxXMargin + this.killButton = t + } + + + // + // Create application lists as CALayers + // + - (void)updateLaunchedApplicationsList + { + // Update launched applications list + var launchedApplications = NSWorkspace.sharedWorkspace.launchedApplications + + var launchedApplicationCount = launchedApplications.length-2 + if (launchedApplicationCount > 0) this.pitchLayers(0.2) + else this.pitchLayers(0) + var launchedIconSize = 128 + + // Compute icon size and list origin + var totalSize = launchedApplicationCount*launchedIconSize + var x = -totalSize/2+launchedIconSize/2 + if (totalSize > this.originalFrameWidth) + { + launchedIconSize = this.originalFrameWidth/launchedApplicationCount + x = -this.originalFrameWidth/2+launchedIconSize/2 + } + + if (!this.previousLaunchedApplicationsList) this.previousLaunchedApplicationsList = {} + var launchedApplicationsList = {} + + // Display each active application icon + for (var i=0; i= this.frame.size.height-25) + { + // Close : fade and terminate + if (p.x < 27) this.layer.opacity = 0, NSApplication.sharedApplication.perform({selector:'terminate:', withObject:null, afterDelay:0.5}) + // Minimize + else if (p.x < 47) this.window.miniaturize(null) + // Maximize + else + { + // Save initial frame size + if (!this.initialSize) this.initialSize = { w : this.window.frame.size.width, h : this.window.frame.size.height } + var newSize = this.window.frame.size.width == this.initialSize.w ? { w : 330, h : 200 } : this.initialSize + var newY = newSize.h == 200 ? this.window.frame.origin.y+200 : this.window.frame.origin.y-200 + // Rescale layer to fill view + this.window.set({frame:NSMakeRect(this.window.frame.origin.x, newY, newSize.w, newSize.h), display:true}) + this.viewDidEndLiveResize + } + return + } + + var hit = this.layer.hitTest(p) + // Clicked back row + if (hit.zPosition !=0) NSWorkspace.sharedWorkspace.openFile(hit.applicationPath) + // Clicked front row : kill + else + { + // Find pid + var launchedApplications = NSWorkspace.sharedWorkspace.launchedApplications + for (var i=0; i 0.1) + { + if (this.pendingPidToKill) JSCocoaController.sharedController.system('kill -9 ' + this.pendingPidToKill) + this.pendingPidToKill = 0 + this.killButton.opacity = 0 + } + } + + - (void)viewDidEndLiveResize + { + CATransaction.begin + CATransaction.set({value:0, forKey:kCATransactionAnimationDuration}) + var s = this.frame.size.width / this.originalFrameWidth + transform = CATransform3DMakeScale(s, s, s) + var zDistance = 600 + transform.m34 = 1.0 / -zDistance + this.containerLayer.sublayerTransform = transform + CATransaction.commit + } + } + + // + // Helper methods + // + + function createIconAndItsMirrorInLayer(applicationPath, parentLayer, iconSize) + { + // Get application icon as a CGImage + var image = NSWorkspace.sharedWorkspace.iconForFile(applicationPath) + if (!image) return null +// var cgImage = image.bestRepresentationForDevice(null).CGImage + var cgImage = image.representations[0] + if (!cgImage) return + cgImage = cgImage.CGImage + + // Icon layer + var l = AppLayer.layer + l.applicationPath = String(applicationPath) + l.contents = cgImage + l.bounds = CGRectMake(0, 0, iconSize, iconSize) + l.anchorPoint = CGPointMake(0.5, 0) + parentLayer.addSublayer(l) + + // Mirror layer + var l2 = CALayer.layer + l2.contents = cgImage + l2.bounds = l.bounds + l2.opacity = 0.1 + l2.anchorPoint = CGPointMake(0.5, 1) + parentLayer.addSublayer(l2) + + return [l, l2] + } + + function pitchLayerAndItsMirror(layers, angle, deltaY) + { + var x = layers[0].originalPosition0.x + var y = layers[0].originalPosition0.y + var z = layers[0].originalZPosition + var y2 = y*Math.cos(angle) - z*Math.sin(angle) + var z2 = y*Math.sin(angle) + z*Math.cos(angle) + layers[0].position = CGPointMake(x, y2+deltaY) + layers[0].zPosition = z2 + layers[0].transform = CATransform3DConcat(layers[0].originalTransform0, CATransform3DMakeRotation(angle, 1, 0, 0)) + + var x = layers[0].originalPosition1.x + var y = layers[0].originalPosition1.y + var z = layers[0].originalZPosition + var y2 = y*Math.cos(angle) - z*Math.sin(angle) + var z2 = y*Math.sin(angle) + z*Math.cos(angle) + layers[1].position = CGPointMake(x, y2+deltaY) + layers[1].zPosition = z2 + layers[1].transform = CATransform3DConcat(layers[0].originalTransform1, CATransform3DMakeRotation(angle, 1, 0, 0)) + } + diff --git a/jscocoa/ProcessViewer/main.m b/jscocoa/ProcessViewer/main.m new file mode 100644 index 0000000..9ad6266 --- /dev/null +++ b/jscocoa/ProcessViewer/main.m @@ -0,0 +1,22 @@ +// +// main.m +// JSCoreAnimation +// +// Created by Patrick Geiller on 19/09/08. +// Copyright __MyCompanyName__ 2008. All rights reserved. +// + +#import +#import "JSCocoaController.h" + + +int main(int argc, char *argv[]) +{ + [[NSAutoreleasePool alloc] init]; + id c = [JSCocoaController sharedController]; + id mainJSFile = [NSString stringWithFormat:@"%@/Contents/Resources/main.js", [[NSBundle mainBundle] bundlePath]]; + [c evalJSFile:mainJSFile]; + return NSApplicationMain(argc, (const char **) argv); +} + + diff --git a/jscocoa/README.markdown b/jscocoa/README.markdown new file mode 100644 index 0000000..ebbcc42 --- /dev/null +++ b/jscocoa/README.markdown @@ -0,0 +1,172 @@ +JSCocoa, a bridge from Javascript to Cocoa +== + +With JSCocoa, you can write Cocoa applications (almost) entirely in Javascript or use it as a Plugin engine (like [Acorn ](http://gusmueller.com/blog/archives/2009/01/jscocoa_and_acorn_plugins_in_javascript.html) and [Spice](http://github.com/onecrayon/Spice-sugar)). +JSCocoa uses WebKit's Javascript framework, [JavascriptCore](http://webkit.org/projects/javascript/). + +**JSCocoa is** a way to use Cocoa from Javascript. It works on the Mac (i386, x86_64, PPC), the iPhone and the iPhone simulator. You can write new Cocoa classes in Javascript, replace existing methods of classes by Javascript functions (swizzling them) and call Javascript functions on Cocoa objects (call filter on an NSArray, or use Javascript regular expressions on NSString with myNSString.match(/pattern/)). + +JSCocoa can also be used as a replacement for the existing WebKit bridge, letting you use C functions, structs, and calling pretty much anything from your WebView. Access restriction can be setup by JSCocoa's delegate messages (canGetProperty:ofObject:inContext:, canCallMethod:ofObject:argumentCount:arguments:, etc.) + +Basically, JSCocoa works like these bridges : + +* [RubyCocoa](http://rubycocoa.sourceforge.net/), [MacRuby](http://www.macruby.org/) write Cocoa in Ruby +* [PyObjC](http://pyobjc.sourceforge.net/) write Cocoa in Python +* [LuaCore](http://gusmueller.com/lua/) write Cocoa in Lua + +**JSCocoa isn't** a Javascript framework to use on the Web. For that, check out : + +* [Cappuccino](http://cappuccino.org/) an open source framework that makes it easy to build desktop-caliber applications that run in a web browser +* [SproutCore](http://www.sproutcore.com/) makes building javascript applications fun and easy + +Contribute and discuss +-- + +* [Discussion group](http://groups.google.com/group/jscocoa) Questions ? Join the Google group and ask away ! +* [Twitter](http://twitter.com/parmanoir) Tweet me questions and comments +* [Github](http://github.com/parmanoir/jscocoa/tree/master) fork JSCocoa from Github, add changes, and notify me with a pull request +* [Documentation](http://code.google.com/p/jscocoa/w/list) on Google Code + +Who uses it ? +-- + +* [Spice-sugar](http://github.com/onecrayon/Spice-sugar) Spice.sugar allows the [Espresso text editor](http://macrabbit.com/espresso/) to be extended using JSCocoa +* [Narwhal-jsc](http://github.com/tlrobinson/narwhal-jsc/) A JavascriptCore + optional JSCocoa module for [Narwhal](http://github.com/tlrobinson/narwhal/tree) (Server-side Javascript) +* [JSTalk](http://github.com/ccgus/jstalk/) Gus Mueller, to let Cocoa applications be scripted in Javascript +* [PluginManager](http://github.com/Grayson/pluginmanager/) Grayson Hansard wrote a manager that enables you to write Cocoa plugins in AppleScript, F-Script, Javascript, Lua, Nu, Python and Ruby. +* [Elysium](http://lucidmac.com/products/elysium/) Matt Mower, to script Elysium, a MIDI sequencer +* [Acorn Plugins](http://gusmueller.com/blog/archives/2009/01/jscocoa_and_acorn_plugins_in_javascript.html) Gus Mueller, to let Acorn users write [Acorn](http://flyingmeat.com/acorn/) plugins in Javascript +* [Interactive console for iPhone](http://ido.nu/kuma/2008/11/22/jscocoa-interactive-console-for-iphone/) Kumagai Kentaro wrote a console to interact with the iPhone simulator from a web page ! +* [JSCocoaCodaLoader](http://gusmueller.com/blog/archives/2008/11/jscocoacodaloader.html) write Javascript plugins that work in [Coda](http://www.panic.com/coda/) +* [REPL console](http://tlrobinson.net/blog/2008/10/10/command-line-interpreter-and-repl-for-jscocoa/) Tom Robinson's command line interface + +Are you missing on that list ? [Send me a mail !](mailto:parmanoir@gmail.com) + + +What does it look like ? +-- + + // Get current application name : dot syntax + var appName = NSWorkspace.sharedWorkspace.activeApplication.NSApplicationName + // The same with Objective-J syntax + var appName = [[[NSWorkspace sharedWorkspace] activeApplication] NSApplicationName] + + // Alloc an object (need to release) + var button = NSButton.alloc.initWithFrame(NSMakeRect(0, 0, 100, 40)) + // Alloc an object (no need to release) + var button = [NSButton instanceWithFrame:NSMakeRect(0, 0, 100, 40)] + + // Setting : an ObjC method starting with 'set' can be set like a Javascript property + var window = NSWorkspace.sharedWorkspace.activeApplication.keyWindow + // Instead of calling setTitle ... + window.setTitle('new title') + // ... set the 'title' property + window.title = 'new title' + + // Call methods with Objective-J syntax + [obj callWithParam1:'Hello' andParam2:'World'] + // Or with a jQuery-like syntax (need to be enabled with __jsc__.setUseSplitCall = true) + obj.call({ withParam1:'Hello', andParam2:'World' }) + obj['callWithParam1:andParam2:']('Hello', 'World') + obj.callWithParam1_andParam2('Hello', 'World' ) + + // Unicode identifiers ! + function 追加する(最初の, 次の) { return 最初の+ 次の } + var 結果 = 追加する('こんにちは', '世界') + NSApplication.sharedApplication.keyWindow.title = 結果 + + // Write a new Cocoa class in Javascript (inspired by Cappucino) + class MyClass < NSObject + { + // Custom drawing, calling parent method + - (void)drawRect:(NSRect)rect + { + // do some drawing here + ... + // Call parent method + this.Super(arguments) + } + // Class method + + (float)addFloatX:(float)x andFloatY:(float)y + { + return x + y + } + } + + // Manipulate an existing class + class NSButton + { + // Add a method to an existing class + - (void)someNewMethod:(NSString*)name + { + ... + } + + // Swizzle an instance method of an existing class + Swizzle- (void)drawRect:(NSRect)rect + { + // Draw something behind the button + ... + // Call original swizzled method + this.Original(arguments) + // Draw something in front of the button + NSBezierPath.bezierPathWithOvalInRect(rect).stroke + } + } + + +Starting up +-- +This will start a controller, eval a file, call a Javascript method and get an ObjC object out of it. You can start multiple interpreters, e.g. one for each document. + + // Start + JSCocoa* jsc = [JSCocoa new]; + + // Eval a file + [jsc evalJSFile:@"path to a file"]; + // Eval a string + [jsc evalJSString:@"log(NSWorkspace.sharedWorkspace.activeApplication.NSApplicationName)"]; + + // Add an object of ours to the Javascript context + [jsc setObject:self withName:@"controller"]; + + // Call a Javascript method - we can use any object we added with setObject + JSValueRef returnValue = [jsc callJSFunctionNamed:@"myJavascriptFunction" withArguments:self, nil]; + // The return value might be a raw Javascript value (null, true, false, a number) or an ObjC object + // To get an ObjC object + id resultingObject = [jsc toObject:returnValue]; + + // (Cleanup : only needed if you don't use ObjC's Garbage Collection) + [jsc release]; + + +Add JSCocoa to your project +-- +Use it as a framework : + +* Build JSCocoa/JSCocoa.xcodeproj +* Add built JSCocoa.framework to your project +* import + +Integrate its files directly into your project : + +* Drag the JSCocoa folder in your project +* Delete irrelevant files (Info.plist, JSCocoa_Prefix.pch, English.lproj, project files) +* Add the JavascriptCore framework +* In 'Build' project settings, add -lffi to 'Other linker flags' +* import "JSCocoa.h" + + +Thanks ! +-- +* 280 North — Objective-J syntax idea +* Douglas Crockford — JSLint +* Gus Mueller — Distant Object code +* Jonathan 'Wolf' Rentzsch — JRSwizzle + +Questions, comments, patches +-- +Send me a mail ! + +Patrick Geiller
[parmanoir@gmail.com](mailto:parmanoir@gmail.com) + diff --git a/jscocoa/Samples/ApplicationController.h b/jscocoa/Samples/ApplicationController.h new file mode 100644 index 0000000..391d254 --- /dev/null +++ b/jscocoa/Samples/ApplicationController.h @@ -0,0 +1,19 @@ +// +// ApplicationController.h +// Samples +// +// Created by Patrick Geiller on 01/12/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import +#import "JSCocoa.h" + + +@interface ApplicationController : NSObject { + + JSCocoa* jsc; + +} + +@end diff --git a/jscocoa/Samples/ApplicationController.m b/jscocoa/Samples/ApplicationController.m new file mode 100644 index 0000000..b9e23a2 --- /dev/null +++ b/jscocoa/Samples/ApplicationController.m @@ -0,0 +1,65 @@ +// +// ApplicationController.m +// Samples +// +// Created by Patrick Geiller on 01/12/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "ApplicationController.h" + +#import + +@implementation ApplicationController + +- (void)awakeFromNib +{ + jsc = [JSCocoa new]; +// [jsc + +/* + Dl_info info; + dladdr(dlsym(RTLD_DEFAULT, "backtrace"), &info); + NSLog(@">>%s", info.dli_fname); + + + NSLog(@"******%s***", [JSCocoa typeEncodingOfMethod:@"_setFrameCommon:display:stashSize:" class:@"NSWindow"]); +*/ +/* + + 2 -[NSWindow _setFrameCommon:display:stashSize:] + 2 -[NSWindow _oldPlaceWindow:] + 2 -[NSWindow _setFrame:updateBorderViewSize:] + + +*/ + +/* + id defaults = [NSUserDefaults standardUserDefaults]; + +// NSLog(@"===%d", [defaults integerForKey:@"AppleAntiAliasingThreshold"]); + + + + [defaults setInteger:2 forKey:@"AppleAntiAliasingThreshold"]; + [defaults setInteger:2 forKey:@"AppleScreenAdvanceSizeThreshold"]; + [defaults setInteger:2 forKey:@"AppleSmoothFontsSizeThreshold"]; + + [defaults synchronize]; +*/ +/* + NSLog(@"%@", [NSThread callStackSymbols]); + NSLog(@"========================"); + NSLog(@"%@", [NSThread callStackReturnAddresses]); +*/ +// id path = [NSString stringWithFormat:@"%@document.js", [[NSBundle mainBundle] bundlePath]]; + id path = [[NSBundle mainBundle] pathForResource:@"document" ofType:@"js"]; + NSLog(@"path=%@", path); + +// canLoad = NO; + BOOL evaled = [jsc evalJSFile:path]; + +} + +@end + diff --git a/jscocoa/Samples/English.lproj/InfoPlist.strings b/jscocoa/Samples/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/jscocoa/Samples/English.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/jscocoa/Samples/English.lproj/MainMenu.xib b/jscocoa/Samples/English.lproj/MainMenu.xib new file mode 100644 index 0000000..03a2afe --- /dev/null +++ b/jscocoa/Samples/English.lproj/MainMenu.xib @@ -0,0 +1,4288 @@ + + + + 1060 + 10C540 + 740 + 1038.25 + 458.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 740 + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + Samples + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + Samples + + YES + + + About Samples + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide Samples + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit Samples + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Paste and Match Style + V + 1572864 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling and Grammar + : + 1048576 + 2147483647 + + + + + + Check Document Now + ; + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + Correct Spelling Automatically + + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Show Substitutions + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Dashes + + 2147483647 + + + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + Text Replacement + + 2147483647 + + + + + + + + + Transformations + + 2147483647 + + + submenuAction: + + Transformations + + YES + + + Make Upper Case + + 2147483647 + + + + + + Make Lower Case + + 2147483647 + + + + + + Capitalize + + 2147483647 + + + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Writing Direction + + 2147483647 + + + submenuAction: + + Writing Direction + + YES + + + YES + Paragraph + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + YES + Selection + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Actual Size + 0 + 1048576 + 2147483647 + + + + + + Zoom In + + + 1048576 + 2147483647 + + + + + + Zoom Out + - + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + View Compiled Source + + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + YES + + + Samples Help + ? + 1048576 + 2147483647 + + + + + _NSHelpMenu + + + + _NSMainMenu + + + NSFontManager + + + ApplicationController + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 371 + + + + openDocument: + + + + 372 + + + + printDocument: + + + + 373 + + + + addFontTrait: + + + + 420 + + + + addFontTrait: + + + + 421 + + + + modifyFont: + + + + 422 + + + + orderFrontFontPanel: + + + + 423 + + + + modifyFont: + + + + 424 + + + + raiseBaseline: + + + + 425 + + + + lowerBaseline: + + + + 426 + + + + copyFont: + + + + 427 + + + + subscript: + + + + 428 + + + + superscript: + + + + 429 + + + + tightenKerning: + + + + 430 + + + + underline: + + + + 431 + + + + orderFrontColorPanel: + + + + 432 + + + + useAllLigatures: + + + + 433 + + + + loosenKerning: + + + + 434 + + + + pasteFont: + + + + 435 + + + + unscript: + + + + 436 + + + + useStandardKerning: + + + + 437 + + + + useStandardLigatures: + + + + 438 + + + + turnOffLigatures: + + + + 439 + + + + turnOffKerning: + + + + 440 + + + + terminate: + + + + 448 + + + + capitalizeWord: + + + + 454 + + + + lowercaseWord: + + + + 455 + + + + uppercaseWord: + + + + 456 + + + + toggleAutomaticDashSubstitution: + + + + 460 + + + + orderFrontSubstitutionsPanel: + + + + 461 + + + + toggleAutomaticTextReplacement: + + + + 463 + + + + toggleAutomaticSpellingCorrection: + + + + 466 + + + + performFindPanelAction: + + + + 467 + + + + performFindPanelAction: + + + + 468 + + + + performFindPanelAction: + + + + 469 + + + + pasteAsPlainText: + + + + 471 + + + + showHelp: + + + + 494 + + + + alignCenter: + + + + 517 + + + + pasteRuler: + + + + 518 + + + + toggleRuler: + + + + 519 + + + + alignRight: + + + + 520 + + + + copyRuler: + + + + 521 + + + + alignJustified: + + + + 522 + + + + alignLeft: + + + + 523 + + + + makeBaseWritingDirectionNatural: + + + + 524 + + + + makeBaseWritingDirectionLeftToRight: + + + + 525 + + + + makeBaseWritingDirectionRightToLeft: + + + + 526 + + + + makeTextWritingDirectionNatural: + + + + 527 + + + + makeTextWritingDirectionLeftToRight: + + + + 528 + + + + makeTextWritingDirectionRightToLeft: + + + + 529 + + + + delegate + + + + 531 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + + + 80 + + + + + 78 + + + + + 72 + + + + + 82 + + + + + 124 + + + YES + + + + + + 77 + + + + + 73 + + + + + 79 + + + + + 112 + + + + + 74 + + + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + + + 144 + + + + + 129 + + + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 374 + + + YES + + + + + + 375 + + + YES + + + + + + + 376 + + + YES + + + + + + 387 + + + YES + + + + + + + + + + + + + + + + + + + + + 388 + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + YES + + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + YES + + + + + + + + + + 405 + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + YES + + + + + + + + 411 + + + + + 412 + + + + + 413 + + + + + 414 + + + YES + + + + + + + + + 415 + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 449 + + + YES + + + + + + 450 + + + YES + + + + + + + + 451 + + + + + 452 + + + + + 453 + + + + + 457 + + + + + 458 + + + + + 459 + + + + + 462 + + + + + 464 + + + + + 465 + + + + + 470 + + + + + 491 + + + YES + + + + + + 492 + + + YES + + + + + + 493 + + + + + 495 + + + YES + + + + + + 496 + + + YES + + + + + + + + + + + + + + + 497 + + + + + 498 + + + + + 499 + + + + + 500 + + + + + 501 + + + + + 502 + + + YES + + + + + + 503 + + + + + 504 + + + + + 505 + + + + + 506 + + + + + 507 + + + YES + + + + + + + + + + + + + + 508 + + + + + 509 + + + + + 510 + + + + + 511 + + + + + 512 + + + + + 513 + + + + + 514 + + + + + 515 + + + + + 516 + + + + + 530 + + + + + 532 + + + + + 533 + + + + + 534 + + + + + 535 + + + + + 536 + + + + + 537 + + + + + + + YES + + YES + -3.IBPluginDependency + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBEditorWindowLastContentRect + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBEditorWindowLastContentRect + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBEditorWindowLastContentRect + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 374.IBPluginDependency + 375.IBEditorWindowLastContentRect + 375.IBPluginDependency + 376.IBPluginDependency + 387.IBEditorWindowLastContentRect + 387.IBPluginDependency + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 449.IBPluginDependency + 450.IBEditorWindowLastContentRect + 450.IBPluginDependency + 451.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 457.IBPluginDependency + 458.IBPluginDependency + 459.IBPluginDependency + 462.IBPluginDependency + 464.IBPluginDependency + 465.IBPluginDependency + 470.IBPluginDependency + 491.IBPluginDependency + 492.IBEditorWindowLastContentRect + 492.IBPluginDependency + 493.IBPluginDependency + 495.IBPluginDependency + 496.IBEditorWindowLastContentRect + 496.IBPluginDependency + 497.IBPluginDependency + 498.IBPluginDependency + 499.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 500.IBPluginDependency + 501.IBPluginDependency + 502.IBPluginDependency + 503.IBPluginDependency + 504.IBPluginDependency + 505.IBPluginDependency + 506.IBPluginDependency + 507.IBEditorWindowLastContentRect + 507.IBPluginDependency + 508.IBPluginDependency + 509.IBPluginDependency + 510.IBPluginDependency + 511.IBPluginDependency + 512.IBPluginDependency + 513.IBPluginDependency + 514.IBPluginDependency + 515.IBPluginDependency + 516.IBPluginDependency + 532.IBPluginDependency + 533.IBPluginDependency + 534.IBPluginDependency + 535.IBPluginDependency + 536.IBPluginDependency + 537.IBPluginDependency + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{656, 201}, {275, 113}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{624, 103}, {254, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{197, 734}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{656, 211}, {164, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{642, 251}, {238, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{784, 313}, {194, 73}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{403, 395}, {424, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{11, 977}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{645, 252}, {242, 143}} + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{642, 181}, {220, 133}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + {{579, 352}, {83, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{662, 112}, {175, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{786, 257}, {170, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{855, 363}, {246, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{751, 183}, {204, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{955, 103}, {164, 173}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + {{416, 203}, {275, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{582, 183}, {196, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{155, 774}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + + YES + + + + + YES + + + YES + + + + 537 + + + + YES + + ApplicationController + NSObject + + IBProjectSource + ApplicationController.h + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaController.h + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaLib.h + + + + + YES + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSBrowser + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSDocument + NSObject + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocument.h + + + + NSDocument + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentScripting.h + + + + NSDocumentController + NSObject + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentController.h + + + + NSFontManager + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMatrix + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSMatrix.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMovieView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMovieView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebEditingDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebFrameLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebJavaPlugIn.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPlugin.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPluginContainer.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPolicyDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebResourceLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebScriptObject.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebUIDelegate.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTableView + NSControl + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextView + NSText + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + WebView + NSView + + YES + + YES + goBack: + goForward: + makeTextLarger: + makeTextSmaller: + makeTextStandardSize: + reload: + reloadFromOrigin: + stopLoading: + takeStringURLFrom: + toggleContinuousSpellChecking: + toggleSmartInsertDelete: + + + YES + id + id + id + id + id + id + id + id + id + id + id + + + + IBFrameworkSource + WebKit.framework/Headers/WebView.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../Samples.xcodeproj + 3 + + diff --git a/jscocoa/Samples/English.lproj/MyDocument.xib b/jscocoa/Samples/English.lproj/MyDocument.xib new file mode 100644 index 0000000..89defe4 --- /dev/null +++ b/jscocoa/Samples/English.lproj/MyDocument.xib @@ -0,0 +1,771 @@ + + + + 1060 + 10C540 + 740 + 1038.25 + 458.00 + + YES + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + 740 + 740 + + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + + YES + + + YES + + + + YES + + MyDocument + + + FirstResponder + + + 15 + 2 + {{133, -121}, {800, 800}} + 1886912512 + Window + NSWindow + View + {1.79769e+308, 1.79769e+308} + {94, 86} + + + 256 + + YES + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + + {800, 800} + + + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + {800, 800} + + + {{0, 0}, {1440, 878}} + {94, 108} + {1.79769e+308, 1.79769e+308} + + + NSApplication + + + + + YES + + + delegate + + + + 17 + + + + window + + + + 18 + + + + webView + + + + 100022 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + 5 + + + YES + + + + Window + + + 6 + + + YES + + + + + + -3 + + + Application + + + 100021 + + + + + + + YES + + YES + -3.IBPluginDependency + 100021.IBPluginDependency + 5.IBEditorWindowLastContentRect + 5.IBPluginDependency + 5.IBWindowTemplateEditedContentRect + 5.ImportedFromIB2 + 5.editorWindowContentRectSynchronizationRect + 5.windowTemplate.hasMinSize + 5.windowTemplate.minSize + 6.IBPluginDependency + 6.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + {{446, 49}, {800, 800}} + com.apple.InterfaceBuilder.CocoaPlugin + {{446, 49}, {800, 800}} + + {{201, 387}, {507, 413}} + + {94, 86} + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + + YES + + + + + YES + + + YES + + + + 100022 + + + + YES + + MyDocument + + webView + id + + + IBUserSource + + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaController.h + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaLib.h + + + + + YES + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebEditingDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebFrameLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebJavaPlugIn.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPlugin.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPluginContainer.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPolicyDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebResourceLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebScriptObject.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebUIDelegate.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + WebView + NSView + + YES + + YES + goBack: + goForward: + makeTextLarger: + makeTextSmaller: + makeTextStandardSize: + reload: + reloadFromOrigin: + stopLoading: + takeStringURLFrom: + toggleContinuousSpellChecking: + toggleSmartInsertDelete: + + + YES + id + id + id + id + id + id + id + id + id + id + id + + + + IBFrameworkSource + WebKit.framework/Headers/WebView.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../Samples.xcodeproj + 3 + + diff --git a/jscocoa/Samples/MyDocument.h b/jscocoa/Samples/MyDocument.h new file mode 100644 index 0000000..634eee8 --- /dev/null +++ b/jscocoa/Samples/MyDocument.h @@ -0,0 +1,16 @@ +// +// MyDocument.h +// Samples +// +// Created by Patrick Geiller on 01/12/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + + +#import +/* +@interface MyDocument : NSDocument +{ +} +@end +*/ \ No newline at end of file diff --git a/jscocoa/Samples/MyDocument.m b/jscocoa/Samples/MyDocument.m new file mode 100644 index 0000000..8921273 --- /dev/null +++ b/jscocoa/Samples/MyDocument.m @@ -0,0 +1,67 @@ +// +// MyDocument.m +// Samples +// +// Created by Patrick Geiller on 01/12/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "MyDocument.h" +/* +@implementation MyDocument + +- (id)init +{ + self = [super init]; + if (self) { + + // Add your subclass-specific initialization here. + // If an error occurs here, send a [self release] message and return nil. + + } + return self; +} + +- (NSString *)windowNibName +{ + // Override returning the nib file name of the document + // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead. + return @"MyDocument"; +} + +- (void)windowControllerDidLoadNib:(NSWindowController *) aController +{ + [super windowControllerDidLoadNib:aController]; + // Add any code here that needs to be executed once the windowController has loaded the document's window. +} + +- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError +{ + // Insert code here to write your document to data of the specified type. If the given outError != NULL, ensure that you set *outError when returning nil. + + // You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead. + + // For applications targeted for Panther or earlier systems, you should use the deprecated API -dataRepresentationOfType:. In this case you can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead. + + if ( outError != NULL ) { + *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; + } + return nil; +} + +- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError +{ + // Insert code here to read your document from the given data of the specified type. If the given outError != NULL, ensure that you set *outError when returning NO. + + // You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead. + + // For applications targeted for Panther or earlier systems, you should use the deprecated API -loadDataRepresentation:ofType. In this case you can also choose to override -readFromFile:ofType: or -loadFileWrapperRepresentation:ofType: instead. + + if ( outError != NULL ) { + *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; + } + return YES; +} + +@end +*/ \ No newline at end of file diff --git a/jscocoa/Samples/Samples-Info.plist b/jscocoa/Samples/Samples-Info.plist new file mode 100644 index 0000000..00b0875 --- /dev/null +++ b/jscocoa/Samples/Samples-Info.plist @@ -0,0 +1,79 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + jscocoa + + CFBundleTypeIconFile + + CFBundleTypeName + DocumentType + CFBundleTypeOSTypes + + ???? + + CFBundleTypeRole + Editor + NSDocumentClass + MyDocument + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.inexdo.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1 + CFBundleShortVersionString + 1.0 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + LSMinimumSystemVersion + 10.5 + UTExportedTypeDeclarations + + + UTTypeConformsTo + + com.netscape.javascript-source + + UTTypeDescription + JSCocoa Document + UTTypeIdentifier + org.jscocoa.jscocoa-source + UTTypeReferenceURL + http://github.com/parmanoir/jscocoa + UTTypeTagSpecification + + public.filename-extension + + jscocoa + + public.mime-type + application/x-jscocoa + + + + + diff --git a/jscocoa/Samples/Samples.xcodeproj/project.pbxproj b/jscocoa/Samples/Samples.xcodeproj/project.pbxproj new file mode 100644 index 0000000..7d386f0 --- /dev/null +++ b/jscocoa/Samples/Samples.xcodeproj/project.pbxproj @@ -0,0 +1,390 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58280DA1D0D100B32029 /* MyDocument.xib */; }; + 1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */; }; + 3D8159AA10C489A70015B843 /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D81597A10C489A70015B843 /* BridgeSupportController.m */; }; + 3D8159AB10C489A70015B843 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D81597B10C489A70015B843 /* class.js */; }; + 3D8159B910C489A70015B843 /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D8159A010C489A70015B843 /* JSCocoaController.m */; }; + 3D8159BA10C489A70015B843 /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D8159A210C489A70015B843 /* JSCocoaFFIArgument.m */; }; + 3D8159BB10C489A70015B843 /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D8159A410C489A70015B843 /* JSCocoaFFIClosure.m */; }; + 3D8159BC10C489A70015B843 /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D8159A610C489A70015B843 /* JSCocoaLib.m */; }; + 3D8159BD10C489A70015B843 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D8159A810C489A70015B843 /* JSCocoaPrivateObject.m */; }; + 3D8159BE10C489A70015B843 /* jslint-jscocoa.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D8159A910C489A70015B843 /* jslint-jscocoa.js */; }; + 3D8159DF10C489E30015B843 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D8159DE10C489E30015B843 /* JavaScriptCore.framework */; }; + 3D815A4B10C48B020015B843 /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D815A4A10C48B020015B843 /* ApplicationController.m */; }; + 3D815A5B10C48BB20015B843 /* document.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D815A5A10C48BB20015B843 /* document.js */; }; + 3D815A7310C48BF60015B843 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D815A7210C48BF60015B843 /* WebKit.framework */; }; + 3D815A8510C48C4B0015B843 /* code colorer.html in Resources */ = {isa = PBXBuildFile; fileRef = 3D815A8410C48C4B0015B843 /* code colorer.html */; }; + 3D955F9510C66EAC0081449A /* code colorer.css in Resources */ = {isa = PBXBuildFile; fileRef = 3D955F9410C66EAC0081449A /* code colorer.css */; }; + 8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */; }; + 8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165FFE840EACC02AAC07 /* InfoPlist.strings */; }; + 8D15AC310486D014006FF6A4 /* MyDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */; settings = {ATTRIBUTES = (); }; }; + 8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 089C1660FE840EACC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 1DDD58290DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MyDocument.xib; sourceTree = ""; }; + 1DDD582B0DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 2564AD2C0F5327BB00F57823 /* Samples_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Samples_Prefix.pch; sourceTree = ""; }; + 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyDocument.m; sourceTree = ""; }; + 2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyDocument.h; sourceTree = ""; }; + 2A37F4B0FDCFA73011CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = ""; }; + 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 3D81597910C489A70015B843 /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3D81597A10C489A70015B843 /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3D81597B10C489A70015B843 /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3D81599A10C489A70015B843 /* JSCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa.h; sourceTree = ""; }; + 3D81599F10C489A70015B843 /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3D8159A010C489A70015B843 /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3D8159A110C489A70015B843 /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3D8159A210C489A70015B843 /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 3D8159A310C489A70015B843 /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3D8159A410C489A70015B843 /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3D8159A510C489A70015B843 /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLib.h; sourceTree = ""; }; + 3D8159A610C489A70015B843 /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaLib.m; sourceTree = ""; }; + 3D8159A710C489A70015B843 /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3D8159A810C489A70015B843 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3D8159A910C489A70015B843 /* jslint-jscocoa.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "jslint-jscocoa.js"; sourceTree = ""; }; + 3D8159DE10C489E30015B843 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; + 3D815A4910C48B020015B843 /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = ""; }; + 3D815A4A10C48B020015B843 /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = ""; }; + 3D815A5A10C48BB20015B843 /* document.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = document.js; sourceTree = ""; }; + 3D815A7210C48BF60015B843 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + 3D815A8410C48C4B0015B843 /* code colorer.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "code colorer.html"; sourceTree = ""; }; + 3D955F9410C66EAC0081449A /* code colorer.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "code colorer.css"; sourceTree = ""; }; + 8D15AC360486D014006FF6A4 /* Samples-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Samples-Info.plist"; sourceTree = ""; }; + 8D15AC370486D014006FF6A4 /* Samples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Samples.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D15AC330486D014006FF6A4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */, + 3D8159DF10C489E30015B843 /* JavaScriptCore.framework in Frameworks */, + 3D815A7310C48BF60015B843 /* WebKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1058C7A6FEA54F5311CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A8FEA54F5311CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */, + 13E42FBA07B3F13500E4EEF1 /* CoreData.framework */, + 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FB0FE9D524F11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D15AC370486D014006FF6A4 /* Samples.app */, + ); + name = Products; + sourceTree = ""; + }; + 2A37F4AAFDCFA73011CA2CEA /* Samples */ = { + isa = PBXGroup; + children = ( + 3D81597810C489A60015B843 /* JSCocoa */, + 2A37F4ABFDCFA73011CA2CEA /* Classes */, + 2A37F4AFFDCFA73011CA2CEA /* Other Sources */, + 2A37F4B8FDCFA73011CA2CEA /* Resources */, + 2A37F4C3FDCFA73011CA2CEA /* Frameworks */, + 19C28FB0FE9D524F11CA2CBB /* Products */, + ); + name = Samples; + sourceTree = ""; + }; + 2A37F4ABFDCFA73011CA2CEA /* Classes */ = { + isa = PBXGroup; + children = ( + 2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */, + 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */, + 3D815A4910C48B020015B843 /* ApplicationController.h */, + 3D815A4A10C48B020015B843 /* ApplicationController.m */, + 3D815A5A10C48BB20015B843 /* document.js */, + ); + name = Classes; + sourceTree = ""; + }; + 2A37F4AFFDCFA73011CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 2564AD2C0F5327BB00F57823 /* Samples_Prefix.pch */, + 2A37F4B0FDCFA73011CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 2A37F4B8FDCFA73011CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 3D955F9410C66EAC0081449A /* code colorer.css */, + 3D815A8410C48C4B0015B843 /* code colorer.html */, + 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */, + 8D15AC360486D014006FF6A4 /* Samples-Info.plist */, + 089C165FFE840EACC02AAC07 /* InfoPlist.strings */, + 1DDD58280DA1D0D100B32029 /* MyDocument.xib */, + 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */, + ); + name = Resources; + sourceTree = ""; + }; + 2A37F4C3FDCFA73011CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A6FEA54F5311CA2CBB /* Linked Frameworks */, + 1058C7A8FEA54F5311CA2CBB /* Other Frameworks */, + 3D8159DE10C489E30015B843 /* JavaScriptCore.framework */, + 3D815A7210C48BF60015B843 /* WebKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3D81597810C489A60015B843 /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3D81597910C489A70015B843 /* BridgeSupportController.h */, + 3D81597A10C489A70015B843 /* BridgeSupportController.m */, + 3D81597B10C489A70015B843 /* class.js */, + 3D81599A10C489A70015B843 /* JSCocoa.h */, + 3D81599F10C489A70015B843 /* JSCocoaController.h */, + 3D8159A010C489A70015B843 /* JSCocoaController.m */, + 3D8159A110C489A70015B843 /* JSCocoaFFIArgument.h */, + 3D8159A210C489A70015B843 /* JSCocoaFFIArgument.m */, + 3D8159A310C489A70015B843 /* JSCocoaFFIClosure.h */, + 3D8159A410C489A70015B843 /* JSCocoaFFIClosure.m */, + 3D8159A510C489A70015B843 /* JSCocoaLib.h */, + 3D8159A610C489A70015B843 /* JSCocoaLib.m */, + 3D8159A710C489A70015B843 /* JSCocoaPrivateObject.h */, + 3D8159A810C489A70015B843 /* JSCocoaPrivateObject.m */, + 3D8159A910C489A70015B843 /* jslint-jscocoa.js */, + ); + name = JSCocoa; + path = ../JSCocoa; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D15AC270486D014006FF6A4 /* Samples */ = { + isa = PBXNativeTarget; + buildConfigurationList = C05733C708A9546B00998B17 /* Build configuration list for PBXNativeTarget "Samples" */; + buildPhases = ( + 8D15AC2B0486D014006FF6A4 /* Resources */, + 8D15AC300486D014006FF6A4 /* Sources */, + 8D15AC330486D014006FF6A4 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Samples; + productInstallPath = "$(HOME)/Applications"; + productName = Samples; + productReference = 8D15AC370486D014006FF6A4 /* Samples.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2A37F4A9FDCFA73011CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "Samples" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 2A37F4AAFDCFA73011CA2CEA /* Samples */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D15AC270486D014006FF6A4 /* Samples */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D15AC2B0486D014006FF6A4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D8159BE10C489A70015B843 /* jslint-jscocoa.js in Resources */, + 3D815A5B10C48BB20015B843 /* document.js in Resources */, + 3D8159AB10C489A70015B843 /* class.js in Resources */, + 8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */, + 8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */, + 1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */, + 1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */, + 3D815A8510C48C4B0015B843 /* code colorer.html in Resources */, + 3D955F9510C66EAC0081449A /* code colorer.css in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D15AC300486D014006FF6A4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D15AC310486D014006FF6A4 /* MyDocument.m in Sources */, + 8D15AC320486D014006FF6A4 /* main.m in Sources */, + 3D8159AA10C489A70015B843 /* BridgeSupportController.m in Sources */, + 3D8159B910C489A70015B843 /* JSCocoaController.m in Sources */, + 3D8159BA10C489A70015B843 /* JSCocoaFFIArgument.m in Sources */, + 3D8159BB10C489A70015B843 /* JSCocoaFFIClosure.m in Sources */, + 3D8159BC10C489A70015B843 /* JSCocoaLib.m in Sources */, + 3D8159BD10C489A70015B843 /* JSCocoaPrivateObject.m in Sources */, + 3D815A4B10C48B020015B843 /* ApplicationController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C165FFE840EACC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C1660FE840EACC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 1DDD58280DA1D0D100B32029 /* MyDocument.xib */ = { + isa = PBXVariantGroup; + children = ( + 1DDD58290DA1D0D100B32029 /* English */, + ); + name = MyDocument.xib; + sourceTree = ""; + }; + 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 1DDD582B0DA1D0D100B32029 /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; + 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */ = { + isa = PBXVariantGroup; + children = ( + 2A37F4BAFDCFA73011CA2CEA /* English */, + ); + name = Credits.rtf; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C05733C808A9546B00998B17 /* 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; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Samples_Prefix.pch; + INFOPLIST_FILE = "Samples-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = Samples; + }; + name = Debug; + }; + C05733C908A9546B00998B17 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Samples_Prefix.pch; + INFOPLIST_FILE = "Samples-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = Samples; + }; + name = Release; + }; + C05733CC08A9546B00998B17 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.6; + }; + name = Debug; + }; + C05733CD08A9546B00998B17 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.6; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C05733C708A9546B00998B17 /* Build configuration list for PBXNativeTarget "Samples" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C05733C808A9546B00998B17 /* Debug */, + C05733C908A9546B00998B17 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "Samples" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C05733CC08A9546B00998B17 /* Debug */, + C05733CD08A9546B00998B17 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2A37F4A9FDCFA73011CA2CEA /* Project object */; +} diff --git a/jscocoa/Samples/Samples_Prefix.pch b/jscocoa/Samples/Samples_Prefix.pch new file mode 100644 index 0000000..b2a4db4 --- /dev/null +++ b/jscocoa/Samples/Samples_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'Samples' target in the 'Samples' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/jscocoa/Samples/code colorer.css b/jscocoa/Samples/code colorer.css new file mode 100644 index 0000000..3f60fc9 --- /dev/null +++ b/jscocoa/Samples/code colorer.css @@ -0,0 +1,408 @@ + html, body + { + margin: 0; + padding: 0; + font-family: Lucida Grande; + } + pre, code + { + font-family: Monaco; + font-size: 8.2px; + } + body + { + font-size: 80%; + ebackground-color: rgb(255, 255, 240); + } + textarea + { + width: 100%; + height: 500px; + ecolor: rgba(255, 255, 255, 0.1); + background-color: transparent; + font-family: courier; + font-family: Andale Mono; + font-family: Monaco; + font-size: 7pt; + } + td + { + vertical-align: top; + width: 50%; + } + #highlighted, #fontWidthMeasurer, #whiteSpaceRevealer, #tracesContainer + { + position: relative; + white-space: pre-wrap; + font-family: monaco; + font-size: 7pt; + outline: none; + } + #highlighted + { + -webkit-user-modify: read-write; + } + #sourceContainer + { + height: 100%; + overflow-y: scroll; + position: relative; + } + + + .line + { + ebackground-color: #fafafa; + eposition: relative; + line-height: 1.3em; + min-height: 1.3em; + } + #selectedLine + { + background-color: lime; + background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.8)), to(rgba(240, 240, 240, 0.8))); + border: solid 1px #bbb; + border-left: 0; + border-right: 0; + margin: -1px 0; + position: absolute; + width: 100%; + } + #selectedLinePosition + { + position: absolute; + right: 0; + bottom: 0; + margin-right: 10px; + font-size: 50%; + opacity: 0.3; + z-index: 300; + cursor: pointer; + } + + #dumpHighlighted + { + } + #dump5 + { + white-space: normal; + } + + + /* source styling */ + .keyword + { + color: rgba(70, 98, 195, 1); + text-shadow: rgba(51, 28, 255, 0.9) 0px 0px 1px, rgba(91, 28, 255, 0.5) 0px 0px 0px; + } + .exps + { + color: red; + } + .number + { + color: green; + } + .string + { + color: purple; + } + .comment + { + color: rgb(83, 180, 255); + ecolor: #888; + } + /* lime !*/ + .string + { + color: #0f0; + color: rgb(107, 166, 0); + background-color: rgb(223, 255, 186); + -webkit-border-radius: 2px; + } + .number + { + color: rgb(255, 115, 0); + background-color: rgba(255, 238, 165, 0.7); + -webkit-border-radius: 2px; + } + + .objcCall + { + color: #864; + color: #753; + text-shadow: rgba(255, 160, 128, .9) 0px 1px 4px; + } + .objcCallSelector + { + border-bottom: dotted 2px #fdc; + border-bottom: dotted 1px #ca8; + } + .objcCallBracket + { + } + + + .newline + { +/* + white-space: normal; + white-space: wrap; + white-space: nowrap; +*/ + eborder: solid 3px red; + edisplay: inline-block; + } + + +/* + .newline:before + { + content: '¶'; + } + .space:before + { + content: '·'; + } + .tab:before + { + content: '→'; + } +*/ +/* + .newline, .space, .tab + { + color: rgb(83, 180, 255); + eposition: absolute; + } +*/ +/* + .newline + { + display: inline-block; border: solid 1px red; height : 7px; width: 7px; + + } + .newline-normal + { + white-space: normal; + display: inline-block; border: solid 1px lime; height : 7px; width: 7px; + + } +*/ + /* source styling */ + + + .tabspaceviewer + { + white-space: pre; + font-family: monaco; + font-size: 7pt; + } + + .visualtab + { + background-color: red; + position: absolute; + display: inline-block; + border-left: solid 1px #ddd; + height: 800px; + } + + .fakeTab + { +/* + eborder: solid 1px red; + height: 2px; + background-color: lime; +*/ + } + + #fontWidthMeasurer + { + position: absolute; + top: -30000px; + } + #rawSourceFromLineExtractor + { + display: none; + } +/* + .bubble + { + position: absolute; + letter-spacing: 0px; + width: 800px; + background-color: yellow; + position: absolute; + z-index: 100; + } +*/ + .bubble + { + + padding: 1px 6px; + padding-bottom: 2px; + + white-space: normal; + + position: relative; + display: inline-block; + margin-bottom: 2em; + max-width: 160px; + z-index: 2; + margin-left: -14px; + margin-top: 2px; + + + font-family: helvetica neue; + font-family: gill sans; + font-family: lucida grande; + font-size: 9px; + + background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.2)), to(rgba(0, 0, 0, 0.2))); + background-color: red; + + -webkit-border-radius: 5px; + -webkit-box-shadow: rgba(0, 0, 0, 0.5) 0px 2px 5px; + + color: white; + text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 1px; + +/* + color: black; + border: solid 1px #bbb; + background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.2)), to(rgba(0, 0, 0, 0.07))); + background-color: white; + text-shadow: rgba(0, 0, 0, 0.0005) 0px -1px 1px; + font-size: 10px; + -webkit-box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 5px; +*/ +/* + background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.2)), to(rgba(0, 0, 0, 0.2))); + background-color: red; + text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 1px; + color: white; + efont-weight: bold; + + -webkit-border-radius: 5px; + -webkit-box-shadow: rgba(0, 0, 0, 0.3) 0px 3px 5px; + + display: inline-block; + margin-bottom: 2em; + max-width: 160px; + emin-width: 80px; + position: relative; + z-index: 2; + margin-left: -14px; + margin-top: 2px; + ecolor: rgba(255, 255, 255, 0.9); + + background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.2)), to(rgba(0, 0, 0, 0.2))); + background-color: #888; + color: black; + color: red; + background-color: #f80; + + background: -webkit-gradient(linear, left top, left bottom, from(#f66), to(#f22)); + color: white; + text-shadow: rgba(0, 0, 0, 0.3) 0px -1px 1px; + text-shadow: rgba(0, 0, 0, 0) 0px 0px 0px; + color: black; + background-color: white; + background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#888)); + background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#fff)); + border: solid 2px red; +*/ + } + .bubble b + { + margin: 0 2px; + font-family: monaco; + font-weight: normal; + efont-size: 150%; + evertical-align: -10%; + color: white; + color: #fd8; + } + .bubbleWrapper + { + position: absolute; + z-index: 8; + } + .bubbleArrow + { + position: absolute; + top: -21px; + top: -5px; + font-size: 40pt; + -webkit-transform: rotate(180deg); + color: red; + margin-left: -14px; + margin-top: 2px; + eborder: solid 1px lime; + ebackground-color: rgba(0, 255, 0, 0.5); + ez-index: 20; + height: 45px; + overflow: hidden; + + font-size: 14pt; + -webkit-transform: rotate(90deg); + ez-index: 10; + ecolor: lime; + left: -16px; + top: -14px; + } + + + + #lineNumbers + { + position: absolute; + width: 25px; + border-right: solid 1px #eee; + background-color: #f8f8f8; + } + #highlightedContainer + { + padding-left: 34px; + position: relative; + } + #highlighted, #highlightedContainer + { + position: relative; + } + + .lineNumber + { + font-size: 50%; + color: #ccc; + text-align: right; + padding-right: 1px; + position: relative; + z-index: 4; + } + .l10 + { + color: #888; + } + + #whiteSpaceRevealer div + { + color: rgb(83, 180, 255); +/* color: #800; text-shadow: red 0px 0px 1px, red 0px 0px 0px, red 0px 0px 2px, red 0px 0px 2px;*/ + position: absolute; + } + + .trace + { + -webkit-box-shadow: rgba(83, 180, 255, .9) 0px 0px 20px, rgba(83, 180, 255, .3) 0px 0px 20px; + -webkit-box-shadow: rgba(83, 180, 255, 0.6) 0px 0px 16px; + width: 1px; + position: absolute; + ebackground-color: #ddd; + margin-left: 2px; + clip: rect(-10px, 100000px, 100000px, 0px); + -webkit-transform: rotate(180deg); + border-right: solid 1px rgba(83, 180, 255, 0.2); + eopacity: 0.7; + } diff --git a/jscocoa/Samples/code colorer.html b/jscocoa/Samples/code colorer.html new file mode 100644 index 0000000..e882c3f --- /dev/null +++ b/jscocoa/Samples/code colorer.html @@ -0,0 +1,2417 @@ + + + + + Code Colorer + + + + + + +
  • REMOVE STYLESHEET +
  • make an automated undo tester : random commands (including undo/redo) + consistency test : replay to initial state, then back to final +
+ +
+ + + +
+
+
+
+
SELECTION DUMP
+
+
LOG ALL COMMANDS HERE. typing (typing count, line extent + sel) + move + undo/redo
+
clock dump
+
+
UNDO DUMP
+ + + + +
order dump
+
lines dump
+
+ + + // List launched applications + var apps = [[NSWorkspace sharedWorkspace] launchedApplications] + + for (var i=0; i + +

+
+
+
+
+
+

+
+

+	

+
+ +

+	

+	
+	
+
+		
+
+
+	

+ +* 4-click selection : menu to select fonction, block, .... move caret to start of function ... + + + +* sel.setBaseAndExtent(sel.baseNode, sel.baseOffset, sel.extentNode, sel.extentOffset) + breaks selection anchor : when shift selecting, selection will always grow instead of being anchored. + (base and offset show up as switched in the dump)` + +* option left, double click 'this.var' should not select 'this.var' but only 'this' or 'var' + +* need to hook up / down + +* do NOT intercept undo / redo in Cocoa, let Cocoa handle it + +* BUG + * type + * click right pane + * click left pane + -> no node + +* BUG + * newline + * tab + * space + -> no space ! + + + diff --git a/jscocoa/Samples/document.js b/jscocoa/Samples/document.js new file mode 100644 index 0000000..81ca2d7 --- /dev/null +++ b/jscocoa/Samples/document.js @@ -0,0 +1,193 @@ + +var doc + class MyDocument < NSDocument + { + + + - (NSString *)windowNibName + { + return 'MyDocument' + } + + - (void)windowControllerDidLoadNib:(NSWindowController *) controller + { + log('===' + controller.shouldCascadeWindows + '==' + controller + ' document=' + controller.document + ' window=' + controller.window + ' self=' + this) + + log('****windowControllerDidLoadNib: webView=' + this.webView) + +// this.webView.mainFrameURL = 'http://www.google.com' + +// this.webView.setFrameLoadDelegate(this) + url = [[NSBundle mainBundle] pathForResource:'code colorer' ofType:'html'] + var localUrl = 'file:///Users/mini/Sites/lintex/code%20colorer.html' + url = localUrl + if (url == localUrl) log('***loading LOCAL colorer***') + + this.webView.mainFrameURL = url + this.webView.frameLoadDelegate = this + + doc = this + } + - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame + { + log('****didFinishLoadForFrame:') + this.page = this.webView.mainFrame.globalContext +// this.webView.mainFrame.globalContext.eval('document.body.style.backgroundColor = "red"') +// this.webView.mainFrame.globalContext.document.body.style.backgroundColor = 'blue' + this.page.cc.captureUndo = false + + +if (this.text) +{ + var cc = this.webView.mainFrame.globalContext.cc + log('CC=' + cc) + cc.text = this.text +// cc.text = '54545' +} + + } + + - (void)undo:(id)sender + { + log('undo2') + } + + - (BOOL)validateUserInterfaceItem:(id )anItem + { + log('there****************>>>>>>>>>>validateUserInterfaceItem'+anItem) + return YES; + } +/* + - (NSUndoManager *)undoManager + { +// log('asking manager') + if (!this._undoManager) this._undoManager = [NSUndoManager instance] + return this._undoManager + } +*/ +/* + - (BOOL)hasUndoManager + { + log('hasUndoManager') + return YES + } +*/ + +- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError +{ + var e = null + this.text = [NSString stringWithContentsOfURL:absoluteURL encoding:NSUTF8StringEncoding error:e] +// this.webView.mainFrame.globalContext.cc +// cc.text = str + log('save data, wait for window to open') + return YES +} + + +// - (BOOL)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError +- (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError + { +/* + log('save') + log('outError=' + outError) +*/ +/* + NSString *localizedDescription = [mainBundle localizedStringForKey:[NSString stringWithFormat:@"description%ld", (long)code] value:@"Sketch could not complete the operation because an unknown error occurred. (IWASHERE)" table:@"SKTError"]; + NSString *localizedFailureReason = [mainBundle localizedStringForKey:[NSString stringWithFormat:@"failureReason%ld", (long)code] value:@"An unknown error occurred. (IWASHERE)" table:@"SKTError"]; + NSDictionary *errorUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:localizedDescription, NSLocalizedDescriptionKey, localizedFailureReason, NSLocalizedFailureReasonErrorKey, nil]; +*/ +/* + var info = {} + log('==' + NSLocalizedDescriptionKey) + log('==' + NSLocalizedFailureReasonErrorKey) + info[NSLocalizedDescriptionKey] = '111111111111111' + info[NSLocalizedFailureReasonErrorKey] = '22222222222222222222' + memwrite(outError, [NSError errorWithDomain:NSCocoaErrorDomain code:0909 userInfo:info]) + log('==' + memread(outError)) + return false +*/ +// NSString + +// log('wv=' + this.webView) +// log('frame=' + this.webView.mainFrame.globalContext.cc.text) + + var str = this.webView.mainFrame.globalContext.cc.text +// log(typeof str) + var str = [NSString stringWithString:str] + + var e = null + var b = [str writeToURL:absoluteURL atomically:YES encoding:NSUTF8StringEncoding error:e] + +// this.Super(arguments) + return b +/* + var b = [@'hello' writeToURL:absoluteURL atomically:YES encoding:NSUTF8StringEncoding error:e] + + var e = new outArgument +log('url=' + absoluteURL) + var b = [NSString.stringWithString('hello') writeToURL:absoluteURL atomically:YES encoding:NSUTF8StringEncoding error:e] + log('saved') + log('e=' + e) + return b +*/ + } + + + IBOutlet webView + } + + + class WebHTMLView + { + + swizzle - (void)keyDown:(id)sender + { + this.Original(arguments) + + var page = this._frame.globalContext + page.cc.exhaustDelayedPerforms() + + var doc = this.window.windowController.document + [doc updateChangeCount:0] + + log('update to page(this). and doc(this).') + + log('check we have OUR webview') + + } + + - (void)undo:(id)sender + { + var doc = this.window.windowController.document + this._frame.globalContext.cc.undo() +// doc.undo() + } + - (void)redo:(id)sender + { + var doc = this.window.windowController.document + this._frame.globalContext.cc.redo() +// doc.undo() + } + + swizzle- (BOOL)validateUserInterfaceItem:(id )item + { + log('this=' +this) + log('this._frame=' + this._frame) + var cc = this._frame.globalContext.cc + log('cc=' + cc) + if (item.action == 'undo:') return cc.undoStack.length > 0 + if (item.action == 'redo:') return cc.redoStack.length > 0 + return this.Original(arguments) + } + + } + + +// detect insertText +// editor : option to run XCode project (eg edit vec samples editor, then compile and run with XCode) +/* + class JSCocoaEditorWebView < WebView + { + } +*/ + \ No newline at end of file diff --git a/jscocoa/Samples/main.m b/jscocoa/Samples/main.m new file mode 100644 index 0000000..a59f047 --- /dev/null +++ b/jscocoa/Samples/main.m @@ -0,0 +1,24 @@ +// +// main.m +// Samples +// +// Created by Patrick Geiller on 01/12/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) +{ + id pool = [NSAutoreleasePool new]; + id dict = [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInt:2], @"AppleAntiAliasingThreshold", + [NSNumber numberWithInt:2], @"AppleScreenAdvanceSizeThreshold", + [NSNumber numberWithInt:2], @"AppleSmoothFontsSizeThreshold", + nil]; + [[NSUserDefaults standardUserDefaults] registerDefaults:dict]; + [pool release]; + + + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jscocoa/Tests/0 blank.js b/jscocoa/Tests/0 blank.js new file mode 100644 index 0000000..c1ff422 --- /dev/null +++ b/jscocoa/Tests/0 blank.js @@ -0,0 +1,2 @@ + + // blank : used by TestsRunner to test the evalJSFile delegate method diff --git a/jscocoa/Tests/1 C and ObjC calls.js b/jscocoa/Tests/1 C and ObjC calls.js new file mode 100644 index 0000000..84bae1d --- /dev/null +++ b/jscocoa/Tests/1 C and ObjC calls.js @@ -0,0 +1,15 @@ + + + // Test C call + var time = CFAbsoluteTimeGetCurrent() + if (typeof time != "number") throw "invalid type" + + // Obj C call + var numBundles = NSBundle.allBundles.count + + if (numBundles < 1) throw "no bundles found" + +// JSCocoaController.log(NSBundle.allBundles().objectAtIndex(0)) +// var r = JSCocoaController.garbageCollect() +// JSCocoaController.log('About to call') +// JSCocoaController.log('r=' + r) diff --git a/jscocoa/Tests/10 shorthand overload.js b/jscocoa/Tests/10 shorthand overload.js new file mode 100644 index 0000000..775dbeb --- /dev/null +++ b/jscocoa/Tests/10 shorthand overload.js @@ -0,0 +1,70 @@ + + + + // Split call disabled by default since ObjJ syntax + var useSplitCall = __jsc__.useSplitCall + __jsc__.useSplitCall = true + + +// JSCocoaController.sharedController.evalJSFile(NSBundle.mainBundle.bundlePath + '/Contents/Resources/class.js') + + + // Shorthand notation for over(ride|load)ing + + JSCocoa.create( { 'class' : 'ShorthandOverloadTest', parentClass : 'NSObject' } ) + JSCocoa.create( { 'class' : 'ShorthandOverloadTest2', parentClass : 'ShorthandOverloadTest' } ) + + + function fn(a, b, c) + { + return '1' + a + '2' + b + '3' + c + '4' + } + var added = JSCocoa.addInstanceMethod_class_jsFunction_encoding('performStuff:withThis:andThat:', ShorthandOverloadTest, fn, objc_encoding('charpointer', 'charpointer', 'charpointer', 'charpointer')) + + function fn2Add(a, b) + { + return a+b + } + var added = JSCocoa.addInstanceMethod_class_jsFunction_encoding('add:and:', ShorthandOverloadTest, fn2Add, objc_encoding('int', 'int', 'int')) + + var o = ShorthandOverloadTest2.alloc.init + + o['performStuff:withThis:andThat:'] = function (a, b, c) + { + return '^' + a + '!' + b + '?' + c + '$' + this.Super(arguments) + } + + + var shorthandOnClassWorked = false + ShorthandOverloadTest2['add:and:'] = function (a, b) + { + var r = this.Super(arguments) + shorthandOnClassWorked = true + return r+1 + } + + var r = o.add_and_(3, 5) + if (r != 9) throw 'shorthand overload on class failed' + if (!shorthandOnClassWorked) throw 'shorthand overload on class failed' + +// ShorthandOverloadTest2 + + var a = 'hello' + var b = 'small' + var c = 'world' + var r = o['performStuff:withThis:andThat:'](a, b, c) +// JSCocoaController.log('r=' + r) + if (r != ('^' + a + '!' + b + '?' + c + '$' + '1' + a + '2' + b + '3' + c + '4')) throw 'shorthand overload failed' + + + // LATER : Direct add method via assign ? +// o['someSelector:'] = { fn : function ... +// ,encoding : ... } + + + o.release + o = null + + + __jsc__.useSplitCall = useSplitCall + \ No newline at end of file diff --git a/jscocoa/Tests/11 retain test 2.js b/jscocoa/Tests/11 retain test 2.js new file mode 100644 index 0000000..8e4ed4b --- /dev/null +++ b/jscocoa/Tests/11 retain test 2.js @@ -0,0 +1,49 @@ + + + + + + /* + + Check JS's GC destroys objc instances + + */ + +// JSCocoaController.garbageCollect + + + // Cannot be tested in one thread as ObjC GC has no way of blocking the main thread to collect everything + if (!hasObjCGC) + { + var newClass = JSCocoaController.createClass_parentClass("SomeRetainCountTest", "NSObject") + + var count0 = JSCocoaController.liveInstanceCount(SomeRetainCountTest) + + var o1 = newClass.alloc.init + o1.release + var o2 = newClass.instance +// log('o1=' + o1 + ' rc=' + o1.retainCount) +// log('o2=' + o2 + ' rc=' + o2.retainCount) + + + newClass.instance + +// JSCocoaController.logInstanceStats + var count1 = JSCocoaController.liveInstanceCount(SomeRetainCountTest) + if (count1 != 3) throw 'invalid retain count - got ' + count1 + ', expected 3 (1)' + + o1 = null + o2 = null + + __jsc__.garbageCollect + + +// JSCocoaController.logInstanceStats + var count2 = JSCocoaController.liveInstanceCount(SomeRetainCountTest) + if (count2 != 0) throw 'invalid retain count - got ' + count2 + ', expected 0 (2)' + +// JSCocoaController.log('***' + count0 + '***' + count1 + '***' + count2 + '***') +// JSCocoaController.logInstanceStats + + newClass = o1 = o2 = count1 = count2 = null + } \ No newline at end of file diff --git a/jscocoa/Tests/12 instance variables.js b/jscocoa/Tests/12 instance variables.js new file mode 100644 index 0000000..92c403a --- /dev/null +++ b/jscocoa/Tests/12 instance variables.js @@ -0,0 +1,115 @@ + + + /* + + A class created with JSCocoaController.createClass holds a javascript hash as an instance variable. + check get / set, hash count + + */ +// JSCocoa.logBoxedObjects + var count0 = JSCocoaController.JSCocoaHashCount + + // Count of instances hosting a js hash + var initialHashCount = JSCocoaController.JSCocoaHashCount + + // + // Allocate a class, set instance variables on it + // + var newClass = JSCocoaController.createClass_parentClass("InstanceVariableTester", "NSObject") + var container = InstanceVariableTester.alloc.init + +// JSCocoaController.logInstanceStats + + container.myValue1 = 3.14 + container.myValue2 = 'Hello world !' + + container.jsTest = function (a, b) { return a+b } + +// JSCocoaController.log('container.myValue1=' + container.myValue1) +// JSCocoaController.log('container.myValue2=' + container.myValue2) +// JSCocoaController.log('container.jsTest(1, 2)=' + container.jsTest(1, 2)) + + if (container.myValue1 != 3.14) throw "(1) Invalid instance variable" + if (container.myValue2 != 'Hello world !') throw "(2) Invalid instance variable" + if (container.jsTest(1, 2) != 3) throw "(3) Invalid instance variable" + + // + // One more test with a derived class + // + var newClass2 = JSCocoaController.createClass_parentClass("InstanceVariableTester2", "InstanceVariableTester") + var container2 = InstanceVariableTester2.alloc.init + + container2.myValue1 = 7.89 + if (container2.myValue1 != 7.89) throw "(4) Invalid instance variable" + + // Test deletion + delete container.myValue1 + delete container2.myValue1 + +// log('GOT=' + ('myValue1' in container)) + + if (('myValue1' in container) != false) throw "(5) Couldn't delete instance variable (1)" + if (('myValue1' in container2) != false) throw "(5) Couldn't delete instance variable (2)" + + + // This is dummy code, as Snow Leopard's JavascriptCore retains an object during this run loop cycle. + // This will force the release of InstanceVariableTester and InstanceVariableTester2 instances. + var blah = NSObject.instance + if (('myValue1' in blah) != false) + { + } + blah = null + + for (var i=0; i<10; i++) + { + var container4 = InstanceVariableTester2.alloc.init + container4.release + container4 = null + delete this.container4 + } +/* +// JSCocoaController.log('JSCocoaHashCount=' + JSCocoaController.JSCocoaHashCount) + +*/ + + // Test if we have two hash counts more + var count1 = JSCocoaController.JSCocoaHashCount + if (!hasObjCGC) + if (count1 != (count0+2)) throw 'invalid hash count — got ' + count1 + ', expected ' + (count0+2) + ' (1)' + + + // Release instances +// log('container.retainCount=' + container.retainCount + ' container2.retainCount=' + container2.retainCount) + + container.release + container2.release +// log('container.retainCount=' + container.retainCount + ' container2.retainCount=' + container2.retainCount) + container = null + container2 = null + newClass = null + newClass2 = null + +/* + // The following line is useless but throws off garbage collection. + // Without it, one instance of InstanceVariableTester sticks around until the next test run. + var instanceCount1 = JSCocoaController.liveInstanceCount(InstanceVariableTester) + + // Collect + __jsc__.garbageCollect + var instanceCount2 = JSCocoaController.liveInstanceCount(InstanceVariableTester) +*/ + delete this['container'] + delete this['container2'] + + __jsc__.garbageCollect + + // Test that objects and their hashes were deleted by expecting initial hash count + var count2 = JSCocoaController.JSCocoaHashCount +// JSCocoaController.log('********initialHashCount=' + count0 + '****postTest=' + count1 + '*******postGC=' + count2) +// JSCocoaController.logInstanceStats + if (!hasObjCGC) + { +// JSCocoa.logInstanceStats +// JSCocoa.logBoxedObjects + if (Number(count2) != Number(count0)) throw 'invalid hash count after GC — got ' + count2 + ', expected ' + count0 + ' (2)' + } diff --git a/jscocoa/Tests/13 instance.js b/jscocoa/Tests/13 instance.js new file mode 100644 index 0000000..7332538 --- /dev/null +++ b/jscocoa/Tests/13 instance.js @@ -0,0 +1,53 @@ + + + // Split call disabled by default since ObjJ syntax + var useSplitCall = __jsc__.useSplitCall + __jsc__.useSplitCall = true + + + + + var instance1 = NSString.stringWithString('hello') + var instance2 = NSString.alloc.initWithString('hello') + instance2.release + var instance3 = NSString.alloc.ini( { tWithString : 'hello' } ) + instance3.release + // Disabled thanks to ObjJ syntax, which is just a much better way : [Class instanceWith...] +// var instance4 = NSString.instance( { withString : 'hello' } ) + var instance4 = NSString.instanceWithString('hello') + var instance5 = NSString.instance + + var instance6 = NSString.alloc.init + var instance7 = NSString.alloc.init + + if (instance1 != 'hello') throw "(1) Invalid string instance" + if (instance2 != 'hello') throw "(2) Invalid string instance" + if (instance3 != 'hello') throw "(3) Invalid string instance" + if (instance4 != 'hello' || instance4['class'] != 'NSCFString') throw "(4) Invalid string instance" + if (instance5 != '' || instance5.length != 0 || instance5['class'] != 'NSCFString') throw "(5) Invalid string instance" + if (instance6 != '' || instance6.length != 0 || instance6['class'] != 'NSCFString') throw "(6) Invalid string instance" + if (instance7 != '' || instance7.length != 0 || instance7['class'] != 'NSCFString') throw "(7) Invalid string instance" + + + __jsc__.useSplitCall = useSplitCall + + + + // + // Test NSLocale alloc + // + + var a = NSLocale.alloc.initWithLocaleIdentifier('fr_FR') + a.release + + __jsc__.useAutoCall = false + + var a = NSLocale.alloc().initWithLocaleIdentifier('fr_FR') + + if (!a.isKindOfClass(NSLocale)) throw "(8) Non autocall alloc failed" + if (a.localeIdentifier() != 'fr_FR') throw "(9) Non autocall alloc failed" + a.release() + + var a = NSLocale.instanceWithLocaleIdentifier('fr_FR') + + __jsc__.useAutoCall = true diff --git a/jscocoa/Tests/14 class.js b/jscocoa/Tests/14 class.js new file mode 100644 index 0000000..1617f88 --- /dev/null +++ b/jscocoa/Tests/14 class.js @@ -0,0 +1,99 @@ + + + /* + + DefineClass is deprecated by the ObjJ syntax. + + + */ + + + // Split call disabled by default since ObjJ syntax + var useSplitCall = __jsc__.useSplitCall + __jsc__.useSplitCall = true + + +// JSCocoaController.sharedController.evalJSFile(NSBundle.mainBundle.bundlePath + '/Contents/Resources/class.js') + + var testInstanceOverload = false + var testClassOverload = false + var testAdd = false + defineClass('MyTestObjectNewClass < NSObject', + { + // We're overloading an existing method : don't specify encoding as it will be infered from the parent class' method. + 'performSelector:withObject:' : + function(sel, object) + { + var r = this.Super(arguments) +// JSCocoaController.log('perform ' + sel + ' object=' + object) + testInstanceOverload = true + return r + } + ,'instanceMethodSignatureForSelector:' : + function (sel) + { + var r = this.Super(arguments) + testClassOverload = true + return r + } + // We're adding a new method : specify encodings + ,'someMethod:' : + ['id', 'id', function (o) + { + testAdd = true + return o + }] + ,'customAdd:And:' : + ['int', 'int', 'int', function (a, b) + { + return a+b + }] + + }) + + var o = MyTestObjectNewClass.instance + + // Test class overload + MyTestObjectNewClass.instanceMethodSignatureForSelector('respondsToSelector:') + + // Test instance overload + o.perform({ selector : 'someMethod:', withObject : o }) + + // Test custom method + var addResult = o.custom({ add : 4, and : 5 }) + + if (!testClassOverload) throw 'class method overload failed' + if (!testInstanceOverload) throw 'instance method overload failed' + if (addResult != 9) throw 'add instance method failed' + + + o = null + + + + function makeAdder(value) + { + return function (a) + { + return a+value + } + } + + var fn = makeAdder(5) +// JSCocoaController.log('r=' + fn(3)) + + var hash = {} + hash['closureTest:'] = ['int', 'int', fn] + defineClass('MyTestObjectNewClass2 < NSObject', hash) + + var o = MyTestObjectNewClass2.instance + var r = o.closureTest(8) + +// JSCocoaController.log('r=' + r) + if (r != 13) throw 'using a closure as instance method failed' + + o = null + + + __jsc__.useSplitCall = useSplitCall + \ No newline at end of file diff --git a/jscocoa/Tests/15 IBOutlet IBAction.js b/jscocoa/Tests/15 IBOutlet IBAction.js new file mode 100644 index 0000000..2edf386 --- /dev/null +++ b/jscocoa/Tests/15 IBOutlet IBAction.js @@ -0,0 +1,189 @@ + + + + // Split call disabled by default since ObjJ syntax + var useSplitCall = __jsc__.useSplitCall + __jsc__.useSplitCall = true + + + var messageFromAction = null + + defineClass('MyButtonTestingOutletAction < NSButton', + { + 'setState:' : + function(sel, object) + { + var r = this.Super(arguments) +// JSCocoaController.log('perform ' + sel + ' object=' + object) + testInstanceOverload = true + return r + } + ,'myAction1' : ['IBAction', + function (sender) + { +// JSCocoaController.log('Action1 ! ' + this.myOutlet1) + messageFromAction = 'myAction1' + }] + ,'myAction2' : ['IBAction', + function (sender) + { +// JSCocoaController.log('Action2 ! ' + this.myOutlet2) + messageFromAction = 'myAction2' + }] + ,'myAction3' : ['IBAction', + function (sender) + { +// JSCocoaController.log('Action3 ! ' + this.myOutlet3) + messageFromAction = 'myAction3' + }] + ,'myOutlet1' : 'IBOutlet' + ,'myOutlet2' : 'IBOutlet' + ,'myOutlet3' : 'IBOutlet' + }) + + defineClass('NibTestOwner < NSObject', + { + 'window' : 'IBOutlet' + ,'button' : 'IBOutlet' + ,'input1' : 'IBOutlet' + ,'input2' : 'IBOutlet' + ,'myValue' : 'Key' + }) + + + var path = NSBundle.mainBundle.bundlePath + '/Contents/Resources/Tests/Resources/standalone window.nib' + + // This will be the NIB's owner, it will receive outlets after loading + var owner = NibTestOwner.instance + + // loadNibNamed does not allow path data, load with NSNib +// var nib = NSNib.instance({withContentsOfURL:NSURL.fileURLWithPath(path)}) + var nib = NSNib.instanceWithContentsOfURL(NSURL.fileURLWithPath(path)) + + var nibObjects = hasObjCGC ? null : new outArgument + if (!nib.instantiateNibWithOwner_topLevelObjects(owner, nibObjects)) throw 'NIB not loaded ' + path + + // Check if outlets are connected + if (owner.window['class'] != 'NSWindow') throw 'window IBOutlet not connected' + if (owner.button['class'] != 'MyButtonTestingOutletAction') throw 'button IBOutlet not connected' + + if (owner.button.myOutlet1.title != 'ButtonOutletTest1') throw 'button1 IBOutlet not connected' + if (owner.button.myOutlet2.title != 'ButtonOutletTest2') throw 'button2 IBOutlet not connected' + if (owner.button.myOutlet3.title != 'ButtonOutletTest3') throw 'button3 IBOutlet not connected' + + + // Check if actions are connected - use perform click + owner.button.myOutlet1.performClick(null) + if (messageFromAction != 'myAction1') throw 'action1 IBAction not connected' + owner.button.myOutlet2.performClick(null) + if (messageFromAction != 'myAction2') throw 'action2 IBAction not connected' + owner.button.myOutlet3.performClick(null) + if (messageFromAction != 'myAction3') throw 'action3 IBAction not connected' + + + // Change window title and check we get it back OK + var 이름 = 'helloéworld' + var 이름 = '오늘의 추천' + owner.window.title = 이름 + if (owner.window.title != 이름) throw 'window title not changed' + + +// JSCocoaController.log('owner.window.title=' + owner.window.title) + + + + // + // Bindings test + // PROBLEM : upon second call, fails in valueForKey, calling and old closure ([owner myValue] ?) + // -> only test once. + // + if (!('bindingsAlreadyTested' in this) && !NSApplication.sharedApplication.delegate.bindingsAlreadyTested) + { + // Test bindings + var λέξη1 = 'εξόρυξης' + var λέξη2 = 'χρυσού' + owner.set({ value : λέξη1, forKey : 'myValue' }) + + // Bind model (owner.myValue) to view (input1.value) + // This will copy model value to view value + owner.input1.bind({ '' : 'value', toObject : owner, withKeyPath : 'myValue', options : null}) + + // Check that view value did reflect initial model value + if (owner.input1.stringValue != λέξη1) throw 'binding : initial binding failed' + + // Change model value + owner.set({ value : λέξη2, forKey : 'myValue' }) + + + // Check that view value did reflect new model value + if (owner.input1.stringValue != λέξη2) throw 'binding : update dispatch failed' + + // Unbind +// JSCocoaController.log('bindingInfo=' + owner.input1.infoForBinding('value')) + owner.input1.unbind('value') +// JSCocoaController.log('bindingInfo=' + owner.input1.infoForBinding('value')) + } + else + { + JSCocoaController.log('(skipping bindings test)') + } + bindingsAlreadyTested = true + NSApplication.sharedApplication.delegate.bindingsAlreadyTested = true + // + // No longer needed as I somehow fixed it ! :) + // 20090321 : HA ! YOU WISH - added one time check back. + // For a class with className, Cocoa create a shadow class named NSKVONotifying_className + // and hardcodes original get / set method implementations into it. + // Upon a next test run, defineClass() will have defined new methods BUT the binding mechanism will use the previous implementations. + // eg for a key named myValue, NSKVONotifying will call the old implementations of these : + // + // - (void)setMyValue + // - (id)myValue + // + // and crash. If the closure was deleted via munmap, GDB will show the top of the stack trace as ???. + // +// delete this.bindingsAlreadyTested + + // Hide window +// owner.window.orderOut(null) + + +// JSCocoaController.log('contentView=' + owner.window.contentView) +// JSCocoaController.log('styleMask=' + owner.window.styleMask) +// JSCocoaController.log('frame=' + owner.window.frame.origin.x) + + + // + // NIB's root objects stick around. ##TOCHECK + // As bundles cannot be unloaded, I suppose it's normal ? + // + // ... manually releasing the window works. + // + +// log('nibObjects=' + nibObjects) + if (nibObjects) + { +// log('asking for nibObjects') +// log('nibObjects=' + nibObjects) +// log('nibObjects.length=' + nibObjects.length) + for (var i=0; i NSNumber + array.addObject('hello) -> NSString + + + Check unboxing : callAsFunction (valueOf) + + array[0] = 'string' + + array[1] + 1 == 'string1' + + array[1] = 5 + array[1] + 1 == 6, NOT '51' + + + */ + + var a = NSMutableArray.instance + + + + a.addObject(5.0) + a.addObject('Hello') + + if ((a.objectAtIndex(0) + 1) != 6) throw 'number unboxing failed' + if ((a.objectAtIndex(1) + 1) != 'Hello1') throw 'string unboxing failed' + + a = null + + /* + Check array JS-like access : + + array[0] = value + value == array[0] + + array.length (duplicate of ObjC's array.count) + */ + var a = NSMutableArray.instance + + a.addObject(6.0) + a.addObject('Hello World !') + + // Bracket get + if ((a[0] + 1) != 7) throw 'array bracket get [] failed' + if ((a[1] + 1) != 'Hello World !1') throw 'array bracket get [] failed (2)' + + // Bracket set + a[0] = 7.0 + a[1] = 'HOY !' + + if ((a[0] + 1) != 8) throw 'array bracket set [] failed' + if ((a[1] + 1) != 'HOY !1') throw 'array bracket set [] failed (2)' + + + if (a.length != 2) throw '[array count] not accessible via array.length' + a = null + + /* + Check hash JS-like access : + + hash['someKey'] = value + value == hash['someKey'] + + + for (key in hash) + */ + var d = NSMutableDictionary.instance + +// d.set({ object : 13.0, forKey : 'key1' }) +// JSCocoaController.log('d.key1=' + d.objectForKey('key1')) + + d.key1 = 13 + d['key2'] = 'Wieder' + + +// JSCocoaController.log('d.key1=' + d.valueForKey('key1')) +// JSCocoaController.log('d.key2=' + d.valueForKey('key2')) + + + if ((d.valueForKey('key1') + 1) != 14) throw 'dictionary set failed' + if ((d.valueForKey('key2') + 1) != 'Wieder1') throw 'dictionary set failed (2)' + + if ((d.key1 + 1) != 14) throw 'dictionary get failed' + if ((d['key2'] + 1) != 'Wieder1') throw 'dictionary get failed (2)' + + + /* + + Check hash enum + + */ + d.key3 = 'hello' + d.key4 = 'world' + + var gotKey1 = false + var gotKey2 = false + var gotKey3 = false + var gotKey4 = false + for (var key in d) + { +// JSCocoaController.log('got key ' + key + ' = ' + d[key]) + if (key == 'key1') gotKey1 = true + if (key == 'key2') gotKey2 = true + if (key == 'key3') gotKey3 = true + if (key == 'key4') gotKey4 = true + } + + if (!gotKey1 || !gotKey2 || !gotKey3 || !gotKey4) throw 'dictionary enum failed' + + + d = null + + + + /* + + Test a 'straight out of Cocoa' dictionary + + */ + var app = NSWorkspace.sharedWorkspace.activeApplication + + // Change that as we could be inactive - check that identifier has two dots +// if (app.NSApplicationBundleIdentifier != 'com.inexdo.JSCocoa') throw 'dictionary get failed (3)' + if (app.NSApplicationBundleIdentifier.match(/\./g).length != 2) throw 'dictionary get failed (3)' + +// JSCocoaController.log('app=' + app['class']) + +// JSCocoaController.log('Running ' + NSWorkspace.sharedWorkspace.activeApplication.NSApplicationName) diff --git a/jscocoa/Tests/17 struct instance.js b/jscocoa/Tests/17 struct instance.js new file mode 100644 index 0000000..9f84168 --- /dev/null +++ b/jscocoa/Tests/17 struct instance.js @@ -0,0 +1,73 @@ + + + + /* + + Check struct instance via new : + + var p = new NSPoint + p.x = 4.5 + + var p2 = new CGRect + + */ + + // NSPoint zero argument instance — expecting all structure members to be created with undefined values + var p1 = NSMakePoint(4.5, 8.2) + + var p2 = new NSPoint + if (!('x' in p2)) throw 'NSPoint structure instance failed — property with undefined value not created (x)' + if (!('y' in p2)) throw 'NSPoint structure instance failed — property with undefined value not created (y)' + p2.x = 4.5 + p2.y = 8.2 +// log('p1=' + p1.x + ',' + p1.y); +// log('p2=' + p2.x + ',' + p2.y); + if (!NSEqualPoints(p1, p2)) throw 'NSPoint structure instance failed' + + + // CGRect zero argument instance + var r1 = CGRectMake(1, 2, 3, 4) + var r2 = new CGRect + if (!('origin' in r2)) throw 'CGRect structure instance failed — property with undefined value not created (origin)' + if (!('x' in r2.origin)) throw 'CGRect structure instance failed — property with undefined value not created (origin.x)' + if (!('y' in r2.origin)) throw 'CGRect structure instance failed — property with undefined value not created (origin.y)' + if (!('size' in r2)) throw 'CGRect structure instance failed — property with undefined value not created (size)' + if (!('width' in r2.size)) throw 'CGRect structure instance failed — property with undefined value not created (size.width)' + if (!('height' in r2.size)) throw 'CGRect structure instance failed — property with undefined value not created (size.height)' + + r2.origin.x = 1 + r2.origin.y = 2 + r2.size.width = 3 + r2.size.height = 4 + + if (!CGRectEqualToRect(r1, r2)) throw 'CGRect structure instance failed' + + + // NSPoint argument instance + var p3 = new NSPoint(4.5, 8.2) + if (!NSEqualPoints(p1, p3)) throw 'NSPoint structure instance with arguments failed' + + // CGRect argument instance + var r3 = new CGRect(1, 2, 3, 4) + if (!CGRectEqualToRect(r1, r3)) throw 'CGRect structure instance with arguments failed' + + + // This should fail : one arg missing + var failed = false + try { + var r4 = new CGRect(1, 2, 3) + } catch (e) { + failed = true + } + if (!failed) throw 'expected CGRect structure instance with too few arguments to fail' + + // This should fail : one arg too many + var failed = false + try { + var r5 = new CGRect(1, 2, 3, 4, 5) + } catch (e) { + failed = true + } + if (!failed) throw 'expected CGRect structure instance with too many arguments to fail' + + diff --git a/jscocoa/Tests/18 structure args.js b/jscocoa/Tests/18 structure args.js new file mode 100644 index 0000000..b8ca598 --- /dev/null +++ b/jscocoa/Tests/18 structure args.js @@ -0,0 +1,42 @@ + + + // Split call disabled by default since ObjJ syntax + var useSplitCall = __jsc__.useSplitCall + __jsc__.useSplitCall = true + + +// JSCocoaController.sharedController.evalJSFile(NSBundle.mainBundle.bundlePath + '/Contents/Resources/class.js') + + + + /* + Use struct as method args + + method('float', 'struct:rect', 'float') returns rect + + */ + + + + defineClass('StructureArgsTester < NSObject', + { + 'testWithX:struct:Y:' : + ['struct NSPoint', 'float', 'struct NSPoint', 'float', function (x, rect, y) + { + var rect = NSMakePoint(rect.x+x, rect.y+y) + return rect + }] + }) + + var o = StructureArgsTester.instance + + var r = o.testWith({x:1.23, struct:NSMakePoint(10, 20), y:4.56}) + + if (Math.abs( (10+1.23) - r.x ) > 0.001) throw 'structure args failed (1)' + if (Math.abs( (20+4.56) - r.y ) > 0.001) throw 'structure args failed (2)' + +// JSCocoaController.log('x=' + r.x + ' y=' + r.y) + + o = null + + __jsc__.useSplitCall = useSplitCall diff --git a/jscocoa/Tests/19 pure js methods.js b/jscocoa/Tests/19 pure js methods.js new file mode 100644 index 0000000..97302fd --- /dev/null +++ b/jscocoa/Tests/19 pure js methods.js @@ -0,0 +1,74 @@ + + // Split call disabled by default since ObjJ syntax + var useSplitCall = __jsc__.useSplitCall + __jsc__.useSplitCall = true + + + + /* + + defineClass(..., hashOfMethods) + + hashOfMethods = { + + pureJavascriptMethod : function (a, b, c) + { + return ... + } + } + + */ + + + Class('MyJSFunctionTest < NSObject').definition = function () + { + Method('customAdd:And:').encoding('int int int').fn = function (a, b) + { + return a+b+this.jsAdd1(a, b) + } + + JSFunction('jsAdd1').fn = function (a, b) + { + return a*2+b*3 + } + + JSFunction('jsAdd2').fn = function (a, b) + { + return '*' + a + '_' + b + '$' + } + } + + + Class('MyJSFunctionTest2 < MyJSFunctionTest').definition = function () + { + JSFunction('jsAdd3').fn = function (a, b) + { + return '*' + b + '_' + a + '$' + } + } + + + var o1 = MyJSFunctionTest.instance + + var addResult1 = o1.custom({ add : 4, and : 5 }) + var addResult2 = o1.jsAdd2(4, 5) +// log(addResult1) +// log(addResult2) + + o1 = null + + if (addResult1 != 4+4*2+5+5*3) throw 'pure js call failed (1)' + if (addResult2 != '*4_5$') throw 'pure js call failed (2)' + + // Test derived class + var o2 = MyJSFunctionTest2.instance + var addResult1 = o2.custom({ add : 4, and : 5 }) + var addResult2 = o2.jsAdd2(4, 5) + var addResult3 = o2.jsAdd3(4, 5) + + if (addResult1 != 4+4*2+5+5*3) throw 'pure js call failed in derived class (1)' + if (addResult2 != '*4_5$') throw 'pure js call failed in derived class (2)' + if (addResult3 != '*5_4$') throw 'pure js call failed in derived class (3)' + + + __jsc__.useSplitCall = useSplitCall diff --git a/jscocoa/Tests/2 structure arguments.js b/jscocoa/Tests/2 structure arguments.js new file mode 100644 index 0000000..b2245a0 --- /dev/null +++ b/jscocoa/Tests/2 structure arguments.js @@ -0,0 +1,26 @@ + + + + // Test NSPoint + var p = NSMakePoint(10, 20) + + if (p.x != 10 || p.y != 20) throw "invalid NSPoint" + + // Test NSRect + var r = NSMakeRect(10, 20, 30, 40) + + if (r.origin.x != 10 || r.origin.y != 20 || r.size.width != 30 || r.size.height != 40) throw "invalid NSRect" + + + // Test structure passing + var r2 = NSInsetRect(r, 1, 5) + if (r2.origin.x != 11 || r2.origin.y != 25 || r2.size.width != 28 || r2.size.height != 30) throw "invalid inset NSRect" + + + // Test native JS structure + var nativeJSRect = { origin : { x : 10, y : 20 }, size : { width : 30, height : 40 } } + var r3 = NSInsetRect(nativeJSRect, 1, 5) + if ( r2.origin.x != r3.origin.x + || r2.origin.y != r3.origin.y + || r2.size.width != r3.size.width + || r2.size.height != r3.size.height) throw "invalid native inset NSRect" diff --git a/jscocoa/Tests/20 pointer to function.js b/jscocoa/Tests/20 pointer to function.js new file mode 100644 index 0000000..6c0b926 --- /dev/null +++ b/jscocoa/Tests/20 pointer to function.js @@ -0,0 +1,14 @@ + + + /* + + C callback + + + ##TODO ! + + */ + + + +// throw 'pointer to function' diff --git a/jscocoa/Tests/21 new class definition.js b/jscocoa/Tests/21 new class definition.js new file mode 100644 index 0000000..522e308 --- /dev/null +++ b/jscocoa/Tests/21 new class definition.js @@ -0,0 +1,165 @@ + + + // Split call disabled by default since ObjJ syntax + var useSplitCall = __jsc__.useSplitCall + __jsc__.useSplitCall = true + + + +// JSCocoaController.sharedController.evalJSFile(NSBundle.mainBundle.bundlePath + '/Contents/Resources/class.js') + + + + Class('MyTestObjectNewClassNewMethod < NSObject').definition = function () + { + + Method('performSelector:withObject:').fn = function (a, b) + { + var r = this.Super(arguments) + testInstanceOverload1 = true + return r + } + + Method('instanceMethodSignatureForSelector:').fn = function (a, b) + { + var r = this.Super(arguments) + testClassOverload1 = true + return r + } + Method('someMethod:').encoding('id id').fn = function (o) + { + testAdd = true + return o + } + Method('customAdd:And:').encoding('int int int').fn = function (a, b) + { + return a+b + } + + IBOutlet('outlet1') + IBOutlet('outlet2').setter = function (newValue) + { + outletSetter = true + // DO NOT DO THIS — THIS WILL GO INTO AN INFINITE RECURSIVE SETPROPERTY CALL +// this.outlet2 = newValue + + // Use this. + this.set({jsValue:newValue, forJsName : '_outlet2' }) + } + + IBAction('clickedStuff').fn = function (sender) + { + actionCalled = sender + } + + Key('MyKey1') + + // Custom key setters and getters — add an underscore or raw JSValueForJSName will take precedence over getter + Key('MyKey2').setter = function (newValue) + { + calledKeySetter = true + this.set({jsValue:newValue, forJsName : '_MyKey2' }) + } + Key('MyKey2').getter = function () + { + calledKeyGetter = true + return this.JSValueForJSName('_MyKey2') + } + } + + Class('MyTestObjectNewClassNewMethod2 < MyTestObjectNewClassNewMethod').definition = function () + { + Method('performSelector:withObject:').fn = function (a, b) + { + var r = this.Super(arguments) + testInstanceOverload2 = true + return r + } + Method('instanceMethodSignatureForSelector:').fn = function (a, b) + { + var r = this.Super(arguments) + testClassOverload2 = true + return r + } + } + + + // + // Test derivation + // + var testInstanceOverload1 = false + var testClassOverload1 = false + + + var o1 = MyTestObjectNewClassNewMethod.instance + + + // Test class overload + MyTestObjectNewClassNewMethod.instanceMethodSignatureForSelector('respondsToSelector:') + if (!testClassOverload1) throw 'class method overload failed' + + // Test instance overload + var testAdd = false + o1.perform({ selector : 'someMethod:', withObject : o1 }) + if (!testInstanceOverload1) throw 'instance method overload failed ' + if (!testAdd) throw 'instance method overload failed b' + + // Test custom method + var addResult = o1.custom({ add : 4, and : 5 }) + if (addResult != 9) throw 'add instance method failed' + + // Test outlet + var outletSetter = false + o1.setOutlet1('hello') + o1.setOutlet2('world') + if (o1.outlet1 != 'hello') throw 'outlet failed' + if (!outletSetter) throw 'outlet custom setter failed 1' + if (o1.outlet2 != 'world') throw 'outlet custom setter failed 2' + + // Test action + var actionCalled = null + o1.perform({ selector : 'clickedStuff:', withObject : 5 }) + if (actionCalled != 5) throw 'action failed' + + + // Test key + var calledKeySetter = false + var calledKeyGetter = false + o1.setMyKey1('Test clé') + if (o1.MyKey1 != 'Test clé') throw 'MyKey1 failed' + + o1.setMyKey2('Test clé 2') + if (o1.MyKey2 != 'Test clé 2') throw 'MyKey2 failed' + + if (!calledKeySetter) throw 'custom key setter failed' + if (!calledKeyGetter) throw 'custom key getter failed' + + // + // Test derivation of derivation + // + var testInstanceOverload1 = false + var testInstanceOverload2 = false + var testClassOverload1 = false + var testClassOverload2 = false + + + var o2 = MyTestObjectNewClassNewMethod2.instance + + // Test class overload + MyTestObjectNewClassNewMethod2.instanceMethodSignatureForSelector('respondsToSelector:') + + // Test instance overload + var testAdd = false + o2.perform({ selector : 'someMethod:', withObject : o1 }) + + if (!testClassOverload1) throw 'class method overload failed 1' + if (!testInstanceOverload1) throw 'instance method overload failed 1' + if (!testClassOverload2) throw 'class method overload failed 2 ' + if (!testInstanceOverload2) throw 'instance method overload failed 2' + + + + o1 = null + o2 = null + + __jsc__.useSplitCall = useSplitCall diff --git a/jscocoa/Tests/22 instance valueOf.js b/jscocoa/Tests/22 instance valueOf.js new file mode 100644 index 0000000..445e732 --- /dev/null +++ b/jscocoa/Tests/22 instance valueOf.js @@ -0,0 +1,28 @@ +/* + + + // Alas, doesn't work. + + JSCocoaController.sharedController.evalJSFile(NSBundle.mainBundle.bundlePath + '/Contents/Resources/class.js') + + + + Class('MyInstanceValueOfTest < NSObject').definition = function () + { + } + + log('a') + var o1 = MyInstanceValueOfTest.instance + log('b') + var o2 = MyInstanceValueOfTest.instance + log('c') + + var count = JSCocoaController.liveInstanceCount('MyInstanceValueOfTest') + log(count) + + if (count != 2) throw 'invalid MyInstanceValueOfTest instance count' + + + o1 = null + o2 = null +*/ \ No newline at end of file diff --git a/jscocoa/Tests/23 NSString bridging.js b/jscocoa/Tests/23 NSString bridging.js new file mode 100644 index 0000000..ed4c1e4 --- /dev/null +++ b/jscocoa/Tests/23 NSString bridging.js @@ -0,0 +1,26 @@ + + /* + + Treat NSStrings as native JS strings + + */ + + + // Replace + var str = NSString.stringWithString('hello').replace(/ll/, 'mm') + if (str != 'hemmo') throw 'NSString bridging failed 1' + + // Split + var r = NSString.stringWithString('helmlo').split('l') + if (r.length != 3 || r[0] != 'he' || r[1] != 'm' || r[2] != 'o') throw 'NSString bridging failed 2' + + // Replace on a bundle identifier — BAD as it will fail if id starts with something else (like VLC, org.videolan.vlc) +// var str = NSWorkspace.sharedWorkspace.activeApplication.NSApplicationBundleIdentifier.substr(0, 3) +// if (str != 'com') throw 'NSString bridging failed 3' + + // Javascript + var str1 = NSWorkspace.sharedWorkspace.activeApplication.NSApplicationBundleIdentifier.substr(0, 3) + // ObjC + var str2 = NSWorkspace.sharedWorkspace.activeApplication.NSApplicationBundleIdentifier.substringWithRange(NSMakeRange(0, 3)) + // Check equivalence of JS and ObjC + if (str1 != str2.valueOf()) throw 'NSString bridging failed 3' diff --git a/jscocoa/Tests/24 structure set.js b/jscocoa/Tests/24 structure set.js new file mode 100644 index 0000000..9bcd79c --- /dev/null +++ b/jscocoa/Tests/24 structure set.js @@ -0,0 +1,29 @@ + + // Can't make it work ! + // There should be a hook when objects get a new name (eg var f = myView.frame -> myView.frame is bound to f) + +/* + + + var o = NSView.instance + o.frame.origin.x = 0 +// o.frame.origin.x = o.frame.size.width + o.frame.size.height + 13 + + + var frame = o.frame + frame.origin.x = 13 + + if (frame.origin.x != 13) throw 'structure set FAILED 1' + + if (o.frame.origin.x != 0) throw 'structure set FAILED 2' + o.frame.origin.x = 14 + if (o.frame.origin.x != 14) throw 'structure set FAILED 3' + + var frame2 = o.frame + frame2.origin.x = 15 + if (frame2.origin.x != 15) throw 'structure set FAILED 4' + + + if (o.frame.origin.x != 14) throw 'structure set FAILED 5' + +*/ \ No newline at end of file diff --git a/jscocoa/Tests/25 variadic.js b/jscocoa/Tests/25 variadic.js new file mode 100644 index 0000000..fcf0640 --- /dev/null +++ b/jscocoa/Tests/25 variadic.js @@ -0,0 +1,61 @@ + + /* + + A variadic call accepts a variable number of arguments. + + ObjC + NSArray.arrayWithObjects(a, b, c, ..., nil) + + C + NSLog(format, var1, var2, ...) + + + */ + + +// log(jsc.typeEncodingOfMethod_class('arrayWithObjects:', 'NSArray')) +// log(jsc.typeEncodingOfMethod_class('instantiateNibWithOwner:topLevelObjects:', 'NSNib')) + + // Bad format - to check NSLogConsole async output +// var format = "kMDItemDisplayName like[cdw] '*jscocoa*') and (kMDItemFSName like[c] \"*\.jscocoa\")" + + + // Check exactitude of a full predicate with a predicate built with arguments + var format = "(kMDItemDisplayName like[cdw] '*jscocoa*') and (kMDItemFSName like[c] \"*.jscocoa\")" + var p1 = NSPredicate.predicateWithFormat(format) +// var p2 = NSPredicate.predicateWithFormat("(kMDItemDisplayName like[cdw] %@) and (kMDItemFSName like[c] %@)", '*jscocoa*', '*.jscocoa', null) + var p2 = NSPredicate.predicateWithFormat("(kMDItemDisplayName like[cdw] %@) and (kMDItemFSName like[c] %@)", '*jscocoa*', '*.jscocoa') + + if (String(p1) != String(p2)) throw 'variadic call failed (1)' + + + // Check array building +// var array = NSArray.arrayWithObjects(1.23, 'hello', 5.67, null) + var array = NSArray.arrayWithObjects(1.23, 'hello', 5.67) + + if (array.length != 3) throw 'variadic call failed (2)' + if (array[0].valueOf() != 1.23) throw 'variadic call failed (3)' + if (array[1].valueOf() != 'hello') throw 'variadic call failed (4)' + if (array[2].valueOf() != 5.67) throw 'variadic call failed (5)' + + // Check array building with a derived class +// var array = NSMutableArray.arrayWithObjects(1.23, 'hello', 5.67, null) + var array = NSMutableArray.arrayWithObjects(1.23, 'hello', 5.67) + + if (array.length != 3) throw 'variadic call failed (6)' + if (array[0].valueOf() != 1.23) throw 'variadic call failed (7)' + if (array[1].valueOf() != 'hello') throw 'variadic call failed (8)' + if (array[2].valueOf() != 5.67) throw 'variadic call failed (9)' + + // Check hash building + var hash = NSMutableDictionary.dictionaryWithObjectsAndKeys('world', 'hello', 'monde', 'bonjour') +// log('hash=' + hash) + if (hash.allKeys.count != 2) throw 'variadic call failed (10)' + if (!('hello' in hash)) throw 'variadic call failed (11)' + if (hash['hello'] != 'world') throw 'variadic call failed (12)' + if (!('bonjour' in hash)) throw 'variadic call failed (13)' + if (hash['bonjour'] != 'monde') throw 'variadic call failed (14)' + + // C variadic call + // Works, but how to test it ? +// NSLog('%@ %@ %@', 5, 'hello', NSArray.array) diff --git a/jscocoa/Tests/26 full NSArray bridge.js b/jscocoa/Tests/26 full NSArray bridge.js new file mode 100644 index 0000000..e491e51 --- /dev/null +++ b/jscocoa/Tests/26 full NSArray bridge.js @@ -0,0 +1,80 @@ + + + + + + defineClass('ArrayDictBridgeTest < NSObject', + { + 'callWithArray:' : + ['void', 'id', function (o) + { + if (o.count != 4) throw 'NSArray bridge failed (1)' + if (o[0] != 'a') throw 'NSArray bridge failed (2)' + if (o[1] != 'b') throw 'NSArray bridge failed (3)' + if (o[2] != 7.89) throw 'NSArray bridge failed (4)' + if (o[3] != 'c') throw 'NSArray bridge failed (5)' + if (o[3].valueOf() != o.objectAtIndex(3).valueOf()) throw 'NSArray bridge failed (6)' + }] + ,'callWithDict:' : + ['void', 'id', function (o) + { + if (o.allKeys.count != 2) throw 'NSArray bridge failed (7)' + if (o.hello != 'world') throw 'NSArray bridge failed (8)' + if (o['hello'] != 'world') throw 'NSArray bridge failed (9)' + if (o.count != 7.89) throw 'NSArray bridge failed (10)' + }] + ,'callWithArray2:' : + ['void', 'id', function (o) + { + if (o[2].hello != 'world') throw 'NSArray bridge failed (11)' + if (o[2].c[1] != 'b') throw 'NSArray bridge failed (12)' + }] + ,'callWithDict2:' : + ['void', 'id', function (o) + { + if (o.hello != 'world') throw 'NSArray bridge failed (13)' + if (o.count != 7.89) throw 'NSArray bridge failed (14)' + if (o.ar[0] != 4) throw 'NSArray bridge failed (15)' + if (o.ar[1] != 5) throw 'NSArray bridge failed (16)' + if (o.ar[2] != 6) throw 'NSArray bridge failed (17)' + if (o.ar[3].bonjour != 'monde') throw 'NSArray bridge failed (18)' + if (o.ar[3].parts[0] != 'a') throw 'NSArray bridge failed (19)' + if (o.ar[3].parts[1] != 'b') throw 'NSArray bridge failed (20)' + if (o.ar[3].parts[2].p != 'g') throw 'NSArray bridge failed (21)' + if (o.ar[3].parts[3] != 'c') throw 'NSArray bridge failed (22)' + if (o.ar[4] != 7) throw 'NSArray bridge failed (23)' +// log(o) + }] + }) + + var o = ArrayDictBridgeTest.instance + + o.callWithArray(['a', 'b', 7.89, 'c']) + o.callWithDict({ hello : 'world', count : 7.89 }) + + o.callWithArray2(['a', 'b', { hello : 'world', c : ['a', 'b', 'c'] }, 'c']) + o.callWithDict2({ hello : 'world', count : 7.89, ar : [4, 5, 6, { bonjour : 'monde', parts : ['a', 'b', { p : 'g' }, 'c' ] }, 7] }) + + + o = null + + + + +/* + + + objcInstance.blah = ['a', 'b', 'c'] + + objcInstance.blah2 = ['a', ['b', 'c', 'd'], 'e'] + + + objcInstance.dict = { hello : 'world', { a : 'b', c : 'd' }, blah : 'hop' } + + + objcInstance.a = ['a', { msg1 : 'hello', msg2 : 'world' }, 45] + objcInstance.b = { a1 : 'hello', a2 : [4, 5, { hello : 'world' }, 6], a3 : 'bonjour' } +*/ + + +// log('hello') \ No newline at end of file diff --git a/jscocoa/Tests/27 type modifier o.js b/jscocoa/Tests/27 type modifier o.js new file mode 100644 index 0000000..f874439 --- /dev/null +++ b/jscocoa/Tests/27 type modifier o.js @@ -0,0 +1,91 @@ + + +/* + + type o arguments (as named by the ObjC runtime) + Given pointers to arguments, a function can write multiple return values to them. + + // Return OpenGL version + int major, minor; + NSOpenGLGetVersion(&major, &minor); + + // JSCocoa eq + var major = new outArgument + var minor = new outArgument + NSOpenGLGetVersion(major, minor) + log('major=' + major + ' minor=' + minor) + + outArgument value can be accessed with .outValue + + var error = new outArgument + var r = [@"hello" writeToURL:url atomically:NO encoding:NSUTF8StringEncoding error:error] + -> error.outValue == NSError (if any) + + + +*/ + + // + // Test basic type encoding (int) + // + var major = new outArgument + var minor = new outArgument + NSOpenGLGetVersion(major, minor) + + if (typeof (major.valueOf()) != 'number') throw 'type o failed (1)' + if (typeof (minor.valueOf()) != 'number') throw 'type o failed (2)' + if (!(major >= 1)) throw 'type o failed (3)' + +// log('OpenGL version major=' + major + ' minor=' + minor) + + + var windowCount = new outArgument + NSCountWindows(windowCount) +// log('windowCount=' + windowCount) + + if (typeof (minor.valueOf()) != 'number') throw 'type o failed (4)' + if (!(major >= 1 && major < 500)) throw 'type o failed (5)' + + + + // + // Test structs + // + var rect = new NSRect(10, 20, 30, 40) + + var rect1 = new outArgument + var rect2 = new outArgument + + NSDivideRect(rect, rect1, rect2, 5, NSMinXEdge) +// log('rect1=' + rect1) + + if (rect1.origin.x != 10 || rect1.origin.y != 20 || rect1.size.width != 5 || rect1.size.height != 40) throw 'type o failed (6)' + if (rect2.origin.x != 15 || rect2.origin.y != 20 || rect2.size.width != 25 || rect2.size.height != 40) throw 'type o failed (7)' + + + + // + // Test ObjC call + // + var scanner = NSScanner.scannerWithString('4.56 123') + var extractedFloat = new outArgument + scanner.scanFloat(extractedFloat) +// log(extractedFloat) + if (Math.abs(4.56-extractedFloat) > 0.01) throw 'type o failed (6)' + + var extractedInteger = new outArgument + scanner.scanInteger(extractedInteger) +// log(extractedInteger) + if (extractedInteger != 123) throw 'type o failed (7)' + + + + major = null + minor = null + windowCount = null + rect1 = null + rect2 = null + + extractedInteger = null + extractedFloat = null + diff --git a/jscocoa/Tests/28 struct description.js b/jscocoa/Tests/28 struct description.js new file mode 100644 index 0000000..6cb5727 --- /dev/null +++ b/jscocoa/Tests/28 struct description.js @@ -0,0 +1,35 @@ + + + /* + + log(new NSMakePoint(3, 4)) + -> prints a readable description of the struct + + */ + var point = NSMakePoint(12, 27) + +//log('point=' + point) + // Account for 32 and 64 bit types + if (point != '' && point != '') throw 'struct description failed (1)' + + var rect = NSMakeRect(1, 5, 8, 59483) +//log('rect=' + rect) + if (rect.valueOf() != '' + && rect.valueOf() != '') throw 'struct description failed (2)' + +// log('point=' + point) +// log('rect=' + rect) + + point = null + rect = null +/* + log('====dump====') + for (var i in this) + { + var o = this[i] + if (typeof o == 'function') log(i + '=[function]') + else log(i + '=' + o + ' [' + (typeof o) + ']') + o = null + } + log('====dump====') +*/ diff --git a/jscocoa/Tests/29 pointer handling.js b/jscocoa/Tests/29 pointer handling.js new file mode 100644 index 0000000..76b5886 --- /dev/null +++ b/jscocoa/Tests/29 pointer handling.js @@ -0,0 +1,151 @@ + +/* + +Re: NSColor to CGColor by j o a r +http://www.cocoabuilder.com/archive/message/cocoa/2006/11/12/174339 + + +static CGColorRef CGColorCreateFromNSColor (CGColorSpaceRef +colorSpace, NSColor *color) + + NSColor *deviceColor = [color colorUsingColorSpaceName: +NSDeviceRGBColorSpace]; + + float components[4]; + [deviceColor getRed: &components[0] green: &components[1] blue: +&components[2] alpha: &components[3]]; + + return CGColorCreate (colorSpace, components); + +*/ + + // Split call disabled by default since ObjJ syntax + var useSplitCall = __jsc__.useSplitCall + __jsc__.useSplitCall = true + + + + + function floatsEq(a, b) + { + if (Math.abs(a-b) < 0.001) return true + return false + } + + // + // Test get : allocate a memory buffer and have Cocoa fill it + // + + // 32bit only +// var encoding = 'ffff' + + // 32 and 64 bit : get size of CGFloat by inspecting a signature of method returning CGFloat (##dirty) + var signature = JSCocoa.typeEncodingOfMethod_class('whiteComponent', 'NSColor') + var CGFloatEncoding = signature.charAt(0) + var buffer = new memoryBuffer(CGFloatEncoding+CGFloatEncoding+CGFloatEncoding+CGFloatEncoding) + + var r = 0.9 + var g = 0.8 + var b = 0.7 + var a = 0.6 + + var color = NSColor.colorWithDevice({ red : r, green : g, blue : b, alpha : a }) + + + // Use scrambled pattern 2 3 0 1 instead of 0 1 2 3 to test + color.get({ red : new outArgument(buffer, 2), + green : new outArgument(buffer, 3), + blue : new outArgument(buffer, 0), + alpha : new outArgument(buffer, 1) }) +/* + log('color=' + color) + log('buffer[0]=' + buffer[0]) + log('buffer[1]=' + buffer[1]) + log('buffer[2]=' + buffer[2]) + log('buffer[3]=' + buffer[3]) +*/ + if (!floatsEq(buffer[2], r)) throw 'pointer handling get failed (1)' + if (!floatsEq(buffer[3], g)) throw 'pointer handling get failed (2)' + if (!floatsEq(buffer[0], b)) throw 'pointer handling get failed (3)' + if (!floatsEq(buffer[1], a)) throw 'pointer handling get failed (4)' + + // + // Test set with the same buffer + // + var a = 123.456 + var b = -87.6 + var c = 563.1 + var d = -1.1 + buffer[0] = a + buffer[1] = b + buffer[2] = c + buffer[3] = d + + if (!floatsEq(buffer[0], a)) throw 'pointer handling set failed (5)' + if (!floatsEq(buffer[1], b)) throw 'pointer handling set failed (6)' + if (!floatsEq(buffer[2], c)) throw 'pointer handling set failed (7)' + if (!floatsEq(buffer[3], d)) throw 'pointer handling set failed (8)' + + + buffer = null + + // + // Test raw buffer + // + var path = NSBezierPath.bezierPath + path.moveToPoint(new NSPoint(0, 0)) + path.curve({ toPoint : new NSPoint(10, 20), controlPoint1 : new NSPoint(30, 40), controlPoint2 : new NSPoint(50, 60) }) + + + // Allocate room for 3 points + var buffer = new memoryBuffer(CGFloatEncoding+CGFloatEncoding+CGFloatEncoding+CGFloatEncoding+CGFloatEncoding+CGFloatEncoding) + // Copy points into our buffer + path.element({ atIndex : 1, associatedPoints : new outArgument(buffer, 0) }) + + // Check points were copied OK (controlPoint1, controlPoint2, toPoint) + if (!floatsEq(buffer[0], 30)) throw 'pointer handling raw get failed (9)' + if (!floatsEq(buffer[1], 40)) throw 'pointer handling raw get failed (10)' + if (!floatsEq(buffer[2], 50)) throw 'pointer handling raw get failed (11)' + if (!floatsEq(buffer[3], 60)) throw 'pointer handling raw get failed (12)' + if (!floatsEq(buffer[4], 10)) throw 'pointer handling raw get failed (13)' + if (!floatsEq(buffer[5], 20)) throw 'pointer handling raw get failed (14)' + +/* + log(buffer[0]) + log(buffer[1]) + log(buffer[2]) + log(buffer[3]) + log(buffer[4]) + log(buffer[5]) +*/ + + // Change point values + buffer[0] = 123 + buffer[1] = 456 + buffer[2] = 789 + buffer[3] = 0.123 + buffer[4] = 0.456 + buffer[5] = 0.789 + + path.set({ associatedPoints : buffer, atIndex : 1 }) + // Overwrite existing points + path.setAssociatedPoints_atIndex(buffer, 1) + + // Copy points into a new buffer + var buffer2 = new memoryBuffer(CGFloatEncoding+CGFloatEncoding+CGFloatEncoding+CGFloatEncoding+CGFloatEncoding+CGFloatEncoding) + path.element({ atIndex : 1, associatedPoints : new outArgument(buffer2, 0) }) + + if (!floatsEq(buffer2[0], 123)) throw 'pointer handling raw get failed (15)' + if (!floatsEq(buffer2[1], 456)) throw 'pointer handling raw get failed (16)' + if (!floatsEq(buffer2[2], 789)) throw 'pointer handling raw get failed (17)' + if (!floatsEq(buffer2[3], 0.123)) throw 'pointer handling raw get failed (18)' + if (!floatsEq(buffer2[4], 0.456)) throw 'pointer handling raw get failed (19)' + if (!floatsEq(buffer2[5], 0.789)) throw 'pointer handling raw get failed (20)' + + + buffer = null + buffer2 = null + + + + __jsc__.useSplitCall = useSplitCall diff --git a/jscocoa/Tests/3 derivation.js b/jscocoa/Tests/3 derivation.js new file mode 100644 index 0000000..3664c4f --- /dev/null +++ b/jscocoa/Tests/3 derivation.js @@ -0,0 +1,76 @@ + + + // Define a new class + var newClass = JSCocoaController.createClass_parentClass("NSDerivedObjectTest", "NSObject") + + var o = NSDerivedObjectTest.alloc.init + o.release + o = null + + + // Allocate instance + var o = NSDerivedObjectTest.alloc.init + o.release + + // Use [] accessor as 'class' is a reserved word in Javascript + if (o['class'] != "NSDerivedObjectTest") throw "derived object not created" + + + // Derived a new class and add an overloaded method + // Then derived from that new class + + + // Record original hash + var originalHash = o.hash + + // Overload hash method + var wentThrough1 = false + function myHash() + { + var hash = this.Super(arguments) + wentThrough1 = true + return hash + } + + var added = JSCocoaController.overloadInstanceMethod_class_jsFunction('hash', NSDerivedObjectTest, myHash) + if (!added) throw "Couldn't overload method 1" + + // Check + wentThrough1 = false + var hash = o.hash + if (hash != originalHash) throw 'invalided hash in overloaded method' + if (!wentThrough1) throw 'invalided hash in overloaded method - did not go through' + + + // Derivation of derivation + var newClass = JSCocoaController.createClass_parentClass("NSDerivedObjectTest2", "NSDerivedObjectTest") + + // Allocate instance + var o2 = NSDerivedObjectTest2.alloc.init + o2.release + + // Record original hash + var originalHash2 = o2.hash + + // Overload the same method + var wentThrough2 = false + function myHash2() + { + var hash = this.Super(arguments) + wentThrough2 = true + return hash + } + + var added = JSCocoaController.overloadInstanceMethod_class_jsFunction('hash', NSDerivedObjectTest2, myHash2) + if (!added) throw "Couldn't overload method 2" + + // Check + wentThrough1 = false + wentThrough2 = false + var hash2 = o2.hash + if (hash2 != originalHash2) throw 'invalided hash in overloaded method (2)' + if (!wentThrough1) throw 'invalided hash in overloaded method - did not go through 1st derivation' + if (!wentThrough2) throw 'invalided hash in overloaded method - did not go through 2nd derivation' + + o = null + o2 = null diff --git a/jscocoa/Tests/30 obj1 == obj2.js b/jscocoa/Tests/30 obj1 == obj2.js new file mode 100644 index 0000000..cba2a81 --- /dev/null +++ b/jscocoa/Tests/30 obj1 == obj2.js @@ -0,0 +1,35 @@ + + + /* + + Test if an ObjC object boxed multiple times is equal to itself : + NSWorkspace.sharedWorkspace == NSWorkspace.sharedWorkspace + should be true. + + Sounds obvious but Javascript has no callback to compare. + + */ + + + var obj1 = NSWorkspace.sharedWorkspace + var obj2 = NSWorkspace.sharedWorkspace + +// log('obj1 == obj2=' + (obj1 == obj2)) + +// log(JSCocoaController.boxedObjects) + if (obj1 != obj2) throw 'obj1 != obj2' + + obj1 = null + obj2 = null + +// JSCocoa.garbageCollect +// log(JSCocoaController.boxedObjects) + + +// log(NSApplication == NSApplication) +// log(NSApplication.sharedWorkspace == NSApplication.sharedWorkspace) +// log(NSString.stringWithString('j') == NSString.stringWithString('j')) + + + var v = NSView.alloc.init + v.release \ No newline at end of file diff --git a/jscocoa/Tests/31 bridgeSupport bench.js b/jscocoa/Tests/31 bridgeSupport bench.js new file mode 100644 index 0000000..af2c253 --- /dev/null +++ b/jscocoa/Tests/31 bridgeSupport bench.js @@ -0,0 +1,24 @@ + + + + function getTickCount() { return (new Date).getTime() } + + var t1 = getTickCount() + +//log('***********************') + var a = 1 + var b = 2 + var c = 3 + var r = 0 + var iterationCount = 10000000 + var iterationCount = 10 + for (var i=0; iSUM=' + (x+y+z)) + var r = this.Original(arguments) + swizzleInstanceCalled = true +// if (x != arg1) throw 'swizzle : wrong argument for x — expected ' + arg1 + ', got ' + x + ' (1)' +// if (y != arg2) throw 'swizzle : wrong argument for x — expected ' + arg2 + ', got ' + y + ' (2)' + log('x=' + x + ' y=' + y + ' z=' + z) + return r + } +*/ + Swizzle- (int)addX:(int)x andY:(int)y + { + var r = this.Original(arguments) + swizzleInstanceCalled = true + if (x != arg1) throw 'swizzle : wrong argument for x — expected ' + arg1 + ', got ' + x + ' (1)' + if (y != arg2) throw 'swizzle : wrong argument for x — expected ' + arg2 + ', got ' + y + ' (2)' + return r + } + + Swizzle+ (float)addFloatX:(float)x andFloatY:(float)y + { + var r = this.Original(arguments) + swizzleClassCalled = true + if (x != arg1) throw 'swizzle : wrong argument for x — expected ' + arg1 + ', got ' + x + ' (3)' + if (y != arg2) throw 'swizzle : wrong argument for x — expected ' + arg2 + ', got ' + y + ' (4)' + return r + } + } + + // + // Test swizzling of an existing class of an existing method + // Disabled as it clogs logs +/* + class NSButton + { + swizzle - (void)drawRect:(NSRect)rect + { + this.Original(arguments) + log('drawRect: called on button ' + this) + } + } +*/ + + // Test extra methods + var o1 = ObjCClassTestSwizzle.instance + var r = o1.add13(2) + if (r != 15) throw 'swizzle : add method failed (1)' + + var r = o1.add({ prefix : 'hello', andSuffix : 'world', toString : 'BIG' }) + if (r != 'helloBIGworld') throw 'swizzle : add method failed (2)' + + // Test swizzled methods + var swizzleInstanceCalled = false + var swizzleClassCalled = false + + var arg1 = 3 + var arg2 = 5 + var r = o1.add({ x : arg1, andY : arg2 }) + if (!swizzleInstanceCalled) throw 'swizzle : instance call failed (1)' + if (r != 8) throw 'swizzle : instance call failed (2)' + + var arg1 = 3.5 + var arg2 = 5.5 + var r = ObjCClassTestSwizzle.add({ floatX : arg1, andFloatY : arg2 }) + if (!swizzleClassCalled) throw 'swizzle : class call failed (1)' + if (r != 9) throw 'swizzle : class call failed (2)' + + o1 = null + + __jsc__.useSplitCall = useSplitCall diff --git a/jscocoa/Tests/34 object keys.js b/jscocoa/Tests/34 object keys.js new file mode 100644 index 0000000..0bf6174 --- /dev/null +++ b/jscocoa/Tests/34 object keys.js @@ -0,0 +1,27 @@ + + + // + // Given a javascript hash, return an array of its keys + // + + var o = { name : 'hello', surname : 'world', someVariable : 1.25556 } + +// for (var i in o) log('i=' + i) +// log('allKeys=' + o.allKeys()) + + var hasName = false + var hasSurname = false + var hasSomeVariable = false + var allKeys = o.allKeys() + for (var i=0; i o['class'] + if ([o class] != o['class']) throw 'ObjJ syntax failed (class)' + + var r = [o wantInt:7 andNSArray:[[NSNumber numberWithDouble:1.23], [NSString stringWithString:'hello'], [NSArray arrayWithObjects:1, 2, 3], [4, 5, 6]] andFloat:8] + if (r != 7+8) throw 'ObjJ syntax failed (8)' + + // Test IBAction + var savedSender = nil + [o doThis:'hello'] + if (savedSender != 'hello') throw 'ObjJ syntax failed (9)' + savedSender = nil + + // Test IBOutlet + var p = 'hello' + [o setMyOutlet:p] + if ([o myOutlet]!= p) throw 'ObjJ syntax failed (11)' + + var p = 'hello2' + var wentThrough = false + [o setMyOutlet2:p] + if ([o myOutlet2]!= p) throw 'ObjJ syntax failed (12)' + if (!wentThrough) throw 'ObjJ syntax failed (13)' + + var p = 'hello3' + var wentThrough = false + [o setMyOutlet3:p] + if (!wentThrough) throw 'ObjJ syntax failed (14)' + if ([o myOutlet3]!= p) throw 'ObjJ syntax failed (15)' + + var p = 'hello4' + var wentThrough = false + [o setMyOutlet4:p] + if (!wentThrough) throw 'ObjJ syntax failed (16)' + var wentThrough = false + if ([o myOutlet4]!= p) throw 'ObjJ syntax failed (17)' + + + o = null + + \ No newline at end of file diff --git a/jscocoa/Tests/41 class inner js functions.js b/jscocoa/Tests/41 class inner js functions.js new file mode 100644 index 0000000..d6a5188 --- /dev/null +++ b/jscocoa/Tests/41 class inner js functions.js @@ -0,0 +1,51 @@ + + // + // JS functions defined within a class definition become part of that class + // + + + class ObjCClassInnerJSFunctionTest < NSObject + { + - (id)init + { + var o = this.Super(arguments) + return o + } + // Standard ObjC instance method + - (int)addOne:(int)one andTwo:(int)two + { + return one + two + } + // Raw Javascript instance method + function add(one, two) + { + return one + two + } + + - (int)multiplyOne:(int)one andTwo:(int)two + { + return one * two + } + function multiply(one, two) + { + return one * two + } + } + + var o = ObjCClassInnerJSFunctionTest.instance + + var r1 = [o addOne:5 andTwo:8] + if (r1 != 13) throw 'class inner js functions failed (1)' + var r2 = o.add(5, 8) + if (r2 != 13) throw 'class inner js functions failed (2)' + + var r1 = [o multiplyOne:5 andTwo:8] + if (r1 != 40) throw 'class inner js functions failed (3)' + var r2 = o.multiply(5, 8) + if (r2 != 40) throw 'class inner js functions failed (4)' + + + o = null + + + \ No newline at end of file diff --git a/jscocoa/Tests/42 return if.js b/jscocoa/Tests/42 return if.js new file mode 100644 index 0000000..300eb7d --- /dev/null +++ b/jscocoa/Tests/42 return if.js @@ -0,0 +1,47 @@ + + /* + + One-line Ruby-like + return if ... + return unless ... + + + return something if (condition) + -> transformed to + if (condition) return something + + return something unless (condition) + -> transformed to + if (!(condition)) return something + + */ + + function returnIf1(param) + { + return 'noparam' if (!param) + } + + function returnIf2(param) + { + return 'wantOdd' unless(param&1) + return 'isOdd' + } + + function returnIf3(a, b) + { + return function (a, b) { return a+b }(a, b) if (a > 10) + return function (a, b) { return a*b }(a, b) if (a <= 10 && b < 5) + } + + + var r1 = returnIf1() + if (r1 != 'noparam') throw 'return if failed (1)' + + var r2 = returnIf2(4) + if (r2 != 'wantOdd') throw 'return if failed (2)' + + var r3 = returnIf3(20, 5) + if (r3 != 25) throw 'return if failed (3)' + var r3 = returnIf3(7, 3) + if (r3 != 21) throw 'return if failed (4)' + \ No newline at end of file diff --git a/jscocoa/Tests/43 @ string and selector.js b/jscocoa/Tests/43 @ string and selector.js new file mode 100644 index 0000000..810a374 --- /dev/null +++ b/jscocoa/Tests/43 @ string and selector.js @@ -0,0 +1,25 @@ + + // + // ObjC friendly immediates + // + + // Defines a NSString via NSString.stringWithString + var str = @'hello' + if (![str isKindOfClass:NSString]) throw 'NSString immediate failed (1)' + + var str = @'hello' + ' ' + @'world' + if (str != 'hello world') throw 'NSString immediate failed (2)' + + + // Syntax sugar - @selector(init) defines a raw javascript string 'init' + // (Conversion to selector is implicit in JSCocoa's internals) + var sel1 = @selector(init) + var sel2 = @selector(hello:world:) + if (sel1 != 'init') throw '@selector immediate failed (1)' + if (sel2 != 'hello:world:') throw '@selector immediate failed (2)' + + var sel3 = sel1 + sel2 + if (sel3 != 'inithello:world:') throw '@selector immediate failed (3)' + + + \ No newline at end of file diff --git a/jscocoa/Tests/44 instanceWith.js b/jscocoa/Tests/44 instanceWith.js new file mode 100644 index 0000000..110741b --- /dev/null +++ b/jscocoa/Tests/44 instanceWith.js @@ -0,0 +1,17 @@ + + + // + // [NSView instanceWith:var1 and:var2] + // + + var o1 = [NSString instanceWithString:'hello'] + if (!o1) throw 'instanceWith failed (1)' + if (![o1 isKindOfClass:NSString]) throw 'instanceWith failed (2)' + + + var o2 = [NSURL instanceFileURLWithPath:@"/tmp" isDirectory:true] + if (!o2) throw 'instanceWith failed (3)' + if (![o2 isKindOfClass:NSURL]) throw 'instanceWith failed (4)' + + + o1 = null \ No newline at end of file diff --git "a/jscocoa/Tests/45 \306\222 function shortcut.js" "b/jscocoa/Tests/45 \306\222 function shortcut.js" new file mode 100644 index 0000000..39c2727 --- /dev/null +++ "b/jscocoa/Tests/45 \306\222 function shortcut.js" @@ -0,0 +1,75 @@ + + + // + // Use ƒ (Option-f) as a shortcurt for function. Can omit name and arguments + // + + + // name + parameters + // function name(a, b) { ... } + ƒ nameAndParams(a, b) + { + return a+b + } + + // name + // function name() { ... } + ƒ name + { + return 'hello' + } + + // params + // function (a, b) { ... } + var f2 = ƒ (a, b) + { + return a*b + } + + // no name, no params + var f3 = ƒ + { + return 'world' + } + + + // function () { ... } + var f1 = ƒ{ return 'hello' } + + + function DualNumber(a, b) + { + this.a = a + this.b = b + } + DualNumber.prototype.toString = function () + { + return '(' + this.a + ':' + this.b + ')' + } + var a = [new DualNumber(5, 2), new DualNumber(1, 3), new DualNumber(8, 1), new DualNumber(1, 1)] +// log('raw=' + a) + a.sort(ƒ{ + var a = arguments[0] + var b = arguments[1] + if (a.a < b.a) return -1 + if (a.a > b.a) return 1 + if (a.b < b.b) return -1 + if (a.b > b.b) return 1 + return 0 + }) + +// log('sorted=' + a) + + if (nameAndParams(8, 5) != 13) throw 'ƒ shortcut failed (1)' + if (name() != 'hello') throw 'ƒ shortcut failed (2)' + if (f2(9, 6) != 54) throw 'ƒ shortcut failed (3)' + if (f3() != 'world') throw 'ƒ shortcut failed (4)' + + var sorted = a[0].a == 1 && a[0].b == 1 + && a[1].a == 1 && a[1].b == 3 + && a[2].a == 5 && a[2].b == 2 + && a[3].a == 8 && a[3].b == 1 + + if (!sorted) throw 'ƒ shortcut failed (5)' + + \ No newline at end of file diff --git a/jscocoa/Tests/46 exceptions.js b/jscocoa/Tests/46 exceptions.js new file mode 100644 index 0000000..c6d6984 --- /dev/null +++ b/jscocoa/Tests/46 exceptions.js @@ -0,0 +1,26 @@ + + + /* + -objectAtIndex: in Cocoa Uncanny Valley + http://rentzsch.tumblr.com/post/266777783/objectatindex-in-cocoa-uncanny-valley + + Fixed. Exception is caught in callAsFunction_ffi, then boxed back to Javascript. + */ + + + var gotIntoCatchBlock = false + try + { + log('Test 46 objectAtIndex=' + [[NSArray arrayWithObjects:@"a", @"b", nil] objectAtIndex:-1]) + } + catch(e) + { + gotIntoCatchBlock = true +// log('got an ObjC exception ' + e.name + '\n' + e.reason) + + if (e.name != 'NSRangeException') throw 'NSArray range exception failed (1)' + if (!e.reason.match(/objectAtIndex/)) throw 'NSArray range exception failed (2)' + } + + if (!gotIntoCatchBlock) throw 'NSArray range exception failed (3)' + diff --git a/jscocoa/Tests/47 ObjJ syntax super.js b/jscocoa/Tests/47 ObjJ syntax super.js new file mode 100644 index 0000000..9b61aee --- /dev/null +++ b/jscocoa/Tests/47 ObjJ syntax super.js @@ -0,0 +1,111 @@ + + + // + // Objective-J, JSTalk - like syntax + // super addon + // + /* + - (void)myMethod:(id)arg + { + // Standard argument, gotten trough arguments.callee + this.Super(arguments) + + // ObjC like call + [super myMethod:arg] + // Translates to + this.Super(arguments, 'myMethod') + + // Same for swizzling + [original myMethod:arg] + // -> + this.Original(arguments, 'myMethod') + } + */ + + + var wentThrough1 = false + var wentThrough2 = false + var wentThrough3 = false + var wentThrough4 = false + + // + // Super test + // + class ObjJSuperTest1 < NSObject + { + - (int)paramLessMethod + { + return 3 + } + - (int)method1:(int)a and2:(int)b + { + wentThrough1 = true + return a+b+1 + } + } + + class ObjJSuperTest2 < ObjJSuperTest1 + { + - (int)paramLessMethod + { + return 4 + [super paramLessMethod] + } + - (int)superTestWith:(int)a and:(int)b + { + return [super method1:a and2:b] + } + + - (int)method1:(int)a and2:(int)b + { + wentThrough2 = true + return a + b + [super method1:a and2:b] + 10 + } + } + + + var o = [ObjJSuperTest2 instance] + + wentThrough1 = wentThrough2 = false + var r = [o superTestWith:4 and:3] + if (r != (4+3+1)) throw 'ObjJ super syntax failed (1)' + if (!wentThrough1 || wentThrough2) throw 'ObjJ super syntax failed (2)' + + wentThrough1 = wentThrough2 = false + var r = [o method1:10 and2:5] + if (r != (10+5+1+10+5+10)) throw 'ObjJ super syntax failed (3)' + if (!wentThrough1 || !wentThrough2) throw 'ObjJ super syntax failed (4)' + + var r = [o paramLessMethod] + if (r != 7) throw 'ObjJ super syntax failed (5)' + + // + // Swizzle test + // + class ObjJSuperTest3 < NSObject + { + - (int)addThis:(int)a andThat:(int)b + { + wentThrough3 = true + return a + b + 100 + } + } + + class ObjJSuperTest3 + { + swizzle - (int)addThis:(int)a andThat:(int)b + { + wentThrough4 = true + return [original addThis:a andThat:b] + 1000 + } + } + + var o = [ObjJSuperTest3 instance] + var r = [o addThis:11 andThat:2] + if (r != (11+2+100+1000)) throw 'ObjJ super syntax failed (5)' + if (!wentThrough3 || !wentThrough4) throw 'ObjJ super syntax failed (6)' + + + o = null + + + diff --git a/jscocoa/Tests/48 ObjJ syntax compatibility.js b/jscocoa/Tests/48 ObjJ syntax compatibility.js new file mode 100644 index 0000000..1a880aa --- /dev/null +++ b/jscocoa/Tests/48 ObjJ syntax compatibility.js @@ -0,0 +1,68 @@ + + + // + // Objective-J, JSTalk - like syntax + // class syntax compatibility + // + + @implementation ObjJClassSyntax1 : NSObject + - (int)method1:(int)a and2:(int)b + { + return a+b+1 + } + @end + + + @implementation ObjJClassSyntax2 : ObjJClassSyntax1 + // Right now these are just skipped. + { + int var1 + float var2 + } + + - (int)method1:(int)a and2:(int)b + { + return a+b+10+[super method1:a and2:b] + } + @end + + + @implementation ObjJClassSyntax2 (SomeExtraMethods) + - (id)hello + { + return 'hello' + } + - (id)world + { + return 'world' + } + + // Check protocol indicator's generated encoding + - (BOOL)validateUserInterfaceItem:(id )item + { + return false + } + + @end + + var o = [ObjJClassSyntax1 instance] + + var r = [o method1:4 and2:3] + if (r != (4+3+1)) throw 'ObjJ compat syntax failed (1)' + + var o = [ObjJClassSyntax2 instance] + var r = [o method1:13 and2:36] + if (r != (13+36+1+10+13+36)) throw 'ObjJ compat syntax failed (2)' + + if ([o hello] != 'hello') throw 'ObjJ compat syntax failed (3)' + if ([o world] != 'world') throw 'ObjJ compat syntax failed (4)' + + + // Protocol indicator + var protocolMethodSignature = [JSCocoa typeEncodingOfMethod:'validateUserInterfaceItem:' class:'ObjJClassSyntax2'] + if (protocolMethodSignature != 'c@:@') throw 'ObjJ compat syntax failed (5)' + + o = null + + + diff --git a/jscocoa/Tests/49 out pointer.js b/jscocoa/Tests/49 out pointer.js new file mode 100644 index 0000000..66a4b31 --- /dev/null +++ b/jscocoa/Tests/49 out pointer.js @@ -0,0 +1,146 @@ + + // + // Write something at some address + // In particular, return an NSError in a method + // + + @implementation NSErrorCallback : NSObject + + - (BOOL)someMethodReturningAnError:(NSError**)outError + { +// log('outError=' + outError) + + // Init a memory buffer from pointer + var b = new memoryBuffer('^') + b[0] = outError + + // Reference error in this pointer ( *outError = error ) + [b referenceObject:error usingPointerAtIndex:0] + + // Read it back + var readBackError1 = [b dereferenceObjectAtIndex:0] + if (readBackError1 != error) throw 'NSError** read/write failed (1)' + + // Read it via JSCocoaPrivateObject + var readBackError2 = outError.dereferencedObject + if (readBackError1 != readBackError2) throw 'NSError** read/write failed (2)' + + // null error out + outError.referenceObject(null) + var readBackError3 = outError.dereferencedObject + if (readBackError3 != null) throw 'NSError** read/write failed (3)' + + // Write error via JSCocoaPrivateObject + outError.referenceObject(error) + var readBackError4 = outError.dereferencedObject + if (readBackError4 != error) throw 'NSError** read/write failed (4)' + + return res + } + + - (BOOL)someMethodReturningAnError2:(NSError**)outError + { + // Make sure we don't crash with anull pointer + var o = outError.dereferencedObject + if (o != null) throw 'NSError** read/write failed (5)' + + + // Init a memory buffer from pointer + var b = new memoryBuffer('^') + b[0] = outError + + var readBackError = [b dereferenceObjectAtIndex:0] + if (readBackError != null) throw 'NSError** read/write failed (6)' + + return true + } + + - (BOOL)someMethodReturningAnError3:(NSError**)outError + { + // Test a error written to an outArgument passed to us + var url = [NSURL fileURLWithPath:@"/non/existent"]; + [@"hello" writeToURL:url atomically:NO encoding:NSUTF8StringEncoding error:outError]; + errorFromTest3 = outError.dereferencedObject + + return true + } + + // This exists to check how pointers are handled by the method signature + - (BOOL)someMethodReturningAnError3:(NSError**)outError andInt:(int*)a + { + return false + } + + @end + + var o = [NSErrorCallback instance] + + + var res = true + + var errorDomain = 'NSErrorCallback test' + var errorCode = '503' + var error = [NSError errorWithDomain:errorDomain code:errorCode userInfo:nil] + + var delegate = NSApplication.sharedApplication.delegate + + // Call ourselves back + var b = [delegate callbackNSErrorWithClass:o] + + var errorFromDelegate = [delegate testNSError] + if (errorFromDelegate.domain != errorDomain) throw 'NSError** failed (1)' + if (errorFromDelegate.code != errorCode) throw 'NSError** failed (2)' + + + // Test again, this time with an error from a file read + var url = [NSURL fileURLWithPath:@"/non/existent"]; + var error = new outArgument + var r = [@"hello" writeToURL:url atomically:NO encoding:NSUTF8StringEncoding error:error]; + error = error.outValue + + if (error == null) throw 'Expected an error while writing to a non existent file' + + errorDomain = error.domain + errorCode = error.code + + var b = [delegate callbackNSErrorWithClass:o] + + var errorFromDelegate = [delegate testNSError] + if (errorFromDelegate.domain != errorDomain) throw 'NSError** failed (3)' + if (errorFromDelegate.code != errorCode) throw 'NSError** failed (4)' + + // Test with null pointer + [o someMethodReturningAnError2:null] + + +/* + log('>>>>>>SIG ' + [JSCocoa typeEncodingOfMethod:'signatureTestWithError:' class:'ApplicationController']) + log('>>>>>>SIG ' + [JSCocoa typeEncodingOfMethod:'signatureTestWithError2:andInt:' class:'ApplicationController']) + log('>>>>>>SIG ' + [JSCocoa typeEncodingOfMethod:'someMethodReturningAnError3:andInt:' class:'NSErrorCallback']) + log('>>>>>>SIG ' + [JSCocoa typeEncodingOfMethod:'someMethodReturningAnError:' class:'NSErrorCallback']) +*/ + + // Test with null pointer + var errorFromTest3 = null + + var oa = new outArgument + [o someMethodReturningAnError3:oa] + + var error2 = oa.outValue + if (!errorFromTest3) throw 'NSError** failed (5)' + if (!error2) throw 'NSError** failed (6)' + if (error2.domain != errorFromTest3.domain) throw 'NSError** failed (7)' + if (error2.code != errorFromTest3.code) throw 'NSError** failed (7)' + + + // Test method signature : NSError** should be encoded with a pointer + var actualSig = [JSCocoa typeEncodingOfMethod:'someMethodReturningAnError:' class:'NSErrorCallback'] + var expectedSig = 'c@:^@' + if (actualSig != expectedSig) throw 'NSError** signature failed — expected ' + expectedSig + ', got ' + actualSig + + + + o = null + + + \ No newline at end of file diff --git a/jscocoa/Tests/50 setValueForKey op.js b/jscocoa/Tests/50 setValueForKey op.js new file mode 100644 index 0000000..ea466fa --- /dev/null +++ b/jscocoa/Tests/50 setValueForKey op.js @@ -0,0 +1,65 @@ + + // + // obj.key @= value + // -> obj.setValue_forKey_(value, 'key') + // + // Lots of check because op rewriting must account for comments, parens, newlines ... + // + + var key, value + + @implementation SetValueOpTester : NSObject + + - (void)setValue:(id)v forKey:(NSString *)k + { + key = k + value = v +// log(key + '=' + value) + } + + @end + + + var o = [SetValueOpTester instance] + o.key @= 123 + + if (key != 'key' && value != 123) throw '@= failed (1)' + + + o.value1 @= ((((2+2)))) + if (key != 'value1' && value != 4) throw '@= failed (1)' + o.value1 @= ((((2+2 /* last comment to check */ )))) + if (key != 'value1' && value != 4) throw '@= failed (1)' + o.value1 @= ((((2+2 /* last comment to check */ + )))) + if (key != 'value1' && value != 4) throw '@= failed (1)' + o.value1 @= (((((((((((((((((((((((((((((((((((((((((((((((((((((((((2+2))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + if (key != 'value1' && value != 4) throw '@= failed (1)' + + + o. /* comment */ valueA @= 'BBB' + if (key != 'valueA' && value != 'BBB') throw '@= failed (1)' + o. /* comment */ valueA /* aeaz */ @= 'BBB' + if (key != 'valueA' && value != 'BBB') throw '@= failed (1)' + o. valueA /* aeaz */ @= 'BBB' + if (key != 'valueA' && value != 'BBB') throw '@= failed (1)' + o. /* comment */ /* eza */ valueA /* aeaz */ /* eza */ @= 'BBB' + if (key != 'valueA' && value != 'BBB') throw '@= failed (1)' + + var a = 7 + o.value1 @= 1 + ((((3+a)))) + 4*(a) + if (key != 'value1' && value != (1 + ((((3+a)))) + 4*(a))) throw '@= failed (1)' + + o[ /* comment */ 'valueA'] @= 'BBB' + if (key != 'valueA' && value != 'BBB') throw '@= failed (1)' + o[ 'valueA' /* comment */ ] @= 'BBB' + if (key != 'valueA' && value != 'BBB') throw '@= failed (1)' + o[ /* comment */ 'va' + function() { return 'lu' }() + /* hep */ 'eA'] @= 'BBB' + if (key != 'valueA' && value != 'BBB') throw '@= failed (1)' + + +// [[NSPrefset2 blah] doThisAndThatWith1:'hello2'+3+[a b] and2:'world'+[z a:1 b:[k d2] c:3]]['value3'] /* ho */ @= /* hai */ 'hello3' + 'world' + 3/5 +// [[NSPrefset2 blah] doThisAndThatWith1:'hello2'+3+[a b] and2:'world'+[z a:1 b:[k d2] c:3]]['value3' + [a b][5]] /* ho */ @= /* hai */ 'hello3' + 'world' + 3/5 + + + o = null diff --git a/jscocoa/Tests/51 ObjC blocks.js b/jscocoa/Tests/51 ObjC blocks.js new file mode 100644 index 0000000..a76bed9 --- /dev/null +++ b/jscocoa/Tests/51 ObjC blocks.js @@ -0,0 +1,24 @@ + + // + // Use javascript functions as blocks + // TOWORK + // Definition absent from regular bridgesupport, only exists in the full version. + // Custom parsing in JSLint ? + // + +/* + var array = [NSArray arrayWithObjects:'hello', 'world', 'bonjour', 'monde'] + + + function arrayEnumerator(obj, idx, stop) + { + log('idx=' + idx + ' obj=' + obj) + } + + log('encoding=' + [JSCocoa typeEncodingOfMethod:'enumerateObjectsUsingBlock:' class:'NSArray']) + + + [array enumerateObjectsUsingBlock:arrayEnumerator] + + log(array) +*/ \ No newline at end of file diff --git a/jscocoa/Tests/52 line and sourceURL.js b/jscocoa/Tests/52 line and sourceURL.js new file mode 100644 index 0000000..84bca9b --- /dev/null +++ b/jscocoa/Tests/52 line and sourceURL.js @@ -0,0 +1,40 @@ + + // + // Use __FILE__ and __LINE__ macros + // + + var url = __FILE__ + url = url.split('/') + if (url[url.length-1] != '52 line and sourceURL.js') throw '(1) line and sourceURL failed' + + var line = __LINE__ + if (line != 10) throw '(2) line and sourceURL failed' + + + + + + + var line = __LINE__ + if (line != 18) throw '(3) line and sourceURL failed' + + + + + + + + + + + + + + + + + + var line = __LINE__ + if (line != 37) throw '(4) line and sourceURL failed' + + diff --git a/jscocoa/Tests/53 Unicode ObjC classes.js b/jscocoa/Tests/53 Unicode ObjC classes.js new file mode 100644 index 0000000..dd97231 --- /dev/null +++ b/jscocoa/Tests/53 Unicode ObjC classes.js @@ -0,0 +1,44 @@ + + + @implementation Élève : NSObject + + - (NSString*)sayHello:(NSString*)str + { + return ('Hello ' + str) + } + + @end + + + var o = [Élève instance] + var message = o.sayHello('world') +// log('message=' + message) + if (message != 'Hello world') throw 'Unicode ObjC classes failed (1)' + + + @implementation ファイナンス : NSObject + + - (int)スチール追加:(int)一 熱:(int)二 + { + return 一 + 二 + } + + - (id)だけを追加する:(id)一 + { + return [NSNumber numberWithInt:[一 intValue] + 1] + } + + + + @end + + + var o = [ファイナンス instance] + var r = [o スチール追加:3 熱:7] + +// log('res=' + r) + + if (r != 10) throw 'Unicode ObjC classes failed (2)' + + + o = null \ No newline at end of file diff --git a/jscocoa/Tests/54 custom indexed access.js b/jscocoa/Tests/54 custom indexed access.js new file mode 100644 index 0000000..fa7ba78 --- /dev/null +++ b/jscocoa/Tests/54 custom indexed access.js @@ -0,0 +1,103 @@ + +/* + + Use Javascript bracket notation to get and set objects, whether as arrays or dictionaries. + + var a = customIndexAccess[i].x + customIndexAccess[i].x = 123 + + Add get and set methods in a class to have it behave like an array or a hash in Javascript. + + Behave like an array + get - (id)objectAtIndex:(int)index + set - (void)replaceObjectAtIndex:(int)index withObject:(id)anObject + length - (int)count + + Then use object[index] to get and set. + + Behave like a dictionary + get - (id)objectForKey:(NSString*)key + set - (void)setObject:(id)anObject forKey:(id)aKey + + Then use object[key] or object.key to get and set. + +*/ + + + var globalObject + var globalIndex + + @implementation CustomIndexedAccess : NSObject + + - (id)objectAtIndex:(int)index + { + if (index == 0) return 'Hello' + if (index == 1) return 'World' + if (index == 2) return 'Test' + } + - (int)count + { + return 3 + } + + - (void)replaceObjectAtIndex:(int)index withObject:(id)anObject + { + globalIndex = index + globalObject = anObject +// log('replaceObjectAtIndex=' + index + ' withObject=' + anObject) + } + + @end + + @implementation CustomKeyedAccess : NSObject + + - (id)objectForKey:(NSString*)key + { + if (key == 'first') return 'Test' + if (key == 'second') return 'Bonjour' + if (key == 'third') return 'Monde' + } + + - (void)setObject:(id)anObject forKey:(id)aKey + { + globalIndex = aKey + globalObject = anObject +// log('setObject=' + anObject + ' forKey=' + aKey) + } + + @end + + + var o = [CustomIndexedAccess instance] + + if (o[0] != 'Hello') throw 'Custom indexed access failed (1)' + if (o[1] != 'World') throw 'Custom indexed access failed (2)' + if (o[2] != 'Test') throw 'Custom indexed access failed (3)' + if (o.length != 3) throw 'Custom indexed access failed (4)' + + o[0] = 'prim' + if (globalIndex != 0 && globalIndex != 'prim') throw 'Custom indexed access failed (5)' + o[1] = 'prox' + if (globalIndex != 1 && globalIndex != 'prox') throw 'Custom indexed access failed (6)' + o[2] = 'dern' + if (globalIndex != 2 && globalIndex != 'dern') throw 'Custom indexed access failed (7)' + + + var o = [CustomKeyedAccess instance] + if (o['first'] != 'Test') throw 'Custom indexed access failed (8)' + if (o['second'] != 'Bonjour') throw 'Custom indexed access failed (9)' + if (o['third'] != 'Monde') throw 'Custom indexed access failed (10)' + + o['first'] = 'prim' + if (globalIndex != 'first' && globalIndex != 'prim') throw 'Custom indexed access failed (11)' + o['second'] = 'prox' + if (globalIndex != 'second' && globalIndex != 'prox') throw 'Custom indexed access failed (12)' + o['third'] = 'dern' + if (globalIndex != 'third' && globalIndex != 'dern') throw 'Custom indexed access failed (13)' + + + o = null + globalIndex = null + globalObject = null + + diff --git a/jscocoa/Tests/55 javascript method override.js b/jscocoa/Tests/55 javascript method override.js new file mode 100644 index 0000000..447cd66 --- /dev/null +++ b/jscocoa/Tests/55 javascript method override.js @@ -0,0 +1,86 @@ + +/* + + Use Javascript functions to override behaviour of existing ObjC objects + (This override exists only on the JSCocoa side and lets the ObjC methods intact) + +*/ + + var canSet = __jsc__.canSetOnBoxedObjects + __jsc__.canSetOnBoxedObjects = true + + var wentThrough1, wentThrough2, wentThrough3 + + + @implementation JavascriptMethodOverride : NSObject + + - (int)add:(int)a + { + wentThrough1 = true + return a + 10 + } + - (int)add:(int)a and:(int)b + { + wentThrough2 = true + return a + b + 20 + } + + @end + + + var o = JavascriptMethodOverride.instance + o.add = function () + { + wentThrough3 = true + if (arguments.length == 1) return this.add_(arguments[0]) + if (arguments.length == 2) return this.add_and_(arguments[0], arguments[1]) + return null + } + + + wentThrough1 = wentThrough2 = wentThrough3 = false + + if (o.add_(15) != 25) throw 'Javascript method override failed (1)' + if (!(wentThrough1 && !wentThrough2 && !wentThrough3)) throw 'Javascript method override failed (2)' + + + wentThrough1 = wentThrough2 = wentThrough3 = false + + if (o.add_and_(5, 7) != 32) throw 'Javascript method override failed (3)' + if (!(!wentThrough1 && wentThrough2 && !wentThrough3)) throw 'Javascript method override failed (4)' + + + wentThrough1 = wentThrough2 = wentThrough3 = false + + if (o.add(15) != 25) throw 'Javascript method override failed (5)' + if (!(wentThrough1 && !wentThrough2 && wentThrough3)) throw 'Javascript method override failed (6)' + + + wentThrough1 = wentThrough2 = wentThrough3 = false + + if (o.add(5, 7) != 32) throw 'Javascript method override failed (7)' + if (!(!wentThrough1 && wentThrough2 && wentThrough3)) throw 'Javascript method override failed (8)' + + o = null + + + // + // Test on a raw ObjC object, not a JSCocoa derived one + // + var wentThrough4 = false + + o = NSObject.instance + o.respondsToSelector = function (sel) + { + wentThrough4 = true + return this.respondsToSelector_(sel) + } + + o.respondsToSelector('hello') + if (!wentThrough4) throw 'Javascript method override failed (9)' + + o = null + + __jsc__.canSetOnBoxedObjects = canSet + + \ No newline at end of file diff --git a/jscocoa/Tests/56 whitespace.js b/jscocoa/Tests/56 whitespace.js new file mode 100644 index 0000000..b7bc8a5 --- /dev/null +++ b/jscocoa/Tests/56 whitespace.js @@ -0,0 +1,24 @@ + + + var object = MRTestWhitespace.alloc.init.autorelease; + +/* + var linebreak = object.fetchLinebreak; + + log('Linebreak: `' + linebreak + '`'); + log('Tab: `' + object.fetchTab + '`'); + log('Four Spaces: `' + object.fetchSpaces + '`'); + + if (linebreak) { + log('linebreak evaluates as true'); + } else { + log('linebreak evaluates as false'); + } + + log('className: ' + linebreak.className); +*/ + + if (object.fetchLinebreak != '\n') throw 'Whitespace failed (1)' + if (object.fetchTab != ' ') throw 'Whitespace failed (2)' + if (object.fetchSpaces != ' ') throw 'Whitespace failed (3)' + diff --git a/jscocoa/Tests/6 basic arguments.js b/jscocoa/Tests/6 basic arguments.js new file mode 100644 index 0000000..6988609 --- /dev/null +++ b/jscocoa/Tests/6 basic arguments.js @@ -0,0 +1,154 @@ + + + + /* + + Test int, float, bool, strings + + http://stackoverflow.com/questions/1908492/unsigned-integer-in-javascript + Javascript ints are signed, therefore + 1 << 31 returns a negative number + (1 << 31) >>> 0 coerces to a positive number + + To get 1 << 32 + (1 << 30)*4 + + */ + +// JSCocoaController.sharedController.evalJSFile(NSBundle.mainBundle.bundlePath + '/Contents/Resources/class.js') + + + // Define a new class + var newClass = JSCocoaController.createClass_parentClass("BasicArgumentsTester", "NSObject") + + // Test all encodings with a small float bias (0.1) + // that bias will disappear during int conversion + var encodingsToTest = ['c', 'C', 's', 'S', 'i', 'I', 'f', 'd']; + for (var i=0; i + + + + + + + + + + \ No newline at end of file diff --git a/jscocoa/Tests/Resources/35 webView page.html b/jscocoa/Tests/Resources/35 webView page.html new file mode 100644 index 0000000..c52d090 --- /dev/null +++ b/jscocoa/Tests/Resources/35 webView page.html @@ -0,0 +1,89 @@ + + + + +

JSCocoa will interact with this webpage. +

This page should show two DIVs with a green background-color. Last div should contain the digit 8, not the word eight. +


+ +
This should be hidden.
+ + + +
This should be green.
+ +
The digit eight should follow : eight
+ + + + Google +

+

+
+ + + + + \ No newline at end of file diff --git a/jscocoa/Tests/Resources/37 inited from webview.html b/jscocoa/Tests/Resources/37 inited from webview.html new file mode 100644 index 0000000..10e5d9b --- /dev/null +++ b/jscocoa/Tests/Resources/37 inited from webview.html @@ -0,0 +1,88 @@ + + + + + +

WebView's context used as JSCocoa source

+ + + Yahoo + +

+

+ + + + + \ No newline at end of file diff --git a/jscocoa/Tests/Resources/externalFileTest.js b/jscocoa/Tests/Resources/externalFileTest.js new file mode 100644 index 0000000..31b9864 --- /dev/null +++ b/jscocoa/Tests/Resources/externalFileTest.js @@ -0,0 +1,8 @@ + + + function externalFunctionAdder(a, b) + { + return a+b + } + + var externalVariable = 'Hello !' diff --git a/jscocoa/Tests/Resources/inited from WebView.nib/designable.nib b/jscocoa/Tests/Resources/inited from WebView.nib/designable.nib new file mode 100644 index 0000000..b2f83e3 --- /dev/null +++ b/jscocoa/Tests/Resources/inited from WebView.nib/designable.nib @@ -0,0 +1,662 @@ + + + + 1060 + 10A432 + 732 + 1038 + 437.00 + + YES + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + 732 + 732 + + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + + YES + + + YES + + + + YES + + ApplicationController + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{196, 111}, {400, 400}} + 544735232 + JSCocoa inited from WebView + NSWindow + + {1.79769e+308, 1.79769e+308} + + + 256 + + YES + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + + {400, 400} + + + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + {400, 400} + + + {{0, 0}, {1680, 1028}} + {1.79769e+308, 1.79769e+308} + + + + + YES + + + webViewUsedAsContextSource + + + + 4 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 2 + + + YES + + + + + + 3 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBAttributePlaceholdersKey + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 2.IBPluginDependency + 3.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + YES + + + YES + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{24, 720}, {400, 400}} + com.apple.InterfaceBuilder.CocoaPlugin + {{24, 720}, {400, 400}} + + {196, 240} + {{357, 418}, {480, 270}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 4 + + + + YES + + ApplicationController + NSObject + + YES + + YES + garbageCollect: + runJSTests: + runSimpleTestFile: + unlinkAllReferences: + + + YES + id + id + id + id + + + + webViewUsedAsContextSource + id + + + IBProjectSource + ApplicationController.h + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaController.h + + + + + YES + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../TestsRunner.xcodeproj + 3 + + diff --git a/jscocoa/Tests/Resources/inited from WebView.nib/keyedobjects.nib b/jscocoa/Tests/Resources/inited from WebView.nib/keyedobjects.nib new file mode 100644 index 0000000..aa7c824 Binary files /dev/null and b/jscocoa/Tests/Resources/inited from WebView.nib/keyedobjects.nib differ diff --git a/jscocoa/Tests/Resources/standalone window OLD.nib/designable.nib b/jscocoa/Tests/Resources/standalone window OLD.nib/designable.nib new file mode 100644 index 0000000..dc0a337 --- /dev/null +++ b/jscocoa/Tests/Resources/standalone window OLD.nib/designable.nib @@ -0,0 +1,523 @@ + + + + 1050 + 9F33 + 672 + 949.34 + 352.00 + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + NibTestOwner + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{196, 213}, {481, 297}} + 536870912 + Check Title Change + NSWindow + + {3.40282e+38, 3.40282e+38} + + + 256 + + YES + + + 268 + {{145, 153}, {226, 32}} + + YES + + 67239424 + 134217728 + MyButtonTestingOutletAction + + LucidaGrande + 1.300000e+01 + 1044 + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{83, 76}, {130, 25}} + + YES + + -2080244224 + 134217728 + ButtonOutletTest1 + + + -2038152961 + 163 + + + 400 + 75 + + + + + 268 + {{83, 45}, {130, 25}} + + YES + + 67239424 + 134217728 + ButtonOutletTest2 + + + -2038152961 + 163 + + + 400 + 75 + + + + + 268 + {{83, 14}, {130, 25}} + + YES + + 67239424 + 134217728 + ButtonOutletTest3 + + + -2038152961 + 163 + + + 400 + 75 + + + + + 268 + {{310, 77}, {96, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + + + + 268 + {{310, 45}, {96, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + + + + + {481, 297} + + + {{0, 0}, {1920, 1178}} + {3.40282e+38, 3.40282e+38} + + + + + YES + + + myOutlet1 + + + + 19 + + + + myOutlet2 + + + + 20 + + + + myOutlet3 + + + + 21 + + + + window + + + + 29 + + + + button + + + + 30 + + + + myAction1: + + + + 31 + + + + myAction2: + + + + 32 + + + + myAction3: + + + + 33 + + + + input1 + + + + 38 + + + + input2 + + + + 39 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 2 + + + YES + + + + + + + + + + + 17 + + + YES + + + + + + 18 + + + + + 9 + + + YES + + + + + + 10 + + + + + 15 + + + YES + + + + + + 16 + + + + + 36 + + + YES + + + + + + 37 + + + + + 34 + + + YES + + + + + + 35 + + + + + 5 + + + YES + + + + + + 6 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 10.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency + 2.IBPluginDependency + 34.IBPluginDependency + 35.IBPluginDependency + 36.IBPluginDependency + 37.IBPluginDependency + 5.CustomClassName + 5.IBPluginDependency + 6.IBPluginDependency + 9.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{82, 449}, {481, 297}} + com.apple.InterfaceBuilder.CocoaPlugin + {{82, 449}, {481, 297}} + + {196, 240} + {{257, 188}, {481, 297}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + MyButtonTestingOutletAction + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 39 + + + + YES + + MyButtonTestingOutletAction + + IBUserSource + + + + + NibTestOwner + + YES + + YES + button + input1 + input2 + window + + + YES + id + id + id + id + + + + IBUserSource + + + + + + 0 + ../JSCocoa.xcodeproj + 3 + + diff --git a/jscocoa/Tests/Resources/standalone window OLD.nib/keyedobjects.nib b/jscocoa/Tests/Resources/standalone window OLD.nib/keyedobjects.nib new file mode 100644 index 0000000..17d9a63 Binary files /dev/null and b/jscocoa/Tests/Resources/standalone window OLD.nib/keyedobjects.nib differ diff --git a/jscocoa/Tests/Resources/standalone window.nib/designable.nib b/jscocoa/Tests/Resources/standalone window.nib/designable.nib new file mode 100644 index 0000000..078930f --- /dev/null +++ b/jscocoa/Tests/Resources/standalone window.nib/designable.nib @@ -0,0 +1,672 @@ + + + + 1050 + 9E17 + 629 + 949.33 + 352.00 + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + NibTestOwner + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{196, 213}, {481, 297}} + 536870912 + Check Title Change + NSWindow + + + + 256 + + YES + + + 268 + {{145, 153}, {226, 32}} + + + YES + + 67239424 + 134217728 + MyButtonTestingOutletAction + + LucidaGrande + 1.300000e+01 + 1044 + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{83, 76}, {130, 25}} + + + YES + + -2080244224 + 134217728 + ButtonOutletTest1 + + + -2038152961 + 163 + + + 400 + 75 + + + + + 268 + {{83, 45}, {130, 25}} + + + YES + + 67239424 + 134217728 + ButtonOutletTest2 + + + -2038152961 + 163 + + + 400 + 75 + + + + + 268 + {{83, 14}, {130, 25}} + + + YES + + 67239424 + 134217728 + ButtonOutletTest3 + + + -2038152961 + 163 + + + 400 + 75 + + + + + 268 + {{310, 77}, {96, 22}} + + + YES + + -1804468671 + 272630784 + + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + + textColor + + 3 + MAA + + + + + + + 268 + {{310, 45}, {96, 22}} + + + YES + + -1804468671 + 272630784 + + + + YES + + + + + + {481, 297} + + + + {{0, 0}, {1920, 1178}} + + + + + YES + + + myOutlet1 + + + + 19 + + + + myOutlet2 + + + + 20 + + + + myOutlet3 + + + + 21 + + + + window + + + + 29 + + + + button + + + + 30 + + + + myAction1: + + + + 31 + + + + myAction2: + + + + 32 + + + + myAction3: + + + + 33 + + + + input1 + + + + 38 + + + + input2 + + + + 39 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 2 + + + YES + + + + + + + + + + + 5 + + + YES + + + + + + 6 + + + + + 9 + + + YES + + + + + + 10 + + + + + 15 + + + YES + + + + + + 16 + + + + + 17 + + + YES + + + + + + 18 + + + + + 34 + + + YES + + + + + + 35 + + + + + 36 + + + YES + + + + + + 37 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 10.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency + 2.IBPluginDependency + 34.IBPluginDependency + 35.IBPluginDependency + 36.IBPluginDependency + 37.IBPluginDependency + 5.CustomClassName + 5.IBPluginDependency + 6.IBPluginDependency + 9.IBPluginDependency + + + YES + + + + + {{257, 188}, {481, 297}} + + {196, 240} + {{257, 188}, {481, 297}} + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 39 + + + + YES + + + + + YES + + YES + + + YES + + + + YES + + YES + + + + + + + YES + id + id + + + + + + IBUserSource + + + + + + + + YES + + YES + + + + + + YES + + + + + + + YES + + YES + + + + + + YES + + + + + + + + + + + + + 0 + ../JSCocoa.xcodeproj + 3 + + YnBsaXN0MDDUAAEAAgADAAQABQAGAAkAClgkdmVyc2lvblQkdG9wWSRhcmNoaXZlclgkb2JqZWN0cxIA +AYag0QAHAAhdSUIub2JqZWN0ZGF0YYABXxAPTlNLZXllZEFyY2hpdmVyrxCNAAsADAAxADUANgA8AD0A +QgBWAFcAWABZAAsAZgBvAH4AfwCAAIEAmQChAKIApQCmAKoArQC1ALYAwgDDAMgA0ADRANgA2QDhAOIA +6QDqAPIA8wEAAQoBCwEMAREBEwEYARkBHAEfASIBKgErATMBNwALATgBOgE7AT4BQgFPAVcBWAFcAWEB +YgFnAWgBawFwAXEBdgF3AXwBfQGCAYMBiAGJAY4BjwGUAZUBpwGqAasBrQG/AdIB5QHmAecB6AHpAeoB +6wHsAe0B7gHvAfAB8QHyAfMB9AH1AfkB/QIaAjcCOAI5AjoCOwI8Aj0CPgI/AkACQQJCAkMCRAJFAkYC +RwJIAkkCSgBUAksAUwEHAkwCTQJOAlECVAJXVSRudWxs3xASAA0ADgAPABAAEQASABMAFAAVABYAFwAY +ABkAGgAbABwAHQAeAB8AIAAhACIAIwAkACUAJgAnACgAKQAqACsALAAtAC4ALwAwVk5TUm9vdFYkY2xh +c3NdTlNPYmplY3RzS2V5c18QD05TQ2xhc3Nlc1ZhbHVlc18QGU5TQWNjZXNzaWJpbGl0eU9pZHNWYWx1 +ZXNdTlNDb25uZWN0aW9uc1tOU05hbWVzS2V5c1tOU0ZyYW1ld29ya11OU0NsYXNzZXNLZXlzWk5TT2lk +c0tleXNdTlNOYW1lc1ZhbHVlc18QGU5TQWNjZXNzaWJpbGl0eUNvbm5lY3RvcnNdTlNGb250TWFuYWdl +cl8QEE5TVmlzaWJsZVdpbmRvd3NfEA9OU09iamVjdHNWYWx1ZXNfEBdOU0FjY2Vzc2liaWxpdHlPaWRz +S2V5c1lOU05leHRPaWRcTlNPaWRzVmFsdWVzgAKAjIBUgGyAi4A9gFmABYBrgG2AWoCJgACABoBYgIoQ +KYBu0gAOADIAMwA0W05TQ2xhc3NOYW1lgASAA1xOaWJUZXN0T3duZXLSADcAOAA5ADpYJGNsYXNzZXNa +JGNsYXNzbmFtZaIAOgA7Xk5TQ3VzdG9tT2JqZWN0WE5TT2JqZWN0XxAQSUJDb2NvYUZyYW1ld29ya9IA +DgA+AD8AQFpOUy5vYmplY3RzgDyhAEGAB9oAQwAOAEQARQBGAEcASABJAEoASwBMAE0ATgBPAFAAUQBS +AFMAVAArXE5TV2luZG93Vmlld1xOU1NjcmVlblJlY3RdTlNXaW5kb3dUaXRsZVlOU1dURmxhZ3NdTlNX +aW5kb3dDbGFzc1xOU1dpbmRvd1JlY3RfEA9OU1dpbmRvd0JhY2tpbmdfEBFOU1dpbmRvd1N0eWxlTWFz +a1tOU1ZpZXdDbGFzc4ALgDuAOoAJEiAAAACACoAIEAIQD4AAXxAYe3sxOTYsIDIxM30sIHs0ODEsIDI5 +N319XxASQ2hlY2sgVGl0bGUgQ2hhbmdlWE5TV2luZG931wBaAA4AWwBcAF0AWABeAF8AYABhAGIAYwBf +AGVfEA9OU05leHRSZXNwb25kZXJaTlNTdWJ2aWV3c1hOU3ZGbGFnc1tOU0ZyYW1lU2l6ZVtOU1N1cGVy +dmlld4AMgDmADREBAIA3gAyAONIADgA+AGcAaIA2pgBpAGoAawBsAG0AboAOgBmAHoAigCaAM9oAWgAO +AHAAcQByAFwAcwBYADIAXgBMAHUAdgB3AHgAeQB6AF8AfABMV05TRnJhbWVfEBNOU09yaWdpbmFsQ2xh +c3NOYW1lVk5TQ2VsbFlOU0VuYWJsZWSAC4AYgBGAEIASEQEMCYAMgA+AC18QG015QnV0dG9uVGVzdGlu +Z091dGxldEFjdGlvblhOU0J1dHRvbl8QF3t7MTQ1LCAxNTN9LCB7MjI2LCAzMn193ACCAA4AgwCEAIUA +hgCHAIgAiQCKAIsAjACNAI4AjwCQAJEAjwB8AJQAaQCWAJcAmFtOU0NlbGxGbGFnc18QE05TQWx0ZXJu +YXRlQ29udGVudHNfEBJOU1BlcmlvZGljSW50ZXJ2YWxeTlNCdXR0b25GbGFnczJfEA9OU0tleUVxdWl2 +YWxlbnRaTlNDb250ZW50c1lOU1N1cHBvcnRdTlNDb250cm9sVmlld18QD05TUGVyaW9kaWNEZWxheVxO +U0NlbGxGbGFnczJdTlNCdXR0b25GbGFncxIEAf4AgBeAFhAZEIGAFoAPgBOADhDIEggAAAAT/////4aC +QP/UAA4AmgCbAJwAnQCeAJ8AoFZOU1NpemVWTlNOYW1lWE5TZkZsYWdzgBUjQCoAAAAAAACAFBEEFFxM +dWNpZGFHcmFuZGXSADcAOACjAKSiAKQAO1ZOU0ZvbnRQ0gA3ADgApwCopACoAKkAcgA7XE5TQnV0dG9u +Q2VsbFxOU0FjdGlvbkNlbGzSADcAOACrAKyiAKwAO15OU0NsYXNzU3dhcHBlctgAWgAOAHAAcgBcAHMA +WABeAEwArwCwALEAeQB6AF8ATIALgB2AGoAbCYAMgAtfEBV7ezgzLCA3Nn0sIHsxMzAsIDI1fX3cAIIA +DgCDAIQAhQCGAIcAiACJAIoAiwCMALcAjgCPALoAuwCPAL0AlABqAMAAlwDBE/////+EAf4AgBeAFhBL +EKOAFoAcgBOAGREBkBP/////hoRA/18QEUJ1dHRvbk91dGxldFRlc3Qx0gA3ADgAxAB/pQB/AMUAxgDH +ADtZTlNDb250cm9sVk5TVmlld1tOU1Jlc3BvbmRlctgAWgAOAHAAcgBcAHMAWABeAEwArwDLAMwAeQB6 +AF8ATIALgB2AH4AgCYAMgAtfEBV7ezgzLCA0NX0sIHsxMzAsIDI1fX3cAIIADgCDAIQAhQCGAIcAiACJ +AIoAiwCMAI0AjgCPALoAuwCPANUAlABrAMAAlwDBgBeAFoAWgCGAE4AeXxARQnV0dG9uT3V0bGV0VGVz +dDLYAFoADgBwAHIAXABzAFgAXgBMAK8A3ADdAHkAegBfAEyAC4AdgCOAJAmADIALXxAVe3s4MywgMTR9 +LCB7MTMwLCAyNX193ACCAA4AgwCEAIUAhgCHAIgAiQCKAIsAjACNAI4AjwC6ALsAjwDmAJQAbADAAJcA +wYAXgBaAFoAlgBOAIl8QEUJ1dHRvbk91dGxldFRlc3Qz2ABaAA4AcAByAFwAcwBYAF4ATADsAO0A7gB5 +AHoAXwBMgAuAMoAngCgJgAyAC18QFXt7MzEwLCA3N30sIHs5NiwgMjJ9fdkAggAOAPQAhwCIAIkAiwD1 +APYA9wD4APkAjwCUAG0A/QB6AP9fEBFOU0JhY2tncm91bmRDb2xvcl8QEU5TRHJhd3NCYWNrZ3JvdW5k +W05TVGV4dENvbG9yE/////+Ucf5BgDGAKYAWgBOAJhIQQAQACYAu1QAOAQEBAgEDAQQBBQEGAQcBCAEJ +V05TQ29sb3JcTlNDb2xvclNwYWNlW05TQ29sb3JOYW1lXU5TQ2F0YWxvZ05hbWWALYAsEAaAK4AqVlN5 +c3RlbV8QE3RleHRCYWNrZ3JvdW5kQ29sb3LTAA4BAgENAQUBDwEQV05TV2hpdGWALRADQjEA0gA3ADgB +EgEBogEBADvVAA4BAQECAQMBBAEFARUBBwEWAQmALYAwgC+AKll0ZXh0Q29sb3LTAA4BAgENAQUBDwEb +gC1CMADSADcAOAEdAR6kAR4AqQByADtfEA9OU1RleHRGaWVsZENlbGzSADcAOAEgASGlASEAxQDGAMcA +O1tOU1RleHRGaWVsZNgAWgAOAHAAcgBcAHMAWABeAEwA7AElASYAeQB6AF8ATIALgDKANIA1CYAMgAtf +EBV7ezMxMCwgNDV9LCB7OTYsIDIyfX3ZAIIADgD0AIcAiACJAIsA9QD2APcA+AD5AI8AlABuAP0AegD/ +gDGAKYAWgBOAMwmALtIANwA4ATQBNaMBNQE2ADteTlNNdXRhYmxlQXJyYXlXTlNBcnJheVp7NDgxLCAy +OTd90gA3ADgBOQDGowDGAMcAO18QFnt7MCwgMH0sIHsxOTIwLCAxMTc4fX3SADcAOAE8AT2iAT0AO18Q +EE5TV2luZG93VGVtcGxhdGXSADcAOAE/AUCjAUABQQA7XE5TTXV0YWJsZVNldFVOU1NldNIADgA+AGcB +RIA2qgFFAUYBRwFIAUkBSgFLAUwBTQFOgD6AQYBDgEaASIBKgEyAToBQgFLUAA4BUAFRAVIBUwBpAGsB +Vl1OU0Rlc3RpbmF0aW9uWE5TU291cmNlV05TTGFiZWyAQIAOgB6AP1pteUFjdGlvbjI60gA3ADgBWQFa +owFaAVsAO18QFU5TTmliQ29udHJvbENvbm5lY3Rvcl5OU05pYkNvbm5lY3RvctQADgFQAVEBUgFTAGkA +agFggECADoAZgEJabXlBY3Rpb24xOtQADgFQAVEBUgFjAGsAaQFmgEWAHoAOgERZbXlPdXRsZXQy0gA3 +ADgBaQFqowFqAVsAO18QFE5TTmliT3V0bGV0Q29ubmVjdG9y1AAOAVABUQFSAVMAaQBsAW+AQIAOgCKA +R1pteUFjdGlvbjM61AAOAVABUQFSAWMAbABpAXWARYAigA6ASVlteU91dGxldDPUAA4BUAFRAVIBYwBp +AB8Be4BFgA6AAoBLVmJ1dHRvbtQADgFQAVEBUgFjAG4AHwGBgEWAM4ACgE1WaW5wdXQy1AAOAVABUQFS +AWMAbQAfAYeARYAmgAKAT1ZpbnB1dDHUAA4BUAFRAVIBYwBqAGkBjYBFgBmADoBRWW15T3V0bGV0MdQA +DgFQAVEBUgFjAEEAHwGTgEWAB4ACgFNWd2luZG930gAOAD4BlgGXgFevEA8AzABuAGoBJgDuAZ0AaQBr +AG0AQQBsAEwAeADdALGAIIAzgBmANYAogFWADoAegCaAB4AigAuAEoAkgBvSAA4AMgAzAamABIBWXU5T +QXBwbGljYXRpb27SADcAOAGsATaiATYAO9IADgA+AZYBr4BXrxAPAGsATABMAG4AbQAfAEwATABMAB8A +TABBAGkAbABqgB6AC4ALgDOAJoACgAuAC4ALgAKAC4AHgA6AIoAZ0gAOAD4BlgHBgFevEBAAbgDMAGoA +HwEmAO4BnQBpAGsAbQBBAGwATAB4AN0AsYAzgCCAGYACgDWAKIBVgA6AHoAmgAeAIoALgBKAJIAb0gAO +AD4BlgHUgFevEBAB1QHWAdcB2AHZAdoB2wHcAd0B3gHfAeAB4QHiAeMB5IBbgFyAXYBegF+AYIBhgGKA +Y4BkgGWAZoBngGiAaYBqWlRleHQgRmllbGRfEB9CdXR0b24gQ2VsbCAoQnV0dG9uT3V0bGV0VGVzdDIp +XxApUm91bmQgVGV4dHVyZWQgQnV0dG9uIChCdXR0b25PdXRsZXRUZXN0MSlcRmlsZSdzIE93bmVyXxAP +VGV4dCBGaWVsZCBDZWxsXxARVGV4dCBGaWVsZCBDZWxsLTFbQXBwbGljYXRpb25fED1NeSBCdXR0b24g +VGVzdGluZyBPdXRsZXQgQWN0aW9uIChNeUJ1dHRvblRlc3RpbmdPdXRsZXRBY3Rpb24pXxApUm91bmQg +VGV4dHVyZWQgQnV0dG9uIChCdXR0b25PdXRsZXRUZXN0MilcVGV4dCBGaWVsZC0xXxAbV2luZG93IChD +aGVjayBUaXRsZSBDaGFuZ2UpXxApUm91bmQgVGV4dHVyZWQgQnV0dG9uIChCdXR0b25PdXRsZXRUZXN0 +MylcQ29udGVudCBWaWV3XxApQnV0dG9uIENlbGwgKE15QnV0dG9uVGVzdGluZ091dGxldEFjdGlvbilf +EB9CdXR0b24gQ2VsbCAoQnV0dG9uT3V0bGV0VGVzdDMpXxAfQnV0dG9uIENlbGwgKEJ1dHRvbk91dGxl +dFRlc3QxKdIADgA+AZYB94BXoQBpgA7SAA4APgGWAfuAV6EAfIAP0gAOAD4BlgH/gFevEBoBSgDMAUsB +RgBBAG0BSAFMAU0BSQDdAUUAbgFOAGoAHwEmAO4BnQBpAGsAbABMAHgBRwCxgEqAIIBMgEGAB4AmgEaA +ToBQgEiAJIA+gDOAUoAZgAKANYAogFWADoAegCKAC4ASgEOAG9IADgA+AZYCHIBXrxAaAh0CHgIfAiAC +IQIiAiMCJAIlAiYCJwIoAikCKgIrAiwCLQIuAi8CMAIxAjICMwI0AjUCNoBvgHCAcYBygHOAdIB1gHaA +d4B4gHmAeoB7gHyAfYB+gH+AgICBgIKAg4CEgIWAhoCHgIgQHhAQECcQHxABECIQIRAmEBMQFRASECAQ +JBAdEAkQKBAlECMT//////////0QBRAREBQQCtIADgA+AGcCUIA2oNIADgA+AZYCU4BXoNIADgA+AZYC +VoBXoNIANwA4AlgCWaICWQA7Xk5TSUJPYmplY3REYXRhAAgAGQAiACcAMQA6AD8ARABSAFQAZgGDAYkB +1AHbAeIB8AICAh4CLAI4AkQCUgJdAmsChwKVAqgCugLUAt4C6wLtAu8C8QLzAvUC9wL5AvsC/QL/AwED +AwMFAwcDCQMLAw0DDwMYAyQDJgMoAzUDPgNHA1IDVwNmA28DggOLA5YDmAObA50DxgPTA+AD7gP4BAYE +EwQlBDkERQRHBEkESwRNBFIEVARWBFgEWgRcBHcEjASVBLIExATPBNgE5ATwBPIE9AT2BPkE+wT9BP8F +CAUKBRcFGQUbBR0FHwUhBSMFTAVUBWoFcQV7BX0FfwWBBYMFhQWIBYkFiwWNBY8FrQW2BdAGAQYNBiMG +OAZHBlkGZAZuBnwGjgabBqkGrgawBrIGtAa2BrgGuga8Br4GwAbFBs4G3wbmBu0G9gb4BwEHAwcGBxMH +HAchBygHKQcyBzsHSAdVB14HYwdyB5MHlQeXB5kHmwecB54HoAe4B+kH8gf0B/YH+Af6B/wH/ggACAII +BQgOCCIIKwg2CEAIRwhTCHQIdgh4CHoIfAh9CH8IgQiZCMoIzAjOCNAI0gjUCNYI6gkLCQ0JDwkRCRMJ +FAkWCRgJMAlhCWMJZQlnCWkJawltCYEJogmkCaYJqAmqCasJrQmvCccJ7AoAChQKIAopCisKLQovCjEK +Mwo4CjkKOwpQClgKZQpxCn8KgQqDCoUKhwqJCpAKpgqzCrsKvQq/CsIKywrQCuUK5wrpCusK7Qr3CwQL +BgsJCxILGwstCzYLQQtNC24LcAtyC3QLdgt3C3kLewuTC7gLugu8C74LwAvCC8MLxQvOC9UL5AvsC/cM +AAwHDCAMKQwuDEEMSgxRDF4MZAxtDG8MhAyGDIgMigyMDI4MkAySDJQMlgyYDKkMtwzADMgMygzMDM4M +0AzbDOQM6w0DDRINIw0lDScNKQ0rDTYNRw1JDUsNTQ1PDVkNYg1pDYANkQ2TDZUNlw2ZDaQNtQ23DbkN +uw29DccN2A3aDdwN3g3gDecN+A36DfwN/g4ADgcOGA4aDhwOHg4gDicOOA46DjwOPg5ADkoOWw5dDl8O +YQ5jDmoOcw51DpYOmA6aDpwOng6gDqIOpA6mDqgOqg6sDq4OsA6yDrQOvQ6/DsEOzw7YDt0O5g7oDwkP +Cw8NDw8PEQ8TDxUPFw8ZDxsPHQ8fDyEPIw8lDycPMA8yD1UPVw9ZD1sPXQ9fD2EPYw9lD2cPaQ9rD20P +bw9xD3MPdQ9+D4APow+lD6cPqQ+rD60Prw+xD7MPtQ+3D7kPuw+9D78PwQ/DD84P8BAcECkQOxBPEFsQ +mxDHENQQ8hEeESsRVxF5EZsRpBGmEakRqxG0EbYRuRG7EcQRxhH9Ef8SARIDEgUSBxIJEgsSDRIPEhES +ExIVEhcSGRIbEh0SHxIhEiMSJRInEikSKxItEi8SMRI6EjwScxJ1EncSeRJ7En0SfxKBEoMShRKHEokS +ixKNEo8SkRKTEpUSlxKZEpsSnRKfEqESoxKlEqcSqRKrEq0SrxKxErMStRK3ErkSuxK9Er8SwRLDEsUS +xxLJEssS1BLWEtgS2hLcEuUS5xLoEvES8xL0Ev0S/xMAEwkTDgAAAAAAAAICAAAAAAAAAloAAAAAAAAA +AAAAAAAAABMdA + + + diff --git a/jscocoa/Tests/Resources/standalone window.nib/keyedobjects.nib b/jscocoa/Tests/Resources/standalone window.nib/keyedobjects.nib new file mode 100644 index 0000000..1e16a79 Binary files /dev/null and b/jscocoa/Tests/Resources/standalone window.nib/keyedobjects.nib differ diff --git a/jscocoa/Tests/old/5 retain count.js b/jscocoa/Tests/old/5 retain count.js new file mode 100644 index 0000000..a232fb5 --- /dev/null +++ b/jscocoa/Tests/old/5 retain count.js @@ -0,0 +1,100 @@ + + + /* + Test object deallocation + */ + + +/* + var deallocatedMyTestObject = false + function myDealloc() + { +// JSCocoaController.log('>>>>autoReleasedObject=' + this + ' count=' + this.retainCount()) + JSCocoaController.log('>>>>MyTestObject=' + this + ' DEALLOC') + deallocatedMyTestObject = true + return this.Super(arguments) + } + + // Deriving from CALayer crashes weirdly when using DerivedClassFromCALayer.alloc.init + var newClass = JSCocoaController.sharedController().createClass_parentClass("MyTestObject", "CALayer") + // Ok +// var newClass = JSCocoaController.sharedController().createClass_parentClass("MyTestObject", "NSObject") + // Check ... OK ! +// var newClass = JSCocoaController.sharedController().createClass_parentClass("MyTestObject", "NSResponder") + + +// var added = JSCocoaController.sharedController().overloadInstanceMethod_class_jsFunction('retain', objc_getClass("MyTestObject"), myRetain) +// var added = JSCocoaController.sharedController().overloadInstanceMethod_class_jsFunction('release', objc_getClass("MyTestObject"), myRelease) + +// var autoReleasedObject = MyTestObject.layer() +// var autoReleasedObject = MyTestObject.alloc.init +// var autoReleasedObject = CALayer.alloc.init +// var autoReleasedObject = SomeKindOfObject.alloc.init +// autoReleasedObject.release +// SomeKindOfObject +// autoReleasedObject.release + +// var added = JSCocoaController.sharedController().overloadInstanceMethod_class_jsFunction('dealloc', objc_getClass("CALayer"), myDealloc) + var added = JSCocoaController.sharedController().overloadInstanceMethod_class_jsFunction('dealloc', objc_getClass("MyTestObject"), myDealloc) + +//var autoReleasedObject = CALayer.alloc.init +var autoReleasedObject = MyTestObject.layer + + JSCocoaController.log('>>>>>>>>>>someKindOfObjectAllocCount=' + ApplicationController.someKindOfObjectAllocCount + ' last=' + autoReleasedObject) +// autoReleasedObject.release + + + + +*/ + + + + +// JSCocoaController.log('autoReleasedObject=' + autoReleasedObject + ' count=' + autoReleasedObject.retainCount()) +// autoReleasedObject.release +/* + + function performSelectorTarget(notif) + { + JSCocoaController.log('about to release autoReleasedObject=' + autoReleasedObject + ' count=' + autoReleasedObject.retainCount()) + autoReleasedObject = null + // This will dealloc object in a next run loop run ... + JSCocoaController.garbageCollect() + + JSCocoaController.log('passed GC') + +// if (!deallocatedMyTestObject) JSCocoaController.logAndSay('retainCount - object was not deallocated') + // ... so set a timer to be there and check it then. + o.performSelector_withObject_afterDelay('callMe2:', null, 0.1) + + JSCocoaController.log('someKindOfObjectAllocCount***********=' + ApplicationController.someKindOfObjectAllocCount) + } + + function performSelectorTarget2(notif) + { + if (!deallocatedMyTestObject) JSCocoaController.logAndSay('retainCount - object was not deallocated') + } + + function objc_encoding() + { + var encodings = { 'void' : 'v' + ,'id' : '@' + } + var encoding = encodings[arguments[0]] + encoding += '@:' + + for (var i=1; i>>>autoReleasedObject=' + this + ' count=' + this.retainCount()) + JSCocoaController.log('>>>>MyTestObject=' + this + ' DEALLOC') + deallocatedMyTestObject = true + return this.Super(arguments) + } + function myRetain() + { + JSCocoaController.log('MyTestObject =>retain ' + this.retainCount()) + var r = this.Super(arguments); + JSCocoaController.log('MyTestObject =>retain ' + this.retainCount()) + return r + } + function myRelease() + { + JSCocoaController.log('MyTestObject RELEASE ' + this.retainCount()) + var r = this.Super(arguments); +// JSCocoaController.log('MyTestObject RELEASE ' + this.retainCount()) + return r + } + var newClass = JSCocoaController.sharedController().createClass_parentClass("MyTestObject", "CALayer") + var added = JSCocoaController.sharedController().overloadInstanceMethod_class_jsFunction('dealloc', objc_getClass("MyTestObject"), myDealloc) +// var added = JSCocoaController.sharedController().overloadInstanceMethod_class_jsFunction('retain', objc_getClass("MyTestObject"), myRetain) +// var added = JSCocoaController.sharedController().overloadInstanceMethod_class_jsFunction('release', objc_getClass("MyTestObject"), myRelease) + + var autoReleasedObject = MyTestObject.layer() + + JSCocoaController.log('autoReleasedObject=' + autoReleasedObject + ' count=' + autoReleasedObject.retainCount()) + + + function performSelectorTarget(notif) + { + JSCocoaController.log('about to release autoReleasedObject=' + autoReleasedObject + ' count=' + autoReleasedObject.retainCount()) + autoReleasedObject = null + // This will dealloc object in a next run loop run ... + JSCocoaController.garbageCollect() + JSCocoaController.garbageCollect() + JSCocoaController.garbageCollect() + JSCocoaController.garbageCollect() + JSCocoaController.garbageCollect() + +// if (!deallocatedMyTestObject) JSCocoaController.logAndSay('retainCount - object was not deallocated') + // ... so set a timer to be there and check it then. + o.performSelector_withObject_afterDelay('callMe2:', null, 0.1) + } + + function performSelectorTarget2(notif) + { + if (!deallocatedMyTestObject) JSCocoaController.logAndSay('retainCount - object was not deallocated') + } + + function objc_encoding() + { + var encodings = { 'void' : 'v' + ,'id' : '@' + } + var encoding = encodings[arguments[0]] + encoding += '@:' + + for (var i=1; i +#import "JSCocoa.h" + + +@interface ApplicationController : NSObject { + + IBOutlet id webViewUsedAsContextSource; + IBOutlet id window; + IBOutlet id textField; + + JSCocoa* jsc2; + id topObjects; + + NSError* testNSError; + + BOOL runningContinuously; + // If we cycle context each time, we can test bindings each time. + BOOL cyclingContext; + +} +- (void)applicationDidFinishLaunching:(NSNotification *)notification; +- (void)applicationWillTerminate:(NSNotification *)notification; + +- (IBAction)runJSTests:(id)sender; +- (IBAction)runJSTestsContinuously:(id)sender; +- (IBAction)stopContinuousJSTestsRun:(id)sender; +- (IBAction)garbageCollect:(id)sender; +- (IBAction)logInstanceStats:(id)sender; +- (IBAction)logBoxedObjects:(id)sender; +- (void)log:(NSString*)message; + +- (IBAction)runSimpleTestFile:(id)sender; +- (IBAction)unlinkAllReferences:(id)sender; + +- (id)testDelegate; +- (int)dummyValue; +- (id)testCallAPI; + +- (NSError*)testNSError; + +- (void)disposeClass:(NSString*)className; +- (void)disposeShadowBindingsClasses; + +- (void)dumpEncodings; + +@end + +@interface NSErrorTest : NSObject +- (BOOL)someMethodReturningAnError:(NSError**)error; +@end \ No newline at end of file diff --git a/jscocoa/TestsRunner/ApplicationController.m b/jscocoa/TestsRunner/ApplicationController.m new file mode 100644 index 0000000..eb79282 --- /dev/null +++ b/jscocoa/TestsRunner/ApplicationController.m @@ -0,0 +1,1006 @@ +// +// ApplicationController.m +// TestsRunner +// +// Created by Patrick Geiller on 17/10/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "ApplicationController.h" +#import "JSCocoa.h" +#import + +@implementation ApplicationController + +JSCocoaController* jsc = nil; + +//- (void)awakeFromNib +- (void)applicationDidFinishLaunching:(NSNotification *)notification +{ + [JSCocoaController hazardReport]; + + jsc = nil; +// jsc = [JSCocoa new]; +// [jsc evalJSFile:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"js"]]; + + [[NSApplication sharedApplication] setDelegate:self]; + [self performSelector:@selector(runJSTests:) withObject:nil afterDelay:0]; + + testNSError = nil; + +// NSLog(@"sizeof(int)=%d", sizeof(int)); +// NSLog(@"sizeof(long)=%d", sizeof(long)); +// NSLog(@"sizeof(CGFloat)=%d", sizeof(CGFloat)); + NSLog(@"*** Running %@ ***", [JSCocoa runningArchitecture]); + + cyclingContext = NO; +/* + id error = nil; + id url = [NSURL fileURLWithPath:@"/non/existent"]; + BOOL b = [@"hello" writeToURL:url atomically:NO encoding:NSUTF8StringEncoding error:&error]; + NSLog(@"++++++++ %d %@", b, error); +*/ +// [self dumpEncodings]; +} + +- (void)applicationWillTerminate:(NSNotification *)notification +{ + if (testNSError) [testNSError release]; + + [self disposeShadowBindingsClasses]; + + // Retain count is 2 because a variable named __jsc__ holds the ObjC object in the Javascript context + if ([jsc retainCount] == 2) NSLog(@"willTerminate %@ JSCocoa retainCount=%d (OK)", jsc, [jsc retainCount]); + else NSLog(@"willTerminate %@ JSCocoa retainCount=%d", jsc, [jsc retainCount]); + + // Check if JSCocoa can be released (retainCount got down to 1) + // Won't work under ObjC GC +#ifndef __OBJC_GC__ + // Must be 2 with new release method + if ([jsc retainCount] != 2) NSLog(@"***Invalid JSCocoa retainCount***"); +#endif + [jsc release]; + + id path = [NSString stringWithFormat:@"%@/Contents/Resources/Tests/! stock", [[NSBundle mainBundle] bundlePath]]; + id files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; + if ([files count]) NSLog(@"***warning, skipping tests in ./!stock***"), NSLog(@"%@", files); +#ifdef __OBJC_GC__ + if (![[NSGarbageCollector defaultCollector] isEnabled]) NSLog(@"***GC running but disabled***"); +#endif +} + +- (void)cycleContext +{ + cyclingContext = YES; + [self disposeShadowBindingsClasses]; + [jsc release]; + jsc = [JSCocoa new]; + [jsc evalJSFile:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"js"]]; +} + + +// +// Run unit tests + delegate tests +// +int runCount = 0; + +- (IBAction)runJSTests:(id)sender +{ + [self cycleContext]; + + [textField setStringValue:@"Running Tests ..."]; + + // Clean up notifications registered by previously run tests + [jsc callJSFunctionNamed:@"resetDelayedTests" withArguments:nil]; + + // + // Run js tests + // + runCount++; + jsc.delegate = nil; + id path = [[NSBundle mainBundle] bundlePath]; + path = [NSString stringWithFormat:@"%@/Contents/Resources/Tests", path]; +// NSLog(@"Run %d from %@", runCount, path); + int testCount = [jsc runTests:path]; + BOOL b = !!testCount; + [self garbageCollect:nil]; + + // + // Test delegate + // + id error = nil; + error = [self testDelegate]; + if (error) + { + b = NO; + path = error; + } + jsc.delegate = nil; + + // + // Test api + // + [self testCallAPI]; + + + // + // Test JSCocoa inited from a WebView + // + id webViewClass = objc_getClass("WebView"); + // Manually load WebKit if it's not yet loaded + if (!webViewClass) + { + [jsc loadFrameworkWithName:@"WebKit"]; + webViewClass = objc_getClass("WebView"); + } + if (webViewClass && 1) + { +// NSLog(@"Testing initing from a WebView"); + // Load nib + id nibPath = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] bundlePath], @"/Contents/Resources/Tests/Resources/inited from WebView.nib"]; + id nibURL = [NSURL fileURLWithPath:nibPath]; + id webViewNib = [[NSNib alloc] initWithContentsOfURL:nibURL]; + + // Instantiate nib with ourselves as owner + topObjects = nil; + [webViewNib instantiateNibWithOwner:self topLevelObjects:&topObjects]; + [webViewNib release]; + [topObjects retain]; + [webViewUsedAsContextSource setFrameLoadDelegate:self]; + + id pageURL = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"/Tests/Resources/37 inited from webview.html"]; + [webViewUsedAsContextSource setMainFrameURL:pageURL]; + + // Init JSCocoa from WebView's globalContext + JSGlobalContextRef ctx = [[webViewUsedAsContextSource mainFrame] globalContext]; +// NSLog(@"WebView contextGroup=%x context=%x", JSContextGetGroup(ctx), ctx); + jsc2 = [[JSCocoa alloc] initWithGlobalContext:ctx]; + } + else + { + NSLog(@"WebKit not loaded - cannot test JSCocoa inited from a WebView"); + } + + + if (!b) + { + id str = [NSString stringWithFormat:@"FAILED %@", path]; + [textField setStringValue:str]; + NSLog(@"!!!!!!!!!!!FAIL runCount %d in %@", runCount, path); + return; + } + else + { + int delayedTestCount = [jsc toInt:[jsc callJSFunctionNamed:@"delayedTestCount" withArguments:nil]]; + + if (delayedTestCount) + { + id str = [NSString stringWithFormat:@"All %d tests ran OK, %d delayed pending", testCount, delayedTestCount]; + NSLog(@"%@", str); + [textField setStringValue:str]; + } + else + { + id str = [NSString stringWithFormat:@"All %d tests ran OK !", testCount]; + NSLog(@"%@", str); + [textField setStringValue:str]; + } + } + + // + // Test autocall-less ObjJ + // + b = [jsc useAutoCall]; + [jsc setUseAutoCall:NO]; + + id str = [jsc toString:[jsc evalJSString:@"[JSCocoa runningArchitecture]"]]; + [jsc setUseAutoCall:b]; + [jsc setUseJSLint:YES]; + if (![str isEqualToString:[JSCocoa runningArchitecture]]) NSLog(@"!!!!!!!!!!ObjJ syntax with autocall disabled failed"); + +/* + id class = objc_getClass([@"ファイナンス" UTF8String]); + id o = [class new]; + NSLog(@"japanese class=%@", class); + NSLog(@"japanese instance=%@", o); + NSLog(@"japanese selector=%s", NSSelectorFromString(@"だけを追加する:")); + +// id r = [o performSelector:NSSelectorFromString(@"だけを追加する:") withObject:[NSNumber numberWithInt:7]]; + id r = [o performSelector:[@"だけを追加する:" UTF8String] withObject:[NSNumber numberWithInt:7]]; + NSLog(@"r=%@", r); +*/ +} + + +- (IBAction)_runJSTestsContinuously:(id)sender +{ + [self runJSTests:nil]; + if (runningContinuously) [self performSelector:@selector(_runJSTestsContinuously:) withObject:nil afterDelay: 0.1]; +} + +- (IBAction)runJSTestsContinuously:(id)sender +{ + runningContinuously = YES; + [self performSelector:@selector(_runJSTestsContinuously:) withObject:nil afterDelay: 0.1]; +} +- (IBAction)stopContinuousJSTestsRun:(id)sender +{ + runningContinuously = NO; +} + + +// +// GC +// +- (IBAction)garbageCollect:(id)sender +{ + [jsc garbageCollect]; +} + +- (IBAction)logInstanceStats:(id)sender +{ + [JSCocoa logInstanceStats]; +} + +- (IBAction)logBoxedObjects:(id)sender +{ + [JSCocoa logBoxedObjects]; +} + +- (void)log:(NSString*)message +{ + NSLog(@"%@", message); +} + + +- (IBAction)runSimpleTestFile:(id)sender +{ + id js = @"2+2"; + js = @"NSWorkspace.sharedWorkspace.activeApplication"; + + js = @"var a = NSMakePoint(2, 3)"; + [JSCocoaController garbageCollect]; + JSValueRef ret = [jsc evalJSString:js]; + [JSCocoaController garbageCollect]; + + JSStringRef resultStringJS = JSValueToStringCopy([jsc ctx], ret, NULL); + NSString* r = (NSString*)JSStringCopyCFString(kCFAllocatorDefault, resultStringJS); + JSStringRelease(resultStringJS); + + NSLog(@"res=%@", r); + [r release]; +} + +- (IBAction)unlinkAllReferences:(id)sender +{ +// [JSCocoa logInstanceStats]; +// [[JSCocoaController sharedController] unlinkAllReferences]; + [jsc unlinkAllReferences]; +// [self garbageCollect:nil]; +// [JSCocoa logInstanceStats]; +} + + + +// +// Delegate testing +// +BOOL hadError; + +BOOL canGet, canSet, didSet, canGetGlobal, canLoad, canEval; +id object; +id propertyName; +BOOL equalsButtonCell, equalsBezelStyle; +id functionName; +id methodName; +BOOL canCallC, canCallObjC; +id pathtoJSFile; +id customScript; +id scriptToEval; +//id o; +id unboxedValueTest; + + +JSValueRef customValueGet, customValueSet, customValueCall, jsValue, ret, willReturn, customValueReturn, customValueGetGlobal; + +- (id)testDelegate +{ + jsc.delegate = self; + + hadError = NO; + canCallC = YES; + canCallObjC = YES; + canSet = YES; + canGet = YES; + didSet = YES; + canGetGlobal= YES; + canLoad = YES; + canEval = YES; + customValueGet = NULL; + customValueSet = NULL; + customValueCall = NULL; + customValueReturn = NULL; + customValueGetGlobal= NULL; + + // Test delegate without JSLint. If not, delegate get test will choke on lint(source.split('\n')) + BOOL useJSLint = jsc.useJSLint; + jsc.useJSLint = NO; + + // Add ourselves in the JS context + [jsc evalJSString:@"var applicationController = NSApplication.sharedApplication.delegate"]; + + // + // Test disallowed getting + // + canGet = NO; + hadError = NO; + ret = [jsc evalJSString:@"NSWorkspace.sharedWorkspace"]; + if (!hadError) return @"delegate canGetProperty failed (1)"; + + // + // Test allowed getting + // + canGet = YES; + ret = [jsc evalJSString:@"NSWorkspace.sharedWorkspace"]; + if (!ret) return @"delegate canGetProperty failed (2)"; + if (object != [NSWorkspace class]) return @"delegate canGetProperty failed (3)"; + if (![propertyName isEqualToString:@"sharedWorkspace"]) return @"delegate canGetProperty failed (4)"; + + // + // Test getting + // + customValueGet = NULL; + ret = [jsc evalJSString:@"NSWorkspace.sharedWorkspace"]; + if (object != [NSWorkspace class]) return @"delegate getProperty failed (1)"; + if (![propertyName isEqualToString:@"sharedWorkspace"]) return @"delegate getProperty failed (2)"; + + unboxedValueTest = [jsc unboxJSValueRef:ret]; + if (unboxedValueTest != [NSWorkspace sharedWorkspace]) return @"delegate getProperty failed (3)"; + + +#define JSRESULTNUMBER (int)JSValueToNumber([jsc ctx], ret?ret:JSValueMakeUndefined([jsc ctx]), NULL) + + // + // Test custom getting + // + customValueGet = JSValueMakeNumber([jsc ctx], 123); + ret = [jsc evalJSString:@"NSWorkspace.sharedWorkspace"]; + if (object != [NSWorkspace class]) return @"delegate getProperty failed (4)"; + if (![propertyName isEqualToString:@"sharedWorkspace"]) return @"delegate getProperty failed (5)"; + if (JSRESULTNUMBER != 123) return @"delegate getProperty failed (6)"; + customValueGet = NULL; + + + + // + // Test disallowed setting + // + canSet = NO; + hadError = NO; + didSet = NO; + ret = [jsc evalJSString:@"var o = NSButtonCell.instance; o.bezelStyle = 0; o = null"]; + if (!hadError) return @"delegate canSetProperty failed (1)"; + + // + // Test allowed setting + // + canSet = YES; + ret = [jsc evalJSString:@"var o = NSButtonCell.instance; o.bezelStyle = 0; o.bezelStyle = 3; var r = o.bezelStyle; o = null; r"]; + if (!equalsButtonCell) return @"delegate canSetProperty failed (2)"; + if (!equalsBezelStyle) return @"delegate canSetProperty failed (3)"; + + // + // Test setting + // + customValueSet = NULL; + ret = [jsc evalJSString:@"var o = NSButtonCell.instance; o.bezelStyle = 0; o.bezelStyle = 3; var r = o.bezelStyle; o = null; r"]; + int bezelStyle = JSRESULTNUMBER; + if (bezelStyle != 3) return @"delegate setProperty failed (1)"; + + + // + // Test custom setting + // + didSet = YES; + ret = [jsc evalJSString:@"var o = NSButtonCell.instance; o.bezelStyle = 0; o.bezelStyle = 3; var r = o.bezelStyle; o = null; r"]; + bezelStyle = JSRESULTNUMBER; +// NSLog(@"bezelStyle=%d", bezelStyle); + if (bezelStyle != 6) return @"delegate setProperty failed (2)"; + + + // + // Test disallowed function + // + hadError = NO; + canCallC = NO; + ret = [jsc evalJSString:@"var p = NSMakePoint(1, 2); p.x+p.y"]; + if (!hadError) return @"delegate canCallC failed (1)"; + + canCallC = YES; + ret = [jsc evalJSString:@"var p = NSMakePoint(15, 100); p.x+p.y"]; + int addResult = JSRESULTNUMBER; + if (addResult != 115) return @"delegate canCallC failed (2)"; + + + + + // + // Test disallowed calling + // + hadError = NO; + canCallObjC = NO; + canSet = YES; + canGet = YES; + didSet = NO; + ret = [jsc evalJSString:@"applicationController.add1(5)"]; + if (!hadError) return @"delegate canCallMethod failed (1)"; + + hadError = NO; + ret = [jsc evalJSString:@"applicationController.get5"]; + if (!hadError) return @"delegate canCallMethod failed (2)"; + + hadError = NO; + ret = [jsc evalJSString:@"applicationController.dummyValue = 8"]; + if (!hadError) return @"delegate canCallMethod failed (3)"; + + // + // Test allowed calling + // + hadError = NO; + canCallObjC = YES; + customValueCall = NULL; + ret = [jsc evalJSString:@"applicationController.add1(5)"]; + + int add1Result1 = JSRESULTNUMBER; + if (add1Result1 != 6) return @"delegate callMethod failed (1)"; + if (object != self) return @"delegate callMethod failed (2)"; + if (![methodName isEqualToString:@"add1:"]) return @"delegate callMethod failed (3)"; + + ret = [jsc evalJSString:@"applicationController.get5"]; + int get5Result1 = JSRESULTNUMBER; + if (get5Result1 != 5) return @"delegate callMethod failed (4)"; + if (object != self) return @"delegate callMethod failed (5)"; + if (![methodName isEqualToString:@"get5"]) return @"delegate callMethod failed (6)"; + + ret = [jsc evalJSString:@"applicationController.dummyValue = 8"]; + if ([self dummyValue] != 8) return @"delegate callMethod failed (7)"; + if (object != self) return @"delegate callMethod failed (8)"; + if (![methodName isEqualToString:@"setDummyValue:"])return @"delegate callMethod failed (9)"; + + // + // Test custom calling + // + hadError = NO; + customValueCall = JSValueMakeNumber([jsc ctx], 789); + ret = [jsc evalJSString:@"applicationController.add1(5)"]; + int add1Result2 = JSRESULTNUMBER; + if (add1Result2 != 789) return @"delegate callMethod failed (10)"; + + ret = [jsc evalJSString:@"applicationController.get5"]; + int get5Result2 = JSRESULTNUMBER; + if (get5Result2 != 789) return @"delegate callMethod failed (11)"; + customValueCall = NULL; + + + // + // Test disallowed global getting + // + canCallObjC = YES; + canCallC = YES; + canGet = YES; + canSet = YES; + canGetGlobal= NO; + ret = [jsc evalJSString:@"NSWorkspace"]; +// NSLog(@"ret=%x %x", ret, JSValueIsNull([jsc ctx], ret)); + if (ret) return @"delegate canGetGlobalProperty failed (1)"; + + // + // Test allowed global getting + // + canGetGlobal= YES; + ret = [jsc evalJSString:@"NSWorkspace"]; + if (![propertyName isEqualToString:@"NSWorkspace"]) return @"delegate canGetGlobalProperty failed (3)"; + + + // + // Test global getting + // + customValueGetGlobal = NULL; + ret = [jsc evalJSString:@"NSWorkspace"]; + if (![propertyName isEqualToString:@"NSWorkspace"]) return @"delegate getGlobalProperty failed (1)"; + + unboxedValueTest = [jsc unboxJSValueRef:ret]; + if (unboxedValueTest != [NSWorkspace class]) return @"delegate getGlobalProperty failed (2)"; + + // + // Test custom global getting + // + customValueGetGlobal = JSValueMakeNumber([jsc ctx], 7599); + ret = [jsc evalJSString:@"NSWorkspace"]; + if (![propertyName isEqualToString:@"NSWorkspace"]) return @"delegate getGlobalProperty failed (3)"; + if (JSRESULTNUMBER != 7599) return @"delegate getGlobalProperty failed (4)"; + customValueGetGlobal = NULL; + + canGetGlobal= YES; + + // + // Test script loading + // + id path = [NSString stringWithFormat:@"%@/Contents/Resources/Tests/0 blank.js", [[NSBundle mainBundle] bundlePath]]; +// NSLog(@"path=%@", path); + + canLoad = NO; + BOOL evaled = [jsc evalJSFile:path]; + if (evaled) return @"delegate canLoad failed (1)"; + if (![pathtoJSFile isEqualToString:path]) return @"delegate canLoad failed (2)"; + + canLoad = YES; + evaled = [jsc evalJSFile:path]; + if (!evaled) return @"delegate canLoad failed (3)"; + if (![pathtoJSFile isEqualToString:path]) return @"delegate canLoad failed (4)"; + + + + // + // Test disallowed script evaling + // + canEval = NO; + evaled = [jsc evalJSFile:path]; + if (evaled) return @"delegate canEval failed (1)"; + + evaled = !![jsc evalJSString:@"2+2"]; + if (evaled) return @"delegate canEval failed (2)"; + + + // + // Test allowed script evaling + // + canEval = YES; + evaled = [jsc evalJSFile:path]; + if (!evaled) return @"delegate canEval failed (3)"; + + evaled = !![jsc evalJSString:@"2+2"]; + if (!evaled) return @"delegate canEval failed (4)"; + + // + // Test custom script evaling + // + customScript = @"100+12"; + evaled = [jsc evalJSFile:path toJSValueRef:&ret]; + if (!evaled) return @"delegate custom eval failed (1)"; + if (JSRESULTNUMBER != 112) return @"delegate custom eval failed (2)"; + + ret = [jsc evalJSString:@"2+2"]; + if (JSRESULTNUMBER != 112) return @"delegate custom eval failed (3)"; + if (![scriptToEval isEqualToString:@"2+2"]) return @"delegate custom eval failed (4)"; + customScript = nil; + + jsc.useJSLint = useJSLint; + + return nil; +} + +- (id)testCallAPI +{ +/* + // This works but is tested only with NSLog + + id jscocoa = jsc; + id str; + str = @"2+2"; + NSLog(@"str=%@", [jscocoa eval:str]); + str = @"2+'hello'"; + NSLog(@"str=%@", [jscocoa eval:str]); + + str = @"function hello(a, b) { return a + b } hello('bonjour', 'monde')"; + NSLog(@"str=%@", [jscocoa eval:str]); + str = @"function dummyReturn() { return 'dummy!' }"; + NSLog(@"str=%@", [jscocoa eval:str]); + + str = @"dummyReturn"; + NSLog(@"call(%@)=%@", str, [jscocoa callFunction:str]); + + str = @"hello"; + NSLog(@"call(%@)=%@", str, [jscocoa callFunction:str withArguments:[NSArray arrayWithObjects:[NSNumber numberWithInt:100], [NSNumber numberWithInt:113], nil]]); + str = @"hello"; + NSLog(@"call(%@)=%@", str, [jscocoa callFunction:str withArguments:[NSArray arrayWithObjects:[NSNumber numberWithFloat:1.23], [NSNumber numberWithFloat:4.56], nil]]); + + + str = @"hello"; + NSLog(@"hasFunction(%@)=%d", str, [jscocoa hasFunction:str]); + str = @"hello23"; + NSLog(@"hasFunction(%@)=%d", str, [jscocoa hasFunction:str]); + + str = @"function returnArray() { return [1, 2, [3], 'hello', [4, [5], [6, [7, 8]], 9]] }"; + [jscocoa eval:str]; + str = @"returnArray"; + NSLog(@"call(%@)=%@", str, [jscocoa callFunction:str]); + + str = @"function returnHash() { return { hello : 'world', array : [1, [2], {a:'b'}, 'z'], last : 'YES' } }"; + [jscocoa eval:str]; + str = @"returnHash"; + NSLog(@"call(%@)=%@", str, [jscocoa callFunction:str]); +*/ + return nil; +} + +- (int)add1:(int)a +{ + return a+1; +} + +int dummyValue; +- (void)setDummyValue:(int)value +{ + dummyValue = value; +} +- (int)dummyValue +{ + return dummyValue; +} +- (int)get5 +{ + return 5; +} + +// +// +#pragma mark Delegate test +// +// +- (void) JSCocoa:(JSCocoaController*)controller hadError:(NSString*)error onLineNumber:(NSInteger)lineNumber atSourceURL:(id)url +{ +// NSLog(@"delegate exception handler : %@", error); + hadError = YES; +} + + +- (BOOL) JSCocoa:(JSCocoaController*)controller canGetProperty:(NSString*)_propertyName ofObject:(id)_object inContext:(JSContextRef)ctx exception:(JSValueRef*)exception +{ +// NSLog(@"delegate canGet %@(%@).%@ canGet=%d", _object, [_object class], _propertyName, canGet); + object = _object; + propertyName = _propertyName; + return canGet; +} +- (JSValueRef) JSCocoa:(JSCocoaController*)controller getProperty:(NSString*)_propertyName ofObject:(id)_object inContext:(JSContextRef)ctx exception:(JSValueRef*)exception +{ +// NSLog(@"delegate get %@(%@).%@ customValueGet=%x", _object, [_object class], _propertyName, customValueGet); + object = _object; + propertyName = _propertyName; + return customValueGet; +} + +- (BOOL) JSCocoa:(JSCocoaController*)controller canSetProperty:(NSString*)_propertyName ofObject:(id)_object toValue:(JSValueRef)_jsValue inContext:(JSContextRef)ctx exception:(JSValueRef*)exception +{ +// NSLog(@"delegate canSet %@(%@).%@", _object, [_object class], _propertyName); + object = _object; + propertyName = _propertyName; + jsValue = _jsValue; + + // Test here. Delaying after evalJSString returned could mean GC was triggered and we'd have invalid data. + equalsButtonCell = [_object class] == [NSButtonCell class]; + equalsBezelStyle = [_propertyName isEqualToString:@"bezelStyle"]; + return canSet; +} +- (BOOL) JSCocoa:(JSCocoaController*)controller setProperty:(NSString*)_propertyName ofObject:(id)_object toValue:(JSValueRef)_jsValue inContext:(JSContextRef)ctx exception:(JSValueRef*)exception +{ +// NSLog(@"delegate set"); + object = _object; + propertyName = _propertyName; + jsValue = _jsValue; + + // Test here. Delaying after evalJSString returned could mean GC was triggered and we'd have invalid data. + equalsButtonCell = [_object class] == [NSButtonCell class]; + equalsBezelStyle = [_propertyName isEqualToString:@"bezelStyle"]; + + if (didSet) + { + [_object setBezelStyle:6]; +// NSLog(@"%@ %d", _object, [_object bezelStyle]); + } + + return didSet; +} + + +- (BOOL) JSCocoa:(JSCocoaController*)controller canCallFunction:(NSString*)_functionName argumentCount:(size_t)argumentCount arguments:(JSValueRef*)arguments inContext:(JSContextRef)ctx exception:(JSValueRef*)exception +{ +// NSLog(@"can call function %@", _functionName); + functionName = _functionName; + return canCallC; +} +- (BOOL) JSCocoa:(JSCocoaController*)controller canCallMethod:(NSString*)_methodName ofObject:(id)_object argumentCount:(size_t)argumentCount arguments:(JSValueRef*)arguments inContext:(JSContextRef)ctx exception:(JSValueRef*)exception +{ +// NSLog(@"can call method %@.%@", _object, _methodName); + object = _object; + methodName = _methodName; + return canCallObjC; +} +- (JSValueRef) JSCocoa:(JSCocoaController*)controller callMethod:(NSString*)_methodName ofObject:(id)_object privateObject:(JSCocoaPrivateObject*)thisPrivateObject argumentCount:(size_t)argumentCount arguments:(JSValueRef*)arguments inContext:(JSContextRef)ctx exception:(JSValueRef*)exception +{ +// NSLog(@"custom method call %@.%@", _object, _methodName); + + object = _object; + methodName = _methodName; + return customValueCall; +} + +/* +- (JSValueRef) JSCocoa:(JSCocoaController*)controller willReturnValue:(JSValueRef)value inContext:(JSContextRef)ctx exception:(JSValueRef*)exception +{ + NSLog(@"willReturn"); + willReturn = value; + if (customValueReturn) return customValueReturn; + return value; +} +*/ +- (BOOL) JSCocoa:(JSCocoaController*)controller canGetGlobalProperty:(NSString*)_propertyName inContext:(JSContextRef)ctx exception:(JSValueRef*)exception +{ +// NSLog(@"canGetGlobalProperty %@ %d", _propertyName, canGetGlobal); + propertyName = _propertyName; + return canGetGlobal; +} +- (JSValueRef) JSCocoa:(JSCocoaController*)controller getGlobalProperty:(NSString*)_propertyName inContext:(JSContextRef)ctx exception:(JSValueRef*)exception +{ +// NSLog(@"getGlobalProperty %@ %x", _propertyName, customValueGetGlobal); + propertyName = _propertyName; + return customValueGetGlobal; +} + + +- (BOOL)JSCocoa:(JSCocoaController*)controller canLoadJSFile:(NSString*)path +{ +// NSLog(@"canLoadJSFile=%@ canLoad=%d", path, canLoad); + pathtoJSFile = path; + return canLoad; +} +// Check if script can be evaluated +- (BOOL)JSCocoa:(JSCocoaController*)controller canEvaluateScript:(NSString*)script +{ +// NSLog(@"canEvaluateScript=%@ canEval=%d", script, canEval); + scriptToEval = script; + return canEval; +} +// Called before evalJSString, used to modify script about to be evaluated +// Return a custom NSString (eg a macro expanded version of the source) +// Return NULL to let JSCocoa handle evaluation +- (NSString*)JSCocoa:(JSCocoaController*)controller willEvaluateScript:(NSString*)script +{ +// NSLog(@"willEvaluateScript=%@ customScript=%@", script, customScript); + scriptToEval = script; + if (customScript) return customScript; + return script; +} + +// +// +#pragma Encodings +// +// +- (void)dumpEncodings +{ + NSLog(@"id=%s", @encode(id)); + NSLog(@"class=%s", @encode(Class)); + NSLog(@"selector=%s", @encode(SEL)); + NSLog(@"char=%s", @encode(char)); + NSLog(@"unsigned char=%s", @encode(unsigned char)); + NSLog(@"short=%s", @encode(short)); + NSLog(@"unsigned short=%s", @encode(unsigned short)); + NSLog(@"int=%s", @encode(int)); + NSLog(@"unsigned int=%s", @encode(unsigned int)); + NSLog(@"long=%s", @encode(long)); + NSLog(@"unsigned long=%s", @encode(unsigned long)); + NSLog(@"long long=%s", @encode(long long)); + NSLog(@"unsigned long long=%s", @encode(unsigned long long)); + NSLog(@"float=%s", @encode(float)); + NSLog(@"double=%s", @encode(double)); + NSLog(@"bool=%s", @encode(bool)); + NSLog(@"void=%s", @encode(void)); + NSLog(@"pointer=%s", @encode(void*)); + NSLog(@"charpointer=%s", @encode(char*)); + NSLog(@"BOOL=%s", @encode(BOOL)); + NSLog(@"NSInteger=%s", @encode(NSInteger)); + NSLog(@"NSUInteger=%s", @encode(NSUInteger)); +} + +// +// +#pragma mark - +// +// + +// +// JSCocoa inited from a WebView tests +// +- (id)testArray:(id)array +{ +// NSLog(@"array from WebView : %@", array); + + if (![[array objectAtIndex:0] isEqualToString:@"hello"]) return nil; + if (![[array objectAtIndex:1] isEqualToString:@"world"]) return nil; + if (![[array objectAtIndex:3] isEqualToString:@"end"]) return nil; + + id subArray = [array objectAtIndex:2]; + if (!subArray) return nil; + if (![subArray isKindOfClass:[NSArray class]]) return nil; + if ([[subArray objectAtIndex:0] intValue] != 4) return nil; + if ([[subArray objectAtIndex:1] intValue] != 5) return nil; + if ([[subArray objectAtIndex:2] intValue] != 6) return nil; + + return [NSArray arrayWithObjects:@"Hello", @"world", nil]; +} + +- (id)testHash:(id)hash +{ +// NSLog(@"hash from WebView : %@", hash); + + if (![[hash objectForKey:@"hello"] isEqualToString:@"world"]) return nil; + if (![[hash objectForKey:@"end"] isEqualToString:@"fin"]) return nil; + + id subHash = [hash objectForKey:@"subHash"]; + if (!subHash) return nil; + if (![[subHash objectForKey:@"part1"] isEqualToString:@"bonjour"]) return nil; + if (![[subHash objectForKey:@"part2"] isEqualToString:@"monde"]) return nil; + id subArray = [hash objectForKey:@"subArray"]; + if (!subArray) return nil; + if ([[subArray objectAtIndex:0] intValue] != 11) return nil; + if ([[subArray objectAtIndex:1] intValue] != 12) return nil; + if ([[subArray objectAtIndex:2] intValue] != 13) return nil; + + return [NSDictionary dictionaryWithObjectsAndKeys:@"world", @"Hello", nil]; +} + +// +// Test37 - JSCocoa inited from a WebView — called back when the webpage has finished. +// +- (void)finishTest37:(BOOL)b +{ + if (!b) return; + [jsc callJSFunctionNamed:@"completeDelayedTest" withArguments:@"37 init from webview", [NSNumber numberWithInt:1], nil]; + + [jsc2 release]; + for (id o in topObjects) + [o release]; + [topObjects release]; + topObjects = nil; + jsc2 = nil; +/* + NSLog(@"****************"); + [JSCocoa logInstanceStats]; + [JSCocoa logBoxedObjects]; + NSLog(@"****************"); +*/ +} + +BOOL bindingsAlreadyTested = NO; +BOOL bindingsAlreadyTested2 = NO; + +- (BOOL)bindingsAlreadyTested { if (cyclingContext) return NO; return bindingsAlreadyTested; } +- (BOOL)bindingsAlreadyTested2 { if (cyclingContext) return NO; return bindingsAlreadyTested2; } +- (void)setBindingsAlreadyTested:(BOOL)b { bindingsAlreadyTested = b; } +- (void)setBindingsAlreadyTested2:(BOOL)b { bindingsAlreadyTested2 = b; } + +- (void)allTestsRanOK +{ + [window makeKeyAndOrderFront:nil]; + [textField setStringValue:@"All tests ran OK"]; +} + +- (NSError*)testNSError +{ + return testNSError; +} + +- (BOOL)callbackNSErrorWithClass:(NSErrorTest*)o +{ + if (testNSError) + { + [testNSError release]; + testNSError = nil; + } + NSError* error = nil; +// NSLog(@"calling with pointer %x", &error); + BOOL r = [o someMethodReturningAnError:&error]; + + if (error) + { + testNSError = error; + [testNSError retain]; + } + + return r; +} + +- (BOOL)signatureTestWithError:(NSError**)error +{ + return NO; +} + +- (bool)signatureTestWithError2:(NSError**)error andInt:(char)a +{ + return NO; +} + +- (void)disposeClass:(NSString *)className +{ + id c = objc_getClass([className UTF8String]); + if (!c) return; + objc_disposeClassPair(c); +} + +- (void)disposeShadowBindingsClasses +{ + [self disposeClass:@"NSKVONotifying_BindingsSafeDeallocSource"]; + [self disposeClass:@"NSKVONotifying_NibTestOwner"]; +} + + +@end + + + +// +// From Ian Beck +#pragma mark Test 56, Whitespace +// +// +@interface MRTestWhitespace : NSObject +@end + +@implementation MRTestWhitespace + +- (NSString *)fetchLinebreak { + return @"\n"; +} +- (NSString *)fetchTab { + return @" "; +} +- (NSString *)fetchSpaces { + return @" "; +} + +@end + +// +// From Gus Mueller +#pragma mark Blocks test +// This fails because JSCocoa does not parse the '?' encoding used by blocks and function pointers +// +@interface JSTestBlocks : NSObject { } @end + +@implementation JSTestBlocks + ++ (id)newErrorBlockForJSFunction:(JSValueRefAndContextRef)callbackFunction { + + JSContextRef mainContext = [[JSCocoa controllerFromContext:callbackFunction.ctx] ctx]; + + // Protect function using the main context (JavascriptCore creates a new context every time it enters a function) + // (This is not needed if the function has a name in the main scope or is stored in an object or array stored in the main scope) + JSValueProtect(mainContext, callbackFunction.value); + + void (^theBlock)(NSError *) = ^(NSError *err) { + [[JSCocoa controllerFromContext:mainContext] callJSFunction:callbackFunction.value withArguments:[NSArray arrayWithObjects:err, nil]]; + }; + + return [theBlock copy]; +} + + ++ (void)testFunction:(void (^)(NSError *))theBlock { + theBlock(nil); +} + +@end + +/* +var f = function(err) { + log("Hello from a jsfunction"); +}; + +var objcBlock = JSTestBlocks.newErrorBlockForJSFunction_(f); + +log('block=' + objcBlock); + +JSTestBlocks.testFunction_(objcBlock); + +*/ diff --git a/jscocoa/TestsRunner/English.lproj/InfoPlist.strings b/jscocoa/TestsRunner/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..5e45963 Binary files /dev/null and b/jscocoa/TestsRunner/English.lproj/InfoPlist.strings differ diff --git a/jscocoa/TestsRunner/English.lproj/MainMenu.xib b/jscocoa/TestsRunner/English.lproj/MainMenu.xib new file mode 100644 index 0000000..38c4ffb --- /dev/null +++ b/jscocoa/TestsRunner/English.lproj/MainMenu.xib @@ -0,0 +1,4136 @@ + + + + 1050 + 10C540 + 740 + 1038.25 + 458.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 740 + + + YES + + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + NewApplication + + YES + + + About NewApplication + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide NewApplication + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit NewApplication + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling… + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 15 + 2 + {{335, 392}, {406, 358}} + 1946157056 + JSCocoa Tests Runner + NSWindow + + {1.79769e+308, 1.79769e+308} + + + 256 + + YES + + + 268 + {{31, 297}, {102, 32}} + + YES + + 67239424 + 134217728 + Run Tests + + LucidaGrande + 13 + 1044 + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{31, 266}, {190, 32}} + + YES + + 67239424 + 134217728 + Run Tests Continuously + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{220, 266}, {68, 32}} + + YES + + 67239424 + 134217728 + Stop + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{31, 204}, {127, 32}} + + YES + + 67239424 + 134217728 + Instance Stats + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{31, 142}, {140, 32}} + + YES + + 67239424 + 134217728 + Garbage Collect + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{31, 173}, {140, 32}} + + YES + + 67239424 + 134217728 + Boxed Objects + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{31, 111}, {168, 32}} + + YES + + 67239424 + 134217728 + Run Simple Test File + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{31, 80}, {169, 32}} + + YES + + 67239424 + 134217728 + Unlink all references + + + -2038284033 + 129 + + + 200 + 25 + + + + + 266 + {{31, 56}, {358, 12}} + + YES + + 68288064 + 272892928 + + + LucidaGrande + 9 + 3614 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + {406, 358} + + + {{0, 0}, {1440, 878}} + {1.79769e+308, 1.79769e+308} + MyWindow + + + NSFontManager + + + ApplicationController + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + alignLeft: + + + + 442 + + + + alignJustified: + + + + 443 + + + + copyRuler: + + + + 444 + + + + alignCenter: + + + + 445 + + + + toggleRuler: + + + + 446 + + + + alignRight: + + + + 447 + + + + pasteRuler: + + + + 448 + + + + terminate: + + + + 449 + + + + delegate + + + + 451 + + + + runJSTests: + + + + 454 + + + + garbageCollect: + + + + 457 + + + + runSimpleTestFile: + + + + 460 + + + + unlinkAllReferences: + + + + 463 + + + + logBoxedObjects: + + + + 631 + + + + logInstanceStats: + + + + 635 + + + + window + + + + 636 + + + + textField + + + + 639 + + + + runJSTestsContinuously: + + + + 649 + + + + stopContinuousJSTestsRun: + + + + 650 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + YES + + + + + + + + + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 378 + + + YES + + + + + + 379 + + + YES + + + + + + + + + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + + + 387 + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + + + 452 + + + YES + + + + + + 453 + + + + + 455 + + + YES + + + + + + 456 + + + + + 458 + + + YES + + + + + + 459 + + + + + 461 + + + YES + + + + + + 462 + + + + + 628 + + + YES + + + + + + 629 + + + + + 632 + + + YES + + + + + + 633 + + + + + 637 + + + YES + + + + + + 638 + + + + + 640 + + + YES + + + + + + 641 + + + + + 646 + + + YES + + + + + + 647 + + + + + + + YES + + YES + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBEditorWindowLastContentRect + 371.IBPluginDependency + 371.IBViewEditorWindowController.showingBoundsRectangles + 371.IBViewEditorWindowController.showingLayoutRectangles + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 371.windowTemplate.maxSize + 372.IBPluginDependency + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 455.IBPluginDependency + 456.IBPluginDependency + 458.IBPluginDependency + 459.IBPluginDependency + 461.IBPluginDependency + 462.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 628.IBPluginDependency + 629.IBPluginDependency + 632.IBPluginDependency + 633.IBPluginDependency + 637.IBPluginDependency + 638.IBPluginDependency + 640.IBPluginDependency + 641.IBPluginDependency + 646.IBPluginDependency + 647.IBPluginDependency + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{187, 434}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{130, 795}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{487, 277}, {406, 358}} + com.apple.InterfaceBuilder.CocoaPlugin + + + {{487, 277}, {406, 358}} + + {{33, 99}, {480, 360}} + {3.40282e+38, 3.40282e+38} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{437, 242}, {86, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{523, 2}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{142, 612}, {242, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{145, 474}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + + YES + + + + + YES + + + YES + + + + 650 + + + + YES + + ApplicationController + NSObject + + YES + + YES + garbageCollect: + logBoxedObjects: + logInstanceStats: + runJSTests: + runJSTestsContinuously: + runSimpleTestFile: + stopContinuousJSTestsRun: + unlinkAllReferences: + + + YES + id + id + id + id + id + id + id + id + + + + YES + + YES + textField + topObjects + webViewUsedAsContextSource + window + + + YES + id + id + id + id + + + + IBProjectSource + ApplicationController.h + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaController.h + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaLib.h + + + + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSBrowser + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSDocument + NSObject + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocument.h + + + + NSDocument + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentScripting.h + + + + NSDocumentController + NSObject + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentController.h + + + + NSFontManager + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMatrix + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSMatrix.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMovieView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMovieView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTableView + NSControl + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSTextView + NSText + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../TestsRunner.xcodeproj + 3 + + diff --git a/jscocoa/TestsRunner/TestsRunner-Info.plist b/jscocoa/TestsRunner/TestsRunner-Info.plist new file mode 100644 index 0000000..612b7da --- /dev/null +++ b/jscocoa/TestsRunner/TestsRunner-Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/jscocoa/TestsRunner/TestsRunner.xcodeproj/project.pbxproj b/jscocoa/TestsRunner/TestsRunner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..774d67d --- /dev/null +++ b/jscocoa/TestsRunner/TestsRunner.xcodeproj/project.pbxproj @@ -0,0 +1,361 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 3D36E291105229E700132E23 /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D36E262105229E700132E23 /* BridgeSupportController.m */; }; + 3D36E292105229E700132E23 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D36E263105229E700132E23 /* class.js */; }; + 3D36E2A0105229E700132E23 /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D36E288105229E700132E23 /* JSCocoaController.m */; }; + 3D36E2A1105229E700132E23 /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D36E28A105229E700132E23 /* JSCocoaFFIArgument.m */; }; + 3D36E2A2105229E700132E23 /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D36E28C105229E700132E23 /* JSCocoaFFIClosure.m */; }; + 3D36E2A3105229E700132E23 /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D36E28E105229E700132E23 /* JSCocoaLib.m */; }; + 3D36E2A4105229E700132E23 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D36E290105229E700132E23 /* JSCocoaPrivateObject.m */; }; + 3D36E2B510522A1200132E23 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D36E2B310522A1200132E23 /* main.m */; }; + 3D36E2B710522A2100132E23 /* test.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D36E2B610522A2100132E23 /* test.js */; }; + 3D36E2BA10522A2600132E23 /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D36E2B910522A2600132E23 /* ApplicationController.m */; }; + 3D36E2BC10522A4100132E23 /* Tests in Resources */ = {isa = PBXBuildFile; fileRef = 3D36E2BB10522A4100132E23 /* Tests */; }; + 3D36E2C310522A5900132E23 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3D36E2BF10522A5900132E23 /* InfoPlist.strings */; }; + 3D36E2C410522A5900132E23 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D36E2C110522A5900132E23 /* MainMenu.xib */; }; + 3D36E2C710522A6F00132E23 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D36E2C610522A6F00132E23 /* JavaScriptCore.framework */; }; + 3D44EA621072FC7300F20BAD /* jslint-jscocoa.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D44EA611072FC7300F20BAD /* jslint-jscocoa.js */; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 3D36E261105229E700132E23 /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3D36E262105229E700132E23 /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3D36E263105229E700132E23 /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3D36E282105229E700132E23 /* JSCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa.h; sourceTree = ""; }; + 3D36E286105229E700132E23 /* JSCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa_Prefix.pch; sourceTree = ""; }; + 3D36E287105229E700132E23 /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3D36E288105229E700132E23 /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3D36E289105229E700132E23 /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3D36E28A105229E700132E23 /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 3D36E28B105229E700132E23 /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3D36E28C105229E700132E23 /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3D36E28D105229E700132E23 /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLib.h; sourceTree = ""; }; + 3D36E28E105229E700132E23 /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaLib.m; sourceTree = ""; }; + 3D36E28F105229E700132E23 /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3D36E290105229E700132E23 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3D36E2B310522A1200132E23 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 3D36E2B410522A1200132E23 /* TestsRunner_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestsRunner_Prefix.pch; sourceTree = ""; }; + 3D36E2B610522A2100132E23 /* test.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = test.js; sourceTree = ""; }; + 3D36E2B810522A2600132E23 /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = ""; }; + 3D36E2B910522A2600132E23 /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = ""; }; + 3D36E2BB10522A4100132E23 /* Tests */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Tests; path = ../Tests; sourceTree = SOURCE_ROOT; }; + 3D36E2BD10522A4E00132E23 /* TestsRunner-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "TestsRunner-Info.plist"; sourceTree = ""; }; + 3D36E2C010522A5900132E23 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 3D36E2C210522A5900132E23 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 3D36E2C610522A6F00132E23 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + 3D44EA611072FC7300F20BAD /* jslint-jscocoa.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "jslint-jscocoa.js"; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* TestsRunner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestsRunner.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 3D36E2C710522A6F00132E23 /* JavaScriptCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 3D36E2B610522A2100132E23 /* test.js */, + 3D36E2B910522A2600132E23 /* ApplicationController.m */, + 3D36E2B810522A2600132E23 /* ApplicationController.h */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* TestsRunner.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* TestsRunner */ = { + isa = PBXGroup; + children = ( + 3D36E260105229E700132E23 /* JSCocoa */, + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = TestsRunner; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 3D36E2B310522A1200132E23 /* main.m */, + 3D36E2B410522A1200132E23 /* TestsRunner_Prefix.pch */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 3D36E2BB10522A4100132E23 /* Tests */, + 3D36E2BD10522A4E00132E23 /* TestsRunner-Info.plist */, + 3D36E2BF10522A5900132E23 /* InfoPlist.strings */, + 3D36E2C110522A5900132E23 /* MainMenu.xib */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + 3D36E2C610522A6F00132E23 /* JavaScriptCore.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3D36E260105229E700132E23 /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3D36E262105229E700132E23 /* BridgeSupportController.m */, + 3D36E261105229E700132E23 /* BridgeSupportController.h */, + 3D36E263105229E700132E23 /* class.js */, + 3D44EA611072FC7300F20BAD /* jslint-jscocoa.js */, + 3D36E282105229E700132E23 /* JSCocoa.h */, + 3D36E286105229E700132E23 /* JSCocoa_Prefix.pch */, + 3D36E288105229E700132E23 /* JSCocoaController.m */, + 3D36E287105229E700132E23 /* JSCocoaController.h */, + 3D36E28A105229E700132E23 /* JSCocoaFFIArgument.m */, + 3D36E289105229E700132E23 /* JSCocoaFFIArgument.h */, + 3D36E28C105229E700132E23 /* JSCocoaFFIClosure.m */, + 3D36E28B105229E700132E23 /* JSCocoaFFIClosure.h */, + 3D36E28E105229E700132E23 /* JSCocoaLib.m */, + 3D36E28D105229E700132E23 /* JSCocoaLib.h */, + 3D36E290105229E700132E23 /* JSCocoaPrivateObject.m */, + 3D36E28F105229E700132E23 /* JSCocoaPrivateObject.h */, + ); + name = JSCocoa; + path = ../JSCocoa; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* TestsRunner */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "TestsRunner" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TestsRunner; + productInstallPath = "$(HOME)/Applications"; + productName = TestsRunner; + productReference = 8D1107320486CEB800E47090 /* TestsRunner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "TestsRunner" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* TestsRunner */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D1107260486CEB800E47090 /* TestsRunner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D36E2B710522A2100132E23 /* test.js in Resources */, + 3D36E292105229E700132E23 /* class.js in Resources */, + 3D44EA621072FC7300F20BAD /* jslint-jscocoa.js in Resources */, + 3D36E2BC10522A4100132E23 /* Tests in Resources */, + 3D36E2C310522A5900132E23 /* InfoPlist.strings in Resources */, + 3D36E2C410522A5900132E23 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D36E291105229E700132E23 /* BridgeSupportController.m in Sources */, + 3D36E2A0105229E700132E23 /* JSCocoaController.m in Sources */, + 3D36E2A1105229E700132E23 /* JSCocoaFFIArgument.m in Sources */, + 3D36E2A2105229E700132E23 /* JSCocoaFFIClosure.m in Sources */, + 3D36E2A3105229E700132E23 /* JSCocoaLib.m in Sources */, + 3D36E2A4105229E700132E23 /* JSCocoaPrivateObject.m in Sources */, + 3D36E2B510522A1200132E23 /* main.m in Sources */, + 3D36E2BA10522A2600132E23 /* ApplicationController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 3D36E2BF10522A5900132E23 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 3D36E2C010522A5900132E23 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 3D36E2C110522A5900132E23 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 3D36E2C210522A5900132E23 /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* 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; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = TestsRunner_Prefix.pch; + INFOPLIST_FILE = "TestsRunner-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = TestsRunner; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = TestsRunner_Prefix.pch; + INFOPLIST_FILE = "TestsRunner-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = TestsRunner; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_PEDANTIC = NO; + GCC_WARN_SHADOW = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_PEDANTIC = NO; + GCC_WARN_SHADOW = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "TestsRunner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "TestsRunner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/jscocoa/TestsRunner/TestsRunner_Prefix.pch b/jscocoa/TestsRunner/TestsRunner_Prefix.pch new file mode 100644 index 0000000..709cf62 --- /dev/null +++ b/jscocoa/TestsRunner/TestsRunner_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'TestsRunner' target in the 'TestsRunner' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/jscocoa/TestsRunner/main.m b/jscocoa/TestsRunner/main.m new file mode 100644 index 0000000..ae2958e --- /dev/null +++ b/jscocoa/TestsRunner/main.m @@ -0,0 +1,19 @@ +// +// main.m +// TestsRunner +// +// Created by Patrick Geiller on 17/10/08. +// Copyright __MyCompanyName__ 2008. All rights reserved. +// + +#import +#import "JSCocoa.h" + +int main(int argc, char *argv[]) +{ +// [[NSAutoreleasePool alloc] init]; +// [JSCocoaController allocAutoreleasePool]; +// [JSCocoaController sharedController]; + + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jscocoa/TestsRunner/test.js b/jscocoa/TestsRunner/test.js new file mode 100644 index 0000000..6a2e98e --- /dev/null +++ b/jscocoa/TestsRunner/test.js @@ -0,0 +1,46 @@ + + +// log('TEST !') + + var delayedTests + + function resetDelayedTests() + { + delayedTests = {} + } + function delayedTestCount() + { + var l = 0 + for (var i in delayedTests) l++ + return l + } + + function delayedTestPendingCount() + { + var l = 0 + for (var i in delayedTests) if (delayedTests[i] == 'pending') l++ + return l + } + function delayedTestSuccessCount() + { + var l = 0 + for (var i in delayedTests) if (delayedTests[i]) l++ + return l + } + + function registerDelayedTest(name) + { + delayedTests[name] = 'pending' + } + + function completeDelayedTest(name, status) + { + delayedTests[name] = !!status + log('Pending test ' + name + ' ' + (status ? 'complete' : 'FAIL')) + if (delayedTestPendingCount() == 0) + { + log('All pending tests ran, ' + delayedTestSuccessCount() + '/' + delayedTestCount() + ' successful') + NSApplication.sharedApplication.delegate.allTestsRanOK + } + } + diff --git a/jscocoa/WebCocoa/English.lproj/InfoPlist.strings b/jscocoa/WebCocoa/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/jscocoa/WebCocoa/English.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/jscocoa/WebCocoa/English.lproj/MainMenu.xib b/jscocoa/WebCocoa/English.lproj/MainMenu.xib new file mode 100644 index 0000000..2bb4c5c --- /dev/null +++ b/jscocoa/WebCocoa/English.lproj/MainMenu.xib @@ -0,0 +1,4366 @@ + + + + 1060 + 10F569 + 740 + 1038.29 + 461.00 + + YES + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + 740 + 740 + + + + YES + + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + WebCocoa + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + WebCocoa + + YES + + + About WebCocoa + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide WebCocoa + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit WebCocoa + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Paste and Match Style + V + 1572864 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling and Grammar + : + 1048576 + 2147483647 + + + + + + Check Document Now + ; + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + Correct Spelling Automatically + + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Show Substitutions + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Dashes + + 2147483647 + + + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + Text Replacement + + 2147483647 + + + + + + + + + Transformations + + 2147483647 + + + submenuAction: + + Transformations + + YES + + + Make Upper Case + + 2147483647 + + + + + + Make Lower Case + + 2147483647 + + + + + + Capitalize + + 2147483647 + + + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Writing Direction + + 2147483647 + + + submenuAction: + + Writing Direction + + YES + + + YES + Paragraph + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + YES + Selection + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + YES + + + WebCocoa Help + ? + 1048576 + 2147483647 + + + + + _NSHelpMenu + + + + _NSMainMenu + + + 15 + 2 + {{335, 70}, {670, 680}} + 1954021376 + WebCocoa + NSWindow + + {1.79769e+308, 1.79769e+308} + + + 256 + + YES + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + + {670, 680} + + + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + {670, 680} + + + {{0, 0}, {1920, 1178}} + {1.79769e+308, 1.79769e+308} + WebCocoa + + + WebCocoaAppDelegate + + + NSFontManager + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + terminate: + + + + 449 + + + + toggleAutomaticSpellingCorrection: + + + + 456 + + + + orderFrontSubstitutionsPanel: + + + + 458 + + + + toggleAutomaticDashSubstitution: + + + + 461 + + + + toggleAutomaticTextReplacement: + + + + 463 + + + + uppercaseWord: + + + + 464 + + + + capitalizeWord: + + + + 467 + + + + lowercaseWord: + + + + 468 + + + + pasteAsPlainText: + + + + 486 + + + + performFindPanelAction: + + + + 487 + + + + performFindPanelAction: + + + + 488 + + + + performFindPanelAction: + + + + 489 + + + + showHelp: + + + + 493 + + + + delegate + + + + 495 + + + + alignCenter: + + + + 518 + + + + pasteRuler: + + + + 519 + + + + toggleRuler: + + + + 520 + + + + alignRight: + + + + 521 + + + + copyRuler: + + + + 522 + + + + alignJustified: + + + + 523 + + + + alignLeft: + + + + 524 + + + + makeBaseWritingDirectionNatural: + + + + 525 + + + + makeBaseWritingDirectionLeftToRight: + + + + 526 + + + + makeBaseWritingDirectionRightToLeft: + + + + 527 + + + + makeTextWritingDirectionNatural: + + + + 528 + + + + makeTextWritingDirectionLeftToRight: + + + + 529 + + + + makeTextWritingDirectionRightToLeft: + + + + 530 + + + + window + + + + 532 + + + + webview + + + + 534 + + + + frameLoadDelegate + + + + 535 + + + + downloadDelegate + + + + 536 + + + + policyDelegate + + + + 537 + + + + resourceLoadDelegate + + + + 538 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + + + 80 + + + + + 78 + + + + + 72 + + + + + 82 + + + + + 124 + + + YES + + + + + + 77 + + + + + 73 + + + + + 79 + + + + + 112 + + + + + 74 + + + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + + + 144 + + + + + 129 + + + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + YES + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + YES + + + + + + 451 + + + YES + + + + + + + + 452 + + + + + 453 + + + + + 454 + + + + + 457 + + + + + 459 + + + + + 460 + + + + + 462 + + + + + 465 + + + + + 466 + + + + + 485 + + + + + 490 + + + YES + + + + + + 491 + + + YES + + + + + + 492 + + + + + 494 + + + + + 496 + + + YES + + + + + + 497 + + + YES + + + + + + + + + + + + + + + 498 + + + + + 499 + + + + + 500 + + + + + 501 + + + + + 502 + + + + + 503 + + + YES + + + + + + 504 + + + + + 505 + + + + + 506 + + + + + 507 + + + + + 508 + + + YES + + + + + + + + + + + + + + 509 + + + + + 510 + + + + + 511 + + + + + 512 + + + + + 513 + + + + + 514 + + + + + 515 + + + + + 516 + + + + + 517 + + + + + 533 + + + + + + + YES + + YES + -3.IBPluginDependency + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBEditorWindowLastContentRect + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBEditorWindowLastContentRect + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBEditorWindowLastContentRect + 371.IBPluginDependency + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 371.windowTemplate.maxSize + 372.IBPluginDependency + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 450.IBPluginDependency + 451.IBEditorWindowLastContentRect + 451.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 454.IBPluginDependency + 457.IBPluginDependency + 459.IBPluginDependency + 460.IBPluginDependency + 462.IBPluginDependency + 465.IBPluginDependency + 466.IBPluginDependency + 485.IBPluginDependency + 490.IBPluginDependency + 491.IBEditorWindowLastContentRect + 491.IBPluginDependency + 492.IBPluginDependency + 496.IBPluginDependency + 497.IBEditorWindowLastContentRect + 497.IBPluginDependency + 498.IBPluginDependency + 499.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 500.IBPluginDependency + 501.IBPluginDependency + 502.IBPluginDependency + 503.IBPluginDependency + 504.IBPluginDependency + 505.IBPluginDependency + 506.IBPluginDependency + 507.IBPluginDependency + 508.IBEditorWindowLastContentRect + 508.IBPluginDependency + 509.IBPluginDependency + 510.IBPluginDependency + 511.IBPluginDependency + 512.IBPluginDependency + 513.IBPluginDependency + 514.IBPluginDependency + 515.IBPluginDependency + 516.IBPluginDependency + 517.IBPluginDependency + 533.IBPluginDependency + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{753, 187}, {275, 113}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{547, 180}, {254, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{187, 434}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{753, 217}, {238, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{654, 239}, {194, 73}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{380, 836}, {438, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{604, 269}, {231, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{746, 287}, {220, 133}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{224, 354}, {670, 680}} + com.apple.InterfaceBuilder.CocoaPlugin + {{224, 354}, {670, 680}} + + {{33, 99}, {480, 360}} + {3.40282e+38, 3.40282e+38} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{591, 420}, {83, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{523, 2}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{753, 197}, {170, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{725, 289}, {246, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{674, 260}, {204, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{878, 180}, {164, 173}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + {{286, 129}, {275, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{452, 109}, {196, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{145, 474}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + + YES + + + + + YES + + + YES + + + + 538 + + + + YES + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaController.h + + + + NSObject + + IBProjectSource + ../JSCocoa/JSCocoaLib.h + + + + WebCocoaAppDelegate + NSObject + + YES + + YES + webview + window + + + YES + WebView + NSWindow + + + + IBProjectSource + WebCocoaAppDelegate.h + + + + + YES + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSBrowser + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSDocument + NSObject + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocument.h + + + + NSDocument + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentScripting.h + + + + NSDocumentController + NSObject + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentController.h + + + + NSFontManager + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMatrix + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSMatrix.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMovieView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMovieView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebEditingDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebFrameLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebJavaPlugIn.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPlugin.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPluginContainer.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPolicyDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebResourceLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebScriptObject.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebUIDelegate.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTableView + NSControl + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextView + NSText + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + WebView + NSView + + YES + + YES + goBack: + goForward: + makeTextLarger: + makeTextSmaller: + makeTextStandardSize: + reload: + reloadFromOrigin: + stopLoading: + takeStringURLFrom: + toggleContinuousSpellChecking: + toggleSmartInsertDelete: + + + YES + id + id + id + id + id + id + id + id + id + id + id + + + + IBFrameworkSource + WebKit.framework/Headers/WebView.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../WebCocoa.xcodeproj + 3 + + diff --git a/jscocoa/WebCocoa/WebCocoa-Info.plist b/jscocoa/WebCocoa/WebCocoa-Info.plist new file mode 100644 index 0000000..35aea88 --- /dev/null +++ b/jscocoa/WebCocoa/WebCocoa-Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + au.com.adam.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + CFBundleVersion + 1 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/jscocoa/WebCocoa/WebCocoa.html b/jscocoa/WebCocoa/WebCocoa.html new file mode 100644 index 0000000..56e09ef --- /dev/null +++ b/jscocoa/WebCocoa/WebCocoa.html @@ -0,0 +1,99 @@ + + + + + +

WebView's context used as JSCocoa source

+ + + Yahoo + +

+

+ + + + + diff --git a/jscocoa/WebCocoa/WebCocoa.xcodeproj/project.pbxproj b/jscocoa/WebCocoa/WebCocoa.xcodeproj/project.pbxproj new file mode 100644 index 0000000..7b99654 --- /dev/null +++ b/jscocoa/WebCocoa/WebCocoa.xcodeproj/project.pbxproj @@ -0,0 +1,353 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; + 256AC3DA0F4B6AC300CF3369 /* WebCocoaAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* WebCocoaAppDelegate.m */; }; + 3D9855CD11E7BF3A00732434 /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9855A011E7BF3A00732434 /* BridgeSupportController.m */; }; + 3D9855CE11E7BF3A00732434 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D9855A111E7BF3A00732434 /* class.js */; }; + 3D9855DC11E7BF3A00732434 /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9855C311E7BF3A00732434 /* JSCocoaController.m */; }; + 3D9855DD11E7BF3A00732434 /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9855C511E7BF3A00732434 /* JSCocoaFFIArgument.m */; }; + 3D9855DE11E7BF3A00732434 /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9855C711E7BF3A00732434 /* JSCocoaFFIClosure.m */; }; + 3D9855DF11E7BF3A00732434 /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9855C911E7BF3A00732434 /* JSCocoaLib.m */; }; + 3D9855E011E7BF3A00732434 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9855CB11E7BF3A00732434 /* JSCocoaPrivateObject.m */; }; + 3D9855E111E7BF3A00732434 /* jslint-jscocoa.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D9855CC11E7BF3A00732434 /* jslint-jscocoa.js */; }; + 3D9855F311E7BF8000732434 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D9855F211E7BF8000732434 /* WebKit.framework */; }; + 3D98560511E7C03100732434 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D98560411E7C03100732434 /* JavaScriptCore.framework */; }; + 3D98562E11E7C0A600732434 /* WebCocoa.html in Resources */ = {isa = PBXBuildFile; fileRef = 3D98562D11E7C0A600732434 /* WebCocoa.html */; }; + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 256AC3D80F4B6AC300CF3369 /* WebCocoaAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCocoaAppDelegate.h; sourceTree = ""; }; + 256AC3D90F4B6AC300CF3369 /* WebCocoaAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebCocoaAppDelegate.m; sourceTree = ""; }; + 256AC3F00F4B6AF500CF3369 /* WebCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCocoa_Prefix.pch; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 3D98559F11E7BF3A00732434 /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgeSupportController.h; sourceTree = ""; }; + 3D9855A011E7BF3A00732434 /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgeSupportController.m; sourceTree = ""; }; + 3D9855A111E7BF3A00732434 /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = class.js; sourceTree = ""; }; + 3D9855BD11E7BF3A00732434 /* JSCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa.h; sourceTree = ""; }; + 3D9855C111E7BF3A00732434 /* JSCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoa_Prefix.pch; sourceTree = ""; }; + 3D9855C211E7BF3A00732434 /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaController.h; sourceTree = ""; }; + 3D9855C311E7BF3A00732434 /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaController.m; sourceTree = ""; }; + 3D9855C411E7BF3A00732434 /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIArgument.h; sourceTree = ""; }; + 3D9855C511E7BF3A00732434 /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIArgument.m; sourceTree = ""; }; + 3D9855C611E7BF3A00732434 /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaFFIClosure.h; sourceTree = ""; }; + 3D9855C711E7BF3A00732434 /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaFFIClosure.m; sourceTree = ""; }; + 3D9855C811E7BF3A00732434 /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaLib.h; sourceTree = ""; }; + 3D9855C911E7BF3A00732434 /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaLib.m; sourceTree = ""; }; + 3D9855CA11E7BF3A00732434 /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCocoaPrivateObject.h; sourceTree = ""; }; + 3D9855CB11E7BF3A00732434 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSCocoaPrivateObject.m; sourceTree = ""; }; + 3D9855CC11E7BF3A00732434 /* jslint-jscocoa.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "jslint-jscocoa.js"; sourceTree = ""; }; + 3D9855F211E7BF8000732434 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + 3D98560411E7C03100732434 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; + 3D98562D11E7C0A600732434 /* WebCocoa.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = WebCocoa.html; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* WebCocoa-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "WebCocoa-Info.plist"; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* WebCocoa.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WebCocoa.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 3D9855F311E7BF8000732434 /* WebKit.framework in Frameworks */, + 3D98560511E7C03100732434 /* JavaScriptCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 256AC3D90F4B6AC300CF3369 /* WebCocoaAppDelegate.m */, + 256AC3D80F4B6AC300CF3369 /* WebCocoaAppDelegate.h */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* WebCocoa.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* WebCocoa */ = { + isa = PBXGroup; + children = ( + 3D98559E11E7BF3A00732434 /* JSCocoa */, + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = WebCocoa; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 256AC3F00F4B6AF500CF3369 /* WebCocoa_Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 3D98562D11E7C0A600732434 /* WebCocoa.html */, + 8D1107310486CEB800E47090 /* WebCocoa-Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3D98560411E7C03100732434 /* JavaScriptCore.framework */, + 3D9855F211E7BF8000732434 /* WebKit.framework */, + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3D98559E11E7BF3A00732434 /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3D98559F11E7BF3A00732434 /* BridgeSupportController.h */, + 3D9855A011E7BF3A00732434 /* BridgeSupportController.m */, + 3D9855A111E7BF3A00732434 /* class.js */, + 3D9855BD11E7BF3A00732434 /* JSCocoa.h */, + 3D9855C111E7BF3A00732434 /* JSCocoa_Prefix.pch */, + 3D9855C211E7BF3A00732434 /* JSCocoaController.h */, + 3D9855C311E7BF3A00732434 /* JSCocoaController.m */, + 3D9855C411E7BF3A00732434 /* JSCocoaFFIArgument.h */, + 3D9855C511E7BF3A00732434 /* JSCocoaFFIArgument.m */, + 3D9855C611E7BF3A00732434 /* JSCocoaFFIClosure.h */, + 3D9855C711E7BF3A00732434 /* JSCocoaFFIClosure.m */, + 3D9855C811E7BF3A00732434 /* JSCocoaLib.h */, + 3D9855C911E7BF3A00732434 /* JSCocoaLib.m */, + 3D9855CA11E7BF3A00732434 /* JSCocoaPrivateObject.h */, + 3D9855CB11E7BF3A00732434 /* JSCocoaPrivateObject.m */, + 3D9855CC11E7BF3A00732434 /* jslint-jscocoa.js */, + ); + name = JSCocoa; + path = ../JSCocoa; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* WebCocoa */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "WebCocoa" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = WebCocoa; + productInstallPath = "$(HOME)/Applications"; + productName = WebCocoa; + productReference = 8D1107320486CEB800E47090 /* WebCocoa.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "WebCocoa" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* WebCocoa */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D1107260486CEB800E47090 /* WebCocoa */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D9855CE11E7BF3A00732434 /* class.js in Resources */, + 3D9855E111E7BF3A00732434 /* jslint-jscocoa.js in Resources */, + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, + 3D98562E11E7C0A600732434 /* WebCocoa.html in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090 /* main.m in Sources */, + 256AC3DA0F4B6AC300CF3369 /* WebCocoaAppDelegate.m in Sources */, + 3D9855CD11E7BF3A00732434 /* BridgeSupportController.m in Sources */, + 3D9855DC11E7BF3A00732434 /* JSCocoaController.m in Sources */, + 3D9855DD11E7BF3A00732434 /* JSCocoaFFIArgument.m in Sources */, + 3D9855DE11E7BF3A00732434 /* JSCocoaFFIClosure.m in Sources */, + 3D9855DF11E7BF3A00732434 /* JSCocoaLib.m in Sources */, + 3D9855E011E7BF3A00732434 /* JSCocoaPrivateObject.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 1DDD58150DA1D0A300B32029 /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* 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; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = WebCocoa_Prefix.pch; + INFOPLIST_FILE = "WebCocoa-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = WebCocoa; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = WebCocoa_Prefix.pch; + INFOPLIST_FILE = "WebCocoa-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = WebCocoa; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.6; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_LDFLAGS = "-lffi"; + PREBINDING = NO; + SDKROOT = macosx10.6; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "WebCocoa" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "WebCocoa" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/jscocoa/WebCocoa/WebCocoaAppDelegate.h b/jscocoa/WebCocoa/WebCocoaAppDelegate.h new file mode 100644 index 0000000..1460862 --- /dev/null +++ b/jscocoa/WebCocoa/WebCocoaAppDelegate.h @@ -0,0 +1,24 @@ +// +// WebCocoaAppDelegate.h +// WebCocoa +// +// Created by Patrick Geiller on 09/07/10. +// Copyright 2010 Inexdo. All rights reserved. +// + +#import +#import +#import "JSCocoa.h" + +@interface WebCocoaAppDelegate : NSObject { + NSWindow* window; + + WebView* webview; + JSCocoa* jscocoa; +} + +@property (assign) IBOutlet NSWindow *window; +@property (assign) IBOutlet WebView *webview; +@property (retain) JSCocoa *jscocoa; + +@end diff --git a/jscocoa/WebCocoa/WebCocoaAppDelegate.m b/jscocoa/WebCocoa/WebCocoaAppDelegate.m new file mode 100644 index 0000000..74ae0e5 --- /dev/null +++ b/jscocoa/WebCocoa/WebCocoaAppDelegate.m @@ -0,0 +1,39 @@ +// +// WebCocoaAppDelegate.m +// WebCocoa +// +// Created by Patrick Geiller on 09/07/10. +// Copyright 2010 Inexdo. All rights reserved. +// + +#import "WebCocoaAppDelegate.h" + +@implementation WebCocoaAppDelegate + + +@synthesize window; +@synthesize webview; +@synthesize jscocoa; + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application + NSLog(@"%@", webview); + + [webview setMainFrameURL:[[NSBundle mainBundle] pathForResource:@"WebCocoa.html" ofType:@""]]; + JSGlobalContextRef ctx = [[webview mainFrame] globalContext]; + jscocoa = [[JSCocoa alloc] initWithGlobalContext:ctx]; + [jscocoa setObject:self withName:@"myself"]; + + NSLog(@"the page should list all classes and corresponding methods, derivation tree, etc. Also, searchable."); + Ideally, integrate the editor into WebCocoa, and launch the debugger from there. +} +#pragma mark WebFrameLoadDelegate Methods + +- (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame { +// NSLog(@"didClearWindowObject:"); + +} + +#pragma mark - + +@end diff --git a/jscocoa/WebCocoa/WebCocoa_Prefix.pch b/jscocoa/WebCocoa/WebCocoa_Prefix.pch new file mode 100644 index 0000000..1cec042 --- /dev/null +++ b/jscocoa/WebCocoa/WebCocoa_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'WebCocoa' target in the 'WebCocoa' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/jscocoa/WebCocoa/main.m b/jscocoa/WebCocoa/main.m new file mode 100644 index 0000000..2e26851 --- /dev/null +++ b/jscocoa/WebCocoa/main.m @@ -0,0 +1,17 @@ +// +// main.m +// WebCocoa +// +// Created by Patrick Geiller on 09/07/10. +// Copyright 2010 Inexdo. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) +{ + id pool = [NSAutoreleasePool new]; + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitDeveloperExtras"]; + [pool release]; + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jscocoa/WebKit additions/NSObject+WebScripting.h b/jscocoa/WebKit additions/NSObject+WebScripting.h new file mode 100644 index 0000000..b1ef825 --- /dev/null +++ b/jscocoa/WebKit additions/NSObject+WebScripting.h @@ -0,0 +1,35 @@ +// +// NSObject+WebScripting.h +// Chocolate +// +// Created by Fabien Franzen on 02-09-09. +// Copyright 2009 Atelier Fabien. All rights reserved. +// +// Getter shortcut on () javascript method calls: +// +// window.bridgedObject('deep.reaching.keyPath'); +// +// Alternatively: +// +// window.bridgedObject.deep().reaching().keyPath(); +// +// Setter shortcut on () javascript method calls: +// +// window.bridgedObject('deep.reaching.keyPath', value); +// + +#import + +@class WebScriptObject; + +@interface NSObject (WebScripting) + ++ (id)JSProxyFrom:(id)object; // looks for @selector(JSProxy) + +- (id)defaultWebScriptProxy; +- (void)setWebScriptValue:(id)value forKeyPath:(NSString *)keyPath; +- (id)webScriptValueForKeyPath:(NSString *)keyPath; + ++ (NSArray *)arrayFromJavaScriptArray:(WebScriptObject *)javaScriptArray; + +@end diff --git a/jscocoa/WebKit additions/NSObject+WebScripting.m b/jscocoa/WebKit additions/NSObject+WebScripting.m new file mode 100644 index 0000000..19a1755 --- /dev/null +++ b/jscocoa/WebKit additions/NSObject+WebScripting.m @@ -0,0 +1,103 @@ +// +// NSObject+WebScripting.m +// Chocolate +// +// Created by Fabien Franzen on 02-09-09. +// Copyright 2009 Atelier Fabien. All rights reserved. +// + +#import "NSObject+WebScripting.h" +#import + +@implementation NSObject (WebScripting) + ++ (id)JSProxyFrom:(id)object { + static SEL jsProxySelector; + if (!jsProxySelector) jsProxySelector = @selector(JSProxy); + if ([object respondsToSelector:jsProxySelector]) { + return [object performSelector:jsProxySelector]; + } else { + return object; + } +} + +- (id)defaultWebScriptProxy { + return self; +} + +- (void)setWebScriptValue:(id)value forKeyPath:(NSString *)keyPath { + if ([value isKindOfClass:[WebScriptObject class]]) { + NSArray *arrayValue = [[self class] arrayFromJavaScriptArray:value]; + if (arrayValue) { + [self setValue:arrayValue forKeyPath:keyPath]; + } else { + [self setValue:value forKeyPath:keyPath]; + } + } else { + [self setValue:value forKeyPath:keyPath]; + } +} + +- (id)webScriptValueForKeyPath:(NSString *)keyPath { + return [self valueForKeyPath:keyPath]; +} + ++ (BOOL)isSelectorExcludedFromWebScript:(SEL)selector { + return NO; +} + ++ (BOOL)isKeyExcludedFromWebScript:(const char *)name { + return NO; +} + +- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args { + id proxy = [self defaultWebScriptProxy]; + + if ([name isEqualToString:@"toString"]) return [proxy description]; + if ([args count] == 0) return [proxy valueForKey:name]; + + NSLog(@"Undefined WebScript Method Call: %@ - args: %@", name, args); + return nil; +} + +- (id)invokeDefaultMethodWithArguments:(NSArray *)args { + id proxy = [self defaultWebScriptProxy]; + + @try { + if ([args count] > 0 && [[args objectAtIndex:0] isKindOfClass:[NSString class]]) { + if ([args count] == 2) { + NSString *keyPath = [args objectAtIndex:0]; + id value = [args objectAtIndex:1]; + [proxy setWebScriptValue:value forKeyPath:keyPath]; + return nil; + } else if ([args count] == 1) { + return [proxy webScriptValueForKeyPath:[args objectAtIndex:0]]; + } + } else { + return [proxy description]; + } + } @catch(NSException *e) { + NSLog(@"An exception occurred: %@", e); + } + return nil; +} + ++ (NSArray *)arrayFromJavaScriptArray:(WebScriptObject *)javaScriptArray { + @try { + id lengthObj = [javaScriptArray valueForKey:@"length"]; + if(![lengthObj respondsToSelector:@selector(unsignedIntValue)]) return nil; + + NSUInteger length = [lengthObj unsignedIntValue]; + NSMutableArray *result = [NSMutableArray arrayWithCapacity:length]; + for (NSUInteger i = 0; i < length; ++i) { + id item = [javaScriptArray webScriptValueAtIndex:i]; + if (item) [result addObject:item]; + } + return result; + } @catch(NSException *e) { + // do nothing + } + return nil; +} + +@end diff --git a/jscocoa/WebKit additions/jscocoa-sample.m b/jscocoa/WebKit additions/jscocoa-sample.m new file mode 100644 index 0000000..e626d62 --- /dev/null +++ b/jscocoa/WebKit additions/jscocoa-sample.m @@ -0,0 +1,78 @@ +// +// Sample code to use JSCocoa in a WebView instead of the existing WebKit bridge. +// by Fabien Franzen on 20090906 +// +// Init JSCocoa with initWithGlobalContext:[[webView mainFrame] globalContext] +// +// Use JSCocoa via the global 'OSX' property : +// var objCDate = OSX.NSDate.alloc.init +// var point = new OSX.NSPoint(123, 456) +// var delegate = OSX.NSApplication.sharedApplication.delegate +// var array = delegate.testArray( ['hello', 'world', [4, 5, 6], 'end' ] ) +// +// The Javascript context (JSGlobalContextRef) is only valid for the current webpage : it will be released when navigating to a new URL. +// Destroy and recreate JSCocoa upon WebFrameLoadDelegate.didClearWindowObject:forFrame: +// + +@interface Report : NSObject { + WebView *webView; + JSCocoaController *JSController; +} + +@property (nonatomic, assign) IBOutlet WebView *webView; // weak ref +@property (nonatomic, retain) JSCocoaController *JSController; + +- (id)initWithWebView:(WebView *)wView; + +- (void)initJSController; + +@end + +@implementation Report + +- (id)initWithWebView:(WebView *)wView { + if (self = [super init]) { + [self setWebView:wView]; + [self initJSController]; + [[self webView] setFrameLoadDelegate:self] + } + return self; +} + +- (void)initJSController { + JSGlobalContextRef ctx = [[[self webView] mainFrame] globalContext]; + if ([self JSController] == nil || ([self JSController] && ctx != [[self JSController] ctx])) { + [self setJSController:[[JSCocoa alloc] initWithGlobalContext:ctx]]; + } +} + +#pragma mark WebFrameLoadDelegate Methods + +- (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame { + [self initJSController]; + [[self JSController] setObject:self withName:@"report"]; +} + +#pragma mark - + +- (void)dealloc { + webView = nil; + [JSController release], JSController = nil; + [super dealloc]; +} + +@end + +// used with jquery.js and chain.js + +jQuery(function($) { + $('#overview').items([]).chain(); +}); + +function update() { + var objects = window.report.representedObjects; + var items = $.map(objects, function(item, idx) { + return { name: item.name.valueOf(), country: item.country.name.valueOf() }; + }); + $('#overview').items('replace', items); +} \ No newline at end of file diff --git a/jscocoa/XCode Templates/JSCocoa Application/ApplicationController.h b/jscocoa/XCode Templates/JSCocoa Application/ApplicationController.h new file mode 100644 index 0000000..274c1a4 --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa Application/ApplicationController.h @@ -0,0 +1,18 @@ +// +// ApplicationController.h +// PROJECTNAME +// +// Created by FULLUSERNAME on DATE. +// Copyright ORGANIZATIONNAME YEAR. All rights reserved. +// + +#import +#import "JSCocoaController.h" + + +@interface ApplicationController : NSObject { + + id jsCocoaController; +} + +@end diff --git a/jscocoa/XCode Templates/JSCocoa Application/ApplicationController.m b/jscocoa/XCode Templates/JSCocoa Application/ApplicationController.m new file mode 100644 index 0000000..ea2d8f3 --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa Application/ApplicationController.m @@ -0,0 +1,31 @@ +// +// ApplicationController.m +// PROJECTNAME +// +// Created by FULLUSERNAME on DATE. +// Copyright ORGANIZATIONNAME YEAR. All rights reserved. +// + +#import "ApplicationController.h" + + +@implementation ApplicationController + +- (void)awakeFromNib +{ + jsCocoaController = [JSCocoaController sharedController]; + // Load class construction kit + id classJSFile = [NSString stringWithFormat:@"%@/Contents/Resources/class.js", [[NSBundle mainBundle] bundlePath]]; + [jsCocoaController evalJSFile:classJSFile]; + // Load our main class + id mainJSFile = [NSString stringWithFormat:@"%@/Contents/Resources/PROJECTNAME.js", [[NSBundle mainBundle] bundlePath]]; + [jsCocoaController evalJSFile:mainJSFile]; +} + +- (void)applicationWillTerminate:(NSNotification *)notification +{ + [jsCocoaController release]; +} + + +@end diff --git a/jscocoa/XCode Templates/JSCocoa Application/English.lproj/InfoPlist.strings b/jscocoa/XCode Templates/JSCocoa Application/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..5e45963 Binary files /dev/null and b/jscocoa/XCode Templates/JSCocoa Application/English.lproj/InfoPlist.strings differ diff --git a/jscocoa/XCode Templates/JSCocoa Application/English.lproj/MainMenu.xib b/jscocoa/XCode Templates/JSCocoa Application/English.lproj/MainMenu.xib new file mode 100644 index 0000000..f685682 --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa Application/English.lproj/MainMenu.xib @@ -0,0 +1,3064 @@ + + + + 1050 + 9F33 + 672 + 949.34 + 352.00 + + YES + + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + NewApplication + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + NewApplication + + YES + + + About NewApplication + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide NewApplication + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit NewApplication + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 15 + 2 + {{335, 390}, {480, 360}} + 1946157056 + Window + NSWindow + + {3.40282e+38, 3.40282e+38} + + + 256 + {480, 360} + + + {{0, 0}, {1440, 878}} + {3.40282e+38, 3.40282e+38} + + + NSFontManager + + + ApplicationController + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + alignLeft: + + + + 442 + + + + alignJustified: + + + + 443 + + + + copyRuler: + + + + 444 + + + + alignCenter: + + + + 445 + + + + toggleRuler: + + + + 446 + + + + alignRight: + + + + 447 + + + + pasteRuler: + + + + 448 + + + + terminate: + + + + 449 + + + + delegate + + + + 451 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 378 + + + YES + + + + + + 379 + + + YES + + + + + + + + + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + + + 387 + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBEditorWindowLastContentRect + 371.IBPluginDependency + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 371.windowTemplate.maxSize + 372.IBPluginDependency + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 450.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{187, 434}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{207, 285}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{335, 390}, {480, 360}} + com.apple.InterfaceBuilder.CocoaPlugin + {{335, 390}, {480, 360}} + + {{33, 99}, {480, 360}} + {3.40282e+38, 3.40282e+38} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{437, 242}, {86, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{523, 2}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{219, 102}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{145, 474}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 451 + + + + YES + + ApplicationController + NSObject + + IBProjectSource + ApplicationController.h + + + + + 0 + ../zzJSCocoaProject.xcodeproj + 3 + + diff --git a/jscocoa/XCode Templates/JSCocoa Application/Info.plist b/jscocoa/XCode Templates/JSCocoa Application/Info.plist new file mode 100644 index 0000000..612b7da --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa Application/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/jscocoa/XCode Templates/JSCocoa Application/JSCocoaApp.js b/jscocoa/XCode Templates/JSCocoa Application/JSCocoaApp.js new file mode 100644 index 0000000..cee9a49 --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa Application/JSCocoaApp.js @@ -0,0 +1,14 @@ + +// +// Put your Javascript code here. It will be called on application delegate's awakeFromNib. +// + + + log('Hello from JSCocoa !') + + var apps = NSWorkspace.sharedWorkspace.launchedApplications + log(apps.length + ' applications are running') + for (var i=0; i +#endif diff --git a/jscocoa/XCode Templates/JSCocoa Application/main.m b/jscocoa/XCode Templates/JSCocoa Application/main.m new file mode 100644 index 0000000..3f59385 --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa Application/main.m @@ -0,0 +1,14 @@ +// +// main.m +// PROJECTNAME +// +// Created by FULLUSERNAME on DATE. +// Copyright ORGANIZATIONNAME YEAR. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jscocoa/XCode Templates/JSCocoa/JSCocoa File.pbfiletemplate/TemplateInfo.plist b/jscocoa/XCode Templates/JSCocoa/JSCocoa File.pbfiletemplate/TemplateInfo.plist new file mode 100644 index 0000000..726dd76 --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa/JSCocoa File.pbfiletemplate/TemplateInfo.plist @@ -0,0 +1,5 @@ +{ + MainTemplateFile = "file.js"; + Description = "A blank JSCocoa file"; + TextFileEncoding = 4; +} \ No newline at end of file diff --git a/jscocoa/XCode Templates/JSCocoa/JSCocoa File.pbfiletemplate/file.js b/jscocoa/XCode Templates/JSCocoa/JSCocoa File.pbfiletemplate/file.js new file mode 100644 index 0000000..12e8999 --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa/JSCocoa File.pbfiletemplate/file.js @@ -0,0 +1,11 @@ +/* + «FILENAME» + «PROJECTNAME» + + Created by «FULLUSERNAME» on «DATE». + Copyright «YEAR» «ORGANIZATIONNAME». All rights reserved. + */ + + // Don't forget to load this file with evalJSFile + log('«FILENAME»') + \ No newline at end of file diff --git a/jscocoa/XCode Templates/JSCocoa/JSCocoa NSObject subclass.pbfiletemplate/TemplateInfo.plist b/jscocoa/XCode Templates/JSCocoa/JSCocoa NSObject subclass.pbfiletemplate/TemplateInfo.plist new file mode 100644 index 0000000..55e911d --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa/JSCocoa NSObject subclass.pbfiletemplate/TemplateInfo.plist @@ -0,0 +1,5 @@ +{ + MainTemplateFile = "file.js"; + Description = "A JSCocoa class which is a subclass of NSObject"; + TextFileEncoding = 4; +} \ No newline at end of file diff --git a/jscocoa/XCode Templates/JSCocoa/JSCocoa NSObject subclass.pbfiletemplate/file.js b/jscocoa/XCode Templates/JSCocoa/JSCocoa NSObject subclass.pbfiletemplate/file.js new file mode 100644 index 0000000..fb4d540 --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa/JSCocoa NSObject subclass.pbfiletemplate/file.js @@ -0,0 +1,16 @@ +/* + «FILENAME» + «PROJECTNAME» + + Created by «FULLUSERNAME» on «DATE». + Copyright «YEAR» «ORGANIZATIONNAME». All rights reserved. + */ + + Class('«FILEBASENAMEASIDENTIFIER» < NSObject').definition = function () + { + Method('awakeFromNib').fn = function () + { + log('«FILEBASENAMEASIDENTIFIER» awoke') + } + } + \ No newline at end of file diff --git a/jscocoa/XCode Templates/JSCocoa/JSCocoa NSView subclass.pbfiletemplate/TemplateInfo.plist b/jscocoa/XCode Templates/JSCocoa/JSCocoa NSView subclass.pbfiletemplate/TemplateInfo.plist new file mode 100644 index 0000000..8f4e1af --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa/JSCocoa NSView subclass.pbfiletemplate/TemplateInfo.plist @@ -0,0 +1,5 @@ +{ + MainTemplateFile = "file.js"; + Description = "A JSCocoa class which is a subclass of NSView"; + TextFileEncoding = 4; +} \ No newline at end of file diff --git a/jscocoa/XCode Templates/JSCocoa/JSCocoa NSView subclass.pbfiletemplate/file.js b/jscocoa/XCode Templates/JSCocoa/JSCocoa NSView subclass.pbfiletemplate/file.js new file mode 100644 index 0000000..39f41ff --- /dev/null +++ b/jscocoa/XCode Templates/JSCocoa/JSCocoa NSView subclass.pbfiletemplate/file.js @@ -0,0 +1,16 @@ +/* + «FILENAME» + «PROJECTNAME» + + Created by «FULLUSERNAME» on «DATE». + Copyright «YEAR» «ORGANIZATIONNAME». All rights reserved. + */ + + Class('«FILEBASENAMEASIDENTIFIER» < NSView').definition = function () + { + Method('drawRect:').fn = function () + { + log('«FILEBASENAMEASIDENTIFIER» drawRect') + } + } + \ No newline at end of file diff --git a/jscocoa/iPhone/Info.plist b/jscocoa/iPhone/Info.plist new file mode 100644 index 0000000..6e1421b --- /dev/null +++ b/jscocoa/iPhone/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + NSMainNibFile + MainWindow + + diff --git a/jscocoa/iPhone/JSBase.h b/jscocoa/iPhone/JSBase.h new file mode 100644 index 0000000..6f4ac66 --- /dev/null +++ b/jscocoa/iPhone/JSBase.h @@ -0,0 +1,112 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSBase_h +#define JSBase_h + +#include + +/* JavaScript engine interface */ + +/*! @typedef JSContextRef A JavaScript execution context. Holds the global object and other execution state. */ +typedef const struct OpaqueJSContext* JSContextRef; + +/*! @typedef JSGlobalContextRef A global JavaScript execution context. A JSGlobalContext is a JSContext. */ +typedef struct OpaqueJSContext* JSGlobalContextRef; + +/*! @typedef JSString A UTF16 character buffer. The fundamental string representation in JavaScript. */ +typedef struct OpaqueJSString* JSStringRef; + +/*! @typedef JSClassRef A JavaScript class. Used with JSObjectMake to construct objects with custom behavior. */ +typedef struct OpaqueJSClass* JSClassRef; + +/*! @typedef JSPropertyNameArrayRef An array of JavaScript property names. */ +typedef struct OpaqueJSPropertyNameArray* JSPropertyNameArrayRef; + +/*! @typedef JSPropertyNameAccumulatorRef An ordered set used to collect the names of a JavaScript object's properties. */ +typedef struct OpaqueJSPropertyNameAccumulator* JSPropertyNameAccumulatorRef; + + +/* JavaScript data types */ + +/*! @typedef JSValueRef A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them. */ +typedef const struct OpaqueJSValue* JSValueRef; + +/*! @typedef JSObjectRef A JavaScript object. A JSObject is a JSValue. */ +typedef struct OpaqueJSValue* JSObjectRef; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Script Evaluation */ + +/*! +@function +@abstract Evaluates a string of JavaScript. +@param ctx The execution context to use. +@param script A JSString containing the script to evaluate. +@param thisObject The object to use as "this," or NULL to use the global object as "this." +@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions. +@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSValue that results from evaluating script, or NULL if an exception is thrown. +*/ +JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); + +/*! +@function JSCheckScriptSyntax +@abstract Checks for syntax errors in a string of JavaScript. +@param ctx The execution context to use. +@param script A JSString containing the script to check for syntax errors. +@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions. +@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. +@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception. +@result true if the script is syntactically correct, otherwise false. +*/ +bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); + +/*! +@function +@abstract Performs a JavaScript garbage collection. +@param ctx This parameter is currently unused. Pass NULL. +@discussion JavaScript values that are on the machine stack, in a register, + protected by JSValueProtect, set as the global object of an execution context, + or reachable from any such value will not be collected. + + During JavaScript execution, you are not required to call this function; the + JavaScript engine will garbage collect as needed. One place you may want to call + this function, however, is after releasing the last reference to a JSGlobalContextRef. + At that point, a garbage collection can free the objects still referenced by the + JSGlobalContextRef's global object, along with the global object itself. +*/ +void JSGarbageCollect(JSContextRef ctx); + +#ifdef __cplusplus +} +#endif + +#endif // JSBase_h diff --git a/jscocoa/iPhone/JSContextRef.h b/jscocoa/iPhone/JSContextRef.h new file mode 100644 index 0000000..091f917 --- /dev/null +++ b/jscocoa/iPhone/JSContextRef.h @@ -0,0 +1,77 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSContextRef_h +#define JSContextRef_h + +#include "JSObjectRef.h" +#include "JSValueRef.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function +@abstract Creates a global JavaScript execution context. +@discussion JSGlobalContextCreate allocates a global object and populates it with all the + built-in JavaScript objects, such as Object, Function, String, and Array. +@param globalObjectClass The class to use when creating the global object. Pass + NULL to use the default object class. +@result A JSGlobalContext with a global object of class globalObjectClass. +*/ +JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass); + +/*! +@function +@abstract Retains a global JavaScript execution context. +@param ctx The JSGlobalContext to retain. +@result A JSGlobalContext that is the same as ctx. +*/ +JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx); + +/*! +@function +@abstract Releases a global JavaScript execution context. +@param ctx The JSGlobalContext to release. +*/ +void JSGlobalContextRelease(JSGlobalContextRef ctx); + +/*! +@function +@abstract Gets the global object of a JavaScript execution context. +@param ctx The JSContext whose global object you want to get. +@result ctx's global object. +*/ +JSObjectRef JSContextGetGlobalObject(JSContextRef ctx); + +#ifdef __cplusplus +} +#endif + +#endif // JSContextRef_h diff --git a/jscocoa/iPhone/JSObjectRef.h b/jscocoa/iPhone/JSObjectRef.h new file mode 100644 index 0000000..51611d2 --- /dev/null +++ b/jscocoa/iPhone/JSObjectRef.h @@ -0,0 +1,645 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSObjectRef_h +#define JSObjectRef_h + +#include "JSBase.h" +#include "JSValueRef.h" + +#include +#include // for size_t + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@enum JSPropertyAttribute +@constant kJSPropertyAttributeNone Specifies that a property has no special attributes. +@constant kJSPropertyAttributeReadOnly Specifies that a property is read-only. +@constant kJSPropertyAttributeDontEnum Specifies that a property should not be enumerated by JSPropertyEnumerators and JavaScript for...in loops. +@constant kJSPropertyAttributeDontDelete Specifies that the delete operation should fail on a property. +*/ +enum { + kJSPropertyAttributeNone = 0, + kJSPropertyAttributeReadOnly = 1 << 1, + kJSPropertyAttributeDontEnum = 1 << 2, + kJSPropertyAttributeDontDelete = 1 << 3 +}; + +/*! +@typedef JSPropertyAttributes +@abstract A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together. +*/ +typedef unsigned JSPropertyAttributes; + +/*! +@enum JSClassAttribute +@constant kJSClassAttributeNone Specifies that a class has no special attributes. +@constant kJSClassAttributeNoAutomaticPrototype Specifies that a class should not automatically generate a shared prototype for its instance objects. Use kJSClassAttributeNoAutomaticPrototype in combination with JSObjectSetPrototype to manage prototypes manually. +*/ +enum { + kJSClassAttributeNone = 0, + kJSClassAttributeNoAutomaticPrototype = 1 << 1 +}; + +/*! +@typedef JSClassAttributes +@abstract A set of JSClassAttributes. Combine multiple attributes by logically ORing them together. +*/ +typedef unsigned JSClassAttributes; + +/*! +@typedef JSObjectInitializeCallback +@abstract The callback invoked when an object is first created. +@param ctx The execution context to use. +@param object The JSObject being created. +@discussion If you named your function Initialize, you would declare it like this: + +void Initialize(JSContextRef ctx, JSObjectRef object); + +Unlike the other object callbacks, the initialize callback is called on the least +derived class (the parent class) first, and the most derived class last. +*/ +typedef void +(*JSObjectInitializeCallback) (JSContextRef ctx, JSObjectRef object); + +/*! +@typedef JSObjectFinalizeCallback +@abstract The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread. +@param object The JSObject being finalized. +@discussion If you named your function Finalize, you would declare it like this: + +void Finalize(JSObjectRef object); + +The finalize callback is called on the most derived class first, and the least +derived class (the parent class) last. + +You must not call any function that may cause a garbage collection or an allocation +of a garbage collected object from within a JSObjectFinalizeCallback. This includes +all functions that have a JSContextRef parameter. +*/ +typedef void +(*JSObjectFinalizeCallback) (JSObjectRef object); + +/*! +@typedef JSObjectHasPropertyCallback +@abstract The callback invoked when determining whether an object has a property. +@param ctx The execution context to use. +@param object The JSObject to search for the property. +@param propertyName A JSString containing the name of the property look up. +@result true if object has the property, otherwise false. +@discussion If you named your function HasProperty, you would declare it like this: + +bool HasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); + +If this function returns false, the hasProperty request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain. + +This callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value would be expensive. + +If this callback is NULL, the getProperty callback will be used to service hasProperty requests. +*/ +typedef bool +(*JSObjectHasPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); + +/*! +@typedef JSObjectGetPropertyCallback +@abstract The callback invoked when getting a property's value. +@param ctx The execution context to use. +@param object The JSObject to search for the property. +@param propertyName A JSString containing the name of the property to get. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result The property's value if object has the property, otherwise NULL. +@discussion If you named your function GetProperty, you would declare it like this: + +JSValueRef GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +If this function returns NULL, the get request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain. +*/ +typedef JSValueRef +(*JSObjectGetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@typedef JSObjectSetPropertyCallback +@abstract The callback invoked when setting a property's value. +@param ctx The execution context to use. +@param object The JSObject on which to set the property's value. +@param propertyName A JSString containing the name of the property to set. +@param value A JSValue to use as the property's value. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result true if the property was set, otherwise false. +@discussion If you named your function SetProperty, you would declare it like this: + +bool SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); + +If this function returns false, the set request forwards to object's statically declared properties, then its parent class chain (which includes the default object class). +*/ +typedef bool +(*JSObjectSetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); + +/*! +@typedef JSObjectDeletePropertyCallback +@abstract The callback invoked when deleting a property. +@param ctx The execution context to use. +@param object The JSObject in which to delete the property. +@param propertyName A JSString containing the name of the property to delete. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result true if propertyName was successfully deleted, otherwise false. +@discussion If you named your function DeleteProperty, you would declare it like this: + +bool DeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +If this function returns false, the delete request forwards to object's statically declared properties, then its parent class chain (which includes the default object class). +*/ +typedef bool +(*JSObjectDeletePropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@typedef JSObjectGetPropertyNamesCallback +@abstract The callback invoked when collecting the names of an object's properties. +@param ctx The execution context to use. +@param object The JSObject whose property names are being collected. +@param accumulator A JavaScript property name accumulator in which to accumulate the names of object's properties. +@discussion If you named your function GetPropertyNames, you would declare it like this: + +void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef accumulator); + +Property name accumulators are used by JSObjectCopyPropertyNames and JavaScript for...in loops. + +Use JSPropertyNameAccumulatorAddName to add property names to accumulator. A class's getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. Other properties, including statically declared properties, properties vended by other classes, and properties belonging to object's prototype, are added independently. +*/ +typedef void +(*JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); + +/*! +@typedef JSObjectCallAsFunctionCallback +@abstract The callback invoked when an object is called as a function. +@param ctx The execution context to use. +@param function A JSObject that is the function being called. +@param thisObject A JSObject that is the 'this' variable in the function's scope. +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of the arguments passed to the function. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result A JSValue that is the function's return value. +@discussion If you named your function CallAsFunction, you would declare it like this: + +JSValueRef CallAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +If your callback were invoked by the JavaScript expression 'myObject.myFunction()', function would be set to myFunction, and thisObject would be set to myObject. + +If this callback is NULL, calling your object as a function will throw an exception. +*/ +typedef JSValueRef +(*JSObjectCallAsFunctionCallback) (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@typedef JSObjectCallAsConstructorCallback +@abstract The callback invoked when an object is used as a constructor in a 'new' expression. +@param ctx The execution context to use. +@param constructor A JSObject that is the constructor being called. +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of the arguments passed to the function. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result A JSObject that is the constructor's return value. +@discussion If you named your function CallAsConstructor, you would declare it like this: + +JSObjectRef CallAsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +If your callback were invoked by the JavaScript expression 'new myConstructor()', constructor would be set to myConstructor. + +If this callback is NULL, using your object as a constructor in a 'new' expression will throw an exception. +*/ +typedef JSObjectRef +(*JSObjectCallAsConstructorCallback) (JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@typedef JSObjectHasInstanceCallback +@abstract hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. +@param ctx The execution context to use. +@param constructor The JSObject that is the target of the 'instanceof' expression. +@param possibleInstance The JSValue being tested to determine if it is an instance of constructor. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result true if possibleInstance is an instance of constructor, otherwise false. +@discussion If you named your function HasInstance, you would declare it like this: + +bool HasInstance(JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); + +If your callback were invoked by the JavaScript expression 'someValue instanceof myObject', constructor would be set to myObject and possibleInstance would be set to someValue. + +If this callback is NULL, 'instanceof' expressions that target your object will return false. + +Standard JavaScript practice calls for objects that implement the callAsConstructor callback to implement the hasInstance callback as well. +*/ +typedef bool +(*JSObjectHasInstanceCallback) (JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); + +/*! +@typedef JSObjectConvertToTypeCallback +@abstract The callback invoked when converting an object to a particular JavaScript type. +@param ctx The execution context to use. +@param object The JSObject to convert. +@param type A JSType specifying the JavaScript type to convert to. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result The objects's converted value, or NULL if the object was not converted. +@discussion If you named your function ConvertToType, you would declare it like this: + +JSValueRef ConvertToType(JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception); + +If this function returns false, the conversion request forwards to object's parent class chain (which includes the default object class). + +This function is only invoked when converting an object to number or string. An object converted to boolean is 'true.' An object converted to object is itself. +*/ +typedef JSValueRef +(*JSObjectConvertToTypeCallback) (JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception); + +/*! +@struct JSStaticValue +@abstract This structure describes a statically declared value property. +@field name A null-terminated UTF8 string containing the property's name. +@field getProperty A JSObjectGetPropertyCallback to invoke when getting the property's value. +@field setProperty A JSObjectSetPropertyCallback to invoke when setting the property's value. May be NULL if the ReadOnly attribute is set. +@field attributes A logically ORed set of JSPropertyAttributes to give to the property. +*/ +typedef struct { + const char* const name; + JSObjectGetPropertyCallback getProperty; + JSObjectSetPropertyCallback setProperty; + JSPropertyAttributes attributes; +} JSStaticValue; + +/*! +@struct JSStaticFunction +@abstract This structure describes a statically declared function property. +@field name A null-terminated UTF8 string containing the property's name. +@field callAsFunction A JSObjectCallAsFunctionCallback to invoke when the property is called as a function. +@field attributes A logically ORed set of JSPropertyAttributes to give to the property. +*/ +typedef struct { + const char* const name; + JSObjectCallAsFunctionCallback callAsFunction; + JSPropertyAttributes attributes; +} JSStaticFunction; + +/*! +@struct JSClassDefinition +@abstract This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL. +@field version The version number of this structure. The current version is 0. +@field attributes A logically ORed set of JSClassAttributes to give to the class. +@field className A null-terminated UTF8 string containing the class's name. +@field parentClass A JSClass to set as the class's parent class. Pass NULL use the default object class. +@field staticValues A JSStaticValue array containing the class's statically declared value properties. Pass NULL to specify no statically declared value properties. The array must be terminated by a JSStaticValue whose name field is NULL. +@field staticFunctions A JSStaticFunction array containing the class's statically declared function properties. Pass NULL to specify no statically declared function properties. The array must be terminated by a JSStaticFunction whose name field is NULL. +@field initialize The callback invoked when an object is first created. Use this callback to initialize the object. +@field finalize The callback invoked when an object is finalized (prepared for garbage collection). Use this callback to release resources allocated for the object, and perform other cleanup. +@field hasProperty The callback invoked when determining whether an object has a property. If this field is NULL, getProperty is called instead. The hasProperty callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value is expensive. +@field getProperty The callback invoked when getting a property's value. +@field setProperty The callback invoked when setting a property's value. +@field deleteProperty The callback invoked when deleting a property. +@field getPropertyNames The callback invoked when collecting the names of an object's properties. +@field callAsFunction The callback invoked when an object is called as a function. +@field hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. +@field callAsConstructor The callback invoked when an object is used as a constructor in a 'new' expression. +@field convertToType The callback invoked when converting an object to a particular JavaScript type. +@discussion The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties. Statically declared properties autmatically service requests like getProperty, setProperty, and getPropertyNames. Property access callbacks are required only to implement unusual properties, like array indexes, whose names are not known at compile-time. + +If you named your getter function "GetX" and your setter function "SetX", you would declare a JSStaticValue array containing "X" like this: + +JSStaticValue StaticValueArray[] = { + { "X", GetX, SetX, kJSPropertyAttributeNone }, + { 0, 0, 0, 0 } +}; + +Standard JavaScript practice calls for storing function objects in prototypes, so they can be shared. The default JSClass created by JSClassCreate follows this idiom, instantiating objects with a shared, automatically generating prototype containing the class's function objects. The kJSClassAttributeNoAutomaticPrototype attribute specifies that a JSClass should not automatically generate such a prototype. The resulting JSClass instantiates objects with the default object prototype, and gives each instance object its own copy of the class's function objects. + +A NULL callback specifies that the default object callback should substitute, except in the case of hasProperty, where it specifies that getProperty should substitute. +*/ +typedef struct { + int version; // current (and only) version is 0 + JSClassAttributes attributes; + + const char* className; + JSClassRef parentClass; + + const JSStaticValue* staticValues; + const JSStaticFunction* staticFunctions; + + JSObjectInitializeCallback initialize; + JSObjectFinalizeCallback finalize; + JSObjectHasPropertyCallback hasProperty; + JSObjectGetPropertyCallback getProperty; + JSObjectSetPropertyCallback setProperty; + JSObjectDeletePropertyCallback deleteProperty; + JSObjectGetPropertyNamesCallback getPropertyNames; + JSObjectCallAsFunctionCallback callAsFunction; + JSObjectCallAsConstructorCallback callAsConstructor; + JSObjectHasInstanceCallback hasInstance; + JSObjectConvertToTypeCallback convertToType; +} JSClassDefinition; + +/*! +@const kJSClassDefinitionEmpty +@abstract A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes. +@discussion Use this constant as a convenience when creating class definitions. For example, to create a class definition with only a finalize method: + +JSClassDefinition definition = kJSClassDefinitionEmpty; +definition.finalize = Finalize; +*/ +//extern const JSClassDefinition kJSClassDefinitionEmpty; + +/*! +@function +@abstract Creates a JavaScript class suitable for use with JSObjectMake. +@param definition A JSClassDefinition that defines the class. +@result A JSClass with the given definition. Ownership follows the Create Rule. +*/ +JSClassRef JSClassCreate(const JSClassDefinition* definition); + +/*! +@function +@abstract Retains a JavaScript class. +@param jsClass The JSClass to retain. +@result A JSClass that is the same as jsClass. +*/ +JSClassRef JSClassRetain(JSClassRef jsClass); + +/*! +@function +@abstract Releases a JavaScript class. +@param jsClass The JSClass to release. +*/ +void JSClassRelease(JSClassRef jsClass); + +/*! +@function +@abstract Creates a JavaScript object. +@param ctx The execution context to use. +@param jsClass The JSClass to assign to the object. Pass NULL to use the default object class. +@param data A void* to set as the object's private data. Pass NULL to specify no private data. +@result A JSObject with the given class and private data. +@discussion The default object class does not allocate storage for private data, so you must provide a non-NULL jsClass to JSObjectMake if you want your object to be able to store private data. + +data is set on the created object before the intialize methods in its class chain are called. This enables the initialize methods to retrieve and manipulate data through JSObjectGetPrivate. +*/ +JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data); + +/*! +@function +@abstract Convenience method for creating a JavaScript function with a given callback as its implementation. +@param ctx The execution context to use. +@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function. +@param callAsFunction The JSObjectCallAsFunctionCallback to invoke when the function is called. +@result A JSObject that is a function. The object's prototype will be the default function prototype. +*/ +JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction); + +/*! +@function +@abstract Convenience method for creating a JavaScript constructor. +@param ctx The execution context to use. +@param jsClass A JSClass that is the class your constructor will assign to the objects its constructs. jsClass will be used to set the constructor's .prototype property, and to evaluate 'instanceof' expressions. Pass NULL to use the default object class. +@param callAsConstructor A JSObjectCallAsConstructorCallback to invoke when your constructor is used in a 'new' expression. Pass NULL to use the default object constructor. +@result A JSObject that is a constructor. The object's prototype will be the default object prototype. +@discussion The default object constructor takes no arguments and constructs an object of class jsClass with no private data. +*/ +JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor); + +/*! +@function +@abstract Creates a function with a given script as its body. +@param ctx The execution context to use. +@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function. +@param parameterCount An integer count of the number of parameter names in parameterNames. +@param parameterNames A JSString array containing the names of the function's parameters. Pass NULL if parameterCount is 0. +@param body A JSString containing the script to use as the function's body. +@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions. +@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. +@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception. +@result A JSObject that is a function, or NULL if either body or parameterNames contains a syntax error. The object's prototype will be the default function prototype. +@discussion Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution. +*/ +JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); + +/*! +@function +@abstract Gets an object's prototype. +@param ctx The execution context to use. +@param object A JSObject whose prototype you want to get. +@result A JSValue that is the object's prototype. +*/ +JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Sets an object's prototype. +@param ctx The execution context to use. +@param object The JSObject whose prototype you want to set. +@param value A JSValue to set as the object's prototype. +*/ +void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value); + +/*! +@function +@abstract Tests whether an object has a given property. +@param object The JSObject to test. +@param propertyName A JSString containing the property's name. +@result true if the object has a property whose name matches propertyName, otherwise false. +*/ +bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); + +/*! +@function +@abstract Gets a property from an object. +@param ctx The execution context to use. +@param object The JSObject whose property you want to get. +@param propertyName A JSString containing the property's name. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The property's value if object has the property, otherwise the undefined value. +*/ +JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@function +@abstract Sets a property on an object. +@param ctx The execution context to use. +@param object The JSObject whose property you want to set. +@param propertyName A JSString containing the property's name. +@param value A JSValue to use as the property's value. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@param attributes A logically ORed set of JSPropertyAttributes to give to the property. +*/ +void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception); + +/*! +@function +@abstract Deletes a property from an object. +@param ctx The execution context to use. +@param object The JSObject whose property you want to delete. +@param propertyName A JSString containing the property's name. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set). +*/ +bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@function +@abstract Gets a property from an object by numeric index. +@param ctx The execution context to use. +@param object The JSObject whose property you want to get. +@param propertyIndex An integer value that is the property's name. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The property's value if object has the property, otherwise the undefined value. +@discussion Calling JSObjectGetPropertyAtIndex is equivalent to calling JSObjectGetProperty with a string containing propertyIndex, but JSObjectGetPropertyAtIndex provides optimized access to numeric properties. +*/ +JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception); + +/*! +@function +@abstract Sets a property on an object by numeric index. +@param ctx The execution context to use. +@param object The JSObject whose property you want to set. +@param propertyIndex The property's name as a number. +@param value A JSValue to use as the property's value. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@discussion Calling JSObjectSetPropertyAtIndex is equivalent to calling JSObjectSetProperty with a string containing propertyIndex, but JSObjectSetPropertyAtIndex provides optimized access to numeric properties. +*/ +void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception); + +/*! +@function +@abstract Gets an object's private data. +@param object A JSObject whose private data you want to get. +@result A void* that is the object's private data, if the object has private data, otherwise NULL. +*/ +void* JSObjectGetPrivate(JSObjectRef object); + +/*! +@function +@abstract Sets a pointer to private data on an object. +@param object The JSObject whose private data you want to set. +@param data A void* to set as the object's private data. +@result true if object can store private data, otherwise false. +@discussion The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private data. +*/ +bool JSObjectSetPrivate(JSObjectRef object, void* data); + +/*! +@function +@abstract Tests whether an object can be called as a function. +@param ctx The execution context to use. +@param object The JSObject to test. +@result true if the object can be called as a function, otherwise false. +*/ +bool JSObjectIsFunction(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Calls an object as a function. +@param ctx The execution context to use. +@param object The JSObject to call as a function. +@param thisObject The object to use as "this," or NULL to use the global object as "this." +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of arguments to pass to the function. Pass NULL if argumentCount is 0. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSValue that results from calling object as a function, or NULL if an exception is thrown or object is not a function. +*/ +JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@function +@abstract Tests whether an object can be called as a constructor. +@param ctx The execution context to use. +@param object The JSObject to test. +@result true if the object can be called as a constructor, otherwise false. +*/ +bool JSObjectIsConstructor(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Calls an object as a constructor. +@param ctx The execution context to use. +@param object The JSObject to call as a constructor. +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of arguments to pass to the constructor. Pass NULL if argumentCount is 0. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSObject that results from calling object as a constructor, or NULL if an exception is thrown or object is not a constructor. +*/ +JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@function +@abstract Gets the names of an object's enumerable properties. +@param ctx The execution context to use. +@param object The object whose property names you want to get. +@result A JSPropertyNameArray containing the names object's enumerable properties. +*/ +JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Retains a JavaScript property name array. +@param array The JSPropertyNameArray to retain. +@result A JSPropertyNameArray that is the same as array. +*/ +JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array); + +/*! +@function +@abstract Releases a JavaScript property name array. +@param array The JSPropetyNameArray to release. +*/ +void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array); + +/*! +@function +@abstract Gets a count of the number of items in a JavaScript property name array. +@param array The array from which to retrieve the count. +@result An integer count of the number of names in array. +*/ +size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array); + +/*! +@function +@abstract Gets a property name at a given index in a JavaScript property name array. +@param array The array from which to retrieve the property name. +@param index The index of the property name to retrieve. +@result A JSStringRef containing the property name. +*/ +JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index); + +/*! +@function +@abstract Adds a property name to a JavaScript property name accumulator. +@param accumulator The accumulator object to which to add the property name. +@param propertyName The property name to add. +*/ +void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName); + +#ifdef __cplusplus +} +#endif + +#endif // JSObjectRef_h diff --git a/jscocoa/iPhone/JSStringRef.h b/jscocoa/iPhone/JSStringRef.h new file mode 100644 index 0000000..25e0035 --- /dev/null +++ b/jscocoa/iPhone/JSStringRef.h @@ -0,0 +1,143 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSStringRef_h +#define JSStringRef_h + +#include "JSValueRef.h" + +#include +#include // for size_t + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@typedef JSChar +@abstract A Unicode character. +*/ +#if !defined(WIN32) && !defined(_WIN32) + typedef unsigned short JSChar; +#else + typedef wchar_t JSChar; +#endif + +/*! +@function +@abstract Creates a JavaScript string from a buffer of Unicode characters. +@param chars The buffer of Unicode characters to copy into the new JSString. +@param numChars The number of characters to copy from the buffer pointed to by chars. +@result A JSString containing chars. Ownership follows the Create Rule. +*/ +JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars); +/*! +@function +@abstract Creates a JavaScript string from a null-terminated UTF8 string. +@param string The null-terminated UTF8 string to copy into the new JSString. +@result A JSString containing string. Ownership follows the Create Rule. +*/ +JSStringRef JSStringCreateWithUTF8CString(const char* string); + +/*! +@function +@abstract Retains a JavaScript string. +@param string The JSString to retain. +@result A JSString that is the same as string. +*/ +JSStringRef JSStringRetain(JSStringRef string); +/*! +@function +@abstract Releases a JavaScript string. +@param string The JSString to release. +*/ +void JSStringRelease(JSStringRef string); + +/*! +@function +@abstract Returns the number of Unicode characters in a JavaScript string. +@param string The JSString whose length (in Unicode characters) you want to know. +@result The number of Unicode characters stored in string. +*/ +size_t JSStringGetLength(JSStringRef string); +/*! +@function +@abstract Returns a pointer to the Unicode character buffer that + serves as the backing store for a JavaScript string. +@param string The JSString whose backing store you want to access. +@result A pointer to the Unicode character buffer that serves as string's + backing store, which will be deallocated when string is deallocated. +*/ +const JSChar* JSStringGetCharactersPtr(JSStringRef string); + +/*! +@function +@abstract Returns the maximum number of bytes a JavaScript string will + take up if converted into a null-terminated UTF8 string. +@param string The JSString whose maximum converted size (in bytes) you + want to know. +@result The maximum number of bytes that could be required to convert string into a + null-terminated UTF8 string. The number of bytes that the conversion actually ends + up requiring could be less than this, but never more. +*/ +size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string); +/*! +@function +@abstract Converts a JavaScript string into a null-terminated UTF8 string, + and copies the result into an external byte buffer. +@param string The source JSString. +@param buffer The destination byte buffer into which to copy a null-terminated + UTF8 representation of string. On return, buffer contains a UTF8 string + representation of string. If bufferSize is too small, buffer will contain only + partial results. If buffer is not at least bufferSize bytes in size, + behavior is undefined. +@param bufferSize The size of the external buffer in bytes. +@result The number of bytes written into buffer (including the null-terminator byte). +*/ +size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize); + +/*! +@function +@abstract Tests whether two JavaScript strings match. +@param a The first JSString to test. +@param b The second JSString to test. +@result true if the two strings match, otherwise false. +*/ +bool JSStringIsEqual(JSStringRef a, JSStringRef b); +/*! +@function +@abstract Tests whether a JavaScript string matches a null-terminated UTF8 string. +@param a The JSString to test. +@param b The null-terminated UTF8 string to test. +@result true if the two strings match, otherwise false. +*/ +bool JSStringIsEqualToUTF8CString(JSStringRef a, const char* b); + +#ifdef __cplusplus +} +#endif + +#endif // JSStringRef_h diff --git a/jscocoa/iPhone/JSStringRefCF.h b/jscocoa/iPhone/JSStringRefCF.h new file mode 100644 index 0000000..eb9aefe --- /dev/null +++ b/jscocoa/iPhone/JSStringRefCF.h @@ -0,0 +1,61 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + * Copyright (C) 2006, 2007 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSStringRefCF_h +#define JSStringRefCF_h + +#include "JSBase.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// CFString convenience methods + +/*! +@function +@abstract Creates a JavaScript string from a CFString. +@discussion This function is optimized to take advantage of cases when + CFStringGetCharactersPtr returns a valid pointer. +@param string The CFString to copy into the new JSString. +@result A JSString containing string. Ownership follows the Create Rule. +*/ +JSStringRef JSStringCreateWithCFString(CFStringRef string); +/*! +@function +@abstract Creates a CFString from a JavaScript string. +@param alloc The alloc parameter to pass to CFStringCreate. +@param string The JSString to copy into the new CFString. +@result A CFString containing string. Ownership follows the Create Rule. +*/ +CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string); + +#ifdef __cplusplus +} +#endif + +#endif // JSStringRefCF_h diff --git a/jscocoa/iPhone/JSValueRef.h b/jscocoa/iPhone/JSValueRef.h new file mode 100644 index 0000000..88036f8 --- /dev/null +++ b/jscocoa/iPhone/JSValueRef.h @@ -0,0 +1,277 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSValueRef_h +#define JSValueRef_h + +#include "JSBase.h" + +#include + +/*! +@enum JSType +@abstract A constant identifying the type of a JSValue. +@constant kJSTypeUndefined The unique undefined value. +@constant kJSTypeNull The unique null value. +@constant kJSTypeBoolean A primitive boolean value, one of true or false. +@constant kJSTypeNumber A primitive number value. +@constant kJSTypeString A primitive string value. +@constant kJSTypeObject An object value (meaning that this JSValueRef is a JSObjectRef). +*/ +typedef enum { + kJSTypeUndefined, + kJSTypeNull, + kJSTypeBoolean, + kJSTypeNumber, + kJSTypeString, + kJSTypeObject +} JSType; + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function +@abstract Returns a JavaScript value's type. +@param ctx The execution context to use. +@param value The JSValue whose type you want to obtain. +@result A value of type JSType that identifies value's type. +*/ +JSType JSValueGetType(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the undefined type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the undefined type, otherwise false. +*/ +bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the null type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the null type, otherwise false. +*/ +bool JSValueIsNull(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the boolean type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the boolean type, otherwise false. +*/ +bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the number type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the number type, otherwise false. +*/ +bool JSValueIsNumber(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the string type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the string type, otherwise false. +*/ +bool JSValueIsString(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the object type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the object type, otherwise false. +*/ +bool JSValueIsObject(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value is an object with a given class in its class chain. +@param ctx The execution context to use. +@param value The JSValue to test. +@param jsClass The JSClass to test against. +@result true if value is an object and has jsClass in its class chain, otherwise false. +*/ +bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass); + +// Comparing values + +/*! +@function +@abstract Tests whether two JavaScript values are equal, as compared by the JS == operator. +@param ctx The execution context to use. +@param a The first value to test. +@param b The second value to test. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result true if the two values are equal, false if they are not equal or an exception is thrown. +*/ +bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception); + +/*! +@function +@abstract Tests whether two JavaScript values are strict equal, as compared by the JS === operator. +@param ctx The execution context to use. +@param a The first value to test. +@param b The second value to test. +@result true if the two values are strict equal, otherwise false. +*/ +bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b); + +/*! +@function +@abstract Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator. +@param ctx The execution context to use. +@param value The JSValue to test. +@param object The constructor to test against. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false. +*/ +bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception); + +// Creating values + +/*! +@function +@abstract Creates a JavaScript value of the undefined type. +@param ctx The execution context to use. +@result The unique undefined value. +*/ +JSValueRef JSValueMakeUndefined(JSContextRef ctx); + +/*! +@function +@abstract Creates a JavaScript value of the null type. +@param ctx The execution context to use. +@result The unique null value. +*/ +JSValueRef JSValueMakeNull(JSContextRef ctx); + +/*! +@function +@abstract Creates a JavaScript value of the boolean type. +@param ctx The execution context to use. +@param boolean The bool to assign to the newly created JSValue. +@result A JSValue of the boolean type, representing the value of boolean. +*/ +JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool boolean); + +/*! +@function +@abstract Creates a JavaScript value of the number type. +@param ctx The execution context to use. +@param number The double to assign to the newly created JSValue. +@result A JSValue of the number type, representing the value of number. +*/ +JSValueRef JSValueMakeNumber(JSContextRef ctx, double number); + +/*! +@function +@abstract Creates a JavaScript value of the string type. +@param ctx The execution context to use. +@param string The JSString to assign to the newly created JSValue. The + newly created JSValue retains string, and releases it upon garbage collection. +@result A JSValue of the string type, representing the value of string. +*/ +JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string); + +// Converting to primitive values + +/*! +@function +@abstract Converts a JavaScript value to boolean and returns the resulting boolean. +@param ctx The execution context to use. +@param value The JSValue to convert. +@result The boolean result of conversion. +*/ +bool JSValueToBoolean(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Converts a JavaScript value to number and returns the resulting number. +@param ctx The execution context to use. +@param value The JSValue to convert. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The numeric result of conversion, or NaN if an exception is thrown. +*/ +double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception); + +/*! +@function +@abstract Converts a JavaScript value to string and copies the result into a JavaScript string. +@param ctx The execution context to use. +@param value The JSValue to convert. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule. +*/ +JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception); + +/*! +@function +@abstract Converts a JavaScript value to object and returns the resulting object. +@param ctx The execution context to use. +@param value The JSValue to convert. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSObject result of conversion, or NULL if an exception is thrown. +*/ +JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception); + +// Garbage collection +/*! +@function +@abstract Protects a JavaScript value from garbage collection. +@param ctx The execution context to use. +@param value The JSValue to protect. +@discussion Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it. + +A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection. +*/ +void JSValueProtect(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Unprotects a JavaScript value from garbage collection. +@param ctx The execution context to use. +@param value The JSValue to unprotect. +@discussion A value may be protected multiple times and must be unprotected an + equal number of times before becoming eligible for garbage collection. +*/ +void JSValueUnprotect(JSContextRef ctx, JSValueRef value); + +#ifdef __cplusplus +} +#endif + +#endif // JSValueRef_h diff --git a/jscocoa/iPhone/JavaScriptCore.h b/jscocoa/iPhone/JavaScriptCore.h new file mode 100644 index 0000000..9a4e2b3 --- /dev/null +++ b/jscocoa/iPhone/JavaScriptCore.h @@ -0,0 +1,37 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JavaScriptCore_h +#define JavaScriptCore_h + +#include "JSBase.h" +#include "JSContextRef.h" +#include "JSStringRef.h" +#include "JSStringRefCF.h" +#include "JSObjectRef.h" +#include "JSValueRef.h" + +#endif // JavaScriptCore_h diff --git a/jscocoa/iPhone/JavascriptCore-dlsym.h b/jscocoa/iPhone/JavascriptCore-dlsym.h new file mode 100644 index 0000000..1dc98bb --- /dev/null +++ b/jscocoa/iPhone/JavascriptCore-dlsym.h @@ -0,0 +1,17 @@ +// +// JavascriptCore-dlsym.h +// iPhoneTest +// +// Created by Patrick Geiller on 11/10/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface JSCocoaSymbolFetcher : NSObject { +} + ++ (void)populateJavascriptCoreSymbols; + +@end \ No newline at end of file diff --git a/jscocoa/iPhone/JavascriptCore-dlsym.m b/jscocoa/iPhone/JavascriptCore-dlsym.m new file mode 100644 index 0000000..bc86c80 --- /dev/null +++ b/jscocoa/iPhone/JavascriptCore-dlsym.m @@ -0,0 +1,525 @@ +// +// JavascriptCore-dlsym.m +// iPhoneTest +// +// Created by Patrick Geiller on 11/10/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "JavascriptCore-dlsym.h" + + + +// +// JSBase +// +JSValueRef (*_JSEvaluateScript)(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); +JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) +{ + return _JSEvaluateScript(ctx, script, thisObject, sourceURL, startingLineNumber, exception); +} + +void (*_JSGarbageCollect)(JSContextRef ctx); +void JSGarbageCollect(JSContextRef ctx) +{ + return _JSGarbageCollect(ctx); +} + +bool (*_JSCheckScriptSyntax)(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); +bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) +{ + return _JSCheckScriptSyntax(ctx, script, sourceURL, startingLineNumber, exception); +} + + +// +// JSContextRef +// +JSGlobalContextRef (*_JSGlobalContextCreate)(JSClassRef globalObjectClass); +JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) +{ + return _JSGlobalContextCreate(globalObjectClass); +} + +JSGlobalContextRef (*_JSGlobalContextRetain)(JSGlobalContextRef ctx); +JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx) +{ + return _JSGlobalContextRetain(ctx); +} + +void (*_JSGlobalContextRelease)(JSGlobalContextRef ctx); +void JSGlobalContextRelease(JSGlobalContextRef ctx) +{ + _JSGlobalContextRelease(ctx); +} + +JSObjectRef (*_JSContextGetGlobalObject)(JSContextRef ctx); +JSObjectRef JSContextGetGlobalObject(JSContextRef ctx) +{ + return _JSContextGetGlobalObject(ctx); +} + + +// +// JSObjectRef +// +JSClassRef (*_JSClassCreate)(const JSClassDefinition* definition); +JSClassRef JSClassCreate(const JSClassDefinition* definition) +{ + return _JSClassCreate(definition); +} + +JSClassRef (*_JSClassRetain)(JSClassRef jsClass); +JSClassRef JSClassRetain(JSClassRef jsClass) +{ + return _JSClassRetain(jsClass); +} + +void (*_JSClassRelease)(JSClassRef jsClass); +void JSClassRelease(JSClassRef jsClass) +{ + _JSClassRelease(jsClass); +} + +JSObjectRef (*_JSObjectMake)(JSContextRef ctx, JSClassRef jsClass, void* data); +JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data) +{ + return _JSObjectMake(ctx, jsClass, data); +} + +JSObjectRef (*_JSObjectMakeFunctionWithCallback)(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction); +JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction) +{ + return _JSObjectMakeFunctionWithCallback(ctx, name, callAsFunction); +} + +JSObjectRef (*_JSObjectMakeConstructor)(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor); +JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor) +{ + return _JSObjectMakeConstructor(ctx, jsClass, callAsConstructor); +} + +JSObjectRef (*_JSObjectMakeFunction)(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); +JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) +{ + return _JSObjectMakeFunction(ctx, name, parameterCount, parameterNames, body, sourceURL, startingLineNumber, exception); +} + +JSValueRef (*_JSObjectGetPrototype)(JSContextRef ctx, JSObjectRef object); +JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object) +{ + return _JSObjectGetPrototype(ctx, object); +} + +void (*_JSObjectSetPrototype)(JSContextRef ctx, JSObjectRef object, JSValueRef value); +void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value) +{ + _JSObjectSetPrototype(ctx, object, value); +} + +bool (*_JSObjectHasProperty)(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); +bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) +{ + return _JSObjectHasProperty(ctx, object, propertyName); +} + +JSValueRef (*_JSObjectGetProperty)(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); +JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) +{ + return _JSObjectGetProperty(ctx, object, propertyName, exception); +} + +void (*_JSObjectSetProperty)(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception); +void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception) +{ + _JSObjectSetProperty(ctx, object, propertyName, value, attributes, exception); +} + +bool (*_JSObjectDeleteProperty)(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); +bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) +{ + return _JSObjectDeleteProperty(ctx, object, propertyName, exception); +} + +JSValueRef (*_JSObjectGetPropertyAtIndex)(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception); +JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception) +{ + return _JSObjectGetPropertyAtIndex(ctx, object, propertyIndex, exception); +} + +void (*_JSObjectSetPropertyAtIndex)(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception); +void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception) +{ + _JSObjectSetPropertyAtIndex(ctx, object, propertyIndex, value, exception); +} + +void* (*_JSObjectGetPrivate)(JSObjectRef object); +void* JSObjectGetPrivate(JSObjectRef object) +{ + return _JSObjectGetPrivate(object); +} + +bool (*_JSObjectSetPrivate)(JSObjectRef object, void* data); +bool JSObjectSetPrivate(JSObjectRef object, void* data) +{ + return _JSObjectSetPrivate(object, data); +} + +bool (*_JSObjectIsFunction)(JSContextRef ctx, JSObjectRef object); +bool JSObjectIsFunction(JSContextRef ctx, JSObjectRef object) +{ + return _JSObjectIsFunction(ctx, object); +} + +JSValueRef (*_JSObjectCallAsFunction)(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); +JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return _JSObjectCallAsFunction(ctx, object, thisObject, argumentCount, arguments, exception); +} + +bool (*_JSObjectIsConstructor)(JSContextRef ctx, JSObjectRef object); +bool JSObjectIsConstructor(JSContextRef ctx, JSObjectRef object) +{ + return _JSObjectIsConstructor(ctx, object); +} + +JSObjectRef (*_JSObjectCallAsConstructor)(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); +JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + return _JSObjectCallAsConstructor(ctx, object, argumentCount, arguments, exception); +} + +JSPropertyNameArrayRef (*_JSObjectCopyPropertyNames)(JSContextRef ctx, JSObjectRef object); +JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object) +{ + return _JSObjectCopyPropertyNames(ctx, object); +} + +JSPropertyNameArrayRef (*_JSPropertyNameArrayRetain)(JSPropertyNameArrayRef array); +JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array) +{ + return _JSPropertyNameArrayRetain(array); +} + +void (*_JSPropertyNameArrayRelease)(JSPropertyNameArrayRef array); +void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array) +{ + _JSPropertyNameArrayRelease(array); +} + +size_t (*_JSPropertyNameArrayGetCount)(JSPropertyNameArrayRef array); +size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array) +{ + return _JSPropertyNameArrayGetCount(array); +} + +JSStringRef (*_JSPropertyNameArrayGetNameAtIndex)(JSPropertyNameArrayRef array, size_t index); +JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index) +{ + return _JSPropertyNameArrayGetNameAtIndex(array, index); +} + +void (*_JSPropertyNameAccumulatorAddName)(JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName); +void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName) +{ + _JSPropertyNameAccumulatorAddName(accumulator, propertyName); +} + + +// +// JSStringRef +// +JSStringRef (*_JSStringCreateWithCharacters)(const JSChar* chars, size_t numChars); +JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars) +{ + return _JSStringCreateWithCharacters(chars, numChars); +} + +JSStringRef (*_JSStringCreateWithUTF8CString)(const char* string); +JSStringRef JSStringCreateWithUTF8CString(const char* string) +{ + return _JSStringCreateWithUTF8CString(string); +} + +JSStringRef (*_JSStringRetain)(JSStringRef string); +JSStringRef JSStringRetain(JSStringRef string) +{ + return _JSStringRetain(string); +} + +void (*_JSStringRelease)(JSStringRef string); +void JSStringRelease(JSStringRef string) +{ + _JSStringRelease(string); +} + +size_t (*_JSStringGetLength)(JSStringRef string); +size_t JSStringGetLength(JSStringRef string) +{ + return _JSStringGetLength(string); +} + +const JSChar* (*_JSStringGetCharactersPtr)(JSStringRef string); +const JSChar* JSStringGetCharactersPtr(JSStringRef string) +{ + return _JSStringGetCharactersPtr(string); +} + +size_t (*_JSStringGetMaximumUTF8CStringSize)(JSStringRef string); +size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string) +{ + return _JSStringGetMaximumUTF8CStringSize(string); +} + +size_t (*_JSStringGetUTF8CString)(JSStringRef string, char* buffer, size_t bufferSize); +size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize) +{ + return _JSStringGetUTF8CString(string, buffer, bufferSize); +} + + +bool (*_JSStringIsEqual)(JSStringRef a, JSStringRef b); +bool JSStringIsEqual(JSStringRef a, JSStringRef b) +{ + return _JSStringIsEqual(a, b); +} + +bool (*_JSStringIsEqualToUTF8CString)(JSStringRef a, const char* b); +bool JSStringIsEqualToUTF8CString(JSStringRef a, const char* b) +{ + return _JSStringIsEqualToUTF8CString(a, b); +} + + +// +// JSStringRefCF +// +JSStringRef (*_JSStringCreateWithCFString)(CFStringRef string); +JSStringRef JSStringCreateWithCFString(CFStringRef string) +{ + return _JSStringCreateWithCFString(string); +} + +CFStringRef (*_JSStringCopyCFString)(CFAllocatorRef alloc, JSStringRef string); +CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string) +{ + return _JSStringCopyCFString(alloc, string); +} + + +// +// JSValueRef +// +JSType (*_JSValueGetType)(JSContextRef ctx, JSValueRef value); +JSType JSValueGetType(JSContextRef ctx, JSValueRef value) +{ + return _JSValueGetType(ctx, value); +} + +bool (*_JSValueIsUndefined)(JSContextRef ctx, JSValueRef value); +bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value) +{ + return _JSValueIsUndefined(ctx, value); +} + +bool (*_JSValueIsNull)(JSContextRef ctx, JSValueRef value); +bool JSValueIsNull(JSContextRef ctx, JSValueRef value) +{ + return _JSValueIsNull(ctx, value); +} + +bool (*_JSValueIsBoolean)(JSContextRef ctx, JSValueRef value); +bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value) +{ + return _JSValueIsBoolean(ctx, value); +} + +bool (*_JSValueIsNumber)(JSContextRef ctx, JSValueRef value); +bool JSValueIsNumber(JSContextRef ctx, JSValueRef value) +{ + return _JSValueIsNumber(ctx, value); +} + +bool (*_JSValueIsString)(JSContextRef ctx, JSValueRef value); +bool JSValueIsString(JSContextRef ctx, JSValueRef value) +{ + return _JSValueIsString(ctx, value); +} + +bool (*_JSValueIsObject)(JSContextRef ctx, JSValueRef value); +bool JSValueIsObject(JSContextRef ctx, JSValueRef value) +{ + return _JSValueIsObject(ctx, value); +} + +bool (*_JSValueIsObjectOfClass)(JSContextRef ctx, JSValueRef value, JSClassRef jsClass); +bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass) +{ + return _JSValueIsObjectOfClass(ctx, value, jsClass); +} + +bool (*_JSValueIsEqual)(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception); +bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception) +{ + return _JSValueIsEqual(ctx, a, b, exception); +} + +bool (*_JSValueIsStrictEqual)(JSContextRef ctx, JSValueRef a, JSValueRef b); +bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b) +{ + return _JSValueIsStrictEqual(ctx, a, b); +} + +bool (*_JSValueIsInstanceOfConstructor)(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception); +bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception) +{ + return _JSValueIsInstanceOfConstructor(ctx, value, constructor, exception); +} + +JSValueRef (*_JSValueMakeUndefined)(JSContextRef ctx); +JSValueRef JSValueMakeUndefined(JSContextRef ctx) +{ + return _JSValueMakeUndefined(ctx); +} + +JSValueRef (*_JSValueMakeNull)(JSContextRef ctx); +JSValueRef JSValueMakeNull(JSContextRef ctx) +{ + return _JSValueMakeNull(ctx); +} + +JSValueRef (*_JSValueMakeBoolean)(JSContextRef ctx, bool boolean); +JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool boolean) +{ + return _JSValueMakeBoolean(ctx, boolean); +} + +JSValueRef (*_JSValueMakeNumber)(JSContextRef ctx, double number); +JSValueRef JSValueMakeNumber(JSContextRef ctx, double number) +{ + return _JSValueMakeNumber(ctx, number); +} + +JSValueRef (*_JSValueMakeString)(JSContextRef ctx, JSStringRef string); +JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string) +{ + return _JSValueMakeString(ctx, string); +} + +bool (*_JSValueToBoolean)(JSContextRef ctx, JSValueRef value); +bool JSValueToBoolean(JSContextRef ctx, JSValueRef value) +{ + return _JSValueToBoolean(ctx, value); +} + +double (*_JSValueToNumber)(JSContextRef ctx, JSValueRef value, JSValueRef* exception); +double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception) +{ + return _JSValueToNumber(ctx, value, exception); +} + +JSStringRef (*_JSValueToStringCopy)(JSContextRef ctx, JSValueRef value, JSValueRef* exception); +JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception) +{ + return _JSValueToStringCopy(ctx, value, exception); +} + +JSObjectRef (*_JSValueToObject)(JSContextRef ctx, JSValueRef value, JSValueRef* exception); +JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception) +{ + return _JSValueToObject(ctx, value, exception); +} + +void (*_JSValueProtect)(JSContextRef ctx, JSValueRef value); +void JSValueProtect(JSContextRef ctx, JSValueRef value) +{ + _JSValueProtect(ctx, value); +} + +void (*_JSValueUnprotect)(JSContextRef ctx, JSValueRef value); +void JSValueUnprotect(JSContextRef ctx, JSValueRef value) +{ + _JSValueUnprotect(ctx, value); +} + + + + + + + + +#include +@implementation JSCocoaSymbolFetcher ++ (void)populateJavascriptCoreSymbols +{ + _JSEvaluateScript = dlsym(RTLD_DEFAULT, "JSEvaluateScript"); + _JSCheckScriptSyntax = dlsym(RTLD_DEFAULT, "JSCheckScriptSyntax"); + _JSGarbageCollect = dlsym(RTLD_DEFAULT, "JSGarbageCollect"); + _JSGlobalContextCreate = dlsym(RTLD_DEFAULT, "JSGlobalContextCreate"); + _JSGlobalContextRetain = dlsym(RTLD_DEFAULT, "JSGlobalContextRetain"); + _JSGlobalContextRelease = dlsym(RTLD_DEFAULT, "JSGlobalContextRelease"); + _JSContextGetGlobalObject = dlsym(RTLD_DEFAULT, "JSContextGetGlobalObject"); + _JSClassCreate = dlsym(RTLD_DEFAULT, "JSClassCreate"); + _JSClassRetain = dlsym(RTLD_DEFAULT, "JSClassRetain"); + _JSClassRelease = dlsym(RTLD_DEFAULT, "JSClassRelease"); + _JSObjectMake = dlsym(RTLD_DEFAULT, "JSObjectMake"); + _JSObjectMakeFunctionWithCallback = dlsym(RTLD_DEFAULT, "JSObjectMakeFunctionWithCallback"); + _JSObjectMakeConstructor = dlsym(RTLD_DEFAULT, "JSObjectMakeConstructor"); + _JSObjectMakeFunction = dlsym(RTLD_DEFAULT, "JSObjectMakeFunction"); + _JSObjectGetPrototype = dlsym(RTLD_DEFAULT, "JSObjectGetPrototype"); + _JSObjectSetPrototype = dlsym(RTLD_DEFAULT, "JSObjectSetPrototype"); + _JSObjectHasProperty = dlsym(RTLD_DEFAULT, "JSObjectHasProperty"); + _JSObjectGetProperty = dlsym(RTLD_DEFAULT, "JSObjectGetProperty"); + _JSObjectSetProperty = dlsym(RTLD_DEFAULT, "JSObjectSetProperty"); + _JSObjectDeleteProperty = dlsym(RTLD_DEFAULT, "JSObjectDeleteProperty"); + _JSObjectGetPropertyAtIndex = dlsym(RTLD_DEFAULT, "JSObjectGetPropertyAtIndex"); + _JSObjectSetPropertyAtIndex = dlsym(RTLD_DEFAULT, "JSObjectSetPropertyAtIndex"); + _JSObjectGetPrivate = dlsym(RTLD_DEFAULT, "JSObjectGetPrivate"); + _JSObjectSetPrivate = dlsym(RTLD_DEFAULT, "JSObjectSetPrivate"); + _JSObjectIsFunction = dlsym(RTLD_DEFAULT, "JSObjectIsFunction"); + _JSObjectCallAsFunction = dlsym(RTLD_DEFAULT, "JSObjectCallAsFunction"); + _JSObjectIsConstructor = dlsym(RTLD_DEFAULT, "JSObjectIsConstructor"); + _JSObjectCallAsConstructor = dlsym(RTLD_DEFAULT, "JSObjectCallAsConstructor"); + _JSObjectCopyPropertyNames = dlsym(RTLD_DEFAULT, "JSObjectCopyPropertyNames"); + _JSPropertyNameArrayRetain = dlsym(RTLD_DEFAULT, "JSPropertyNameArrayRetain"); + _JSPropertyNameArrayRelease = dlsym(RTLD_DEFAULT, "JSPropertyNameArrayRelease"); + _JSPropertyNameArrayGetCount = dlsym(RTLD_DEFAULT, "JSPropertyNameArrayGetCount"); + _JSPropertyNameArrayGetNameAtIndex = dlsym(RTLD_DEFAULT, "JSPropertyNameArrayGetNameAtIndex"); + _JSPropertyNameAccumulatorAddName = dlsym(RTLD_DEFAULT, "JSPropertyNameAccumulatorAddName"); + _JSStringCreateWithCharacters = dlsym(RTLD_DEFAULT, "JSStringCreateWithCharacters"); + _JSStringCreateWithUTF8CString = dlsym(RTLD_DEFAULT, "JSStringCreateWithUTF8CString"); + _JSStringRetain = dlsym(RTLD_DEFAULT, "JSStringRetain"); + _JSStringRelease = dlsym(RTLD_DEFAULT, "JSStringRelease"); + _JSStringGetLength = dlsym(RTLD_DEFAULT, "JSStringGetLength"); + _JSStringGetCharactersPtr = dlsym(RTLD_DEFAULT, "JSStringGetCharactersPtr"); + _JSStringGetMaximumUTF8CStringSize = dlsym(RTLD_DEFAULT, "JSStringGetMaximumUTF8CStringSize"); + _JSStringGetUTF8CString = dlsym(RTLD_DEFAULT, "JSStringGetUTF8CString"); + _JSStringIsEqual = dlsym(RTLD_DEFAULT, "JSStringIsEqual"); + _JSStringIsEqualToUTF8CString = dlsym(RTLD_DEFAULT, "JSStringIsEqualToUTF8CString"); + _JSStringCreateWithCFString = dlsym(RTLD_DEFAULT, "JSStringCreateWithCFString"); + _JSStringCopyCFString = dlsym(RTLD_DEFAULT, "JSStringCopyCFString"); + _JSValueGetType = dlsym(RTLD_DEFAULT, "JSValueGetType"); + _JSValueIsUndefined = dlsym(RTLD_DEFAULT, "JSValueIsUndefined"); + _JSValueIsNull = dlsym(RTLD_DEFAULT, "JSValueIsNull"); + _JSValueIsBoolean = dlsym(RTLD_DEFAULT, "JSValueIsBoolean"); + _JSValueIsNumber = dlsym(RTLD_DEFAULT, "JSValueIsNumber"); + _JSValueIsString = dlsym(RTLD_DEFAULT, "JSValueIsString"); + _JSValueIsObject = dlsym(RTLD_DEFAULT, "JSValueIsObject"); + _JSValueIsObjectOfClass = dlsym(RTLD_DEFAULT, "JSValueIsObjectOfClass"); + _JSValueIsEqual = dlsym(RTLD_DEFAULT, "JSValueIsEqual"); + _JSValueIsStrictEqual = dlsym(RTLD_DEFAULT, "JSValueIsStrictEqual"); + _JSValueIsInstanceOfConstructor = dlsym(RTLD_DEFAULT, "JSValueIsInstanceOfConstructor"); + _JSValueMakeUndefined = dlsym(RTLD_DEFAULT, "JSValueMakeUndefined"); + _JSValueMakeNull = dlsym(RTLD_DEFAULT, "JSValueMakeNull"); + _JSValueMakeBoolean = dlsym(RTLD_DEFAULT, "JSValueMakeBoolean"); + _JSValueMakeNumber = dlsym(RTLD_DEFAULT, "JSValueMakeNumber"); + _JSValueMakeString = dlsym(RTLD_DEFAULT, "JSValueMakeString"); + _JSValueToBoolean = dlsym(RTLD_DEFAULT, "JSValueToBoolean"); + _JSValueToNumber = dlsym(RTLD_DEFAULT, "JSValueToNumber"); + _JSValueToStringCopy = dlsym(RTLD_DEFAULT, "JSValueToStringCopy"); + _JSValueToObject = dlsym(RTLD_DEFAULT, "JSValueToObject"); + _JSValueProtect = dlsym(RTLD_DEFAULT, "JSValueProtect"); + _JSValueUnprotect = dlsym(RTLD_DEFAULT, "JSValueUnprotect"); +} +@end diff --git a/jscocoa/iPhone/MainWindow.xib b/jscocoa/iPhone/MainWindow.xib new file mode 100644 index 0000000..aee2cd6 --- /dev/null +++ b/jscocoa/iPhone/MainWindow.xib @@ -0,0 +1,179 @@ + + + + 528 + 9F33 + 672 + 949.34 + 352.00 + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + IBFilesOwner + + + IBFirstResponder + + + + iPhoneTest2ViewController + + 2 + + + + + 292 + {320, 480} + + 1 + MSAxIDEAA + + NO + NO + + + + + + YES + + + delegate + + + + 4 + + + + viewController + + + + 11 + + + + window + + + + 14 + + + + + YES + + 0 + + YES + + + + + + -1 + + + RmlsZSdzIE93bmVyA + + + 3 + + + iPhoneTest2 App Delegate + + + -2 + + + + + 10 + + + + + 12 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 10.CustomClassName + 10.IBEditorWindowLastContentRect + 10.IBPluginDependency + 12.IBEditorWindowLastContentRect + 12.IBPluginDependency + 3.CustomClassName + 3.IBPluginDependency + + + YES + UIApplication + UIResponder + iPhoneTest2ViewController + {{787, 277}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{525, 346}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + iPhoneTest2AppDelegate + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 14 + + + + YES + + iPhoneTest2AppDelegate + NSObject + + IBUserSource + + + + + + 0 + iPhoneTest2.xcodeproj + 3 + + diff --git a/jscocoa/iPhone/hiPointCount.png b/jscocoa/iPhone/hiPointCount.png new file mode 100644 index 0000000..4446d54 Binary files /dev/null and b/jscocoa/iPhone/hiPointCount.png differ diff --git a/jscocoa/iPhone/iPhone.bridgesupport b/jscocoa/iPhone/iPhone.bridgesupport new file mode 100644 index 0000000..09b0d09 --- /dev/null +++ b/jscocoa/iPhone/iPhone.bridgesupport @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jscocoa/iPhone/iPhoneMain.js b/jscocoa/iPhone/iPhoneMain.js new file mode 100644 index 0000000..f381126 --- /dev/null +++ b/jscocoa/iPhone/iPhoneMain.js @@ -0,0 +1,234 @@ + + /* + + Drag the shape ... + * from inside its bounds to change its shape + * from outside its bounds to rotate it + + */ + + + + // + // Application Delegate + // + @implementation iPhoneTest2AppDelegate : NSObject + + - (void)applicationDidFinishLaunching:(UIApplication *)application + { + // Table view background + this.viewController.view.backgroundColor = UIColor.groupTableViewBackgroundColor + this.window.addSubview(this.viewController.view) + this.window.makeKeyAndVisible + + [this performSelector:'repaintPolygon' withObject:null afterDelay:0] + } + // Shouldn't be needed ! + - (void)repaintPolygon + { + [this.viewController.polygonView setNeedsDisplay] + } + IBOutlet window + IBOutlet viewController + + @end + + + // + // View controller + // + @implementation iPhoneTest2ViewController : UIViewController + + - (void)loadView + { + myTableView = [UITableView instanceWithFrame:UIScreen.mainScreen.applicationFrame style:0] + myTableView.delegate = this + myTableView.dataSource = this + myTableView.autoresizesSubviews = true + this.view = myTableView +// this.polygonView.pointCount = 5 + this.Super(arguments) + [this initCells] + } + - (void)initCells + { + var cell0 = [UITableViewCell instance] + var cell1 = [UITableViewCell instance] + + var bounds = this.view.bounds + var margin = 50 + + // Slider + var slider = [UISlider instanceWithFrame:new CGRect(margin, 12, bounds.size.width-margin*2, 10)] + [cell0 addSubview:slider] + + // Image buttons + var imageButton = [UIButton instanceWithFrame: new CGRect(25, 19, 12, 10)] + var image = UIImage.imageNamed('lowPointCount.png') + [imageButton setImage:image forState:0] + [cell0 addSubview:imageButton] + + var imageButton = [UIButton instanceWithFrame: new CGRect(bounds.size.width-38, 19, 12, 10)] + var image = UIImage.imageNamed('hiPointCount.png') + [imageButton setImage:image forState:0] + [cell0 addSubview:imageButton] + + // Text label + var label = [UILabel instanceWithFrame: new CGRect(20, 8, 200, 30)] + label.text = /*String(new Date)*/ 'Fill Polygon' + label.font = UIFont.boldSystemFontOfSize(18) + [cell1 addSubview:label] + + // Switch + var onoff = [UISwitch instanceWithFrame: new CGRect(200, 9, bounds.size.width-margin*2, 80)] + [cell1 addSubview:onoff] + + this.cells = [cell0, cell1] + + // UIControlEventAllEvents (0xFFFFFFFF) does not work anymore. ##checkwhy + [slider addTarget:this action:'pointCountChanged:' forControlEvents:1 << 12] + [onoff addTarget:this action:'fillModeChanged:' forControlEvents:1 << 12] + + slider.value = 0 + } + + // + // Table view + // + - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView + { + return 1 + } + - (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section + { + return 2 + } + - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath + { + if (!this.cells) + { + [this initCells] + } + return this.cells[indexPath.row] + } + + // + // Actions + // + - (void)fillModeChanged:(id)sender + { + this.polygonView.isFilled = sender.isOn==1 ? true : false + [this.polygonView setNeedsDisplay] + } + - (void)pointCountChanged:(id)sender + { + var pointCount = Math.round(sender.value*10+5) + if (pointCount < 5 || pointCount > 15) + { + log('out of bounds pointCount=' + pointCount) + if (pointCount < 5) pointCount = 5 + if (pointCount > 15) pointCount = 15 + } + + this.polygonView.pointCount = pointCount + [this.polygonView setNeedsDisplay] + } + + // + // Outlets + // + IBOutlet labelView + IBOutlet polygonView + @end + + + // + // Polygon view + // + @implementation PolygonView : UIView + + - (void)drawRect:(CGRect)rect + { + var bounds = this.bounds + var w = this.bounds.size.width/2 + var h = this.bounds.size.height/2 +// log('DRAW ' + this.pointCount + '*' + bounds.size.width + ' ' + this.isFilled) + + var scale = h*0.9 + if (!this.pointCount) + { + this.pointCount = 5 + this.backgroundColor = UIColor.groupTableViewBackgroundColor + this.angleOffset = 0 + this.currentAngleOffset = 0 + this.dynamicScale = scale/2 + } + this.backgroundColor = UIColor.groupTableViewBackgroundColor + + var ctx = UIGraphicsGetCurrentContext() + CGContextSetShadow(ctx, new CGSize(0, -10), 4) + // Using string 'kCGColorWhite' instead of constant — BAD — ##tocheck + CGContextSetFillColorWithColor(ctx, CGColorGetConstantColor('kCGColorWhite')) + CGContextSetStrokeColorWithColor(ctx, CGColorGetConstantColor('kCGColorWhite')) + + for (var i=0; i<=this.pointCount*2; i++) + { + var a = Math.PI*2*(i/(this.pointCount*2)) + this.angleOffset + this.currentAngleOffset + var s = i&1 ? scale : this.dynamicScale + var x = w + Math.sin(a)*s + var y = h + Math.cos(a)*s + if (i == 0) CGContextMoveToPoint(ctx, x, y) + else CGContextAddLineToPoint(ctx, x, y) + } + if (this.isFilled) CGContextFillPath(ctx) + else CGContextStrokePath(ctx) + } + + - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event + { + var touch = touches.anyObject + this.locationStart = touch.locationInView(this) + var x = this.locationStart.x-this.bounds.size.width/2 + var y = this.locationStart.y-this.bounds.size.height/2 + var distanceFromCenter = Math.sqrt(x*x+y*y)/(this.bounds.size.width/2) + // Rotate when dragging from outside, Scale when dragging from inside + this.action = distanceFromCenter > 0.7 ? 'rotating' : 'scaling' + } + - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event + { + var touch = touches.anyObject + var location = touch.locationInView(this) + var w = this.bounds.size.width/2 + var h = this.bounds.size.height/2 + + if (this.action == 'scaling') + { + var x = location.x-this.bounds.size.width/2 + var y = location.y-this.bounds.size.height/2 + var distanceFromCenter = Math.sqrt(x*x+y*y)///(this.bounds.size.width) + this.dynamicScale = distanceFromCenter + } + else + { + var x0 = this.locationStart.x - w + var y0 = this.locationStart.y - h + var l0 = Math.sqrt(x0*x0+y0*y0); x0 /= l0, y0 /= l0 + + var x1 = location.x - w + var y1 = location.y - h + var l1 = Math.sqrt(x1*x1+y1*y1); x1 /= l1, y1 /= l1 + + this.currentAngleOffset = Math.acos(x0*x1 + y0*y1) + this.currentAngleOffset = Math.atan2(x1, y1) - Math.atan2(x0, y0) + } + [this setNeedsDisplay] + } + - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event + { + this.angleOffset += this.currentAngleOffset + this.currentAngleOffset = 0 + } + + @end + + diff --git a/jscocoa/iPhone/iPhoneMain.oldStyle.js b/jscocoa/iPhone/iPhoneMain.oldStyle.js new file mode 100644 index 0000000..5887e6b --- /dev/null +++ b/jscocoa/iPhone/iPhoneMain.oldStyle.js @@ -0,0 +1,273 @@ + + + + /* + + This is the old style class syntax, using split calls (using this.perform({selector:'repaintPolygon:', withObject:null, afterDelay:0}) + instead of [this performSelector:'repaintPolygon:' withObject:null afterDelay:0] ) + + */ + + + + + + + + // Call twice to check for a difference in return registers +/* + log('***************About to call JSCocoaObjCMsgSend.addFloat_Float_') + log('JSCocoaObjCMsgSend.addFloat_Float_(7)=' + JSCocoaObjCMsgSend.addFloat_Float_(3, 4)) + log('JSCocoaObjCMsgSend.addFloat_Float_(11)=' + JSCocoaObjCMsgSend.addFloat_Float_(5, 6)) + log('***************Called JSCocoaObjCMsgSend.addFloatFloat') + + log('***************About to call JSCocoaObjCMsgSend.addDouble_Double_') + log('JSCocoaObjCMsgSend.addDouble_Double_(7)=' + JSCocoaObjCMsgSend.addDouble_Double_(3, 4)) + log('JSCocoaObjCMsgSend.addDouble_Double_(11)=' + JSCocoaObjCMsgSend.addDouble_Double_(5, 6)) + log('***************Called JSCocoaObjCMsgSend.addFloatFloat') + + log('***************About to call JSCocoaObjCMsgSend.returnFloat') + log('JSCocoaObjCMsgSend.returnFloat(1.2)=' + JSCocoaObjCMsgSend.returnFloat) + log('***************Called JSCocoaObjCMsgSend.returnFloat') + + log('***************About to call JSCocoaObjCMsgSend.returnDouble') + log('JSCocoaObjCMsgSend.returnDouble(3.4)=' + JSCocoaObjCMsgSend.returnDouble) + log('***************Called JSCocoaObjCMsgSend.returnDouble') + + log('***************About to call JSCocoaObjCMsgSend.returnPoint') + var o = JSCocoaObjCMsgSend.returnPoint + log('JSCocoaObjCMsgSend.returnPoint(1, 2)=' + o.x + ', ' + o.y) + log('***************Called JSCocoaObjCMsgSend.returnPoint') + + log('***************About to call JSCocoaObjCMsgSend.returnRect') + var o = JSCocoaObjCMsgSend.returnRect + log('JSCocoaObjCMsgSend.returnRect(3, 4, 5, 6)=' + o.origin.x + ', ' + o.origin.y + ', ' + o.size.width + ', ' + o.size.height) + log('***************Called JSCocoaObjCMsgSend.returnRect') + CGRect + log('Also check return value of structs, eg View.frame, View.position') +*/ + + // + // Application Delegate + // + Class('iPhoneTest2AppDelegate < NSObject').definition = function () + { + Method('applicationDidFinishLaunching:').encoding('void id').fn = function (application) + { +// log('***(applicationDidFinishLaunching:)***finished launching, self=' + this + ' application=' + application) + // Table view background + this.viewController.view.backgroundColor = UIColor.groupTableView0BackgroundColor + this.window.addSubview(this.viewController.view) + this.window.makeKeyAndVisible + this.perform({selector:'repaintPolygon:', withObject:null, afterDelay:0}) + } + // Shouldn't be needed ! + IBAction('repaintPolygon').fn = function() + { + this.viewController.polygonView.setNeedsDisplay + } + IBOutlet('window') + IBOutlet('viewController') + } + + + // + // View controller + // + Class('iPhoneTest2ViewController < UIViewController').definition = function() + { + Method('loadView').fn = function () + { + myTableView = UITableView.instance({withFrame:UIScreen.mainScreen.applicationFrame, style:0 }) + myTableView.delegate = this + myTableView.dataSource = this + myTableView.autoresizesSubviews = true + this.view = myTableView +// this.polygonView.pointCount = 5 + return this.Super(arguments) + } + + // + // Table view + // + Method('numberOfSectionsInTableView:').encoding('int id').fn = function (tableView) + { + return 1 + } + Method('tableView:numberOfRowsInSection:').encoding('int id int').fn = function (tableView, section) + { + return 2 + } + Method('tableView:cellForRowAtIndexPath:').encoding('id id id').fn = function (tableView, indexPath) + { + if (!this.cells) + { + var cell0 = UITableViewCell.instance() + var cell1 = UITableViewCell.instance() + + var bounds = this.view.bounds + var margin = 50 + + // Slider + var slider = UISlider.instance({withFrame: new CGRect(margin, 12, bounds.size.width-margin*2, 10)}) + cell0.addSubview(slider) + + // Image buttons + var imageButton = UIButton.instance({withFrame: new CGRect(25, 19, 12, 10)}) + var image = UIImage.imageNamed('lowPointCount.png') + imageButton.set({image:image, forState:0}) + cell0.addSubview(imageButton) + + var imageButton = UIButton.instance({withFrame: new CGRect(bounds.size.width-38, 19, 12, 10)}) + var image = UIImage.imageNamed('hiPointCount.png') + imageButton.set({image:image, forState:0}) + cell0.addSubview(imageButton) + + // Text label + var label = UILabel.instance({withFrame: new CGRect(20, 8, 200, 30)}) + label.text = /*String(new Date)*/ 'Fill Polygon' + label.font = UIFont.boldSystemFontOfSize(18) + cell1.addSubview(label) + + // Switch + var onoff = UISwitch.instance({withFrame: new CGRect(200, 9, bounds.size.width-margin*2, 80)}) + cell1.addSubview(onoff) + + this.cells = [cell0, cell1] + + slider.add({target:this, action:'pointCountChanged:', forControlEvents:0xffffffff}) + onoff.add({target:this, action:'fillModeChanged:', forControlEvents:0xffffffff}) + + slider.value = 0 + +// log('inited slider=' + slider) +// log('slider.value=' + slider.value) + } + return this.cells[indexPath.row] + } + + // + // Actions + // + IBAction('fillModeChanged').fn = function (sender) + { + this.polygonView.isFilled = sender.isOn==1 ? true : false + this.polygonView.setNeedsDisplay + } + IBAction('pointCountChanged').fn = function (sender) + { +// log('sender=' + sender) +// log('sender.value=' + sender.value) +// log('typeof sender.value=' + (typeof sender.value)) + var pointCount = Math.round(sender.value*10+5) + if (pointCount < 5 || pointCount > 15) + { + log('out of bounds pointCount=' + pointCount) + if (pointCount < 5) pointCount = 5 + if (pointCount > 15) pointCount = 15 + } + + +// log('pointCount=' + pointCount) + this.polygonView.pointCount = pointCount +// log('point count set') + this.polygonView.setNeedsDisplay +// log('display') + } + + // + // Outlets + // + IBOutlet('labelView') + IBOutlet('polygonView') + } + + + // + // Polygon view + // + Class('PolygonView < UIView').definition = function () + { + Method('drawRect:').fn = function(rect) + { + var bounds = this.bounds + var w = this.bounds.size.width/2 + var h = this.bounds.size.height/2 +// log('DRAW ' + this.pointCount + '*' + bounds.size.width + ' ' + this.isFilled) + + var scale = h*0.9 + if (!this.pointCount) + { + this.pointCount = 5 + this.backgroundColor = UIColor.groupTableViewBackgroundColor + this.angleOffset = 0 + this.currentAngleOffset = 0 + this.dynamicScale = scale/2 + } + this.backgroundColor = UIColor.groupTableViewBackgroundColor + + var ctx = UIGraphicsGetCurrentContext() + CGContextSetShadow(ctx, new CGSize(0, -10), 4) + // Using string 'kCGColorWhite' instead of constant — BAD — ##tocheck + CGContextSetFillColorWithColor(ctx, CGColorGetConstantColor('kCGColorWhite')) + CGContextSetStrokeColorWithColor(ctx, CGColorGetConstantColor('kCGColorWhite')) + + for (var i=0; i<=this.pointCount*2; i++) + { + var a = Math.PI*2*(i/(this.pointCount*2)) + this.angleOffset + this.currentAngleOffset + var s = i&1 ? scale : this.dynamicScale + var x = w + Math.sin(a)*s + var y = h + Math.cos(a)*s + if (i == 0) CGContextMoveToPoint(ctx, x, y) + else CGContextAddLineToPoint(ctx, x, y) + } + if (this.isFilled) CGContextFillPath(ctx) + else CGContextStrokePath(ctx) + } + + Method('touchesBegan:withEvent:').fn = function (touches, event) + { + var touch = touches.anyObject + this.locationStart = touch.locationInView(this) + var x = this.locationStart.x-this.bounds.size.width/2 + var y = this.locationStart.y-this.bounds.size.height/2 + var distanceFromCenter = Math.sqrt(x*x+y*y)/(this.bounds.size.width/2) + // Rotate when dragging from outside, Scale when dragging from inside + this.action = distanceFromCenter > 0.7 ? 'rotating' : 'scaling' + } + Method('touchesMoved:withEvent:').fn = function (touches, event) + { + var touch = touches.anyObject + var location = touch.locationInView(this) + var w = this.bounds.size.width/2 + var h = this.bounds.size.height/2 + + if (this.action == 'scaling') + { + var x = location.x-this.bounds.size.width/2 + var y = location.y-this.bounds.size.height/2 + var distanceFromCenter = Math.sqrt(x*x+y*y)///(this.bounds.size.width) + this.dynamicScale = distanceFromCenter + } + else + { + var x0 = this.locationStart.x - w + var y0 = this.locationStart.y - h + var l0 = Math.sqrt(x0*x0+y0*y0); x0 /= l0, y0 /= l0 + + var x1 = location.x - w + var y1 = location.y - h + var l1 = Math.sqrt(x1*x1+y1*y1); x1 /= l1, y1 /= l1 + + this.currentAngleOffset = Math.acos(x0*x1 + y0*y1) + this.currentAngleOffset = Math.atan2(x1, y1) - Math.atan2(x0, y0) + } + this.setNeedsDisplay + } + Method('touchesEnded:withEvent:').fn = function (touches, event) + { + this.angleOffset += this.currentAngleOffset + this.currentAngleOffset = 0 + } + } + diff --git a/jscocoa/iPhone/iPhoneTest2.xcodeproj/project.pbxproj b/jscocoa/iPhone/iPhoneTest2.xcodeproj/project.pbxproj new file mode 100755 index 0000000..a8e5bb2 --- /dev/null +++ b/jscocoa/iPhone/iPhoneTest2.xcodeproj/project.pbxproj @@ -0,0 +1,416 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; + 2899E5220DE3E06400AC0155 /* iPhoneTest2ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* iPhoneTest2ViewController.xib */; }; + 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; + 3D3B559C0F1D41F300D60188 /* GDataXMLNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D3B559B0F1D41F300D60188 /* GDataXMLNode.m */; }; + 3D64C8870F3F1A45004D610C /* JSCocoaLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D64C8850F3F1A45004D610C /* JSCocoaLib.m */; }; + 3D7A7E270EA2216D009DE07C /* iPhone.bridgesupport in Resources */ = {isa = PBXBuildFile; fileRef = 3D7A7E260EA2216D009DE07C /* iPhone.bridgesupport */; }; + 3D7A818F0EA238D3009DE07C /* hiPointCount.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D7A818D0EA238D3009DE07C /* hiPointCount.png */; }; + 3D7A81900EA238D3009DE07C /* lowPointCount.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D7A818E0EA238D3009DE07C /* lowPointCount.png */; }; + 3D97DA6C10425AAA00E2E233 /* ffi-iphone.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D97DA5A10425AAA00E2E233 /* ffi-iphone.c */; }; + 3D97DA6D10425AAA00E2E233 /* ffi-iphonesimulator.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D97DA5C10425AAA00E2E233 /* ffi-iphonesimulator.c */; }; + 3D97DA6E10425AAA00E2E233 /* iphone-sysv.S in Sources */ = {isa = PBXBuildFile; fileRef = 3D97DA6410425AAA00E2E233 /* iphone-sysv.S */; }; + 3D97DA6F10425AAA00E2E233 /* iphonesimulator-darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 3D97DA6510425AAA00E2E233 /* iphonesimulator-darwin.S */; }; + 3D97DA7110425AAA00E2E233 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D97DA6710425AAA00E2E233 /* prep_cif.c */; }; + 3D97DA7210425AAA00E2E233 /* raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D97DA6810425AAA00E2E233 /* raw_api.c */; }; + 3D97DA7310425AAA00E2E233 /* types.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D97DA6910425AAA00E2E233 /* types.c */; }; + 3D9BA7DB0EB10DC9005F9A76 /* class.js in Resources */ = {isa = PBXBuildFile; fileRef = 3D9BA7DA0EB10DC9005F9A76 /* class.js */; }; + 3DA390150EA7523300CB6F74 /* JSCocoaController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DA3900B0EA7523300CB6F74 /* JSCocoaController.m */; }; + 3DA390160EA7523300CB6F74 /* JSCocoaPrivateObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DA3900D0EA7523300CB6F74 /* JSCocoaPrivateObject.m */; }; + 3DA390170EA7523300CB6F74 /* JSCocoaFFIArgument.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DA3900F0EA7523300CB6F74 /* JSCocoaFFIArgument.m */; }; + 3DA390180EA7523300CB6F74 /* JSCocoaFFIClosure.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DA390110EA7523300CB6F74 /* JSCocoaFFIClosure.m */; }; + 3DA390190EA7523300CB6F74 /* BridgeSupportController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DA390130EA7523300CB6F74 /* BridgeSupportController.m */; }; + 3DB582150EA17CAC00EB80D9 /* JavascriptCore-dlsym.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB5820C0EA17CAC00EB80D9 /* JavascriptCore-dlsym.m */; }; + 3DB582770EA1814000EB80D9 /* iPhoneMain.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DB582760EA1814000EB80D9 /* iPhoneMain.js */; }; + 3DCB6EE211D5504F00385AE2 /* jslint-jscocoa.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DCB6EE111D5504F00385AE2 /* jslint-jscocoa.js */; }; + 3DED293F103B970D0093C660 /* BurksPool.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DED293E103B970D0093C660 /* BurksPool.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D6058910D05DD3D006BFB54 /* iPhoneTest2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iPhoneTest2.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 2899E5210DE3E06400AC0155 /* iPhoneTest2ViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = iPhoneTest2ViewController.xib; sourceTree = ""; }; + 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* iPhoneTest2_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iPhoneTest2_Prefix.pch; sourceTree = ""; }; + 3D35B9D1120C4EDF00E260FB /* iPhoneMain.oldStyle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = iPhoneMain.oldStyle.js; sourceTree = ""; }; + 3D3B559A0F1D41F300D60188 /* GDataXMLNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GDataXMLNode.h; path = ../JSCocoa/iPhone/GDataXMLNode.h; sourceTree = SOURCE_ROOT; }; + 3D3B559B0F1D41F300D60188 /* GDataXMLNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GDataXMLNode.m; path = ../JSCocoa/iPhone/GDataXMLNode.m; sourceTree = SOURCE_ROOT; }; + 3D3B55C90F1D4C2200D60188 /* GDataDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GDataDefines.h; path = ../JSCocoa/iPhone/GDataDefines.h; sourceTree = SOURCE_ROOT; }; + 3D64C8850F3F1A45004D610C /* JSCocoaLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSCocoaLib.m; path = ../JSCocoa/JSCocoaLib.m; sourceTree = SOURCE_ROOT; }; + 3D64C8860F3F1A45004D610C /* JSCocoaLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCocoaLib.h; path = ../JSCocoa/JSCocoaLib.h; sourceTree = SOURCE_ROOT; }; + 3D7A7E260EA2216D009DE07C /* iPhone.bridgesupport */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = iPhone.bridgesupport; sourceTree = ""; }; + 3D7A818D0EA238D3009DE07C /* hiPointCount.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = hiPointCount.png; sourceTree = ""; }; + 3D7A818E0EA238D3009DE07C /* lowPointCount.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lowPointCount.png; sourceTree = ""; }; + 3D97DA5A10425AAA00E2E233 /* ffi-iphone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "ffi-iphone.c"; sourceTree = ""; }; + 3D97DA5B10425AAA00E2E233 /* ffi-iphone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ffi-iphone.h"; sourceTree = ""; }; + 3D97DA5C10425AAA00E2E233 /* ffi-iphonesimulator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "ffi-iphonesimulator.c"; sourceTree = ""; }; + 3D97DA5D10425AAA00E2E233 /* ffi-iphonesimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ffi-iphonesimulator.h"; sourceTree = ""; }; + 3D97DA5E10425AAA00E2E233 /* ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi.h; sourceTree = ""; }; + 3D97DA5F10425AAA00E2E233 /* ffi_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_common.h; sourceTree = ""; }; + 3D97DA6010425AAA00E2E233 /* fficonfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig.h; sourceTree = ""; }; + 3D97DA6110425AAA00E2E233 /* ffitarget-iphone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ffitarget-iphone.h"; sourceTree = ""; }; + 3D97DA6210425AAA00E2E233 /* ffitarget-iphonesimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ffitarget-iphonesimulator.h"; sourceTree = ""; }; + 3D97DA6310425AAA00E2E233 /* ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget.h; sourceTree = ""; }; + 3D97DA6410425AAA00E2E233 /* iphone-sysv.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "iphone-sysv.S"; sourceTree = ""; }; + 3D97DA6510425AAA00E2E233 /* iphonesimulator-darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "iphonesimulator-darwin.S"; sourceTree = ""; }; + 3D97DA6710425AAA00E2E233 /* prep_cif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prep_cif.c; sourceTree = ""; }; + 3D97DA6810425AAA00E2E233 /* raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = raw_api.c; sourceTree = ""; }; + 3D97DA6910425AAA00E2E233 /* types.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = types.c; sourceTree = ""; }; + 3D9BA7DA0EB10DC9005F9A76 /* class.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = class.js; path = ../JSCocoa/class.js; sourceTree = SOURCE_ROOT; }; + 3DA3900B0EA7523300CB6F74 /* JSCocoaController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSCocoaController.m; path = ../JSCocoa/JSCocoaController.m; sourceTree = SOURCE_ROOT; }; + 3DA3900C0EA7523300CB6F74 /* JSCocoaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCocoaController.h; path = ../JSCocoa/JSCocoaController.h; sourceTree = SOURCE_ROOT; }; + 3DA3900D0EA7523300CB6F74 /* JSCocoaPrivateObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSCocoaPrivateObject.m; path = ../JSCocoa/JSCocoaPrivateObject.m; sourceTree = SOURCE_ROOT; }; + 3DA3900E0EA7523300CB6F74 /* JSCocoaPrivateObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCocoaPrivateObject.h; path = ../JSCocoa/JSCocoaPrivateObject.h; sourceTree = SOURCE_ROOT; }; + 3DA3900F0EA7523300CB6F74 /* JSCocoaFFIArgument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSCocoaFFIArgument.m; path = ../JSCocoa/JSCocoaFFIArgument.m; sourceTree = SOURCE_ROOT; }; + 3DA390100EA7523300CB6F74 /* JSCocoaFFIArgument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCocoaFFIArgument.h; path = ../JSCocoa/JSCocoaFFIArgument.h; sourceTree = SOURCE_ROOT; }; + 3DA390110EA7523300CB6F74 /* JSCocoaFFIClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSCocoaFFIClosure.m; path = ../JSCocoa/JSCocoaFFIClosure.m; sourceTree = SOURCE_ROOT; }; + 3DA390120EA7523300CB6F74 /* JSCocoaFFIClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCocoaFFIClosure.h; path = ../JSCocoa/JSCocoaFFIClosure.h; sourceTree = SOURCE_ROOT; }; + 3DA390130EA7523300CB6F74 /* BridgeSupportController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BridgeSupportController.m; path = ../JSCocoa/BridgeSupportController.m; sourceTree = SOURCE_ROOT; }; + 3DA390140EA7523300CB6F74 /* BridgeSupportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BridgeSupportController.h; path = ../JSCocoa/BridgeSupportController.h; sourceTree = SOURCE_ROOT; }; + 3DB5820C0EA17CAC00EB80D9 /* JavascriptCore-dlsym.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JavascriptCore-dlsym.m"; sourceTree = ""; }; + 3DB5820D0EA17CAC00EB80D9 /* JavascriptCore-dlsym.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JavascriptCore-dlsym.h"; sourceTree = ""; }; + 3DB5820E0EA17CAC00EB80D9 /* JavaScriptCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptCore.h; sourceTree = ""; }; + 3DB5820F0EA17CAC00EB80D9 /* JSBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBase.h; sourceTree = ""; }; + 3DB582100EA17CAC00EB80D9 /* JSContextRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSContextRef.h; sourceTree = ""; }; + 3DB582110EA17CAC00EB80D9 /* JSObjectRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectRef.h; sourceTree = ""; }; + 3DB582120EA17CAC00EB80D9 /* JSStringRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringRef.h; sourceTree = ""; }; + 3DB582130EA17CAC00EB80D9 /* JSStringRefCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringRefCF.h; sourceTree = ""; }; + 3DB582140EA17CAC00EB80D9 /* JSValueRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSValueRef.h; sourceTree = ""; }; + 3DB582760EA1814000EB80D9 /* iPhoneMain.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = iPhoneMain.js; sourceTree = ""; }; + 3DCB6EE111D5504F00385AE2 /* jslint-jscocoa.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = "jslint-jscocoa.js"; path = "../JSCocoa/jslint-jscocoa.js"; sourceTree = SOURCE_ROOT; }; + 3DED293D103B970D0093C660 /* BurksPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BurksPool.h; path = ../JSCocoa/iPhone/BurksPool.h; sourceTree = SOURCE_ROOT; }; + 3DED293E103B970D0093C660 /* BurksPool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BurksPool.m; path = ../JSCocoa/iPhone/BurksPool.m; sourceTree = SOURCE_ROOT; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* iPhoneTest2.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + 3DB581EF0EA17C9000EB80D9 /* JSCocoa */, + 3D35B89E120B08F000E260FB /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* iPhoneTest2_Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 3D7A818D0EA238D3009DE07C /* hiPointCount.png */, + 3D7A818E0EA238D3009DE07C /* lowPointCount.png */, + 2899E5210DE3E06400AC0155 /* iPhoneTest2ViewController.xib */, + 28AD733E0D9D9553002E5188 /* MainWindow.xib */, + 8D1107310486CEB800E47090 /* Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765A40DF7441C002DB57D /* CoreGraphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3D35B89E120B08F000E260FB /* Classes */ = { + isa = PBXGroup; + children = ( + 3DB582760EA1814000EB80D9 /* iPhoneMain.js */, + 3D35B9D1120C4EDF00E260FB /* iPhoneMain.oldStyle.js */, + ); + name = Classes; + sourceTree = ""; + }; + 3D97DA5710425AAA00E2E233 /* libffi */ = { + isa = PBXGroup; + children = ( + 3D97DA5A10425AAA00E2E233 /* ffi-iphone.c */, + 3D97DA5B10425AAA00E2E233 /* ffi-iphone.h */, + 3D97DA5C10425AAA00E2E233 /* ffi-iphonesimulator.c */, + 3D97DA5D10425AAA00E2E233 /* ffi-iphonesimulator.h */, + 3D97DA5E10425AAA00E2E233 /* ffi.h */, + 3D97DA5F10425AAA00E2E233 /* ffi_common.h */, + 3D97DA6010425AAA00E2E233 /* fficonfig.h */, + 3D97DA6110425AAA00E2E233 /* ffitarget-iphone.h */, + 3D97DA6210425AAA00E2E233 /* ffitarget-iphonesimulator.h */, + 3D97DA6310425AAA00E2E233 /* ffitarget.h */, + 3D97DA6410425AAA00E2E233 /* iphone-sysv.S */, + 3D97DA6510425AAA00E2E233 /* iphonesimulator-darwin.S */, + 3D97DA6710425AAA00E2E233 /* prep_cif.c */, + 3D97DA6810425AAA00E2E233 /* raw_api.c */, + 3D97DA6910425AAA00E2E233 /* types.c */, + ); + name = libffi; + path = ../JSCocoa/iPhone/libffi; + sourceTree = SOURCE_ROOT; + }; + 3DB581EF0EA17C9000EB80D9 /* JSCocoa */ = { + isa = PBXGroup; + children = ( + 3DED2940103B97130093C660 /* iPhone */, + 3DB5820B0EA17CAC00EB80D9 /* JavascriptCore */, + 3DA3900B0EA7523300CB6F74 /* JSCocoaController.m */, + 3DA3900C0EA7523300CB6F74 /* JSCocoaController.h */, + 3DA3900D0EA7523300CB6F74 /* JSCocoaPrivateObject.m */, + 3DA3900E0EA7523300CB6F74 /* JSCocoaPrivateObject.h */, + 3DA3900F0EA7523300CB6F74 /* JSCocoaFFIArgument.m */, + 3DA390100EA7523300CB6F74 /* JSCocoaFFIArgument.h */, + 3DA390110EA7523300CB6F74 /* JSCocoaFFIClosure.m */, + 3DA390120EA7523300CB6F74 /* JSCocoaFFIClosure.h */, + 3D64C8850F3F1A45004D610C /* JSCocoaLib.m */, + 3D64C8860F3F1A45004D610C /* JSCocoaLib.h */, + 3DA390130EA7523300CB6F74 /* BridgeSupportController.m */, + 3DA390140EA7523300CB6F74 /* BridgeSupportController.h */, + 3D9BA7DA0EB10DC9005F9A76 /* class.js */, + 3DCB6EE111D5504F00385AE2 /* jslint-jscocoa.js */, + ); + name = JSCocoa; + sourceTree = ""; + }; + 3DB5820B0EA17CAC00EB80D9 /* JavascriptCore */ = { + isa = PBXGroup; + children = ( + 3DB5820C0EA17CAC00EB80D9 /* JavascriptCore-dlsym.m */, + 3DB5820D0EA17CAC00EB80D9 /* JavascriptCore-dlsym.h */, + 3DB5820E0EA17CAC00EB80D9 /* JavaScriptCore.h */, + 3DB5820F0EA17CAC00EB80D9 /* JSBase.h */, + 3DB582100EA17CAC00EB80D9 /* JSContextRef.h */, + 3DB582110EA17CAC00EB80D9 /* JSObjectRef.h */, + 3DB582120EA17CAC00EB80D9 /* JSStringRef.h */, + 3DB582130EA17CAC00EB80D9 /* JSStringRefCF.h */, + 3DB582140EA17CAC00EB80D9 /* JSValueRef.h */, + ); + name = JavascriptCore; + sourceTree = ""; + }; + 3DED2940103B97130093C660 /* iPhone */ = { + isa = PBXGroup; + children = ( + 3D7A7E260EA2216D009DE07C /* iPhone.bridgesupport */, + 3D3B55C90F1D4C2200D60188 /* GDataDefines.h */, + 3D3B559A0F1D41F300D60188 /* GDataXMLNode.h */, + 3D3B559B0F1D41F300D60188 /* GDataXMLNode.m */, + 3DED293D103B970D0093C660 /* BurksPool.h */, + 3DED293E103B970D0093C660 /* BurksPool.m */, + 3D97DA5710425AAA00E2E233 /* libffi */, + ); + name = iPhone; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* iPhoneTest2 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "iPhoneTest2" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = iPhoneTest2; + productName = iPhoneTest2; + productReference = 1D6058910D05DD3D006BFB54 /* iPhoneTest2.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iPhoneTest2" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* iPhoneTest2 */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D9BA7DB0EB10DC9005F9A76 /* class.js in Resources */, + 3DB582770EA1814000EB80D9 /* iPhoneMain.js in Resources */, + 3DCB6EE211D5504F00385AE2 /* jslint-jscocoa.js in Resources */, + 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, + 2899E5220DE3E06400AC0155 /* iPhoneTest2ViewController.xib in Resources */, + 3D7A7E270EA2216D009DE07C /* iPhone.bridgesupport in Resources */, + 3D7A818F0EA238D3009DE07C /* hiPointCount.png in Resources */, + 3D7A81900EA238D3009DE07C /* lowPointCount.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589B0D05DD56006BFB54 /* main.m in Sources */, + 3DB582150EA17CAC00EB80D9 /* JavascriptCore-dlsym.m in Sources */, + 3DA390150EA7523300CB6F74 /* JSCocoaController.m in Sources */, + 3DA390160EA7523300CB6F74 /* JSCocoaPrivateObject.m in Sources */, + 3DA390170EA7523300CB6F74 /* JSCocoaFFIArgument.m in Sources */, + 3DA390180EA7523300CB6F74 /* JSCocoaFFIClosure.m in Sources */, + 3DA390190EA7523300CB6F74 /* BridgeSupportController.m in Sources */, + 3D3B559C0F1D41F300D60188 /* GDataXMLNode.m in Sources */, + 3D64C8870F3F1A45004D610C /* JSCocoaLib.m in Sources */, + 3DED293F103B970D0093C660 /* BurksPool.m in Sources */, + 3D97DA6C10425AAA00E2E233 /* ffi-iphone.c in Sources */, + 3D97DA6D10425AAA00E2E233 /* ffi-iphonesimulator.c in Sources */, + 3D97DA6E10425AAA00E2E233 /* iphone-sysv.S in Sources */, + 3D97DA6F10425AAA00E2E233 /* iphonesimulator-darwin.S in Sources */, + 3D97DA7110425AAA00E2E233 /* prep_cif.c in Sources */, + 3D97DA7210425AAA00E2E233 /* raw_api.c in Sources */, + 3D97DA7310425AAA00E2E233 /* types.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = iPhoneTest2_Prefix.pch; + INFOPLIST_FILE = Info.plist; + PRODUCT_NAME = iPhoneTest2; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = iPhoneTest2_Prefix.pch; + INFOPLIST_FILE = Info.plist; + PRODUCT_NAME = iPhoneTest2; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEAD_CODE_STRIPPING = YES; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /usr/include/libxml2; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-lxml2"; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /usr/include/libxml2; + OTHER_LDFLAGS = "-lxml2"; + PREBINDING = NO; + SDKROOT = iphoneos3.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "iPhoneTest2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iPhoneTest2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/jscocoa/iPhone/iPhoneTest2ViewController.xib b/jscocoa/iPhone/iPhoneTest2ViewController.xib new file mode 100644 index 0000000..9368942 --- /dev/null +++ b/jscocoa/iPhone/iPhoneTest2ViewController.xib @@ -0,0 +1,308 @@ + + + + 528 + 9F33 + 672 + 949.34 + 352.00 + + YES + + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + IBFilesOwner + + + IBFirstResponder + + + + 274 + + YES + + + 290 + {320, 44} + + NO + NO + 1 + + YES + + + JSCocoa Sample + + + + + + 274 + {{0, 330}, {320, 130}} + + NO + YES + NO + NO + 1 + 1 + 0 + 4.400000e+01 + 2.700000e+01 + 2.700000e+01 + + + + 292 + {{0, 44}, {320, 300}} + + + 3 + MQA + + 2 + + + NO + + + {320, 460} + + + 1 + MC42NTk1ODA1MyAwLjY1NTg5NTcxIDAuNjYzMjY1MzUAA + + NO + + 2 + + + + + 292 + {320, 480} + + + 1 + MSAxIDEAA + + NO + NO + + 2 + + + + + + YES + + + view + + + + 7 + + + + dataSource + + + + 52 + + + + delegate + + + + 53 + + + + polygonView + + + + 69 + + + + + YES + + 0 + + YES + + + + + + -1 + + + RmlsZSdzIE93bmVyA + + + -2 + + + + + 6 + + + YES + + + + + + + + 8 + + + + + 49 + + + YES + + + + + + 50 + + + + + 51 + + + + + 68 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 49.IBPluginDependency + 50.IBPluginDependency + 51.IBPluginDependency + 6.IBEditorWindowLastContentRect + 6.IBPluginDependency + 68.CustomClassName + 68.IBPluginDependency + 8.IBEditorWindowLastContentRect + 8.IBPluginDependency + + + YES + iPhoneTest2ViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{801, 319}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + PolygonView + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{984, 419}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 69 + + + + YES + + iPhoneTest2ViewController + + YES + + YES + fillModeChanged: + pointCountChanged: + + + YES + id + id + + + + YES + + YES + fillModeSwitch + labelView + pointCountSlider + polygonView + sliderView + switchView + + + YES + id + id + id + id + id + id + + + + IBUserSource + + + + + + 0 + iPhoneTest2.xcodeproj + 3 + + diff --git a/jscocoa/iPhone/iPhoneTest2_Prefix.pch b/jscocoa/iPhone/iPhoneTest2_Prefix.pch new file mode 100644 index 0000000..f064dd1 --- /dev/null +++ b/jscocoa/iPhone/iPhoneTest2_Prefix.pch @@ -0,0 +1,10 @@ +// +// Prefix header for all source files of the 'iPhoneTest2' target in the 'iPhoneTest2' project +// + +#ifdef __OBJC__ + #import + #import +#endif + +#include "JavascriptCore.h" \ No newline at end of file diff --git a/jscocoa/iPhone/lowPointCount.png b/jscocoa/iPhone/lowPointCount.png new file mode 100644 index 0000000..699c7f0 Binary files /dev/null and b/jscocoa/iPhone/lowPointCount.png differ diff --git a/jscocoa/iPhone/main.m b/jscocoa/iPhone/main.m new file mode 100644 index 0000000..25820c7 --- /dev/null +++ b/jscocoa/iPhone/main.m @@ -0,0 +1,32 @@ +// +// main.m +// iPhoneTest2 +// +// Created by Patrick Geiller on 12/10/08. +// Copyright __MyCompanyName__ 2008. All rights reserved. +// + +#import +#include "JavascriptCore-dlsym.h" +#include "JSCocoaController.h" + +int main(int argc, char *argv[]) { + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + + // Fetch JS symbols + [JSCocoaSymbolFetcher populateJavascriptCoreSymbols]; + + // Load iPhone bridgeSupport + [[BridgeSupportController sharedController] loadBridgeSupport:[NSString stringWithFormat:@"%@/iPhone.bridgesupport", [[NSBundle mainBundle] bundlePath]]]; + // Load js class kit + id c = [JSCocoaController sharedController]; +// [c evalJSFile:[NSString stringWithFormat:@"%@/class.js", [[NSBundle mainBundle] bundlePath]]]; + // Load js main + [c evalJSFile:[NSString stringWithFormat:@"%@/iPhoneMain.js", [[NSBundle mainBundle] bundlePath]]]; + + + // Start app + int retVal = UIApplicationMain(argc, argv, nil, nil); + [pool release]; + return retVal; +}