Permalink
Browse files

More Mocha transitional stuff.

  • Loading branch information...
1 parent b850231 commit d20aebdcc47cf7145a488b79bc8d6bf6e1c64497 @ccgus committed Jul 22, 2012
View
8 README.md
@@ -169,7 +169,13 @@ As said earlier, JSTalk is a blend of existing technologies, and has very little
- JSTalk Icon, from Brad Ellis.
- JavaScriptCore, from Apple and the WebKit team.
-- [JSCocoa](http://inexdo.com/JSCocoa), from Patrick Geiller.
+- [Mocha](https://github.com/logancollins/Mocha), from Logan Collins.
- [TDParseKit](http://ditchnet.org/tdparsekit/), from Todd Ditchendorf.
- [NoodleLineNumberView](http://www.noodlesoft.com/blog/2008/10/05/displaying-line-numbers-with-nstextview/), from Paul Kim / Noodlesoft.
- [TextExtras](http://www.lorax.com/FreeStuff/TextExtras.html), from Mike Ferris.
+
+
+### Mocha Transition Notes for Gus:
+
+Hey, JSTCodeSketcher has a lot of commented out code that you'll need to figure out still
+
View
12 jstalk.xcodeproj/project.pbxproj
@@ -134,6 +134,8 @@
CC3A9B5D15BCB2E00075F377 /* TDWord.m in Sources */ = {isa = PBXBuildFile; fileRef = CC1C7D790F48BB2C007A2941 /* TDWord.m */; };
CC3A9B5E15BCB2E00075F377 /* TDWordOrReservedState.m in Sources */ = {isa = PBXBuildFile; fileRef = CC1C7D7B0F48BB2C007A2941 /* TDWordOrReservedState.m */; };
CC3A9B5F15BCB2E00075F377 /* TDWordState.m in Sources */ = {isa = PBXBuildFile; fileRef = CC1C7D7D0F48BB2C007A2941 /* TDWordState.m */; };
+ CC3A9B6315BCB82C0075F377 /* MochaRuntime.m in Sources */ = {isa = PBXBuildFile; fileRef = CCEC36AF15BA5E44008D8460 /* MochaRuntime.m */; };
+ CC3A9B6415BCB82E0075F377 /* Mocha.m in Sources */ = {isa = PBXBuildFile; fileRef = CCEC36AC15BA5E44008D8460 /* Mocha.m */; };
CC41432E0F25257C00E46669 /* JSTalk_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = CCC5B8CB0F1EFAAA00126722 /* JSTalk_Prefix.pch */; settings = {ATTRIBUTES = (Private, ); }; };
CC41433B0F25259400E46669 /* JSTalk.h in Headers */ = {isa = PBXBuildFile; fileRef = CC5FB7D60F1FDDE900F4ECC2 /* JSTalk.h */; settings = {ATTRIBUTES = (Public, ); }; };
CC41433C0F25259400E46669 /* JSTalk.m in Sources */ = {isa = PBXBuildFile; fileRef = CC5FB7D70F1FDDE900F4ECC2 /* JSTalk.m */; };
@@ -1191,6 +1193,7 @@
CC1C7DDF0F48BB2C007A2941 /* TDChar.m in Sources */,
CC1C7DE00F48BB2C007A2941 /* TDCharacterAssembly.m in Sources */,
CC3A9B2315BC8F390075F377 /* MOBridgeSupportController.m in Sources */,
+ CC3A9B6315BCB82C0075F377 /* MochaRuntime.m in Sources */,
CC3A9B2415BC8F390075F377 /* MOBridgeSupportLibrary.m in Sources */,
CC3A9B2515BC8F390075F377 /* MOBridgeSupportParser.m in Sources */,
CC3A9B2615BC8F390075F377 /* MOBridgeSupportSymbol.m in Sources */,
@@ -1234,6 +1237,7 @@
CC1C7DF40F48BB2C007A2941 /* TDSequence.m in Sources */,
CC1C7DF60F48BB2C007A2941 /* TDSingleLineCommentState.m in Sources */,
CC1C7DF70F48BB2C007A2941 /* TDSpecificChar.m in Sources */,
+ CC3A9B6415BCB82E0075F377 /* Mocha.m in Sources */,
CC1C7DF80F48BB2C007A2941 /* TDSymbol.m in Sources */,
CC1C7DF90F48BB2C007A2941 /* TDSymbolNode.m in Sources */,
CC1C7DFA0F48BB2C007A2941 /* TDSymbolRootNode.m in Sources */,
@@ -1302,10 +1306,6 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "\"$(SRCROOT)/lib\"",
- );
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -1328,10 +1328,6 @@
x86_64,
i386,
);
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "\"$(SRCROOT)/lib\"",
- );
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = src/JSTalk_Prefix.pch;
INFOPLIST_FILE = res/Info.plist;
View
4 plugins/imagetools/ImageTools.xcodeproj/project.pbxproj
@@ -300,7 +300,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../Frameworks";
OTHER_CFLAGS = "-DDEBUG";
PRODUCT_NAME = ImageTools;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
WRAPPER_EXTENSION = jstplugin;
};
name = Debug;
@@ -328,7 +328,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../Frameworks";
OTHER_CFLAGS = "-DDEBUG";
PRODUCT_NAME = ImageTools;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
WRAPPER_EXTENSION = jstplugin;
};
name = Release;
View
4 plugins/imagetools/JSTCodeSketcher.h
@@ -8,7 +8,6 @@
#import <Foundation/Foundation.h>
#import <JSTalk/JSTalk.h>
-#import <JSTalk/JSCocoa.h>
@interface JSTCodeSketcher : NSView {
@@ -54,12 +53,13 @@
- (void)stop;
- (void)start;
+/*
- (void)setDraw:(JSValueRefAndContextRef)ref;
- (void)setMouseMove:(JSValueRefAndContextRef)ref;
- (void)setMouseUp:(JSValueRefAndContextRef)ref;
- (void)setMouseDown:(JSValueRefAndContextRef)ref;
- (void)setMouseDrag:(JSValueRefAndContextRef)ref;
-
+*/
@end
View
22 plugins/imagetools/JSTCodeSketcher.m
@@ -103,34 +103,35 @@ - (void)stop {
_redrawTimer = 0x00;
if (_setupFunction) {
- JSValueUnprotect([[_jstalk jsController] ctx], _drawFunction);
+ JSValueUnprotect([_jstalk context], _drawFunction);
}
if (_drawFunction) {
- JSValueUnprotect([[_jstalk jsController] ctx], _drawFunction);
+ JSValueUnprotect([_jstalk context], _drawFunction);
}
if (_mouseUpFunction) {
- JSValueUnprotect([[_jstalk jsController] ctx], _mouseUpFunction);
+ JSValueUnprotect([_jstalk context], _mouseUpFunction);
}
if (_mouseDownFunction) {
- JSValueUnprotect([[_jstalk jsController] ctx], _mouseDownFunction);
+ JSValueUnprotect([_jstalk context], _mouseDownFunction);
}
if (_mouseMoveFunction) {
- JSValueUnprotect([[_jstalk jsController] ctx], _mouseMoveFunction);
+ JSValueUnprotect([_jstalk context], _mouseMoveFunction);
}
if (_mouseDragFunction) {
- JSValueUnprotect([[_jstalk jsController] ctx], _mouseDragFunction);
+ JSValueUnprotect([_jstalk context], _mouseDragFunction);
}
}
- (void)start {
if (_setupFunction) {
- [[_jstalk jsController] callJSFunction:_setupFunction withArguments:0x00];
+ #pragma message "FIXME: add this back in with the Mocha transition"
+ //[[_jstalk jsController] callJSFunction:_setupFunction withArguments:0x00];
}
[self setupWindow];
@@ -230,7 +231,9 @@ - (void)drawRect:(NSRect)dirtyRect {
if (_drawFunction) {
[self pushContext];
- [[_jstalk jsController] callJSFunction:_drawFunction withArguments:0x00];
+
+ #pragma message "FIXME: add back in w/ Mocha transition"
+ //[[_jstalk jsController] callJSFunction:_drawFunction withArguments:0x00];
[self popContext];
}
@@ -244,7 +247,7 @@ - (void)drawRect:(NSRect)dirtyRect {
- (void)viewDidEndLiveResize {
[self resizeContext];
}
-
+/*
- (void)setSetup:(JSValueRefAndContextRef)ref {
_setupFunction = ref.value;
JSValueProtect([[_jstalk jsController] ctx], _setupFunction);
@@ -328,6 +331,7 @@ - (void)mouseMoved:(NSEvent *)event {
}
}
+*/
- (BOOL)isFlipped {
return _flipped;
View
2 plugins/imagetools/JSTOpenCLProgram.m
@@ -16,7 +16,7 @@ - (id)printController;
@interface JSTOpenCLKernel ()
@property (readwrite) cl_kernel computeKernel;
-@property (readwrite) int workGroupSize;
+@property (readwrite) size_t workGroupSize;
@end
@implementation JSTOpenCLProgram
View
8 src/JSTAppDelegate.m
@@ -8,7 +8,6 @@
#import "JSTAppDelegate.h"
#import "JSTalk.h"
-//#import "JSCocoaController.h"
@interface JSTAppDelegate (PrivateStuff)
- (void)restoreWorkspace;
@@ -220,11 +219,9 @@ - (NSFont*)defaultEditorFont {
return defaultFont;
}
-/*
-- (void)JSCocoa:(JSCocoaController*)controller hadError:(NSString*)error onLineNumber:(NSInteger)lineNumber atSourceURL:(id)url {
+- (void)JSTalk:(JSTalk*)jstalk hadError:(NSString*)error onLineNumber:(NSInteger)lineNumber atSourceURL:(id)url {
_serviceError = [error retain];
}
-*/
- (void)runAsJSTalkScript:(NSPasteboard *)pb userData:(NSDictionary *)userData error:(NSString **)error {
@@ -246,8 +243,7 @@ - (void)runAsJSTalkScript:(NSPasteboard *)pb userData:(NSDictionary *)userData e
JSTalk *jstalk = [[JSTalk alloc] init];
- //JSCocoaController *jsController = [jstalk jsController];
- //jsController.delegate = self;
+ [jstalk setErrorController:self];
[[[NSThread currentThread] threadDictionary] setObject:jstalk forKey:@"org.jstalk.currentJSTalkContext"];
View
6 src/JSTDocument.m
@@ -10,7 +10,6 @@
#import "JSTAppDelegate.h"
#import "JSTListener.h"
#import "JSTalk.h"
-//#import "JSCocoaController.h"
#import "JSTPreprocessor.h"
@interface JSTDocument (SuperSecretItsPrivateDontEvenThinkOfUsingTheseMethodsOutsideThisClass)
@@ -151,7 +150,7 @@ - (void)JSTalk:(JSTalk*)jstalk hadError:(NSString*)error onLineNumber:(NSInteger
[errorLabel setStringValue:error];
}
else {
- [errorLabel setStringValue:[NSString stringWithFormat:@"Line %d, %@", lineNumber, error]];
+ [errorLabel setStringValue:[NSString stringWithFormat:@"Line %ld, %@", lineNumber, error]];
NSUInteger lineIdx = 0;
NSRange lineRange = NSMakeRange(0, 0);
@@ -174,9 +173,6 @@ - (void)runScript:(NSString*)s {
[[[NSThread currentThread] threadDictionary] setObject:jstalk forKey:@"org.jstalk.currentJSTalkContext"];
-#pragma message "FIXME: the error delegate stuff needs to be added back in"
- //jsController.delegate = self;
-
[jstalk setPrintController:self];
[jstalk setErrorController:self];
View
2 src/JSTalk.h
@@ -27,7 +27,7 @@
- (void)pushObject:(id)obj withName:(NSString*)name;
- (void)deleteObjectWithName:(NSString*)name;
-- (Mocha*)mochaRuntime;
+- (JSGlobalContextRef)context;
- (id)callFunctionNamed:(NSString*)name withArguments:(NSArray*)args;
+ (void)listen;
View
4 src/JSTalk.m
@@ -85,8 +85,8 @@ - (void)dealloc {
}
-- (Mocha*)mochaRuntime {
- return _mochaRuntime;
+- (JSGlobalContextRef)context {
+ return [_mochaRuntime context];
}
- (void)addExtrasToRuntime {
View
10 src/jstalkmain.m
@@ -1,7 +1,6 @@
#import <Cocoa/Cocoa.h>
#import "JSTListener.h"
#import "JSTalk.h"
-//#import "JSCocoaController.h"
BOOL JSCErrorHandlerExitOnError = YES;
@@ -12,16 +11,14 @@ @interface JSCErrorHandler : NSObject {
@implementation JSCErrorHandler
-/*
-- (void)JSCocoa:(JSCocoaController*)controller hadError:(NSString*)error onLineNumber:(NSInteger)lineNumber atSourceURL:(id)url {
+- (void)JSTalk:(JSTalk*)jstalk hadError:(NSString*)error onLineNumber:(NSInteger)lineNumber atSourceURL:(id)url {
printf("Error line %d, %s\n", (int)lineNumber, [[error description] UTF8String]);
if (JSCErrorHandlerExitOnError) {
exit(1);
}
}
- */
@end
@@ -62,12 +59,9 @@ int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- JSCErrorHandler *eh = [[[JSCErrorHandler alloc] init] autorelease];
-
JSTalk *t = [[[JSTalk alloc] init] autorelease];
- //JSCocoaController *jsController = [t jsController];
- //jsController.delegate = eh;
+ [t setErrorController:[[[JSCErrorHandler alloc] init] autorelease]];
if (argc < 2) {
runREPL(t);

0 comments on commit d20aebd

Please sign in to comment.