added helpfile, classfile, implementations, references

This commit is contained in:
rob 2008-12-21 14:19:17 +00:00
parent a3f943efa1
commit 5ec08f4ba6
55 changed files with 2756 additions and 727 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.moved-aside*
build/

26
SC3Controller.h Normal file
View File

@ -0,0 +1,26 @@
//
// SC3Controller.h
// sc3ctrl
//
// Created by Robin Watson on 21/December/2008.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <VVOSC/VVOSC.h>
#include "debug.h"
@interface SC3Controller : NSObject {
OSCManager *manager;
OSCOutPort *outport;
}
- (void)interpretContentsOfEnvironmentVariable:(const char *)var;
- (void)openHelpFile:(NSString *)classname;
- (void)openClassFile:(NSString *)classname;
- (void)openImplementations:(NSString *)method;
- (void)openReferences:(NSString *)method;
- (void)close;
@end

88
SC3Controller.m Normal file
View File

@ -0,0 +1,88 @@
//
// SC3Controller.m
// sc3ctrl
//
// Created by Robin Watson on 21/December/2008.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "SC3Controller.h"
@implementation SC3Controller
- (id)init
{
[super init];
manager = [[OSCManager alloc] init];
outport = [manager createNewOutputToAddress:@"127.0.0.1" atPort:57120];
return self;
}
- (void)interpretContentsOfEnvironmentVariable:(const char *)var
{
char *utf8cmd = getenv(var);
if(utf8cmd == NULL) {
Log(@"$%s is NULL", var);
return;
}
NSString *cmd = [NSString stringWithUTF8String:utf8cmd];
OSCMessage *msg = [OSCMessage createMessageToAddress:@"/sc3ctrl/cmd"];
[msg addString:cmd];
Log(@"Sending cmd %@", cmd);
[outport sendThisMessage:msg];
}
- (void)openHelpFile:(NSString *)classname
{
OSCMessage *msg = [OSCMessage createMessageToAddress:@"/sc3ctrl/help"];
[msg addString:classname];
Log(@"Opening helpfile %@", classname);
[outport sendThisMessage:msg];
}
- (void)openClassFile:(NSString *)classname
{
OSCMessage *msg = [OSCMessage createMessageToAddress:@"/sc3ctrl/class"];
[msg addString:classname];
Log(@"Opening classfile %@", classname);
[outport sendThisMessage:msg];
}
- (void)openImplementations:(NSString *)method
{
OSCMessage *msg = [OSCMessage createMessageToAddress:@"/sc3ctrl/implementations"];
[msg addString:method];
Log(@"Opening implementations of %@", method);
[outport sendThisMessage:msg];
}
- (void)openReferences:(NSString *)method
{
OSCMessage *msg = [OSCMessage createMessageToAddress:@"/sc3ctrl/references"];
[msg addString:method];
Log(@"Opening references to %@", method);
[outport sendThisMessage:msg];
}
- (void)close
{
[manager release];
}
@end

View File

@ -1 +0,0 @@
Versions/Current/Headers

View File

@ -1 +0,0 @@
Versions/Current/Resources

View File

@ -1 +0,0 @@
Versions/Current/VVOSC

View File

@ -1 +0,0 @@
VVOSC.framework

View File

@ -1,28 +0,0 @@
//
// AddressValPair.h
// VVOSC
//
// Created by bagheera on 12/11/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#if IPHONE
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
@interface AddressValPair : NSObject {
NSString *address;
id val;
}
+ (id) createWithAddress:(NSString *)a val:(id)v;
- (id) initWithAddress:(NSString *)a val:(id)v;
- (NSString *) address;
- (id) val;
@end

View File

@ -1,34 +0,0 @@
//
// OSCBundle.h
// OSC
//
// Created by bagheera on 9/20/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#if IPHONE
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
#import "OSCMessage.h"
@interface OSCBundle : NSObject {
NSMutableArray *elementArray; // array of messages or bundles
}
+ (void) parseRawBuffer:(unsigned char *)b ofMaxLength:(int)l toInPort:(id)p;
+ (id) create;
- (void) addElement:(id)n;
- (void) addElementArray:(NSArray *)a;
- (int) bufferLength;
- (void) writeToBuffer:(unsigned char *)b;
@end

View File

@ -1,93 +0,0 @@
//
// OSCInPort.h
// OSC
//
// Created by bagheera on 9/20/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#if IPHONE
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
//#import <sys/types.h>
//#import <sys/socket.h>
#import <netinet/in.h>
#import <pthread.h>
#import "AddressValPair.h"
#import "OSCPacket.h"
#import "OSCBundle.h"
#import "OSCMessage.h"
@protocol OSCInPortDelegateProtocol
- (void) oscMessageReceived:(NSDictionary *)d;
- (void) receivedOSCVal:(id)v forAddress:(NSString *)a;
@end
@protocol OSCDelegateProtocol
- (void) oscMessageReceived:(NSDictionary *)d;
- (void) receivedOSCVal:(id)v forAddress:(NSString *)a;
@end
@interface OSCInPort : NSObject {
BOOL deleted; // whether or not i'm deleted- ensures that socket gets closed
BOOL bound; // whether or not the socket is bound
int sock; // socket file descriptor. remember, everything in unix is files!
struct sockaddr_in addr; // struct that describes *my* address (this is an in port)
short port; // the port number i'm receiving from
BOOL running; // whether or not i should keep running
BOOL busy;
unsigned char buf[8192]; // the socket gets data and dumps it here immediately
pthread_mutex_t lock;
NSTimer *threadTimer;
int threadTimerCount;
NSAutoreleasePool *threadPool;
NSString *portLabel; // the "name" of the port (added to distinguish multiple osc input ports for bonjour)
NSNetService *zeroConfDest; // bonjour service for publishing this input's address...only active if there's a portLabel!
NSMutableDictionary *scratchDict; // key of dict is address port; object at key is a mut. array. coalesced messaging.
NSMutableArray *scratchArray; // array of AddressValPair objects. used for serial messaging.
id delegate; // my delegate gets notified of incoming messages
}
+ (id) createWithPort:(short)p;
+ (id) createWithPort:(short)p labelled:(NSString *)n;
- (id) initWithPort:(short)p;
- (id) initWithPort:(short)p labelled:(NSString *)n;
- (void) prepareToBeDeleted;
- (NSDictionary *) createSnapshot;
- (BOOL) createSocket;
- (void) start;
- (void) stop;
- (void) launchOSCLoop:(id)o;
- (void) OSCThreadProc:(NSTimer *)t;
- (void) parseRawBuffer:(unsigned char *)b ofMaxLength:(int)l;
// if the delegate im
- (void) handleParsedScratchDict:(NSDictionary *)d;
- (void) handleScratchArray:(NSArray *)a;
- (void) addValue:(id)val toAddressPath:(NSString *)p;
- (short) port;
- (void) setPort:(short)n;
- (NSString *) portLabel;
- (void) setPortLabel:(NSString *)n;
- (NSNetService *) zeroConfDest;
- (BOOL) bound;
- (id) delegate;
- (void) setDelegate:(id)n;
@end

View File

@ -1,144 +0,0 @@
//
// OSCManager.h
// OSC
//
// Created by bagheera on 9/20/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#if IPHONE
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
#import "OSCZeroConfManager.h"
#import "OSCInPort.h"
#import "OSCOutPort.h"
#import <pthread.h>
/*
TOP-LEVEL OVERVIEW
this osc manager class is all you need to add to your app. it has methods for
adding and removing ports. you can have as many osc managers as you like, but
you should really only need one instance.
input ports have a delegate- delegate methods are called as the port receives data.
it's important to note that the delegate methods must be thread-safe: each input
port is running on its own (non-main) thread.
data is sent via the output ports (convenience methods for doing this are built
into the osc manager).
GENERAL OSC STRUCTURE AND OVERVIEW
this framework was written from the OSC spec found here:
http://opensoundcontrol.org/spec-1_0
- an OSC packet is the basic unit of transmitting OSC data.
- an OSC packet consists of:
- contents- contiguous block of binary data (either a bundle or a message), and then the
- size- number of 8-bit bytes that comprise 'contents'- ALWAYS multiple of 4!
- an OSC message consists of:
- an OSC address pattern (starting with '/'), followed by
- an OSC type tag string, followed by
- zero or more 'OSC arguments'
- an OSC bundle consists of:
- the OSC-string "#bundle", followed by
- an OSC time tag, followed by
- zero or more 'OSC bundle elements'
- an OSC bundle element consists of:
- 'size' (int32)- number of 8-bit bytes in the contents- ALWAYS multiple of 4!
- 'contents'- either another OSC bundle, or an OSC message
PORTS- SENDING AND RECEIVING UDP/TCP DATA
some basic information, gleaned from:
http://beej.us/guide/bgnet/output/html/multipage/index.html
struct sockaddr {
unsigned short sa_family; // address family, AF_xxx
char sa_data[14]; // 14 bytes of protocol address
}
struct sockaddr_in {
short int sin_family; // address family
unsigned short int sin_port; // port number
struct in_addr sin_addr; // internet address
unsigned char sin_zero[8]; // exists so sockaddr_in has same length as sockaddr
}
recv(int sockfd, void *buf, int len, unsigned int flags);
- sockfd is the socket descriptor to read from
- buf is the buffer to read the information into
- len is the max length of the buffer
- flags can be set to 0
recvfrom(int sockfd, void *buf, int len, unsigned int flags, struct sockaddr *from, int *fromlen);
- from is a pointer to a local struct sockaddr that will be filled with the IP & port of the originating machine
- fromlen is a pointer to a local int that should be initialized to a sizeof(struct sockaddr)- contains length of address actually stored in from on return
...as well as the 4 params listed above in recv()
int select(int numfds, fd_set *readrds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
*/
@interface OSCManager : NSObject {
NSMutableArray *inPortArray;
NSMutableArray *outPortArray;
pthread_rwlock_t inPortLock;
pthread_rwlock_t outPortLock;
id delegate;
OSCZeroConfManager *zeroConfManager; // bonjour/zero-configuration manager
}
- (void) deleteAllInputs;
- (void) deleteAllOutputs;
// methods for creating input ports
- (OSCInPort *) createNewInputFromSnapshot:(NSDictionary *)s;
- (OSCInPort *) createNewInputForPort:(int)p withLabel:(NSString *)l;
- (OSCInPort *) createNewInputForPort:(int)p;
- (OSCInPort *) createNewInput;
// methods for creating output ports
- (OSCOutPort *) createNewOutputFromSnapshot:(NSDictionary *)s;
- (OSCOutPort *) createNewOutputToAddress:(NSString *)a atPort:(int)p withLabel:(NSString *)l;
- (OSCOutPort *) createNewOutputToAddress:(NSString *)a atPort:(int)p;
- (OSCOutPort *) createNewOutput;
// typically, the manager is the input port's delegate- input ports tell delegates when they receive data
// this method is called and contains coalesced messages (grouped by address path)
- (void) oscMessageReceived:(NSDictionary *)d;
// this method is called every time any osc val is processed
- (void) receivedOSCVal:(id)v forAddress:(NSString *)a;
// methods for working with ports
- (NSString *) getUniqueInputLabel;
- (NSString *) getUniqueOutputLabel;
- (OSCInPort *) findInputWithLabel:(NSString *)n;
- (OSCOutPort *) findOutputWithLabel:(NSString *)n;
- (OSCOutPort *) findOutputWithAddress:(NSString *)a andPort:(int)p;
- (OSCOutPort *) findOutputForIndex:(int)i;
- (OSCInPort *) findInputWithZeroConfName:(NSString *)n;
- (void) removeInput:(id)p;
- (void) removeOutput:(id)p;
- (NSArray *) outPortLabelArray;
// subclassable methods for customizing
- (id) inPortClass;
- (NSString *) inPortLabelBase;
- (id) outPortClass;
// misc
- (id) delegate;
- (void) setDelegate:(id)n;
- (NSMutableArray *) inPortArray;
- (NSMutableArray *) outPortArray;
@end

View File

@ -1,43 +0,0 @@
//
// OSCMessage.h
// OSC
//
// Created by bagheera on 9/20/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#if IPHONE
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
#import <pthread.h>
@interface OSCMessage : NSObject {
NSString *address;
NSMutableArray *typeArray;
NSMutableArray *argArray;
pthread_rwlock_t lock;
}
+ (void) parseRawBuffer:(unsigned char *)b ofMaxLength:(int)l toInPort:(id)p;
+ (id) createMessageToAddress:(NSString *)a;
- (id) initWithAddress:(NSString *)a;
- (void) addInt:(int)n;
- (void) addFloat:(float)n;
#if IPHONE
- (void) addColor:(UIColor *)c;
#else
- (void) addColor:(NSColor *)c;
#endif
- (void) addBOOL:(BOOL)n;
- (void) addString:(NSString *)n;
- (int) bufferLength;
- (void) writeToBuffer:(unsigned char *)b;
@end

View File

@ -1,58 +0,0 @@
//
// OSCOutPort.h
// OSC
//
// Created by bagheera on 9/20/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#if IPHONE
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
#include <arpa/inet.h>
#import "OSCPacket.h"
#import "OSCBundle.h"
#import "OSCMessage.h"
@interface OSCOutPort : NSObject {
BOOL deleted;
int sock;
struct sockaddr_in addr;
int port;
NSString *addressString;
NSString *portLabel; // used it to distinguish between multiple osc outputs
}
+ (id) createWithAddress:(NSString *)a andPort:(int)p;
+ (id) createWithAddress:(NSString *)a andPort:(int)p labelled:(NSString *)l;
- (id) initWithAddress:(NSString *)a andPort:(int)p;
- (id) initWithAddress:(NSString *)a andPort:(int)p labelled:(NSString *)l;
- (void) prepareToBeDeleted;
- (NSDictionary *) createSnapshot;
- (BOOL) createSocket;
- (void) sendThisBundle:(OSCBundle *)b;
- (void) sendThisMessage:(OSCMessage *)m;
- (void) sendThisPacket:(OSCPacket *)p;
- (void) setAddressString:(NSString *)n;
- (void) setPort:(int)p;
- (void) setAddressString:(NSString *)n andPort:(int)p;
- (NSString *) portLabel;
- (void) setPortLabel:(NSString *)n;
- (int) port;
- (NSString *) addressString;
@end

View File

@ -1,37 +0,0 @@
//
// OSCPacket.h
// OSC
//
// Created by bagheera on 9/20/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#if IPHONE
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
#include <stdio.h>
#import "OSCBundle.h"
#import "OSCMessage.h"
/*
this class requires a bundle or message on create/init. the buffer/msg
is NOT retained by this class in any way- it's used to immediately create
the buffer which will be sent.
*/
@interface OSCPacket : NSObject {
int bufferLength;
unsigned char *payload;
}
+ (void) parseRawBuffer:(unsigned char *)b ofMaxLength:(int)l toInPort:(id)p;
+ (id) createWithContent:(id)c;
- (id) initWithContent:(id)c;
- (int) bufferLength;
- (unsigned char *) payload;
@end

View File

@ -1,44 +0,0 @@
//
// OSCZeroConfDomain.h
// VVOSC
//
// Created by bagheera on 12/9/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#if IPHONE
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
#import <pthread.h>
#import <sys/socket.h>
#include <arpa/inet.h>
@interface OSCZeroConfDomain : NSObject {
NSString *domainString;
NSNetServiceBrowser *serviceBrowser;
NSMutableArray *servicesArray;
pthread_rwlock_t servicesLock;
id domainManager;
}
+ (id) createWithDomain:(NSString *)d andDomainManager:(id)m;
- (id) initWithDomain:(NSString *)d andDomainManager:(id)m;
// NSNetServiceBrowser delegate methods
- (void)netServiceBrowser:(NSNetServiceBrowser *)n didFindService:(NSNetService *)x moreComing:(BOOL)m;
- (void)netServiceBrowser:(NSNetServiceBrowser *)n didNotSearch:(NSDictionary *)err;
- (void)netServiceBrowser:(NSNetServiceBrowser *)n didRemoveService:(NSNetService *)s moreComing:(BOOL)m;
// NSNetService delegate methods
- (void)netService:(NSNetService *)n didNotResolve:(NSDictionary *)err;
- (void)netServiceDidResolveAddress:(NSNetService *)n;
@end

View File

@ -1,39 +0,0 @@
//
// OSCZeroConfManager.h
// VVOSC
//
// Created by bagheera on 12/9/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#if IPHONE
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
#import "OSCZeroConfDomain.h"
#import <pthread.h>
@interface OSCZeroConfManager : NSObject {
NSNetServiceBrowser *domainBrowser;
NSMutableDictionary *domainDict;
pthread_rwlock_t domainLock;
id oscManager;
}
- (id) initWithOSCManager:(id)m;
- (void) serviceRemoved:(NSNetService *)s;
- (void) serviceResolved:(NSNetService *)s;
// NSNetServiceBrowser delegate methods
- (void)netServiceBrowser:(NSNetServiceBrowser *)n didFindDomain:(NSString *)d moreComing:(BOOL)m;
- (void)netServiceBrowser:(NSNetServiceBrowser *)n didNotSearch:(NSDictionary *)err;
@end

View File

@ -1,9 +0,0 @@
#import "AddressValPair.h"
#import "OSCManager.h"
#import "OSCZeroConfManager.h"
#import "OSCPacket.h"
#import "OSCBundle.h"
#import "OSCMessage.h"

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>VVOSC</string>
<key>CFBundleGetInfoString</key>
<string>0.1.2</string>
<key>CFBundleIdentifier</key>
<string>com.vidvox.VVOSC</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>VVOSC</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.1.2</string>
</dict>
</plist>

Binary file not shown.

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.sc3ctrl</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>dSYM_UUID</key>
<dict>
<key>i386</key>
<string>3318CB70-EB25-6384-E7F4-69918E59B470</string>
<key>ppc</key>
<string>1429EEE0-2EEE-3E06-E7F5-133928D9356C</string>
</dict>
</dict>
</plist>

View File

@ -1 +0,0 @@
/Developer/Projects/sc3ctrl/build/sc3ctrl.build/Release/sc3ctrl.build/Objects-normal/i386/sc3ctrl.o

View File

@ -1 +0,0 @@
/Developer/Projects/sc3ctrl/build/sc3ctrl.build/Release/sc3ctrl.build/Objects-normal/ppc/sc3ctrl.o

11
debug.c Normal file
View File

@ -0,0 +1,11 @@
/*
* debug.c
* sc3ctrl
*
* Created by Robin Watson on 21/December/2008.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*
*/
#include "debug.h"
void DummyLog(NSString* format, ...);

17
debug.h Normal file
View File

@ -0,0 +1,17 @@
/*
* debug.h
* sc3ctrl
*
* Created by Robin Watson on 21/December/2008.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*
*/
#if Debug_Enabled
#define Log( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define Log( s, ... )
#endif

View File

@ -7,4 +7,4 @@
*
*/
void interpretContentsOfEnvironmentVariable(char *var);
#include "debug.h"

View File

@ -1,30 +1,10 @@
#import <Foundation/Foundation.h>
#import <VVOSC/VVOSC.h>
#include "SC3Controller.h"
void interpretContentsOfEnvironmentVariable(const char *var) {
char *utf8cmd = getenv(var);
if(utf8cmd == NULL) {
NSLog(@"$%s is NULL", var);
return;
}
NSString *cmd = [NSString stringWithUTF8String:utf8cmd];
OSCManager *manager = [[OSCManager alloc] init];
OSCOutPort *outport = [manager createNewOutputToAddress:@"127.0.0.1" atPort:57120];
OSCMessage *msg = [OSCMessage createMessageToAddress:@"/sc3ctrl/cmd"];
[msg addString:cmd];
NSLog(@"Sending cmd %@", cmd);
[outport sendThisMessage:msg];
[manager release];
}
int main (int argc, const char **argv) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SC3Controller *controller = [[SC3Controller alloc] init];
if(argv[1] == NULL) {
NSLog(@"Usage: sc3ctrl -x");
@ -32,14 +12,45 @@ int main (int argc, const char **argv) {
NSString *arg = [NSString stringWithUTF8String:argv[1]];
if([arg isEqual:@"-x"]) {
if(argv[2] == NULL) {
interpretContentsOfEnvironmentVariable("SC3_INTERPRET_TEXT");
[controller interpretContentsOfEnvironmentVariable:(argv[2] == NULL ? "SC3_INTERPRET_TEXT" : argv[2])];
return 0;
}
if([arg isEqual:@"-d"]) {
if(argc < 3) {
NSLog(@"Usage: sc3ctrl -d classname");
} else {
interpretContentsOfEnvironmentVariable((const char *)argv[2]);
[controller openHelpFile:[NSString stringWithUTF8String:argv[2]]];
}
}
if([arg isEqual:@"-j"]) {
if(argc < 3) {
NSLog(@"Usage: sc3ctrl -j classname");
} else {
[controller openClassFile:[NSString stringWithUTF8String:argv[2]]];
}
}
if([arg isEqual:@"-y"]) {
if(argc < 3) {
NSLog(@"Usage: sc3ctrl -y methodname");
} else {
[controller openImplementations:[NSString stringWithUTF8String:argv[2]]];
}
}
if([arg isEqual:@"-Y"]) {
if(argc < 3) {
NSLog(@"Usage: sc3ctrl -Y methodname");
} else {
[controller openReferences:[NSString stringWithUTF8String:argv[2]]];
}
}
}
[controller close];
[controller release];
[pool drain];
return 0;
}

View File

@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
567162810EFD45740047EA2B /* VVOSC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 567162800EFD45740047EA2B /* VVOSC.framework */; };
5671631B0EFE70500047EA2B /* SC3Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = 5671631A0EFE70500047EA2B /* SC3Controller.m */; };
8DD76F9A0486AA7600D96B5E /* sc3ctrl.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* sc3ctrl.m */; settings = {ATTRIBUTES = (); }; };
8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; };
8DD76F9F0486AA7600D96B5E /* sc3ctrl.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* sc3ctrl.1 */; };
@ -32,6 +33,9 @@
32A70AAB03705E1F00C91783 /* sc3ctrl_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sc3ctrl_Prefix.pch; sourceTree = "<group>"; };
567162800EFD45740047EA2B /* VVOSC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VVOSC.framework; path = Projects/vvosc/build/Release/VVOSC.framework; sourceTree = DEVELOPER_DIR; };
567162BF0EFE62AD0047EA2B /* sc3ctrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sc3ctrl.h; path = Projects/sc3ctrl/sc3ctrl.h; sourceTree = DEVELOPER_DIR; };
567163190EFE70500047EA2B /* SC3Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SC3Controller.h; path = Projects/sc3ctrl/SC3Controller.h; sourceTree = DEVELOPER_DIR; };
5671631A0EFE70500047EA2B /* SC3Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SC3Controller.m; path = Projects/sc3ctrl/SC3Controller.m; sourceTree = DEVELOPER_DIR; };
567163FE0EFE87020047EA2B /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = debug.h; path = Projects/sc3ctrl/debug.h; sourceTree = DEVELOPER_DIR; };
8DD76FA10486AA7600D96B5E /* sc3ctrl */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = sc3ctrl; sourceTree = BUILT_PRODUCTS_DIR; };
C6859EA3029092ED04C91782 /* sc3ctrl.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = sc3ctrl.1; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -52,7 +56,6 @@
08FB7794FE84155DC02AAC07 /* sc3ctrl */ = {
isa = PBXGroup;
children = (
567162BF0EFE62AD0047EA2B /* sc3ctrl.h */,
08FB7795FE84155DC02AAC07 /* Source */,
C6859EA2029092E104C91782 /* Documentation */,
08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */,
@ -64,8 +67,12 @@
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
567163190EFE70500047EA2B /* SC3Controller.h */,
5671631A0EFE70500047EA2B /* SC3Controller.m */,
567162BF0EFE62AD0047EA2B /* sc3ctrl.h */,
32A70AAB03705E1F00C91783 /* sc3ctrl_Prefix.pch */,
08FB7796FE84155DC02AAC07 /* sc3ctrl.m */,
567163FE0EFE87020047EA2B /* debug.h */,
);
name = Source;
sourceTree = "<group>";
@ -139,6 +146,7 @@
buildActionMask = 2147483647;
files = (
8DD76F9A0486AA7600D96B5E /* sc3ctrl.m in Sources */,
5671631B0EFE70500047EA2B /* SC3Controller.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -188,6 +196,7 @@
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = Debug_Enabled;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
@ -201,6 +210,7 @@
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = "@executable_path/../Frameworks";

File diff suppressed because it is too large Load Diff

View File

@ -283,7 +283,9 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>24</integer>
<integer>2</integer>
<integer>1</integer>
<integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
@ -322,7 +324,7 @@
<key>PBXProjectModuleGUID</key>
<string>567162000EFD3EA50047EA2B</string>
<key>PBXProjectModuleLabel</key>
<string>sc3ctrl.m</string>
<string>SC3Controller.h</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@ -330,15 +332,19 @@
<key>PBXProjectModuleGUID</key>
<string>567162010EFD3EA50047EA2B</string>
<key>PBXProjectModuleLabel</key>
<string>sc3ctrl.m</string>
<string>SC3Controller.h</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>5671630B0EFE688B0047EA2B</string>
<string>567164110EFE87250047EA2B</string>
<key>history</key>
<array>
<string>567162ED0EFE66E70047EA2B</string>
<string>567163050EFE67DE0047EA2B</string>
<string>567164000EFE87250047EA2B</string>
<string>567164010EFE87250047EA2B</string>
<string>567164020EFE87250047EA2B</string>
<string>567164030EFE87250047EA2B</string>
<string>567164040EFE87250047EA2B</string>
<string>567164050EFE87250047EA2B</string>
</array>
<key>prevStack</key>
<array>
@ -364,6 +370,125 @@
<string>567162F20EFE66E70047EA2B</string>
<string>567162F30EFE66E70047EA2B</string>
<string>567162F40EFE66E70047EA2B</string>
<string>567163110EFE6F170047EA2B</string>
<string>567163120EFE6F170047EA2B</string>
<string>567163210EFE72720047EA2B</string>
<string>567163220EFE72720047EA2B</string>
<string>567163230EFE72720047EA2B</string>
<string>567163240EFE72720047EA2B</string>
<string>567163250EFE72720047EA2B</string>
<string>567163260EFE72720047EA2B</string>
<string>567163270EFE72720047EA2B</string>
<string>567163280EFE72720047EA2B</string>
<string>567163290EFE72720047EA2B</string>
<string>5671632A0EFE72720047EA2B</string>
<string>5671632B0EFE72720047EA2B</string>
<string>5671632C0EFE72720047EA2B</string>
<string>5671632D0EFE72720047EA2B</string>
<string>5671632E0EFE72720047EA2B</string>
<string>5671632F0EFE72720047EA2B</string>
<string>567163300EFE72720047EA2B</string>
<string>567163310EFE72720047EA2B</string>
<string>567163320EFE72720047EA2B</string>
<string>567163330EFE72720047EA2B</string>
<string>567163340EFE72720047EA2B</string>
<string>567163350EFE72720047EA2B</string>
<string>567163360EFE72720047EA2B</string>
<string>567163370EFE72720047EA2B</string>
<string>567163380EFE72720047EA2B</string>
<string>567163390EFE72720047EA2B</string>
<string>5671633A0EFE72720047EA2B</string>
<string>5671633B0EFE72720047EA2B</string>
<string>5671633C0EFE72720047EA2B</string>
<string>5671633D0EFE72720047EA2B</string>
<string>5671633E0EFE72720047EA2B</string>
<string>5671633F0EFE72720047EA2B</string>
<string>567163470EFE72D00047EA2B</string>
<string>567163480EFE72D00047EA2B</string>
<string>567163490EFE72D00047EA2B</string>
<string>5671634A0EFE72D00047EA2B</string>
<string>5671634B0EFE72D00047EA2B</string>
<string>5671634C0EFE72D00047EA2B</string>
<string>5671634D0EFE72D00047EA2B</string>
<string>5671634E0EFE72D00047EA2B</string>
<string>5671634F0EFE72D00047EA2B</string>
<string>567163500EFE72D00047EA2B</string>
<string>567163560EFE72FF0047EA2B</string>
<string>567163570EFE72FF0047EA2B</string>
<string>567163580EFE72FF0047EA2B</string>
<string>5671635F0EFE739C0047EA2B</string>
<string>567163600EFE739C0047EA2B</string>
<string>567163610EFE739C0047EA2B</string>
<string>567163620EFE739C0047EA2B</string>
<string>567163630EFE739C0047EA2B</string>
<string>567163640EFE739C0047EA2B</string>
<string>567163690EFE73D20047EA2B</string>
<string>5671636A0EFE73D20047EA2B</string>
<string>567163780EFE74860047EA2B</string>
<string>567163790EFE74860047EA2B</string>
<string>5671637A0EFE74860047EA2B</string>
<string>5671637B0EFE74860047EA2B</string>
<string>5671637C0EFE74860047EA2B</string>
<string>5671637D0EFE74860047EA2B</string>
<string>5671637E0EFE74860047EA2B</string>
<string>5671637F0EFE74860047EA2B</string>
<string>567163800EFE74860047EA2B</string>
<string>567163810EFE74860047EA2B</string>
<string>567163890EFE75BA0047EA2B</string>
<string>5671638A0EFE75BA0047EA2B</string>
<string>5671638B0EFE75BA0047EA2B</string>
<string>5671638C0EFE75BA0047EA2B</string>
<string>5671638D0EFE75BA0047EA2B</string>
<string>5671638E0EFE75BA0047EA2B</string>
<string>5671638F0EFE75BA0047EA2B</string>
<string>567163900EFE75BA0047EA2B</string>
<string>567163910EFE75BA0047EA2B</string>
<string>567163920EFE75BA0047EA2B</string>
<string>5671639C0EFE77480047EA2B</string>
<string>5671639D0EFE77480047EA2B</string>
<string>5671639E0EFE77480047EA2B</string>
<string>567163A60EFE7BB80047EA2B</string>
<string>567163A70EFE7BB80047EA2B</string>
<string>567163A80EFE7BB80047EA2B</string>
<string>567163A90EFE7BB80047EA2B</string>
<string>567163AA0EFE7BB80047EA2B</string>
<string>567163AB0EFE7BB80047EA2B</string>
<string>567163B30EFE83720047EA2B</string>
<string>567163B40EFE83720047EA2B</string>
<string>567163B50EFE83720047EA2B</string>
<string>567163B60EFE83720047EA2B</string>
<string>567163B70EFE83720047EA2B</string>
<string>567163B80EFE83720047EA2B</string>
<string>567163C80EFE85780047EA2B</string>
<string>567163C90EFE85780047EA2B</string>
<string>567163CE0EFE85A10047EA2B</string>
<string>567163D20EFE85BA0047EA2B</string>
<string>567163D90EFE85D50047EA2B</string>
<string>567163ED0EFE86A80047EA2B</string>
<string>567163EF0EFE86A80047EA2B</string>
<string>567163F00EFE86A80047EA2B</string>
<string>567163F10EFE86A80047EA2B</string>
<string>567163F20EFE86A80047EA2B</string>
<string>567163F30EFE86A80047EA2B</string>
<string>567163F40EFE86A80047EA2B</string>
<string>567163F50EFE86A80047EA2B</string>
<string>567163F60EFE86A80047EA2B</string>
<string>567163F70EFE86A80047EA2B</string>
<string>567163F80EFE86A80047EA2B</string>
<string>567163F90EFE86A80047EA2B</string>
<string>567163FA0EFE86A80047EA2B</string>
<string>567163FB0EFE86A80047EA2B</string>
<string>567164060EFE87250047EA2B</string>
<string>567164070EFE87250047EA2B</string>
<string>567164080EFE87250047EA2B</string>
<string>567164090EFE87250047EA2B</string>
<string>5671640A0EFE87250047EA2B</string>
<string>5671640B0EFE87250047EA2B</string>
<string>5671640C0EFE87250047EA2B</string>
<string>5671640D0EFE87250047EA2B</string>
<string>5671640E0EFE87250047EA2B</string>
<string>5671640F0EFE87250047EA2B</string>
<string>567164100EFE87250047EA2B</string>
</array>
</dict>
<key>SplitCount</key>
@ -403,8 +528,6 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {1473, 180}}</string>
<key>RubberWindowFrame</key>
<string>0 93 1680 935 0 0 1680 1028 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -459,6 +582,8 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {1473, 180}}</string>
<key>RubberWindowFrame</key>
<string>0 93 1680 935 0 0 1680 1028 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>

View File

@ -3,6 +3,7 @@
SC3Controller {
classvar nodes;
*initClass {
nodes = List[];
@ -11,8 +12,88 @@ SC3Controller {
var node;
node = OSCresponderNode(nil, '/sc3ctrl/cmd') { |t, r, msg|
msg[1].asString.interpretPrint
}.add
}.add;
nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/help') { |t, r, msg|
{ msg[1].asString.openHelpFile }.defer
}.add;
nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/class') { |t, r, msg|
{ msg[1].asString.interpret.openCodeFile }.defer
}.add;
nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/implementations') { |t, r, msg|
{ SC3Controller.methodTemplates(msg[1]) }.defer
}.add;
nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/references') { |t, r, msg|
{ SC3Controller.methodReferences(msg[1]) }.defer
}.add;
nodes.add(node);
}
}
}
// adapated from Kernel.sc
*methodTemplates { |name|
var out, found = 0, namestring;
out = CollStream.new;
out << "Implementations of '" << name << "' :\n";
Class.allClasses.do({ arg class;
class.methods.do({ arg method;
if (method.name == name, {
found = found + 1;
namestring = class.name ++ ":" ++ name;
out << " " << namestring << " : ";
if (method.argNames.isNil or: { method.argNames.size == 1 }, {
out << "this." << name;
if (name.isSetter, { out << "(val)"; });
},{
out << method.argNames.at(0);
if (name.asString.at(0).isAlpha, {
out << "." << name << "(";
method.argNames.do({ arg argName, i;
if (i > 0, {
if (i != 1, { out << ", " });
out << argName;
});
});
out << ")";
},{
out << " " << name << " ";
out << method.argNames.at(1);
});
});
out.nl;
});
});
});
if(found == 0)
{
Post << "\nNo implementations of '" << name << "'.\n";
}
{
out.collection.newTextWindow(name.asString);
};
}
// adapted from Kernel.sc
*methodReferences { |name|
var out, references;
name = name.asSymbol;
out = CollStream.new;
references = Class.findAllReferences(name);
if (references.notNil, {
out << "References to '" << name << "' :\n";
references.do({ arg ref; out << " " << ref.asString << "\n"; });
out.collection.newTextWindow(name.asString);
},{
Post << "\nNo references to '" << name << "'.\n";
});
}
}