Skip to content

Commit

Permalink
migrate from broken jscocoa git submodule to working git fake submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
rentzsch committed Nov 6, 2010
1 parent db8c761 commit 5859ea0
Show file tree
Hide file tree
Showing 290 changed files with 95,137 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -152,8 +152,6 @@ Here's what is currently being worked on, what's broken:
Checking out the code: Checking out the code:
---------------------- ----------------------
$ git clone git://github.com/ccgus/jstalk.git $ git clone git://github.com/ccgus/jstalk.git
$ cd jstalk
$ git clone http://github.com/parmanoir/jscocoa.git jscocoa




TODO: TODO:
Expand Down
20 changes: 20 additions & 0 deletions 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 <Cocoa/Cocoa.h>


@interface ApplicationController : NSObject {

}

- (IBAction)runJSTests:(id)sender;
- (IBAction)collect:(id)sender;
- (IBAction)dumpMemory:(id)sender;

@end
92 changes: 92 additions & 0 deletions 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
Binary file not shown.

0 comments on commit 5859ea0

Please sign in to comment.