5 // Created by C. Ramakrishnan on Mon Oct 20 2003.
6 // Copyright (c) 2003 __MyCompanyName__. All rights reserved.
11 #import "SCVirtualMachine.h"
13 #include "PyrSymbol.h"
14 #include "PyrObject.h"
15 #include "PyrKernel.h"
17 #include "VMGlobals.h"
19 #import <AppKit/NSPasteboard.h>
23 extern bool compiledOK;
24 extern pthread_mutex_t gLangMutex;
26 @implementation SCService
28 - (void)doExecuteService:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error
30 NSString *pboardString;
33 types = [pboard types];
35 // if there's a problem with the data passed to this method
36 if(![types containsObject:NSStringPboardType] ||
37 !(pboardString = [pboard stringForType:NSStringPboardType])) {
38 *error = NSLocalizedString(@"Error: Pasteboard doesn't contain a string.",
39 @"Pasteboard couldn't give a string.");
44 *error = NSLocalizedString(@"Error: SuperCollider library is not compiled.",
45 @"Could not execute selection.");
49 const char *text = [pboardString UTF8String];
51 [[SCVirtualMachine sharedInstance] setCmdLine: text length: [pboardString length]];
53 pthread_mutex_lock(&gLangMutex);
54 runLibrary(getsym("interpretPrintCmdLine"));
55 pthread_mutex_unlock(&gLangMutex);