Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 29 Mar 2016 08:38:24 +0100
branchjv
changeset 19496 7613c0fb5f3c
parent 19478 1f5aa87f6170 (current diff)
parent 19495 885347ee3b18 (diff)
child 19500 49f06f2390fa
Merge
AbstractOperatingSystem.st
ApplicationDefinition.st
ByteArray.st
ExternalAddress.st
ExternalBytes.st
ExternalFunction.st
ExternalLibraryFunction.st
ProjectDefinition.st
SmallInteger.st
Smalltalk.st
UserPreferences.st
--- a/AbstractOperatingSystem.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/AbstractOperatingSystem.st	Tue Mar 29 08:38:24 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
@@ -1930,6 +1932,40 @@
     "
 !
 
+executeCommand:aCommandString outputTo:anOutStreamOrNil errorTo:anErrStreamOrNil
+    "execute the unix command specified by the argument, aCommandString.
+     If aCommandString is a String, the commandString is passed to a shell for execution
+     - see the description of 'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
+     If aCommandString is an Array, the first element is the command to be executed,
+     and the other elements are the arguments to the command. No shell is invoked in this case.
+     Return true if successful, false otherwise."
+
+     ^ self
+        executeCommand:aCommandString
+        inputFrom:nil
+        outputTo:anOutStreamOrNil
+        errorTo:anErrStreamOrNil
+        auxFrom:nil
+        environment:nil
+        inDirectory:nil
+        lineWise:false
+        onError:[:status| false]
+
+    "
+     String streamContents:[:s|OperatingSystem
+        executeCommand:'ls'
+        outputTo:s
+     ]
+    "
+
+    "
+     String streamContents:[:s|OperatingSystem
+        executeCommand:'pwd'
+        outputTo:s
+     ]
+    "
+!
+
 executeCommand:aCommandString outputTo:outStreamOrNil errorTo:errStreamOrNil inDirectory:aDirectory
     "much like #executeCommand:, but changes the current directory
      for the command. Since this is OS specific, use this instead of
--- a/ApplicationDefinition.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/ApplicationDefinition.st	Tue Mar 29 08:38:24 2016 +0100
@@ -1952,6 +1952,7 @@
         copy $(TOP)\librun\$(OBJDIR_LIBRUN)\librun.dll librun.dll
 
 !!ifdef USEBC 
+!!ifndef USEMINGW64        
 #cs3245.dll
 $(RT_DLL): $(TOP)\support\win32\borland\$(RT_DLL)
         copy $(TOP)\support\win32\borland\$(RT_DLL) $(RT_DLL)
--- a/ByteArray.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/ByteArray.st	Tue Mar 29 08:38:24 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -166,6 +164,7 @@
 ! !
 
 
+
 !ByteArray class methodsFor:'queries'!
 
 elementByteSize
@@ -186,6 +185,7 @@
     "Modified: 23.4.1996 / 15:56:25 / cg"
 ! !
 
+
 !ByteArray methodsFor:'Compatibility-Squeak'!
 
 bitXor:aByteArray
@@ -817,11 +817,11 @@
             }
             nIndex = __byteArraySize(self);
             if ((indx+1) <= nIndex) {
-                val.u_ushort = v = __intVal(value);
+                v = __intVal(value);
                 if ((v & ~0xFFFF) == 0 /* i.e. (val >= 0) && (val <= 0xFFFF) */) {
                     byteP = (unsigned char *)(__ByteArrayInstPtr(self)->ba_element) + indx - 1;
 #if defined(__i386__) || defined(UNALIGNED_FETCH_OK)
-                    ((unsigned short *)byteP)[0] = val.u_ushort;
+                    ((unsigned short *)byteP)[0] = v;
 #else
                     /*
                      * mhmh to be measured:
@@ -830,8 +830,9 @@
                      */
                     if (((INT)byteP & 1) == 0) {
                         /* aligned */
-                        ((unsigned short *)byteP)[0] = val.u_ushort;
+                        ((unsigned short *)byteP)[0] = v;
                     } else {
+                        val.u_ushort = v;
                         byteP[0] = val.u_char[0];
                         byteP[1] = val.u_char[1];
                     }
--- a/ExternalAddress.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/ExternalAddress.st	Tue Mar 29 08:38:24 2016 +0100
@@ -135,7 +135,10 @@
 !
 
 pointerSize
-    "answer the size in bytes of a pointer"
+    "answer the size in bytes of a pointer.
+     Notice: this is inlined by the compiler(s) as a constant,
+     therefore, a query like 'ExternalAddress pointerSize == 8'
+     costs nothing; it is compiled in as a constant."
 
 %{ /* NOCONTEXT */
     RETURN(__mkSmallInteger(sizeof(void *)));
@@ -146,6 +149,7 @@
     "
 ! !
 
+
 !ExternalAddress methodsFor:'Compatibility-Squeak'!
 
 beNull
--- a/ExternalBytes.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/ExternalBytes.st	Tue Mar 29 08:38:24 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -742,6 +740,7 @@
     "
 ! !
 
+
 !ExternalBytes methodsFor:'accessing'!
 
 address
@@ -1369,10 +1368,10 @@
 !
 
 isValid
-    "true if I gave an address"
+    "true if I have an address"
 
 %{  /* NOCONTEXT */
-    RETURN ((__INST(address_) == nil) ? false : true );
+    RETURN ((__INST(address_) == 0) ? false : true );
 %}
 !
 
--- a/ExternalFunction.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/ExternalFunction.st	Tue Mar 29 08:38:24 2016 +0100
@@ -239,7 +239,8 @@
 !ExternalFunction class methodsFor:'calling custom functions'!
 
 callCustomFunction:nr
-    "call the custom function #nr without arguments"
+    "call the custom function #nr without arguments.
+     See main.c for examples."
 
     ^ self callCustomFunction:nr withArguments:#()
 
@@ -252,7 +253,8 @@
 !
 
 callCustomFunction:nr with:arg
-    "call the custom function #nr with a single argument"
+    "call the custom function #nr with a single argument.
+     See main.c for examples."
 
     ^ self callCustomFunction:nr withArguments:(Array with:arg)
 
@@ -264,7 +266,8 @@
 !
 
 callCustomFunction:nr with:arg1 with:arg2
-    "call the custom function #nr with two arguments"
+    "call the custom function #nr with two arguments.
+     See main.c for examples."
 
     ^ self callCustomFunction:nr withArguments:(Array with:arg1 with:arg2)
 
@@ -276,7 +279,8 @@
 !
 
 callCustomFunction:nr with:arg1 with:arg2 with:arg3
-    "call the custom function #nr with three arguments"
+    "call the custom function #nr with three arguments.
+     See main.c for examples."
 
     ^ self callCustomFunction:nr
 		withArguments:(Array with:arg1 with:arg2 with:arg3)
@@ -285,9 +289,10 @@
 !
 
 callCustomFunction:nr withArguments:argArray
-    "call the custom function #nr with arguments from argArray"
+    "call the custom function #nr with arguments from argArray.
+     See main.c for examples."
 
-    |retVal called|
+    |retVal called errCode|
 
 %{
 #ifndef __stxNCustomFunctions__
@@ -312,9 +317,10 @@
 
 		retVal = self;
 		ok = (*func)(nargs, &retVal, __ArrayInstPtr(argArray)->a_element);
-		if (ok) {
+		if (ok == 0) {
 		    RETURN (retVal);
 		}
+		errCode = __mkSmallInteger(ok);
 		called = true;
 	    }
 	}
@@ -322,8 +328,18 @@
 %}.
     called ifTrue:[
 	"
-	 the customFunction returned 0 (failure)
+	 the customFunction returned non-0 (failure)
+	    PRIM_OK         0
+	    PRIM_FAIL       -1
+	    PRIM_ARGCOUNT   -2
+	    PRIM_ARGTYPE    -3
 	"
+	errCode == -2 ifTrue:[
+	    ^ self primitiveFailed:'argument count'
+	].
+	errCode == -3 ifTrue:[
+	    ^ self primitiveFailed:'argument type'
+	].
 	^ self primitiveFailed
     ].
 
@@ -332,7 +348,6 @@
     "
     InvalidCustomFunctionSignal raise
 
-
     "
      ExternalFunction callCustomFunction:2 withArguments:#(1.0 1.0)
      ExternalFunction callCustomFunction:999 withArguments:#(1.0 1.0)
@@ -371,15 +386,15 @@
 #endif
 
     if (__isStringLike(functionName)) {
-        char *nm;
-        int i;
+	char *nm;
+	int i;
 
-        nm = (char *)__stringVal(functionName);
-        for (i=0; i < __stxNCustomFunctions__; i++) {
-           if (strcmp(__stxCustomFunctions__[i].name, nm) == 0) {
-                RETURN (__mkSmallInteger(i));
-           }
-        }
+	nm = (char *)__stringVal(functionName);
+	for (i=0; i < __stxNCustomFunctions__; i++) {
+	   if (strcmp(__stxCustomFunctions__[i].name, nm) == 0) {
+		RETURN (__mkSmallInteger(i));
+	   }
+	}
     }
 %}.
     ^ nil
@@ -972,11 +987,11 @@
 !ExternalFunction class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalFunction.st,v 1.27 2009-11-05 16:26:28 stefan Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalFunction.st,v 1.27 2009-11-05 16:26:28 stefan Exp $'
+    ^ '$Header$'
 ! !
 
 ExternalFunction initialize!
--- a/ExternalLibraryFunction.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/ExternalLibraryFunction.st	Tue Mar 29 08:38:24 2016 +0100
@@ -199,11 +199,13 @@
 addToDllPath:aDirectoryPathName
     "can be used during initialization, to add more places for dll-loading"
 
-    |oldPath|
+    |oldPath newPath|
 
     oldPath := self dllPath.
     (oldPath includes:aDirectoryPathName) ifFalse:[
-	self dllPath:(oldPath asOrderedCollection copyWith:aDirectoryPathName)
+        newPath := oldPath asOrderedCollection.
+        newPath add:aDirectoryPathName.
+        self dllPath:newPath
     ]
 !
 
@@ -314,6 +316,103 @@
     "Modified: / 01-08-2006 / 13:44:57 / cg"
 ! !
 
+!ExternalLibraryFunction class methodsFor:'type name mapping'!
+
+ffiTypeSymbolForType:aType
+    "map type to one of the ffi-supported ones:
+        sint8, sint16, sint32, sint64
+        uint8, uint16, uint32, uint64
+        bool void pointer handle
+    "
+
+    aType == #sint8           ifTrue:[^ aType ].
+    aType == #sint16          ifTrue:[^ aType ].
+    aType == #sint32          ifTrue:[^ aType ].
+    aType == #sint64          ifTrue:[^ aType ].
+    aType == #uint8           ifTrue:[^ aType ].
+    aType == #uint16          ifTrue:[^ aType ].
+    aType == #uint32          ifTrue:[^ aType ].
+    aType == #uint64          ifTrue:[^ aType ].
+    aType == #double          ifTrue:[^ aType ].
+    aType == #float           ifTrue:[^ aType ].
+    aType == #char            ifTrue:[^ aType ].
+    aType == #void            ifTrue:[^ aType ].
+    aType == #bool            ifTrue:[^ aType ].
+    aType == #pointer         ifTrue:[^ aType ].
+    aType == #charPointer     ifTrue:[^ aType ].
+    aType == #wcharPointer    ifTrue:[^ aType ].
+
+    aType == #int8            ifTrue:[^ #sint8 ].
+    aType == #int16           ifTrue:[^ #sint16 ].
+    aType == #int32           ifTrue:[^ #sint32 ].
+    aType == #int64           ifTrue:[^ #sint64 ].
+
+    aType == #voidPointer         ifTrue:[^ #pointer ].
+    aType == #uint8Pointer        ifTrue:[^ #pointer ].
+    aType == #voidPointerPointer  ifTrue:[^ #pointer ].
+
+    aType == #short           ifTrue:[^ #sint16 ].
+    aType == #long            ifTrue:[^ #long ].
+    aType == #int             ifTrue:[^ #int ].
+    aType == #uint            ifTrue:[^ #uint ].
+    aType == #ushort          ifTrue:[^ #uint16 ].
+    aType == #unsignedShort   ifTrue:[^ #uint16 ].
+    aType == #ulong           ifTrue:[^ #ulong ].
+    aType == #unsignedLong    ifTrue:[^ #ulong ].
+    aType == #uchar           ifTrue:[^ #uint8 ].
+    aType == #unsignedChar    ifTrue:[^ #uint8 ].
+    aType == #byte            ifTrue:[^ #uint8 ].
+    aType == #longlong        ifTrue:[^ #sint64 ].
+    aType == #longLong        ifTrue:[^ #sint64 ].
+    aType == #ulonglong       ifTrue:[^ #uint64 ].
+    aType == #ulongLong       ifTrue:[^ #uint64 ].
+
+    "/ windefs
+    aType == #dword           ifTrue:[^ #uint32 ].
+    aType == #sdword          ifTrue:[^ #sint32 ].
+    aType == #word            ifTrue:[^ #uint16 ].
+    aType == #sword           ifTrue:[^ #sint16 ].
+    aType == #handle          ifTrue:[^ #pointer ].
+    aType == #lpstr           ifTrue:[^ #charPointer ].
+    aType == #hresult         ifTrue:[^ #uint32 ].
+    aType == #boolean         ifTrue:[^ #bool ].
+    "/ care for 64bit machines
+    aType == #ulongReturn     ifTrue:[^ ExternalAddress pointerSize == 8 ifTrue:[#uint64] ifFalse:[#uint32]].
+    aType == #none            ifTrue:[^ #void ].
+    aType == #struct          ifTrue:[^ #pointer ].
+    aType == #structIn        ifTrue:[^ #pointer ].
+    aType == #structOut       ifTrue:[^ #pointer ].
+    aType == #structInOut     ifTrue:[^ #pointer ].
+    aType == #unsigned        ifTrue:[^ #uint ].
+
+    aType == #ATOM            ifTrue:[^ #uint16 ].
+    aType == #BOOL            ifTrue:[^ #int ].
+    aType == #BOOLEAN         ifTrue:[^ #uint8 ].
+    aType == #BYTE            ifTrue:[^ #uint8 ].
+    aType == #DWORD           ifTrue:[^ #uint32 ].
+    aType == #HANDLE          ifTrue:[^ #pointer ].
+    "/ care for 64bit machines
+    aType == #SIZE_T          ifTrue:[^ ExternalAddress pointerSize == 8 ifTrue:[#uint64] ifFalse:[#uint32]].
+    aType == #BSTR            ifTrue:[^ #wcharPointer].
+
+    (aType isString or:[aType isSymbol]) ifFalse:[
+        CType isNil ifTrue:[
+            self error:'unknown type'.
+        ].
+        ^ aType typeSymbol.
+    ].
+
+    (aType endsWith:'*') ifTrue:[
+        ^ #pointer.
+    ].
+    (aType endsWith:'Pointer') ifTrue:[
+        ^ #pointer.
+    ].
+    ^ aType
+
+    "Modified: / 14-06-2007 / 17:21:42 / cg"
+! !
+
 !ExternalLibraryFunction methodsFor:'accessing'!
 
 argumentTypes
@@ -448,18 +547,27 @@
 !
 
 isCallTypeAPI
+    "is this a windows API-call linkage call.
+     Attention: this uses a different call API (callee unwinds the stack),
+     and MUST be declared as such for many Kernel functions.
+     The calltype API is one of the worst historic garbage kept by MS..."
+
     ^ ((flags ? 0) bitAnd: CALLTYPE_MASK) == CALLTYPE_API.
 
     "Created: / 01-08-2006 / 15:21:16 / cg"
 !
 
 isCallTypeC
+    "is this a regular C-call (attention: on windows, there are two kinds of calls)"
+
     ^ ((flags ? 0) bitAnd: CALLTYPE_MASK) == CALLTYPE_C.
 
     "Created: / 01-08-2006 / 15:21:23 / cg"
 !
 
 isCallTypeOLE
+    "is this an OLE-object call ? (eg. a virtual c++ call; same as isCallTypeCPP)"
+
     ^ ((flags ? 0) bitTest: FLAG_VIRTUAL).
 
     "Created: / 01-08-2006 / 15:21:23 / cg"
@@ -499,7 +607,7 @@
 !
 
 isVirtualCPP
-    "is this a virtual c++-function ?"
+    "is this a virtual c++-function (same as isCallTypeOLE) ?"
 
     ^ (flags ? 0) bitTest: FLAG_VIRTUAL.
 
@@ -638,10 +746,16 @@
 !ExternalLibraryFunction methodsFor:'private'!
 
 adjustTypes
+    "map all those existing type names to a small number of definite ffi type names.
+     This is needed, because there are so many different C-type names found in code imported
+     from various Smalltalk dialects' library function call declarations.
+     For example: all of word, WORD, unsignedShort, ushort, uShort etc. will map to uint16.
+     Also, this deals with pointer size differences."
+
     argumentTypes notEmptyOrNil ifTrue:[
-        argumentTypes := argumentTypes collect:[:argType | self ffiTypeSymbolForType:argType].
+        argumentTypes := argumentTypes collect:[:argType | self class ffiTypeSymbolForType:argType].
     ].
-    returnType := self ffiTypeSymbolForType:returnType.
+    returnType := self class ffiTypeSymbolForType:returnType.
 
     "Modified: / 07-07-2015 / 22:18:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -653,56 +767,59 @@
     |handle moduleNameUsed functionName|
 
     name isNumber ifTrue:[
-	self isCPPFunction ifTrue:[
-	    "/ no need to load a dll.
-	    ^ self
-	]
+        self isCPPFunction ifTrue:[
+            "/ no need to load a dll.
+            ^ self
+        ]
     ].
 
     "/ in some other smalltalks, there is no moduleName in the ffi-spec;
     "/ instead, the class provides the libraryName...
     (moduleNameUsed := moduleName) isNil ifTrue:[
-	owningClass isNil ifTrue:[
-	    self error:'Missing moduleName'.
-	].
-	moduleNameUsed := owningClass theNonMetaclass libraryName asSymbol.
+        owningClass isNil ifTrue:[
+            self error:'Missing moduleName'.
+        ].
+        moduleNameUsed := owningClass theNonMetaclass libraryName asSymbol.
     ].
     moduleHandle isNil ifTrue:[
-	"/ speedup. in 95% of all calls, the same moduleName is resolved here
-	(LastModuleHandleHolder isNil
-	or:[ (handle := LastModuleHandleHolder at:1) isNil
-	or:[ LastModuleHandleName ~= moduleNameUsed ]]) ifTrue:[
+        "/ speedup. in 95% of all calls, the same moduleName is resolved here
+        (LastModuleHandleHolder isNil
+        or:[ (handle := LastModuleHandleHolder at:1) isNil
+        or:[ LastModuleHandleName ~= moduleNameUsed ]]) ifTrue:[
 
-	    handle := self loadLibrary:moduleNameUsed.
-	    handle isNil ifTrue:[
-		self error:('Cannot find or load dll/module: "%1"' bindWith: moduleNameUsed).
-	    ].
-	    LastModuleHandleHolder := WeakArray with:handle.
-	    LastModuleHandleName := moduleNameUsed.
-	].
-	moduleHandle := handle.
+            handle := self loadLibrary:moduleNameUsed.
+            handle isNil ifTrue:[
+                self error:('Cannot find or load dll/module: "%1"' bindWith: moduleNameUsed).
+            ].
+            LastModuleHandleHolder := WeakArray with:handle.
+            LastModuleHandleName := moduleNameUsed.
+        ].
+        moduleHandle := handle.
     ].
     name isNumber ifFalse:[
-	functionName := name.
-	(moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[
-	    functionName := ('_', functionName) asSymbol.
-
-	    (moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[
-		moduleHandle := nil.
-		self error:'Missing function: ', name, ' in module: ', moduleNameUsed.
-	    ].
-	].
+        functionName := name.
+        (moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[
+            (moduleHandle getFunctionAddress:('_', functionName) into:self) isNil ifTrue:[
+                moduleHandle := nil.
+                self error:'Missing function: ', name, ' in module: ', moduleNameUsed.
+            ].
+        ].
     ].
 
     "Modified: / 10-04-2012 / 12:12:44 / cg"
 !
 
 loadLibrary:dllName
+    "load a dll.
+     Notice the dllMapping mechanism, which can be used to silently load different dlls.
+     This is useful, if some code has a hardcoded dll-name in it, which needs to be changed,
+     but you do not want or cannot recompile the methods (i.e. no source avail)"
+
     |handle nameString filename|
 
     filename := dllName.
     DllMapping notNil ifTrue:[
-	filename := DllMapping at:filename ifAbsent:[ filename ]
+        filename := DllMapping at:filename ifAbsent:[ filename ]
     ].
 
     filename := filename asFilename.
@@ -713,25 +830,25 @@
     handle notNil ifTrue:[^ handle ].
 
     filename isAbsolute ifFalse:[
-	"First ask the class defining the ExternalFunction for the location of the dlls ..."
-	owningClass notNil ifTrue:[
-	    owningClass dllPath do:[:eachDirectory |
-		handle := ObjectFileLoader
-			    loadDynamicObject:(eachDirectory asFilename construct:nameString) pathName.
-		handle notNil ifTrue:[^ handle ].
-	    ].
-	].
-	".. then ask the system"
-	self class dllPath do:[:eachDirectory |
-	    handle := ObjectFileLoader
-			loadDynamicObject:(eachDirectory asFilename construct:nameString) pathName.
-	    handle notNil ifTrue:[^ handle ].
-	].
+        "First ask the class defining the ExternalFunction for the location of the dlls ..."
+        owningClass notNil ifTrue:[
+            owningClass dllPath do:[:eachDirectory |
+                handle := ObjectFileLoader
+                            loadDynamicObject:(eachDirectory asFilename construct:nameString) pathName.
+                handle notNil ifTrue:[^ handle ].
+            ].
+        ].
+        ".. then ask the system"
+        self class dllPath do:[:eachDirectory |
+            handle := ObjectFileLoader
+                        loadDynamicObject:(eachDirectory asFilename construct:nameString) pathName.
+            handle notNil ifTrue:[^ handle ].
+        ].
     ].
 
     filename suffix isEmpty ifTrue:[
-	"/ try again with the OS-specific dll-extension
-	^ self loadLibrary:(filename withSuffix:ObjectFileLoader sharedLibrarySuffix)
+        "/ try again with the OS-specific dll-extension
+        ^ self loadLibrary:(filename withSuffix:ObjectFileLoader sharedLibrarySuffix)
     ].
 
     ^ nil
@@ -740,100 +857,18 @@
 !
 
 prepareInvoke
+    "called before invoked.
+     When called the very first time, moduleHandle is nil, 
+     and we ensure that the dll is loaded, the function address is extracted"
+
     (moduleHandle isNil or:[self hasCode not]) ifTrue:[
-	self linkToModule.
-	self adjustTypes.
+        self linkToModule.
+        self adjustTypes.
     ].
 ! !
 
 !ExternalLibraryFunction methodsFor:'private-accessing'!
 
-ffiTypeSymbolForType:aType
-    "map type to one of the ffi-supported ones:
-	sint8, sint16, sint32, sint64
-	uint8, uint16, uint32, uint64
-	bool void pointer handle
-    "
-
-    aType == #sint8           ifTrue:[^ aType ].
-    aType == #sint16          ifTrue:[^ aType ].
-    aType == #sint32          ifTrue:[^ aType ].
-    aType == #sint64          ifTrue:[^ aType ].
-    aType == #uint8           ifTrue:[^ aType ].
-    aType == #uint16          ifTrue:[^ aType ].
-    aType == #uint32          ifTrue:[^ aType ].
-    aType == #uint64          ifTrue:[^ aType ].
-    aType == #double          ifTrue:[^ aType ].
-    aType == #float           ifTrue:[^ aType ].
-    aType == #char            ifTrue:[^ aType ].
-    aType == #void            ifTrue:[^ aType ].
-    aType == #bool            ifTrue:[^ aType ].
-    aType == #pointer         ifTrue:[^ aType ].
-    aType == #charPointer     ifTrue:[^ aType ].
-    aType == #wcharPointer    ifTrue:[^ aType ].
-
-    aType == #int8            ifTrue:[^ #sint8 ].
-    aType == #int16           ifTrue:[^ #sint16 ].
-    aType == #int32           ifTrue:[^ #sint32 ].
-    aType == #int64           ifTrue:[^ #sint64 ].
-
-    aType == #voidPointer         ifTrue:[^ #pointer ].
-    aType == #uint8Pointer        ifTrue:[^ #pointer ].
-    aType == #voidPointerPointer  ifTrue:[^ #pointer ].
-
-    aType == #short           ifTrue:[^ #sint16 ].
-    aType == #long            ifTrue:[^ #long ].
-    aType == #int             ifTrue:[^ #int ].
-    aType == #uint            ifTrue:[^ #uint ].
-    aType == #ushort          ifTrue:[^ #uint16 ].
-    aType == #unsignedShort   ifTrue:[^ #uint16 ].
-    aType == #ulong           ifTrue:[^ #ulong ].
-    aType == #unsignedLong    ifTrue:[^ #ulong ].
-    aType == #uchar           ifTrue:[^ #uint8 ].
-    aType == #unsignedChar    ifTrue:[^ #uint8 ].
-    aType == #byte            ifTrue:[^ #uint8 ].
-    aType == #dword           ifTrue:[^ #uint32 ].
-    aType == #sdword          ifTrue:[^ #sint32 ].
-    aType == #word            ifTrue:[^ #uint16 ].
-    aType == #sword           ifTrue:[^ #sint16 ].
-    aType == #longlong        ifTrue:[^ #sint64 ].
-    aType == #longLong        ifTrue:[^ #sint64 ].
-    aType == #ulonglong       ifTrue:[^ #uint64 ].
-    aType == #ulongLong       ifTrue:[^ #uint64 ].
-    aType == #handle          ifTrue:[^ #pointer ].
-    aType == #lpstr           ifTrue:[^ #charPointer ].
-    aType == #hresult         ifTrue:[^ #uint32 ].
-    aType == #boolean         ifTrue:[^ #bool ].
-    "/ care for 64bit machines
-    ExternalAddress pointerSize == 8 ifTrue:[
-	aType == #ulongReturn     ifTrue:[^ #uint64 ].
-    ] ifFalse:[
-	aType == #ulongReturn     ifTrue:[^ #uint32 ].
-    ].
-    aType == #none            ifTrue:[^ #void ].
-    aType == #struct          ifTrue:[^ #pointer ].
-    aType == #structIn        ifTrue:[^ #pointer ].
-    aType == #structOut       ifTrue:[^ #pointer ].
-    aType == #unsigned        ifTrue:[^ #uint ].
-
-    (aType isString or:[aType isSymbol]) ifFalse:[
-	CType isNil ifTrue:[
-	    self error:'unknown type'.
-	].
-	^ aType typeSymbol.
-    ].
-
-    (aType endsWith:'*') ifTrue:[
-	^ #pointer.
-    ].
-    (aType endsWith:'Pointer') ifTrue:[
-	^ #pointer.
-    ].
-    ^ aType
-
-    "Modified: / 14-06-2007 / 17:21:42 / cg"
-!
-
 name:functionNameOrVirtualIndex module:aModuleName returnType:aReturnType argumentTypes:argTypes
     name := functionNameOrVirtualIndex.
     functionNameOrVirtualIndex isNumber ifTrue:[
@@ -1964,6 +1999,10 @@
 
 !ExternalLibraryFunction class methodsFor:'documentation'!
 
+version
+    ^ '$Header$'
+!
+
 version_CVS
     ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.97 2015-04-20 10:48:54 cg Exp $'
 !
--- a/ProjectDefinition.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/ProjectDefinition.st	Tue Mar 29 08:38:24 2016 +0100
@@ -4736,7 +4736,7 @@
     ^ String streamContents:[:s |
         self effectiveSubProjects do:[:packageID |
             s nextPutLine:'@echo "***********************************"'.
-            s nextPutLine:'@echo "Buildung ',(packageID copyReplaceAll:$: with:$/) , '"'.
+            s nextPutLine:'@echo "Building ',(packageID copyReplaceAll:$: with:$/).
             s nextPutLine:'@echo "***********************************"'.
             s nextPutLine:'@pushd ', (self msdosPathToPackage:packageID from:(self package)).
             s nextPutAll:'@'; nextPutAll:callString; nextPutLine:' || exit /b "%errorlevel%"'.
--- a/SmallInteger.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/SmallInteger.st	Tue Mar 29 08:38:24 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
@@ -127,7 +129,10 @@
 
 maxBytes
     "return the number of bytes in instances of me.
-     For very special uses only - not constant across implementations"
+     For very special uses only - not constant across implementations.
+     Notice: this is inlined by the compiler(s) as a constant,
+     therefore, a query like 'SmallInteger maxBytes == 8'
+     costs nothing; it is compiled in as a constant."
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
--- a/Smalltalk.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/Smalltalk.st	Tue Mar 29 08:38:24 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
@@ -8191,13 +8193,13 @@
     (lang == #de) ifTrue:[
         proto := 'Willkommen bei %1 (%4Version %2 von %3)'. bit := 'Bit'.
     ] ifFalse:[ (lang == #fr) ifTrue:[
-        proto := 'Salut, Bienvenue à %1 (%4version %2 de %3)'
+        proto := 'Salut, Bienvenue à %1 (%4version %2 de %3)'
     ] ifFalse:[ (lang == #it) ifTrue:[
         proto := 'Ciao, benvenuto al %1 (%4versione %2 di %3)'
     ] ifFalse:[ (lang == #es) ifTrue:[
         proto := 'Hola, bienvenida a %1 (%4version %2 de %3)'
     ] ifFalse:[ (lang == #pt) ifTrue:[
-        proto := 'Ol!!, mem-vindo a %1 (%4version %2 de %3)'
+        proto := 'Olá!!, mem-vindo a %1 (%4version %2 de %3)'
     ] ifFalse:[ (lang == #no) ifTrue:[
         proto := 'Hei, verdenmottakelse til %1 (%4versjon %2 av %3)'
     ]]]]]].
@@ -8207,8 +8209,8 @@
     proto isNil ifTrue:[
         proto := 'Hello World - welcome to %1 (%4version %2 of %3)'.
     ].
-    ExternalBytes sizeofPointer ~~ 4 ifTrue:[
-        bitsPerWordString := (ExternalBytes sizeofPointer * 8) printString,bit,' '.
+    ExternalAddress pointerSize ~~ 4 ifTrue:[
+        bitsPerWordString := (ExternalAddress pointerSize * 8) printString,bit,' '.
     ] ifFalse:[
         bitsPerWordString := ''
     ].        
--- a/UserPreferences.st	Sat Mar 26 07:56:10 2016 +0000
+++ b/UserPreferences.st	Tue Mar 29 08:38:24 2016 +0100
@@ -588,7 +588,7 @@
           nextPutLine:'  ParserFlags stcCompilationOptions: ' , (ParserFlags stcCompilationOptions storeString) , '.';
           nextPutLine:'  ParserFlags ccCompilationOptions: ' , (ParserFlags ccCompilationOptions storeString) , '.';
           nextPutLine:'  ParserFlags makeCommand: ' , (ParserFlags makeCommand storeString) , '.';
-          nextPutLine:'  ExternalBytes sizeofPointer = ' , (ExternalBytes sizeofPointer storeString) , ' ifTrue:[';
+          nextPutLine:'  ExternalAddress pointerSize = ' , (ExternalAddress pointerSize storeString) , ' ifTrue:[';
           nextPutLine:'    ParserFlags stcCompilationIncludes: ' , (ParserFlags stcCompilationIncludes storeString) , '.';
           nextPutLine:'    ',(ParserFlags stcModulePath ? 'modules') storeString , ' asFilename exists ifTrue:[';
           nextPutLine:'      ParserFlags stcModulePath: ' , (ParserFlags stcModulePath ? 'modules') storeString , '.';