Revision: 3314 Author: johnmci Date: 2015-04-26 16:58:12 -0700 (Sun, 26 Apr 2015) Log Message: ----------- arc and modern C support plus compile on iphone arm-64 host Modified Paths: -------------- trunk/platforms/iOS/plugins/ClipboardExtended/sqMacExtendedClipboard.h trunk/platforms/iOS/plugins/ClipboardExtended/sqMacExtendedClipboard.m trunk/platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m trunk/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.h trunk/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m trunk/platforms/iOS/plugins/SqueakObjectiveC/PDColoredProgressView.m trunk/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.h trunk/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m trunk/platforms/iOS/vm/Common/Classes/Queue.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.h trunk/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.h trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.h trunk/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+attributes.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+imageReadWrite.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+vmAndImagePath.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.h trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.h trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.m trunk/platforms/iOS/vm/Common/aio.c trunk/platforms/iOS/vm/Common/main.m trunk/platforms/iOS/vm/MainWindow.xib trunk/platforms/iOS/vm/OSX/SqViewBitmapConversion.m trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.h trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.h trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m trunk/platforms/iOS/vm/OSX/plugins/SoundPlugin/sqSqueakOSXSoundCoreAudio.m trunk/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+clipboard.m trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+imageReadWrite.h trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+imageReadWrite.m trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication.h trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m trunk/platforms/iOS/vm/OSX/sqSqueakOSXClipboardAPI.m trunk/platforms/iOS/vm/OSX/sqSqueakOSXFileDirectoryInterface.m trunk/platforms/iOS/vm/OSX/sqSqueakOSXInfoPlistInterface.h trunk/platforms/iOS/vm/OSX/sqSqueakOSXInfoPlistInterface.m trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.h trunk/platforms/iOS/vm/OSX/sqSqueakOSXNSView.m trunk/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.h trunk/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m trunk/platforms/iOS/vm/Resources-iPad/MainWindow-iPad.xib trunk/platforms/iOS/vm/SqueakPureObjc-Info.plist trunk/platforms/iOS/vm/SqueakPureObjc.xcodeproj/project.pbxproj trunk/platforms/iOS/vm/SqueakPureObjc.xcodeproj/project.xcworkspace/xcuserdata/johnmci.xcuserdatad/UserInterfaceState.xcuserstate trunk/platforms/iOS/vm/SqueakPureObjc.xcodeproj/xcuserdata/johnmci.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist trunk/platforms/iOS/vm/iPhone/Classes/SqueakNoOGLIPhoneAppDelegate.h trunk/platforms/iOS/vm/iPhone/Classes/SqueakNoOGLIPhoneAppDelegate.m trunk/platforms/iOS/vm/iPhone/Classes/SqueakUIController.m trunk/platforms/iOS/vm/iPhone/Classes/SqueakUIView.h trunk/platforms/iOS/vm/iPhone/Classes/SqueakUIView.m trunk/platforms/iOS/vm/iPhone/Classes/SqueakUIViewCALayer.m trunk/platforms/iOS/vm/iPhone/Classes/SqueakUIViewOpenGL.m trunk/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneApplication+clipboard.h trunk/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneApplication+clipboard.m trunk/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneApplication+events.m trunk/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneApplication+imageReadWrite.h trunk/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneApplication+imageReadWrite.m trunk/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneApplication.m trunk/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneClipboardAPI.m trunk/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneFileDirectoryInterface.m trunk/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneInfoPlistInterface.m trunk/platforms/iOS/vm/iPhone/Classes/sqiPhoneScreenAndWindow.m trunk/platforms/iOS/vm/iPhone/config.h trunk/platforms/iOS/vm/iPhone/plugins/ClipboardExtended/sqMacExtendedClipboard.h trunk/platforms/iOS/vm/iPhone/plugins/ClipboardExtended/sqMacExtendedClipboard.m trunk/platforms/iOS/vm/iPhone/sqPlatformSpecific.h trunk/platforms/iOS/vm/src/vm/intplugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c trunk/platforms/iOS/vm/src/vm/sqNamedPrims.h Modified: trunk/platforms/iOS/plugins/ClipboardExtended/sqMacExtendedClipboard.h =================================================================== --- trunk/platforms/iOS/plugins/ClipboardExtended/sqMacExtendedClipboard.h 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/plugins/ClipboardExtended/sqMacExtendedClipboard.h 2015-04-26 23:58:12 UTC (rev 3314) @@ -29,10 +29,15 @@ */ /* The virtual machine proxy definition */ #include "sqVirtualMachine.h" +#ifdef BUILD_FOR_OSX +typedef NSPasteboard * CLIPBOARDTYPE; +#else +typedef UIPasteboard * CLIPBOARDTYPE; +#endif -void sqPasteboardClear( void * inPasteboard ); -sqInt sqPasteboardGetItemCount ( void *inPasteboard ); -sqInt sqPasteboardCopyItemFlavorsitemNumber ( void *inPasteboard, sqInt formatNumber ); +void sqPasteboardClear( CLIPBOARDTYPE inPasteboard ); +sqInt sqPasteboardGetItemCount ( CLIPBOARDTYPE inPasteboard ); +sqInt sqPasteboardCopyItemFlavorsitemNumber ( CLIPBOARDTYPE inPasteboard, sqInt formatNumber ); void * sqCreateClipboard( void ); -void sqPasteboardPutItemFlavordatalengthformatTypeformatLength ( void *inPasteboard, char* inData, sqInt dataLength, char* format, sqInt formatLength); -sqInt sqPasteboardCopyItemFlavorDataformatformatLength ( void* inPasteboard, char* format, sqInt formatLength); +void sqPasteboardPutItemFlavordatalengthformatTypeformatLength ( CLIPBOARDTYPE inPasteboard, char* inData, sqInt dataLength, char* format, sqInt formatLength); +sqInt sqPasteboardCopyItemFlavorDataformatformatLength ( CLIPBOARDTYPE inPasteboard, char* format, sqInt formatLength); Modified: trunk/platforms/iOS/plugins/ClipboardExtended/sqMacExtendedClipboard.m =================================================================== --- trunk/platforms/iOS/plugins/ClipboardExtended/sqMacExtendedClipboard.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/plugins/ClipboardExtended/sqMacExtendedClipboard.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -31,35 +31,33 @@ #include "sqMacExtendedClipboard.h" #import <Cocoa/Cocoa.h> - extern struct VirtualMachine* interpreterProxy; -void sqPasteboardClear(void *inPasteboard ) +void sqPasteboardClear(CLIPBOARDTYPE inPasteboard ) { NSArray *arrayOfTypes = [[NSArray alloc] init]; - [(NSPasteboard*) inPasteboard declareTypes: arrayOfTypes owner: nil]; - [arrayOfTypes release]; + [inPasteboard declareTypes: arrayOfTypes owner: nil]; } -sqInt sqPasteboardGetItemCount (void *inPasteboard ) +sqInt sqPasteboardGetItemCount (CLIPBOARDTYPE inPasteboard ) { - return [[(NSPasteboard *)inPasteboard types] count]; + return [[inPasteboard types] count]; } -sqInt sqPasteboardCopyItemFlavorsitemNumber ( void *inPasteboard, sqInt formatNumber ) +sqInt sqPasteboardCopyItemFlavorsitemNumber ( CLIPBOARDTYPE inPasteboard, sqInt formatNumber ) { sqInt formatTypeLength; sqInt flavorCount; - flavorCount = [[(NSPasteboard *)inPasteboard types] count]; + flavorCount = [[inPasteboard types] count]; if (formatNumber > flavorCount) { return interpreterProxy->nilObject(); } - NSString *formatType = [[(NSPasteboard *)inPasteboard types] objectAtIndex: formatNumber-1]; + NSString *formatType = [inPasteboard types][formatNumber-1]; const char *utf8data = [formatType UTF8String]; formatTypeLength = strlen(utf8data); @@ -72,42 +70,35 @@ void * sqCreateClipboard( void ) { - return (void*) [NSPasteboard generalPasteboard]; + return (__bridge void*) [NSPasteboard generalPasteboard]; } -void sqPasteboardPutItemFlavordatalengthformatTypeformatLength ( void *inPasteboard, char* inData, sqInt dataLength, char* format, sqInt formatLength) +void sqPasteboardPutItemFlavordatalengthformatTypeformatLength ( CLIPBOARDTYPE inPasteboard, char* inData, sqInt dataLength, char* format, sqInt formatLength) { NSString *formatType = [[NSString alloc] initWithBytes: format length: formatLength encoding: NSUTF8StringEncoding]; NSData* data = [[NSData alloc ] initWithBytes: inData length: dataLength]; NSArray *arrayOfTypes = [[NSArray alloc] initWithObjects: formatType,nil]; - [(NSPasteboard *)inPasteboard declareTypes: arrayOfTypes owner: nil]; - [(NSPasteboard *)inPasteboard setData: data forType: formatType]; + [inPasteboard declareTypes: arrayOfTypes owner: nil]; + [inPasteboard setData: data forType: formatType]; - [arrayOfTypes release]; - [data release]; - [formatType release]; } -sqInt sqPasteboardCopyItemFlavorDataformatformatLength ( void *inPasteboard, char* format, sqInt formatLength) +sqInt sqPasteboardCopyItemFlavorDataformatformatLength ( CLIPBOARDTYPE inPasteboard, char* format, sqInt formatLength) { NSString *formatType = [[NSString alloc] initWithBytes: format length: formatLength encoding: NSUTF8StringEncoding]; NSArray *arrayOfTypes = [[NSArray alloc] initWithObjects: formatType,nil]; - NSString *type= [(NSPasteboard *)inPasteboard availableTypeFromArray: arrayOfTypes]; + NSString *type= [inPasteboard availableTypeFromArray: arrayOfTypes]; if (type == NULL) { - [formatType release]; - [arrayOfTypes release]; return interpreterProxy->nilObject(); } - NSData *dataBuffer = [(NSPasteboard *)inPasteboard dataForType: type]; + NSData *dataBuffer = [inPasteboard dataForType: type]; sqInt dataLength = [dataBuffer length]; sqInt outData = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), dataLength ); char *outDataPtr = (char *) interpreterProxy->firstIndexableField(outData); [dataBuffer getBytes: outDataPtr]; - [formatType release]; - [arrayOfTypes release]; return outData; } \ No newline at end of file Modified: trunk/platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m =================================================================== --- trunk/platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -21,7 +21,7 @@ MenuRef GetMenuHandle(MenuID menuID){ NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu]; NSMenuItem *menuRef = [mainMenu itemAtIndex: menuID]; - MenuRef handle = (MenuRef)menuRef; + MenuRef handle = (__bridge MenuRef)menuRef; return handle; }; @@ -222,7 +222,7 @@ MenuID GetMenuID(MenuRef menu){ NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu]; - NSMenuItem *menuItem = (NSMenuItem *) menu; + NSMenuItem *menuItem = (__bridge NSMenuItem *) menu; return (MenuID) [mainMenu indexOfItem: menuItem]; }; @@ -273,6 +273,6 @@ MenuItemIndex * outIndex){ NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu]; - NSMenuItem *inputMenu = (NSMenuItem *) inMenu; + NSMenuItem *inputMenu = (__bridge NSMenuItem *) inMenu; OSType inputCommandID = inCommandID; }; \ No newline at end of file Modified: trunk/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.h =================================================================== --- trunk/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.h 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.h 2015-04-26 23:58:12 UTC (rev 3314) @@ -89,8 +89,8 @@ @property (nonatomic) AudioStreamBasicDescription* inputFormat; @property (nonatomic) AudioQueueBufferRef * outputBuffers; @property (nonatomic) AudioQueueBufferRef * inputBuffers; -@property (nonatomic,retain) Queue* soundOutQueue; -@property (nonatomic,retain) Queue* soundInQueue; +@property (nonatomic,strong) Queue* soundOutQueue; +@property (nonatomic,strong) Queue* soundInQueue; @end @interface soundAtom : NSObject { @@ -98,7 +98,7 @@ usqInt byteCount; usqInt startOffset; } -- (id) initWith: (char*) buffer count: (usqInt) bytes; +- (instancetype) initWith: (char*) buffer count: (usqInt) bytes; @property (nonatomic,assign) char * data; @property (nonatomic,assign) usqInt byteCount; Modified: trunk/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m =================================================================== --- trunk/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -40,15 +40,14 @@ #define SqueakFrameSize 4 // guaranteed (see class SoundPlayer) extern struct VirtualMachine* interpreterProxy; -void MyAudioQueueOutputCallback (void *inUserData, +void MyAudioQueueOutputCallback (sqSqueakSoundCoreAudio *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer); -void MyAudioQueueOutputCallback (void *inUserData, +void MyAudioQueueOutputCallback (sqSqueakSoundCoreAudio *myInstance, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) { - sqSqueakSoundCoreAudio * myInstance = ( sqSqueakSoundCoreAudio *)inUserData; soundAtom *atom = [myInstance.soundOutQueue returnOldest]; if (!atom) { @@ -60,7 +59,6 @@ atom = [myInstance.soundOutQueue returnAndRemoveOldest]; inBuffer->mAudioDataByteSize = (int) atom.byteCount; memcpy(inBuffer->mAudioData,atom.data,atom.byteCount); - [atom release]; //NSLog(@"%i Fill sound buffer with %i bytesA",ioMSecs(),inBuffer->mAudioDataByteSize); } else { inBuffer->mAudioDataByteSize = (int) MIN(atom.byteCount - atom.startOffset,inBuffer->mAudioDataBytesCapacity); @@ -68,7 +66,6 @@ atom.startOffset = atom.startOffset + inBuffer->mAudioDataByteSize; if (atom.startOffset == atom.byteCount) { atom = [myInstance.soundOutQueue returnAndRemoveOldest]; //ignore now it's empty - [atom release]; } //NSLog(@"%i Fill sound buffer with %i bytesB",ioMSecs(),inBuffer->mAudioDataByteSize); } @@ -87,7 +84,7 @@ { sqInt isRunning; UInt32 size = sizeof(isRunning); - sqSqueakSoundCoreAudio * myInstance = ( sqSqueakSoundCoreAudio *)inUserData; + sqSqueakSoundCoreAudio * myInstance = (__bridge sqSqueakSoundCoreAudio *)inUserData; AudioQueueGetProperty (inAQ, kAudioQueueProperty_IsRunning, &isRunning, &size); myInstance.outputIsRunning = isRunning; @@ -111,7 +108,7 @@ UInt32 inNumberPacketDescriptions, const AudioStreamPacketDescription *inPacketDescs) { - sqSqueakSoundCoreAudio * myInstance = ( sqSqueakSoundCoreAudio *)inUserData; + sqSqueakSoundCoreAudio * myInstance = (__bridge sqSqueakSoundCoreAudio *)inUserData; if (!myInstance.inputIsRunning) return; @@ -119,7 +116,6 @@ if (inNumberPacketDescriptions > 0) { soundAtom *atom = [[soundAtom alloc] initWith: inBuffer->mAudioData count: inBuffer->mAudioDataByteSize]; [myInstance.soundInQueue addItem: atom]; - [atom release]; } AudioQueueEnqueueBuffer (inAQ, @@ -136,7 +132,7 @@ @synthesize byteCount; @synthesize startOffset; -- initWith: (char*) buffer count: (usqInt) bytes { +- (instancetype) initWith: (char*) buffer count: (usqInt) bytes { data = malloc(bytes); memcpy(data,buffer,bytes); byteCount = bytes; @@ -149,7 +145,6 @@ data = 0; byteCount = 0; startOffset = 0; - [super dealloc]; } @end @@ -182,8 +177,8 @@ self.inputFormat = calloc(1,sizeof(AudioStreamBasicDescription)); self.outputBuffers = calloc((unsigned)kNumberOfBuffers,sizeof(AudioQueueBufferRef)); self.inputBuffers = calloc((unsigned) kNumberOfBuffers,sizeof(AudioQueueBufferRef)); - soundOutQueue = [Queue new]; - soundInQueue = [Queue new]; + soundOutQueue = [[Queue alloc] init]; + soundInQueue = [[Queue alloc] init]; return 1; } @@ -221,14 +216,14 @@ /* we want to create a new audio queue only if we have to */ - if (self.outputAudioQueue == nil || (memcmp(&check,self.outputFormat,sizeof(AudioStreamBasicDescription) != 0))) { + if (self.outputAudioQueue == nil || (memcmp(&check,self.outputFormat,(size_t)(sizeof(AudioStreamBasicDescription) != 0)))) { AudioQueueRef newQueue; //NSLog(@"%i create new audioqueue",ioMSecs()); if (self.outputAudioQueue) [self snd_StopAndDispose]; *self.outputFormat = check; - result = AudioQueueNewOutput (self.outputFormat, &MyAudioQueueOutputCallback, - (void*) self, + result = AudioQueueNewOutput (self.outputFormat, (void*) &MyAudioQueueOutputCallback, + (__bridge void*) self, NULL, NULL, 0, @@ -238,7 +233,7 @@ return interpreterProxy->primitiveFail(); self.outputAudioQueue = newQueue; - AudioQueueAddPropertyListener (self.outputAudioQueue, kAudioQueueProperty_IsRunning, MyAudioQueuePropertyListenerProc, self); + AudioQueueAddPropertyListener (self.outputAudioQueue, kAudioQueueProperty_IsRunning, MyAudioQueuePropertyListenerProc, (__bridge void *)(self)); self.bufferSizeForOutput = (unsigned) (SqueakFrameSize * nChannels * frameCount * 2); int i; @@ -285,7 +280,7 @@ OSStatus result = AudioQueueDispose (self.outputAudioQueue,true); #pragma unused(result) self.outputAudioQueue = nil; - self.soundOutQueue = [Queue new]; + self.soundOutQueue = [[Queue alloc] init]; return 1; } @@ -314,7 +309,6 @@ soundAtom *atom = [[soundAtom alloc] initWith: arrayIndex+startIndex count: (unsigned) (byteCount-startIndex)]; [self.soundOutQueue addItem: atom]; - [atom release]; if (!self.outputIsRunning) { int i; @@ -365,7 +359,7 @@ AudioQueueRef newQueue; OSStatus result = AudioQueueNewInput (self.inputFormat, &MyAudioQueueInputCallback, - (void*) self, + (__bridge void*) self, NULL, NULL, 0, @@ -401,7 +395,7 @@ return 0; result = AudioQueueDispose (self.inputAudioQueue,true); self.inputAudioQueue = nil; - self.soundInQueue = [Queue new]; + self.soundInQueue = [[Queue alloc] init]; return 1; } @@ -429,7 +423,6 @@ atom = [self.soundInQueue returnAndRemoveOldest]; memcpy(arrayIndex+start,atom.data,atom.byteCount); count= MIN(atom.byteCount, bufferSizeInBytes - start); - [atom release]; return count / (SqueakFrameSize / 2) / self.inputChannels; } else { count= MIN(atom.byteCount-atom.startOffset, bufferSizeInBytes - start); @@ -437,7 +430,6 @@ atom.startOffset = atom.startOffset + (count); if (atom.startOffset == atom.byteCount) { atom = [self.soundInQueue returnAndRemoveOldest]; //ignore now it's empty - [atom release]; } return count / (SqueakFrameSize / 2) / self.inputChannels; } Modified: trunk/platforms/iOS/plugins/SqueakObjectiveC/PDColoredProgressView.m =================================================================== --- trunk/platforms/iOS/plugins/SqueakObjectiveC/PDColoredProgressView.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/plugins/SqueakObjectiveC/PDColoredProgressView.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -104,15 +104,10 @@ } - (void) setTintColor: (UIColor *) aColor { - [_tintColor release]; - _tintColor = [aColor retain]; + _tintColor = aColor; } -- (void)dealloc { - [super dealloc]; - [_tintColor release]; -} @end Modified: trunk/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.h =================================================================== --- trunk/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.h 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.h 2015-04-26 23:58:12 UTC (rev 3314) @@ -74,24 +74,24 @@ @interface SqueakProxy : NSObject { sqInt sem; - Protocol* protocol; - NSInvocation* invocation; + Protocol* __unsafe_unretained protocol; + NSInvocation* __weak invocation; NSConditionLock* lockForSqueak; NSMutableDictionary *sigs; id target; sqInt callbackid; BOOL isCarbonVM; } -- (id) initWithSemaphore: (sqInt) squeakSem protocolNSString: (NSString *) nameString target: (id) aTarget; +- (instancetype) initWithSemaphore: (sqInt) squeakSem protocolNSString: (NSString *) nameString target: (id) aTarget; - (void) setReturnValue: (void*) pointer; - (BOOL) isDataTypeAware; - (void) setIsCarbonVM; @property (nonatomic,assign) sqInt sem; -@property (nonatomic,assign) Protocol* protocol; -@property (nonatomic,assign) NSInvocation* invocation; -@property (nonatomic,assign) NSConditionLock* lockForSqueak; -@property (nonatomic,assign) NSMutableDictionary *sigs; -@property (nonatomic,retain) id target; +@property (nonatomic,unsafe_unretained) Protocol* protocol; +@property (weak, nonatomic) NSInvocation* invocation; +@property (nonatomic) NSConditionLock* lockForSqueak; +@property (nonatomic) NSMutableDictionary *sigs; +@property (nonatomic,strong) id target; @property (nonatomic,assign) sqInt callbackid; @end Modified: trunk/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m =================================================================== --- trunk/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -44,8 +44,8 @@ // #import "squeakProxy.h" +#include <dlfcn.h> - @implementation SqueakProxy @synthesize sem; @@ -56,7 +56,7 @@ @synthesize target; @synthesize callbackid; -- (id) initWithSemaphore: (sqInt) squeakSem protocolNSString: (NSString *) nameString target: aTarget +- (instancetype) initWithSemaphore: (sqInt) squeakSem protocolNSString: (NSString *) nameString target: aTarget { sem = squeakSem; if (nameString) @@ -69,7 +69,6 @@ } else { NSObject *dummy = [[NSObject alloc] init]; [self setTarget: dummy]; - [dummy release]; } lockForSqueak = [[NSConditionLock alloc] initWithCondition: 0]; @@ -80,7 +79,7 @@ return self; } -#include <dlfcn.h> + - (void) forwardInvocation: (NSInvocation*) anInvocation { NSDate *timeout; @@ -88,7 +87,7 @@ // NSLog(@"currentThread: %@", [NSThread currentThread]); SEL selector = [anInvocation selector]; NSString *selectorString = NSStringFromSelector(selector); - if (![sigs objectForKey: selectorString]) { + if (!sigs[selectorString]) { [anInvocation invokeWithTarget: target]; return; } @@ -97,8 +96,7 @@ { // NSLog(@"inside lock 0"); [lockForSqueak unlockWithCondition: 1]; - [timeout release]; - invocation = [anInvocation retain]; + invocation = anInvocation; // NSLog(@"signalling squeak"); interpreterProxy->signalSemaphoreWithIndex(sem); @@ -109,16 +107,12 @@ if([lockForSqueak lockWhenCondition: 2 beforeDate: (timeout = [[NSDate alloc] initWithTimeIntervalSinceNow: 5.0])]) { // NSLog(@"inside lock 2"); - [timeout release]; - [invocation release]; invocation = nil; [lockForSqueak unlockWithCondition: 0]; } else { // NSLog(@"failed lock 2"); - [timeout release]; - [invocation release]; invocation = nil; [lockForSqueak unlockWithCondition: 0]; } @@ -126,7 +120,6 @@ } else { - [timeout release]; //NSLog(@"failed lock 0"); } } @@ -145,7 +138,7 @@ NSString *selectorString = NSStringFromSelector (selector); - if (sigAsString = [sigs objectForKey: selectorString]) { + if (sigAsString = sigs[selectorString]) { if (protocol) { struct objc_method_description methodDescription; @@ -176,7 +169,7 @@ NSString *which = NSStringFromSelector(selector); - if ([sigs objectForKey: which]) + if (sigs[which]) return true; return false; @@ -194,13 +187,6 @@ isCarbonVM = YES; } -- (void) dealloc -{ - [lockForSqueak release]; - [sigs release]; - [target release]; - [super dealloc]; -} @end Modified: trunk/platforms/iOS/vm/Common/Classes/Queue.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/Queue.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/Queue.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -52,6 +52,8 @@ */ +/* Arc version */ + #import "Queue.h" @@ -59,7 +61,7 @@ // Initialize a empty mutable array for queue items // which we can fill -- (id) init +- (instancetype) init { self = [super init]; { @@ -78,7 +80,6 @@ anObject = [mItemArray lastObject]; if (anObject) { - [anObject retain]; [mItemArray removeLastObject]; } } @@ -113,11 +114,5 @@ return mItemArray; } -- (void) dealloc -{ - [mItemArray release]; - - [super dealloc]; -} @end Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.h =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.h 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.h 2015-04-26 23:58:12 UTC (rev 3314) @@ -44,15 +44,15 @@ @interface sqSqueakAppDelegate : NSObject { sqSqueakMainApplication *squeakApplication; + NSThread *squeakThread; } -@property (nonatomic,retain) sqSqueakMainApplication *squeakApplication; +@property (nonatomic,strong) sqSqueakMainApplication *squeakApplication; +@property (nonatomic, strong) NSThread *squeakThread; - (void) makeMainWindowOnMainThread ; - (void) makeMainWindow; - (id) createPossibleWindow; -- (NSTimeInterval) squeakUIFlushPrimaryDeferNMilliseconds; -- (sqSqueakMainApplication *) makeApplicationInstance; - (void) workerThreadStart; - (void) singleThreadStart; - +- (NSTimeInterval) squeakUIFlushPrimaryDeferNMilliseconds; @end Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -42,7 +42,7 @@ #import "sqMacHostWindow.h" @implementation sqSqueakAppDelegate -@synthesize squeakApplication; +@synthesize squeakApplication,squeakThread; - (void) makeMainWindow { @@ -60,7 +60,7 @@ width = ((unsigned) getSavedWindowSize()) >> 16; height = getSavedWindowSize() & 0xFFFF; windowBlock = AddWindowBlock(); - windowBlock-> handle = createdWindow; + windowBlock->handle = createdWindow; windowBlock->context = nil; windowBlock->updateArea = CGRectZero; width = (usqInt) ioScreenSize() >> 16; @@ -88,14 +88,14 @@ - (void) workerThreadStart { // Run the squeak process in a worker thread - NSThread* myThread = [[NSThread alloc] initWithTarget: self.squeakApplication + squeakThread = [[NSThread alloc] initWithTarget: self.squeakApplication selector: @selector(runSqueak) object:nil]; #if COGVM - [myThread setStackSize: [myThread stackSize]*4]; + [squeakThread setStackSize: [squeakThread stackSize]*4]; #endif - [myThread start]; + [squeakThread start]; } - (void) singleThreadStart { @@ -106,13 +106,9 @@ target: self.squeakApplication argument: nil order: 1 - modes: [NSArray arrayWithObject: NSDefaultRunLoopMode]]; + modes: @[NSDefaultRunLoopMode]]; } -- (void)dealloc { - [squeakApplication release]; - [super dealloc]; -} @end Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -53,6 +53,11 @@ aioPoll(0); + if ([[NSThread currentThread] isCancelled]) { + gQuitNowRightNow = YES; + return 0; + } + if ([getMainWindowDelegate() forceUpdateFlush]) { [getMainWindowDelegate() ioForceDisplayUpdate]; } @@ -83,4 +88,4 @@ NSLog(@"evt.type %i keyboard pc %i cc %i uc %i m %i",evt->type,((sqKeyboardEvent *)evt)->pressCode,((sqKeyboardEvent *) evt)->charCode,((sqKeyboardEvent *) evt)->utf32Code,((sqKeyboardEvent *) evt)->modifiers); } */ return 0; -} \ No newline at end of file +} Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -56,13 +56,13 @@ filenameSize is size of file name fType and fCreator is type and creator codes (4 bytes preallocated) */ - NSAutoreleasePool * pool = [NSAutoreleasePool new]; - sqInt status = [gDelegateApp.squeakApplication.fileDirectoryLogic dir_GetMacFileTypeAndCreator: filename - fileNameSize: filenameSize - fType: fType - fCreator: fCreator]; - [pool drain]; + @autoreleasepool { + sqInt status = [gDelegateApp.squeakApplication.fileDirectoryLogic dir_GetMacFileTypeAndCreator: filename + fileNameSize: filenameSize + fType: fType + fCreator: fCreator]; return status; + } } sqInt dir_SetMacFileTypeAndCreator(char *filename, sqInt filenameSize, char *fType, char *fCreator) { @@ -71,13 +71,14 @@ filenameSize is size of file name fType and fCreator is type and creator codes (4 bytes) */ - NSAutoreleasePool * pool = [NSAutoreleasePool new]; + @autoreleasepool { sqInt status = [gDelegateApp.squeakApplication.fileDirectoryLogic dir_SetMacFileTypeAndCreator: filename fileNameSize: filenameSize fType: fType fCreator: fCreator]; - [pool drain]; + return status; + } } sqInt dir_Delimitor(void) @@ -102,9 +103,8 @@ /*Implementation notes if pathStringLength = 0 then we use the current working directory if pathStringLength > 0 then we resolve the pathString and alias */ - NSAutoreleasePool * pool = [NSAutoreleasePool new]; - - sqInt status = + @autoreleasepool { + sqInt status = [gDelegateApp.squeakApplication.fileDirectoryLogic dir_Lookup: pathString length: pathStringLength index: index @@ -114,16 +114,15 @@ modificationDate: modificationDate isDirectory: isDirectory sizeIfFile: sizeIfFile]; - [pool drain]; return status; + } } sqInt dir_EntryLookup(char *pathString, sqInt pathStringLength, char* nameString, sqInt nameStringLength, /* outputs: */ char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate, sqInt *isDirectory, squeakFileOffsetType *sizeIfFile) { - NSAutoreleasePool * pool = [NSAutoreleasePool new]; - + @autoreleasepool { sqInt status = [gDelegateApp.squeakApplication.fileDirectoryLogic dir_EntryLookup: pathString length: pathStringLength @@ -135,36 +134,34 @@ modificationDate: modificationDate isDirectory: isDirectory sizeIfFile: sizeIfFile]; - [pool drain]; return status; + } } sqInt dir_Create(char *pathString, sqInt pathStringLength){ //API Documented - NSAutoreleasePool * pool = [NSAutoreleasePool new]; + @autoreleasepool { sqInt status = [gDelegateApp.squeakApplication.fileDirectoryLogic dir_Create: pathString length: pathStringLength]; - [pool drain]; return status; + } } sqInt dir_Delete(char *pathString, sqInt pathStringLength){ - NSAutoreleasePool * pool = [NSAutoreleasePool new]; + @autoreleasepool { sqInt status = [gDelegateApp.squeakApplication.fileDirectoryLogic dir_Delete: pathString length: pathStringLength]; - [pool drain]; return status; + } } -NSString* createFilePathFromString(char * aFilenameString, +NSString* createFilePathFromString(char * aFilenameString, sqInt filenameLength, sqInt resolveAlias) { - - NSAutoreleasePool * pool = [NSAutoreleasePool new]; - NSString * filePath = [[[NSString alloc] initWithBytes: aFilenameString length: (NSUInteger) filenameLength encoding: NSUTF8StringEncoding] autorelease]; + @autoreleasepool { + NSString * filePath = [[NSString alloc] initWithBytes: aFilenameString length: (NSUInteger) filenameLength encoding: NSUTF8StringEncoding]; if (!filePath) { - [pool drain]; return NULL; } @@ -175,12 +172,11 @@ NSString *newFilePath = [gDelegateApp.squeakApplication.fileDirectoryLogic resolvedAliasFiles: owningDirectoryPath]; filePath = [newFilePath stringByAppendingPathComponent: [filePath lastPathComponent]]; } - [filePath retain]; - [pool drain]; return filePath; + } } -sqInt sqGetFilenameFromString(char * aCharBuffer, char * aFilenameString, +sqInt sqGetFilenameFromString(char * aCharBuffer, char * aFilenameString, sqInt filenameLength, sqInt resolveAlias) { //API Documented BOOL ok; @@ -194,7 +190,6 @@ //1000 is coded by callers, really should pass in, but historical issue, this also includes null byte which is accounted for by maxLength //Obviously this is a problem that lets a caller do a buffer overflow? - [filePath release]; return 0; } @@ -205,4 +200,4 @@ sqInt dir_PathToWorkingDir(char *pathName, sqInt pathNameMax){ //API Documented return 0; -} \ No newline at end of file +} Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.h =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.h 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.h 2015-04-26 23:58:12 UTC (rev 3314) @@ -80,9 +80,9 @@ fCreator: (char *) fCreator; - (NSString *) resolvedAliasFiles: (NSString *) filePath; -@property (nonatomic,retain) NSString* lastPathForDirLookup; +@property (nonatomic,strong) NSString* lastPathForDirLookup; @property (nonatomic,assign) NSInteger lastIndexForDirLookup; -@property (nonatomic,retain) NSArray * directoryContentsForDirLookup; +@property (nonatomic,strong) NSArray * directoryContentsForDirLookup; @end Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -103,7 +103,7 @@ } if (pathStringLength > 0) - directoryPath = [[[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding] autorelease]; + directoryPath = [[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding]; if (directoryPath == NULL) return BAD_PATH; @@ -135,7 +135,7 @@ if (index < 1 || (NSUInteger) index > [directoryContentsForDirLookup count]) return NO_MORE_ENTRIES; - filePath = [ directoryContentsForDirLookup objectAtIndex: (NSUInteger) (index-1)]; + filePath = directoryContentsForDirLookup[(NSUInteger) (index-1)]; filePath = [[ lastPathForDirLookup stringByAppendingString: @"/"] stringByAppendingString: filePath] ; fileName = [[filePath lastPathComponent] precomposedStringWithCanonicalMapping]; strlcpy(name,[fileName UTF8String],256); @@ -155,19 +155,20 @@ if (!fileAttributes) { return ENTRY_FOUND; } - fileType = [fileAttributes objectForKey: NSFileType]; + fileType = fileAttributes[NSFileType]; *isDirectory = [fileType isEqualToString: NSFileTypeDirectory] ? 1 : 0; } else { NSDictionary *fileAttributesPossibleAlias = [fileMgr attributesOfItemAtPath: newFilePath error: &error]; // do symbolic link - fileAttributes = fileAttributesPossibleAlias; + if (!fileAttributes) + fileAttributes = fileAttributesPossibleAlias; - fileType = [fileAttributesPossibleAlias objectForKey: NSFileType]; + fileType = fileAttributesPossibleAlias[NSFileType]; *isDirectory = [fileType isEqualToString: NSFileTypeDirectory] ? 1 : 0; } - *creationDate = convertToSqueakTime([fileAttributes objectForKey: NSFileCreationDate ]); - *modificationDate = convertToSqueakTime([fileAttributes objectForKey: NSFileModificationDate]); - *sizeIfFile = [[fileAttributes objectForKey: NSFileSize] integerValue]; + *creationDate = convertToSqueakTime(fileAttributes[NSFileCreationDate]); + *modificationDate = convertToSqueakTime(fileAttributes[NSFileModificationDate]); + *sizeIfFile = [fileAttributes[NSFileSize] integerValue]; /* POSSIBLE IPHONE BUG CHECK */ if (*creationDate == 0) @@ -197,7 +198,6 @@ NSError *error; ok = [fileMgr createDirectoryAtPath: directoryPath withIntermediateDirectories: NO attributes: NULL error: &error]; - [directoryPath release]; return ok; } @@ -224,7 +224,6 @@ if (directoryContentsForDirLookupCheck == NULL || ([directoryContentsForDirLookupCheck count])) { /* We don't recursive delete directory, that is too dangerous, let the squeak programmer do it which is why if the directory content count is > 0 we abort the delete */ - [directoryPath release]; return 0; } @@ -239,8 +238,6 @@ if (lastPathForDirLookup) { self.lastPathForDirLookup = NULL; } - - [directoryPath release]; return ok; } @@ -268,12 +265,11 @@ NSError *error; NSDictionary * fileAttributes = [fileMgr attributesOfItemAtPath:filePath error:&error]; - [filePath release]; if (!fileAttributes) return 0; - NSNumber *typeCode = [fileAttributes objectForKey: NSFileHFSTypeCode]; - NSNumber *creatorCode = [fileAttributes objectForKey: NSFileHFSCreatorCode]; + NSNumber *typeCode = fileAttributes[NSFileHFSTypeCode]; + NSNumber *creatorCode = fileAttributes[NSFileHFSCreatorCode]; if (creatorCode == NULL || typeCode == NULL) return 0; @@ -302,19 +298,12 @@ return 0; } - NSNumber *typeCode,*creatorCode; - typeCode = [NSNumber numberWithUnsignedLong: CFSwapInt32HostToBig(*((uint32_t *) fType))]; - creatorCode = [NSNumber numberWithUnsignedLong: CFSwapInt32HostToBig(*((uint32_t *) fCreator))]; + NSNumber *typeCode = [NSNumber numberWithUnsignedLong: CFSwapInt32HostToBig(*((uint32_t *) fType))]; + NSNumber *creatorCode = [NSNumber numberWithUnsignedLong: CFSwapInt32HostToBig(*((uint32_t *) fCreator))]; - NSMutableDictionary *fileAttributes = [NSMutableDictionary new]; - [fileAttributes setObject: typeCode forKey: NSFileHFSTypeCode]; - [fileAttributes setObject: creatorCode forKey: NSFileHFSCreatorCode]; - - BOOL ok=[fileMgr setAttributes: fileAttributes ofItemAtPath: filePath + BOOL ok=[fileMgr setAttributes: @{ NSFileHFSTypeCode : typeCode, NSFileHFSCreatorCode: creatorCode} ofItemAtPath: filePath error: NULL]; - [fileAttributes release]; - [filePath release]; return ok; } @@ -322,10 +311,4 @@ return filePath; } -- (void)dealloc { - [super dealloc]; - [lastPathForDirLookup release]; - [directoryContentsForDirLookup release]; -} - @end Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.h =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.h 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.h 2015-04-26 23:58:12 UTC (rev 3314) @@ -43,7 +43,7 @@ } - (void) parseInfoPlist; -@property (nonatomic,retain) NSUserDefaults* defaults; +@property (nonatomic,strong) NSUserDefaults* defaults; @property (nonatomic,assign) BOOL SqueakUseFileMappedMMAP; @end Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -55,9 +55,9 @@ return; } -- (void)dealloc { - [super dealloc]; - [defaults release]; -} +//- (void)dealloc { +// [super dealloc]; +// [defaults release]; +//} @end Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+attributes.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+attributes.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+attributes.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -60,7 +60,7 @@ if (indexNumber < 0) /* VM argument */ { if (-indexNumber <= [self.argsArguments count]) - return (char *) [self.argsArguments objectAtIndex: (NSUInteger) (-indexNumber - 1)]; + return (char *) [(self.argsArguments)[(NSUInteger) (indexNumber - 1)] cStringUsingEncoding: [self currentVMEncoding]]; } else { switch (indexNumber) { @@ -94,7 +94,7 @@ default: if ((indexNumber - 2) > 0 && ((indexNumber - 2) < [self.argsArguments count])) - return (char *) [[self.argsArguments objectAtIndex: (NSUInteger) (indexNumber - 2)] cStringUsingEncoding: [self currentVMEncoding]]; + return (char *) [(self.argsArguments)[(NSUInteger) (indexNumber - 2)] cStringUsingEncoding: [self currentVMEncoding]]; } } interpreterProxy->success(false); Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -68,10 +68,9 @@ ioProcessEvents(); id event = [eventQueue returnAndRemoveOldest]; if (event) { - NSAutoreleasePool * pool = [NSAutoreleasePool new]; - [self processAsOldEventOrComplexEvent: event placeIn: evt]; - [event release]; - [pool drain]; + @autoreleasepool { + [self processAsOldEventOrComplexEvent: event placeIn: evt]; + } } } Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+imageReadWrite.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+imageReadWrite.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+imageReadWrite.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -44,17 +44,16 @@ } - (BOOL) readImageIntoMemory { - NSAutoreleasePool * pool = [NSAutoreleasePool new]; + @autoreleasepool { const char * characterPathForImage = (const char *) [[NSFileManager defaultManager] fileSystemRepresentationWithPath: [self.imageNameURL path]]; sqImageFile f; if (!characterPathForImage) { - [pool drain]; return NO; } f = sqImageFileOpen(characterPathForImage, "rb"); readImageFromFileHeapSizeStartingAt(f, sqGetAvailableMemory(), (squeakFileOffsetType) 0); //This is a VM Callback sqImageFileClose(f); - [pool drain]; return YES; + } } @end Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+vmAndImagePath.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+vmAndImagePath.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+vmAndImagePath.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -80,7 +80,7 @@ if (!sqImageName) return; - self.imageNameURL = [NSURL fileURLWithPath: [NSString stringWithUTF8String: sqImageName] isDirectory: NO]; + self.imageNameURL = [NSURL fileURLWithPath: @(sqImageName) isDirectory: NO]; } - (const char *) getVMPath { Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.h =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.h 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.h 2015-04-26 23:58:12 UTC (rev 3314) @@ -71,19 +71,21 @@ - (void) setupBrowserLogic; - (void) setupSoundLogic; - (void) runSqueak; +- (void) tearDown; - (void) MenuBarRestore; - (void) ioExit; - (void) ioExitWithErrorCode: (int) ec; - (sqSqueakFileDirectoryInterface *) newFileDirectoryInterfaceInstance; +- (void) imageNamePut:(const char *) sqImageName; -@property (nonatomic,retain) NSURL* vmPathStringURL; -@property (nonatomic,retain) sqSqueakInfoPlistInterface* infoPlistInterfaceLogic; -@property (nonatomic,retain) sqSqueakSoundCoreAudio* soundInterfaceLogic; -@property (nonatomic,retain) NSURL* imageNameURL; +@property (nonatomic,strong) NSURL* vmPathStringURL; +@property (nonatomic,strong) sqSqueakInfoPlistInterface* infoPlistInterfaceLogic; +@property (nonatomic,strong) sqSqueakSoundCoreAudio* soundInterfaceLogic; +@property (nonatomic,strong) NSURL* imageNameURL; @property (nonatomic,assign) sqInt inputSemaphoreIndex; @property (nonatomic,assign) NSStringEncoding currentVMEncoding; -@property (nonatomic,retain) Queue* eventQueue; -@property (nonatomic,retain) sqSqueakFileDirectoryInterface * fileDirectoryLogic; -@property (nonatomic,retain) NSMutableArray* argsArguments; +@property (nonatomic,strong) Queue* eventQueue; +@property (nonatomic,strong) sqSqueakFileDirectoryInterface * fileDirectoryLogic; +@property (nonatomic,strong) NSMutableArray* argsArguments; @end Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -75,7 +75,7 @@ } - (sqSqueakInfoPlistInterface *) newSqSqueakInfoPlistInterfaceCreation { - return [sqSqueakInfoPlistInterface new]; + return [[sqSqueakInfoPlistInterface alloc] init]; } - (void) fetchPreferences { @@ -111,23 +111,25 @@ } - (void) setupEventQueue { - eventQueue = [Queue new]; + eventQueue = [[Queue alloc] init]; } - (void) setupBrowserLogic { } - (void) setupSoundLogic { - soundInterfaceLogic = [sqSqueakSoundCoreAudio new]; + soundInterfaceLogic = [[sqSqueakSoundCoreAudio alloc] init]; } - (sqSqueakFileDirectoryInterface *) newFileDirectoryInterfaceInstance { - return [sqSqueakFileDirectoryInterface new]; + return [[sqSqueakFileDirectoryInterface alloc] init]; } - (void) runSqueak { - NSAutoreleasePool * pool = [NSAutoreleasePool new]; //Needed since this is a worker thread, see comments in NSAutoreleasePool Class Reference about Threads - + @autoreleasepool { + extern BOOL gQuitNowRightNow; + gQuitNowRightNow=false; + [self setupFloat]; //JMM We have code for intel and powerpc float, but arm? [self setupErrorRecovery]; [self fetchPreferences]; @@ -135,7 +137,6 @@ fileDirectoryLogic = [self newFileDirectoryInterfaceInstance]; [self setVMPathFromApplicationDirectory]; if (![self.fileDirectoryLogic setWorkingDirectory]) { - [pool drain]; return; } @@ -153,12 +154,10 @@ [self findImageViaBundleOrPreferences]; if ([self ImageNameIsEmpty]) { - [pool drain]; return; } if (![self readImageIntoMemory]) { - [pool drain]; return; } @@ -170,10 +169,15 @@ [gDelegateApp makeMainWindow]; interpret(); - [pool drain]; //may not return here, could call exit() via quit image - [self release]; + [self tearDown]; + } + [NSThread exit]; } +- (void) tearDown{ + +} + - (void) MenuBarRestore { } @@ -190,14 +194,13 @@ } - (void)dealloc { - [infoPlistInterfaceLogic release]; - [soundInterfaceLogic release]; - [vmPathStringURL release]; - [imageNameURL release]; - [fileDirectoryLogic release]; - [eventQueue release]; +// [infoPlistInterfaceLogic release]; +// [soundInterfaceLogic release]; +// [vmPathStringURL release]; +// [imageNameURL release]; +// [fileDirectoryLogic release]; +// [eventQueue release]; sqMacMemoryFree(); - [super dealloc]; } @end @@ -229,4 +232,4 @@ /* Squeak epoch is Jan 1, 1901. Unix epoch is Jan 1, 1970: 17 leap years and 52 non-leap years later than Squeak. */ return unixTime + ((52*365UL + 17*366UL) * 24*60*60UL); -} \ No newline at end of file +} Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -53,7 +53,7 @@ sqSqueakScreenAndWindow *getMainWindowDelegate() { #ifdef BUILD_FOR_OSX - return ((NSWindow *) windowHandleFromIndex(1)).delegate; + return (windowHandleFromIndex(1)).delegate; #else return [gDelegateApp screenAndWindow]; #endif Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.h =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.h 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.h 2015-04-26 23:58:12 UTC (rev 3314) @@ -66,7 +66,7 @@ - (id) getMainView; - (void) ioForceDisplayUpdateFlush: (NSTimer*)theTimer; @property (nonatomic,assign) sqInt windowIndex; -@property (nonatomic,retain) NSTimer *blip; +@property (nonatomic,strong) NSTimer *blip; @property (nonatomic,assign) NSTimeInterval squeakUIFlushPrimaryDeferNMilliseconds; @property (nonatomic,assign) NSTimeInterval lastFlushTime; @property (nonatomic,assign) BOOL forceUpdateFlush; Modified: trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.m =================================================================== --- trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -40,6 +40,7 @@ #import "sqSqueakScreenAndWindow.h" #import "sqSqueakMainApplication+screen.h" #import "sqMacHostWindow.h" + #ifdef BUILD_FOR_OSX #import "SqueakOSXAppDelegate.h" extern SqueakOSXAppDelegate *gDelegateApp; @@ -64,7 +65,7 @@ @synthesize windowIndex; @synthesize blip,squeakUIFlushPrimaryDeferNMilliseconds,forceUpdateFlush,lastFlushTime,displayIsDirty; -- (id)init { +- (instancetype)init { self = [super init]; if (self) { // Initialization code here. @@ -112,11 +113,13 @@ lastFlushTime = [NSDate timeIntervalSinceReferenceDate]; self.displayIsDirty = NO; self.forceUpdateFlush = NO; - if ([NSThread isMainThread]) + + [[self getMainView] preDrawThelayers]; + + + dispatch_async(dispatch_get_main_queue(), ^{ [[self getMainView] drawThelayers]; - else { - [[self getMainView] performSelectorOnMainThread: @selector(drawThelayers) withObject: nil waitUntilDone: NO]; - } + }); } - (void) ioForceDisplayUpdate { @@ -200,6 +203,8 @@ } - (void)dealloc { - [super dealloc]; + if (blip) { + [blip invalidate]; + } } @end Modified: trunk/platforms/iOS/vm/Common/aio.c =================================================================== --- trunk/platforms/iOS/vm/Common/aio.c 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/aio.c 2015-04-26 23:58:12 UTC (rev 3314) @@ -31,6 +31,7 @@ */ #include "sqaio.h" +#include "sqMemoryAccess.h" #ifdef HAVE_CONFIG_H @@ -123,8 +124,6 @@ #define _DO_FLAG_TYPE() _DO(AIO_R, rd) _DO(AIO_W, wr) _DO(AIO_X, ex) -static int one= 1; - static aioHandler rdHandler[FD_SETSIZE]; static aioHandler wrHandler[FD_SETSIZE]; static aioHandler exHandler[FD_SETSIZE]; @@ -219,9 +218,9 @@ if (maxFd == 0) return 0; #endif + extern sqInt ioMSecs(void); + ms= (sqInt) ioMSecs(); - ms= (int) ioMSecs(); - for (;;) { struct timeval tv; Modified: trunk/platforms/iOS/vm/Common/main.m =================================================================== --- trunk/platforms/iOS/vm/Common/main.m 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/Common/main.m 2015-04-26 23:58:12 UTC (rev 3314) @@ -48,9 +48,9 @@ int main(int argc, char *argv[]) { - NSAutoreleasePool * pool = [NSAutoreleasePool new]; - int retVal = UIApplicationMain(argc, argv, nil, nil); - [pool drain]; - return retVal; + @autoreleasepool { + int retVal = UIApplicationMain(argc, argv, nil, nil); + return retVal; + } } #endif \ No newline at end of file Modified: trunk/platforms/iOS/vm/MainWindow.xib =================================================================== --- trunk/platforms/iOS/vm/MainWindow.xib 2015-04-22 18:36:16 UTC (rev 3313) +++ trunk/platforms/iOS/vm/MainWindow.xib 2015-04-26 23:58:12 UTC (rev 3314) @@ -1,172 +1,29 @@ -<?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10"> - <data> - <int key="IBDocument.SystemTarget">512</int> - <string key="IBDocument.SystemVersion">12C3006</string> - <string key="IBDocument.InterfaceBuilderVersion">2840</string> - <string key="IBDocument.AppKitVersion">1187.34</string> - <string key="IBDocument.HIToolboxVersion">625.00</string> - <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> - <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="NS.object.0">1926</string> - </object> - <object class="NSArray" key="IBDocument.IntegratedClassDependencies"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>IBProxyObject</string> - <string>IBUICustomObject</string> - <string>IBUIWindow</string> - </object> - <object class="NSArray" key="IBDocument.PluginDependencies"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - </object> - <object class="NSMutableDictionary" key="IBDocument.Metadata"> - <string key="NS.key.0">PluginDependencyRecalculationVersion</string> - <integer value="1" key="NS.object.0"/> - </object> - <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBProxyObject" id="841351856"> - <string key="IBProxiedObjectIdentifier">IBFilesOwner</string> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - </object> - <object class="IBProxyObject" id="64004946"> - <string key="IBProxiedObjectIdentifier">IBFirstResponder</string> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - </object> - <object class="IBUICustomObject" id="664661524"> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - </object> - <object class="IBUIWindow" id="380026005"> - <reference key="NSNextResponder"/> - <int key="NSvFlags">1316</int> - <object class="NSPSMatrix" key="NSFrameMatrix"/> - <string key="NSFrameSize">{320, 480}</string> - <reference key="NSSuperview"/> - <object class="NSColor" key="IBUIBackgroundColor"> - <int key="NSColorSpace">1</int> - <bytes key="NSRGB">MSAxIDEAA</bytes> - </object> - <bool key="IBUIOpaque">NO</bool> - <bool key="IBUIClearsContextBeforeDrawing">NO</bool> - <bool key="IBUIMultipleTouchEnabled">YES</bool> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - <bool key="IBUIVisibleAtLaunch">YES</bool> @@ Diff output truncated at 50000 characters. @@ |
Free forum by Nabble | Edit this page |