From 08c340864abfbb3ef42963ff1601b00cfaff9976 Mon Sep 17 00:00:00 2001 From: Stefan Marr Date: Fri, 22 Oct 2010 11:15:03 -0700 Subject: [PATCH] Necessary adaptations to code coming directly from Squeak. --- .../Cross/plugins/FilePlugin/FilePlugin.c | 13 +- .../Cross/plugins/FilePlugin/FilePlugin.h | 8 +- .../plugins/FilePlugin/sqFilePluginBasicPrims.c | 14 +- .../Cross/plugins/FilePlugin/sqUnixFile.c | 26 +- .../Cross/plugins/RePlugin/sqr_config.h | 199 +++++++++++ vm/src/from_squeak/Cross/vm/sqVirtualMachine.h | 4 +- .../Cross/vm/{sqNamedPrims.c => sqrNamedPrims.c} | 26 +- .../vm/{sqVirtualMachine.c => sqrVirtualMachine.c} | 15 +- .../from_squeak/intplugins/B2DPlugin/B2DPlugin.c | 36 +- .../intplugins/BitBltPlugin/BitBltPlugin.c | 375 +++++++++++--------- .../intplugins/LargeIntegers/LargeIntegers.c | 34 +- .../intplugins/SoundPlugin/SoundPlugin.c | 12 +- .../intplugins/SoundPlugin/sqUnixSound.c | 20 +- .../UnixOSProcessPlugin/UnixOSProcessPlugin.c | 24 ++- .../from_squeak/unix/vm-display-X11/sqUnixXdnd.c | 30 +- .../vm-display-X11/{sqUnixX11.c => sqrUnixX11.c} | 83 +++-- .../{sqUnixSoundMacOSX.c => sqrUnixSoundMacOSX.c} | 135 ++++---- .../unix/vm-sound-custom/sqUnixCustomSound.c | 2 +- .../unix/vm-sound-null/sqUnixSoundNull.c | 18 +- vm/src/from_squeak/unix/vm/aio.c | 30 +- vm/src/from_squeak/unix/vm/dlfcn-dyld.c | 22 +- vm/src/from_squeak/unix/vm/sq.h | 20 +- vm/src/from_squeak/unix/vm/sqMemoryAccess.h | 20 +- vm/src/from_squeak/unix/vm/sqNamedPrims.h | 8 + vm/src/from_squeak/unix/vm/sqPlatformSpecific.h | 22 +- vm/src/from_squeak/unix/vm/sqUnixCharConv.h | 22 +- vm/src/from_squeak/unix/vm/sqUnixEvent.c | 18 +- vm/src/from_squeak/unix/vm/sqaio.h | 16 +- .../vm/{sqUnixCharConv.c => sqrUnixCharConv.c} | 42 ++- ...qUnixExternalPrims.c => sqrUnixExternalPrims.c} | 30 +- .../unix/vm/{sqUnixMain.c => sqrUnixMain.c} | 223 +++++++----- 31 files changed, 962 insertions(+), 585 deletions(-) create mode 100644 vm/src/from_squeak/Cross/plugins/RePlugin/sqr_config.h rename vm/src/from_squeak/Cross/vm/{sqNamedPrims.c => sqrNamedPrims.c} (95%) rename vm/src/from_squeak/Cross/vm/{sqVirtualMachine.c => sqrVirtualMachine.c} (98%) rename vm/src/from_squeak/unix/vm-display-X11/{sqUnixX11.c => sqrUnixX11.c} (98%) rename vm/src/from_squeak/unix/vm-sound-MacOSX/{sqUnixSoundMacOSX.c => sqrUnixSoundMacOSX.c} (97%) rename vm/src/from_squeak/unix/vm/{sqUnixCharConv.c => sqrUnixCharConv.c} (96%) rename vm/src/from_squeak/unix/vm/{sqUnixExternalPrims.c => sqrUnixExternalPrims.c} (98%) rename vm/src/from_squeak/unix/vm/{sqUnixMain.c => sqrUnixMain.c} (90%) diff --git a/vm/src/from_squeak/Cross/plugins/FilePlugin/FilePlugin.c b/vm/src/from_squeak/Cross/plugins/FilePlugin/FilePlugin.c index 74e7816..af33a47 100644 --- a/vm/src/from_squeak/Cross/plugins/FilePlugin/FilePlugin.c +++ b/vm/src/from_squeak/Cross/plugins/FilePlugin/FilePlugin.c @@ -112,11 +112,13 @@ static sqInt asciiDirectoryDelimiter(void) { /* Open the named file, possibly checking security. Answer the file oop. */ -EXPORT(sqInt) fileOpenNamesizewritesecure(char * nameIndex, sqInt nameSize, sqInt writeFlag, sqInt secureFlag) { +EXPORT(sqInt) fileOpenNamesizewritesecure(char * nameIndex_xxx_dmu, sqInt nameSize, sqInt writeFlag, sqInt secureFlag) { sqInt fileOop; sqInt okToOpen; SQFile * file; + char* nameIndex_xxx_dmu1 = malloc(nameSize); + memmove(nameIndex_xxx_dmu1, nameIndex_xxx_dmu, nameSize); fileOop = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classByteArray(), fileRecordSize()); /* begin fileValueOf: */ if (!((interpreterProxy->isBytes(fileOop)) && ((interpreterProxy->byteSizeOf(fileOop)) == (fileRecordSize())))) { @@ -129,7 +131,7 @@ l1: /* end fileValueOf: */; if (!(interpreterProxy->failed())) { if (secureFlag) { if (sCOFfn != 0) { - okToOpen = ((sqInt (*) (char *, sqInt, sqInt)) sCOFfn)(nameIndex, nameSize, writeFlag); + okToOpen = ((sqInt (*) (char *, sqInt, sqInt)) sCOFfn)(nameIndex_xxx_dmu1, nameSize, writeFlag); if (!(okToOpen)) { interpreterProxy->primitiveFail(); } @@ -137,8 +139,9 @@ l1: /* end fileValueOf: */; } } if (!(interpreterProxy->failed())) { - sqFileOpen(file, nameIndex, nameSize, writeFlag); + sqFileOpen(file, nameIndex_xxx_dmu1, nameSize, writeFlag); } + free(nameIndex_xxx_dmu1); return fileOop; } @@ -318,7 +321,7 @@ EXPORT(sqInt) primitiveDirectoryDelimitor(void) { return interpreterProxy->primitiveFail(); } interpreterProxy->pop(1); - interpreterProxy->push(interpreterProxy->fetchPointerofObject(ascii, interpreterProxy->characterTable())); + interpreterProxy->push(interpreterProxy->fetchPointerofObject(ascii, interpreterProxy->characterTable())); // OK xxx_dmu } EXPORT(sqInt) primitiveDirectoryGetMacTypeAndCreator(void) { @@ -384,7 +387,7 @@ EXPORT(sqInt) primitiveDirectoryLookup(void) { } pathNameIndex = interpreterProxy->firstIndexableField(pathName); - /* If the security plugin can be loaded, use it to check for permission. + /* If the security plugin can be loaded, use it to check for permission. If not, assume it's ok */ pathNameSize = interpreterProxy->byteSizeOf(pathName); diff --git a/vm/src/from_squeak/Cross/plugins/FilePlugin/FilePlugin.h b/vm/src/from_squeak/Cross/plugins/FilePlugin/FilePlugin.h index 5ecdb8f..76abb2e 100644 --- a/vm/src/from_squeak/Cross/plugins/FilePlugin/FilePlugin.h +++ b/vm/src/from_squeak/Cross/plugins/FilePlugin/FilePlugin.h @@ -1,11 +1,11 @@ /**************************************************************************** * PROJECT: Common include * FILE: FilePlugin.h -* CONTENT: +* CONTENT: * -* AUTHOR: -* ADDRESS: -* EMAIL: +* AUTHOR: +* ADDRESS: +* EMAIL: * RCSID: $Id: FilePlugin.h 1283 2005-12-31 00:51:12Z rowledge $ * * 2005-03-26 IKP fix unaligned accesses to file member diff --git a/vm/src/from_squeak/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c b/vm/src/from_squeak/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c index 1a938ce..cb43c47 100644 --- a/vm/src/from_squeak/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c +++ b/vm/src/from_squeak/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c @@ -1,10 +1,10 @@ /**************************************************************************** * PROJECT: File Interface * FILE: sqFilePluginBasicPrims.c -* CONTENT: +* CONTENT: * -* AUTHOR: -* ADDRESS: +* AUTHOR: +* ADDRESS: * EMAIL: ] * RCSID: $Id: sqFilePluginBasicPrims.c 1283 2005-12-31 00:51:12Z rowledge $ * @@ -26,7 +26,7 @@ * handling code. Note that the win32 platform #defines NO_STD_FILE_SUPPORT * and thus bypasses this file */ - + #include "sq.h" #ifndef NO_STD_FILE_SUPPORT #include "FilePlugin.h" @@ -203,8 +203,8 @@ sqInt sqFileOpen(SQFile *f, char* sqFileName, sqInt sqFileNameSize, sqInt writeF if (getFile(f) != NULL) { char type[4],creator[4]; dir_GetMacFileTypeAndCreator(sqFileName, sqFileNameSize, type, creator); - if (strncmp(type,"BINA",4) == 0 || strncmp(type,"????",4) == 0 || *(int *)type == 0 ) - dir_SetMacFileTypeAndCreator(sqFileName, sqFileNameSize,"TEXT","R*ch"); + if (strncmp(type,"BINA",4) == 0 || strncmp(type,"????",4) == 0 || *(int *)type == 0 ) + dir_SetMacFileTypeAndCreator(sqFileName, sqFileNameSize,"TEXT","R*ch"); } } f->writable = true; @@ -297,7 +297,7 @@ sqInt sqFileTruncate(SQFile *f,squeakFileOffsetType offset) { if (!sqFileValid(f)) return interpreterProxy->success(false); if (sqFTruncate(getFile(f), offset)) { return interpreterProxy->success(false); - } + } setSize(f, ftell(getFile(f))); return 1; } diff --git a/vm/src/from_squeak/Cross/plugins/FilePlugin/sqUnixFile.c b/vm/src/from_squeak/Cross/plugins/FilePlugin/sqUnixFile.c index a604f61..9719acc 100644 --- a/vm/src/from_squeak/Cross/plugins/FilePlugin/sqUnixFile.c +++ b/vm/src/from_squeak/Cross/plugins/FilePlugin/sqUnixFile.c @@ -1,41 +1,41 @@ /* sqUnixFile.c -- directory operations for Unix - * + * * Copyright (C) 1996-2004 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. */ /* Author: Ian.Piumarta@INRIA.Fr - * + * * Last edited: 2004-06-13 19:42:03 by piumarta on emilia.local */ @@ -201,15 +201,15 @@ sqInt dir_Lookup(char *pathString, sqInt pathStringLength, sqInt index, { nextEntry: do - { - errno= 0; + { + errno= 0; dirEntry= readdir(openDir); } while ((dirEntry == 0) && (errno == EINTR)); if (!dirEntry) return NO_MORE_ENTRIES; - + nameLen= NAMLEN(dirEntry); /* ignore '.' and '..' (these are not *guaranteed* to be first) */ diff --git a/vm/src/from_squeak/Cross/plugins/RePlugin/sqr_config.h b/vm/src/from_squeak/Cross/plugins/RePlugin/sqr_config.h new file mode 100644 index 0000000..4c12b0c --- /dev/null +++ b/vm/src/from_squeak/Cross/plugins/RePlugin/sqr_config.h @@ -0,0 +1,199 @@ +/* Modified for RVM -- dmu 2/10 */ + +/* config.h. Generated by configure. */ +/* config.h.in -- template for config.h -*- C -*- + * + * Copyright (C) 1996-2005 by Ian Piumarta and other authors/contributors + * listed elsewhere in this file. + * All rights reserved. + * + * This file is part of Unix Squeak. + * + * You are NOT ALLOWED to distribute modified versions of this file + * under its original name. If you modify this file then you MUST + * rename it before making your modifications available publicly. + * + * This file is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You may use and/or distribute this file ONLY as part of Squeak, under + * the terms of the Squeak License as described in `LICENSE' in the base of + * this distribution, subject to the following additional restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment to the original author(s) (and any + * other contributors mentioned herein) in the product documentation + * would be appreciated but is not required. + * + * 2. You must not distribute (or make publicly available by any + * means) a modified copy of this file unless you first rename it. + * + * 3. This notice must not be removed or altered in any source distribution. + * + * Using (or modifying this file for use) in any context other than Squeak + * changes these copyright conditions. Read the file `COPYING' in the + * directory `platforms/unix/doc' before proceeding with any such use. + */ + +/* Author: Ian.Piumarta@squeakland.org + * + * Last edited: 2006-04-06 09:12:12 by piumarta on emilia.local + */ + +#ifndef __sq_config_h +#define __sq_config_h + +/* explicit image width */ + +#define HAVE_INTERP_H 1 + +/* package options */ + +#define USE_X11 1 +# if !Configure_Squeak_Code_for_Tilera // xxx_dmu +#define USE_X11_GLX 1 +#define USE_QUARTZ 1 +#define USE_QUARTZ_CGL 1 +# endif // xxx_dmu +/* #undef USE_RFB */ + +/* libraries */ + +/* #undef HAVE_LIBX11 */ +#define HAVE_LIBXEXT 1 +/* #undef HAVE_LIBDL */ +# if Configure_Squeak_Code_for_Tilera + # define HAVE_LIBDL +# endif +# if Configure_Squeak_Code_for_Tilera // xxx_dmu +# undef HAVE_DYLD +# else +#define HAVE_DYLD 1 +# endif +/* #undef HAVE_LIBFFI */ +/* #undef HAVE_ICONV */ + +/* #undef USE_AUDIO_NONE */ +/* #undef USE_AUDIO_SUN */ +/* #undef USE_AUDIO_NAS */ +/* #undef USE_AUDIO_OSS */ +/* #undef USE_AUDIO_MACOSX */ +/* #undef OSS_DEVICE */ + +/* header files */ + +#define HAVE_UNISTD_H 1 +/* #undef NEED_GETHOSTNAME_P */ + +#define HAVE_DIRENT_H 1 +/* #undef HAVE_SYS_NDIR_H */ +/* #undef HAVE_SYS_DIR_H */ +/* #undef HAVE_NDIR_H */ + +#define HAVE_DLFCN_H 1 +# if !Configure_Squeak_Code_for_Tilera // xxx_dmu +#define HAVE_ICONV_H 1 +# endif + +#define HAVE_SYS_TIME_H 1 +#define TIME_WITH_SYS_TIME 1 + +#define HAVE_SYS_FILIO_H 1 + +/* #undef HAVE_SYS_AUDIOIO_H */ +/* #undef HAVE_SUN_AUDIOIO_H */ + +/* #undef HAVE_PTY_H */ +#define HAVE_UTIL_H 1 +/* #undef HAVE_LIBUTIL_H */ +/* #undef HAVE_STROPTS_H */ +# if !Configure_Squeak_Code_for_Tilera // xxx_dmu +#define HAVE_GL_GL_H 1 +#define HAVE_OPENGL_GL_H 1 +# endif + +/* #undef NEED_SUNOS_H */ + +/* system calls/library functions */ + +#define AT_EXIT atexit + +#define HAVE_TZSET 1 + +#define HAVE_OPENPTY 1 +/* #undef HAVE_UNIX98_PTYS */ + +#define HAVE_SNPRINTF 1 +/* #undef HAVE___SNPRINTF */ + +#define HAVE_MMAP 1 + +#define HAVE_LANGINFO_CODESET 1 + +#define HAVE_ALLOCA 1 +#define HAVE_ALLOCA_H 1 + +#define HAVE_UNSETENV 1 + +/* widths of primitive types */ + +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_LONG_LONG 8 +#define SIZEOF_VOID_P 4 + +/* structures */ + +#define HAVE_TM_GMTOFF 1 +#define HAVE_TIMEZONE 1 + +/* typedefs */ + +/* #undef size_t */ +/* #undef socklen_t */ + +#define squeakInt64 long long + +/* architecture */ + +#define OS_TYPE "unix" + +#define VM_HOST "i386-apple-darwin9.2.2" +#define VM_HOST_CPU "i386" +/* #undef VM_HOST_VENDOR */ +#define VM_HOST_OS "darwin9.2.2" +#define VM_BUILD_STRING "Unix built on "__DATE__ " "__TIME__" Compiler: "__VERSION__ + +/* #undef WORDS_BIGENDIAN */ +/* #undef DOUBLE_WORD_ALIGNMENT */ +#define DOUBLE_WORD_ORDER 1 + +/* damage containment */ + +#define DARWIN 1 + +#ifdef NEED_SUNOS_H +# include "sunos.h" +#endif + +/* other configured variables */ + +#define SQ_VERSION "3.9a-7021" +#define VM_VERSION "3.9-4" +#define VM_LIBDIR "/Users/ungar/renaissance/Squeak/vm/newVMbuild/lib/squeak/3.9-4" +#define VM_MODULE_PREFIX "" +/* #undef VM_DLSYM_PREFIX */ +#define VM_X11DIR "/usr/X11/lib" + +/* avoid dependencies on glibc2.3 */ + +/* #undef HAVE_FEATURES_H */ + +#if defined(HAVE_FEATURES_H) +# include "glibc.h" +#endif + +#endif /* __sq_config_h */ + diff --git a/vm/src/from_squeak/Cross/vm/sqVirtualMachine.h b/vm/src/from_squeak/Cross/vm/sqVirtualMachine.h index e73f8e5..37afd59 100644 --- a/vm/src/from_squeak/Cross/vm/sqVirtualMachine.h +++ b/vm/src/from_squeak/Cross/vm/sqVirtualMachine.h @@ -174,7 +174,7 @@ typedef struct VirtualMachine { #if VM_PROXY_MINOR > 3 - void *(*ioLoadFunctionFrom)(char *fnName, char *modName); + void *(*ioLoadFunctionFrom)(const char *fnName, const char *modName); sqInt (*ioMicroMSecs)(void); #endif @@ -205,7 +205,7 @@ typedef struct VirtualMachine { sqInt (*fetchLong32ofObject)(sqInt fieldFieldIndex, sqInt oop); sqInt (*getThisSessionID)(void); sqInt (*ioFilenamefromStringofLengthresolveAliases)(char* aCharBuffer, char* filenameIndex, sqInt filenameLength, sqInt resolveFlag); - sqInt (*vmEndianness)(void); + sqInt (*vmEndianness)(void); #endif diff --git a/vm/src/from_squeak/Cross/vm/sqNamedPrims.c b/vm/src/from_squeak/Cross/vm/sqrNamedPrims.c similarity index 95% rename from vm/src/from_squeak/Cross/vm/sqNamedPrims.c rename to vm/src/from_squeak/Cross/vm/sqrNamedPrims.c index ecaa0a0..8330242 100644 --- a/vm/src/from_squeak/Cross/vm/sqNamedPrims.c +++ b/vm/src/from_squeak/Cross/vm/sqrNamedPrims.c @@ -1,5 +1,5 @@ /**************************************************************************** -* PROJECT: Squeak +* PROJECT: Squeak * FILE: sqNamedPrims.c * CONTENT: Generic (cross platform) named primitive support * @@ -195,7 +195,7 @@ static int callInitializersIn(ModuleEntry *module) /* Note: older plugins may not export the compiled module name */ dprintf(("WARNING: getModuleName() not found in %s\n", module->name)); } - if(!init1) { + if(!init1) { dprintf(("ERROR: setInterpreter() not found\n")); return 0; } @@ -262,7 +262,7 @@ static ModuleEntry *findAndLoadModule(char *pluginName, int ffiLoad) } /* findOrLoadModule: - Look if the given module is already loaded. + Look if the given module is already loaded. If so, return it's handle, otherwise try to load it. */ static ModuleEntry *findOrLoadModule(char *pluginName, int ffiLoad) @@ -289,7 +289,7 @@ static ModuleEntry *findOrLoadModule(char *pluginName, int ffiLoad) Return the function address if successful, otherwise 0. This entry point is called from the interpreter proxy. */ -void *ioLoadFunctionFrom(char *functionName, char *pluginName) +void *ioLoadFunctionFrom(const char *functionName, const char *pluginName) { ModuleEntry *module; @@ -313,8 +313,8 @@ void *ioLoadFunctionFrom(char *functionName, char *pluginName) void *ioLoadExternalFunctionOfLengthFromModuleOfLength(sqInt functionNameIndex, sqInt functionNameLength, sqInt moduleNameIndex, sqInt moduleNameLength) { - char *functionNamePointer= pointerForOop(functionNameIndex); - char *moduleNamePointer= pointerForOop(moduleNameIndex); + char *functionNamePointer= pointerForIndex_xxx_dmu(functionNameIndex); + char *moduleNamePointer= pointerForIndex_xxx_dmu(moduleNameIndex); char functionName[256]; char moduleName[256]; int i; @@ -335,7 +335,7 @@ void *ioLoadExternalFunctionOfLengthFromModuleOfLength(sqInt functionNameIndex, */ void *ioLoadSymbolOfLengthFromModule(sqInt functionNameIndex, sqInt functionNameLength, void *moduleHandle) { - char *functionNamePointer= pointerForOop(functionNameIndex); + char *functionNamePointer= pointerForIndex_xxx_dmu(functionNameIndex); char functionName[256]; int i; @@ -358,7 +358,7 @@ void *ioLoadSymbolOfLengthFromModule(sqInt functionNameIndex, sqInt functionName void *ioLoadModuleOfLength(sqInt moduleNameIndex, sqInt moduleNameLength) { ModuleEntry *module; - char *moduleNamePointer= pointerForOop(moduleNameIndex); + char *moduleNamePointer= pointerForIndex_xxx_dmu(moduleNameIndex); char moduleName[256]; int i; @@ -446,7 +446,7 @@ sqInt ioUnloadModule(char *moduleName) */ sqInt ioUnloadModuleOfLength(sqInt moduleNameIndex, sqInt moduleNameLength) { - char *moduleNamePointer= pointerForOop(moduleNameIndex); + char *moduleNamePointer= pointerForIndex_xxx_dmu(moduleNameIndex); char moduleName[256]; int i; @@ -519,3 +519,11 @@ char *ioListLoadedModule(sqInt moduleIndex) { } else return (char*)NULL; } + + + +void rvm_callInitializersInAllModules() { + findOrLoadModule("BitBltPlugin", 0); + // xxxxxx Which other modules? +} + diff --git a/vm/src/from_squeak/Cross/vm/sqVirtualMachine.c b/vm/src/from_squeak/Cross/vm/sqrVirtualMachine.c similarity index 98% rename from vm/src/from_squeak/Cross/vm/sqVirtualMachine.c rename to vm/src/from_squeak/Cross/vm/sqrVirtualMachine.c index 5045c00..8451885 100644 --- a/vm/src/from_squeak/Cross/vm/sqVirtualMachine.c +++ b/vm/src/from_squeak/Cross/vm/sqrVirtualMachine.c @@ -3,6 +3,7 @@ #include #include #include +#include "squeak_adapters.h" #include "sqVirtualMachine.h" /*** Function prototypes ***/ @@ -41,7 +42,7 @@ sqInt fetchPointerofObject(sqInt index, sqInt oop); * equivalent but 64 bit valid function is added as * * 'fetchLong32OfObject' */ sqInt obsoleteDontUseThisFetchWordofObject(sqInt index, sqInt oop); -sqInt fetchLong32ofObject(sqInt index, sqInt oop); +sqInt fetchLong32ofObject(sqInt index, sqInt oop); void *firstFixedField(sqInt oop); void *firstIndexableField(sqInt oop); sqInt literalofMethod(sqInt offset, sqInt methodPointer); @@ -136,7 +137,7 @@ sqInt ioMicroMSecs(void); sqInt forceInterruptCheck(void); sqInt getThisSessionID(void); sqInt ioFilenamefromStringofLengthresolveAliases(char* aCharBuffer, char* filenameIndex, sqInt filenameLength, sqInt resolveFlag); -sqInt vmEndianness(void); +sqInt vmEndianness(void); /* InterpreterProxy methodsFor: 'BitBlt support' */ sqInt loadBitBltFrom(sqInt bbOop); @@ -153,7 +154,7 @@ sqInt ioLoadModuleOfLength(sqInt moduleNameIndex, sqInt moduleNameLength); sqInt ioLoadSymbolOfLengthFromModule(sqInt functionNameIndex, sqInt functionNameLength, sqInt moduleHandle); sqInt isInMemory(sqInt address); -void *ioLoadFunctionFrom(char *fnName, char *modName); +void *ioLoadFunctionFrom(const char *fnName, const char *modName); struct VirtualMachine *VM = NULL; @@ -189,7 +190,7 @@ struct VirtualMachine* sqGetInterpreterProxy(void) VM->stackIntegerValue = stackIntegerValue; VM->stackObjectValue = stackObjectValue; VM->stackValue = stackValue; - + /* InterpreterProxy methodsFor: 'object access' */ VM->argumentCountOf = argumentCountOf; VM->arrayValueOf = arrayValueOf; @@ -215,7 +216,7 @@ struct VirtualMachine* sqGetInterpreterProxy(void) VM->stSizeOf = stSizeOf; VM->storeIntegerofObjectwithValue = storeIntegerofObjectwithValue; VM->storePointerofObjectwithValue = storePointerofObjectwithValue; - + /* InterpreterProxy methodsFor: 'testing' */ VM->isKindOf = isKindOf; VM->isMemberOf = isMemberOf; @@ -245,7 +246,7 @@ struct VirtualMachine* sqGetInterpreterProxy(void) VM->falseObject = falseObject; VM->nilObject = nilObject; VM->trueObject = trueObject; - + /* InterpreterProxy methodsFor: 'special classes' */ VM->classArray = classArray; VM->classBitmap = classBitmap; @@ -257,7 +258,7 @@ struct VirtualMachine* sqGetInterpreterProxy(void) VM->classSemaphore = classSemaphore; VM->classSmallInteger = classSmallInteger; VM->classString = classString; - + /* InterpreterProxy methodsFor: 'instance creation' */ VM->clone = clone; VM->instantiateClassindexableSize = instantiateClassindexableSize; diff --git a/vm/src/from_squeak/intplugins/B2DPlugin/B2DPlugin.c b/vm/src/from_squeak/intplugins/B2DPlugin/B2DPlugin.c index a18e538..8559a18 100644 --- a/vm/src/from_squeak/intplugins/B2DPlugin/B2DPlugin.c +++ b/vm/src/from_squeak/intplugins/B2DPlugin/B2DPlugin.c @@ -860,7 +860,7 @@ static sqInt addEdgeToGET(sqInt edge) { } -/* NOTE: This method is (hopefully) obsolete due to unrolling +/* NOTE: This method is (hopefully) obsolete due to unrolling the fill loops to deal with full pixels. */ /* Adjust the span buffers values by the appropriate color offset for anti-aliasing. We do this by replicating the top bits of each color in the lower bits. The idea is that we can scale each color value uniquely from 0 to 255 and thus fill the entire range of colors. */ @@ -1521,7 +1521,7 @@ static sqInt checkCompressedPointssegments(sqInt points, sqInt nSegments) { } -/* Check if the given shape can be handled by the engine. +/* Check if the given shape can be handled by the engine. Since there are a number of requirements this is an extra method. */ static sqInt checkCompressedShapesegmentsleftFillsrightFillslineWidthslineFillsfillIndexList(sqInt points, sqInt nSegments, sqInt leftFills, sqInt rightFills, sqInt lineWidths, sqInt lineFills, sqInt fillIndexList) { @@ -1920,7 +1920,7 @@ l1: /* end wbStackPush: */; } -/* Get both values from the two boundaries of the given bezier +/* Get both values from the two boundaries of the given bezier and compute the actual position/width of the line */ static sqInt computeFinalWideBezierValueswidth(sqInt bezier, sqInt lineWidth) { @@ -3968,7 +3968,7 @@ static sqInt findNextExternalFillFromAET(void) { leftX = rightX = workBuffer[GWFillMaxX]; while ((workBuffer[GWAETStart]) < (workBuffer[GWAETUsed])) { - /* TODO: We should check if leftX from last operation + /* TODO: We should check if leftX from last operation is greater than leftX from next edge. Currently, we rely here on spanEndAA from the span buffer fill. */ @@ -5956,7 +5956,7 @@ EXPORT(sqInt) moduleUnloaded(char * aModuleName) { } -/* The entry at index is not in the right position of the AET. +/* The entry at index is not in the right position of the AET. Move it to the left until the position is okay. */ static sqInt moveAETEntryFromedgex(sqInt index, sqInt edge, sqInt xValue) { @@ -6629,7 +6629,7 @@ EXPORT(sqInt) primitiveAddPolygon(void) { return interpreterProxy->primitiveFail(); } if (((lineFill == 0) || (lineWidth == 0)) && (fillIndex == 0)) { - return interpreterProxy->pop(6); + return interpreterProxy->pop(5); // was 6 DMU Squeak bug? } if (!(lineWidth == 0)) { lineWidth = transformWidth(lineWidth); @@ -6873,7 +6873,7 @@ EXPORT(sqInt) primitiveDisplaySpanBuffer(void) { if (!(loadSpanBufferFrom(interpreterProxy->fetchPointerofObject(BESpanIndex, engine)))) { return interpreterProxy->primitiveFail(); } - if (!(loadBitBltFrom(interpreterProxy->fetchPointerofObject(BEBitBltIndex, engine)))) { + if (!(loadBitBltFrom(interpreterProxy->fetchPointerofObject(BEBitBltIndex, engine)))) { // maybe xxx_dmu return interpreterProxy->primitiveFail(); } if (((workBuffer[GWCurrentY]) & (workBuffer[GWAAScanMask])) == (workBuffer[GWAAScanMask])) { @@ -7088,7 +7088,7 @@ EXPORT(sqInt) primitiveGetFailureReason(void) { if ((interpreterProxy->slotSizeOf(engine)) < BEBalloonEngineSize) { return 0; } - if (!(loadWorkBufferFrom(interpreterProxy->fetchPointerofObject(BEWorkBufferIndex, engine)))) { + if (!(loadWorkBufferFrom(interpreterProxy->fetchPointerofObject(BEWorkBufferIndex, engine)))) { // maybe xxx_dmu return interpreterProxy->primitiveFail(); } interpreterProxy->pop(1); @@ -7213,7 +7213,7 @@ EXPORT(sqInt) primitiveInitializeProcessing(void) { if (!(quickLoadEngineFromrequiredState(engine, GEStateUnlocked))) { return interpreterProxy->primitiveFail(); } - if (!(loadSpanBufferFrom(interpreterProxy->fetchPointerofObject(BESpanIndex, engine)))) { + if (!(loadSpanBufferFrom(interpreterProxy->fetchPointerofObject(BESpanIndex, engine)))) { // maybe xxx_dmu return interpreterProxy->primitiveFail(); } initializeGETProcessing(); @@ -7257,7 +7257,7 @@ EXPORT(sqInt) primitiveMergeFillFrom(void) { if (!(quickLoadEngineFromrequiredState(engine, GEStateWaitingForFill))) { return interpreterProxy->primitiveFail(); } - if (!(loadSpanBufferFrom(interpreterProxy->fetchPointerofObject(BESpanIndex, engine)))) { + if (!(loadSpanBufferFrom(interpreterProxy->fetchPointerofObject(BESpanIndex, engine)))) { // maybe xxx_dmu return interpreterProxy->primitiveFail(); } if (!((interpreterProxy->fetchClassOf(bitsOop)) == (interpreterProxy->classBitmap()))) { @@ -7416,10 +7416,10 @@ EXPORT(sqInt) primitiveNextFillEntry(void) { if (!(quickLoadEngineFromrequiredState(engine, GEStateScanningAET))) { return interpreterProxy->primitiveFail(); } - if (!(loadSpanBufferFrom(interpreterProxy->fetchPointerofObject(BESpanIndex, engine)))) { + if (!(loadSpanBufferFrom(interpreterProxy->fetchPointerofObject(BESpanIndex, engine)))) { // maybe xxx_dmu return interpreterProxy->primitiveFail(); } - if (!(loadFormsFrom(interpreterProxy->fetchPointerofObject(BEFormsIndex, engine)))) { + if (!(loadFormsFrom(interpreterProxy->fetchPointerofObject(BEFormsIndex, engine)))) { // maybe xxx_dmu return interpreterProxy->primitiveFail(); } if (!((workBuffer[GWClearSpanBuffer]) == 0)) { @@ -7717,8 +7717,8 @@ EXPORT(sqInt) primitiveSetClipRect(void) { if ((interpreterProxy->slotSizeOf(rectOop)) < 2) { return interpreterProxy->primitiveFail(); } - loadPointfrom(((int *) (workBuffer + GWPoint1)), interpreterProxy->fetchPointerofObject(0, rectOop)); - loadPointfrom(((int *) (workBuffer + GWPoint2)), interpreterProxy->fetchPointerofObject(1, rectOop)); + loadPointfrom(((int *) (workBuffer + GWPoint1)), interpreterProxy->fetchPointerofObject(0, rectOop)); // maybe xxx_dmu + loadPointfrom(((int *) (workBuffer + GWPoint2)), interpreterProxy->fetchPointerofObject(1, rectOop)); // maybe xxx_dmu if (!(interpreterProxy->failed())) { workBuffer[GWClipMinX] = ((((int *) (workBuffer + GWPoint1)))[0]); workBuffer[GWClipMinY] = ((((int *) (workBuffer + GWPoint1)))[1]); @@ -8073,7 +8073,7 @@ static sqInt quickLoadEngineFrom(sqInt engineOop) { return 0; } engine = engineOop; - if (!(loadWorkBufferFrom(interpreterProxy->fetchPointerofObject(BEWorkBufferIndex, engineOop)))) { + if (!(loadWorkBufferFrom(interpreterProxy->fetchPointerofObject(BEWorkBufferIndex, engineOop)))) { // maybe xxx_dmu return 0; } workBuffer[GWStopReason] = 0; @@ -8411,7 +8411,7 @@ static sqInt showFilldepthrightX(sqInt fillIndex, sqInt depth, sqInt rightX) { } static int * smallSqrtTable(void) { - static int theTable[32] = + static int theTable[32] = {0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6}; return theTable; @@ -8509,7 +8509,7 @@ static sqInt stepToFirstBezier(void) { /* Initialize the bezier at yValue. - TODO: Check if reducing maxSteps from 2*deltaY to deltaY + TODO: Check if reducing maxSteps from 2*deltaY to deltaY brings a *significant* performance improvement. In theory this should make for double step performance but will cost in quality. Might be that the AA stuff will @@ -9341,7 +9341,7 @@ static sqInt subdivideBezierFrom(sqInt index) { } -/* Check if the given bezier curve is monoton in Y, and, if desired in X. +/* Check if the given bezier curve is monoton in Y, and, if desired in X. If not, subdivide it */ static sqInt subdivideToBeMonotoninX(sqInt base, sqInt doTestX) { diff --git a/vm/src/from_squeak/intplugins/BitBltPlugin/BitBltPlugin.c b/vm/src/from_squeak/intplugins/BitBltPlugin/BitBltPlugin.c index e0b6a5e..997eec0 100644 --- a/vm/src/from_squeak/intplugins/BitBltPlugin/BitBltPlugin.c +++ b/vm/src/from_squeak/intplugins/BitBltPlugin/BitBltPlugin.c @@ -30,6 +30,9 @@ by VMMaker 3.8b6 #include "sqMemoryAccess.h" +void dp(int); +void pst(); + /*** Constants ***/ #define AllOnes 4294967295U @@ -222,6 +225,7 @@ static unsigned int * cmMaskTable; static int * cmShiftTable; static sqInt combinationRule; static sqInt destBits; +static sqInt destBitsOop_xxx_dmu; static sqInt destDelta; static sqInt destDepth; static sqInt destForm; @@ -284,6 +288,7 @@ static void * querySurfaceFn; static sqInt skew; static sqInt sourceAlpha; static sqInt sourceBits; +static sqInt sourceBitsOop_xxx_dmu; static sqInt sourceDelta; static sqInt sourceDepth; static sqInt sourceForm; @@ -345,8 +350,8 @@ static sqInt OLDrgbDiffwith(sqInt sourceWord, sqInt destinationWord) { } -/* Tally pixels into the color map. Note that the source should be - specified = destination, in order for the proper color map checks +/* Tally pixels into the color map. Note that the source should be + specified = destination, in order for the proper color map checks to be performed at setup. Note that the region is not clipped to bit boundaries, but only to the nearest (enclosing) word. This is because copyLoop does not do @@ -736,7 +741,7 @@ static sqInt alphaPaintConstwith(sqInt sourceWord, sqInt destinationWord) { } -/* This version assumes +/* This version assumes combinationRule = 34 sourcePixSize = 32 destPixSize = 16 @@ -797,7 +802,7 @@ static sqInt alphaSourceBlendBits16(void) { } while ((deltaX -= 1) != 0) { ditherThreshold = ditherMatrix4x4[ditherBase + (ditherIndex = (ditherIndex + 1) & 3)]; - sourceWord = long32At(srcIndex); + sourceWord = long32AtPointer(srcIndex); srcAlpha = ((usqInt) sourceWord) >> 24; if (srcAlpha == 255) { /* begin dither32To16:threshold: */ @@ -809,13 +814,13 @@ static sqInt alphaSourceBlendBits16(void) { sourceWord = sourceWord << srcShift; } /* begin dstLongAt:put:mask: */ - dstValue = long32At(dstIndex); + dstValue = long32AtPointer(dstIndex); dstValue = dstValue & dstMask; dstValue = dstValue | sourceWord; - long32Atput(dstIndex, dstValue); + long32AtPointerput(dstIndex, dstValue); } else { if (!(srcAlpha == 0)) { - destWord = long32At(dstIndex); + destWord = long32AtPointer(dstIndex); destWord = destWord & (~dstMask); /* Expand from 16 to 32 bit by adding zero bits */ @@ -838,10 +843,10 @@ static sqInt alphaSourceBlendBits16(void) { sourceWord = sourceWord << srcShift; } /* begin dstLongAt:put:mask: */ - dstValue1 = long32At(dstIndex); + dstValue1 = long32AtPointer(dstIndex); dstValue1 = dstValue1 & dstMask; dstValue1 = dstValue1 | sourceWord; - long32Atput(dstIndex, dstValue1); + long32AtPointerput(dstIndex, dstValue1); } } srcIndex += 4; @@ -866,12 +871,12 @@ static sqInt alphaSourceBlendBits16(void) { } -/* This version assumes +/* This version assumes combinationRule = 34 sourcePixSize = destPixSize = 32 sourceForm ~= destForm. Note: The inner loop has been optimized for dealing - with the special cases of srcAlpha = 0.0 and srcAlpha = 1.0 + with the special cases of srcAlpha = 0.0 and srcAlpha = 1.0 */ static sqInt alphaSourceBlendBits32(void) { @@ -903,17 +908,17 @@ static sqInt alphaSourceBlendBits32(void) { deltaX = bbW + 1; while ((deltaX -= 1) != 0) { - sourceWord = long32At(srcIndex); + sourceWord = long32AtPointer(srcIndex); srcAlpha = ((usqInt) sourceWord) >> 24; if (srcAlpha == 255) { - long32Atput(dstIndex, sourceWord); + long32AtPointerput(dstIndex, sourceWord); srcIndex += 4; /* Now copy as many words as possible with alpha = 255 */ dstIndex += 4; - while (((deltaX -= 1) != 0) && ((((usqInt) (sourceWord = long32At(srcIndex))) >> 24) == 255)) { - long32Atput(dstIndex, sourceWord); + while (((deltaX -= 1) != 0) && ((((usqInt) (sourceWord = long32AtPointer(srcIndex))) >> 24) == 255)) { + long32AtPointerput(dstIndex, sourceWord); srcIndex += 4; dstIndex += 4; } @@ -925,15 +930,15 @@ static sqInt alphaSourceBlendBits32(void) { /* Now skip as many words as possible, */ dstIndex += 4; - while (((deltaX -= 1) != 0) && ((((usqInt) (sourceWord = long32At(srcIndex))) >> 24) == 0)) { + while (((deltaX -= 1) != 0) && ((((usqInt) (sourceWord = long32AtPointer(srcIndex))) >> 24) == 0)) { srcIndex += 4; dstIndex += 4; } deltaX += 1; } else { - destWord = long32At(dstIndex); + destWord = long32AtPointer(dstIndex); destWord = alphaBlendScaledwith(sourceWord, destWord); - long32Atput(dstIndex, destWord); + long32AtPointerput(dstIndex, destWord); srcIndex += 4; dstIndex += 4; } @@ -945,7 +950,7 @@ static sqInt alphaSourceBlendBits32(void) { } -/* This version assumes +/* This version assumes combinationRule = 34 sourcePixSize = 32 destPixSize = 8 @@ -1007,11 +1012,11 @@ static sqInt alphaSourceBlendBits8(void) { dstMask = mask2; while ((deltaX -= 1) != 0) { - sourceWord = ((long32At(srcIndex)) & (~adjust)) + adjust; + sourceWord = ((long32AtPointer(srcIndex)) & (~adjust)) + adjust; srcAlpha = ((usqInt) sourceWord) >> 24; if (srcAlpha > 31) { if (srcAlpha < 224) { - destWord = long32At(dstIndex); + destWord = long32AtPointer(dstIndex); destWord = destWord & (~dstMask); destWord = ((usqInt) destWord) >> srcShift; destWord = mappingTable[destWord]; @@ -1040,10 +1045,10 @@ static sqInt alphaSourceBlendBits8(void) { sourceWord = sourceWord << srcShift; /* begin dstLongAt:put:mask: */ - dstValue = long32At(dstIndex); + dstValue = long32AtPointer(dstIndex); dstValue = dstValue & dstMask; dstValue = dstValue | sourceWord; - long32Atput(dstIndex, dstValue); + long32AtPointerput(dstIndex, dstValue); } srcIndex += 4; if (destMSB) { @@ -1641,18 +1646,18 @@ static sqInt copyLoop(void) { halftoneWord = AllOnes; halftoneHeight = 0; } else { - halftoneWord = long32At(halftoneBase + ((0 % halftoneHeight) * 4)); + halftoneWord = long32AtPointer(halftoneBase + ((0 % halftoneHeight) * 4)); } y = dy; for (i = 1; i <= bbH; i += 1) { if (halftoneHeight > 1) { - halftoneWord = long32At(halftoneBase + ((y % halftoneHeight) * 4)); + halftoneWord = long32AtPointer(halftoneBase + ((y % halftoneHeight) * 4)); y += vDir; } if (preload) { /* begin srcLongAt: */ idx = sourceIndex; - prevWord = long32At(idx); + prevWord = long32AtPointer(idx); sourceIndex += hInc; } else { prevWord = 0; @@ -1660,7 +1665,7 @@ static sqInt copyLoop(void) { destMask = mask1; /* begin srcLongAt: */ idx12 = sourceIndex; - thisWord = long32At(idx12); + thisWord = long32AtPointer(idx12); sourceIndex += hInc; /* 32-bit rotate */ @@ -1669,12 +1674,12 @@ static sqInt copyLoop(void) { prevWord = thisWord; /* begin dstLongAt: */ idx13 = destIndex; - destWord = long32At(idx13); + destWord = long32AtPointer(idx13); mergeWord = mergeFnwith(skewWord & halftoneWord, destWord); destWord = (destMask & mergeWord) | (destWord & (~destMask)); /* begin dstLongAt:put: */ idx14 = destIndex; - long32Atput(idx14, destWord); + long32AtPointerput(idx14, destWord); /* This central horizontal loop requires no store masking */ @@ -1686,22 +1691,22 @@ static sqInt copyLoop(void) { for (word = 2; word <= (nWords - 1); word += 1) { /* begin srcLongAt: */ idx1 = sourceIndex; - thisWord = long32At(idx1); + thisWord = long32AtPointer(idx1); sourceIndex += hInc; /* begin dstLongAt:put: */ idx2 = destIndex; - long32Atput(idx2, thisWord); + long32AtPointerput(idx2, thisWord); destIndex += hInc; } } else { for (word = 2; word <= (nWords - 1); word += 1) { /* begin dstLongAt:put: */ idx3 = destIndex; - long32Atput(idx3, prevWord); + long32AtPointerput(idx3, prevWord); destIndex += hInc; /* begin srcLongAt: */ idx4 = sourceIndex; - prevWord = long32At(idx4); + prevWord = long32AtPointer(idx4); sourceIndex += hInc; } } @@ -1709,7 +1714,7 @@ static sqInt copyLoop(void) { for (word = 2; word <= (nWords - 1); word += 1) { /* begin srcLongAt: */ idx5 = sourceIndex; - thisWord = long32At(idx5); + thisWord = long32AtPointer(idx5); sourceIndex += hInc; /* 32-bit rotate */ @@ -1718,7 +1723,7 @@ static sqInt copyLoop(void) { prevWord = thisWord; /* begin dstLongAt:put: */ idx6 = destIndex; - long32Atput(idx6, skewWord & halftoneWord); + long32AtPointerput(idx6, skewWord & halftoneWord); destIndex += hInc; } } @@ -1726,7 +1731,7 @@ static sqInt copyLoop(void) { for (word = 2; word <= (nWords - 1); word += 1) { /* begin srcLongAt: */ idx7 = sourceIndex; - thisWord = long32At(idx7); + thisWord = long32AtPointer(idx7); sourceIndex += hInc; /* 32-bit rotate */ @@ -1736,7 +1741,7 @@ static sqInt copyLoop(void) { mergeWord = mergeFnwith(skewWord & halftoneWord, dstLongAt(destIndex)); /* begin dstLongAt:put: */ idx8 = destIndex; - long32Atput(idx8, mergeWord); + long32AtPointerput(idx8, mergeWord); destIndex += hInc; } } @@ -1744,7 +1749,7 @@ static sqInt copyLoop(void) { destMask = mask2; /* begin srcLongAt: */ idx9 = sourceIndex; - thisWord = long32At(idx9); + thisWord = long32AtPointer(idx9); sourceIndex += hInc; /* 32-bit rotate */ @@ -1752,12 +1757,12 @@ static sqInt copyLoop(void) { skewWord = (((unskew < 0) ? ((usqInt) (prevWord & notSkewMask) >> -unskew) : ((usqInt) (prevWord & notSkewMask) << unskew))) | (((skew < 0) ? ((usqInt) (thisWord & skewMask) >> -skew) : ((usqInt) (thisWord & skewMask) << skew))); /* begin dstLongAt: */ idx10 = destIndex; - destWord = long32At(idx10); + destWord = long32AtPointer(idx10); mergeWord = mergeFnwith(skewWord & halftoneWord, destWord); destWord = (destMask & mergeWord) | (destWord & (~destMask)); /* begin dstLongAt:put: */ idx11 = destIndex; - long32Atput(idx11, destWord); + long32AtPointerput(idx11, destWord); destIndex += hInc; } sourceIndex += sourceDelta; @@ -1793,17 +1798,17 @@ static sqInt copyLoopNoSource(void) { } else { /* begin halftoneAt: */ idx = (dy + i) - 1; - halftoneWord = long32At(halftoneBase + ((idx % halftoneHeight) * 4)); + halftoneWord = long32AtPointer(halftoneBase + ((idx % halftoneHeight) * 4)); } destMask = mask1; /* begin dstLongAt: */ idx6 = destIndex; - destWord = long32At(idx6); + destWord = long32AtPointer(idx6); mergeWord = mergeFnwith(halftoneWord, destWord); destWord = (destMask & mergeWord) | (destWord & (~destMask)); /* begin dstLongAt:put: */ idx7 = destIndex; - long32Atput(idx7, destWord); + long32AtPointerput(idx7, destWord); /* This central horizontal loop requires no store masking */ @@ -1814,18 +1819,18 @@ static sqInt copyLoopNoSource(void) { for (word = 2; word <= (nWords - 1); word += 1) { /* begin dstLongAt:put: */ idx1 = destIndex; - long32Atput(idx1, destWord); + long32AtPointerput(idx1, destWord); destIndex += 4; } } else { for (word = 2; word <= (nWords - 1); word += 1) { /* begin dstLongAt: */ idx2 = destIndex; - destWord = long32At(idx2); + destWord = long32AtPointer(idx2); mergeWord = mergeFnwith(halftoneWord, destWord); /* begin dstLongAt:put: */ idx3 = destIndex; - long32Atput(idx3, mergeWord); + long32AtPointerput(idx3, mergeWord); destIndex += 4; } } @@ -1833,12 +1838,12 @@ static sqInt copyLoopNoSource(void) { destMask = mask2; /* begin dstLongAt: */ idx4 = destIndex; - destWord = long32At(idx4); + destWord = long32AtPointer(idx4); mergeWord = mergeFnwith(halftoneWord, destWord); destWord = (destMask & mergeWord) | (destWord & (~destMask)); /* begin dstLongAt:put: */ idx5 = destIndex; - long32Atput(idx5, destWord); + long32AtPointerput(idx5, destWord); destIndex += 4; } destIndex += destDelta; @@ -1939,7 +1944,7 @@ static sqInt copyLoopPixMap(void) { } else { /* begin halftoneAt: */ idx2 = (dy + i) - 1; - halftoneWord = long32At(halftoneBase + ((idx2 % halftoneHeight) * 4)); + halftoneWord = long32AtPointer(halftoneBase + ((idx2 % halftoneHeight) * 4)); } srcBitShift = srcShift; dstBitShift = dstShift; @@ -1953,7 +1958,7 @@ static sqInt copyLoopPixMap(void) { /* begin pickSourcePixels:flags:srcMask:destMask:srcShiftInc:dstShiftInc: */ /* begin srcLongAt: */ idx21 = sourceIndex; - sourceWord = long32At(idx21); + sourceWord = long32AtPointer(idx21); destWord1 = 0; srcShift1 = srcBitShift; dstShift1 = dstBitShift; @@ -1972,7 +1977,7 @@ static sqInt copyLoopPixMap(void) { } /* begin srcLongAt: */ idx4 = sourceIndex += 4; - sourceWord = long32At(idx4); + sourceWord = long32AtPointer(idx4); } } while(!((nPix1 -= 1) == 0)); } else { @@ -2006,7 +2011,7 @@ static sqInt copyLoopPixMap(void) { } /* begin srcLongAt: */ idx11 = sourceIndex += 4; - sourceWord = long32At(idx11); + sourceWord = long32AtPointer(idx11); } } while(!((nPix1 -= 1) == 0)); } @@ -2018,16 +2023,16 @@ static sqInt copyLoopPixMap(void) { /* begin dstLongAt:put: */ idx = destIndex; value = destMask & mergeWord; - long32Atput(idx, value); + long32AtPointerput(idx, value); } else { /* begin dstLongAt: */ idx3 = destIndex; - destWord = long32At(idx3); + destWord = long32AtPointer(idx3); mergeWord = mergeFnwith(skewWord & halftoneWord, destWord & destMask); destWord = (destMask & mergeWord) | (destWord & (~destMask)); /* begin dstLongAt:put: */ idx1 = destIndex; - long32Atput(idx1, destWord); + long32AtPointerput(idx1, destWord); } destIndex += 4; if (words == 2) { @@ -2061,38 +2066,38 @@ static sqInt copyLoopPixMap(void) { ]. */ static unsigned int * default8To32Table(void) { - static unsigned int theTable[256] = { -0x0, 0xFF000001, 0xFFFFFFFF, 0xFF808080, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFF00FFFF, -0xFFFFFF00, 0xFFFF00FF, 0xFF202020, 0xFF404040, 0xFF606060, 0xFF9F9F9F, 0xFFBFBFBF, 0xFFDFDFDF, -0xFF080808, 0xFF101010, 0xFF181818, 0xFF282828, 0xFF303030, 0xFF383838, 0xFF484848, 0xFF505050, -0xFF585858, 0xFF686868, 0xFF707070, 0xFF787878, 0xFF878787, 0xFF8F8F8F, 0xFF979797, 0xFFA7A7A7, -0xFFAFAFAF, 0xFFB7B7B7, 0xFFC7C7C7, 0xFFCFCFCF, 0xFFD7D7D7, 0xFFE7E7E7, 0xFFEFEFEF, 0xFFF7F7F7, -0xFF000001, 0xFF003300, 0xFF006600, 0xFF009900, 0xFF00CC00, 0xFF00FF00, 0xFF000033, 0xFF003333, -0xFF006633, 0xFF009933, 0xFF00CC33, 0xFF00FF33, 0xFF000066, 0xFF003366, 0xFF006666, 0xFF009966, -0xFF00CC66, 0xFF00FF66, 0xFF000099, 0xFF003399, 0xFF006699, 0xFF009999, 0xFF00CC99, 0xFF00FF99, -0xFF0000CC, 0xFF0033CC, 0xFF0066CC, 0xFF0099CC, 0xFF00CCCC, 0xFF00FFCC, 0xFF0000FF, 0xFF0033FF, -0xFF0066FF, 0xFF0099FF, 0xFF00CCFF, 0xFF00FFFF, 0xFF330000, 0xFF333300, 0xFF336600, 0xFF339900, -0xFF33CC00, 0xFF33FF00, 0xFF330033, 0xFF333333, 0xFF336633, 0xFF339933, 0xFF33CC33, 0xFF33FF33, -0xFF330066, 0xFF333366, 0xFF336666, 0xFF339966, 0xFF33CC66, 0xFF33FF66, 0xFF330099, 0xFF333399, -0xFF336699, 0xFF339999, 0xFF33CC99, 0xFF33FF99, 0xFF3300CC, 0xFF3333CC, 0xFF3366CC, 0xFF3399CC, -0xFF33CCCC, 0xFF33FFCC, 0xFF3300FF, 0xFF3333FF, 0xFF3366FF, 0xFF3399FF, 0xFF33CCFF, 0xFF33FFFF, -0xFF660000, 0xFF663300, 0xFF666600, 0xFF669900, 0xFF66CC00, 0xFF66FF00, 0xFF660033, 0xFF663333, -0xFF666633, 0xFF669933, 0xFF66CC33, 0xFF66FF33, 0xFF660066, 0xFF663366, 0xFF666666, 0xFF669966, -0xFF66CC66, 0xFF66FF66, 0xFF660099, 0xFF663399, 0xFF666699, 0xFF669999, 0xFF66CC99, 0xFF66FF99, -0xFF6600CC, 0xFF6633CC, 0xFF6666CC, 0xFF6699CC, 0xFF66CCCC, 0xFF66FFCC, 0xFF6600FF, 0xFF6633FF, -0xFF6666FF, 0xFF6699FF, 0xFF66CCFF, 0xFF66FFFF, 0xFF990000, 0xFF993300, 0xFF996600, 0xFF999900, -0xFF99CC00, 0xFF99FF00, 0xFF990033, 0xFF993333, 0xFF996633, 0xFF999933, 0xFF99CC33, 0xFF99FF33, -0xFF990066, 0xFF993366, 0xFF996666, 0xFF999966, 0xFF99CC66, 0xFF99FF66, 0xFF990099, 0xFF993399, -0xFF996699, 0xFF999999, 0xFF99CC99, 0xFF99FF99, 0xFF9900CC, 0xFF9933CC, 0xFF9966CC, 0xFF9999CC, -0xFF99CCCC, 0xFF99FFCC, 0xFF9900FF, 0xFF9933FF, 0xFF9966FF, 0xFF9999FF, 0xFF99CCFF, 0xFF99FFFF, -0xFFCC0000, 0xFFCC3300, 0xFFCC6600, 0xFFCC9900, 0xFFCCCC00, 0xFFCCFF00, 0xFFCC0033, 0xFFCC3333, -0xFFCC6633, 0xFFCC9933, 0xFFCCCC33, 0xFFCCFF33, 0xFFCC0066, 0xFFCC3366, 0xFFCC6666, 0xFFCC9966, -0xFFCCCC66, 0xFFCCFF66, 0xFFCC0099, 0xFFCC3399, 0xFFCC6699, 0xFFCC9999, 0xFFCCCC99, 0xFFCCFF99, -0xFFCC00CC, 0xFFCC33CC, 0xFFCC66CC, 0xFFCC99CC, 0xFFCCCCCC, 0xFFCCFFCC, 0xFFCC00FF, 0xFFCC33FF, -0xFFCC66FF, 0xFFCC99FF, 0xFFCCCCFF, 0xFFCCFFFF, 0xFFFF0000, 0xFFFF3300, 0xFFFF6600, 0xFFFF9900, -0xFFFFCC00, 0xFFFFFF00, 0xFFFF0033, 0xFFFF3333, 0xFFFF6633, 0xFFFF9933, 0xFFFFCC33, 0xFFFFFF33, -0xFFFF0066, 0xFFFF3366, 0xFFFF6666, 0xFFFF9966, 0xFFFFCC66, 0xFFFFFF66, 0xFFFF0099, 0xFFFF3399, -0xFFFF6699, 0xFFFF9999, 0xFFFFCC99, 0xFFFFFF99, 0xFFFF00CC, 0xFFFF33CC, 0xFFFF66CC, 0xFFFF99CC, + static unsigned int theTable[256] = { +0x0, 0xFF000001, 0xFFFFFFFF, 0xFF808080, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFF00FFFF, +0xFFFFFF00, 0xFFFF00FF, 0xFF202020, 0xFF404040, 0xFF606060, 0xFF9F9F9F, 0xFFBFBFBF, 0xFFDFDFDF, +0xFF080808, 0xFF101010, 0xFF181818, 0xFF282828, 0xFF303030, 0xFF383838, 0xFF484848, 0xFF505050, +0xFF585858, 0xFF686868, 0xFF707070, 0xFF787878, 0xFF878787, 0xFF8F8F8F, 0xFF979797, 0xFFA7A7A7, +0xFFAFAFAF, 0xFFB7B7B7, 0xFFC7C7C7, 0xFFCFCFCF, 0xFFD7D7D7, 0xFFE7E7E7, 0xFFEFEFEF, 0xFFF7F7F7, +0xFF000001, 0xFF003300, 0xFF006600, 0xFF009900, 0xFF00CC00, 0xFF00FF00, 0xFF000033, 0xFF003333, +0xFF006633, 0xFF009933, 0xFF00CC33, 0xFF00FF33, 0xFF000066, 0xFF003366, 0xFF006666, 0xFF009966, +0xFF00CC66, 0xFF00FF66, 0xFF000099, 0xFF003399, 0xFF006699, 0xFF009999, 0xFF00CC99, 0xFF00FF99, +0xFF0000CC, 0xFF0033CC, 0xFF0066CC, 0xFF0099CC, 0xFF00CCCC, 0xFF00FFCC, 0xFF0000FF, 0xFF0033FF, +0xFF0066FF, 0xFF0099FF, 0xFF00CCFF, 0xFF00FFFF, 0xFF330000, 0xFF333300, 0xFF336600, 0xFF339900, +0xFF33CC00, 0xFF33FF00, 0xFF330033, 0xFF333333, 0xFF336633, 0xFF339933, 0xFF33CC33, 0xFF33FF33, +0xFF330066, 0xFF333366, 0xFF336666, 0xFF339966, 0xFF33CC66, 0xFF33FF66, 0xFF330099, 0xFF333399, +0xFF336699, 0xFF339999, 0xFF33CC99, 0xFF33FF99, 0xFF3300CC, 0xFF3333CC, 0xFF3366CC, 0xFF3399CC, +0xFF33CCCC, 0xFF33FFCC, 0xFF3300FF, 0xFF3333FF, 0xFF3366FF, 0xFF3399FF, 0xFF33CCFF, 0xFF33FFFF, +0xFF660000, 0xFF663300, 0xFF666600, 0xFF669900, 0xFF66CC00, 0xFF66FF00, 0xFF660033, 0xFF663333, +0xFF666633, 0xFF669933, 0xFF66CC33, 0xFF66FF33, 0xFF660066, 0xFF663366, 0xFF666666, 0xFF669966, +0xFF66CC66, 0xFF66FF66, 0xFF660099, 0xFF663399, 0xFF666699, 0xFF669999, 0xFF66CC99, 0xFF66FF99, +0xFF6600CC, 0xFF6633CC, 0xFF6666CC, 0xFF6699CC, 0xFF66CCCC, 0xFF66FFCC, 0xFF6600FF, 0xFF6633FF, +0xFF6666FF, 0xFF6699FF, 0xFF66CCFF, 0xFF66FFFF, 0xFF990000, 0xFF993300, 0xFF996600, 0xFF999900, +0xFF99CC00, 0xFF99FF00, 0xFF990033, 0xFF993333, 0xFF996633, 0xFF999933, 0xFF99CC33, 0xFF99FF33, +0xFF990066, 0xFF993366, 0xFF996666, 0xFF999966, 0xFF99CC66, 0xFF99FF66, 0xFF990099, 0xFF993399, +0xFF996699, 0xFF999999, 0xFF99CC99, 0xFF99FF99, 0xFF9900CC, 0xFF9933CC, 0xFF9966CC, 0xFF9999CC, +0xFF99CCCC, 0xFF99FFCC, 0xFF9900FF, 0xFF9933FF, 0xFF9966FF, 0xFF9999FF, 0xFF99CCFF, 0xFF99FFFF, +0xFFCC0000, 0xFFCC3300, 0xFFCC6600, 0xFFCC9900, 0xFFCCCC00, 0xFFCCFF00, 0xFFCC0033, 0xFFCC3333, +0xFFCC6633, 0xFFCC9933, 0xFFCCCC33, 0xFFCCFF33, 0xFFCC0066, 0xFFCC3366, 0xFFCC6666, 0xFFCC9966, +0xFFCCCC66, 0xFFCCFF66, 0xFFCC0099, 0xFFCC3399, 0xFFCC6699, 0xFFCC9999, 0xFFCCCC99, 0xFFCCFF99, +0xFFCC00CC, 0xFFCC33CC, 0xFFCC66CC, 0xFFCC99CC, 0xFFCCCCCC, 0xFFCCFFCC, 0xFFCC00FF, 0xFFCC33FF, +0xFFCC66FF, 0xFFCC99FF, 0xFFCCCCFF, 0xFFCCFFFF, 0xFFFF0000, 0xFFFF3300, 0xFFFF6600, 0xFFFF9900, +0xFFFFCC00, 0xFFFFFF00, 0xFFFF0033, 0xFFFF3333, 0xFFFF6633, 0xFFFF9933, 0xFFFFCC33, 0xFFFFFF33, +0xFFFF0066, 0xFFFF3366, 0xFFFF6666, 0xFFFF9966, 0xFFFFCC66, 0xFFFFFF66, 0xFFFF0099, 0xFFFF3399, +0xFFFF6699, 0xFFFF9999, 0xFFFFCC99, 0xFFFFFF99, 0xFFFF00CC, 0xFFFF33CC, 0xFFFF66CC, 0xFFFF99CC, 0xFFFFCCCC, 0xFFFFFFCC, 0xFFFF00FF, 0xFFFF33FF, 0xFFFF66FF, 0xFFFF99FF, 0xFFFFCCFF, 0xFFFFFFFF};; return theTable; @@ -2290,11 +2295,11 @@ static sqInt drawLoopXY(sqInt xDelta, sqInt yDelta) { } static sqInt dstLongAt(sqInt idx) { - return long32At(idx); + return long32AtPointer(idx); } static sqInt dstLongAtput(sqInt idx, sqInt value) { - return long32Atput(idx, value); + return long32AtPointerput(idx, value); } @@ -2305,10 +2310,10 @@ static sqInt dstLongAtput(sqInt idx, sqInt value) { static sqInt dstLongAtputmask(sqInt idx, sqInt srcValue, sqInt dstMask) { sqInt dstValue; - dstValue = long32At(idx); + dstValue = long32AtPointer(idx); dstValue = dstValue & dstMask; dstValue = dstValue | srcValue; - long32Atput(idx, dstValue); + long32AtPointerput(idx, dstValue); } @@ -2354,7 +2359,7 @@ static sqInt fetchIntOrFloatofObject(sqInt fieldIndex, sqInt objectPointer) { double floatValue; sqInt fieldOop; - fieldOop = interpreterProxy->fetchPointerofObject(fieldIndex, objectPointer); + fieldOop = interpreterProxy->fetchPointerofObject(fieldIndex, objectPointer); // OK xxx_dmu if ((fieldOop & 1)) { return (fieldOop >> 1); } @@ -2373,7 +2378,7 @@ static sqInt fetchIntOrFloatofObjectifNil(sqInt fieldIndex, sqInt objectPointer, double floatValue; sqInt fieldOop; - fieldOop = interpreterProxy->fetchPointerofObject(fieldIndex, objectPointer); + fieldOop = interpreterProxy->fetchPointerofObject(fieldIndex, objectPointer); // OK xxx_dmu if ((fieldOop & 1)) { return (fieldOop >> 1); } @@ -2425,7 +2430,7 @@ EXPORT(const char*) getModuleName(void) { /* Return a value from the halftone pattern. */ static sqInt halftoneAt(sqInt idx) { - return long32At(halftoneBase + ((idx % halftoneHeight) * 4)); + return long32AtPointer(halftoneBase + ((idx % halftoneHeight) * 4)); } static sqInt halt(void) { @@ -2562,7 +2567,7 @@ static sqInt isIdentityMapwith(int * shifts, unsigned int * masks) { static sqInt loadBitBltDestForm(void) { sqInt destBitsSize; - destBits = interpreterProxy->fetchPointerofObject(FormBitsIndex, destForm); + destBitsOop_xxx_dmu = interpreterProxy->fetchPointerofObject(FormBitsIndex, destForm); // maybe xxx_dmu destWidth = interpreterProxy->fetchIntegerofObject(FormWidthIndex, destForm); destHeight = interpreterProxy->fetchIntegerofObject(FormHeightIndex, destForm); if (!((destWidth >= 0) && (destHeight >= 0))) { @@ -2573,8 +2578,8 @@ static sqInt loadBitBltDestForm(void) { if (destDepth < 0) { destDepth = 0 - destDepth; } - if ((destBits & 1)) { - if (!(queryDestSurface((destBits >> 1)))) { + if ((destBitsOop_xxx_dmu & 1)) { + if (!(queryDestSurface((destBitsOop_xxx_dmu >> 1)))) { return 0; } destPPW = 32 / destDepth; @@ -2582,11 +2587,12 @@ static sqInt loadBitBltDestForm(void) { } else { destPPW = 32 / destDepth; destPitch = ((destWidth + (destPPW - 1)) / destPPW) * 4; - destBitsSize = interpreterProxy->byteSizeOf(destBits); - if (!((interpreterProxy->isWordsOrBytes(destBits)) && (destBitsSize == (destPitch * destHeight)))) { + destBitsSize = interpreterProxy->byteSizeOf(destBitsOop_xxx_dmu); + if (!((interpreterProxy->isWordsOrBytes(destBitsOop_xxx_dmu)) && (destBitsSize == (destPitch * destHeight)))) { return 0; } - destBits = oopForPointer(interpreterProxy->firstIndexableField(destBits)); + // xxx_dmu destBits = oopForPointer(interpreterProxy->firstIndexableField(destBits)); + destBits = (sqInt) interpreterProxy->firstIndexableField(destBitsOop_xxx_dmu); } return 1; } @@ -2618,16 +2624,19 @@ static sqInt loadBitBltFromwarping(sqInt bbObj, sqInt aBool) { sqInt mapOop; sqInt mapOop1; + bitBltOop = bbObj; isWarping = aBool; combinationRule = interpreterProxy->fetchIntegerofObject(BBRuleIndex, bitBltOop); if ((interpreterProxy->failed()) || ((combinationRule < 0) || (combinationRule > (OpTableSize - 2)))) { + //fprintf(stderr, "failed 2629\n"); return 0; } if ((combinationRule >= 16) && (combinationRule <= 17)) { + //fprintf(stderr, "failed 2633\n"); return 0; } - sourceForm = interpreterProxy->fetchPointerofObject(BBSourceFormIndex, bitBltOop); + sourceForm = interpreterProxy->fetchPointerofObject(BBSourceFormIndex, bitBltOop); // maybe xxx_dmu /* begin ignoreSourceOrHalftone: */ formPointer = sourceForm; if (formPointer == (interpreterProxy->nilObject())) { @@ -2652,7 +2661,7 @@ static sqInt loadBitBltFromwarping(sqInt bbObj, sqInt aBool) { } noSource = 0; l2: /* end ignoreSourceOrHalftone: */; - halftoneForm = interpreterProxy->fetchPointerofObject(BBHalftoneFormIndex, bitBltOop); + halftoneForm = interpreterProxy->fetchPointerofObject(BBHalftoneFormIndex, bitBltOop); // maybe xxx_dmu /* begin ignoreSourceOrHalftone: */ formPointer1 = halftoneForm; if (formPointer1 == (interpreterProxy->nilObject())) { @@ -2677,16 +2686,18 @@ l2: /* end ignoreSourceOrHalftone: */; } noHalftone = 0; l3: /* end ignoreSourceOrHalftone: */; - destForm = interpreterProxy->fetchPointerofObject(BBDestFormIndex, bbObj); + destForm = interpreterProxy->fetchPointerofObject(BBDestFormIndex, bbObj); // maybe xxx_dmu if (!((interpreterProxy->isPointers(destForm)) && ((interpreterProxy->slotSizeOf(destForm)) >= 4))) { + //fprintf(stderr, "failed 2688\n"); return 0; } /* begin loadBitBltDestForm */ - destBits = interpreterProxy->fetchPointerofObject(FormBitsIndex, destForm); + destBitsOop_xxx_dmu = interpreterProxy->fetchPointerofObject(FormBitsIndex, destForm); // maybe xxx_dmu destWidth = interpreterProxy->fetchIntegerofObject(FormWidthIndex, destForm); destHeight = interpreterProxy->fetchIntegerofObject(FormHeightIndex, destForm); if (!((destWidth >= 0) && (destHeight >= 0))) { ok = 0; + //fprintf(stderr, "failed 2697\n"); goto l4; } destDepth = interpreterProxy->fetchIntegerofObject(FormDepthIndex, destForm); @@ -2694,9 +2705,10 @@ l3: /* end ignoreSourceOrHalftone: */; if (destDepth < 0) { destDepth = 0 - destDepth; } - if ((destBits & 1)) { - if (!(queryDestSurface((destBits >> 1)))) { + if ((destBitsOop_xxx_dmu & 1)) { + if (!(queryDestSurface((destBitsOop_xxx_dmu >> 1)))) { ok = 0; + //fprintf(stderr, "failed 2708\n"); goto l4; } destPPW = 32 / destDepth; @@ -2704,16 +2716,19 @@ l3: /* end ignoreSourceOrHalftone: */; } else { destPPW = 32 / destDepth; destPitch = ((destWidth + (destPPW - 1)) / destPPW) * 4; - destBitsSize = interpreterProxy->byteSizeOf(destBits); - if (!((interpreterProxy->isWordsOrBytes(destBits)) && (destBitsSize == (destPitch * destHeight)))) { + destBitsSize = interpreterProxy->byteSizeOf(destBitsOop_xxx_dmu); + if (!((interpreterProxy->isWordsOrBytes(destBitsOop_xxx_dmu)) && (destBitsSize == (destPitch * destHeight)))) { ok = 0; + //fprintf(stderr, "failed 2719\n"); goto l4; } - destBits = oopForPointer(interpreterProxy->firstIndexableField(destBits)); + // xxx_dmu destBits = oopForPointer(interpreterProxy->firstIndexableField(destBits)); + destBits = (sqInt) interpreterProxy->firstIndexableField(destBitsOop_xxx_dmu); } ok = 1; l4: /* end loadBitBltDestForm */; if (!(ok)) { + //fprintf(stderr, "failed 2725\n"); return 0; } destX = fetchIntOrFloatofObjectifNil(BBDestXIndex, bitBltOop, 0); @@ -2721,29 +2736,33 @@ l4: /* end loadBitBltDestForm */; width = fetchIntOrFloatofObjectifNil(BBWidthIndex, bitBltOop, destWidth); height = fetchIntOrFloatofObjectifNil(BBHeightIndex, bitBltOop, destHeight); if (interpreterProxy->failed()) { + //fprintf(stderr, "failed 2733\n"); return 0; } if (noSource) { sourceX = sourceY = 0; } else { if (!((interpreterProxy->isPointers(sourceForm)) && ((interpreterProxy->slotSizeOf(sourceForm)) >= 4))) { + //fprintf(stderr, "failed 2740\n"); return 0; } /* begin loadBitBltSourceForm */ - sourceBits = interpreterProxy->fetchPointerofObject(FormBitsIndex, sourceForm); + sourceBitsOop_xxx_dmu = interpreterProxy->fetchPointerofObject(FormBitsIndex, sourceForm); // maybe xxx_dmu sourceWidth = fetchIntOrFloatofObject(FormWidthIndex, sourceForm); sourceHeight = fetchIntOrFloatofObject(FormHeightIndex, sourceForm); if (!((sourceWidth >= 0) && (sourceHeight >= 0))) { ok = 0; - goto l1; + //fprintf(stderr, "failed 2753\n"); + goto l1; } sourceDepth = interpreterProxy->fetchIntegerofObject(FormDepthIndex, sourceForm); sourceMSB = sourceDepth > 0; if (sourceDepth < 0) { sourceDepth = 0 - sourceDepth; } - if ((sourceBits & 1)) { - if (!(querySourceSurface((sourceBits >> 1)))) { + if ((sourceBitsOop_xxx_dmu & 1)) { + if (!(querySourceSurface((sourceBitsOop_xxx_dmu >> 1)))) { + //fprintf(stderr, "failed 2762\n"); ok = 0; goto l1; } @@ -2752,16 +2771,25 @@ l4: /* end loadBitBltDestForm */; } else { sourcePPW = 32 / sourceDepth; sourcePitch = ((sourceWidth + (sourcePPW - 1)) / sourcePPW) * 4; - sourceBitsSize = interpreterProxy->byteSizeOf(sourceBits); - if (!((interpreterProxy->isWordsOrBytes(sourceBits)) && (sourceBitsSize == (sourcePitch * sourceHeight)))) { + sourceBitsSize = interpreterProxy->byteSizeOf(sourceBitsOop_xxx_dmu); + if (!((interpreterProxy->isWordsOrBytes(sourceBitsOop_xxx_dmu)) && (sourceBitsSize == (sourcePitch * sourceHeight)))) { + //fprintf(stderr, "failed 2773\n"); + //fprintf(stderr, "sourceBitsSize %d, sourcePitch %d, source Height %d\n", sourceBitsSize, sourcePitch, sourceHeight); + //fprintf(stderr, "sourceBitsOop_xxx_dmu 0x%x\n", sourceBitsOop_xxx_dmu); ok = 0; goto l1; } - sourceBits = oopForPointer(interpreterProxy->firstIndexableField(sourceBits)); + //fprintf(stderr, "success 2784\n"); + //fprintf(stderr, "sourceBitsSize %d, sourcePitch %d, source Height %d\n", sourceBitsSize, sourcePitch, sourceHeight); + //fprintf(stderr, "sourceBitsOop_xxx_dmu 0x%x\n", sourceBitsOop_xxx_dmu); + + // xxx_dmu sourceBits = oopForPointer(interpreterProxy->firstIndexableField(sourceBits)); + sourceBits = (sqInt)(interpreterProxy->firstIndexableField(sourceBitsOop_xxx_dmu)); } ok = 1; l1: /* end loadBitBltSourceForm */; if (!(ok)) { + //fprintf(stderr, "failed 2777\n"); return 0; } /* begin loadColorMap */ @@ -2769,7 +2797,7 @@ l4: /* end loadBitBltDestForm */; cmShiftTable = null; cmMaskTable = null; cmLookupTable = null; - cmOop = interpreterProxy->fetchPointerofObject(BBColorMapIndex, bitBltOop); + cmOop = interpreterProxy->fetchPointerofObject(BBColorMapIndex, bitBltOop); // OK xxx_dmu if (cmOop == (interpreterProxy->nilObject())) { ok = 1; goto l8; @@ -2783,10 +2811,11 @@ l4: /* end loadBitBltDestForm */; } else { if (!((interpreterProxy->isPointers(cmOop)) && ((interpreterProxy->slotSizeOf(cmOop)) >= 3))) { ok = 0; + //fprintf(stderr, "failed 2806\n"); goto l8; } /* begin loadColorMapShiftOrMaskFrom: */ - mapOop = interpreterProxy->fetchPointerofObject(0, cmOop); + mapOop = interpreterProxy->fetchPointerofObject(0, cmOop); // OK xxx_dmu if (mapOop == (interpreterProxy->nilObject())) { cmShiftTable = null; goto l6; @@ -2804,7 +2833,7 @@ l4: /* end loadBitBltDestForm */; cmShiftTable = interpreterProxy->firstIndexableField(mapOop); l6: /* end loadColorMapShiftOrMaskFrom: */; /* begin loadColorMapShiftOrMaskFrom: */ - mapOop1 = interpreterProxy->fetchPointerofObject(1, cmOop); + mapOop1 = interpreterProxy->fetchPointerofObject(1, cmOop); // OK xxx_dmu if (mapOop1 == (interpreterProxy->nilObject())) { cmMaskTable = null; goto l7; @@ -2821,11 +2850,12 @@ l4: /* end loadBitBltDestForm */; } cmMaskTable = interpreterProxy->firstIndexableField(mapOop1); l7: /* end loadColorMapShiftOrMaskFrom: */; - oop = interpreterProxy->fetchPointerofObject(2, cmOop); + oop = interpreterProxy->fetchPointerofObject(2, cmOop); // maybe xxx_dmu if (oop == (interpreterProxy->nilObject())) { cmSize = 0; } else { if (!(interpreterProxy->isWords(oop))) { + //fprintf(stderr, "failed 2849\n"); ok = 0; goto l8; } @@ -2835,6 +2865,7 @@ l4: /* end loadBitBltDestForm */; cmFlags = cmFlags | ColorMapNewStyle; } if (!((cmSize & (cmSize - 1)) == 0)) { + //fprintf(stderr, "failed 2859\n"); ok = 0; goto l8; } @@ -2867,6 +2898,7 @@ l4: /* end loadBitBltDestForm */; ok = 1; l8: /* end loadColorMap */; if (!(ok)) { + //fprintf(stderr, "failed 2883\n"); return 0; } if ((cmFlags & ColorMapNewStyle) == 0) { @@ -2889,16 +2921,19 @@ l4: /* end loadBitBltDestForm */; } } else { if (!((!(interpreterProxy->isPointers(halftoneForm))) && (interpreterProxy->isWords(halftoneForm)))) { + //fprintf(stderr, "failed 2906\n"); ok = 0; goto l5; } halftoneBits = halftoneForm; halftoneHeight = interpreterProxy->slotSizeOf(halftoneBits); } - halftoneBase = oopForPointer(interpreterProxy->firstIndexableField(halftoneBits)); + // xxx_dmu halftoneBase = oopForPointer(interpreterProxy->firstIndexableField(halftoneBits)); + halftoneBase = (sqInt)(interpreterProxy->firstIndexableField(halftoneBits)); ok = 1; l5: /* end loadHalftoneForm */; if (!(ok)) { + //fprintf(stderr, "failed 2918\n"); return 0; } clipX = fetchIntOrFloatofObjectifNil(BBClipXIndex, bitBltOop, 0); @@ -2906,6 +2941,7 @@ l5: /* end loadHalftoneForm */; clipWidth = fetchIntOrFloatofObjectifNil(BBClipWidthIndex, bitBltOop, destWidth); clipHeight = fetchIntOrFloatofObjectifNil(BBClipHeightIndex, bitBltOop, destHeight); if (interpreterProxy->failed()) { + //fprintf(stderr, "failed 2926\n"); return 0; } if (clipX < 0) { @@ -2931,7 +2967,7 @@ l5: /* end loadHalftoneForm */; static sqInt loadBitBltSourceForm(void) { sqInt sourceBitsSize; - sourceBits = interpreterProxy->fetchPointerofObject(FormBitsIndex, sourceForm); + sourceBitsOop_xxx_dmu = interpreterProxy->fetchPointerofObject(FormBitsIndex, sourceForm); // maybe xxx_dmu sourceWidth = fetchIntOrFloatofObject(FormWidthIndex, sourceForm); sourceHeight = fetchIntOrFloatofObject(FormHeightIndex, sourceForm); if (!((sourceWidth >= 0) && (sourceHeight >= 0))) { @@ -2942,8 +2978,8 @@ static sqInt loadBitBltSourceForm(void) { if (sourceDepth < 0) { sourceDepth = 0 - sourceDepth; } - if ((sourceBits & 1)) { - if (!(querySourceSurface((sourceBits >> 1)))) { + if ((sourceBitsOop_xxx_dmu & 1)) { + if (!(querySourceSurface((sourceBitsOop_xxx_dmu >> 1)))) { return 0; } sourcePPW = 32 / sourceDepth; @@ -2951,18 +2987,19 @@ static sqInt loadBitBltSourceForm(void) { } else { sourcePPW = 32 / sourceDepth; sourcePitch = ((sourceWidth + (sourcePPW - 1)) / sourcePPW) * 4; - sourceBitsSize = interpreterProxy->byteSizeOf(sourceBits); - if (!((interpreterProxy->isWordsOrBytes(sourceBits)) && (sourceBitsSize == (sourcePitch * sourceHeight)))) { + sourceBitsSize = interpreterProxy->byteSizeOf(sourceBitsOop_xxx_dmu); + if (!((interpreterProxy->isWordsOrBytes(sourceBitsOop_xxx_dmu)) && (sourceBitsSize == (sourcePitch * sourceHeight)))) { return 0; } - sourceBits = oopForPointer(interpreterProxy->firstIndexableField(sourceBits)); + // xxx_dmu sourceBits = oopForPointer(interpreterProxy->firstIndexableField(sourceBits)); + sourceBits = (sqInt)(interpreterProxy->firstIndexableField(sourceBitsOop_xxx_dmu)); } return 1; } -/* ColorMap, if not nil, must be longWords, and - 2^N long, where N = sourceDepth for 1, 2, 4, 8 bits, +/* ColorMap, if not nil, must be longWords, and + 2^N long, where N = sourceDepth for 1, 2, 4, 8 bits, or N = 9, 12, or 15 (3, 4, 5 bits per color) for 16 or 32 bits. */ static sqInt loadColorMap(void) { @@ -2977,7 +3014,7 @@ static sqInt loadColorMap(void) { cmShiftTable = null; cmMaskTable = null; cmLookupTable = null; - cmOop = interpreterProxy->fetchPointerofObject(BBColorMapIndex, bitBltOop); + cmOop = interpreterProxy->fetchPointerofObject(BBColorMapIndex, bitBltOop); // OK xxx_dmu if (cmOop == (interpreterProxy->nilObject())) { return 1; } @@ -2995,7 +3032,7 @@ static sqInt loadColorMap(void) { return 0; } /* begin loadColorMapShiftOrMaskFrom: */ - mapOop = interpreterProxy->fetchPointerofObject(0, cmOop); + mapOop = interpreterProxy->fetchPointerofObject(0, cmOop); // OK xxx_dmu if (mapOop == (interpreterProxy->nilObject())) { cmShiftTable = null; goto l1; @@ -3013,7 +3050,7 @@ static sqInt loadColorMap(void) { cmShiftTable = interpreterProxy->firstIndexableField(mapOop); l1: /* end loadColorMapShiftOrMaskFrom: */; /* begin loadColorMapShiftOrMaskFrom: */ - mapOop1 = interpreterProxy->fetchPointerofObject(1, cmOop); + mapOop1 = interpreterProxy->fetchPointerofObject(1, cmOop); // maybe xxx_dmu if (mapOop1 == (interpreterProxy->nilObject())) { cmMaskTable = null; goto l2; @@ -3030,7 +3067,7 @@ static sqInt loadColorMap(void) { } cmMaskTable = interpreterProxy->firstIndexableField(mapOop1); l2: /* end loadColorMapShiftOrMaskFrom: */; - oop = interpreterProxy->fetchPointerofObject(2, cmOop); + oop = interpreterProxy->fetchPointerofObject(2, cmOop); // OK xxx_dmu if (oop == (interpreterProxy->nilObject())) { cmSize = 0; } else { @@ -3112,7 +3149,8 @@ static sqInt loadHalftoneForm(void) { halftoneBits = halftoneForm; halftoneHeight = interpreterProxy->slotSizeOf(halftoneBits); } - halftoneBase = oopForPointer(interpreterProxy->firstIndexableField(halftoneBits)); + // xxx_dmu halftoneBase = oopForPointer(interpreterProxy->firstIndexableField(halftoneBits)); + halftoneBase = (sqInt)(interpreterProxy->firstIndexableField(halftoneBits)); return 1; } @@ -3132,13 +3170,13 @@ static sqInt loadWarpBltFrom(sqInt bbObj) { /* Get a pointer to the bits of any OS surfaces. */ -/* Notes: +/* Notes: * For equal source/dest handles only one locking operation is performed. This is to prevent locking of overlapping areas which does not work with - certain APIs (as an example, DirectDraw prevents locking of overlapping areas). - A special case for non-overlapping but equal source/dest handle would - be possible but we would have to transfer this information over to - unlockSurfaces somehow (currently, only one unlock operation is + certain APIs (as an example, DirectDraw prevents locking of overlapping areas). + A special case for non-overlapping but equal source/dest handle would + be possible but we would have to transfer this information over to + unlockSurfaces somehow (currently, only one unlock operation is performed for equal source and dest handles). Also, this would require a change in the notion of ioLockSurface() which is right now interpreted as a hint and not as a requirement to lock only the specific portion of @@ -3197,6 +3235,7 @@ static sqInt lockSurfaces(void) { sourceBits = fn(sourceHandle, &sourcePitch, 0,0, sourceWidth, sourceHeight); } destBits = sourceBits; + destBitsOop_xxx_dmu = sourceBitsOop_xxx_dmu; destPitch = sourcePitch; hasSurfaceLock = 1; return destBits != 0; @@ -3557,7 +3596,7 @@ static sqInt pickSourcePixelsflagssrcMaskdestMasksrcShiftIncdstShiftInc(sqInt nP /* begin srcLongAt: */ idx2 = sourceIndex; - sourceWord = long32At(idx2); + sourceWord = long32AtPointer(idx2); destWord = 0; /* Hint: Keep in register */ @@ -3591,7 +3630,7 @@ static sqInt pickSourcePixelsflagssrcMaskdestMasksrcShiftIncdstShiftInc(sqInt nP } /* begin srcLongAt: */ idx = sourceIndex += 4; - sourceWord = long32At(idx); + sourceWord = long32AtPointer(idx); } } while(!((nPix -= 1) == 0)); } else { @@ -3631,7 +3670,7 @@ static sqInt pickSourcePixelsflagssrcMaskdestMasksrcShiftIncdstShiftInc(sqInt nP } /* begin srcLongAt: */ idx1 = sourceIndex += 4; - sourceWord = long32At(idx1); + sourceWord = long32AtPointer(idx1); } } while(!((nPix -= 1) == 0)); } @@ -3661,7 +3700,7 @@ static sqInt pickWarpPixelAtXy(sqInt xx, sqInt yy) { /* Extract pixel from word */ - sourceWord = long32At(srcIndex); + sourceWord = long32AtPointer(srcIndex); srcBitShift = warpBitShiftTable[x & warpAlignMask]; sourcePix = (((usqInt) sourceWord) >> srcBitShift) & warpSrcMask; return sourcePix; @@ -3810,18 +3849,22 @@ EXPORT(sqInt) primitiveDisplayString(void) { sqInt startBits; if (!((interpreterProxy->methodArgumentCount()) == 6)) { + //fprintf(stderr, "failed arg count\n"); return interpreterProxy->primitiveFail(); } kernDelta = interpreterProxy->stackIntegerValue(0); xTable = interpreterProxy->stackObjectValue(1); glyphMap = interpreterProxy->stackObjectValue(2); if (!(((interpreterProxy->fetchClassOf(xTable)) == (interpreterProxy->classArray())) && ((interpreterProxy->fetchClassOf(glyphMap)) == (interpreterProxy->classArray())))) { + //fprintf(stderr, "failed 3831\n"); return interpreterProxy->primitiveFail(); } if (!((interpreterProxy->slotSizeOf(glyphMap)) == 256)) { + //fprintf(stderr, "failed 3834\n"); return interpreterProxy->primitiveFail(); } if (interpreterProxy->failed()) { + //fprintf(stderr, "failed 3838\n"); return null; } maxGlyph = (interpreterProxy->slotSizeOf(xTable)) - 2; @@ -3829,16 +3872,20 @@ EXPORT(sqInt) primitiveDisplayString(void) { startIndex = interpreterProxy->stackIntegerValue(4); sourceString = interpreterProxy->stackObjectValue(5); if (!(interpreterProxy->isBytes(sourceString))) { + //fprintf(stderr, "failed 3846\n"); return interpreterProxy->primitiveFail(); } if (!((startIndex > 0) && ((stopIndex > 0) && (stopIndex <= (interpreterProxy->byteSizeOf(sourceString)))))) { + //fprintf(stderr, "failed 3850\n"); return interpreterProxy->primitiveFail(); } bbObj = interpreterProxy->stackObjectValue(6); if (!(loadBitBltFromwarping(bbObj, 0))) { + //fprintf(stderr, "failed 3855\n"); return interpreterProxy->primitiveFail(); } if ((combinationRule == 30) || (combinationRule == 31)) { + //fprintf(stderr, "failed 3859\n"); return interpreterProxy->primitiveFail(); } quickBlt = (destBits != 0) && ((sourceBits != 0) && ((noSource == 0) && ((sourceForm != destForm) && ((cmFlags != 0) || ((sourceMSB != destMSB) || (sourceDepth != destDepth)))))); @@ -3848,11 +3895,13 @@ EXPORT(sqInt) primitiveDisplayString(void) { ascii = byteAtPointer((sourcePtr + charIndex) - 1); glyphIndex = interpreterProxy->fetchIntegerofObject(ascii, glyphMap); if ((glyphIndex < 0) || (glyphIndex > maxGlyph)) { + //fprintf(stderr, "failed 3869\n"); return interpreterProxy->primitiveFail(); } sourceX = interpreterProxy->fetchIntegerofObject(glyphIndex, xTable); width = (interpreterProxy->fetchIntegerofObject(glyphIndex + 1, xTable)) - sourceX; if (interpreterProxy->failed()) { + //fprintf(stderr, "failed 3875\n"); return null; } clipRange(); @@ -3892,6 +3941,7 @@ EXPORT(sqInt) primitiveDisplayString(void) { } } if (interpreterProxy->failed()) { + //fprintf(stderr, "failed 3915\n"); return null; } destX = (destX + width) + kernDelta; @@ -4547,7 +4597,7 @@ static sqInt sourceWordwith(sqInt sourceWord, sqInt destinationWord) { } static sqInt srcLongAt(sqInt idx) { - return long32At(idx); + return long32AtPointer(idx); } static sqInt subWordwith(sqInt sourceWord, sqInt destinationWord) { @@ -4563,8 +4613,8 @@ static sqInt tableLookupat(unsigned int * table, sqInt index) { /* Tally pixels into the color map. Those tallied are exactly those - in the destination rectangle. Note that the source should be - specified == destination, in order for the proper color map checks + in the destination rectangle. Note that the source should be + specified == destination, in order for the proper color map checks to be performed at setup. */ static sqInt tallyIntoMapwith(sqInt sourceWord, sqInt destinationWord) { @@ -4707,7 +4757,7 @@ static sqInt tallyMapAtput(sqInt idx, sqInt value) { /* Shortcut for stuff that's being run from the balloon engine. - Since we do this at each scan line we should avoid the expensive + Since we do this at each scan line we should avoid the expensive setup for source and destination. */ static sqInt tryCopyingBitsQuickly(void) { @@ -4763,7 +4813,7 @@ static sqInt unlockSurfaces(void) { } fn = ((sqInt (*)(sqInt, sqInt, sqInt, sqInt, sqInt)) unlockSurfaceFn); destLocked = 0; - destHandle = interpreterProxy->fetchPointerofObject(FormBitsIndex, destForm); + destHandle = interpreterProxy->fetchPointerofObject(FormBitsIndex, destForm); // maybe xxx_dmu if ((destHandle & 1)) { /* The destBits are always assumed to be dirty */ @@ -4774,7 +4824,7 @@ static sqInt unlockSurfaces(void) { destLocked = 1; } if (!(noSource)) { - sourceHandle = interpreterProxy->fetchPointerofObject(FormBitsIndex, sourceForm); + sourceHandle = interpreterProxy->fetchPointerofObject(FormBitsIndex, sourceForm); // maybe xxx_dmu if ((sourceHandle & 1)) { /* Only unlock sourceHandle if different from destHandle */ @@ -4870,6 +4920,7 @@ static sqInt warpLoop(void) { sqInt mergeWord; sqInt pBx; sqInt sourceMapOop; + sqInt sourceMapIndex_xxx_dmu; sqInt nSteps; sqInt halftoneWord; sqInt pAy; @@ -5002,11 +5053,13 @@ l6: /* end deltaFrom:to:nSteps: */; if ((interpreterProxy->slotSizeOf(sourceMapOop)) < (1 << sourceDepth)) { return interpreterProxy->primitiveFail(); } - sourceMapOop = oopForPointer(interpreterProxy->firstIndexableField(sourceMapOop)); + // xxx_dmu sourceMapOop = oopForPointer(interpreterProxy->firstIndexableField(sourceMapOop)); + sourceMapIndex_xxx_dmu = (sqInt)(interpreterProxy->firstIndexableField(sourceMapOop)); } } else { smoothingCount = 1; sourceMapOop = interpreterProxy->nilObject(); + sourceMapIndex_xxx_dmu = 0; } nSteps = width - 1; if (nSteps <= 0) { @@ -5108,7 +5161,7 @@ l6: /* end deltaFrom:to:nSteps: */; } else { /* begin halftoneAt: */ idx = (dy + i) - 1; - halftoneWord = long32At(halftoneBase + ((idx % halftoneHeight) * 4)); + halftoneWord = long32AtPointer(halftoneBase + ((idx % halftoneHeight) * 4)); } destMask = mask1; @@ -5132,7 +5185,7 @@ l6: /* end deltaFrom:to:nSteps: */; goto l7; } srcIndex = (sourceBits + (y * sourcePitch)) + ((((usqInt) x) >> warpAlignShift) * 4); - sourceWord = long32At(srcIndex); + sourceWord = long32AtPointer(srcIndex); srcBitShift = warpBitShiftTable[x & warpAlignMask]; sourcePix1 = (((usqInt) sourceWord) >> srcBitShift) & warpSrcMask; sourcePix = sourcePix1; @@ -5153,7 +5206,7 @@ l6: /* end deltaFrom:to:nSteps: */; goto l8; } srcIndex1 = (sourceBits + (y1 * sourcePitch)) + ((((usqInt) x1) >> warpAlignShift) * 4); - sourceWord1 = long32At(srcIndex1); + sourceWord1 = long32AtPointer(srcIndex1); srcBitShift = warpBitShiftTable[x1 & warpAlignMask]; sourcePix2 = (((usqInt) sourceWord1) >> srcBitShift) & warpSrcMask; sourcePix = sourcePix2; @@ -5184,7 +5237,7 @@ l6: /* end deltaFrom:to:nSteps: */; } skewWord = destWord1; } else { - skewWord = warpPickSmoothPixelsxDeltahyDeltahxDeltavyDeltavsourceMapsmoothingdstShiftInc(nPix, xDelta, yDelta, deltaP12x, deltaP12y, sourceMapOop, smoothingCount, dstShiftInc); + skewWord = warpPickSmoothPixelsxDeltahyDeltahxDeltavyDeltavsourceMapsmoothingdstShiftInc(nPix, xDelta, yDelta, deltaP12x, deltaP12y, sourceMapIndex_xxx_dmu, smoothingCount, dstShiftInc); } dstBitShift = dstShiftLeft; if (destMask == AllOnes) { @@ -5192,16 +5245,16 @@ l6: /* end deltaFrom:to:nSteps: */; /* begin dstLongAt:put: */ idx1 = destIndex; value = destMask & mergeWord; - long32Atput(idx1, value); + long32AtPointerput(idx1, value); } else { /* begin dstLongAt: */ idx2 = destIndex; - destWord = long32At(idx2); + destWord = long32AtPointer(idx2); mergeWord = mergeFnwith(skewWord & halftoneWord, destWord & destMask); destWord = (destMask & mergeWord) | (destWord & (~destMask)); /* begin dstLongAt:put: */ idx3 = destIndex; - long32Atput(idx3, destWord); + long32AtPointerput(idx3, destWord); } destIndex += 4; if (words == 2) { @@ -5328,7 +5381,7 @@ static sqInt warpPickSmoothPixelsxDeltahyDeltahxDeltavyDeltavsourceMapsmoothingd goto l1; } srcIndex = (sourceBits + (y1 * sourcePitch)) + ((((usqInt) x1) >> warpAlignShift) * 4); - sourceWord = long32At(srcIndex); + sourceWord = long32AtPointer(srcIndex); srcBitShift = warpBitShiftTable[x1 & warpAlignMask]; sourcePix = (((usqInt) sourceWord) >> srcBitShift) & warpSrcMask; rgb = sourcePix; @@ -5336,7 +5389,7 @@ static sqInt warpPickSmoothPixelsxDeltahyDeltahxDeltavyDeltavsourceMapsmoothingd if (!((combinationRule == 25) && (rgb == 0))) { nPix += 1; if (sourceDepth < 16) { - rgb = long32At(sourceMap + (rgb << 2)); + rgb = long32AtPointer(sourceMap + (rgb << 2)); } else { if (sourceDepth == 16) { rgb = (((rgb & 31) << 3) | ((rgb & 992) << 6)) | ((rgb & 31744) << 9); @@ -5449,7 +5502,7 @@ static sqInt warpPickSourcePixelsxDeltahyDeltahxDeltavyDeltavdstShiftIncflags(sq goto l1; } srcIndex = (sourceBits + (y * sourcePitch)) + ((((usqInt) x) >> warpAlignShift) * 4); - sourceWord = long32At(srcIndex); + sourceWord = long32AtPointer(srcIndex); srcBitShift = warpBitShiftTable[x & warpAlignMask]; sourcePix1 = (((usqInt) sourceWord) >> srcBitShift) & warpSrcMask; sourcePix = sourcePix1; @@ -5470,7 +5523,7 @@ static sqInt warpPickSourcePixelsxDeltahyDeltahxDeltavyDeltavdstShiftIncflags(sq goto l2; } srcIndex1 = (sourceBits + (y1 * sourcePitch)) + ((((usqInt) x1) >> warpAlignShift) * 4); - sourceWord1 = long32At(srcIndex1); + sourceWord1 = long32AtPointer(srcIndex1); srcBitShift = warpBitShiftTable[x1 & warpAlignMask]; sourcePix2 = (((usqInt) sourceWord1) >> srcBitShift) & warpSrcMask; sourcePix = sourcePix2; diff --git a/vm/src/from_squeak/intplugins/LargeIntegers/LargeIntegers.c b/vm/src/from_squeak/intplugins/LargeIntegers/LargeIntegers.c index 2d3f4ba..b3777a2 100644 --- a/vm/src/from_squeak/intplugins/LargeIntegers/LargeIntegers.c +++ b/vm/src/from_squeak/intplugins/LargeIntegers/LargeIntegers.c @@ -264,7 +264,7 @@ static sqInt bytesLshift(sqInt aBytesOop, sqInt shiftCount) { /* Attention: this method invalidates all oop's! Only newBytes is valid at return. */ -/* Shift right 8*b+anInteger bits, 0<=n<8. +/* Shift right 8*b+anInteger bits, 0<=n<8. Discard all digits beyond a, and all zeroes at or below a. */ /* Does not normalize. */ @@ -420,9 +420,9 @@ static int cBytesCopyFromtolen(unsigned char * pFrom, unsigned char * pTo, sqI } -/* Answer the index (in bits) of the high order bit of the receiver, or zero if the - receiver is zero. This method is allowed (and needed) for - LargeNegativeIntegers as well, since Squeak's LargeIntegers are +/* Answer the index (in bits) of the high order bit of the receiver, or zero if the + receiver is zero. This method is allowed (and needed) for + LargeNegativeIntegers as well, since Squeak's LargeIntegers are sign/magnitude. */ static sqInt cBytesHighBitlen(unsigned char * pByte, sqInt len) { @@ -575,7 +575,7 @@ static sqInt cCoreDigitDivDivlenremlenquolen(unsigned char * pDiv, sqInt divLen mul = q * dnh; hi = ((usqInt) mul >> 8); - /* Correct overestimate of q. + /* Correct overestimate of q. Max of 2 iterations through loop -- see Knuth vol. 2 */ lo = mul & 255; @@ -672,7 +672,7 @@ static sqInt cDigitComparewithlen(unsigned char * pFirst, unsigned char * pSec } -/* Answer the number of indexable fields of a CSmallInteger. This value is +/* Answer the number of indexable fields of a CSmallInteger. This value is the same as the largest legal subscript. */ static sqInt cDigitLengthOfCSI(sqInt csi) { @@ -727,8 +727,8 @@ static unsigned char cDigitMultiplylenwithleninto(unsigned char * pByteShort, s } -/* Answer the value of an indexable field in the receiver. - LargePositiveInteger uses bytes of base two number, and each is a +/* Answer the value of an indexable field in the receiver. + LargePositiveInteger uses bytes of base two number, and each is a 'digit' base 256. */ /* ST indexed! */ @@ -771,7 +771,7 @@ static sqInt cDigitSublenwithleninto(unsigned char * pByteSmall, sqInt smallLen } -/* Answer the index of the high order bit of the argument, or zero if the +/* Answer the index of the high order bit of the argument, or zero if the argument is zero. */ /* For 64 bit uints there could be added a 32-shift. */ @@ -960,7 +960,7 @@ static sqInt digitBitLogicwithopIndex(sqInt firstInteger, sqInt secondInteger, s } -/* Compare the magnitude of firstInteger with that of secondInteger. +/* Compare the magnitude of firstInteger with that of secondInteger. Return a code of 1, 0, -1 for firstInteger >, = , < secondInteger */ static sqInt digitCompareLargewith(sqInt firstInteger, sqInt secondInteger) { @@ -1431,9 +1431,9 @@ EXPORT(sqInt) primAnyBitFromTo(void) { } -/* Converts a SmallInteger into a - non normalized! - LargeInteger; +/* Converts a SmallInteger into a - non normalized! - LargeInteger; aLargeInteger will be returned unchanged. */ -/* Do not check for forced fail, because we need this conversion to test the +/* Do not check for forced fail, because we need this conversion to test the plugin in ST during forced fail, too. */ EXPORT(sqInt) primAsLargeInteger(void) { @@ -1551,7 +1551,7 @@ EXPORT(sqInt) primDigitAddWith(void) { } -/* Bit logic here is only implemented for positive integers or Zero; if rec +/* Bit logic here is only implemented for positive integers or Zero; if rec or arg is negative, it fails. */ EXPORT(sqInt) primDigitBitAnd(void) { @@ -1602,7 +1602,7 @@ EXPORT(sqInt) primDigitBitLogicWithOp(void) { } -/* Bit logic here is only implemented for positive integers or Zero; if rec +/* Bit logic here is only implemented for positive integers or Zero; if rec or arg is negative, it fails. */ EXPORT(sqInt) primDigitBitOr(void) { @@ -1723,7 +1723,7 @@ EXPORT(sqInt) primDigitBitShiftMagnitude(void) { } -/* Bit logic here is only implemented for positive integers or Zero; if rec +/* Bit logic here is only implemented for positive integers or Zero; if rec or arg is negative, it fails. */ EXPORT(sqInt) primDigitBitXor(void) { @@ -1884,8 +1884,8 @@ EXPORT(sqInt) primDigitCompareWith(void) { } -/* Answer the result of dividing firstInteger by secondInteger. - Fail if parameters are not integers, not normalized or secondInteger is +/* Answer the result of dividing firstInteger by secondInteger. + Fail if parameters are not integers, not normalized or secondInteger is zero. */ EXPORT(sqInt) primDigitDivNegative(void) { diff --git a/vm/src/from_squeak/intplugins/SoundPlugin/SoundPlugin.c b/vm/src/from_squeak/intplugins/SoundPlugin/SoundPlugin.c index 031ff2c..42314c5 100644 --- a/vm/src/from_squeak/intplugins/SoundPlugin/SoundPlugin.c +++ b/vm/src/from_squeak/intplugins/SoundPlugin/SoundPlugin.c @@ -169,13 +169,13 @@ EXPORT(sqInt) primitiveSoundGetVolume(void) { } -/* Insert a buffer's worth of sound samples into the currently playing - buffer. Used to make a sound start playing as quickly as possible. The +/* Insert a buffer's worth of sound samples into the currently playing + buffer. Used to make a sound start playing as quickly as possible. The new sound is mixed with the previously buffered sampled. */ -/* Details: Unlike primitiveSoundPlaySamples, this primitive always starts - with the first sample the given sample buffer. Its third argument - specifies the number of samples past the estimated sound output buffer - position the inserted sound should start. If successful, it returns the +/* Details: Unlike primitiveSoundPlaySamples, this primitive always starts + with the first sample the given sample buffer. Its third argument + specifies the number of samples past the estimated sound output buffer + position the inserted sound should start. If successful, it returns the number of samples inserted. */ EXPORT(sqInt) primitiveSoundInsertSamples(void) { diff --git a/vm/src/from_squeak/intplugins/SoundPlugin/sqUnixSound.c b/vm/src/from_squeak/intplugins/SoundPlugin/sqUnixSound.c index c56ba4d..3108c48 100644 --- a/vm/src/from_squeak/intplugins/SoundPlugin/sqUnixSound.c +++ b/vm/src/from_squeak/intplugins/SoundPlugin/sqUnixSound.c @@ -1,45 +1,45 @@ /* sqUnixSound.c -- sound support for various Unix sound systems * * Author: Ian.Piumarta@inria.fr - * + * * Last edited: 2003-08-14 01:34:52 by piumarta on emilia.inria.fr * * Copyright (C) 1996-2004 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. * * NOTE: The real sound support code is in one of the following files according * to the output driver selected by `configure': - * + * * sqUnixSoundOSS.c (Open Sound System [incl. Linux native & ALSA compat]) * sqUnixSoundNAS.c (Network Audio System) * sqUnixSoundSun.c (SunOS/Solaris) diff --git a/vm/src/from_squeak/intplugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c b/vm/src/from_squeak/intplugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c index a641c00..ba255ba 100644 --- a/vm/src/from_squeak/intplugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c +++ b/vm/src/from_squeak/intplugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c @@ -2,6 +2,22 @@ by VMMaker 3.8b6 */ +// added bu dmu +#define AIO_X (1<<0) /* handle for exceptions */ +#define AIO_R (1<<1) /* handle for read */ +#define AIO_W (1<<2) /* handle for write */ +#define AIO_SEQ (1<<3) /* call handlers sequentially */ +#define AIO_EXT (1<<4) /* external fd -- don't close on aio shutdown */ + +#define AIO_RW (AIO_R | AIO_W) +#define AIO_RX (AIO_R | AIO_X) +#define AIO_WX (AIO_W | AIO_X) + +#define AIO_RWX (AIO_R | AIO_W | AIO_X) + + + + #include #include #include @@ -45,6 +61,10 @@ by VMMaker 3.8b6 #ifndef SQAIO_H # define SQAIO_H "aio.h" /* aio.h has been renamed to sqaio.h */ #endif +# if Configure_Squeak_Code_for_Tilera // xxx_dmu +# undef SQAIO_H // xxx_dmu +# define SQAIO_H "sqaio.h" // xxx_dmu +# endif #include SQAIO_H #include "FilePlugin.h" #include "SocketPlugin.h" @@ -1415,7 +1435,7 @@ EXPORT(sqInt) primitiveFileProtectionMask(void) { /* Call stat(2) to obtain the file protection mask for a file. Answer errno on failure, - or on success answer an array with: UID with: GID with: protectionMask. The + or on success answer an array with: UID with: GID with: protectionMask. The protectionMask is an Array of four integers representing the protection mask, or answer errno on failure. The protection mask is four Integers, each of which may be considered an octal digit (0-7), with bit values 4, 2, and 1. The first digit selects @@ -2470,7 +2490,7 @@ EXPORT(sqInt) primitiveSemaIndexFor(void) { sigNum = interpreterProxy->stackIntegerValue(0); index = semaIndices[sigNum]; - interpreterProxy->pop(1); + interpreterProxy->pop(2); // Squeak bug, was 1 interpreterProxy->pushInteger(index); } diff --git a/vm/src/from_squeak/unix/vm-display-X11/sqUnixXdnd.c b/vm/src/from_squeak/unix/vm-display-X11/sqUnixXdnd.c index 92642f8..94983d7 100644 --- a/vm/src/from_squeak/unix/vm-display-X11/sqUnixXdnd.c +++ b/vm/src/from_squeak/unix/vm-display-X11/sqUnixXdnd.c @@ -1,58 +1,58 @@ /* sqUnixXdnd.c -- drag-and-drop for the X Window System. -*- C -*- - * + * * Copyright (C) 1996-2004 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. */ /* Author: Ian Piumarta - * + * * Last edited: 2004-04-04 23:06:38 by piumarta on cartman.inria.fr - * + * * BUGS - * + * * - This only works with version 3 and higher of the XDND protocol. * No attempt whatsoever is made to check for and deal with earlier * versions. Since version 3 is at least six years old now, I doubt * this matters much. - * + * * - Some memory could be released between drop operations, but it's * only a few tens of bytes so who cares? - * + * * - Only filenames (MIME type text/uri-list) are handled, although * it would be trivial to extend the code to cope with dropping text * selections into the Squeak clipboard. I'm simply too lazy to be * bothered. - * + * * - No attempt is made to verify that XDND protocol messages arrive * in the correct order. (If your WM or file manager is broken, you * get to keep all the shrapnel that will be left behind after diff --git a/vm/src/from_squeak/unix/vm-display-X11/sqUnixX11.c b/vm/src/from_squeak/unix/vm-display-X11/sqrUnixX11.c similarity index 98% rename from vm/src/from_squeak/unix/vm-display-X11/sqUnixX11.c rename to vm/src/from_squeak/unix/vm-display-X11/sqrUnixX11.c index 5ef6be3..8514d4a 100644 --- a/vm/src/from_squeak/unix/vm-display-X11/sqUnixX11.c +++ b/vm/src/from_squeak/unix/vm-display-X11/sqrUnixX11.c @@ -1,34 +1,34 @@ /* sqUnixX11.c -- support for display via the X Window System. - * + * * Copyright (C) 1996-2005 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. @@ -40,7 +40,7 @@ * * Support for more intelligent CLIPBOARD selection handling contributed by: * Ned Konz - * + * * Support for displays deeper than 8 bits contributed by: Kazuki YASUMATSU * * @@ -63,6 +63,8 @@ * Dave Lewis Mon Oct 18 20:36:54 EDT 1999 */ +# include "squeak_adapters.h" + #include "sq.h" #include "sqMemoryAccess.h" @@ -574,7 +576,7 @@ static int sendSelection(XSelectionRequestEvent *requestEv, int isMultiple) int xError= 0; XSelectionEvent notifyEv; Atom targetProperty= ((None == requestEv->property) - ? requestEv->target + ? requestEv->target : requestEv->property); notifyEv.property= targetProperty; @@ -723,7 +725,7 @@ static int sendSelection(XSelectionRequestEvent *requestEv, int isMultiple) } #if defined(DEBUG_SELECTIONS) - if (xError == BadAlloc || xError == BadAtom || xError == BadMatch + if (xError == BadAlloc || xError == BadAtom || xError == BadMatch || xError == BadValue || xError == BadWindow) fprintf(stderr, "sendSelection: XChangeProperty err %d\n", xError); #endif @@ -963,7 +965,7 @@ static sqInt display_clipboardWriteFromAt(sqInt count, sqInt byteArrayIndex, sqI { if (allocateSelectionBuffer(count)) { - memcpy((void *)stPrimarySelection, pointerForOop(byteArrayIndex + startIndex), count); + memcpy((void *)stPrimarySelection, (char*)pointerForIndex_xxx_dmu(byteArrayIndex + startIndex), count); stPrimarySelection[count]= '\0'; claimSelection(); } @@ -984,7 +986,7 @@ static sqInt display_clipboardReadIntoAt(sqInt count, sqInt byteArrayIndex, sqIn #if defined(DEBUG_SELECTIONS) fprintf(stderr, "clipboard read: %d selectionSize %d\n", count, selectionSize); #endif - memcpy(pointerForOop(byteArrayIndex + startIndex), (void *)stPrimarySelection, clipSize); + memcpy((char*)pointerForIndex_xxx_dmu(byteArrayIndex + startIndex), (void *)stPrimarySelection, clipSize); return clipSize; } @@ -1005,14 +1007,15 @@ static void redrawDisplay(int l, int r, int t, int b) sqInt displayObj= displayObject(); - if ((((((unsigned)(oopAt(displayObj))) >> 8) & 15) <= 4) + if ((((((unsigned)( oopAt(displayObj) )) >> 8) & 15) <= 4) && ((lengthOf(displayObj)) >= 4)) { - sqInt dispBits= fetchPointerofObject(0, displayObj); + sqInt dispBits= fetchPointerofObject(0, displayObj); // OK xxx_dmu sqInt w= fetchIntegerofObject(1, displayObj); sqInt h= fetchIntegerofObject(2, displayObj); sqInt d= fetchIntegerofObject(3, displayObj); - sqInt dispBitsIndex= dispBits + BaseHeaderSize; + // sqInt dispBitsIndex= dispBits + BaseHeaderSize; xxx_dmu + sqInt dispBitsIndex = (sqInt)firstFixedField(dispBits); // xxx_dmu ioShowDisplay(dispBitsIndex, w, h, d, (sqInt)l, (sqInt)r, (sqInt)t, (sqInt)b); } } @@ -1225,7 +1228,7 @@ static int x2sqModifier(int state) /* M - A - */ _|M|_|_, _|M|_|S, _|M|_|S, _|M|_|_, /* M - A C */ O|_|_|_, O|M|_|S, O|M|_|S, O|M|_|_, }; -# if defined(__POWERPC__) || defined(__ppc__) +# if defined(__POWERPC__) || defined(__ppc__) || Configure_Squeak_Code_for_Tilera // xxx_dmu mods= midofiers[state & 0x1f]; # else mods= midofiers[state & 0x0f]; @@ -1251,7 +1254,7 @@ static void waitForCompletions(void) static void handleEvent(XEvent *evt) { -#if defined(DEBUG_EVENTS) + #if defined(DEBUG_EVENTS) switch (evt->type) { case ButtonPress: @@ -1337,7 +1340,17 @@ static void handleEvent(XEvent *evt) case KeyPress: noteEventState(evt->xkey); { - int keyCode= x2sqKey(&evt->xkey); + int keyCode= x2sqKey(&evt->xkey); + if (keyCode == 1 && modifierState == 3) signal_emergency_semaphore(); + if (keyCode == 1 && modifierState == 2) /* ^a */ print_vm_info(); +# if Multiple_Tileras + extern void connect_to_other_chips(); + extern void send_test_message(); + + if (keyCode == 2 && modifierState == 3) connect_to_other_chips(); + if (keyCode == 5 && modifierState == 3) send_test_message();//ctrl shift e +# endif + if (keyCode >= 0) { recordKeyboardEvent(keyCode, EventKeyDown, modifierState); @@ -1759,12 +1772,20 @@ void initWindow(char *displayName) XSetErrorHandler(xError); - stDisplay= XOpenDisplay(displayName); + // xxx_dmu Tilera sometimes takes time to initialize + int xxx_dmu; + for (xxx_dmu = 0; xxx_dmu < 100; ++xxx_dmu) { + stDisplay= XOpenDisplay(displayName); + if (stDisplay) break; + if (xxx_dmu == 0) fprintf(stderr, "Retrying display\n"); + sleep(1); + } if (!stDisplay) { fprintf(stderr, "Could not open display `%s'.\n", displayName); exit(1); } + if (xxx_dmu != 0) fprintf(stderr, "had to try %d times\n", xxx_dmu + 1); /* get screen size */ scrH= (DisplayHeight(stDisplay, DefaultScreen(stDisplay))); @@ -2136,7 +2157,7 @@ static sqInt display_ioFormPrint(sqInt bitsIndex, sqInt width, sqInt height, sqI { # if defined(PRINT_PS_FORMS) - char *bitsAddr= pointerForOop(bitsIndex); + char *bitsAddr= pointerForIndex_xxx_dmu(bitsIndex); FILE *ppm; float scale; /* scale to use with pnmtops */ char printCommand[1000]; @@ -2372,8 +2393,8 @@ static unsigned char swapBits(unsigned char in) static sqInt display_ioSetCursorWithMask(sqInt cursorBitsIndex, sqInt cursorMaskIndex, sqInt offsetX, sqInt offsetY) { - unsigned int *cursorBits= (unsigned int *)pointerForOop(cursorBitsIndex); - unsigned int *cursorMask= (unsigned int *)pointerForOop(cursorMaskIndex); + unsigned int *cursorBits= (unsigned int *)pointerForIndex_xxx_dmu(cursorBitsIndex); + unsigned int *cursorMask= (unsigned int *)pointerForIndex_xxx_dmu(cursorMaskIndex); unsigned char data[32], mask[32]; /* cursors are always 16x16 */ int i; Cursor cursor; @@ -2677,7 +2698,7 @@ static sqInt display_ioShowDisplay(sqInt dispBitsIndex, sqInt width, sqInt heigh static sqInt stDisplayHeight= 0; /* ditto height */ static sqInt stDisplayDepth= 0; /* ditto depth */ - char *dispBits= pointerForOop(dispBitsIndex); + char *dispBits= pointerForIndex_xxx_dmu(dispBitsIndex); int geometryChanged= ((stDisplayBits != dispBits) || (stDisplayWidth != width) @@ -3981,7 +4002,7 @@ static int visualAttributes[]= { GLX_RGBA, /* no indexed colors */ GLX_DOUBLEBUFFER, /* will swap */ GLX_LEVEL, 0, /* frame buffer, not overlay */ - GLX_DEPTH_SIZE, 16, /* decent depth */ + GLX_DEPTH_SIZE, 16, /* decent depth */ GLX_AUX_BUFFERS, 0, /* no aux buffers */ GLX_ACCUM_RED_SIZE, 0, /* no accumulation */ GLX_ACCUM_GREEN_SIZE, 0, @@ -4005,7 +4026,7 @@ static sqInt display_ioGLcreateRenderer(glRenderer *r, sqInt x, sqInt y, sqInt w if (flags & B3D_STENCIL_BUFFER) visualAttributes[1]= 1; - else + else visualAttributes[1]= 0; _renderWindow(r)= 0; _renderContext(r)= 0; @@ -4059,7 +4080,7 @@ static sqInt display_ioGLcreateRenderer(glRenderer *r, sqInt x, sqInt y, sqInt w valuemask|= CWBackPixel; if (!(_renderWindow(r)= (void *)XCreateWindow(stDisplay, stWindow, x, y, w, h, 0, - visinfo->depth, InputOutput, visinfo->visual, + visinfo->depth, InputOutput, visinfo->visual, valuemask, &attributes))) { DPRINTF(1, (fp, "Failed to create client window\r")); @@ -4137,9 +4158,9 @@ static void display_ioGLsetBufferRect(glRenderer *r, sqInt x, sqInt y, sqInt w, static void printVisual(XVisualInfo* visinfo) { - int isOpenGL; + int isOpenGL; glXGetConfig(stDisplay, visinfo, GLX_USE_GL, &isOpenGL); - if (isOpenGL) + if (isOpenGL) { int slow= 0; int red, green, blue, alpha, stencil, depth; @@ -4167,7 +4188,7 @@ static void listVisuals(void) { XVisualInfo* visinfo; int nvisuals, i; - + visinfo= XGetVisualInfo(stDisplay, VisualNoMask, NULL, &nvisuals); for (i= 0; i < nvisuals; i++) diff --git a/vm/src/from_squeak/unix/vm-sound-MacOSX/sqUnixSoundMacOSX.c b/vm/src/from_squeak/unix/vm-sound-MacOSX/sqrUnixSoundMacOSX.c similarity index 97% rename from vm/src/from_squeak/unix/vm-sound-MacOSX/sqUnixSoundMacOSX.c rename to vm/src/from_squeak/unix/vm-sound-MacOSX/sqrUnixSoundMacOSX.c index da8e327..5bba1a5 100644 --- a/vm/src/from_squeak/unix/vm-sound-MacOSX/sqUnixSoundMacOSX.c +++ b/vm/src/from_squeak/unix/vm-sound-MacOSX/sqrUnixSoundMacOSX.c @@ -1,54 +1,55 @@ +# if !Configure_Squeak_Code_for_Tilera // xxx_dmu /* sqUnixSoundMacOSX.c -- sound support for CoreAudio on Mac OS 10 * * Author: Ian.Piumarta@squeakland.org - * + * * Last edited: 2005-03-17 21:36:05 by piumarta on squeak.hpl.hp.com * * Copyright (C) 1996-2005 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. */ // Notes: -// +// // The image always generates stereo samples. Since the only // supported hardware format is stereo, I cheerfully ignore the stereo // flag in snd_Start(). (Mixing everything down to mono only to have // the format converter break it back into stereo seems pointless.) -/// +/// /// Things you can tweak, should you really want to... -/// +/// // Do we obey the (huge) default "lead" time of 1024 frames (supplied // by the image) when mixing frames into the buffer, or do we reduce @@ -56,14 +57,16 @@ // #define OBEY_LEAD_TIME 0 -/// +/// /// No more user-serviceable parts in this file. Stop Tweaking Now! -/// +/// #include #include +# include "squeak_adapters.h" + #include #include #include @@ -119,7 +122,7 @@ static void eprintf(const char *fmt, ...) // Apple error codes are really (rather contrived) 4-byte chars with // (almost) meaningful content. -// +// static char *str4(UInt32 chars) { static char str[5]; @@ -139,9 +142,9 @@ static inline int checkError(OSStatus err, char *op, char *param) } -/// +/// /// (ring) Buffer -- a FIFO of bytes -/// +/// typedef struct @@ -155,7 +158,7 @@ typedef struct // allocate a new, empty buffer -// +// Buffer *Buffer_new(int size) { Buffer *b= (Buffer *)malloc(sizeof(Buffer)); @@ -174,7 +177,7 @@ Buffer *Buffer_new(int size) } // deallocate a buffer -// +// void Buffer_delete(Buffer *b) { assert(b && b->data); @@ -183,14 +186,14 @@ void Buffer_delete(Buffer *b) } // answer how many bytes are available for reading -// +// inline int Buffer_avail(Buffer *b) { return b->avail; } // answer how many bytes can be written -// +// inline int Buffer_free(Buffer *b) { return b->size - Buffer_avail(b); @@ -198,7 +201,7 @@ inline int Buffer_free(Buffer *b) // set outputs to address and size of zero (empty), one (contiguous) or two // (wrapped, fragmented) populated regions in the buffer -// +// inline int Buffer_getOutputPointers(Buffer *b, char **p1, int *n1, char **p2, int *n2) { int optr= b->optr; @@ -226,7 +229,7 @@ inline int Buffer_getOutputPointers(Buffer *b, char **p1, int *n1, char **p2, in // set the output to the current read position and answer the amount of // data at that location -// +// inline int Buffer_getOutputPointer(Buffer *b, char **ptr) { int optr= b->optr; @@ -240,7 +243,7 @@ inline int Buffer_getOutputPointer(Buffer *b, char **ptr) // set the output to the current write location and answer the number of // bytes that can be written to that location -// +// inline int Buffer_getInputPointer(Buffer *b, char **ptr) { int iptr= b->iptr; @@ -253,7 +256,7 @@ inline int Buffer_getInputPointer(Buffer *b, char **ptr) } // increment the output pointer over a contiguous section of buffer -// +// inline void Buffer_advanceOutputPointer(Buffer *b, int size) { int optr= b->optr; @@ -268,7 +271,7 @@ inline void Buffer_advanceOutputPointer(Buffer *b, int size) } // advance the input pointer over a contiguous section of buffer -// +// inline void Buffer_advanceInputPointer(Buffer *b, int size) { int iptr= b->iptr; @@ -284,7 +287,7 @@ inline void Buffer_advanceInputPointer(Buffer *b, int size) // clear the given number of bytes at the input position and advance the // input pointer past them -// +// inline void Buffer_prefill(Buffer *b, int bytes) { char *ptr; @@ -296,7 +299,7 @@ inline void Buffer_prefill(Buffer *b, int bytes) // write at most nbytes from buf into the buffer, wrapping in the middle if // necessary. answer the actual number of bytes written. -// +// inline int Buffer_write(Buffer *b, char *buf, int nbytes) { int iptr= b->iptr; @@ -325,7 +328,7 @@ inline int Buffer_write(Buffer *b, char *buf, int nbytes) // read at most nbytes from the buffer into buf, wrapping in the middle if // necessary. answer the actual number of bytes read. -// +// inline int Buffer_read(Buffer *b, char *buf, int nbytes) { int optr= b->optr; @@ -358,9 +361,9 @@ inline int Buffer_read(Buffer *b, char *buf, int nbytes) } -/// +/// /// Stream -- abstraction over CoreAudio devices and streams -/// +/// typedef struct Stream @@ -428,7 +431,7 @@ static OSStatus bufferDataProc(AudioConverterRef inAudioConverter, UInt32 *ioDat // shipout to device (usually 512 frames at 44k1 for builtin audio and // USB). this is asynchronous and runs (implicitly) in its own thread. -// +// static OSStatus ioProcOutput(AudioDeviceID device, const AudioTimeStamp *currentTime, const AudioBufferList *inputData, @@ -449,7 +452,7 @@ static OSStatus ioProcOutput(AudioDeviceID device, // shipin from device (usually 512 frames at 44k1). this is asynchronous and // runs (implicitly) in its own thread. -// +// static OSStatus ioProcInput(AudioDeviceID device, const AudioTimeStamp *currentTime, const AudioBufferList *inputData, @@ -551,7 +554,7 @@ static int Stream_setFormat(Stream *s, int frameCount, int sampleRate, int stere sz= sizeof(s->cvtBufSize); s->cvtBufSize= 512 * devFmt.mBytesPerFrame; if (checkError(AudioConverterGetProperty(s->converter, kAudioConverterPropertyCalculateOutputBufferSize, - &sz, &s->cvtBufSize), + &sz, &s->cvtBufSize), "GetProperty", "OutputBufferSize")) return 0; } @@ -576,13 +579,13 @@ static int Stream_setFormat(Stream *s, int frameCount, int sampleRate, int stere // start the device attached to the stream. -// +// static int Stream_startSema(Stream *s, int semaIndex) { AudioDeviceIOProc ioProc= s->direction ? ioProcInput : ioProcOutput; dprintf("stream %p[%d] startSema: %d\n", s, s->direction, semaIndex); - + s->semaphore= semaIndex; // can be zero if (checkError(AudioDeviceAddIOProc(s->id, ioProc, (void *)s), "Add", "ioProcOut")) @@ -599,7 +602,7 @@ static int Stream_startSema(Stream *s, int semaIndex) // stop the device attached to a stream. -// +// static int Stream_stop(Stream *s) { AudioDeviceIOProc ioProc= s->direction ? ioProcInput : ioProcOutput; @@ -612,9 +615,9 @@ static int Stream_stop(Stream *s) } -/// +/// /// sound output primitives -/// +/// static sqInt sound_AvailableSpace(void) @@ -627,7 +630,7 @@ static sqInt sound_AvailableSpace(void) // mix nFrames of samples into an output buffer. -// +// static void mixFrames(short *out, short *in, int nFrames) { while (nFrames--) @@ -645,10 +648,10 @@ static void mixFrames(short *out, short *in, int nFrames) // intact before starging the insertion. (this last parameter is // meaningless for us and could be reduced to zero, but ignoring it causes // strange things to happen. time to rething the image code, methinks.) -// +// // Note: this is only used when the "sound quick start" preference is // enabled in the image. -// +// static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, sqInt framesOfLeadTime) { Stream *s= output; @@ -720,9 +723,9 @@ static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, if ((frontFrames + backFrames) >= (frameCount / 2)) { - mixFrames((short *)frontData, (short *)pointerForOop(srcBufPtr), frontFrames); + mixFrames((short *)frontData, (short *)pointerForIndex_xxx_dmu(srcBufPtr), frontFrames); srcBufPtr += frontFrames * SqueakFrameSize; - mixFrames((short *)backData, (short *)pointerForOop(srcBufPtr), backFrames); + mixFrames((short *)backData, (short *)pointerForIndex_xxx_dmu(srcBufPtr), backFrames); framesDone= frontFrames + backFrames; } return framesDone; @@ -735,7 +738,7 @@ static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, // play (exactly) frameCount of samples (and no less, since the result is // ignored). -// +// static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex) { if (output) @@ -744,7 +747,7 @@ static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, s if (Buffer_free(output->buffer) >= byteCount) { Buffer_write(output->buffer, - pointerForOop(arrayIndex) + (startIndex * SqueakFrameSize), + pointerForIndex_xxx_dmu(arrayIndex) + (startIndex * SqueakFrameSize), byteCount); return frameCount; } @@ -756,7 +759,7 @@ static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, s // play a buffer's worth of silence (as quietly as possible). -// +// static sqInt sound_PlaySilence(void) { success(false); @@ -765,11 +768,11 @@ static sqInt sound_PlaySilence(void) // shut down sound output. -// +// static sqInt sound_Stop(void) { dprintf("snd_Stop\n"); - + if (output) { Stream_stop(output); @@ -781,14 +784,14 @@ static sqInt sound_Stop(void) // start up sound output. -// +// static sqInt sound_Start(sqInt frameCount, sqInt samplesPerSec, sqInt stereo, sqInt semaIndex) { Stream *s= 0; dprintf("snd_Start frames: %d samplesPerSec: %d stereo: %d semaIndex: %d\n", frameCount, samplesPerSec, stereo, semaIndex); - + if (output) // there might be a change of sample rate sound_Stop(); @@ -806,14 +809,14 @@ static sqInt sound_Start(sqInt frameCount, sqInt samplesPerSec, sqInt stereo, sq } -/// +/// /// sound input -/// +/// // answer the input sample rate. (this is guaranteed to be the same // as the sample rate that was requested.) -// +// static double sound_GetRecordingSampleRate(void) { if (input) @@ -839,14 +842,14 @@ static sqInt sound_StopRecording(void) // start up sound input. -// +// static sqInt sound_StartRecording(sqInt samplesPerSec, sqInt stereo, sqInt semaIndex) { Stream *s= 0; dprintf("snd_StartRecording rate: %d stereo: %d semaIndex: %d\n", samplesPerSec, stereo, semaIndex); - + if (input) // there might be a change of sample rate sound_StopRecording(); @@ -875,7 +878,7 @@ static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, s int start= startSliceIndex * SqueakFrameSize / 2; UInt32 count= min(input->cvtBufSize, bufferSizeInBytes - start); if (kAudioHardwareNoError == AudioConverterFillBuffer(input->converter, bufferDataProc, input, - &count, pointerForOop(buf) + start)) + &count, pointerForIndex_xxx_dmu(buf) + start)) return count / (SqueakFrameSize / 2) / input->channels; } return 0; @@ -885,9 +888,9 @@ static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, s } -/// +/// /// mixer -/// +/// static int getVolume(int dir, double *left, double *right) @@ -911,7 +914,7 @@ static int getVolume(int dir, double *left, double *right) &sz, &chan2), "GetProperty", "VolumeScalar")) chan2= chan1; - + *left= chan1; *right= chan2; @@ -948,7 +951,7 @@ static int setVolume(int dir, double dleft, double dright) // get output gain, 0.0 <= { left, right } <= 1.0 -// +// static void sound_Volume(double *left, double *right) { getVolume(0, left, right); @@ -956,7 +959,7 @@ static void sound_Volume(double *left, double *right) // set output gain, 0.0 <= { left, right } <= 1.0 -// +// static void sound_SetVolume(double left, double right) { extern int noSoundMixer; //xxx FIXME: this should not be a global option @@ -969,7 +972,7 @@ static void sound_SetVolume(double left, double right) // set recording gain, 0 <= level <= 1000 -// +// static sqInt sound_SetRecordLevel(sqInt level) { extern int noSoundMixer; @@ -981,9 +984,9 @@ static sqInt sound_SetRecordLevel(sqInt level) } -/// +/// /// debugging -/// +/// #if (DEBUG) @@ -1099,3 +1102,5 @@ int main() */ #endif // TESTING +# endif // !Configure_Squeak_Code_for_Tilera xxx_dmu + diff --git a/vm/src/from_squeak/unix/vm-sound-custom/sqUnixCustomSound.c b/vm/src/from_squeak/unix/vm-sound-custom/sqUnixCustomSound.c index 82070e7..cedcce9 100644 --- a/vm/src/from_squeak/unix/vm-sound-custom/sqUnixCustomSound.c +++ b/vm/src/from_squeak/unix/vm-sound-custom/sqUnixCustomSound.c @@ -3,7 +3,7 @@ * Last edited: 2005-04-06 05:44:40 by piumarta on pauillac.hpl.hp.com * * This is a template for creating your own sound drivers for Squeak: - * + * * - copy the entire contents of this directory to some other name * - rename this file to be something more appropriate * - modify acinclude.m4, Makefile.in, and ../vm/sqUnixMain accordingly diff --git a/vm/src/from_squeak/unix/vm-sound-null/sqUnixSoundNull.c b/vm/src/from_squeak/unix/vm-sound-null/sqUnixSoundNull.c index ada90de..5938c58 100644 --- a/vm/src/from_squeak/unix/vm-sound-null/sqUnixSoundNull.c +++ b/vm/src/from_squeak/unix/vm-sound-null/sqUnixSoundNull.c @@ -1,38 +1,38 @@ /* sqUnixSoundNull.c -- sound module for no sound * * Author: Ian.Piumarta@squeakland.org - * + * * Last edited: 2005-03-17 20:34:26 by piumarta on squeak.hpl.hp.com * * Copyright (C) 1996-2005 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. diff --git a/vm/src/from_squeak/unix/vm/aio.c b/vm/src/from_squeak/unix/vm/aio.c index 6246a34..b06fc08 100644 --- a/vm/src/from_squeak/unix/vm/aio.c +++ b/vm/src/from_squeak/unix/vm/aio.c @@ -1,41 +1,41 @@ /* aio.c -- asynchronous file i/o - * + * * Copyright (C) 1996-2006 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. */ /* Author: Ian.Piumarta@squeakland.org - * + * * Last edited: 2006-04-17 21:44:32 by piumarta on margaux.local */ @@ -49,27 +49,27 @@ # include # include # endif /* HAVE_UNISTD_H */ - + # ifdef NEED_GETHOSTNAME_P extern int gethostname(); # endif - + # include # include # include # include # include - + # ifdef HAVE_SYS_TIME_H # include # else # include # endif - + # ifdef HAS_SYS_SELECT_H # include # endif - + # ifndef FIONBIO # ifdef HAVE_SYS_FILIO_H # include diff --git a/vm/src/from_squeak/unix/vm/dlfcn-dyld.c b/vm/src/from_squeak/unix/vm/dlfcn-dyld.c index bf981b1..b35d44c 100644 --- a/vm/src/from_squeak/unix/vm/dlfcn-dyld.c +++ b/vm/src/from_squeak/unix/vm/dlfcn-dyld.c @@ -1,40 +1,40 @@ /* dlfcn-dyld.c -- provides dlopen() and friends as wrappers around Mach dyld - * + * * Author: Ian.Piumarta@INRIA.Fr - * + * * Copyright (C) 1996-2006 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. - * + * * Last edited: 2006-04-15 11:13:44 by piumarta on margaux.local */ diff --git a/vm/src/from_squeak/unix/vm/sq.h b/vm/src/from_squeak/unix/vm/sq.h index 70b6c17..a79eb98 100644 --- a/vm/src/from_squeak/unix/vm/sq.h +++ b/vm/src/from_squeak/unix/vm/sq.h @@ -1,11 +1,11 @@ /**************************************************************************** * PROJECT: Common include * FILE: sq.h -* CONTENT: +* CONTENT: * -* AUTHOR: -* ADDRESS: -* EMAIL: +* AUTHOR: +* ADDRESS: +* EMAIL: * RCSID: $Id: sq.h 1283 2005-12-31 00:51:12Z rowledge $ * */ @@ -15,6 +15,8 @@ #include #include +# include "squeak_adapters.h" + #include "sqConfig.h" #include "sqMemoryAccess.h" #include "sqVirtualMachine.h" @@ -116,11 +118,11 @@ sqInt ioMicroMSecs(void); #define ioMSecs() ((1000 * clock()) / CLOCKS_PER_SEC) /* this macro cannot be used now that ioMicroMSecs is involved in the - sqVirtualMachine structures - we must have a function + sqVirtualMachine structures - we must have a function #define ioMicroMSecs() ((1000 * clock()) / CLOCKS_PER_SEC) */ -/* New filename converting function; used by the interpreterProxy function +/* New filename converting function; used by the interpreterProxy function ioFilenamefromStringofLengthresolveAliases. Most platforms can ignore the resolveAlias boolean - it seems to only be of use by OSX but is crucial there. */ @@ -131,7 +133,7 @@ sqInt sqGetFilenameFromString(char * aCharBuffer, char * aFilenameString, sqInt Override in sqPlatformSpecific.h for each platform that implements a file truncate, or consider replacing the ../Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c - file with a platform specific version as Win32 and RISC OS do. + file with a platform specific version as Win32 and RISC OS do. */ #define sqFTruncate(filenum, fileoffset) true @@ -188,7 +190,7 @@ sqInt ioDisablePowerManager(sqInt disableIfNonZero); In general, either set of input function can be supported, depending on the platform. This (first) set is state based and should be supported even on platforms that make use - of the newer event driven API to support older images + of the newer event driven API to support older images without event support. */ @@ -383,7 +385,7 @@ sqInt getAttributeIntoLength(sqInt id, sqInt byteArrayIndex, sqInt length); void *ioLoadExternalFunctionOfLengthFromModuleOfLength(sqInt functionNameIndex, sqInt functionNameLength, sqInt moduleNameIndex, sqInt moduleNameLength); sqInt ioUnloadModuleOfLength(sqInt moduleNameIndex, sqInt moduleNameLength); -void *ioLoadFunctionFrom(char *functionName, char *pluginName); +void *ioLoadFunctionFrom(const char *functionName, const char *pluginName); sqInt ioShutdownAllModules(void); sqInt ioUnloadModule(char *moduleName); sqInt ioUnloadModuleOfLength(sqInt moduleNameIndex, sqInt moduleNameLength); diff --git a/vm/src/from_squeak/unix/vm/sqMemoryAccess.h b/vm/src/from_squeak/unix/vm/sqMemoryAccess.h index 9f848aa..948f6e8 100644 --- a/vm/src/from_squeak/unix/vm/sqMemoryAccess.h +++ b/vm/src/from_squeak/unix/vm/sqMemoryAccess.h @@ -1,7 +1,7 @@ /* sqMemoryAccess.h -- memory accessors (and associated type definitions) - * + * * Author: Ian.Piumarta@squeakland.org - * + * * Last edited: 2006-04-06 09:47:39 by piumarta on emilia.local */ @@ -22,7 +22,7 @@ # include "interp.h" #else # define SQ_VI_BYTES_PER_WORD 4 /* build a 32-bit VM */ -# warning +# warning # warning *************************************************** # warning * # warning * interp.h not found -- defaulting to a 32-bit VM @@ -31,7 +31,7 @@ # warning * version to avoid this message # warning * # warning *************************************************** -# warning +# warning #endif #if (SQ_VI_BYTES_PER_WORD == 4) @@ -57,7 +57,7 @@ #else # if (SIZEOF_LONG_LONG != 8) # error long long integers are not 64-bits wide? -# endif +# endif typedef long long sqInt; typedef unsigned long long usqInt; #endif @@ -82,8 +82,9 @@ static inline sqInt longAtPointerput(char *ptr, sqInt val) { return (sqInt)(*((sqInt *)ptr)= (sqInt)val); } static inline sqInt oopAtPointer(char *ptr) { return (sqInt)(*((sqInt *)ptr)); } static inline sqInt oopAtPointerput(char *ptr, sqInt val) { return (sqInt)(*((sqInt *)ptr)= (sqInt)val); } - static inline char *pointerForOop(sqInt oop) { return sqMemoryBase + oop; } - static inline sqInt oopForPointer(char *ptr) { return (sqInt)(ptr - sqMemoryBase); } + + extern char *pointerForOop(sqInt oop); // xxx_dmu Renaissance + extern sqInt oopForPointer(void *ptr); // xxx_dmu Renaissance static inline sqInt byteAt(sqInt oop) { return byteAtPointer(pointerForOop(oop)); } static inline sqInt byteAtput(sqInt oop, int val) { return byteAtPointerput(pointerForOop(oop), val); } static inline sqInt shortAt(sqInt oop) { return shortAtPointer(pointerForOop(oop)); } @@ -95,6 +96,7 @@ static inline sqInt oopAt(sqInt oop) { return oopAtPointer(pointerForOop(oop)); } static inline sqInt oopAtput(sqInt oop, sqInt val) { return oopAtPointerput(pointerForOop(oop), val); } #else +# error Use the other ones for Renaissance /* Use macros when static inline functions aren't efficient. */ # define byteAtPointer(ptr) ((sqInt)(*((unsigned char *)(ptr)))) # define byteAtPointerput(ptr, val) ((sqInt)(*((unsigned char *)(ptr))= (unsigned char)(val))) @@ -123,6 +125,10 @@ #define long32At intAt #define long32Atput intAtput +#define long32AtPointer intAtPointer // xxx_dmu +#define long32AtPointerput intAtPointerput // xxx_dmu + + /* platform-dependent float conversion macros */ /* Note: Second argument must be a variable name, not an expression! */ /* Note: Floats in image are always in PowerPC word order; change diff --git a/vm/src/from_squeak/unix/vm/sqNamedPrims.h b/vm/src/from_squeak/unix/vm/sqNamedPrims.h index 9211b20..ca5d3dc 100644 --- a/vm/src/from_squeak/unix/vm/sqNamedPrims.h +++ b/vm/src/from_squeak/unix/vm/sqNamedPrims.h @@ -23,9 +23,15 @@ extern sqExport StarSqueakPlugin_exports[]; extern sqExport UnixOSProcessPlugin_exports[]; extern sqExport XDisplayControlPlugin_exports[]; +extern sqExport FilePlugin_exports[]; // xxx_dmu +extern sqExport RVMPlugin_exports[]; // xxx_dmu +extern sqExport SocketPlugin_exports[]; // xxx_dmu + sqExport *pluginExports[] = { vm_exports, os_exports, + +FilePlugin_exports, // xxx_dmu ADPCMCodecPlugin_exports, BMPReadWriterPlugin_exports, B2DPlugin_exports, @@ -43,5 +49,7 @@ sqExport *pluginExports[] = { StarSqueakPlugin_exports, UnixOSProcessPlugin_exports, XDisplayControlPlugin_exports, + RVMPlugin_exports, + SocketPlugin_exports, // xxx_dmu NULL }; diff --git a/vm/src/from_squeak/unix/vm/sqPlatformSpecific.h b/vm/src/from_squeak/unix/vm/sqPlatformSpecific.h index 3a193b3..71f9a4c 100644 --- a/vm/src/from_squeak/unix/vm/sqPlatformSpecific.h +++ b/vm/src/from_squeak/unix/vm/sqPlatformSpecific.h @@ -1,40 +1,40 @@ /* sqPlatformSpecific.h -- platform-specific modifications to sq.h - * + * * Copyright (C) 1996-2005 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. - * + * * Author: ian.piumarta@squeakland.org - * + * * Last edited: 2005-03-28 22:59:56 by piumarta on emilia.local */ diff --git a/vm/src/from_squeak/unix/vm/sqUnixCharConv.h b/vm/src/from_squeak/unix/vm/sqUnixCharConv.h index 4d28e97..7e02ee4 100644 --- a/vm/src/from_squeak/unix/vm/sqUnixCharConv.h +++ b/vm/src/from_squeak/unix/vm/sqUnixCharConv.h @@ -1,40 +1,40 @@ /* sqUnixCharConv.h -- conversion between character encodings - * + * * Author: Ian.Piumarta@squeakland.org - * + * * Copyright (C) 1996-2005 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. - * + * * Last edited: 2005-03-17 21:11:25 by piumarta on squeak.hpl.hp.com */ diff --git a/vm/src/from_squeak/unix/vm/sqUnixEvent.c b/vm/src/from_squeak/unix/vm/sqUnixEvent.c index 6a137c1..62e008e 100644 --- a/vm/src/from_squeak/unix/vm/sqUnixEvent.c +++ b/vm/src/from_squeak/unix/vm/sqUnixEvent.c @@ -1,34 +1,34 @@ /* sqUnixEvent.c -- support for window system events. - * + * * Copyright (C) 1996-2005 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. diff --git a/vm/src/from_squeak/unix/vm/sqaio.h b/vm/src/from_squeak/unix/vm/sqaio.h index 410bd07..4148849 100644 --- a/vm/src/from_squeak/unix/vm/sqaio.h +++ b/vm/src/from_squeak/unix/vm/sqaio.h @@ -3,32 +3,32 @@ * Copyright (C) 1996-2004 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. diff --git a/vm/src/from_squeak/unix/vm/sqUnixCharConv.c b/vm/src/from_squeak/unix/vm/sqrUnixCharConv.c similarity index 96% rename from vm/src/from_squeak/unix/vm/sqUnixCharConv.c rename to vm/src/from_squeak/unix/vm/sqrUnixCharConv.c index 3ad02d0..ada7e00 100644 --- a/vm/src/from_squeak/unix/vm/sqUnixCharConv.c +++ b/vm/src/from_squeak/unix/vm/sqrUnixCharConv.c @@ -1,43 +1,45 @@ /* sqUnixCharConv.c -- conversion between character encodings - * + * * Author: Ian.Piumarta@squeakland.org - * + * * Copyright (C) 1996-2005 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. - * + * * Last edited: 2005-03-17 21:09:51 by piumarta on squeak.hpl.hp.com */ +# include "squeak_adapters.h" + #if !defined(__MACH__) # include "sqMemoryAccess.h" #endif @@ -153,13 +155,13 @@ int convertChars(char *from, int fromLen, void *fromCode, char *to, int toLen, v typedef char ichar_t; #ifdef __sparc -void *sqTextEncoding= (void *)"mac"; /* xxxFIXME -> "ISO-8859-15" */ +void *sqTextEncoding= (void *)"mac"; /* xxxFIXME -> "ISO-8859-15" */ void *uxPathEncoding= (void *)"iso"; void *uxTextEncoding= (void *)"iso"; void *uxXWinEncoding= (void *)"iso"; void *uxUTF8Encoding= (void *)"UTF-8"; #else -void *sqTextEncoding= (void *)"MACINTOSH"; /* xxxFIXME -> "ISO-8859-15" */ +void *sqTextEncoding= (void *)"MACINTOSH"; /* xxxFIXME -> "ISO-8859-15" */ void *uxPathEncoding= (void *)"UTF-8"; void *uxTextEncoding= (void *)"ISO-8859-15"; void *uxXWinEncoding= (void *)"ISO-8859-1"; @@ -240,7 +242,7 @@ int convertChars(char *from, int fromLen, void *fromCode, char *to, int toLen, v if (0xfe == c || 0xff == c) /* invalid */ skip= 1; - else + else while ((skip < inbytes) && (mask & c)) { skip++; @@ -340,7 +342,7 @@ Convert(ux,sq, UTF8, uxUTF8Encoding, sqTextEncoding, 0, 1); void sqFilenameFromString(char *uxName, sqInt sqNameIndex, int sqNameLength) { /*xxx BUG: lots of code generate from the image assumes 1000 chars max path len */ - sq2uxPath(pointerForOop(sqNameIndex), sqNameLength, uxName, 1000, 1); + sq2uxPath(pointerForIndex_xxx_dmu(sqNameIndex), sqNameLength, uxName, 1000, 1); } @@ -371,17 +373,17 @@ int main() { char *in, out[256]; int n; - in= "tésté"; // UTF-8 composed Unicode + in= "t√©st√©"; // UTF-8 composed Unicode n= convertChars(in, strlen(in), uxPathEncoding, out, sizeof(out), uxTextEncoding, 0, 1); printf("%d: %s -> %s\n", n, in, out); - in= "tésté"; // UTF-8 decomposed Unicode (libiconv fails on this one, MacOSX passes) + in= "teÃÅsteÃÅ"; // UTF-8 decomposed Unicode (libiconv fails on this one, MacOSX passes) n= convertChars(in, strlen(in), uxPathEncoding, out, sizeof(out), uxTextEncoding, 0, 1); printf("%d: %s -> %s\n", n, in, out); - in= "tst"; // ISO-8859-15 + in= "tÈstÈ"; // ISO-8859-15 n= convertChars(in, strlen(in), uxTextEncoding, out, sizeof(out), uxPathEncoding, 0, 1); - printf("%d: %s -> %s\n", n, in, out); // default composition -- should yield "tésté" + printf("%d: %s -> %s\n", n, in, out); // default composition -- should yield "t√©st√©" n= convertChars(in, strlen(in), uxTextEncoding, out, sizeof(out), uxPathEncoding, 1, 1); - printf("%d: %s -> %s\n", n, in, out); // canonical decomposition -- should yield "tésté" + printf("%d: %s -> %s\n", n, in, out); // canonical decomposition -- should yield "teÃÅsteÃÅ" } return 0; } diff --git a/vm/src/from_squeak/unix/vm/sqUnixExternalPrims.c b/vm/src/from_squeak/unix/vm/sqrUnixExternalPrims.c similarity index 98% rename from vm/src/from_squeak/unix/vm/sqUnixExternalPrims.c rename to vm/src/from_squeak/unix/vm/sqrUnixExternalPrims.c index bcc82d2..25d9a34 100644 --- a/vm/src/from_squeak/unix/vm/sqUnixExternalPrims.c +++ b/vm/src/from_squeak/unix/vm/sqrUnixExternalPrims.c @@ -1,34 +1,34 @@ /* sqUnixExternalPrims.c -- Unix named primitives and loadable modules - * + * * Copyright (C) 1996-2004 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. @@ -40,7 +40,7 @@ */ #define DEBUG 0 - + #include "sq.h" /* sqUnixConfig.h */ #if (DEBUG) @@ -48,7 +48,7 @@ #else # define dprintf(ARGS) #endif - + #if !defined(HAVE_LIBDL) && defined(HAVE_DYLD) # include "dlfcn-dyld.c" #endif @@ -63,7 +63,7 @@ extern void *dlsym(void *handle, const char *symbol); extern int dlclose (void *handle); #endif - + #include #include @@ -85,7 +85,7 @@ #if !defined(RTLD_GLOBAL) # define RTLD_GLOBAL 0 #endif - + #ifndef NAME_MAX # ifdef MAXPATHLEN # define NAME_MAX MAXPATHLEN @@ -330,6 +330,10 @@ void *ioFindExternalFunctionIn(char *lookupName, void *moduleHandle) fprintf(stderr, "ioFindExternalFunctionIn(%s, %p):\n %s\n", lookupName, moduleHandle, dlerror()); + if (fn == 0) // xxx_dmu + fprintf(stderr, "ioFindExternalFunctionIn(%s, %p):\n %s\n", lookupName, moduleHandle, dlerror()); + + return fn; } diff --git a/vm/src/from_squeak/unix/vm/sqUnixMain.c b/vm/src/from_squeak/unix/vm/sqrUnixMain.c similarity index 90% rename from vm/src/from_squeak/unix/vm/sqUnixMain.c rename to vm/src/from_squeak/unix/vm/sqrUnixMain.c index 96e3b18..81da04e 100644 --- a/vm/src/from_squeak/unix/vm/sqUnixMain.c +++ b/vm/src/from_squeak/unix/vm/sqrUnixMain.c @@ -1,34 +1,34 @@ /* sqUnixMain.c -- support for Unix. - * + * * Copyright (C) 1996-2006 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. - * + * * This file is part of Unix Squeak. - * + * * You are NOT ALLOWED to distribute modified versions of this file * under its original name. If you modify this file then you MUST * rename it before making your modifications available publicly. - * + * * This file is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. - * + * * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of * this distribution, subject to the following additional restrictions: - * + * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment to the original author(s) (and any * other contributors mentioned herein) in the product documentation * would be appreciated but is not required. - * + * * 2. You must not distribute (or make publicly available by any * means) a modified copy of this file unless you first rename it. - * + * * 3. This notice must not be removed or altered in any source distribution. - * + * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. @@ -40,10 +40,12 @@ */ #include "sq.h" +/* #include "sqMemoryAccess.h" #include "sqaio.h" #include "sqUnixCharConv.h" #include "debug.h" + */ #ifdef ioMSecs # undef ioMSecs @@ -103,7 +105,7 @@ static int useItimer= 1; /* 0 to disable itimer-based clock */ int useJit= 0; /* use default */ int jitProcs= 0; /* use default */ int jitMaxPIC= 0; /* use default */ - int withSpy= 0; + /* Renaissance */ int xxx_dmuwithSpy= 0; int uxDropFileCount= 0; /* number of dropped items */ char **uxDropFileNames= 0; /* dropped filenames */ @@ -115,7 +117,7 @@ static int dumpImageFile= 0; /* 1 after SIGHUP received */ #endif #if defined(DARWIN) -int inModalLoop= 0; +/* Renaissance */ int xxx_dmuinModalLoop= 0; #endif int sqIgnorePluginErrors = 0; @@ -144,7 +146,9 @@ static void sigalrm(int signum) static void initTimers(void) { /* set up the micro/millisecond clock */ - gettimeofday(&startUpTime, 0); + // gettimeofday(&startUpTime, 0); cannot do this because time is different on each core -- dmu 3/09 + fprintf(stderr, "itimer is %sbeing used\n", useItimer ? "" : "not "); // xxx_dmu + if (useItimer) { /* set up the low-res (50th second) millisecond clock */ @@ -292,7 +296,7 @@ sqInt imageNameSize(void) sqInt imageNameGetLength(sqInt sqImageNameIndex, sqInt length) { - char *sqImageName= pointerForOop(sqImageNameIndex); + char *sqImageName= (char*)pointerForIndex_xxx_dmu(sqImageNameIndex); int count, i; count= strlen(imageName); @@ -308,7 +312,7 @@ sqInt imageNameGetLength(sqInt sqImageNameIndex, sqInt length) sqInt imageNamePutLength(sqInt sqImageNameIndex, sqInt length) { - char *sqImageName= pointerForOop(sqImageNameIndex); + char *sqImageName= (char*)pointerForIndex_xxx_dmu(sqImageNameIndex); int count, i; count= (IMAGE_NAME_SIZE < length) ? IMAGE_NAME_SIZE : length; @@ -340,7 +344,7 @@ sqInt vmPathSize(void) sqInt vmPathGetLength(sqInt sqVMPathIndex, sqInt length) { - char *stVMPath= pointerForOop(sqVMPathIndex); + char *stVMPath= (char*)pointerForIndex_xxx_dmu(sqVMPathIndex); int count, i; count= strlen(vmPath); @@ -433,7 +437,7 @@ sqInt attributeSize(sqInt id) sqInt getAttributeIntoLength(sqInt id, sqInt byteArrayIndex, sqInt length) { if (length > 0) - strncpy(pointerForOop(byteArrayIndex), getAttribute(id), length); + strncpy((char*)pointerForIndex_xxx_dmu(byteArrayIndex), getAttribute(id), length); return 0; } @@ -523,7 +527,7 @@ static void emergencyDump(int quit) sqInt ioProcessEvents(void) { -#if defined(IMAGE_DUMP) + #if defined(IMAGE_DUMP) if (dumpImageFile) { emergencyDump(0); @@ -849,8 +853,14 @@ static void loadImplicit(struct SqModule **addr, char *evar, char *type, char *n static void loadModules(void) { +# if Configure_Squeak_Code_for_Tilera + extern struct SqModule display_X11,sound_null; + displayModule = &display_X11; + soundModule = &sound_null; +# else loadImplicit(&displayModule, "DISPLAY", "display", "X11"); loadImplicit(&soundModule, "AUDIOSERVER", "sound", "NAS"); +# endif { struct moduleDescription *md; @@ -900,11 +910,13 @@ static int strtobkm(const char *str) return value; } -static int jitArgs(char *str) +# if UNUSED // xxx_dmu + +UNUSED static int jitArgs(char *str) { char *endptr= str; int args= 3; /* default JIT mode = fast compiler */ - + if (*str == '\0') return args; if (*str != ',') args= strtol(str, &endptr, 10); /* mode */ @@ -913,6 +925,7 @@ static int jitArgs(char *str) return args; } +# endif // UNUSED static void vm_parseEnvironment(void) { @@ -929,21 +942,30 @@ static void vm_parseEnvironment(void) if ((ev= getenv("SQUEAK_MMAP"))) useMmap= strtobkm(ev); if ((ev= getenv("SQUEAK_PLUGINS"))) squeakPlugins= strdup(ev); if ((ev= getenv("SQUEAK_NOEVENTS"))) noEvents= 1; - if ((ev= getenv("SQUEAK_NOTIMER"))) useItimer= 0; + if ((ev= getenv("SQUEAK_NOTIMER"))) + useItimer= 0; + # if UNUSED if ((ev= getenv("SQUEAK_JIT"))) useJit= jitArgs(ev); + # endif // UNUSED if ((ev= getenv("SQUEAK_PROCS"))) jitProcs= atoi(ev); if ((ev= getenv("SQUEAK_MAXPIC"))) jitMaxPIC= atoi(ev); + # if UNUSED if ((ev= getenv("SQUEAK_ENCODING"))) setEncoding(&sqTextEncoding, ev); if ((ev= getenv("SQUEAK_PATHENC"))) setEncoding(&uxPathEncoding, ev); if ((ev= getenv("SQUEAK_TEXTENC"))) setEncoding(&uxTextEncoding, ev); + # endif if ((ev= getenv("SQUEAK_VM"))) requireModulesNamed(ev); } static void usage(void); -static void versionInfo(void); +# if UNUSED + +UNUSED static void versionInfo(void); + +# endif // UNUSED static int parseModuleArgument(int argc, char **argv, struct SqModule **addr, char *type, char *name) { @@ -999,10 +1021,12 @@ static int vm_parseArgument(int argc, char **argv) else if (!strcmp(argv[0], "-noevents")) { noEvents = 1; return 1; } else if (!strcmp(argv[0], "-nomixer")) { noSoundMixer = 1; return 1; } else if (!strcmp(argv[0], "-notimer")) { useItimer = 0; return 1; } + # if UNUSED else if (!strncmp(argv[0],"-jit", 4)) { useJit = jitArgs(argv[0]+4); return 1; } else if (!strcmp(argv[0], "-nojit")) { useJit = 0; return 1; } else if (!strcmp(argv[0], "-spy")) { withSpy = 1; return 1; } else if (!strcmp(argv[0], "-version")) { versionInfo(); return 1; } + # endif /* option requires an argument */ else if (argc > 1) { @@ -1011,23 +1035,27 @@ static int vm_parseArgument(int argc, char **argv) else if (!strcmp(argv[0], "-memory")) { extraMemory= strtobkm(argv[1]); return 2; } else if (!strcmp(argv[0], "-mmap")) { useMmap= strtobkm(argv[1]); return 2; } else if (!strcmp(argv[0], "-plugins")) { squeakPlugins= strdup(argv[1]); return 2; } + # if UNUSED else if (!strcmp(argv[0], "-encoding")) { setEncoding(&sqTextEncoding, argv[1]); return 2; } else if (!strcmp(argv[0], "-pathenc")) { setEncoding(&uxPathEncoding, argv[1]); return 2; } + # endif // UNUSED else if (!strcmp(argv[0], "-textenc")) - { - char *buf= (char *)malloc(strlen(argv[1]) + 1); - int len, i; - strcpy(buf, argv[1]); - len= strlen(buf); - for (i= 0; i < len; ++i) - buf[i]= toupper(buf[i]); - if ((!strcmp(buf, "UTF8")) || (!strcmp(buf, "UTF-8"))) - textEncodingUTF8= 1; - else - setEncoding(&uxTextEncoding, buf); - free(buf); - return 2; - } + { + char *buf= (char *)malloc(strlen(argv[1]) + 1); + int len, i; + strcpy(buf, argv[1]); + len= strlen(buf); + for (i= 0; i < len; ++i) + buf[i]= toupper(buf[i]); + # if UNUSED + if ((!strcmp(buf, "UTF8")) || (!strcmp(buf, "UTF-8"))) + textEncodingUTF8= 1; + else + setEncoding(&uxTextEncoding, buf); + # endif // UNUSED + free(buf); + return 2; + } } return 0; /* option not recognised */ } @@ -1114,8 +1142,9 @@ static void usage(void) exit(1); } +# if UNUSED -char *getVersionInfo(int verbose) +UNUSED char *getVersionInfo(int verbose) { extern int vm_serial; extern char *vm_date, *cc_version, *ux_version; @@ -1140,14 +1169,16 @@ char *getVersionInfo(int verbose) } -static void versionInfo(void) +UNUSED static void versionInfo(void) { printf("%s", getVersionInfo(0)); exit(0); } -static void parseArguments(int argc, char **argv) +# endif // UNUSED + + static void parseArguments(int argc, char **argv) { # define skipArg() (--argc, argv++) # define saveArg() (vmArgVec[vmArgCnt++]= *skipArg()) @@ -1159,20 +1190,20 @@ static void parseArguments(int argc, char **argv) struct SqModule *m= 0; int n= 0; if (!strcmp(*argv, "--")) /* escape from option processing */ - break; + break; modulesDo (m) - if ((n= m->parseArgument(argc, argv))) - break; + if ((n= m->parseArgument(argc, argv))) + break; # ifdef DEBUG_IMAGE printf("parseArgument n = %d\n", n); # endif if (n == 0) /* option not recognised */ - { - fprintf(stderr, "unknown option: %s\n", argv[0]); - usage(); - } + { + fprintf(stderr, "unknown option: %s\n", argv[0]); + usage(); + } while (n--) - saveArg(); + saveArg(); } if (!argc) return; @@ -1181,9 +1212,9 @@ static void parseArguments(int argc, char **argv) else /* image name */ { if (!documentName) - strcpy(shortImageName, saveArg()); + strcpy(shortImageName, saveArg()); if (!strstr(shortImageName, ".image")) - strcat(shortImageName, ".image"); + strcat(shortImageName, ".image"); } /* save remaining arguments as Squeak arguments */ while (argc > 0) @@ -1193,6 +1224,8 @@ static void parseArguments(int argc, char **argv) # undef skipArg } +# if UNUSED + /*** main ***/ @@ -1201,17 +1234,17 @@ static void imageNotFound(char *imageName) { /* image file is not found */ fprintf(stderr, - "Could not open the Squeak image file `%s'.\n" - "\n" - "There are three ways to open a Squeak image file. You can:\n" - " 1. Put copies of the default image and changes files in this directory.\n" - " 2. Put the name of the image file on the command line when you\n" - " run squeak (use the `-help' option for more information).\n" - " 3. Set the environment variable SQUEAK_IMAGE to the name of the image\n" - " that you want to use by default.\n" - "\n" - "For more information, type: `man squeak' (without the quote characters).\n", - imageName); + "Could not open the Squeak image file `%s'.\n" + "\n" + "There are three ways to open a Squeak image file. You can:\n" + " 1. Put copies of the default image and changes files in this directory.\n" + " 2. Put the name of the image file on the command line when you\n" + " run squeak (use the `-help' option for more information).\n" + " 3. Set the environment variable SQUEAK_IMAGE to the name of the image\n" + " that you want to use by default.\n" + "\n" + "For more information, type: `man squeak' (without the quote characters).\n", + imageName); exit(1); } @@ -1226,25 +1259,25 @@ void imgInit(void) char imageName[MAXPATHLEN]; sq2uxPath(shortImageName, strlen(shortImageName), imageName, 1000, 1); if (( (-1 == stat(imageName, &sb))) - || ( 0 == (f= fopen(imageName, "r")))) - { - if (dpy->winImageFind(shortImageName, sizeof(shortImageName))) - continue; - dpy->winImageNotFound(); - imageNotFound(shortImageName); - } + || ( 0 == (f= fopen(imageName, "r")))) + { + if (dpy->winImageFind(shortImageName, sizeof(shortImageName))) + continue; + dpy->winImageNotFound(); + imageNotFound(shortImageName); + } { - int fd= open(imageName, O_RDONLY); - if (fd < 0) abort(); + int fd= open(imageName, O_RDONLY); + if (fd < 0) abort(); # ifdef DEBUG_IMAGE - printf("fstat(%d) => %d\n", fd, fstat(fd, &sb)); + printf("fstat(%d) => %d\n", fd, fstat(fd, &sb)); # endif } recordFullPathForImageName(shortImageName); /* full image path */ if (extraMemory) - useMmap= 0; + useMmap= 0; else - extraMemory= DefaultHeapSize * 1024 *1024; + extraMemory= DefaultHeapSize * 1024 *1024; # ifdef DEBUG_IMAGE printf("image size %d + heap size %d (useMmap = %d)\n", (int)sb.st_size, extraMemory, useMmap); # endif @@ -1254,10 +1287,12 @@ void imgInit(void) break; } } +# endif // UNUSED + #if defined(__GNUC__) && ( defined(i386) || defined(__i386) || defined(__i386__) \ - || defined(i486) || defined(__i486) || defined (__i486__) \ - || defined(intel) || defined(x86) || defined(i86pc) ) + || defined(i486) || defined(__i486) || defined (__i486__) \ + || defined(intel) || defined(x86) || defined(i86pc) ) static void fldcw(unsigned int cw) { __asm__("fldcw %0" :: "m"(cw)); @@ -1267,7 +1302,7 @@ void imgInit(void) #endif #if defined(__GNUC__) && ( defined(ppc) || defined(__ppc) || defined(__ppc__) \ - || defined(POWERPC) || defined(__POWERPC) || defined (__POWERPC__) ) + || defined(POWERPC) || defined(__POWERPC) || defined (__POWERPC__) ) void mtfsfi(unsigned long long fpscr) { __asm__("lfd f0, %0" :: "m"(fpscr)); @@ -1306,7 +1341,7 @@ int main(int argc, char **argv, char **envp) if ((squeakArgVec= calloc(argc + 1, sizeof(char *))) == 0) outOfMemory(); - signal(SIGSEGV, sigsegv); + // xxxxxx better without this for now: signal(SIGSEGV, sigsegv); #if defined(__alpha__) /* disable printing of unaligned access exceptions */ @@ -1314,7 +1349,7 @@ int main(int argc, char **argv, char **envp) int buf[2]= { SSIN_UACPROC, UAC_NOPRINT }; if (setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0, 0) < 0) { - perror("setsysinfo(UAC_NOPRINT)"); + perror("setsysinfo(UAC_NOPRINT)"); } } #endif @@ -1340,6 +1375,7 @@ int main(int argc, char **argv, char **envp) printf("soundModule %p %s\n", soundModule, soundModule->name); #endif +# if UNSED if (!realpath(argv[0], vmName)) vmName[0]= 0; /* full VM name */ @@ -1348,13 +1384,17 @@ int main(int argc, char **argv, char **envp) printf("viName: %s\n", shortImageName); printf("documentName: %s\n", documentName); #endif +# endif // UNUXED initTimers(); aioInit(); dpy->winInit(); +# ifdef UNUSED imgInit(); +# endif // UNUSED dpy->winOpen(); +# if UNUSED #if defined(HAVE_LIBDL) if (useJit) { @@ -1363,19 +1403,19 @@ int main(int argc, char **argv, char **envp) void *comp= ioFindExternalFunctionIn("j_interpret", handle); /* ...and if that fails... */ if (comp == 0) - { - /* ...try to find an external one */ - handle= ioLoadModule("SqueakCompiler"); - if (handle != 0) - comp= ioFindExternalFunctionIn("j_interpret", handle); - } + { + /* ...try to find an external one */ + handle= ioLoadModule("SqueakCompiler"); + if (handle != 0) + comp= ioFindExternalFunctionIn("j_interpret", handle); + } if (comp) - { - ((void (*)(void))comp)(); - fprintf(stderr, "handing control back to interpret() -- have a nice day\n"); - } + { + ((void (*)(void))comp)(); + fprintf(stderr, "handing control back to interpret() -- have a nice day\n"); + } else - printf("could not find j_interpret\n"); + printf("could not find j_interpret\n"); exit(1); } #endif @@ -1393,13 +1433,18 @@ int main(int argc, char **argv, char **envp) (void)sq2uxPath; (void)ux2sqPath; sqDebugAnchor(); - + +# endif // UNUSED + extern void sigint(int); + signal(SIGINT, sigint); + return 0; } sqInt ioExit(void) { - dpy->winExit(); + if (dpy != NULL) dpy->winExit(); + rvm_exit(); // xxx_dmu exit(0); } -- 1.7.3.1