[Vm-dev] Re: objc prefix header macros

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Wed Oct 28 21:21:37 UTC 2015


Skipped content of type multipart/alternative-------------- next part --------------
Index: platforms/Mac OS/plugins/MIDIPlugin/sqMacMIDI.c
===================================================================
--- platforms/Mac OS/plugins/MIDIPlugin/sqMacMIDI.c	(revision 3478)
+++ platforms/Mac OS/plugins/MIDIPlugin/sqMacMIDI.c	(working copy)
@@ -290,7 +290,7 @@
 	}
 }
 
-int sqMIDIGetPortName(int portNum, int namePtr, int length) {
+int sqMIDIGetPortName(int portNum, char * namePtr, int length) {
 /* Copy the name of the given MIDI port into the string at the given
    address. Copy at most length characters, and return the number of
    characters copied. Fail if there is no port of the given number.*/
@@ -427,7 +427,7 @@
 	return 0;
 }
 
-int sqMIDIPortReadInto(int portNum, int count, int bufferPtr) {
+int sqMIDIPortReadInto(int portNum, int count, char * bufferPtr) {
 /* bufferPtr is the address of the first byte of a Smalltalk
    ByteArray of the given length. Copy up to (length - 4) bytes
    of incoming MIDI data into that buffer, preceded by a 4-byte
@@ -456,7 +456,7 @@
 	return bytesRead + 4;
 }
 
-int sqMIDIPortWriteFromAt(int portNum, int count, int bufferPtr, int time) {
+int sqMIDIPortWriteFromAt(int portNum, int count, char *bufferPtr, int time) {
 /* bufferPtr is the address of the first byte of a Smalltalk
    ByteArray of the given length. Send its contents to the given
    port when the MIDI clock reaches the given time. If time equals
Index: platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.h
===================================================================
--- platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.h	(revision 3478)
+++ platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.h	(working copy)
@@ -30,6 +30,7 @@
 /* The virtual machine proxy definition */
 #include "sqVirtualMachine.h"
 #ifdef BUILD_FOR_OSX
+#import <Cocoa/Cocoa.h>
 typedef NSPasteboard * CLIPBOARDTYPE;
 #else
 typedef UIPasteboard * CLIPBOARDTYPE;
Index: platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m
===================================================================
--- platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m	(revision 3478)
+++ platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m	(working copy)
@@ -75,8 +75,8 @@
 
 void sqPasteboardPutItemFlavordatalengthformatTypeformatLength ( CLIPBOARDTYPE inPasteboard, char* inData, sqInt dataLength, char* format, sqInt formatLength)
 {
-    NSString *formatType = [[[NSString alloc] initWithBytes: format length: formatLength encoding:  NSUTF8StringEncoding] AUTORELEASEOBJ];
-    NSData* data = [[[NSData alloc ] initWithBytes: inData length: dataLength] AUTORELEASEOBJ];
+    NSString *formatType = AUTORELEASEOBJ([[NSString alloc] initWithBytes: format length: formatLength encoding:  NSUTF8StringEncoding]);
+    NSData* data = AUTORELEASEOBJ([[NSData alloc ] initWithBytes: inData length: dataLength]);
     NSArray *arrayOfTypes = @[formatType];
     
     [inPasteboard declareTypes: arrayOfTypes owner: nil];
@@ -86,7 +86,7 @@
 
 sqInt sqPasteboardCopyItemFlavorDataformatformatLength ( CLIPBOARDTYPE inPasteboard, char* format, sqInt formatLength)
 {
-    NSString *formatType = [[[NSString alloc] initWithBytes: format length: formatLength encoding:  NSUTF8StringEncoding] AUTORELEASEOBJ];
+    NSString *formatType = AUTORELEASEOBJ([[NSString alloc] initWithBytes: format length: formatLength encoding:  NSUTF8StringEncoding]);
     NSArray *arrayOfTypes = @[formatType];
     NSString     *type= [inPasteboard availableTypeFromArray: arrayOfTypes];
     
Index: platforms/iOS/plugins/MIDIPlugin/sqMacMIDI.m
===================================================================
--- platforms/iOS/plugins/MIDIPlugin/sqMacMIDI.m	(revision 3478)
+++ platforms/iOS/plugins/MIDIPlugin/sqMacMIDI.m	(working copy)
@@ -291,7 +291,7 @@
 	}
 }
 
-int sqMIDIGetPortName(int portNum, int namePtr, int length) {
+int sqMIDIGetPortName(int portNum, char * namePtr, int length) {
 /* Copy the name of the given MIDI port into the string at the given
    address. Copy at most length characters, and return the number of
    characters copied. Fail if there is no port of the given number.*/
@@ -428,7 +428,7 @@
 	return 0;
 }
 
-int sqMIDIPortReadInto(int portNum, int count, int bufferPtr) {
+int sqMIDIPortReadInto(int portNum, int count, char * bufferPtr) {
 /* bufferPtr is the address of the first byte of a Smalltalk
    ByteArray of the given length. Copy up to (length - 4) bytes
    of incoming MIDI data into that buffer, preceded by a 4-byte
@@ -457,7 +457,7 @@
 	return bytesRead + 4;
 }
 
-int sqMIDIPortWriteFromAt(int portNum, int count, int bufferPtr, int time) {
+int sqMIDIPortWriteFromAt(int portNum, int count, char * bufferPtr, int time) {
 /* bufferPtr is the address of the first byte of a Smalltalk
    ByteArray of the given length. Send its contents to the given
    port when the MIDI clock reaches the given time. If time equals
Index: platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m
===================================================================
--- platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m	(revision 3478)
+++ platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m	(working copy)
@@ -7,6 +7,7 @@
 //
 
 #import "MacMenuOS9ToOSX.h"
+#import <Cocoa/Cocoa.h>
 
 
 Boolean ioCheckMenuHandle(MenuHandle menuHandle) {
Index: platforms/iOS/plugins/MacMenubarPlugin/MacMenubarPlugin.h
===================================================================
--- platforms/iOS/plugins/MacMenubarPlugin/MacMenubarPlugin.h	(revision 3478)
+++ platforms/iOS/plugins/MacMenubarPlugin/MacMenubarPlugin.h	(working copy)
@@ -34,7 +34,7 @@
 
 
 Boolean ioCheckMenuHandle(MenuHandle menuHandle);
-#define TARGET_API_MAC_CARBON 1
+//#define TARGET_API_MAC_CARBON 1
 #define kHICommandHide 'hide'
 
 MenuRef GetMenuHandle(MenuID menuID);
Index: platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m
===================================================================
--- platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m	(revision 3478)
+++ platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m	(working copy)
@@ -114,7 +114,7 @@
 		return;
 	
 	if (inNumberPacketDescriptions > 0) {
-		soundAtom *atom = [[[soundAtom alloc] initWith: inBuffer->mAudioData count: inBuffer->mAudioDataByteSize] AUTORELEASEOBJ];
+		soundAtom *atom = AUTORELEASEOBJ([[soundAtom alloc] initWith: inBuffer->mAudioData count: inBuffer->mAudioDataByteSize]);
 		[myInstance.soundInQueue addItem: atom];
     }
 	
@@ -281,7 +281,7 @@
 	OSStatus result  = AudioQueueDispose (self.outputAudioQueue,true);
 #pragma unused(result)
 	self.outputAudioQueue = nil;
-	self.soundOutQueue = [[[Queue alloc] init] AUTORELEASEOBJ];
+	self.soundOutQueue = AUTORELEASEOBJ([[Queue alloc] init]);
 	return 1;
 }
 
@@ -308,7 +308,7 @@
 		return interpreterProxy->primitiveFail();
 	//NSLog(@"%i sound place samples on queue frames %i startIndex %i count %i",ioMSecs(),frameCount,startIndex,byteCount-startIndex);
 		
-	soundAtom *atom = [[[soundAtom alloc] initWith: arrayIndex+startIndex count: (unsigned) (byteCount-startIndex)] AUTORELEASEOBJ];
+	soundAtom *atom = AUTORELEASEOBJ([[soundAtom alloc] initWith: arrayIndex+startIndex count: (unsigned) (byteCount-startIndex)]);
 	[self.soundOutQueue addItem: atom];
 	
 	if (!self.outputIsRunning) {
@@ -396,7 +396,7 @@
 		return 0;
 	result = AudioQueueDispose (self.inputAudioQueue,true);
 	self.inputAudioQueue = nil;
-	self.soundInQueue = [[[Queue alloc] init] AUTORELEASEOBJ];
+	self.soundInQueue = AUTORELEASEOBJ([[Queue alloc] init]);
 	return 1;
 }
 
Index: platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m
===================================================================
--- platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m	(revision 3478)
+++ platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m	(working copy)
@@ -92,11 +92,11 @@
 		return;
 	}
 	
-	if([lockForSqueak lockWhenCondition: 0 beforeDate: (timeout = [[[NSDate alloc] initWithTimeIntervalSinceNow: 3.0] AUTORELEASEOBJ])])
+	if([lockForSqueak lockWhenCondition: 0 beforeDate: (timeout = AUTORELEASEOBJ([[NSDate alloc] initWithTimeIntervalSinceNow: 3.0]))])
 	{ 
 		// NSLog(@"inside lock 0");
 		[lockForSqueak unlockWithCondition: 1];
-		invocation = [anInvocation RETAINOBJ];
+		invocation = RETAINOBJ(anInvocation);
 		
 		// NSLog(@"signalling squeak");
 		interpreterProxy->signalSemaphoreWithIndex(sem);
@@ -104,7 +104,7 @@
 		if (isCarbonVM)
 			interpreterProxy->callbackEnter(&callbackid);
 		
-		if([lockForSqueak lockWhenCondition: 2 beforeDate: (timeout = [[[NSDate alloc] initWithTimeIntervalSinceNow: 5.0] AUTORELEASEOBJ])] )
+		if([lockForSqueak lockWhenCondition: 2 beforeDate: (timeout = AUTORELEASEOBJ([[NSDate alloc] initWithTimeIntervalSinceNow: 5.0]))] )
 		{
 			// NSLog(@"inside lock 2");
 			invocation = nil;
@@ -189,9 +189,9 @@
 
 - (void) dealloc
 {
-    [lockForSqueak RELEASEOBJ];
-    [sigs RELEASEOBJ];
-    [target RELEASEOBJ];
+    RELEASEOBJ(lockForSqueak)
+    RELEASEOBJ(sigs)
+    RELEASEOBJ(target)
     SUPERDEALLOC
 }
 
Index: platforms/iOS/vm/Common/Classes/Queue.m
===================================================================
--- platforms/iOS/vm/Common/Classes/Queue.m	(revision 3478)
+++ platforms/iOS/vm/Common/Classes/Queue.m	(working copy)
@@ -54,9 +54,9 @@
 
 /* Arc version */
 
+
 #import "Queue.h"
 
-
 @implementation Queue
 
 // Initialize a empty mutable array for queue items
@@ -73,7 +73,7 @@
 
 - (void) dealloc
 {
-    [mItemArray RELEASEOBJ];
+    RELEASEOBJ(mItemArray)
     SUPERDEALLOC
 }
 
Index: platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m
===================================================================
--- platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m	(revision 3478)
+++ platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m	(working copy)
@@ -45,7 +45,7 @@
 @synthesize squeakApplication,squeakThread;
 
 - (void)dealloc {
-    [squeakApplication RELEASEOBJ];
+    RELEASEOBJ(squeakApplication)
     SUPERDEALLOC
 }
 
Index: platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m
===================================================================
--- platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m	(revision 3478)
+++ platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m	(working copy)
@@ -191,7 +191,7 @@
 
 NSString* createFilePathFromString(char * aFilenameString,
 									sqInt filenameLength, sqInt resolveAlias) {
-	NSString * filePath = [[[NSString alloc] initWithBytes: aFilenameString length: (NSUInteger) filenameLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
+	NSString * filePath = AUTORELEASEOBJ([[NSString alloc] initWithBytes: aFilenameString length: (NSUInteger) filenameLength encoding: NSUTF8StringEncoding]);
 	if (!filePath) {
 		return NULL;
 	}
@@ -203,7 +203,7 @@
 		NSString *newFilePath = [gDelegateApp.squeakApplication.fileDirectoryLogic resolvedAliasFiles: owningDirectoryPath];
 		filePath = [newFilePath stringByAppendingPathComponent: [filePath lastPathComponent]];
 	}
-    [filePath RETAINOBJ];
+    RETAINOBJ(filePath);
 	return filePath;
 }
 
Index: platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m
===================================================================
--- platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m	(revision 3478)
+++ platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m	(working copy)
@@ -133,8 +133,8 @@
     if (nameStringLength <= 0 || pathStringLength <= 0)
         return BAD_PATH;
         
-	directoryPath = [[[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
-    fileName      = [[[NSString alloc] initWithBytes: nameString length: (NSUInteger) nameStringLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
+	directoryPath = AUTORELEASEOBJ([[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding]);
+    fileName      = AUTORELEASEOBJ([[NSString alloc] initWithBytes: nameString length: (NSUInteger) nameStringLength encoding: NSUTF8StringEncoding]);
 	
     if (![directoryPath hasSuffix: @"/"]) {
         directoryPath = [directoryPath stringByAppendingString: @"/"];
@@ -190,7 +190,7 @@
 	}
 	
 	if (pathStringLength > 0) {
-		directoryPath = [[[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
+		directoryPath = AUTORELEASEOBJ([[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding]);
     }
 	if (directoryPath == NULL) {
 		return BAD_PATH;
@@ -377,8 +377,8 @@
 
 - (void)dealloc {
     SUPERDEALLOC
-    [lastPathForDirLookup RELEASEOBJ];
-    [directoryContentsForDirLookup RELEASEOBJ];
+    RELEASEOBJ(lastPathForDirLookup)
+    RELEASEOBJ([directoryContentsForDirLookup)
 }
 
 
Index: platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m
===================================================================
--- platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m	(revision 3478)
+++ platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m	(working copy)
@@ -56,7 +56,7 @@
 }
 
 - (void)dealloc {
-    [defaults RELEASEOBJ];
+    RELEASEOBJ(defaults)
     SUPERDEALLOC
 }
 
Index: platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m
===================================================================
--- platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m	(revision 3478)
+++ platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m	(working copy)
@@ -209,11 +209,13 @@
     
 }
 
+#ifndef SPURVM
 #if COGVM
     void sqMacMemoryFree();
 #else
     void sqMacMemoryFree(void);
 #endif
+#endif
 
 - (void) ioExit {
 	[self ioExitWithErrorCode: 0];
Index: platforms/iOS/vm/OSX/SqViewBitmapConversion.m
===================================================================
--- platforms/iOS/vm/OSX/SqViewBitmapConversion.m	(revision 3478)
+++ platforms/iOS/vm/OSX/SqViewBitmapConversion.m	(working copy)
@@ -64,7 +64,7 @@
 	copyImage1To32(srcBits, dBits, srcPixelWidth, height, left, top, right, bottom,colorMap);
 	
 	
-	CHECKANDRETURN([[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
+	CHECKANDRETURN(AUTORELEASEOBJ([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
 														   pixelsWide:right-left
 														   pixelsHigh:bottom-top
 														bitsPerSample:bitsPerSample
@@ -73,7 +73,7 @@
 															 isPlanar:NO
 													   colorSpaceName:colorSpace
 														  bytesPerRow:bytesPerRow
-														 bitsPerPixel:bitsPerPixel] AUTORELEASEOBJ]);
+														 bitsPerPixel:bitsPerPixel]));
 }//extractPixels_1_to_32;
 
 
@@ -96,7 +96,7 @@
 	copyImage2To32(srcBits, dBits, srcPixelWidth, height, left, top, right, bottom,colorMap);
 	
 	
-	CHECKANDRETURN([[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
+	CHECKANDRETURN(AUTORELEASEOBJ([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
 														   pixelsWide:right-left
 														   pixelsHigh:bottom-top
 														bitsPerSample:bitsPerSample
@@ -105,7 +105,7 @@
 															 isPlanar:NO
 													   colorSpaceName:colorSpace
 														  bytesPerRow:bytesPerRow
-														 bitsPerPixel:bitsPerPixel] AUTORELEASEOBJ]);
+														 bitsPerPixel:bitsPerPixel]));
 }//extractPixels_2_to_32;
 
 -(CGImageRef)extractPixels_4_to_32:(void*)srcBits 
@@ -127,7 +127,7 @@
 	copyImage4To32(srcBits, dBits, srcPixelWidth, height, left, top, right, bottom,colorMap);
 	
 	
-	CHECKANDRETURN([[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
+	CHECKANDRETURN(AUTORELEASEOBJ([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
 														   pixelsWide:right-left
 														   pixelsHigh:bottom-top
 														bitsPerSample:bitsPerSample
@@ -136,7 +136,7 @@
 															 isPlanar:NO
 													   colorSpaceName:colorSpace
 														  bytesPerRow:bytesPerRow
-														 bitsPerPixel:bitsPerPixel] AUTORELEASEOBJ]);
+														 bitsPerPixel:bitsPerPixel]));
 }//extractPixels_4_to_32;
 
 
@@ -159,7 +159,7 @@
 		copyImage8To32(srcBits, dBits, srcPixelWidth, height, left, top, right, bottom,colorMap);
 		
 		
-		CHECKANDRETURN([[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
+		CHECKANDRETURN(AUTORELEASEOBJ([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
 				pixelsWide:right-left
 				pixelsHigh:bottom-top
 				bitsPerSample:bitsPerSample
@@ -168,7 +168,7 @@
 				isPlanar:NO
 				colorSpaceName:colorSpace
 				bytesPerRow:bytesPerRow
-				bitsPerPixel:bitsPerPixel] AUTORELEASEOBJ]);
+				bitsPerPixel:bitsPerPixel]));
 	}//extractPixels_8_to_32;
 	
 
@@ -189,7 +189,7 @@
 	
 	copyImage16To32(srcBits, dBits, srcPixelWidth, height, left, top, right, bottom);
 	
-	CHECKANDRETURN([[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
+	CHECKANDRETURN(AUTORELEASEOBJ([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
 														   pixelsWide:right-left
 														   pixelsHigh:bottom-top
 														bitsPerSample:bitsPerSample
@@ -198,7 +198,7 @@
 															 isPlanar:NO
 													   colorSpaceName:colorSpace
 														  bytesPerRow:bytesPerRow
-														 bitsPerPixel:bitsPerPixel] AUTORELEASEOBJ]);
+														 bitsPerPixel:bitsPerPixel]));
 }//extractPixels_16_to_32;
 
 -(CGImageRef)computeBitmapFromBitsIndex:(void*)srcBits
Index: platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m
===================================================================
--- platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m	(revision 3478)
+++ platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m	(working copy)
@@ -43,8 +43,8 @@
 #import "sqSqueakOSXInfoPlistInterface.h"
 #if defined(i386) || defined(__i386) || defined(__i386__)
 #else
-#import <Fabric/Fabric.h>
-#import <Crashlytics/Crashlytics.h>
+//#import <Fabric/Fabric.h>
+//#import <Crashlytics/Crashlytics.h>
 #endif
 
 #ifndef USE_CORE_GRAPHICS
@@ -63,7 +63,7 @@
 @synthesize window,mainView,possibleImageNameAtLaunchTime,checkForFileNameOnFirstParm,windowHandler;
 
 - (sqSqueakMainApplication *) makeApplicationInstance {
-	return [[[sqSqueakOSXApplication alloc] init] AUTORELEASEOBJ];
+	return AUTORELEASEOBJ([[sqSqueakOSXApplication alloc] init]);
 }
 
 - (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
@@ -75,13 +75,13 @@
 #if defined(i386) || defined(__i386) || defined(__i386__)
 #else
     //   [Crashlytics startWithAPIKey:@"add501476623fc20212a60334cd537d16dfd566f"];
-    [Fabric with:@[[Crashlytics class]]];
+    //[Fabric with:@[[Crashlytics class]]];
 #endif
 	
     @autoreleasepool {
 		gDelegateApp = self;	
 		self.squeakApplication = [self makeApplicationInstance];
-		self.windowHandler = [[[sqSqueakOSXScreenAndWindow alloc] init] AUTORELEASEOBJ];
+		self.windowHandler = AUTORELEASEOBJ([[sqSqueakOSXScreenAndWindow alloc] init]);
 		windowHandler.mainViewOnWindow = self.mainView;
 		self.mainView.windowLogic = windowHandler;
 		windowHandler.windowIndex = 1;
@@ -176,7 +176,7 @@
     //It can right now, I have two implementations to pick (CoreGraphics or OpenGL), muy more/different could be added 
     //in the future. 
     
-    NSView *view = [[[ContentViewClass alloc] initWithFrame:[[self window] frame]] AUTORELEASEOBJ];
+    NSView *view = AUTORELEASEOBJ([[ContentViewClass alloc] initWithFrame:[[self window] frame]]);
     self.mainView = (id) view;
     [[self window] setContentView: view];
     
Index: platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m
===================================================================
--- platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m	(revision 3478)
+++ platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m	(working copy)
@@ -101,7 +101,7 @@
 }
 
 sqInt ioSetTitleOfWindow(sqInt windowIndex, char * newTitle, sqInt sizeOfTitle) {
-    NSString *title = [[[NSString alloc] initWithBytes:newTitle length:sizeOfTitle encoding:NSUTF8StringEncoding] AUTORELEASEOBJ];
+    NSString *title = AUTORELEASEOBJ([[NSString alloc] initWithBytes:newTitle length:sizeOfTitle encoding:NSUTF8StringEncoding]);
     [[[NSApplication sharedApplication] mainWindow] setTitle:title];
 	return 1;
 }
Index: platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m
===================================================================
--- platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m	(revision 3478)
+++ platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m	(working copy)
@@ -208,7 +208,7 @@
 			OSErr err = FSFindFolder(kSystemDomain, kFrameworksFolderType, false, &frameworksFolderRef);
 #pragma unused(err)
 			NSURL *myURLRef = (NSURL *) CFBridgingRelease(CFURLCreateFromFSRef(kCFAllocatorDefault, &frameworksFolderRef));
-			systemFolder = [[myURLRef path] RETAINOBJ];
+			systemFolder = RETAINOBJ([myURLRef path]);
 		}
 		
 		pluginNameLength = strlen(pluginName);
Index: platforms/iOS/vm/OSX/sqSqueakOSXApplication+clipboard.m
===================================================================
--- platforms/iOS/vm/OSX/sqSqueakOSXApplication+clipboard.m	(revision 3478)
+++ platforms/iOS/vm/OSX/sqSqueakOSXApplication+clipboard.m	(working copy)
@@ -74,7 +74,7 @@
 
 - (void) clipboardWrite: (sqInt) count from: (char *)byteArrayIndex  startingAt:  (sqInt) startIndex {
 	NSPasteboard      *pboard= [NSPasteboard generalPasteboard];
-	NSString * string = [[[NSString alloc] initWithBytes: byteArrayIndex length:(NSUInteger)count encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
+	NSString * string = AUTORELEASEOBJ([[NSString alloc] initWithBytes: byteArrayIndex length:(NSUInteger)count encoding: NSUTF8StringEncoding]);
 	[pboard declareTypes: @[NSStringPboardType] owner: nil];
 	[pboard setString: string forType: NSStringPboardType];
 }
Index: platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m
===================================================================
--- platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m	(revision 3478)
+++ platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m	(working copy)
@@ -62,13 +62,13 @@
 		return;
 	@autoreleasepool {
 	 
-	NSBitmapImageRep *bitmap= [[[NSBitmapImageRep alloc]
+	NSBitmapImageRep *bitmap= AUTORELEASEOBJ([[NSBitmapImageRep alloc]
 			 initWithBitmapDataPlanes:  NULL pixelsWide: 16 pixelsHigh: 16
 			 bitsPerSample: 1 samplesPerPixel: 2
 			 hasAlpha: YES isPlanar: YES
 			 colorSpaceName: NSCalibratedBlackColorSpace
 			 bytesPerRow: 2
-			 bitsPerPixel: 0] AUTORELEASEOBJ];
+			 bitsPerPixel: 0]);
 
     unsigned char*      planes[5];
 	[bitmap getBitmapDataPlanes:planes];
@@ -93,7 +93,7 @@
 		mask[i*2 + 1]= (word >> 16) & 0xFF;
 	}
 
-	NSImage *image = [[[NSImage alloc] init] AUTORELEASEOBJ];
+	NSImage *image = AUTORELEASEOBJ([[NSImage alloc] init]);
 	[image addRepresentation: bitmap];
 	
 	
@@ -125,13 +125,13 @@
 	
 	@autoreleasepool {
 	
-	NSBitmapImageRep *bitmap= [[[NSBitmapImageRep alloc]
+	NSBitmapImageRep *bitmap= AUTORELEASEOBJ([[NSBitmapImageRep alloc]
 								initWithBitmapDataPlanes: NULL pixelsWide: extentX pixelsHigh: extentY
 								bitsPerSample: 8 samplesPerPixel: 4
 								hasAlpha: YES isPlanar: NO
 								colorSpaceName: NSCalibratedRGBColorSpace
 								bytesPerRow: extentX * 4
-								bitsPerPixel: 0] AUTORELEASEOBJ];
+								bitsPerPixel: 0]);
 	unsigned int *planes[5];
 	[bitmap getBitmapDataPlanes: (unsigned char **) planes];
 	unsigned int *src= (unsigned int*) pointerForOop(cursorBitsIndex);
@@ -144,7 +144,7 @@
 		*dst= (*src & 0xFF00FF00) | ((*src & 0x000000FF) << 16) | ((*src & 0x00FF0000) >> 16); // BGRA to RGBA
 #endif
 	}
-	NSImage  *image= [[[NSImage alloc] init] AUTORELEASEOBJ];
+	NSImage  *image= AUTORELEASEOBJ([[NSImage alloc] init]);
 	[image addRepresentation: bitmap];
 	NSPoint hotSpot= { -offsetX, -offsetY };
 	self.squeakHasCursor = YES;
Index: platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m
===================================================================
--- platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m	(revision 3478)
+++ platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m	(working copy)
@@ -195,7 +195,7 @@
             }
 		}
 		
-		NSString *lookupString = [[[NSString alloc] initWithCharacters: &unicode length: 1] AUTORELEASEOBJ];
+		NSString *lookupString = AUTORELEASEOBJ([[NSString alloc] initWithCharacters: &unicode length: 1]);
 		[lookupString getBytes: &macRomanCharacter maxLength: 1 usedLength: NULL encoding: NSMacOSRomanStringEncoding
 					   options: 0 range: picker remainingRange: NULL];
 		
Index: platforms/iOS/vm/OSX/sqSqueakOSXApplication.m
===================================================================
--- platforms/iOS/vm/OSX/sqSqueakOSXApplication.m	(revision 3478)
+++ platforms/iOS/vm/OSX/sqSqueakOSXApplication.m	(working copy)
@@ -126,7 +126,7 @@
 }
 
 - (void) setupSoundLogic {
-	self.soundInterfaceLogic = [[[sqSqueakOSXSoundCoreAudio alloc] init] AUTORELEASEOBJ];
+	self.soundInterfaceLogic = AUTORELEASEOBJ([[sqSqueakOSXSoundCoreAudio alloc] init]);
  	[(sqSqueakOSXSoundCoreAudio *) self.soundInterfaceLogic soundInitOverride];
 
 	snd_Start(2644, 22050, 1, 0);
@@ -195,7 +195,7 @@
 	
 	if ([args count] < 2) 
 		return;
-	NSMutableArray *revisedArgs = [[args mutableCopyWithZone: NULL] AUTORELEASEOBJ];
+	NSMutableArray *revisedArgs = AUTORELEASEOBJ([args mutableCopyWithZone: NULL]);
 	[revisedArgs removeObjectAtIndex:0];
 	
 	NSUInteger i,result;
Index: platforms/iOS/vm/OSX/sqSqueakOSXCGView.m
===================================================================
--- platforms/iOS/vm/OSX/sqSqueakOSXCGView.m	(revision 3478)
+++ platforms/iOS/vm/OSX/sqSqueakOSXCGView.m	(working copy)
@@ -73,7 +73,7 @@
 		NSOpenGLPFABackingStore,
 		0
     };
-    return[[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs] AUTORELEASEOBJ];
+    return AUTORELEASEOBJ([[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]);
 }
 
 - (id)initWithFrame:(NSRect)frameRect {
@@ -335,11 +335,11 @@
 	//http://www.internet4classrooms.com/mac_ext.gif
 	//http://developer.apple.com/legacy/mac/library/documentation/mac/Text/Text-571.html
 	
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	
-	NSArray *down = [[[NSArray alloc] initWithObjects: theEvent,nil] AUTORELEASEOBJ];
+	NSArray *down = AUTORELEASEOBJ2([[NSArray alloc] initWithObjects: theEvent,nil]);
 	@synchronized(self) {
 		lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;
 
@@ -355,11 +355,11 @@
 }
 
 -(void)keyDown:(NSEvent*)theEvent {
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	
-	NSArray *down = [[[NSArray alloc] initWithObjects: theEvent,nil] AUTORELEASEOBJ];
+	NSArray *down = AUTORELEASEOBJ2([[NSArray alloc] initWithObjects: theEvent,nil]);
 //	NSLog(@"sqSqueakOSXCGView.m>>keyDown:");
 	@synchronized(self) {
 		lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;
@@ -389,7 +389,7 @@
 
 - (void)flagsChanged:(NSEvent *)theEvent {
 //	NSLog(@"sqSqueakOSXCGView.m>>flagsChanged -- %d, %d", [theEvent keyCode], [theEvent modifierFlags] );
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	self.lastSeenKeyBoardModifierDetails = aKeyBoardStrokeDetails;
@@ -464,7 +464,7 @@
     else return;
 	
 	@synchronized(self) {
-		keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+		keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 		aKeyBoardStrokeDetails.keyCode = keyCode;
 		aKeyBoardStrokeDetails.modifierFlags = self.lastSeenKeyBoardModifierDetails.modifierFlags;
 		lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;
Index: platforms/iOS/vm/OSX/sqSqueakOSXFileDirectoryInterface.m
===================================================================
--- platforms/iOS/vm/OSX/sqSqueakOSXFileDirectoryInterface.m	(revision 3478)
+++ platforms/iOS/vm/OSX/sqSqueakOSXFileDirectoryInterface.m	(working copy)
@@ -74,7 +74,7 @@
 - (NSString *)resolvedAliasFiles:(NSString *)filePath {
 	NSArray *compoents = [[filePath stringByStandardizingPath] pathComponents];
 	NSString *thisComponent;
-	NSString *path = [[[NSString alloc] init] AUTORELEASEOBJ];
+	NSString *path = AUTORELEASEOBJ([[NSString alloc] init]);
 	for (thisComponent in compoents) {
 		path = [path stringByAppendingPathComponent:thisComponent];
 		if (![[NSFileManager defaultManager] fileExistsAtPath:path])
Index: platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m
===================================================================
--- platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m	(revision 3478)
+++ platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m	(working copy)
@@ -70,7 +70,7 @@
 		NSOpenGLPFABackingStore,
 		0
     };
-    return[[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs] AUTORELEASEOBJ];
+    return AUTORELEASEOBJ([[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]);
 }
 
 - (id)initWithFrame:(NSRect)frameRect {
@@ -415,7 +415,7 @@
 	//http://www.internet4classrooms.com/mac_ext.gif
 	//http://developer.apple.com/legacy/mac/library/documentation/mac/Text/Text-571.html
 	
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	
@@ -433,7 +433,7 @@
 }
 
 -(void)keyDown:(NSEvent*)theEvent {
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	
@@ -462,7 +462,7 @@
 }
 
 - (void)flagsChanged:(NSEvent *)theEvent {
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	self.lastSeenKeyBoardModifierDetails = aKeyBoardStrokeDetails;
@@ -549,7 +549,7 @@
 																																									return;
 	
 	@synchronized(self) {
-		keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+		keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 		aKeyBoardStrokeDetails.keyCode = keyCode;
 		aKeyBoardStrokeDetails.modifierFlags = self.lastSeenKeyBoardModifierDetails.modifierFlags;
 		lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;
Index: platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m
===================================================================
--- platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m	(revision 3478)
+++ platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m	(working copy)
@@ -53,7 +53,7 @@
 }
 
 - (void) dealloc {
-    [mainViewOnWindow RELEASEOBJ];
+    RELEASEOBJ(mainViewOnWindow)
     SUPERDEALLOC
 }
 
Index: platforms/iOS/vm/SqueakPureObjc_Prefix.pch
===================================================================
--- platforms/iOS/vm/SqueakPureObjc_Prefix.pch	(revision 3478)
+++ platforms/iOS/vm/SqueakPureObjc_Prefix.pch	(working copy)
@@ -7,12 +7,15 @@
 #endif
 
 #if __has_feature(objc_arc)
-#define RELEASEOBJ
-#define RETAINOBJ
-#define AUTORELEASEOBJ
+#define RELEASEOBJ(x)
+#define RETAINOBJ(x) x
+#define AUTORELEASEOBJ(x) x
+#define AUTORELEASEOBJ2(x,y) x,y
+#define SUPERDEALLOC
 #else
-#define RELEASEOBJ release
-#define RETAINOBJ retain
-#define AUTORELEASEOBJ autorelease
+#define RELEASEOBJ(x) [x release];
+#define RETAINOBJ(x) [x retain]
+#define AUTORELEASEOBJ(x) [x autorelease]
+#define AUTORELEASEOBJ2(x,y) [x,y autorelease]
 #define SUPERDEALLOC [super dealloc];
-#endif
\ No newline at end of file
+#endif
Index: platforms/iOS/vm/iPhone/plugins/SqueakFFIPrims/dummyFFI.c
===================================================================
--- platforms/iOS/vm/iPhone/plugins/SqueakFFIPrims/dummyFFI.c	(revision 3478)
+++ platforms/iOS/vm/iPhone/plugins/SqueakFFIPrims/dummyFFI.c	(working copy)
@@ -157,7 +157,7 @@
 }
 
 
-int ffiFree(int ptr)
+int ffiFree(long ptr)
 {
 	if (ptr) free((void *)ptr);
 	return 1;
Index: platforms/iOS/vm/iPhone/sqMacV2Memory.c
===================================================================
--- platforms/iOS/vm/iPhone/sqMacV2Memory.c	(revision 3478)
+++ platforms/iOS/vm/iPhone/sqMacV2Memory.c	(working copy)
@@ -167,6 +167,7 @@
 	return gMaxHeapSize - gHeapSize;
 }
 
+#ifndef SPURVM
 void 
 sqMacMemoryFree() {
 	if (gSqueakUseFileMappedMMAP) {
@@ -174,6 +175,7 @@
 		munmap(startOfmmapForANONMemory,freeSpaceRoundedUpToPageSize);
 	}
 }
+#endif
 
 #ifdef BUILD_FOR_OSX
 size_t 
@@ -214,7 +216,7 @@
  * start of the region and assign its size through allocatedSizePointer.
  */
 void *
-sqAllocateMemorySegmentOfSizeAboveAllocatedSizeInto(sqInt size, void *minAddress, sqInt *allocatedSizePointer)
+sqAllocateMemorySegmentOfSizeAboveAllocatedSizeInto(usqInt size, void *minAddress, sqInt *allocatedSizePointer)
 {
 	void *alloc;
 	long bytes = roundUpToPage(size);
@@ -244,9 +246,41 @@
  * sqAllocateMemorySegmentOfSizeAboveAllocatedSizeInto.  Cannot fail.
  */
 void
-sqDeallocateMemorySegmentAtOfSize(void *addr, sqInt sz)
+sqDeallocateMemorySegmentAtOfSize(void *addr, usqInt sz)
 {
 	if (munmap(addr, sz) != 0)
 		perror("sqDeallocateMemorySegment... munmap");
 }
+
+static int mmax(size_t x, size_t y) { return (x > y) ? x : y; }
+
+
+/* Answer the address of minHeapSize rounded up to page size bytes of memory. */
+usqInt
+sqAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize)
+{
+    char *hint, *address, *alloc;
+    unsigned long alignment, allocBytes;
+    
+    if (pageSize) {
+        fprintf(stderr, "sqAllocateMemory: already called\n");
+        exit(1);
+    }
+    pageSize = getpagesize();
+    pageMask = ~(pageSize - 1);
+    
+    hint = sbrk(0);
+    
+    alignment = mmax(pageSize,1024*1024);
+    address = (char *)(((usqInt)hint + alignment - 1) & ~(alignment - 1));
+    
+    alloc = sqAllocateMemorySegmentOfSizeAboveAllocatedSizeInto
+    (roundUpToPage(desiredHeapSize), address, &allocBytes);
+    if (!alloc) {
+        fprintf(stderr, "sqAllocateMemory: initial alloc failed!\n");
+        exit(errno);
+    }
+    return (usqInt)alloc;
+}
+
 #endif /* SPURVM */
Index: platforms/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c
===================================================================
--- platforms/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c	(revision 3478)
+++ platforms/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c	(working copy)
@@ -140,7 +140,7 @@
   return fp;
 }
 
-INLINE static allocateBuffer(struct FileBuf *buf, int size)
+INLINE static int allocateBuffer(struct FileBuf *buf, int size)
 {
   if (buf->capacity >= size)
     return 1;
Index: platforms/unix/vm/sqUnixHeartbeat.c
===================================================================
--- platforms/unix/vm/sqUnixHeartbeat.c	(revision 3478)
+++ platforms/unix/vm/sqUnixHeartbeat.c	(working copy)
@@ -463,9 +463,9 @@
 unsigned long
 ioHeartbeatFrequency(int resetStats)
 {
-	unsigned duration = (ioUTCMicroseconds() - get64(frequencyMeasureStart))
+	unsigned long duration = (ioUTCMicroseconds() - get64(frequencyMeasureStart))
 						/ MicrosecondsPerSecond;
-	unsigned frequency = duration ? heartbeats / duration : 0;
+	unsigned long frequency = duration ? heartbeats / duration : 0;
 
 	if (resetStats) {
 		unsigned long long zero = 0;


More information about the Vm-dev mailing list