|
From: John M M. <jo...@us...> - 2002-08-06 21:44:13
|
Update of /cvsroot/squeak/squeak/platforms/Mac OS/vm
In directory usw-pr-cvs1:/tmp/cvs-serv3047/squeak/platforms/Mac OS/vm
Modified Files:
sqMacMain.c
Log Message:
3.2.8b3 Fix for building as a carbon netscape plugin. Added feature to print to console for carbon plugin debugging support
Index: sqMacMain.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/Mac OS/vm/sqMacMain.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** sqMacMain.c 27 Apr 2002 18:55:25 -0000 1.8
--- sqMacMain.c 6 Aug 2002 21:44:10 -0000 1.9
***************
*** 59,62 ****
--- 59,64 ----
* 2/14/2002 JMM fixes for updatewindow logic and drag/drop image with no file type
* 2/25/2002 JMM additions for carbon event managment.
+ * 3.2.8b1 July 24th, 2002 JMM support for os-x plugin under IE 5.x
+
*/
***************
*** 160,164 ****
if (imageName[0] == 0) {
FSSpec workingDirectory;
! #if TARGET_API_MAC_CARBON
CFBundleRef mainBundle;
CFURLRef imageURL;
--- 162,166 ----
if (imageName[0] == 0) {
FSSpec workingDirectory;
! #if TARGET_API_MAC_CARBON && !defined(__MWERKS__)
CFBundleRef mainBundle;
CFURLRef imageURL;
***************
*** 178,182 ****
CopyCStringToPascal("squeak.image",workingDirectory.name);
PathToFile(imageName, IMAGE_NAME_SIZE, &workingDirectory);
! #if TARGET_API_MAC_CARBON
}
#endif
--- 180,184 ----
CopyCStringToPascal("squeak.image",workingDirectory.name);
PathToFile(imageName, IMAGE_NAME_SIZE, &workingDirectory);
! #if TARGET_API_MAC_CARBON && !defined(__MWERKS__)
}
#endif
***************
*** 436,441 ****
return "PowerPC";
}
! #if TARGET_API_MAC_CARBON
! if (id == 1004) {
CFBundleRef mainBundle;
CFStringRef versionString;
--- 438,444 ----
return "PowerPC";
}
!
! #if TARGET_API_MAC_CARBON && !defined(__MWERKS__)
! if (id == 1004) {
CFBundleRef mainBundle;
CFStringRef versionString;
***************
*** 450,457 ****
return data;
}
! if (id == 1201) return (isVmPathVolumeHFSPlus() ? "255" : "31"); //name size on hfs plus volumes
! #else
if (id == 1004) return (char *) interpreterVersion;
#endif
/* attribute undefined by this platform */
success(false);
--- 453,465 ----
return data;
}
! #endif
!
! #if TARGET_API_MAC_CARBON && defined(__MWERKS__)
if (id == 1004) return (char *) interpreterVersion;
#endif
+
+ #if TARGET_API_MAC_CARBON
+ if (id == 1201) return (isVmPathVolumeHFSPlus() ? "255" : "31"); //name size on hfs plus volumes
+ #endif
/* attribute undefined by this platform */
success(false);
***************
*** 527,528 ****
--- 535,652 ----
int startProfiling(void){}
int stopProfiling(void) {}
+
+ #if TARGET_API_MAC_CARBON && defined(__MWERKS__)
+ int printOnOSX(char * string);
+ int printOnOSXNumber(int number);
+ int printOnOSXPascal(unsigned char * string);
+ int printOnOSXFormat(char * string,char *format);
+ OSStatus LoadFrameworkBundle(CFStringRef framework, CFBundleRef
+ *bundlePtr);
+
+ OSStatus LoadFrameworkBundle(CFStringRef framework, CFBundleRef
+ *bundlePtr)
+ {
+ OSStatus err;
+ FSRef frameworksFolderRef;
+ CFURLRef baseURL;
+ CFURLRef bundleURL;
+
+ if ( bundlePtr == nil ) return( -1 );
+
+ *bundlePtr = nil;
+
+ baseURL = nil;
+ bundleURL = nil;
+
+ err = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, true,
+ &frameworksFolderRef);
+ if (err == noErr) {
+ baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault,
+ &frameworksFolderRef);
+ if (baseURL == nil) {
+ err = coreFoundationUnknownErr;
+ }
+ }
+ if (err == noErr) {
+ bundleURL =
+ CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL,
+ framework, false);
+ if (bundleURL == nil) {
+ err = coreFoundationUnknownErr;
+ }
+ }
+ if (err == noErr) {
+ *bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL);
+ if (*bundlePtr == nil) {
+ err = coreFoundationUnknownErr;
+ }
+ }
+ if (err == noErr) {
+ if ( ! CFBundleLoadExecutable( *bundlePtr ) ) {
+ err = coreFoundationUnknownErr;
+ }
+ }
+
+ // Clean up.
+ if (err != noErr && *bundlePtr != nil) {
+ CFRelease(*bundlePtr);
+ *bundlePtr = nil;
+ }
+ if (bundleURL != nil) {
+ CFRelease(bundleURL);
+ }
+
+ if (baseURL != nil) {
+ CFRelease(baseURL);
+ }
+
+ return err;
+ }
+
+ int printOnOSXFormat(char * string,char *format) {
+ CFBundleRef bundle;
+ int(*fprintf_ptr)(FILE *stream, const char *format, ...) = NULL;
+ void* fcn_ptr = NULL;
+ OSErr err;
+ FILE* stderr_ptr = NULL;
+ void* __sf_ptr = NULL;
+
+ err = LoadFrameworkBundle( CFSTR("System.framework"), &bundle );
+
+ fcn_ptr = CFBundleGetFunctionPointerForName(bundle, CFSTR("fprintf"));
+ __sf_ptr = CFBundleGetDataPointerForName(bundle, CFSTR("__sF"));
+
+ if(fcn_ptr) {
+ /* cast it */
+ fprintf_ptr = ( int(*)(FILE *stream, const char *format, ...) ) fcn_ptr;
+ } else {
+ /* it failed, handle that somehow */
+ return;
+ }
+
+ if(__sf_ptr) {
+ stderr_ptr = (FILE*) ( ((char*)__sf_ptr) + 176);
+ /* 176 = 88*2, where 88=sizeof(FILE) under BSD */
+ } else {
+ /* it failed */
+ return;
+ }
+
+ fprintf_ptr(stderr_ptr, format,string);
+ }
+
+ int printOnOSX(char * string) {
+ return printOnOSXFormat(string,"\n+-+%s");
+ }
+
+ int printOnOSXNumber(int number) {
+ return printOnOSXFormat((char *) number,"\n+-+%d");
+ }
+
+ int printOnOSXPascal(unsigned char *string) {
+ CopyPascalStringToC((ConstStr255Param) string,(char*) string);
+ printOnOSX((char*) string);
+ CopyCStringToPascal((char*)string,(void *) string);
+ }
+
+ #endif
\ No newline at end of file
|