--- a/Win32OperatingSystem.st Fri Jul 18 12:20:32 2008 +0200
+++ b/Win32OperatingSystem.st Mon Jul 21 12:48:57 2008 +0200
@@ -1,7 +1,7 @@
"
COPYRIGHT (c) 1988 by Claus Gittinger
COPYRIGHT (c) 1998-2004 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -13,161 +13,161 @@
"{ Package: 'stx:libbasic' }"
AbstractOperatingSystem subclass:#Win32OperatingSystem
- instanceVariableNames:''
- classVariableNames:'HostName DomainName CurrentDirectory'
- poolDictionaries:''
- category:'OS-Windows'
+ instanceVariableNames:''
+ classVariableNames:'HostName DomainName CurrentDirectory'
+ poolDictionaries:''
+ category:'OS-Windows'
!
ByteArray variableByteSubclass:#DevModeStructure
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
ByteArray variableByteSubclass:#DocInfoStructure
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
Object subclass:#FileStatusInfo
- instanceVariableNames:'type mode uid gid size id accessed modified created statusChanged
- path fullName alternativeName'
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:'type mode uid gid size id accessed modified created statusChanged
+ path fullName alternativeName'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
Object subclass:#OSProcessStatus
- instanceVariableNames:'pid status code core'
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:'pid status code core'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
Object subclass:#PerformanceData
- instanceVariableNames:'objectArray perfTime perfFreq perfTime100nSec'
- classVariableNames:'PerformanceText CounterIndexTextDictionary
- HelpIndexTextDictionary'
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:'objectArray perfTime perfFreq perfTime100nSec'
+ classVariableNames:'PerformanceText CounterIndexTextDictionary
+ HelpIndexTextDictionary'
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
Object subclass:#Abstract
- instanceVariableNames:'lastData lastTimestamp cachedResults'
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem::PerformanceData
+ instanceVariableNames:'lastData lastTimestamp cachedResults'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem::PerformanceData
!
Win32OperatingSystem::PerformanceData::Abstract subclass:#DiskIO
- instanceVariableNames:''
- classVariableNames:'TheOneAndOnlyInstance'
- poolDictionaries:''
- privateIn:Win32OperatingSystem::PerformanceData
+ instanceVariableNames:''
+ classVariableNames:'TheOneAndOnlyInstance'
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem::PerformanceData
!
Win32OperatingSystem::PerformanceData::Abstract subclass:#Global
- instanceVariableNames:''
- classVariableNames:'TheOneAndOnlyInstance'
- poolDictionaries:''
- privateIn:Win32OperatingSystem::PerformanceData
+ instanceVariableNames:''
+ classVariableNames:'TheOneAndOnlyInstance'
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem::PerformanceData
!
Win32OperatingSystem::PerformanceData::Abstract subclass:#Memory
- instanceVariableNames:''
- classVariableNames:'TheOneAndOnlyInstance'
- poolDictionaries:''
- privateIn:Win32OperatingSystem::PerformanceData
+ instanceVariableNames:''
+ classVariableNames:'TheOneAndOnlyInstance'
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem::PerformanceData
!
Win32OperatingSystem::PerformanceData::Abstract subclass:#Network
- instanceVariableNames:''
- classVariableNames:'TheOneAndOnlyInstance'
- poolDictionaries:''
- privateIn:Win32OperatingSystem::PerformanceData
+ instanceVariableNames:''
+ classVariableNames:'TheOneAndOnlyInstance'
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem::PerformanceData
!
Win32OperatingSystem::PerformanceData::Abstract subclass:#Process
- instanceVariableNames:''
- classVariableNames:'TheOneAndOnlyInstance'
- poolDictionaries:''
- privateIn:Win32OperatingSystem::PerformanceData
+ instanceVariableNames:''
+ classVariableNames:'TheOneAndOnlyInstance'
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem::PerformanceData
!
Win32OperatingSystem::PerformanceData::Abstract subclass:#Processor
- instanceVariableNames:''
- classVariableNames:'TheOneAndOnlyInstance'
- poolDictionaries:''
- privateIn:Win32OperatingSystem::PerformanceData
+ instanceVariableNames:''
+ classVariableNames:'TheOneAndOnlyInstance'
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem::PerformanceData
!
ByteArray variableByteSubclass:#PrinterInfo2Structure
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
Object subclass:#RegistryEntry
- instanceVariableNames:'path handle'
- classVariableNames:'Lobby HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE
- HKEY_USERS HKEY_PERFORMANCE_DATA HKEY_CURRENT_CONFIG
- HKEY_DYN_DATA HKEY_PERFORMANCE_TEXT HKEY_PERFORMANCE_NLSTEXT'
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:'path handle'
+ classVariableNames:'Lobby HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE
+ HKEY_USERS HKEY_PERFORMANCE_DATA HKEY_CURRENT_CONFIG
+ HKEY_DYN_DATA HKEY_PERFORMANCE_TEXT HKEY_PERFORMANCE_NLSTEXT'
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
ByteArray variableByteSubclass:#TextMetricsStructure
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
OSHandle subclass:#Win32IOHandle
- instanceVariableNames:''
- classVariableNames:'Lobby'
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:''
+ classVariableNames:'Lobby'
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
Win32Handle subclass:#Win32PrinterHandle
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
Win32Handle subclass:#Win32ProcessHandle
- instanceVariableNames:'pid'
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:'pid'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
Win32OperatingSystem::Win32IOHandle subclass:#Win32SerialPortHandle
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
Win32OperatingSystem::Win32IOHandle subclass:#Win32SocketHandle
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
ByteArray variableByteSubclass:#WinPointStructure
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:Win32OperatingSystem
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:Win32OperatingSystem
!
!Win32OperatingSystem primitiveDefinitions!
@@ -461,48 +461,48 @@
tv.tv_usec = 0;
if (readMode) {
- n = select (sock + 1, & fds, NULL, NULL, & tv);
+ n = select (sock + 1, & fds, NULL, NULL, & tv);
} else {
- n = select (sock + 1, NULL, & fds, NULL, & tv);
+ n = select (sock + 1, NULL, & fds, NULL, & tv);
}
if (n == 0) {
- return (0);
+ return (0);
}
if (n > 0) {
- return ((FD_ISSET (sock, & fds)) ? 1 : 0);
+ return ((FD_ISSET (sock, & fds)) ? 1 : 0);
}
winErrNo = WSAGetLastError();
switch (winErrNo) {
- case WSAENOTSOCK:
- if (readMode) {
-
- DWORD w = 0;
- HANDLE h = (HANDLE) _get_osfhandle (aFD);
-
- if (PeekNamedPipe (h, 0, 0, 0, & w, 0)) {
- if( !__isWinNT || w > 0 )
- return (1);
-
- return (0);
- }
+ case WSAENOTSOCK:
+ if (readMode) {
+
+ DWORD w = 0;
+ HANDLE h = (HANDLE) _get_osfhandle (aFD);
+
+ if (PeekNamedPipe (h, 0, 0, 0, & w, 0)) {
+ if( !__isWinNT || w > 0 )
+ return (1);
+
+ return (0);
+ }
#if 0
- console_fprintf(stderr, "_canAccessIOWithoutBlocking non Socket\n");
-#endif
- return (-1);
- }
- /* in writeMode we return allways true for none-sockets */
- return (1);
-
- case WSAEINPROGRESS:
- case WSAEWOULDBLOCK:
- return (0);
-
- default:
- console_fprintf(stderr, "_canAccessIOWithoutBlocking -> %d (0x%x)\n", winErrNo, winErrNo);
- return (-1);
+ console_fprintf(stderr, "_canAccessIOWithoutBlocking non Socket\n");
+#endif
+ return (-1);
+ }
+ /* in writeMode we return allways true for none-sockets */
+ return (1);
+
+ case WSAEINPROGRESS:
+ case WSAEWOULDBLOCK:
+ return (0);
+
+ default:
+ console_fprintf(stderr, "_canAccessIOWithoutBlocking -> %d (0x%x)\n", winErrNo, winErrNo);
+ return (-1);
}
/* not reached */
@@ -523,7 +523,7 @@
static HINSTANCE handle = NULL;
if (handle == NULL) {
- handle = LoadLibrary("KERNEL32.DLL");
+ handle = LoadLibrary("KERNEL32.DLL");
}
entry = GetProcAddress(handle, functionName);
return entry;
@@ -540,7 +540,7 @@
static HINSTANCE handle2 = NULL;
if (handle2 == NULL) {
- handle2 = LoadLibrary("iphlpapi.DLL");
+ handle2 = LoadLibrary("iphlpapi.DLL");
}
entry = GetProcAddress(handle2, functionName);
return entry;
@@ -555,7 +555,7 @@
"
COPYRIGHT (c) 1988 by Claus Gittinger
COPYRIGHT (c) 1998-2004 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -585,90 +585,90 @@
[Class variables:]
- HostName <String> remembered hostname
-
- DomainName <String> remembered domainname
-
- CurrentDirectory <String> remembered currentDirectories path
+ HostName <String> remembered hostname
+
+ DomainName <String> remembered domainname
+
+ CurrentDirectory <String> remembered currentDirectories path
[author:]
- Claus Gittinger (initial version & cleanup)
- Manfred Dierolf (many features)
+ Claus Gittinger (initial version & cleanup)
+ Manfred Dierolf (many features)
[see also:]
- OSProcessStatus
- Filename Date Time
- ExternalStream FileStream PipeStream Socket
+ OSProcessStatus
+ Filename Date Time
+ ExternalStream FileStream PipeStream Socket
"
!
examples
"
various queries
- [exBegin]
+ [exBegin]
Transcript
- showCR:'hello ' , (OperatingSystem getLoginName)
- [exEnd]
-
- [exBegin]
+ showCR:'hello ' , (OperatingSystem getLoginName)
+ [exEnd]
+
+ [exBegin]
OperatingSystem isUNIXlike ifTrue:[
- Transcript showCR:'this is some UNIX-like OS'
+ Transcript showCR:'this is some UNIX-like OS'
] ifFalse:[
- Transcript showCR:'this OS is not UNIX-like'
+ Transcript showCR:'this OS is not UNIX-like'
]
- [exEnd]
-
- [exBegin]
+ [exEnd]
+
+ [exBegin]
Transcript
- showCR:'this machine is called ' , OperatingSystem getHostName
- [exEnd]
-
- [exBegin]
+ showCR:'this machine is called ' , OperatingSystem getHostName
+ [exEnd]
+
+ [exBegin]
Transcript
- showCR:('this machine is in the '
- , OperatingSystem getDomainName
- , ' domain')
- [exEnd]
-
- [exBegin]
+ showCR:('this machine is in the '
+ , OperatingSystem getDomainName
+ , ' domain')
+ [exEnd]
+
+ [exBegin]
Transcript
- showCR:('this machine''s CPU is a '
- , OperatingSystem getCPUType
- )
- [exEnd]
-
- [exBegin]
+ showCR:('this machine''s CPU is a '
+ , OperatingSystem getCPUType
+ )
+ [exEnd]
+
+ [exBegin]
Transcript showCR:'executing ls command ...'.
OperatingSystem executeCommand:'ls'.
Transcript showCR:'... done.'.
- [exEnd]
+ [exEnd]
locking a file
(should be executed on two running smalltalks - not in two threads):
- [exBegin]
+ [exBegin]
|f|
f := 'testFile' asFilename readWriteStream.
10 timesRepeat:[
- 'about to lock ...' printCR.
- [
- OperatingSystem
- lockFD:(f fileDescriptor)
- shared:false
- blocking:false
- ] whileFalse:[
- 'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
- Delay waitForSeconds:1
- ].
- 'LOCKED ...' printCR.
- Delay waitForSeconds:10.
- 'unlock ...' printCR.
- (OperatingSystem
- unlockFD:(f fileDescriptor)) printCR.
- Delay waitForSeconds:3.
+ 'about to lock ...' printCR.
+ [
+ OperatingSystem
+ lockFD:(f fileDescriptor)
+ shared:false
+ blocking:false
+ ] whileFalse:[
+ 'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
+ Delay waitForSeconds:1
+ ].
+ 'LOCKED ...' printCR.
+ Delay waitForSeconds:10.
+ 'unlock ...' printCR.
+ (OperatingSystem
+ unlockFD:(f fileDescriptor)) printCR.
+ Delay waitForSeconds:3.
]
- [exBegin]
+ [exBegin]
"
! !
@@ -686,9 +686,9 @@
GetVersionEx (&osvi);
if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
- __isWinNT = 1;
+ __isWinNT = 1;
} else {
- __isWinNT = 0;
+ __isWinNT = 0;
}
%}.
!
@@ -710,14 +710,14 @@
"catch image restart and flush some cached data"
something == #earlyRestart ifTrue:[
- "
- flush cached data
- "
- HostName := nil.
- DomainName := nil.
- LastErrorNumber := nil.
- PipeFailed := false.
- self initOSType
+ "
+ flush cached data
+ "
+ HostName := nil.
+ DomainName := nil.
+ LastErrorNumber := nil.
+ PipeFailed := false.
+ self initOSType
]
"Modified: 22.4.1996 / 13:10:43 / cg"
@@ -1298,16 +1298,16 @@
|logFilePath|
aFilenameOrNil notNil ifTrue:[
- logFilePath := aFilenameOrNil asFilename pathName
+ logFilePath := aFilenameOrNil asFilename pathName
].
%{
extern void __win32_setLogFile();
if (__isString(logFilePath)) {
- __win32_setLogFile(__stringVal(logFilePath));
+ __win32_setLogFile(__stringVal(logFilePath));
} else {
- __win32_setLogFile( NULL );
+ __win32_setLogFile( NULL );
}
%}
@@ -1326,14 +1326,14 @@
!Win32OperatingSystem class methodsFor:'clipboard'!
clipboardContainsBitmap
- "Answer whether the clipboard contains a bitmap."
+ "Answer whether the clipboard contains a bitmap."
^self clipboardContainsFormat: 2 "CfBitmap"
!
clipboardContainsFormat: aCfConstant
- "Answer true if the clipboard contains data in
- the format described by aCfConstant. "
+ "Answer true if the clipboard contains data in
+ the format described by aCfConstant. "
^self primIsClipboardFormatAvailable: aCfConstant
!
@@ -1346,7 +1346,7 @@
!
emptyClipboard
- "Private - empty the clipboard. Note: it must be opened first."
+ "Private - empty the clipboard. Note: it must be opened first."
| result |
result := self primEmptyClipboard.
result ifFalse: [ ^self error].
@@ -1407,7 +1407,7 @@
!
setBitmapToClipboard: aBitmap
- "Copy aBitmap to the clipboard."
+ "Copy aBitmap to the clipboard."
| handle |
aBitmap isNil ifTrue:[ ^nil ].
aBitmap id isNil ifTrue:[aBitmap onDevice: Screen current].
@@ -1419,7 +1419,7 @@
self closeClipboard
"
- self setBitmapToClipboard: Image fromUser
+ self setBitmapToClipboard: Image fromUser
"
!
@@ -2322,207 +2322,207 @@
*/
#ifdef ERROR_INVALID_FUNCTION
if (sym == @symbol(ERROR_INVALID_FUNCTION)) {
- RETURN ( __mkSmallInteger(ERROR_INVALID_FUNCTION) );
+ RETURN ( __mkSmallInteger(ERROR_INVALID_FUNCTION) );
}
#endif
#ifdef ERROR_BAD_FORMAT
if (sym == @symbol(ERROR_BAD_FORMAT)) {
- RETURN ( __mkSmallInteger(ERROR_BAD_FORMAT) );
+ RETURN ( __mkSmallInteger(ERROR_BAD_FORMAT) );
}
#endif
#ifdef ERROR_FILE_NOT_FOUND
if (sym == @symbol(ERROR_FILE_NOT_FOUND)) {
- RETURN ( __mkSmallInteger(ERROR_FILE_NOT_FOUND) );
+ RETURN ( __mkSmallInteger(ERROR_FILE_NOT_FOUND) );
}
#endif
#ifdef ERROR_PATH_NOT_FOUND
if (sym == @symbol(ERROR_PATH_NOT_FOUND)) {
- RETURN ( __mkSmallInteger(ERROR_PATH_NOT_FOUND) );
+ RETURN ( __mkSmallInteger(ERROR_PATH_NOT_FOUND) );
}
#endif
#ifdef ERROR_TOO_MANY_OPEN_FILES
if (sym == @symbol(ERROR_TOO_MANY_OPEN_FILES)) {
- RETURN ( __mkSmallInteger(ERROR_TOO_MANY_OPEN_FILES) );
+ RETURN ( __mkSmallInteger(ERROR_TOO_MANY_OPEN_FILES) );
}
#endif
#ifdef ERROR_OPEN_FAILED
if (sym == @symbol(ERROR_OPEN_FAILED)) {
- RETURN ( __mkSmallInteger(ERROR_OPEN_FAILED) );
+ RETURN ( __mkSmallInteger(ERROR_OPEN_FAILED) );
}
#endif
#ifdef ERROR_ACCESS_DENIED
if (sym == @symbol(ERROR_ACCESS_DENIED)) {
- RETURN ( __mkSmallInteger(ERROR_ACCESS_DENIED) );
+ RETURN ( __mkSmallInteger(ERROR_ACCESS_DENIED) );
}
#endif
#ifdef ERROR_INVALID_HANDLE
if (sym == @symbol(ERROR_INVALID_HANDLE)) {
- RETURN ( __mkSmallInteger(ERROR_INVALID_HANDLE) );
+ RETURN ( __mkSmallInteger(ERROR_INVALID_HANDLE) );
}
#endif
#ifdef ERROR_NOT_ENOUGH_MEMORY
if (sym == @symbol(ERROR_NOT_ENOUGH_MEMORY)) {
- RETURN ( __mkSmallInteger(ERROR_NOT_ENOUGH_MEMORY) );
+ RETURN ( __mkSmallInteger(ERROR_NOT_ENOUGH_MEMORY) );
}
#endif
#ifdef ERROR_INVALID_ACCESS
if (sym == @symbol(ERROR_INVALID_ACCESS)) {
- RETURN ( __mkSmallInteger(ERROR_INVALID_ACCESS) );
+ RETURN ( __mkSmallInteger(ERROR_INVALID_ACCESS) );
}
#endif
#ifdef ERROR_INVALID_DATA
if (sym == @symbol(ERROR_INVALID_DATA)) {
- RETURN ( __mkSmallInteger(ERROR_INVALID_DATA) );
+ RETURN ( __mkSmallInteger(ERROR_INVALID_DATA) );
}
#endif
#ifdef ERROR_INVALID_NAME
if (sym == @symbol(ERROR_INVALID_NAME)) {
- RETURN ( __mkSmallInteger(ERROR_INVALID_NAME) );
+ RETURN ( __mkSmallInteger(ERROR_INVALID_NAME) );
}
#endif
#ifdef ERROR_ARENA_TRASHED
if (sym == @symbol(ERROR_ARENA_TRASHED)) {
- RETURN ( __mkSmallInteger(ERROR_ARENA_TRASHED) );
+ RETURN ( __mkSmallInteger(ERROR_ARENA_TRASHED) );
}
#endif
#ifdef ERROR_OUTOFMEMORY
if (sym == @symbol(ERROR_OUTOFMEMORY)) {
- RETURN ( __mkSmallInteger(ERROR_OUTOFMEMORY) );
+ RETURN ( __mkSmallInteger(ERROR_OUTOFMEMORY) );
}
#endif
#ifdef ERROR_BROKEN_PIPE
if (sym == @symbol(ERROR_BROKEN_PIPE)) {
- RETURN ( __mkSmallInteger(ERROR_BROKEN_PIPE) );
+ RETURN ( __mkSmallInteger(ERROR_BROKEN_PIPE) );
}
#endif
#ifdef ERROR_GEN_FAILURE
if (sym == @symbol(ERROR_GEN_FAILURE)) {
- RETURN ( __mkSmallInteger(ERROR_GEN_FAILURE) );
+ RETURN ( __mkSmallInteger(ERROR_GEN_FAILURE) );
}
#endif
#ifdef ERROR_WRITE_PROTECT
if (sym == @symbol(ERROR_WRITE_PROTECT)) {
- RETURN ( __mkSmallInteger(ERROR_WRITE_PROTECT) );
+ RETURN ( __mkSmallInteger(ERROR_WRITE_PROTECT) );
}
#endif
#ifdef ERROR_WRITE_FAULT
if (sym == @symbol(ERROR_WRITE_FAULT)) {
- RETURN ( __mkSmallInteger(ERROR_WRITE_FAULT) );
+ RETURN ( __mkSmallInteger(ERROR_WRITE_FAULT) );
}
#endif
#ifdef ERROR_READ_FAULT
if (sym == @symbol(ERROR_READ_FAULT)) {
- RETURN ( __mkSmallInteger(ERROR_READ_FAULT) );
+ RETURN ( __mkSmallInteger(ERROR_READ_FAULT) );
}
#endif
#ifdef ERROR_HANDLE_DISK_FULL
if (sym == @symbol(ERROR_HANDLE_DISK_FULL)) {
- RETURN ( __mkSmallInteger(ERROR_HANDLE_DISK_FULL) );
+ RETURN ( __mkSmallInteger(ERROR_HANDLE_DISK_FULL) );
}
#endif
#ifdef ERROR_DISK_FULL
if (sym == @symbol(ERROR_DISK_FULL)) {
- RETURN ( __mkSmallInteger(ERROR_DISK_FULL) );
+ RETURN ( __mkSmallInteger(ERROR_DISK_FULL) );
}
#endif
#ifdef ERROR_ERROR_SHARING_VIOLATION
if (sym == @symbol(ERROR_ERROR_SHARING_VIOLATION)) {
- RETURN ( __mkSmallInteger(ERROR_ERROR_SHARING_VIOLATION) );
+ RETURN ( __mkSmallInteger(ERROR_ERROR_SHARING_VIOLATION) );
}
#endif
#ifdef ERROR_LOCK_VIOLATION
if (sym == @symbol(ERROR_LOCK_VIOLATION)) {
- RETURN ( __mkSmallInteger(ERROR_LOCK_VIOLATION) );
+ RETURN ( __mkSmallInteger(ERROR_LOCK_VIOLATION) );
}
#endif
#ifdef ERROR_INVALID_PARAMETER
if (sym == @symbol(ERROR_INVALID_PARAMETER)) {
- RETURN ( __mkSmallInteger(ERROR_INVALID_PARAMETER) );
+ RETURN ( __mkSmallInteger(ERROR_INVALID_PARAMETER) );
}
#endif
#ifdef ERROR_NET_WRITE_FAULT
if (sym == @symbol(ERROR_NET_WRITE_FAULT)) {
- RETURN ( __mkSmallInteger(ERROR_NET_WRITE_FAULT) );
+ RETURN ( __mkSmallInteger(ERROR_NET_WRITE_FAULT) );
}
#endif
#ifdef ERROR_NOT_SUPPORTED
if (sym == @symbol(ERROR_NOT_SUPPORTED)) {
- RETURN ( __mkSmallInteger(ERROR_NOT_SUPPORTED) );
+ RETURN ( __mkSmallInteger(ERROR_NOT_SUPPORTED) );
}
#endif
#ifdef ERROR_REM_NOT_LIST
if (sym == @symbol(ERROR_REM_NOT_LIST)) {
- RETURN ( __mkSmallInteger(ERROR_REM_NOT_LIST) );
+ RETURN ( __mkSmallInteger(ERROR_REM_NOT_LIST) );
}
#endif
#ifdef ERROR_NETWORK_ACCESS_DENIED
if (sym == @symbol(ERROR_NETWORK_ACCESS_DENIED)) {
- RETURN ( __mkSmallInteger(ERROR_NETWORK_ACCESS_DENIED) );
+ RETURN ( __mkSmallInteger(ERROR_NETWORK_ACCESS_DENIED) );
}
#endif
#ifdef ERROR_DUP_NAME
if (sym == @symbol(ERROR_DUP_NAME)) {
- RETURN ( __mkSmallInteger(ERROR_DUP_NAME) );
+ RETURN ( __mkSmallInteger(ERROR_DUP_NAME) );
}
#endif
#ifdef ERROR_BAD_NETPATH
if (sym == @symbol(ERROR_BAD_NETPATH)) {
- RETURN ( __mkSmallInteger(ERROR_BAD_NETPATH) );
+ RETURN ( __mkSmallInteger(ERROR_BAD_NETPATH) );
}
#endif
#ifdef ERROR_NETWORK_BUSY
if (sym == @symbol(ERROR_NETWORK_BUSY)) {
- RETURN ( __mkSmallInteger(ERROR_NETWORK_BUSY) );
+ RETURN ( __mkSmallInteger(ERROR_NETWORK_BUSY) );
}
#endif
#ifdef ERROR_DRIVE_LOCKED
if (sym == @symbol(ERROR_DRIVE_LOCKED)) {
- RETURN ( __mkSmallInteger(ERROR_DRIVE_LOCKED) );
+ RETURN ( __mkSmallInteger(ERROR_DRIVE_LOCKED) );
}
#endif
#ifdef ERROR_INVALID_DRIVE
if (sym == @symbol(ERROR_INVALID_DRIVE)) {
- RETURN ( __mkSmallInteger(ERROR_INVALID_DRIVE) );
+ RETURN ( __mkSmallInteger(ERROR_INVALID_DRIVE) );
}
#endif
#ifdef ERROR_WRONG_DISK
if (sym == @symbol(ERROR_WRONG_DISK)) {
- RETURN ( __mkSmallInteger(ERROR_WRONG_DISK) );
+ RETURN ( __mkSmallInteger(ERROR_WRONG_DISK) );
}
#endif
#ifdef ERROR_CURRENT_DIRECTORY
if (sym == @symbol(ERROR_CURRENT_DIRECTORY)) {
- RETURN ( __mkSmallInteger(ERROR_CURRENT_DIRECTORY) );
+ RETURN ( __mkSmallInteger(ERROR_CURRENT_DIRECTORY) );
}
#endif
#ifdef ERROR_CANNOT_MAKE
if (sym == @symbol(ERROR_CANNOT_MAKE)) {
- RETURN ( __mkSmallInteger(ERROR_CANNOT_MAKE) );
+ RETURN ( __mkSmallInteger(ERROR_CANNOT_MAKE) );
}
#endif
#ifdef ERROR_NO_MORE_FILES
if (sym == @symbol(ERROR_NO_MORE_FILES)) {
- RETURN ( __mkSmallInteger(ERROR_NO_MORE_FILES) );
+ RETURN ( __mkSmallInteger(ERROR_NO_MORE_FILES) );
}
#endif
#ifdef ERROR_NOT_READY
if (sym == @symbol(ERROR_NOT_READY)) {
- RETURN ( __mkSmallInteger(ERROR_NOT_READY) );
+ RETURN ( __mkSmallInteger(ERROR_NOT_READY) );
}
#endif
#ifdef ERROR_NOT_DOS_DISK
if (sym == @symbol(ERROR_NOT_DOS_DISK)) {
- RETURN ( __mkSmallInteger(ERROR_NOT_DOS_DISK) );
+ RETURN ( __mkSmallInteger(ERROR_NOT_DOS_DISK) );
}
#endif
#ifdef ERROR_OUT_OF_PAPER
if (sym == @symbol(ERROR_OUT_OF_PAPER)) {
- RETURN ( __mkSmallInteger(ERROR_OUT_OF_PAPER) );
+ RETURN ( __mkSmallInteger(ERROR_OUT_OF_PAPER) );
}
#endif
#ifdef ERROR_PRINTQ_FULL
if (sym == @symbol(ERROR_PRINTQ_FULL)) {
- RETURN ( __mkSmallInteger(ERROR_PRINTQ_FULL) );
+ RETURN ( __mkSmallInteger(ERROR_PRINTQ_FULL) );
}
#endif
@@ -2531,229 +2531,229 @@
*/
#ifdef EPERM
if (sym == @symbol(EPERM)) {
- RETURN ( __mkSmallInteger(EPERM) );
+ RETURN ( __mkSmallInteger(EPERM) );
}
#endif
#ifdef ENOENT
if (sym == @symbol(ENOENT)) {
- RETURN ( __mkSmallInteger(ENOENT) );
+ RETURN ( __mkSmallInteger(ENOENT) );
}
#endif
#ifdef ESRCH
if (sym == @symbol(ESRCH)) {
- RETURN ( __mkSmallInteger(ESRCH) );
+ RETURN ( __mkSmallInteger(ESRCH) );
}
#endif
#ifdef EINTR
if (sym == @symbol(EINTR)) {
- RETURN ( __mkSmallInteger(EINTR) );
+ RETURN ( __mkSmallInteger(EINTR) );
}
#endif
#ifdef EIO
if (sym == @symbol(EIO)) {
- RETURN ( __mkSmallInteger(EIO) );
+ RETURN ( __mkSmallInteger(EIO) );
}
#endif
#ifdef ENXIO
if (sym == @symbol(ENXIO)) {
- RETURN ( __mkSmallInteger(ENXIO) );
+ RETURN ( __mkSmallInteger(ENXIO) );
}
#endif
#ifdef E2BIG
if (sym == @symbol(E2BIG)) {
- RETURN ( __mkSmallInteger(E2BIG) );
+ RETURN ( __mkSmallInteger(E2BIG) );
}
#endif
#ifdef ENOEXEC
if (sym == @symbol(ENOEXEC)) {
- RETURN ( __mkSmallInteger(ENOEXEC) );
+ RETURN ( __mkSmallInteger(ENOEXEC) );
}
#endif
#ifdef EBADF
if (sym == @symbol(EBADF)) {
- RETURN ( __mkSmallInteger(EBADF) );
+ RETURN ( __mkSmallInteger(EBADF) );
}
#endif
#ifdef ECHILD
if (sym == @symbol(ECHILD)) {
- RETURN ( __mkSmallInteger(ECHILD) );
+ RETURN ( __mkSmallInteger(ECHILD) );
}
#endif
#if defined(EAGAIN)
if (sym == @symbol(EAGAIN)) {
- RETURN ( __mkSmallInteger(EAGAIN) );
+ RETURN ( __mkSmallInteger(EAGAIN) );
}
#endif
#ifdef ENOMEM
if (sym == @symbol(ENOMEM)) {
- RETURN ( __mkSmallInteger(ENOMEM) );
+ RETURN ( __mkSmallInteger(ENOMEM) );
}
#endif
#ifdef EACCES
if (sym == @symbol(EACCES)) {
- RETURN ( __mkSmallInteger(EACCES) );
+ RETURN ( __mkSmallInteger(EACCES) );
}
#endif
#ifdef EFAULT
if (sym == @symbol(EFAULT)) {
- RETURN ( __mkSmallInteger(EFAULT) );
+ RETURN ( __mkSmallInteger(EFAULT) );
}
#endif
#ifdef EBUSY
if (sym == @symbol(EBUSY)) {
- RETURN ( __mkSmallInteger(EBUSY) );
+ RETURN ( __mkSmallInteger(EBUSY) );
}
#endif
#ifdef EXDEV
if (sym == @symbol(EXDEV)) {
- RETURN ( __mkSmallInteger(EXDEV) );
+ RETURN ( __mkSmallInteger(EXDEV) );
}
#endif
#ifdef ENODEV
if (sym == @symbol(ENODEV)) {
- RETURN ( __mkSmallInteger(ENODEV) );
+ RETURN ( __mkSmallInteger(ENODEV) );
}
#endif
#ifdef ENOTDIR
if (sym == @symbol(ENOTDIR)) {
- RETURN ( __mkSmallInteger(ENOTDIR) );
+ RETURN ( __mkSmallInteger(ENOTDIR) );
}
#endif
#ifdef EISDIR
if (sym == @symbol(EISDIR)) {
- RETURN ( __mkSmallInteger(EISDIR) );
+ RETURN ( __mkSmallInteger(EISDIR) );
}
#endif
#ifdef EINVAL
if (sym == @symbol(EINVAL)) {
- RETURN ( __mkSmallInteger(EINVAL) );
+ RETURN ( __mkSmallInteger(EINVAL) );
}
#endif
#ifdef ENFILE
if (sym == @symbol(ENFILE)) {
- RETURN ( __mkSmallInteger(ENFILE) );
+ RETURN ( __mkSmallInteger(ENFILE) );
}
#endif
#ifdef EMFILE
if (sym == @symbol(EMFILE)) {
- RETURN ( __mkSmallInteger(EMFILE) );
+ RETURN ( __mkSmallInteger(EMFILE) );
}
#endif
#ifdef ENOTTY
if (sym == @symbol(ENOTTY)) {
- RETURN ( __mkSmallInteger(ENOTTY) );
+ RETURN ( __mkSmallInteger(ENOTTY) );
}
#endif
#ifdef EFBIG
if (sym == @symbol(EFBIG)) {
- RETURN ( __mkSmallInteger(EFBIG) );
+ RETURN ( __mkSmallInteger(EFBIG) );
}
#endif
#ifdef ENOSPC
if (sym == @symbol(ENOSPC)) {
- RETURN ( __mkSmallInteger(ENOSPC) );
+ RETURN ( __mkSmallInteger(ENOSPC) );
}
#endif
#ifdef ESPIPE
if (sym == @symbol(ESPIPE)) {
- RETURN ( __mkSmallInteger(ESPIPE) );
+ RETURN ( __mkSmallInteger(ESPIPE) );
}
#endif
#ifdef EROFS
if (sym == @symbol(EROFS)) {
- RETURN ( __mkSmallInteger(EROFS) );
+ RETURN ( __mkSmallInteger(EROFS) );
}
#endif
#ifdef EMLINK
if (sym == @symbol(EMLINK)) {
- RETURN ( __mkSmallInteger(EMLINK) );
+ RETURN ( __mkSmallInteger(EMLINK) );
}
#endif
#ifdef EPIPE
if (sym == @symbol(EPIPE)) {
- RETURN ( __mkSmallInteger(EPIPE) );
+ RETURN ( __mkSmallInteger(EPIPE) );
}
#endif
#ifdef EDOM
if (sym == @symbol(EDOM)) {
- RETURN ( __mkSmallInteger(EDOM) );
+ RETURN ( __mkSmallInteger(EDOM) );
}
#endif
#ifdef ERANGE
if (sym == @symbol(ERANGE)) {
- RETURN ( __mkSmallInteger(ERANGE) );
+ RETURN ( __mkSmallInteger(ERANGE) );
}
#endif
#ifdef EDEADLK
if (sym == @symbol(EDEADLK)) {
- RETURN ( __mkSmallInteger(EDEADLK) );
+ RETURN ( __mkSmallInteger(EDEADLK) );
}
#endif
#ifdef ENAMETOOLONG
if (sym == @symbol(ENAMETOOLONG)) {
- RETURN ( __mkSmallInteger(ENAMETOOLONG) );
+ RETURN ( __mkSmallInteger(ENAMETOOLONG) );
}
#endif
#ifdef ENOLCK
if (sym == @symbol(ENOLCK)) {
- RETURN ( __mkSmallInteger(ENOLCK) );
+ RETURN ( __mkSmallInteger(ENOLCK) );
}
#endif
#ifdef ENOSYS
if (sym == @symbol(ENOSYS)) {
- RETURN ( __mkSmallInteger(ENOSYS) );
+ RETURN ( __mkSmallInteger(ENOSYS) );
}
#endif
#ifdef ENOTEMPTY
if (sym == @symbol(ENOTEMPTY)) {
- RETURN ( __mkSmallInteger(ENOTEMPTY) );
+ RETURN ( __mkSmallInteger(ENOTEMPTY) );
}
#endif
#ifdef EEXIST
if (sym == @symbol(EEXIST)) {
- RETURN ( __mkSmallInteger(EEXIST) );
+ RETURN ( __mkSmallInteger(EEXIST) );
}
#endif
#ifdef EILSEQ
if (sym == @symbol(EILSEQ)) {
- RETURN ( __mkSmallInteger(EILSEQ) );
+ RETURN ( __mkSmallInteger(EILSEQ) );
}
#endif
@@ -2762,13 +2762,13 @@
*/
#ifdef ENOTBLK
if (sym == @symbol(ENOTBLK)) {
- RETURN ( __mkSmallInteger(ENOTBLK) );
+ RETURN ( __mkSmallInteger(ENOTBLK) );
}
#endif
#ifdef ETXTBSY
if (sym == @symbol(ETXTBSY)) {
- RETURN ( __mkSmallInteger(ETXTBSY) );
+ RETURN ( __mkSmallInteger(ETXTBSY) );
}
#endif
@@ -2777,19 +2777,19 @@
*/
#ifdef EWOULDBLOCK
if (sym == @symbol(EWOULDBLOCK)) {
- RETURN ( __mkSmallInteger(EWOULDBLOCK) );
+ RETURN ( __mkSmallInteger(EWOULDBLOCK) );
}
#endif
#ifdef ENOMSG
if (sym == @symbol(ENOMSG)) {
- RETURN ( __mkSmallInteger(ENOMSG) );
+ RETURN ( __mkSmallInteger(ENOMSG) );
}
#endif
#ifdef ELOOP
if (sym == @symbol(ELOOP)) {
- RETURN ( __mkSmallInteger(ELOOP) );
+ RETURN ( __mkSmallInteger(ELOOP) );
}
#endif
@@ -2798,31 +2798,31 @@
*/
#ifdef ETIME
if (sym == @symbol(ETIME)) {
- RETURN ( __mkSmallInteger(ETIME) );
+ RETURN ( __mkSmallInteger(ETIME) );
}
#endif
#ifdef ENOSR
if (sym == @symbol(ENOSR)) {
- RETURN ( __mkSmallInteger(ENOSR) );
+ RETURN ( __mkSmallInteger(ENOSR) );
}
#endif
#ifdef ENOSTR
if (sym == @symbol(ENOSTR)) {
- RETURN ( __mkSmallInteger(ENOSTR) );
+ RETURN ( __mkSmallInteger(ENOSTR) );
}
#endif
#ifdef ECOMM
if (sym == @symbol(ECOMM)) {
- RETURN ( __mkSmallInteger(ECOMM) );
+ RETURN ( __mkSmallInteger(ECOMM) );
}
#endif
#ifdef EPROTO
if (sym == @symbol(EPROTO)) {
- RETURN ( __mkSmallInteger(EPROTO) );
+ RETURN ( __mkSmallInteger(EPROTO) );
}
#endif
@@ -2831,13 +2831,13 @@
*/
#ifdef ESTALE
if (sym == @symbol(ESTALE)) {
- RETURN ( __mkSmallInteger(ESTALE) );
+ RETURN ( __mkSmallInteger(ESTALE) );
}
#endif
#ifdef EREMOTE
if (sym == @symbol(EREMOTE)) {
- RETURN ( __mkSmallInteger(EREMOTE) );
+ RETURN ( __mkSmallInteger(EREMOTE) );
}
#endif
@@ -2846,157 +2846,157 @@
*/
#ifdef EINPROGRESS
if (sym == @symbol(EINPROGRESS)) {
- RETURN ( __mkSmallInteger(EINPROGRESS) );
+ RETURN ( __mkSmallInteger(EINPROGRESS) );
}
#endif
#ifdef EALREADY
if (sym == @symbol(EALREADY)) {
- RETURN ( __mkSmallInteger(EALREADY) );
+ RETURN ( __mkSmallInteger(EALREADY) );
}
#endif
#ifdef ENOTSOCK
if (sym == @symbol(ENOTSOCK)) {
- RETURN ( __mkSmallInteger(ENOTSOCK) );
+ RETURN ( __mkSmallInteger(ENOTSOCK) );
}
#endif
#ifdef EDESTADDRREQ
if (sym == @symbol(EDESTADDRREQ)) {
- RETURN ( __mkSmallInteger(EDESTADDRREQ) );
+ RETURN ( __mkSmallInteger(EDESTADDRREQ) );
}
#endif
#ifdef EMSGSIZE
if (sym == @symbol(EMSGSIZE)) {
- RETURN ( __mkSmallInteger(EMSGSIZE) );
+ RETURN ( __mkSmallInteger(EMSGSIZE) );
}
#endif
#ifdef EPROTOTYPE
if (sym == @symbol(EPROTOTYPE)) {
- RETURN ( __mkSmallInteger(EPROTOTYPE) );
+ RETURN ( __mkSmallInteger(EPROTOTYPE) );
}
#endif
#ifdef ENOPROTOOPT
if (sym == @symbol(ENOPROTOOPT)) {
- RETURN ( __mkSmallInteger(ENOPROTOOPT) );
+ RETURN ( __mkSmallInteger(ENOPROTOOPT) );
}
#endif
#ifdef EPROTONOSUPPORT
if (sym == @symbol(EPROTONOSUPPORT)) {
- RETURN ( __mkSmallInteger(EPROTONOSUPPORT) );
+ RETURN ( __mkSmallInteger(EPROTONOSUPPORT) );
}
#endif
#ifdef ESOCKTNOSUPPORT
if (sym == @symbol(ESOCKTNOSUPPORT)) {
- RETURN ( __mkSmallInteger(ESOCKTNOSUPPORT) );
+ RETURN ( __mkSmallInteger(ESOCKTNOSUPPORT) );
}
#endif
#ifdef EOPNOTSUPP
if (sym == @symbol(EOPNOTSUPP)) {
- RETURN ( __mkSmallInteger(EOPNOTSUPP) );
+ RETURN ( __mkSmallInteger(EOPNOTSUPP) );
}
#endif
#ifdef EPFNOSUPPORT
if (sym == @symbol(EPFNOSUPPORT)) {
- RETURN ( __mkSmallInteger(EPFNOSUPPORT) );
+ RETURN ( __mkSmallInteger(EPFNOSUPPORT) );
}
#endif
#ifdef EAFNOSUPPORT
if (sym == @symbol(EAFNOSUPPORT)) {
- RETURN ( __mkSmallInteger(EAFNOSUPPORT) );
+ RETURN ( __mkSmallInteger(EAFNOSUPPORT) );
}
#endif
#ifdef EADDRINUSE
if (sym == @symbol(EADDRINUSE)) {
- RETURN ( __mkSmallInteger(EADDRINUSE) );
+ RETURN ( __mkSmallInteger(EADDRINUSE) );
}
#endif
#ifdef EADDRNOTAVAIL
if (sym == @symbol(EADDRNOTAVAIL)) {
- RETURN ( __mkSmallInteger(EADDRNOTAVAIL) );
+ RETURN ( __mkSmallInteger(EADDRNOTAVAIL) );
}
#endif
#ifdef ETIMEDOUT
if (sym == @symbol(ETIMEDOUT)) {
- RETURN ( __mkSmallInteger(ETIMEDOUT) );
+ RETURN ( __mkSmallInteger(ETIMEDOUT) );
}
#endif
#ifdef ECONNREFUSED
if (sym == @symbol(ECONNREFUSED)) {
- RETURN ( __mkSmallInteger(ECONNREFUSED) );
+ RETURN ( __mkSmallInteger(ECONNREFUSED) );
}
#endif
#ifdef ENETDOWN
if (sym == @symbol(ENETDOWN)) {
- RETURN ( __mkSmallInteger(ENETDOWN) );
+ RETURN ( __mkSmallInteger(ENETDOWN) );
}
#endif
#ifdef ENETUNREACH
if (sym == @symbol(ENETUNREACH)) {
- RETURN ( __mkSmallInteger(ENETUNREACH) );
+ RETURN ( __mkSmallInteger(ENETUNREACH) );
}
#endif
#ifdef ENETRESET
if (sym == @symbol(ENETRESET)) {
- RETURN ( __mkSmallInteger(ENETRESET) );
+ RETURN ( __mkSmallInteger(ENETRESET) );
}
#endif
#ifdef ECONNABORTED
if (sym == @symbol(ECONNABORTED)) {
- RETURN ( __mkSmallInteger(ECONNABORTED) );
+ RETURN ( __mkSmallInteger(ECONNABORTED) );
}
#endif
#ifdef ECONNRESET
if (sym == @symbol(ECONNRESET)) {
- RETURN ( __mkSmallInteger(ECONNRESET) );
+ RETURN ( __mkSmallInteger(ECONNRESET) );
}
#endif
#ifdef EISCONN
if (sym == @symbol(EISCONN)) {
- RETURN ( __mkSmallInteger(EISCONN) );
+ RETURN ( __mkSmallInteger(EISCONN) );
}
#endif
#ifdef ENOTCONN
if (sym == @symbol(ENOTCONN)) {
- RETURN ( __mkSmallInteger(ENOTCONN) );
+ RETURN ( __mkSmallInteger(ENOTCONN) );
}
#endif
#ifdef ESHUTDOWN
if (sym == @symbol(ESHUTDOWN)) {
- RETURN ( __mkSmallInteger(ESHUTDOWN) );
+ RETURN ( __mkSmallInteger(ESHUTDOWN) );
}
#endif
#ifdef EHOSTDOWN
if (sym == @symbol(EHOSTDOWN)) {
- RETURN ( __mkSmallInteger(EHOSTDOWN) );
+ RETURN ( __mkSmallInteger(EHOSTDOWN) );
}
#endif
#ifdef EHOSTUNREACH
if (sym == @symbol(EHOSTUNREACH)) {
- RETURN ( __mkSmallInteger(EHOSTUNREACH) );
+ RETURN ( __mkSmallInteger(EHOSTUNREACH) );
}
#endif
/*
@@ -3004,92 +3004,92 @@
*/
#ifdef WSAEINTR
if (sym == @symbol(WSAEINTR)) {
- RETURN ( __mkSmallInteger(WSAEINTR) );
+ RETURN ( __mkSmallInteger(WSAEINTR) );
}
#endif
#ifdef WSAEBADF
if (sym == @symbol(WSAEBADF)) {
- RETURN ( __mkSmallInteger(WSAEBADF) );
+ RETURN ( __mkSmallInteger(WSAEBADF) );
}
#endif
#ifdef WSAEACCESS
if (sym == @symbol(WSAEACCESS)) {
- RETURN ( __mkSmallInteger(WSAEACCESS) );
+ RETURN ( __mkSmallInteger(WSAEACCESS) );
}
#endif
#ifdef WSAEFAULT
if (sym == @symbol(WSAEFAULT)) {
- RETURN ( __mkSmallInteger(WSAEFAULT) );
+ RETURN ( __mkSmallInteger(WSAEFAULT) );
}
#endif
#ifdef WSAEINVAL
if (sym == @symbol(WSAEINVAL)) {
- RETURN ( __mkSmallInteger(WSAEINVAL) );
+ RETURN ( __mkSmallInteger(WSAEINVAL) );
}
#endif
#ifdef WSAEMFILE
if (sym == @symbol(WSAEMFILE)) {
- RETURN ( __mkSmallInteger(WSAEMFILE) );
+ RETURN ( __mkSmallInteger(WSAEMFILE) );
}
#endif
#ifdef WSAEWOULDBLOCK
if (sym == @symbol(WSAEWOULDBLOCK)) {
- RETURN ( __mkSmallInteger(WSAEWOULDBLOCK) );
+ RETURN ( __mkSmallInteger(WSAEWOULDBLOCK) );
}
#endif
#ifdef WSAEINPROGRESS
if (sym == @symbol(WSAEINPROGRESS)) {
- RETURN ( __mkSmallInteger(WSAEINPROGRESS) );
+ RETURN ( __mkSmallInteger(WSAEINPROGRESS) );
}
#endif
#ifdef WSAEALREADY
if (sym == @symbol(WSAEALREADY)) {
- RETURN ( __mkSmallInteger(WSAEALREADY) );
+ RETURN ( __mkSmallInteger(WSAEALREADY) );
}
#endif
#ifdef WSAENOTSOCK
if (sym == @symbol(WSAENOTSOCK)) {
- RETURN ( __mkSmallInteger(WSAENOTSOCK) );
+ RETURN ( __mkSmallInteger(WSAENOTSOCK) );
}
#endif
#ifdef WSAEPROTONOSUPPORT
if (sym == @symbol(WSAEPROTONOSUPPORT)) {
- RETURN ( __mkSmallInteger(WSAEPROTONOSUPPORT) );
+ RETURN ( __mkSmallInteger(WSAEPROTONOSUPPORT) );
}
#endif
#ifdef WSAESOCKTNOSUPPORT
if (sym == @symbol(WSAESOCKTNOSUPPORT)) {
- RETURN ( __mkSmallInteger(WSAESOCKTNOSUPPORT) );
+ RETURN ( __mkSmallInteger(WSAESOCKTNOSUPPORT) );
}
#endif
#ifdef E_NOINTERFACE
if (sym == @symbol(E_NOINTERFACE)) {
- RETURN ( __MKUINT(E_NOINTERFACE) );
+ RETURN ( __MKUINT(E_NOINTERFACE) );
}
#endif
#ifdef CO_E_NOTINITIALIZED
if (sym == @symbol(CO_E_NOTINITIALIZED)) {
- RETURN ( __MKUINT(CO_E_NOTINITIALIZED) );
+ RETURN ( __MKUINT(CO_E_NOTINITIALIZED) );
}
#endif
#ifdef REGDB_E_CLASSNOTREG
if (sym == @symbol(REGDB_E_CLASSNOTREG)) {
- RETURN ( __MKUINT(REGDB_E_CLASSNOTREG) );
+ RETURN ( __MKUINT(REGDB_E_CLASSNOTREG) );
}
#endif
#ifdef CLASS_E_NOAGGREGATION
if (sym == @symbol(CLASS_E_NOAGGREGATION)) {
- RETURN ( __MKUINT(CLASS_E_NOAGGREGATION) );
+ RETURN ( __MKUINT(CLASS_E_NOAGGREGATION) );
}
#endif
#ifdef DISP_E_UNKNOWNNAME
if (sym == @symbol(DISP_E_UNKNOWNNAME)) {
- RETURN ( __MKUINT(DISP_E_UNKNOWNNAME) );
+ RETURN ( __MKUINT(DISP_E_UNKNOWNNAME) );
}
#endif
#ifdef OLEOBJ_E_NOVERBS
if (sym == @symbol(OLEOBJ_E_NOVERBS)) {
- RETURN ( __MKUINT(OLEOBJ_E_NOVERBS) );
+ RETURN ( __MKUINT(OLEOBJ_E_NOVERBS) );
}
#endif
@@ -3148,98 +3148,98 @@
"/ command.com command-line parsing here (sigh).
hasRedirection := false.
(aCommandString isNil or:[aCommandString includesAny:'<>|']) ifTrue:[
- hasRedirection := true
+ hasRedirection := true
].
self isMSWINDOWSNTlike ifTrue:[
- hasRedirection ifFalse:[
- "/ test whether the commandString is an executable;
- "/ then, no shell is required
- cmdName := aCommandString withoutSeparators.
- (cmdName notEmpty and:[(cmdName startsWith:$") not]) ifTrue:[
- |index file suffix|
-
- index := cmdName indexOfSeparatorStartingAt:1.
- index ~~ 0 ifTrue:[
- cmdName := cmdName copyFrom:1 to:(index -1).
- ].
-
- file := cmdName asFilename.
- suffix := file suffix.
-
- suffix isEmptyOrNil ifTrue:[
- suffix := 'exe'.
- file := file withSuffix:suffix.
- ].
-
- (file exists and:[suffix = 'exe']) ifTrue:[
- "/ is an executable, no shell required
- ^ Array with:nil with:aCommandString.
- ].
- (self pathOfCommand:cmdName) notNil ifTrue:[
- "/ is an executable, no shell required
- ^ Array with:nil with:aCommandString.
- ].
- ].
- ].
- shell := self getEnvironment:'COMSPEC'.
- shell isNil ifTrue:[
- wDir := self getWindowsSystemDirectory asFilename.
- shell := (wDir construct:'cmd.exe').
- shell exists ifFalse:[
- shell := (wDir construct:'command.com').
- shell exists ifFalse:[
- self error:'no command.com available'.
- ]
- ].
- shell := shell pathName.
- ].
- aCommandString isNil ifTrue:[
- ^ Array with:nil with:shell
- ].
-
- ^ Array with:nil with:(shell , ' /c ' , '"' , aCommandString , '"' )
+ hasRedirection ifFalse:[
+ "/ test whether the commandString is an executable;
+ "/ then, no shell is required
+ cmdName := aCommandString withoutSeparators.
+ (cmdName notEmpty and:[(cmdName startsWith:$") not]) ifTrue:[
+ |index file suffix|
+
+ index := cmdName indexOfSeparatorStartingAt:1.
+ index ~~ 0 ifTrue:[
+ cmdName := cmdName copyFrom:1 to:(index -1).
+ ].
+
+ file := cmdName asFilename.
+ suffix := file suffix.
+
+ suffix isEmptyOrNil ifTrue:[
+ suffix := 'exe'.
+ file := file withSuffix:suffix.
+ ].
+
+ (file exists and:[suffix = 'exe']) ifTrue:[
+ "/ is an executable, no shell required
+ ^ Array with:nil with:aCommandString.
+ ].
+ (self pathOfCommand:cmdName) notNil ifTrue:[
+ "/ is an executable, no shell required
+ ^ Array with:nil with:aCommandString.
+ ].
+ ].
+ ].
+ shell := self getEnvironment:'COMSPEC'.
+ shell isNil ifTrue:[
+ wDir := self getWindowsSystemDirectory asFilename.
+ shell := (wDir construct:'cmd.exe').
+ shell exists ifFalse:[
+ shell := (wDir construct:'command.com').
+ shell exists ifFalse:[
+ self error:'no command.com available'.
+ ]
+ ].
+ shell := shell pathName.
+ ].
+ aCommandString isNil ifTrue:[
+ ^ Array with:nil with:shell
+ ].
+
+ ^ Array with:nil with:(shell , ' /c ' , '"' , aCommandString , '"' )
].
"/ I/O redirection is not yet handled directly
"/ fallBack to command.com (below) to do it.
hasRedirection ifFalse:[
- words := aCommandString asCollectionOfSubstringsSeparatedBy:Character space.
- args := ' '.
- words from:2 to:(words size) do:[:s |
- args := args , (s , ' ').
- ].
-
- path := self pathOfCommand:(words at:1).
- path notNil ifTrue:[
- "/ execute the command directly -
- "/ without going through command.com
-
- self isMSWINDOWSNTlike ifTrue:[
- args := path , args.
- ].
-
- ^ Array with:path with:args
- ].
+ words := aCommandString asCollectionOfSubstringsSeparatedBy:Character space.
+ args := ' '.
+ words from:2 to:(words size) do:[:s |
+ args := args , (s , ' ').
+ ].
+
+ path := self pathOfCommand:(words at:1).
+ path notNil ifTrue:[
+ "/ execute the command directly -
+ "/ without going through command.com
+
+ self isMSWINDOWSNTlike ifTrue:[
+ args := path , args.
+ ].
+
+ ^ Array with:path with:args
+ ].
].
"/ I/O redirection or no executable was found
shell := self getEnvironment:'COMSPEC'.
shell isNil ifTrue:[
- wDir := self getWindowsSystemDirectory asFilename.
- shell := (wDir construct:'cmd.exe').
- shell exists ifFalse:[
- shell := (wDir construct:'command.com').
- shell exists ifFalse:[
- self error:'no command.com available'.
- ]
- ].
- shell := shell pathName.
+ wDir := self getWindowsSystemDirectory asFilename.
+ shell := (wDir construct:'cmd.exe').
+ shell exists ifFalse:[
+ shell := (wDir construct:'command.com').
+ shell exists ifFalse:[
+ self error:'no command.com available'.
+ ]
+ ].
+ shell := shell pathName.
].
aCommandString isNil ifTrue:[
- ^ Array with:shell with:shell
+ ^ Array with:shell with:shell
].
^ Array with:shell with:(shell , ' /c ' , aCommandString)
@@ -3251,56 +3251,56 @@
"Internal lowLevel entry for combined fork & exec for WIN32
If fork is false (chain a command):
- execute the OS command specified by the argument, aCommandPath, with
- arguments in argArray (no arguments, if nil).
- If successful, this method does not return and smalltalk is gone.
- If not successful, it does return.
- Normal use is with forkForCommand.
+ execute the OS command specified by the argument, aCommandPath, with
+ arguments in argArray (no arguments, if nil).
+ If successful, this method does not return and smalltalk is gone.
+ If not successful, it does return.
+ Normal use is with forkForCommand.
If fork is true (subprocess command execution):
- fork a child to do the above.
- The process id of the child process is returned; nil if the fork failed.
+ fork a child to do the above.
+ The process id of the child process is returned; nil if the fork failed.
fdArray contains the filedescriptors, to be used for the child (if fork is true).
- fdArray[1] = 15 -> use fd 15 as stdin.
- If an element of the array is set to nil, the corresponding filedescriptor
- will be closed for the child.
- fdArray[0] == StdIn for child
- fdArray[1] == StdOut for child
- fdArray[2] == StdErr for child
- on VMS, these must be channels as returned by createMailBox.
+ fdArray[1] = 15 -> use fd 15 as stdin.
+ If an element of the array is set to nil, the corresponding filedescriptor
+ will be closed for the child.
+ fdArray[0] == StdIn for child
+ fdArray[1] == StdOut for child
+ fdArray[2] == StdErr for child
+ on VMS, these must be channels as returned by createMailBox.
NOTE that in WIN32 the fds are HANDLES.
If newPgrp is true, the subprocess will be established in a new process group.
- The processgroup will be equal to id.
- newPgrp is not used on WIN32 and VMS systems."
+ The processgroup will be equal to id.
+ newPgrp is not used on WIN32 and VMS systems."
|dirPath cmdPath cmdLine rslt|
aDirectory notNil ifTrue:[
- dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
- (dirPath endsWith:':') ifTrue:[
- dirPath := dirPath , '\'.
- ].
+ dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
+ (dirPath endsWith:':') ifTrue:[
+ dirPath := dirPath , '\'.
+ ].
].
self isMSWINDOWSNTlike ifTrue:[
- cmdPath := aCommandPath.
- cmdLine := argString
+ cmdPath := aCommandPath.
+ cmdLine := argString
] ifFalse:[
- cmdPath := 'stxspawn.exe'.
- cmdLine := 'stxspawn.exe ' , aCommandPath , ' ' , argString
+ cmdPath := 'stxspawn.exe'.
+ cmdLine := 'stxspawn.exe ' , aCommandPath , ' ' , argString
].
rslt := self
- primExec:cmdPath
- commandLine:cmdLine
- fileDescriptors:fdArray
- fork:doFork
- newPgrp:newPgrp
- inPath:dirPath
- createFlags:nil.
+ primExec:cmdPath
+ commandLine:cmdLine
+ fileDescriptors:fdArray
+ fork:doFork
+ newPgrp:newPgrp
+ inPath:dirPath
+ createFlags:nil.
"/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR.
^ rslt
@@ -3318,28 +3318,28 @@
int status = -1;
if (__isExternalAddressLike(aProcessId)) {
- HANDLE handle = _HANDLEVal(aProcessId);
- if (handle) {
+ HANDLE handle = _HANDLEVal(aProcessId);
+ if (handle) {
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- endStatus = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, handle, INFINITE);
- } while ((endStatus < 0) && (__threadErrno == EINTR));
-#else
- endStatus = WaitForSingleObject(handle , INFINITE);
-#endif
- if (endStatus != WAIT_FAILED) {
- if (GetExitCodeProcess(handle,&endStatus)) {
- status = endStatus;
+ do {
+ __threadErrno = 0;
+ endStatus = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, handle, INFINITE);
+ } while ((endStatus < 0) && (__threadErrno == EINTR));
+#else
+ endStatus = WaitForSingleObject(handle , INFINITE);
+#endif
+ if (endStatus != WAIT_FAILED) {
+ if (GetExitCodeProcess(handle,&endStatus)) {
+ status = endStatus;
#ifdef PROCESSDEBUGWIN32
- console_fprintf(stderr, "getexitcode status = %d\n",status);
- } else {
- console_fprintf(stderr, "getexitcode failed.\n");
-#endif
- }
- }
- }
- RETURN ( __mkSmallInteger(status));
+ console_fprintf(stderr, "getexitcode status = %d\n",status);
+ } else {
+ console_fprintf(stderr, "getexitcode failed.\n");
+#endif
+ }
+ }
+ }
+ RETURN ( __mkSmallInteger(status));
}
%}.
self primitiveFailed
@@ -3353,45 +3353,45 @@
|path f fExt|
aCommand asFilename isAbsolute ifTrue:[
- aCommand asFilename exists ifTrue:[
- ^ aCommand
- ].
- ^ nil
+ aCommand asFilename exists ifTrue:[
+ ^ aCommand
+ ].
+ ^ nil
].
(aCommand includes:Filename separator) ifTrue:[
- path := Filename currentDirectory construct:aCommand.
- (path exists
- or:[(path withSuffix:'exe') exists]) ifTrue:[
- ^ path pathName
- ].
+ path := Filename currentDirectory construct:aCommand.
+ (path exists
+ or:[(path withSuffix:'exe') exists]) ifTrue:[
+ ^ path pathName
+ ].
].
path := self getEnvironment:'PATH'.
path notNil ifTrue:[
- (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
- path isEmpty ifTrue:[
- f := aCommand asFilename
- ] ifFalse:[
- f := path asFilename construct:aCommand.
- ].
- f suffix isEmpty ifTrue:[
- self executableFileExtensions do:[:ext |
- ext notEmpty ifTrue:[
- fExt := (f pathName , '.' , ext) asFilename.
- ] ifFalse:[
- fExt := f.
- ].
- fExt isExecutable ifTrue:[
- ^ fExt pathName
- ].
- ].
- ] ifFalse:[
- f isExecutable ifTrue:[
- ^ f pathName
- ].
- ].
- ].
+ (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
+ path isEmpty ifTrue:[
+ f := aCommand asFilename
+ ] ifFalse:[
+ f := path asFilename construct:aCommand.
+ ].
+ f suffix isEmpty ifTrue:[
+ self executableFileExtensions do:[:ext |
+ ext notEmpty ifTrue:[
+ fExt := (f pathName , '.' , ext) asFilename.
+ ] ifFalse:[
+ fExt := f.
+ ].
+ fExt isExecutable ifTrue:[
+ ^ fExt pathName
+ ].
+ ].
+ ] ifFalse:[
+ f isExecutable ifTrue:[
+ ^ f pathName
+ ].
+ ].
+ ].
].
^ nil
@@ -3436,181 +3436,181 @@
SECURITY_DESCRIPTOR sd;
if (__isString(dirName)) {
- dir = __stringVal(dirName);
+ dir = __stringVal(dirName);
}
if ((__isString(commandPath) || (commandPath == nil))
&& __isString(commandLine)) {
#if 0
- /*
- * generate command line (cmd plus args)
- */
- if (__isWinNT) {
- char *d;
-
- strcpy(fullCmdPath, __stringVal(aCommandPath));
- d = strchr(fullCmdPath,' ');
- if (d) {
- *d++ = 0;
- strcpy(fullCmdLine, d);
- } else {
- fullCmdLine[0] = '\0';
- }
- } else {
- //fullCmdPath = 0;
- strcpy(fullCmdPath,"stxspawn.exe");
- strcpy(fullCmdLine,"stxspawn.exe ");
- strcat(fullCmdLine, __stringVal(aCommandPath));
- }
-
- if (__isString(argArray)) {
- if (strlen(fullCmdLine) > 0) {
- strcat(fullCmdLine, " ");
- }
- strcat(fullCmdLine, __stringVal(argArray));
- } else {
- int i;
-
- for (i=0; i<__arraySize(argArray); i++) {
- OBJ arg = __ArrayInstPtr(argArray)->a_element[i];
-
- if (__isString(arg)) {
- strcat(fullCmdLine, " ");
- strcat(fullCmdLine, __stringVal(arg));
- } else {
- /* ignore */
- console_fprintf(stderr, "bad (non-string) arg\n");
- }
- }
- }
-#endif
- if (commandPath != nil) {
- cmdPath = __stringVal(commandPath);
- }
- cmdLine = __stringVal(commandLine);
-
- /*
- * create descriptors as req'd
- */
- memset(&sa, 0, sizeof (sa));
- sa.nLength = sizeof( sa );
- sa.lpSecurityDescriptor = NULL;
- sa.bInheritHandle = TRUE;
- if (__isWinNT) {
- InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
- SetSecurityDescriptorDacl(&sd, -1, 0, 0);
-
- sa.lpSecurityDescriptor = &sd;
- }
- memset(&lppiProcInfo, 0, sizeof (lppiProcInfo));
-
- memset(&lpsiStartInfo, 0, sizeof (lpsiStartInfo));
- lpsiStartInfo.cb = sizeof(lpsiStartInfo);
- lpsiStartInfo.lpReserved = NULL;
- lpsiStartInfo.lpDesktop = NULL;
- lpsiStartInfo.lpTitle = NULL;
- lpsiStartInfo.dwX = 0;
- lpsiStartInfo.dwY = 0;
- lpsiStartInfo.dwXSize = 100;
- lpsiStartInfo.dwYSize = 100;
- lpsiStartInfo.dwXCountChars = 0;
- lpsiStartInfo.dwYCountChars = 0;
- lpsiStartInfo.dwFillAttribute = 0;
- if (0 /*__isWinNT*/) {
- lpsiStartInfo.dwFlags = STARTF_USESTDHANDLES;
- lpsiStartInfo.wShowWindow = SW_SHOWDEFAULT;
- } else {
- lpsiStartInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES /*| STARTF_USEPOSITION*/;
- lpsiStartInfo.wShowWindow = SW_HIDE /*SW_SHOWDEFAULT*/;
- }
- lpsiStartInfo.cbReserved2 = 0;
- lpsiStartInfo.lpReserved2 = NULL;
- lpsiStartInfo.hStdInput = NULL;
- lpsiStartInfo.hStdOutput = NULL;
- lpsiStartInfo.hStdError = NULL;
-
- /*
- * set create process flags
- * if the flags arg is nil, use common defaults;
- * if non-nil, it must be a positive integer containing the fdwCreate bits.
- */
- if (flagsOrNil != nil) {
- fdwCreate = __longIntVal(flagsOrNil);
- } else {
- if (0 /* __isWinNT */)
- fdwCreate = 0; //IDLE_PRIORITY_CLASS;
- else
- fdwCreate = CREATE_NEW_CONSOLE; //|IDLE_PRIORITY_CLASS; // DETACHED_PROCESS; // NORMAL_PRIORITY_CLASS ;
-
- if (newPgrp == true) {
- fdwCreate |= CREATE_NEW_PROCESS_GROUP;
- }
- fdwCreate |= CREATE_DEFAULT_ERROR_MODE;
- }
-
- if (fdArray == nil) {
- lpsiStartInfo.hStdInput = (HANDLE) _get_osfhandle (0);
- lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (1);
- lpsiStartInfo.hStdError = (HANDLE) _get_osfhandle (2);
- } else if (__isArrayLike(fdArray) && (__arraySize(fdArray) >= 3)) {
- if (__ArrayInstPtr(fdArray)->a_element[0] != nil) {
- if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[0])) {
- lpsiStartInfo.hStdInput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
- } else {
- lpsiStartInfo.hStdInput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[0]));
- }
- }
- if (__ArrayInstPtr(fdArray)->a_element[1] != nil) {
- if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[1])) {
- lpsiStartInfo.hStdOutput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
- } else {
- lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[1]));
- }
- }
- if (__ArrayInstPtr(fdArray)->a_element[2] != nil) {
- if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[2])) {
- lpsiStartInfo.hStdError = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
- } else {
- lpsiStartInfo.hStdError = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[2]));
- }
- }
+ /*
+ * generate command line (cmd plus args)
+ */
+ if (__isWinNT) {
+ char *d;
+
+ strcpy(fullCmdPath, __stringVal(aCommandPath));
+ d = strchr(fullCmdPath,' ');
+ if (d) {
+ *d++ = 0;
+ strcpy(fullCmdLine, d);
+ } else {
+ fullCmdLine[0] = '\0';
+ }
+ } else {
+ //fullCmdPath = 0;
+ strcpy(fullCmdPath,"stxspawn.exe");
+ strcpy(fullCmdLine,"stxspawn.exe ");
+ strcat(fullCmdLine, __stringVal(aCommandPath));
+ }
+
+ if (__isString(argArray)) {
+ if (strlen(fullCmdLine) > 0) {
+ strcat(fullCmdLine, " ");
+ }
+ strcat(fullCmdLine, __stringVal(argArray));
+ } else {
+ int i;
+
+ for (i=0; i<__arraySize(argArray); i++) {
+ OBJ arg = __ArrayInstPtr(argArray)->a_element[i];
+
+ if (__isString(arg)) {
+ strcat(fullCmdLine, " ");
+ strcat(fullCmdLine, __stringVal(arg));
+ } else {
+ /* ignore */
+ console_fprintf(stderr, "bad (non-string) arg\n");
+ }
+ }
+ }
+#endif
+ if (commandPath != nil) {
+ cmdPath = __stringVal(commandPath);
+ }
+ cmdLine = __stringVal(commandLine);
+
+ /*
+ * create descriptors as req'd
+ */
+ memset(&sa, 0, sizeof (sa));
+ sa.nLength = sizeof( sa );
+ sa.lpSecurityDescriptor = NULL;
+ sa.bInheritHandle = TRUE;
+ if (__isWinNT) {
+ InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
+ SetSecurityDescriptorDacl(&sd, -1, 0, 0);
+
+ sa.lpSecurityDescriptor = &sd;
+ }
+ memset(&lppiProcInfo, 0, sizeof (lppiProcInfo));
+
+ memset(&lpsiStartInfo, 0, sizeof (lpsiStartInfo));
+ lpsiStartInfo.cb = sizeof(lpsiStartInfo);
+ lpsiStartInfo.lpReserved = NULL;
+ lpsiStartInfo.lpDesktop = NULL;
+ lpsiStartInfo.lpTitle = NULL;
+ lpsiStartInfo.dwX = 0;
+ lpsiStartInfo.dwY = 0;
+ lpsiStartInfo.dwXSize = 100;
+ lpsiStartInfo.dwYSize = 100;
+ lpsiStartInfo.dwXCountChars = 0;
+ lpsiStartInfo.dwYCountChars = 0;
+ lpsiStartInfo.dwFillAttribute = 0;
+ if (0 /*__isWinNT*/) {
+ lpsiStartInfo.dwFlags = STARTF_USESTDHANDLES;
+ lpsiStartInfo.wShowWindow = SW_SHOWDEFAULT;
+ } else {
+ lpsiStartInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES /*| STARTF_USEPOSITION*/;
+ lpsiStartInfo.wShowWindow = SW_HIDE /*SW_SHOWDEFAULT*/;
+ }
+ lpsiStartInfo.cbReserved2 = 0;
+ lpsiStartInfo.lpReserved2 = NULL;
+ lpsiStartInfo.hStdInput = NULL;
+ lpsiStartInfo.hStdOutput = NULL;
+ lpsiStartInfo.hStdError = NULL;
+
+ /*
+ * set create process flags
+ * if the flags arg is nil, use common defaults;
+ * if non-nil, it must be a positive integer containing the fdwCreate bits.
+ */
+ if (flagsOrNil != nil) {
+ fdwCreate = __longIntVal(flagsOrNil);
+ } else {
+ if (0 /* __isWinNT */)
+ fdwCreate = 0; //IDLE_PRIORITY_CLASS;
+ else
+ fdwCreate = CREATE_NEW_CONSOLE; //|IDLE_PRIORITY_CLASS; // DETACHED_PROCESS; // NORMAL_PRIORITY_CLASS ;
+
+ if (newPgrp == true) {
+ fdwCreate |= CREATE_NEW_PROCESS_GROUP;
+ }
+ fdwCreate |= CREATE_DEFAULT_ERROR_MODE;
+ }
+
+ if (fdArray == nil) {
+ lpsiStartInfo.hStdInput = (HANDLE) _get_osfhandle (0);
+ lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (1);
+ lpsiStartInfo.hStdError = (HANDLE) _get_osfhandle (2);
+ } else if (__isArrayLike(fdArray) && (__arraySize(fdArray) >= 3)) {
+ if (__ArrayInstPtr(fdArray)->a_element[0] != nil) {
+ if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[0])) {
+ lpsiStartInfo.hStdInput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
+ } else {
+ lpsiStartInfo.hStdInput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[0]));
+ }
+ }
+ if (__ArrayInstPtr(fdArray)->a_element[1] != nil) {
+ if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[1])) {
+ lpsiStartInfo.hStdOutput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
+ } else {
+ lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[1]));
+ }
+ }
+ if (__ArrayInstPtr(fdArray)->a_element[2] != nil) {
+ if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[2])) {
+ lpsiStartInfo.hStdError = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
+ } else {
+ lpsiStartInfo.hStdError = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[2]));
+ }
+ }
#ifdef PROCESSDEBUGWIN32
- console_fprintf(stderr, "stdin %x\n", lpsiStartInfo.hStdInput);
- console_fprintf(stderr, "stdout %x\n",lpsiStartInfo.hStdOutput);
- console_fprintf(stderr, "stderr %x\n",lpsiStartInfo.hStdError);
-#endif
- } else {
- console_fprintf(stderr, "Win32OS [warning]: bad fd arg in createProcess\n");
- }
-
- if (doFork == true) {
+ console_fprintf(stderr, "stdin %x\n", lpsiStartInfo.hStdInput);
+ console_fprintf(stderr, "stdout %x\n",lpsiStartInfo.hStdOutput);
+ console_fprintf(stderr, "stderr %x\n",lpsiStartInfo.hStdError);
+#endif
+ } else {
+ console_fprintf(stderr, "Win32OS [warning]: bad fd arg in createProcess\n");
+ }
+
+ if (doFork == true) {
#ifdef PROCESSDEBUGWIN32
- console_fprintf(stderr, "create process cmdPath:<%s> cmdLine:<%s> in <%s>\n", cmdPath, cmdLine, dir);
-#endif
- if (CreateProcess( cmdPath,
- cmdLine,
- &sa, NULL /* &sa */, /* sec-attribs */
- sa.bInheritHandle, /* inherit handles */
- fdwCreate,
- NULL, /* env */
- dir,
- &lpsiStartInfo,
- &lppiProcInfo ))
- {
- CloseHandle(lppiProcInfo.hThread);
+ console_fprintf(stderr, "create process cmdPath:<%s> cmdLine:<%s> in <%s>\n", cmdPath, cmdLine, dir);
+#endif
+ if (CreateProcess( cmdPath,
+ cmdLine,
+ &sa, NULL /* &sa */, /* sec-attribs */
+ sa.bInheritHandle, /* inherit handles */
+ fdwCreate,
+ NULL, /* env */
+ dir,
+ &lpsiStartInfo,
+ &lppiProcInfo ))
+ {
+ CloseHandle(lppiProcInfo.hThread);
#ifdef PROCESSDEBUGWIN32
- console_fprintf(stderr, "created process hProcess=%x\n", lppiProcInfo.hProcess);
-#endif
- __externalAddressVal(handle) = lppiProcInfo.hProcess;
- ((struct __Win32OperatingSystem__Win32ProcessHandle_struct *)(handle))->pid = __mkSmallInteger(lppiProcInfo.dwProcessId);
- RETURN (handle);
- }
+ console_fprintf(stderr, "created process hProcess=%x\n", lppiProcInfo.hProcess);
+#endif
+ __externalAddressVal(handle) = lppiProcInfo.hProcess;
+ ((struct __Win32OperatingSystem__Win32ProcessHandle_struct *)(handle))->pid = __mkSmallInteger(lppiProcInfo.dwProcessId);
+ RETURN (handle);
+ }
#ifdef PROCESSDEBUGWIN32
- console_fprintf(stderr, "created process error %d\n", GetLastError());
-#endif
- RETURN (nil);
- } else {
- ; /* should never be called that way */
- }
+ console_fprintf(stderr, "created process error %d\n", GetLastError());
+#endif
+ RETURN (nil);
+ } else {
+ ; /* should never be called that way */
+ }
}
%}.
"
@@ -3641,36 +3641,36 @@
aCommandString isNil ifTrue:[^ nil].
(in := anExternalInStream) isNil ifTrue:[
- nullStream := Filename nullDevice readWriteStream.
- in := nullStream.
+ nullStream := Filename nullDevice readWriteStream.
+ in := nullStream.
].
(out := anExternalOutStream) isNil ifTrue:[
- nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
- out := nullStream.
+ nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
+ out := nullStream.
].
(err := anExternalErrStream) isNil ifTrue:[
- err := out
+ err := out
].
anAuxiliaryStream notNil ifTrue:[
- auxFd := anAuxiliaryStream fileDescriptor
+ auxFd := anAuxiliaryStream fileDescriptor
].
shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
rslt := self
- exec:(shellAndArgs at:1)
- withArguments:(shellAndArgs at:2)
- environment:anEvironmentDictionary
- fileDescriptors:(Array with:in fileDescriptor
- with:out fileDescriptor
- with:err fileDescriptor
- with:auxFd)
- fork:true
- newPgrp:true "/ false
- inDirectory:dir.
+ exec:(shellAndArgs at:1)
+ withArguments:(shellAndArgs at:2)
+ environment:anEvironmentDictionary
+ fileDescriptors:(Array with:in fileDescriptor
+ with:out fileDescriptor
+ with:err fileDescriptor
+ with:auxFd)
+ fork:true
+ newPgrp:true "/ false
+ inDirectory:dir.
nullStream notNil ifTrue:[
- nullStream close.
+ nullStream close.
].
^ rslt
@@ -3693,7 +3693,7 @@
The following will no longer work. monitorPid has disappeared
pid notNil ifTrue:[
- Processor monitorPid:pid action:[:OSstatus | sema signal ].
+ Processor monitorPid:pid action:[:OSstatus | sema signal ].
].
in close.
out close.
@@ -3716,13 +3716,13 @@
%{
if (__isExternalAddressLike(anIntegerOrHandle) ) {
if( !CloseHandle( anIntegerOrHandle ) ) {
- console_fprintf( stderr, "Win32OS [warning]: Could not close handle : %x\n", anIntegerOrHandle);
+ console_fprintf( stderr, "Win32OS [warning]: Could not close handle : %x\n", anIntegerOrHandle);
}
RETURN(self);
}
if (__isSmallInteger(anIntegerOrHandle)) {
- close(__intVal(anIntegerOrHandle));
- RETURN(self);
+ close(__intVal(anIntegerOrHandle));
+ RETURN(self);
}
%}.
^ self primitiveFailed.
@@ -3740,20 +3740,20 @@
%{
if (__isString(aPathName)) {
- int ret;
- SECURITY_ATTRIBUTES sa;
-
- sa.nLength = sizeof( sa );
- sa.lpSecurityDescriptor = NULL;
- sa.bInheritHandle = TRUE;
-
- ret = CreateDirectory(__stringVal(aPathName), &sa);
- if (ret != TRUE) {
- __threadErrno = __WIN32_ERR(GetLastError());
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN (false);
- }
- RETURN (true);
+ int ret;
+ SECURITY_ATTRIBUTES sa;
+
+ sa.nLength = sizeof( sa );
+ sa.lpSecurityDescriptor = NULL;
+ sa.bInheritHandle = TRUE;
+
+ ret = CreateDirectory(__stringVal(aPathName), &sa);
+ if (ret != TRUE) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN (false);
+ }
+ RETURN (true);
}
%}.
self primitiveFailed
@@ -3796,65 +3796,65 @@
IPersistFile *ppf;
if (! __isString(aPathName)) {
- console_fprintf(stderr, "invalid argument\n");
- goto error;
+ console_fprintf(stderr, "invalid argument\n");
+ goto error;
}
hres = CoInitialize(NULL);
if (! SUCCEEDED(hres)) {
- console_fprintf(stderr, "Could not open the COM library\n");
- goto error;
+ console_fprintf(stderr, "Could not open the COM library\n");
+ goto error;
}
hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
- &IID_IShellLink, (LPVOID *)&psl);
+ &IID_IShellLink, (LPVOID *)&psl);
if (SUCCEEDED(hres)) {
- hres = psl->lpVtbl->QueryInterface(psl, &IID_IPersistFile, &ppf);
-
- if (SUCCEEDED(hres)) {
- WORD wsz[MAX_PATH];
-
- MultiByteToWideChar(CP_ACP, 0, __stringVal(aPathName), -1, wsz, MAX_PATH);
-
- hres = ppf->lpVtbl->Load(ppf, wsz, STGM_READ);
- if (SUCCEEDED(hres)) {
+ hres = psl->lpVtbl->QueryInterface(psl, &IID_IPersistFile, &ppf);
+
+ if (SUCCEEDED(hres)) {
+ WORD wsz[MAX_PATH];
+
+ MultiByteToWideChar(CP_ACP, 0, __stringVal(aPathName), -1, wsz, MAX_PATH);
+
+ hres = ppf->lpVtbl->Load(ppf, wsz, STGM_READ);
+ if (SUCCEEDED(hres)) {
#if 0
- hres = psl->lpVtbl->Resolve(psl, 0, SLR_ANY_MATCH|SLR_NO_UI);
-#endif
- if (SUCCEEDED(hres)) {
- hres = psl->lpVtbl->GetPath(psl, szGotPath, MAX_PATH,
- (WIN32_FIND_DATA *)&wfd, 0 /* SLGP_SHORTPATH */ );
- if (!SUCCEEDED(hres)) {
- console_fprintf(stderr, "GetPath failed!\n");
- } else {
+ hres = psl->lpVtbl->Resolve(psl, 0, SLR_ANY_MATCH|SLR_NO_UI);
+#endif
+ if (SUCCEEDED(hres)) {
+ hres = psl->lpVtbl->GetPath(psl, szGotPath, MAX_PATH,
+ (WIN32_FIND_DATA *)&wfd, 0 /* SLGP_SHORTPATH */ );
+ if (!SUCCEEDED(hres)) {
+ console_fprintf(stderr, "GetPath failed!\n");
+ } else {
#if 0
- console_printf("This points to %s\n", wfd.cFileName); console_fflush(stdout);
- console_printf("Path is %s\n", szGotPath); console_fflush(stdout);
- if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- console_printf("This is a directory\n"); console_fflush(stdout);
- }
-#endif
- resolvedPath = __MKSTRING(szGotPath);
+ console_printf("This points to %s\n", wfd.cFileName); console_fflush(stdout);
+ console_printf("Path is %s\n", szGotPath); console_fflush(stdout);
+ if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
+ console_printf("This is a directory\n"); console_fflush(stdout);
+ }
+#endif
+ resolvedPath = __MKSTRING(szGotPath);
#if 0
- hres = psl->lpVtbl->GetWorkingDirectory(psl, szGotPath, MAX_PATH);
- if (!SUCCEEDED(hres)) {
- console_fprintf(stderr, "GetWorkingDirectory failed!\n");
- } else {
- console_printf("In Directory %s\n", szGotPath);
- }
-#endif
- }
- }
- } else {
- console_fprintf(stderr, "IPersistFile Load Error\n");
- }
- ppf->lpVtbl->Release(ppf);
- } else {
- console_fprintf(stderr, "QueryInterface Error\n");
- }
- psl->lpVtbl->Release(psl);
+ hres = psl->lpVtbl->GetWorkingDirectory(psl, szGotPath, MAX_PATH);
+ if (!SUCCEEDED(hres)) {
+ console_fprintf(stderr, "GetWorkingDirectory failed!\n");
+ } else {
+ console_printf("In Directory %s\n", szGotPath);
+ }
+#endif
+ }
+ }
+ } else {
+ console_fprintf(stderr, "IPersistFile Load Error\n");
+ }
+ ppf->lpVtbl->Release(ppf);
+ } else {
+ console_fprintf(stderr, "QueryInterface Error\n");
+ }
+ psl->lpVtbl->Release(psl);
} else {
- console_fprintf(stderr, "CoCreateInstance Error - hres = %08x\n", hres);
+ console_fprintf(stderr, "CoCreateInstance Error - hres = %08x\n", hres);
}
error: ;
%}.
@@ -3877,10 +3877,10 @@
Return true if successful, false if not."
(oldPath isString not or:[newPath isString not]) ifTrue:[
- "/
- "/ bad argument(s) given
- "/
- ^ self primitiveFailed
+ "/
+ "/ bad argument(s) given
+ "/
+ ^ self primitiveFailed
].
"/
@@ -3912,14 +3912,14 @@
DWORD access, share, create, attr;
if (! __isString(pathName)) {
- fileHandle = nil;
- argumentError = @symbol(badPathName);
- goto badArgument;
+ fileHandle = nil;
+ argumentError = @symbol(badPathName);
+ goto badArgument;
}
if (! __isArrayLike(attributeSpec)) {
- fileHandle = nil;
- argumentError = @symbol(badAttributeSpec);
- goto badArgument;
+ fileHandle = nil;
+ argumentError = @symbol(badAttributeSpec);
+ goto badArgument;
}
name = __stringVal(pathName);
@@ -3930,72 +3930,72 @@
attr = 0;
for (i=0; i<numAttrib;i++) {
- OBJ attrSym = ap[i];
-
- if (attrSym == @symbol(FILE_SHARE_READ)) {
- share |= FILE_SHARE_READ;
- } else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
- share |= FILE_SHARE_WRITE;
-
- } else if (attrSym == @symbol(GENERIC_READ)) {
- access |= GENERIC_READ;
- } else if (attrSym == @symbol(GENERIC_WRITE)) {
- access |= GENERIC_WRITE;
-
- } else if (attrSym == @symbol(CREATE_NEW)) {
- create |= CREATE_NEW;
- } else if (attrSym == @symbol(CREATE_ALWAYS)) {
- create |= CREATE_ALWAYS;
- } else if (attrSym == @symbol(OPEN_EXISTING)) {
- create |= OPEN_EXISTING;
- } else if (attrSym == @symbol(OPEN_ALWAYS)) {
- create |= OPEN_ALWAYS;
- } else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
- create |= TRUNCATE_EXISTING;
-
- } else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
- attr |= FILE_ATTRIBUTE_HIDDEN;
- } else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
- attr |= FILE_ATTRIBUTE_READONLY;
- } else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
- attr |= FILE_ATTRIBUTE_READONLY;
- } else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
- attr |= FILE_FLAG_WRITE_THROUGH;
- } else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
- attr |= FILE_FLAG_SEQUENTIAL_SCAN;
- } else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
- attr |= FILE_FLAG_DELETE_ON_CLOSE;
- } else {
- console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
- }
+ OBJ attrSym = ap[i];
+
+ if (attrSym == @symbol(FILE_SHARE_READ)) {
+ share |= FILE_SHARE_READ;
+ } else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
+ share |= FILE_SHARE_WRITE;
+
+ } else if (attrSym == @symbol(GENERIC_READ)) {
+ access |= GENERIC_READ;
+ } else if (attrSym == @symbol(GENERIC_WRITE)) {
+ access |= GENERIC_WRITE;
+
+ } else if (attrSym == @symbol(CREATE_NEW)) {
+ create |= CREATE_NEW;
+ } else if (attrSym == @symbol(CREATE_ALWAYS)) {
+ create |= CREATE_ALWAYS;
+ } else if (attrSym == @symbol(OPEN_EXISTING)) {
+ create |= OPEN_EXISTING;
+ } else if (attrSym == @symbol(OPEN_ALWAYS)) {
+ create |= OPEN_ALWAYS;
+ } else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
+ create |= TRUNCATE_EXISTING;
+
+ } else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
+ attr |= FILE_ATTRIBUTE_HIDDEN;
+ } else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
+ attr |= FILE_ATTRIBUTE_READONLY;
+ } else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
+ attr |= FILE_ATTRIBUTE_READONLY;
+ } else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
+ attr |= FILE_FLAG_WRITE_THROUGH;
+ } else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
+ attr |= FILE_FLAG_SEQUENTIAL_SCAN;
+ } else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
+ attr |= FILE_FLAG_DELETE_ON_CLOSE;
+ } else {
+ console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
+ }
}
if (create == 0) {
- fileHandle = nil;
- argumentError = @symbol(missingCreateMode);
- goto badArgument;
+ fileHandle = nil;
+ argumentError = @symbol(missingCreateMode);
+ goto badArgument;
}
#ifdef PROCESSDEBUGWIN32
console_fprintf(stderr, "name:<%s> access:%x share:%x create:%x attr:%x\n",
- name, access, share, create, attr);
+ name, access, share, create, attr);
#endif
h = CreateFile(name, access, share, 0 /* sa */, create, attr, 0 /* hTempl */);
if (h != INVALID_HANDLE_VALUE) {
- __externalAddressVal(fileHandle) = (void *)h;
+ __externalAddressVal(fileHandle) = (void *)h;
} else {
- fileHandle = nil;
- errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
+ fileHandle = nil;
+ errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
}
badArgument: ;
%}.
fileHandle notNil ifTrue:[
- fileHandle registerForFinalization.
- ^ fileHandle.
+ fileHandle registerForFinalization.
+ ^ fileHandle.
].
errorNumber isNil ifTrue:[
- self error:'invalid argument(s): ', argumentError.
+ self error:'invalid argument(s): ', argumentError.
] ifFalse:[
- (self errorHolderForNumber:errorNumber) reportError
+ (self errorHolderForNumber:errorNumber) reportError
].
!
@@ -4043,24 +4043,24 @@
if (__isString(fullPathName)) {
#ifdef DO_WRAP_CALLS
- {
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "RemoveDirectory", RemoveDirectory, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
- }
-#else
- ret = RemoveDirectory((char *)__stringVal(fullPathName));
- __threadErrno = __WIN32_ERR(GetLastError());
-#endif
- if (ret != TRUE) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN (false);
- }
- RETURN (true);
+ {
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "RemoveDirectory", RemoveDirectory, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+ }
+#else
+ ret = RemoveDirectory((char *)__stringVal(fullPathName));
+ __threadErrno = __WIN32_ERR(GetLastError());
+#endif
+ if (ret != TRUE) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN (false);
+ }
+ RETURN (true);
}
%}.
"/
@@ -4084,24 +4084,24 @@
if (__isString(fullPathName)) {
#ifdef DO_WRAP_CALLS
- {
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "DeleteFile", DeleteFile, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
- }
-#else
- ret = DeleteFile((char *)__stringVal(fullPathName));
- __threadErrno = __WIN32_ERR(GetLastError());
-#endif
- if (ret != TRUE) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN (false);
- }
- RETURN (true);
+ {
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "DeleteFile", DeleteFile, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+ }
+#else
+ ret = DeleteFile((char *)__stringVal(fullPathName));
+ __threadErrno = __WIN32_ERR(GetLastError());
+#endif
+ if (ret != TRUE) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN (false);
+ }
+ RETURN (true);
}
%}.
^ self primitiveFailed
@@ -4120,32 +4120,32 @@
if (__isString(oldPath) && __isString(newPath)) {
#ifdef DO_WRAP_CALLS
- char _oldPath[MAXPATHLEN], _newPath[MAXPATHLEN];
-
- strncpy(_oldPath, __stringVal(oldPath), MAXPATHLEN-1); _oldPath[MAXPATHLEN-1] = '\0';
- strncpy(_newPath, __stringVal(newPath), MAXPATHLEN-1); _newPath[MAXPATHLEN-1] = '\0';
-
- do {
- __threadErrno = 0;
- ret = STX_C_CALL2( "rename", rename, _oldPath, _newPath);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- __BEGIN_INTERRUPTABLE__
- do {
- __threadErrno = 0;
- ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
- } while ((ret < 0) && (__threadErrno == EINTR));
- __END_INTERRUPTABLE__
-
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN (false);
- }
- RETURN (true);
+ char _oldPath[MAXPATHLEN], _newPath[MAXPATHLEN];
+
+ strncpy(_oldPath, __stringVal(oldPath), MAXPATHLEN-1); _oldPath[MAXPATHLEN-1] = '\0';
+ strncpy(_newPath, __stringVal(newPath), MAXPATHLEN-1); _newPath[MAXPATHLEN-1] = '\0';
+
+ do {
+ __threadErrno = 0;
+ ret = STX_C_CALL2( "rename", rename, _oldPath, _newPath);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ __BEGIN_INTERRUPTABLE__
+ do {
+ __threadErrno = 0;
+ ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
+ } while ((ret < 0) && (__threadErrno == EINTR));
+ __END_INTERRUPTABLE__
+
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN (false);
+ }
+ RETURN (true);
}
%}.
^ self primitiveFailed
@@ -4204,43 +4204,43 @@
# endif
if (aSymbol == @symbol(readUser)) {
- RETURN ( __mkSmallInteger(S_IRUSR) );
+ RETURN ( __mkSmallInteger(S_IRUSR) );
}
if (aSymbol == @symbol(writeUser)) {
- RETURN ( __mkSmallInteger(S_IWUSR) );
+ RETURN ( __mkSmallInteger(S_IWUSR) );
}
if (aSymbol == @symbol(executeUser)) {
- RETURN ( __mkSmallInteger(S_IXUSR) );
+ RETURN ( __mkSmallInteger(S_IXUSR) );
}
if (aSymbol == @symbol(readGroup)) {
- RETURN ( __mkSmallInteger(S_IRGRP) );
+ RETURN ( __mkSmallInteger(S_IRGRP) );
}
if (aSymbol == @symbol(writeGroup)) {
- RETURN ( __mkSmallInteger(S_IWGRP) );
+ RETURN ( __mkSmallInteger(S_IWGRP) );
}
if (aSymbol == @symbol(executeGroup)) {
- RETURN ( __mkSmallInteger(S_IXGRP) );
+ RETURN ( __mkSmallInteger(S_IXGRP) );
}
if (aSymbol == @symbol(readOthers)) {
- RETURN ( __mkSmallInteger(S_IROTH) );
+ RETURN ( __mkSmallInteger(S_IROTH) );
}
if (aSymbol == @symbol(writeOthers)) {
- RETURN ( __mkSmallInteger(S_IWOTH) );
+ RETURN ( __mkSmallInteger(S_IWOTH) );
}
if (aSymbol == @symbol(executeOthers)) {
- RETURN ( __mkSmallInteger(S_IXOTH) );
+ RETURN ( __mkSmallInteger(S_IXOTH) );
}
// These are not defined for Win32 - simply ignore them
// (but handle them for UNIX compatibility
if (aSymbol == @symbol(setUid)) {
- RETURN ( __mkSmallInteger(0) );
+ RETURN ( __mkSmallInteger(0) );
}
if (aSymbol == @symbol(setGid)) {
- RETURN ( __mkSmallInteger(0) );
+ RETURN ( __mkSmallInteger(0) );
}
if (aSymbol == @symbol(removeOnlyByOwner)) {
- RETURN ( __mkSmallInteger(0) );
+ RETURN ( __mkSmallInteger(0) );
}
%}.
@@ -4259,7 +4259,7 @@
"
this could have been implemented as:
- (self infoOf:aPathName) at:#mode
+ (self infoOf:aPathName) at:#mode
but for huge directory searches the code below is faster
"
@@ -4269,31 +4269,31 @@
if (__isString(aPathName)) {
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
-
- do {
- __threadErrno = 0;
- ret = STX_C_CALL2( "stat", stat, _aPathName, &buf);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- __BEGIN_INTERRUPTABLE__
- do {
- __threadErrno = 0;
- ret = stat( (char *)__stringVal(aPathName), &buf);
- } while ((ret < 0) && (__threadErrno == EINTR));
- __END_INTERRUPTABLE__
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
-
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( nil );
- }
- RETURN ( __mkSmallInteger(buf.st_mode & 0777) );
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+
+ do {
+ __threadErrno = 0;
+ ret = STX_C_CALL2( "stat", stat, _aPathName, &buf);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ __BEGIN_INTERRUPTABLE__
+ do {
+ __threadErrno = 0;
+ ret = stat( (char *)__stringVal(aPathName), &buf);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( nil );
+ }
+ RETURN ( __mkSmallInteger(buf.st_mode & 0777) );
}
%}.
^ self primitiveFailed
@@ -4316,30 +4316,30 @@
if (__isString(aPathName) && __isSmallInteger(modeBits)) {
#ifdef DO_WRAP_CALLS
- int chmod();
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_C_CALL2( "chmod", chmod, _aPathName, __intVal(modeBits));
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- __BEGIN_INTERRUPTABLE__
- do {
- __threadErrno = 0;
- ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
- } while ((ret < 0) && (__threadErrno == EINTR));
- __END_INTERRUPTABLE__
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN ( true );
+ int chmod();
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_C_CALL2( "chmod", chmod, _aPathName, __intVal(modeBits));
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ __BEGIN_INTERRUPTABLE__
+ do {
+ __threadErrno = 0;
+ ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
+ } while ((ret < 0) && (__threadErrno == EINTR));
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN ( true );
}
%}.
^ self primitiveFailed
@@ -4424,27 +4424,27 @@
|names n "{ Class: SmallInteger }" |
names := pathName
- asCollectionOfSubstringsSeparatedBy:self fileSeparator.
+ asCollectionOfSubstringsSeparatedBy:self fileSeparator.
names := names asOrderedCollection.
"
cut off initial double-slashes
"
[names startsWith:#('' '')] whileTrue:[
- names removeFirst.
+ names removeFirst.
].
"
cut off double-slashes at end
"
[names endsWith:#('')] whileTrue:[
- names removeLast.
+ names removeLast.
].
"
cut off current-dir at beginning
"
n := names size.
[(n >= 2) and:[names startsWith:#('.')]] whileTrue:[
- names removeFirst.
- n := n - 1.
+ names removeFirst.
+ n := n - 1.
].
"
@@ -4453,14 +4453,14 @@
[(n > 2)
and:[(names endsWith:#('..'))
and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[
- names removeLast; removeLast.
- n := n - 2.
+ names removeLast; removeLast.
+ n := n - 2.
].
^ names asStringWith:self fileSeparator
- from:1
- to:n
- compressTabs:false final:nil
+ from:1
+ to:n
+ compressTabs:false final:nil
"
OperatingSystem compressPath:'.\..'
@@ -4499,8 +4499,8 @@
getDiskInfoOf:volumeNameArg
"returns a dictionary filled with any of:
- freeBytes
- totalBytes
+ freeBytes
+ totalBytes
and possibly additional (OS-specific) information"
|volumeName info ok sectorsPerCluster bytesPerSector freeClusters totalClusters
@@ -4508,11 +4508,11 @@
volumeName := volumeNameArg.
(volumeName endsWith:$\) ifFalse:[
- volumeName := volumeName , '\'
+ volumeName := volumeName , '\'
].
%{
typedef BOOL (WINAPI *P_GDFSE)(LPCTSTR, PULARGE_INTEGER,
- PULARGE_INTEGER, PULARGE_INTEGER);
+ PULARGE_INTEGER, PULARGE_INTEGER);
P_GDFSE pGetDiskFreeSpaceEx = NULL;
DWORD __sectorsPerCluster, __bytesPerSector, __freeClusters, __totalClusters;
@@ -4520,62 +4520,62 @@
unsigned __int64 i64FreeBytesForUsersQuota, i64TotalBytes, i64FreeBytes;
if (__isString(volumeName) || __isSymbol(volumeName)) {
- /*
- * Use GetDiskFreeSpaceEx if available; otherwise, use GetDiskFreeSpace.
- * Notice that GetDiskFreeSpace does not work correctly under win2k,
- * and GetDiskFreeSpaceEx is not avail. for all win versions (can microsoft ever do something right ?).
- */
- pGetDiskFreeSpaceEx = (P_GDFSE)GetProcAddress (
- GetModuleHandle ("kernel32.dll"),
- "GetDiskFreeSpaceExA");
- if (pGetDiskFreeSpaceEx) {
- fResult = pGetDiskFreeSpaceEx (__stringVal(volumeName),
- (PULARGE_INTEGER)&i64FreeBytesForUsersQuota,
- (PULARGE_INTEGER)&i64TotalBytes,
- (PULARGE_INTEGER)&i64FreeBytes);
- if (fResult) {
- freeBytesForUsersQuota = __MKUINT64(&i64FreeBytesForUsersQuota);
- totalBytes = __MKUINT64(&i64TotalBytes);
- freeBytes = __MKUINT64(&i64FreeBytes);
- }
- }
- fResult = GetDiskFreeSpace(__stringVal(volumeName),
- &__sectorsPerCluster,
- &__bytesPerSector,
- &__freeClusters,
- &__totalClusters);
- if (fResult) {
- sectorsPerCluster = __MKUINT(__sectorsPerCluster);
- bytesPerSector = __MKUINT(__bytesPerSector);
- freeClusters = __MKUINT(__freeClusters);
- totalClusters = __MKUINT(__totalClusters);
- }
- switch (GetDriveType(__stringVal(volumeName))) {
- case DRIVE_REMOVABLE:
- type = @symbol(removable); break;
- case DRIVE_FIXED:
- type = @symbol(fixed); break;
- case DRIVE_REMOTE:
- type = @symbol(network); break;
- case DRIVE_CDROM:
- type = @symbol(cdrom); break;
- case DRIVE_RAMDISK:
- type = @symbol(ramdisk); break;
- case DRIVE_UNKNOWN:
- default:
- break;
- }
- if (fResult) {
- ok = true;
- } else {
- __threadErrno = __WIN32_ERR(GetLastError());
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- }
+ /*
+ * Use GetDiskFreeSpaceEx if available; otherwise, use GetDiskFreeSpace.
+ * Notice that GetDiskFreeSpace does not work correctly under win2k,
+ * and GetDiskFreeSpaceEx is not avail. for all win versions (can microsoft ever do something right ?).
+ */
+ pGetDiskFreeSpaceEx = (P_GDFSE)GetProcAddress (
+ GetModuleHandle ("kernel32.dll"),
+ "GetDiskFreeSpaceExA");
+ if (pGetDiskFreeSpaceEx) {
+ fResult = pGetDiskFreeSpaceEx (__stringVal(volumeName),
+ (PULARGE_INTEGER)&i64FreeBytesForUsersQuota,
+ (PULARGE_INTEGER)&i64TotalBytes,
+ (PULARGE_INTEGER)&i64FreeBytes);
+ if (fResult) {
+ freeBytesForUsersQuota = __MKUINT64(&i64FreeBytesForUsersQuota);
+ totalBytes = __MKUINT64(&i64TotalBytes);
+ freeBytes = __MKUINT64(&i64FreeBytes);
+ }
+ }
+ fResult = GetDiskFreeSpace(__stringVal(volumeName),
+ &__sectorsPerCluster,
+ &__bytesPerSector,
+ &__freeClusters,
+ &__totalClusters);
+ if (fResult) {
+ sectorsPerCluster = __MKUINT(__sectorsPerCluster);
+ bytesPerSector = __MKUINT(__bytesPerSector);
+ freeClusters = __MKUINT(__freeClusters);
+ totalClusters = __MKUINT(__totalClusters);
+ }
+ switch (GetDriveType(__stringVal(volumeName))) {
+ case DRIVE_REMOVABLE:
+ type = @symbol(removable); break;
+ case DRIVE_FIXED:
+ type = @symbol(fixed); break;
+ case DRIVE_REMOTE:
+ type = @symbol(network); break;
+ case DRIVE_CDROM:
+ type = @symbol(cdrom); break;
+ case DRIVE_RAMDISK:
+ type = @symbol(ramdisk); break;
+ case DRIVE_UNKNOWN:
+ default:
+ break;
+ }
+ if (fResult) {
+ ok = true;
+ } else {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ }
}
%}.
ok == true ifFalse:[
- self primitiveFailed.
- ^ self
+ self primitiveFailed.
+ ^ self
].
info := IdentityDictionary new.
@@ -4585,14 +4585,14 @@
info at:#totalClusters put:totalClusters.
info at:#freeBytes put:(freeBytes notNil
- ifTrue:[freeBytes]
- ifFalse:[freeClusters * sectorsPerCluster * bytesPerSector]).
+ ifTrue:[freeBytes]
+ ifFalse:[freeClusters * sectorsPerCluster * bytesPerSector]).
info at:#totalBytes put:(totalBytes notNil
- ifTrue:[totalBytes]
- ifFalse:[totalClusters * sectorsPerCluster * bytesPerSector]).
+ ifTrue:[totalBytes]
+ ifFalse:[totalClusters * sectorsPerCluster * bytesPerSector]).
info at:#freeBytesForUsersQuota put:freeBytesForUsersQuota.
type notNil ifTrue:[
- info at:#type put:type
+ info at:#type put:type
].
^ info
@@ -4643,24 +4643,24 @@
DWORD dummy;
if (__isString(aPathName)) {
- sz = GetFileVersionInfoSizeA(__stringVal(aPathName), &dummy);
+ sz = GetFileVersionInfoSizeA(__stringVal(aPathName), &dummy);
} else if (__isUnicode16String(aPathName)) {
- sz = GetFileVersionInfoSizeW(__unicode16StringVal(aPathName), &dummy);
+ sz = GetFileVersionInfoSizeW(__unicode16StringVal(aPathName), &dummy);
} else {
- goto badArgument;
+ goto badArgument;
}
if (sz > 0) {
- OBJ versionData;
-
- versionData = __BYTEARRAY_UNINITIALIZED_NEW_INT(sz);
- if (versionData == nil) {
- RETURN (nil);
- }
- if (GetFileVersionInfo(__stringVal(aPathName), 0, sz, __ByteArrayInstPtr(versionData)->ba_element) == FALSE) {
- RETURN (nil);
- }
- RETURN (versionData);
+ OBJ versionData;
+
+ versionData = __BYTEARRAY_UNINITIALIZED_NEW_INT(sz);
+ if (versionData == nil) {
+ RETURN (nil);
+ }
+ if (GetFileVersionInfo(__stringVal(aPathName), 0, sz, __ByteArrayInstPtr(versionData)->ba_element) == FALSE) {
+ RETURN (nil);
+ }
+ RETURN (versionData);
}
RETURN (nil);
badArgument: ;
@@ -4693,16 +4693,16 @@
"return some object filled with info for the file 'aPathName';
the info (for which corresponding access methods are understood by
the returned object) is:
- type - a symbol giving the files type
- mode - numeric access mode
- uid - owners user id
- gid - owners group id
- size - files size
- id - files number (i.e. inode number)
- accessed - last access time (as Timestamp)
- modified - last modification time (as Timestamp)
- statusChanged - last status change time (as Timestamp)
- alternativeName - (windows only:) the MSDOS name of the file
+ type - a symbol giving the files type
+ mode - numeric access mode
+ uid - owners user id
+ gid - owners group id
+ size - files size
+ id - files number (i.e. inode number)
+ accessed - last access time (as Timestamp)
+ modified - last modification time (as Timestamp)
+ statusChanged - last status change time (as Timestamp)
+ alternativeName - (windows only:) the MSDOS name of the file
Some of the fields may be returned as nil on systems which do not provide
all of the information.
@@ -4716,10 +4716,10 @@
info := self linkInfoOf:aPathName.
(info notNil and:[info isSymbolicLink]) ifTrue:[
- target := info path.
- target notNil ifTrue:[
- ^ self linkInfoOf:target.
- ]
+ target := info path.
+ target notNil ifTrue:[
+ ^ self linkInfoOf:target.
+ ]
].
^ info
@@ -4741,67 +4741,67 @@
%{
if (__isString(aPathName)) {
- int ret;
+ int ret;
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesA((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesA((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
}
#ifdef SUPPORT_WIDE_CHAR_FILENAMES
if (__isUnicode16String(aPathName)) {
- int ret;
+ int ret;
#ifdef DO_WRAP_CALLS
- unsigned char _wPathName[MAXPATHLEN];
- int i;
+ unsigned char _wPathName[MAXPATHLEN];
+ int i;
# if 1
- for (i=0; i<MAXPATHLEN; i++) {
- _wPathName[i] = __unicode16StringVal(aPathName)[i];
- if (_wPathName[i] == 0) break;
- }
+ for (i=0; i<MAXPATHLEN; i++) {
+ _wPathName[i] = __unicode16StringVal(aPathName)[i];
+ if (_wPathName[i] == 0) break;
+ }
# else
- wstrncpy(_wPathName, __unicode16StringVal(aPathName), MAXPATHLEN-1); _wPathName[MAXPATHLEN-1] = '\0';
-# endif
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesW(__unicode16StringVal(wPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
+ wstrncpy(_wPathName, __unicode16StringVal(aPathName), MAXPATHLEN-1); _wPathName[MAXPATHLEN-1] = '\0';
+# endif
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesW(__unicode16StringVal(wPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
}
#endif /* SUPPORT_WIDE_CHAR_FILENAMES */
%}.
^ self primitiveFailed
"an alternative implementation would be:
- ^ (self infoOf:aPathName) type == #directory
+ ^ (self infoOf:aPathName) type == #directory
"
"Modified: / 05-07-2006 / 17:23:42 / cg"
@@ -4828,24 +4828,24 @@
if (__isString(aPathName)) {
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributes((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN ( (ret & FILE_ATTRIBUTE_HIDDEN) ? true : false);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributes((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN ( (ret & FILE_ATTRIBUTE_HIDDEN) ? true : false);
}
%}.
^ self primitiveFailed
@@ -4857,68 +4857,68 @@
%{
if (__isString(aPathName)) {
- int ret;
-
- /*
- * under windows, all files are readable ...
- * so, only check for the files existence here.
- */
+ int ret;
+
+ /*
+ * under windows, all files are readable ...
+ * so, only check for the files existence here.
+ */
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesA((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN (false);
- }
- RETURN (true);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesA((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN (false);
+ }
+ RETURN (true);
}
#ifdef SUPPORT_WIDE_CHAR_FILENAMES
if (__isUnicode16String(aPathName)) {
- int ret;
-
- /*
- * under windows, all files are readable ...
- * so, only check for the files existence here.
- */
+ int ret;
+
+ /*
+ * under windows, all files are readable ...
+ * so, only check for the files existence here.
+ */
#ifdef DO_WRAP_CALLS
- unsigned short _wPathName[MAXPATHLEN];
+ unsigned short _wPathName[MAXPATHLEN];
# if 1
- int i;
- for (i=0; i<MAXPATHLEN; i++) {
- _wPathName[i] = __unicode16StringVal(aPathName)[i];
- if (_wPathName[i] == 0) break;
- }
+ int i;
+ for (i=0; i<MAXPATHLEN; i++) {
+ _wPathName[i] = __unicode16StringVal(aPathName)[i];
+ if (_wPathName[i] == 0) break;
+ }
# else
- wstrncpy(_wPathName, __unicode16StringVal(aPathName), MAXPATHLEN-1); _wPathName[MAXPATHLEN-1] = '\0';
-# endif
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesW(__unicode16StringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN (false);
- }
- RETURN (true);
+ wstrncpy(_wPathName, __unicode16StringVal(aPathName), MAXPATHLEN-1); _wPathName[MAXPATHLEN-1] = '\0';
+# endif
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesW(__unicode16StringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN (false);
+ }
+ RETURN (true);
}
#endif /* SUPPORT_WIDE_CHAR_FILENAMES */
%}.
@@ -4936,54 +4936,54 @@
if (__isString(aPathName) || __isSymbol(aPathName)) {
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesA((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN (true);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesA((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
#ifdef SUPPORT_WIDE_CHAR_FILENAMES
if (__isUnicode16String(aPathName)) {
#ifdef DO_WRAP_CALLS
- unsigned short _wPathName[MAXPATHLEN];
+ unsigned short _wPathName[MAXPATHLEN];
# if 1
- int i;
- for (i=0; i<MAXPATHLEN; i++) {
- _wPathName[i] = __unicode16StringVal(aPathName)[i];
- if (_wPathName[i] == 0) break;
- }
+ int i;
+ for (i=0; i<MAXPATHLEN; i++) {
+ _wPathName[i] = __unicode16StringVal(aPathName)[i];
+ if (_wPathName[i] == 0) break;
+ }
# else
- wstrncpy(_wPathName, __unicode16StringVal(aPathName), MAXPATHLEN-1); _wPathName[MAXPATHLEN-1] = '\0';
-# endif
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesW(__unicode16StringVal(wPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN (true);
+ wstrncpy(_wPathName, __unicode16StringVal(aPathName), MAXPATHLEN-1); _wPathName[MAXPATHLEN-1] = '\0';
+# endif
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesW(__unicode16StringVal(wPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
#endif /* SUPPORT_WIDE_CHAR_FILENAMES */
%}.
@@ -5001,24 +5001,24 @@
if (__isString(aPathName)) {
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributes((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN ( (ret & FILE_ATTRIBUTE_READONLY) ? false : true);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributes((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN ( (ret & FILE_ATTRIBUTE_READONLY) ? false : true);
}
%}.
^ self primitiveFailed
@@ -5240,8 +5240,8 @@
Returns nil if no mimeType for the given suffix is known."
^ RegistryEntry
- stringValueFor:'Content Type'
- atKey:('HKEY_CLASSES_ROOT\.' , aFileSuffix)
+ stringValueFor:'Content Type'
+ atKey:('HKEY_CLASSES_ROOT\.' , aFileSuffix)
"
self mimeTypeForSuffix:'au'
@@ -5274,20 +5274,20 @@
path := self primPathNameOf:pathName.
path isNil ifTrue:[
- (self isValidPath:pathName) ifFalse:[
- p := pathName.
- [(p size > 1)
- and:[p endsWith:(self fileSeparator)]
- ] whileTrue:[
- p := p copyWithoutLast:1.
- ].
- ^ p
- ].
-
- "/
- "/ return the original - there is nothing else can we do
- "/
- path := self compressPath:pathName
+ (self isValidPath:pathName) ifFalse:[
+ p := pathName.
+ [(p size > 1)
+ and:[p endsWith:(self fileSeparator)]
+ ] whileTrue:[
+ p := p copyWithoutLast:1.
+ ].
+ ^ p
+ ].
+
+ "/
+ "/ return the original - there is nothing else can we do
+ "/
+ path := self compressPath:pathName
].
^ path.
@@ -5335,50 +5335,50 @@
%{ /* xxSTACK: 16000 */
if (__isStringLike(aPathName)) {
- char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
- char *pFinal;
- int rslt;
+ char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
+ char *pFinal;
+ int rslt;
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- rslt = STX_API_CALL4( "GetFullPathName", GetFullPathName, _aPathName, sizeof(nameBuffer), nameBuffer, &pFinal);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetFullPathName(__stringVal(aPathName), sizeof(nameBuffer), nameBuffer, &pFinal);
-#endif
-
- if (rslt > 0) {
- /*
- * Attention: GetLongPathName is not available on old NT4.0/W95/W98
- */
- static FARPROC entry = NULL;
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_CALL4( "GetFullPathName", GetFullPathName, _aPathName, sizeof(nameBuffer), nameBuffer, &pFinal);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetFullPathName(__stringVal(aPathName), sizeof(nameBuffer), nameBuffer, &pFinal);
+#endif
+
+ if (rslt > 0) {
+ /*
+ * Attention: GetLongPathName is not available on old NT4.0/W95/W98
+ */
+ static FARPROC entry = NULL;
#ifdef NO_NT4_0_COMPATIBILITY
- entry = (FARPROC) GetLongPathName;
-#else
- if (entry == NULL) {
- entry = __get_KERNEL32_functionAddress("GetLongPathNameA");
- }
+ entry = (FARPROC) GetLongPathName;
+#else
+ if (entry == NULL) {
+ entry = __get_KERNEL32_functionAddress("GetLongPathNameA");
+ }
#endif /* NO_NT4_0_COMPATIBILITY */
- if (entry) {
+ if (entry) {
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- rslt = STX_API_CALL3( "GetLongPathName", entry, nameBuffer, nameBuffer, sizeof(nameBuffer));
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = (*entry)(nameBuffer, nameBuffer, sizeof(nameBuffer));
-#endif
- }
- }
- if (rslt > 0) {
- RETURN ( __MKSTRING(nameBuffer) );
- }
- __threadErrno = __WIN32_ERR(GetLastError());
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_CALL3( "GetLongPathName", entry, nameBuffer, nameBuffer, sizeof(nameBuffer));
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = (*entry)(nameBuffer, nameBuffer, sizeof(nameBuffer));
+#endif
+ }
+ }
+ if (rslt > 0) {
+ RETURN ( __MKSTRING(nameBuffer) );
+ }
+ __threadErrno = __WIN32_ERR(GetLastError());
}
%}.
^ nil
@@ -5405,16 +5405,16 @@
int ret;
if (__isString(aPathName)) {
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- ret = STX_API_CALL2( "SetFileAttributes", SetFileAttributes, _aPathName, FILE_ATTRIBUTE_HIDDEN );
-
- if (ret != 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-
- RETURN (true);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ ret = STX_API_CALL2( "SetFileAttributes", SetFileAttributes, _aPathName, FILE_ATTRIBUTE_HIDDEN );
+
+ if (ret != 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+
+ RETURN (true);
}
%}.
^ self primitiveFailed
@@ -5431,16 +5431,16 @@
int ret;
if (__isString(aPathName)) {
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- ret = STX_API_CALL2( "SetFileAttributes", SetFileAttributes, _aPathName, FILE_ATTRIBUTE_NORMAL );
-
- if (ret != 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-
- RETURN (true);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ ret = STX_API_CALL2( "SetFileAttributes", SetFileAttributes, _aPathName, FILE_ATTRIBUTE_NORMAL );
+
+ if (ret != 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+
+ RETURN (true);
}
%}.
^ self primitiveFailed
@@ -5451,7 +5451,7 @@
For nonexistent files, nil is returned."
"could be implemented as:
- (self infoOf:aPathName) accessed
+ (self infoOf:aPathName) accessed
"
| i|
@@ -5469,7 +5469,7 @@
For nonexistent files, nil is returned."
"could be implemented as:
- (self infoOf:aPathName) modified
+ (self infoOf:aPathName) modified
"
| i|
@@ -5492,7 +5492,7 @@
"
this could have been implemented as:
- (self infoOf:aPathName) type
+ (self infoOf:aPathName) type
"
i := self infoOf:aPathName.
@@ -5546,7 +5546,7 @@
aPathString size < 2 ifTrue:[^ ''].
(aPathString at:2) == $: ifTrue:[
- ^ (aPathString at:1) asString.
+ ^ (aPathString at:1) asString.
].
^ ''
! !
@@ -5561,21 +5561,21 @@
|result|
Error
- handle:[:ex |
- self halt
- ] do:[
- |filename|
-
- filename := aFilenameOrString asFilename.
- result := self
- shellExecute:nil
- lpOperation:'open'
- lpFile:filename pathName
- lpParameters:nil
- lpDirectory:filename directory pathName
- nShowCmd:#SW_SHOWNORMAL.
- ^ self.
- ]
+ handle:[:ex |
+ self halt
+ ] do:[
+ |filename|
+
+ filename := aFilenameOrString asFilename.
+ result := self
+ shellExecute:nil
+ lpOperation:'open'
+ lpFile:filename pathName
+ lpParameters:nil
+ lpDirectory:filename directory pathName
+ nShowCmd:#SW_SHOWNORMAL.
+ ^ self.
+ ]
"
self openDocumentationFilename: 'C:\WINDOWS\Help\clipbrd.chm' asFilename
@@ -5632,8 +5632,8 @@
%{
while(1) {
- console_printf("blocking...");
- Sleep(50);
+ console_printf("blocking...");
+ Sleep(50);
}
%}.
"
@@ -5647,8 +5647,8 @@
%{
while(1) {
- console_printf("blocking...");
- STX_API_CALL1("Sleep", Sleep, 50);
+ console_printf("blocking...");
+ STX_API_CALL1("Sleep", Sleep, 50);
}
%}.
"
@@ -5670,8 +5670,8 @@
if (__isSmallInteger(signalNumber)) {
#ifdef SIG_DFL
- signal(__intVal(signalNumber), SIG_DFL);
- RETURN (self);
+ signal(__intVal(signalNumber), SIG_DFL);
+ RETURN (self);
#endif
}
%}.
@@ -5714,14 +5714,14 @@
%{ /* NOCONTEXT */
if (__isSmallInteger(signalNumber)) {
- int sigNo = __intVal(signalNumber);
-
- if (sigNo == 0) {
- RETURN (self);
- }
+ int sigNo = __intVal(signalNumber);
+
+ if (sigNo == 0) {
+ RETURN (self);
+ }
#ifdef SIG_IGN
- signal(sigNo, SIG_IGN);
- RETURN (self);
+ signal(sigNo, SIG_IGN);
+ RETURN (self);
#endif
}
%}.
@@ -5742,8 +5742,8 @@
disableTimer
"disable timer interrupts.
WARNING:
- the system will not operate correctly with timer interrupts
- disabled, because no scheduling or timeouts are possible."
+ the system will not operate correctly with timer interrupts
+ disabled, because no scheduling or timeouts are possible."
%{ /* NOCONTEXT */
@@ -5879,121 +5879,121 @@
&& (sigNr <= SIG_LIMIT)
#endif
) {
- /*
- * standard signals are forced into standard handlers
- * - all others go into general signalInterrupt
- */
+ /*
+ * standard signals are forced into standard handlers
+ * - all others go into general signalInterrupt
+ */
#if defined(SIGPOLL) && defined(SIGIO)
- if (sigNr == SIGPOLL)
- sigNr = SIGIO;
-#endif
- switch (sigNr) {
- case 0:
- /* enabling a non-supported signal */
- RETURN (self);
+ if (sigNr == SIGPOLL)
+ sigNr = SIGIO;
+#endif
+ switch (sigNr) {
+ case 0:
+ /* enabling a non-supported signal */
+ RETURN (self);
#ifdef SIGBREAK
- case SIGBREAK:
+ case SIGBREAK:
#endif
#ifdef SIGINT
- case SIGINT:
+ case SIGINT:
#endif
#ifdef SIGQUIT
- case SIGQUIT:
+ case SIGQUIT:
#endif
#ifdef SIGNALDEBUGWIN32
- console_printf("ConsoleSignal %d\n",sigNr);
-#endif
- SetConsoleCtrlHandler((PHANDLER_ROUTINE)__signalUserInterruptWIN32,TRUE);
- RETURN (self);
+ console_printf("ConsoleSignal %d\n",sigNr);
+#endif
+ SetConsoleCtrlHandler((PHANDLER_ROUTINE)__signalUserInterruptWIN32,TRUE);
+ RETURN (self);
#ifdef SIGFPE
- case SIGFPE:
- handler = __signalFpExceptionInterrupt;
- break;
+ case SIGFPE:
+ handler = __signalFpExceptionInterrupt;
+ break;
#endif
#ifdef SIGPIPE
- case SIGPIPE:
- handler = __signalPIPEInterrupt;
- break;
+ case SIGPIPE:
+ handler = __signalPIPEInterrupt;
+ break;
#endif
#ifdef SIGBUS
- case SIGBUS:
- handler = __signalBUSInterrupt;
- break;
+ case SIGBUS:
+ handler = __signalBUSInterrupt;
+ break;
#endif
#ifdef SIGSEGV
- case SIGSEGV:
- handler = __signalSEGVInterrupt;
- break;
+ case SIGSEGV:
+ handler = __signalSEGVInterrupt;
+ break;
#endif
#ifdef SIGILL
- case SIGILL:
- handler = __signalTrapInterrupt;
- break;
+ case SIGILL:
+ handler = __signalTrapInterrupt;
+ break;
#endif
#ifdef SIGEMT
- case SIGEMT:
- handler = __signalTrapInterrupt;
- break;
+ case SIGEMT:
+ handler = __signalTrapInterrupt;
+ break;
#endif
#ifdef SIGIO
- case SIGIO:
- handler = __signalIoInterrupt;
- break;
+ case SIGIO:
+ handler = __signalIoInterrupt;
+ break;
#endif
#ifdef CHILD_SIGNAL
- case CHILD_SIGNAL:
- handler = __signalChildInterrupt;
- break;
-#endif
-
- default:
- handler = __signalInterrupt;
- break;
- }
-
- {
+ case CHILD_SIGNAL:
+ handler = __signalChildInterrupt;
+ break;
+#endif
+
+ default:
+ handler = __signalInterrupt;
+ break;
+ }
+
+ {
#ifdef HAS_SIGACTION
- struct sigaction act;
-
- /*
- * Do not add SA_RESTART here. A signal can cause a
- * thread switch, another thread can do a garbage collect
- * and restarted system calls may write into old
- * (collected) addresses.
- */
-
- act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
- sigemptyset(&act.sa_mask);
- act.sa_handler = handler;
- sigaction(sigNr, &act, 0);
+ struct sigaction act;
+
+ /*
+ * Do not add SA_RESTART here. A signal can cause a
+ * thread switch, another thread can do a garbage collect
+ * and restarted system calls may write into old
+ * (collected) addresses.
+ */
+
+ act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
+ sigemptyset(&act.sa_mask);
+ act.sa_handler = handler;
+ sigaction(sigNr, &act, 0);
#else
# ifdef HAS_SIGVEC
- struct sigvec vec;
-
- vec.sv_flags = SV_INTERRUPT;
- sigemptyset(&vec.sv_mask);
- vec.sv_handler = handler;
- sigvec(sigNr, &vec, NULL);
+ struct sigvec vec;
+
+ vec.sv_flags = SV_INTERRUPT;
+ sigemptyset(&vec.sv_mask);
+ vec.sv_handler = handler;
+ sigvec(sigNr, &vec, NULL);
# else
# ifdef WIN32
# ifdef SIGNALDEBUGWIN32
- console_printf("signal %d can't change handler\n",sigNr);
+ console_printf("signal %d can't change handler\n",sigNr);
# endif
# else
- (void) signal(sigNr, handler);
+ (void) signal(sigNr, handler);
# endif
# endif
#endif
- }
-
- /*
- * maybe, we should Return the old enable-status
- * as boolean here ...
- */
- RETURN (self);
+ }
+
+ /*
+ * maybe, we should Return the old enable-status
+ * as boolean here ...
+ */
+ RETURN (self);
}
%}.
@@ -6011,8 +6011,8 @@
extern void __win32SetTimer();
if (__isSmallInteger(milliSeconds)) {
- __win32SetTimer( __intVal(milliSeconds) );
- RETURN (true);
+ __win32SetTimer( __intVal(milliSeconds) );
+ RETURN (true);
}
%}.
^ false
@@ -6032,8 +6032,8 @@
The process terminates immediately and has no chance to perform any cleanup actions.
WARNING: in order to avoid zombie processes (on unix),
- you have to fetch the processes exitstatus with
- OperatingSystem>>getStatusOfProcess:aProcessId."
+ you have to fetch the processes exitstatus with
+ OperatingSystem>>getStatusOfProcess:aProcessId."
self terminateProcess:processId
!
@@ -6045,9 +6045,9 @@
Do not confuse UNIX signals with Smalltalk-Signals.
WARNING: in order to avoid zombie processes (on unix),
- you may have to fetch the processes exitstatus with
- OperatingSystem>>getStatusOfProcess:aProcessId
- if the signal terminates that process."
+ you may have to fetch the processes exitstatus with
+ OperatingSystem>>getStatusOfProcess:aProcessId
+ if the signal terminates that process."
"/
"/ either invalid argument (non-integers)
@@ -6060,15 +6060,15 @@
"terminate a process.
The process has a chance to do some cleanup.
WIN32:
- Under unix, we have terminateProcess, which does a soft
- terminate (giving the process a chance to cleanup) and
- killProcess, which does a hard terminate.
- Under WIN32, both (currently) use the TerminateProcess
- function, which unconditionally causes a process to exit.
- I.e. under WIN32, the process has no chance to perform cleanup.
- Use it only in extreme circumstances. The state of
- global data maintained by dynamic-link libraries (DLLs)
- may be compromised if TerminateProcess is used.
+ Under unix, we have terminateProcess, which does a soft
+ terminate (giving the process a chance to cleanup) and
+ killProcess, which does a hard terminate.
+ Under WIN32, both (currently) use the TerminateProcess
+ function, which unconditionally causes a process to exit.
+ I.e. under WIN32, the process has no chance to perform cleanup.
+ Use it only in extreme circumstances. The state of
+ global data maintained by dynamic-link libraries (DLLs)
+ may be compromised if TerminateProcess is used.
TODO: send it a WM_QUIT instead, to allow for proper shutdown."
self terminateProcess:processHandle exitCode:0
@@ -6078,31 +6078,31 @@
"terminate a process.
The process should have a chance to do some cleanup.
WIN32:
- Under unix, we have terminateProcess, which does a soft
- terminate (giving the process a chance to cleanup) and
- killProcess, which does a hard terminate.
- Under WIN32, both (currently) use the TerminateProcess
- function, which unconditionally causes a process to exit.
- I.e. under WIN32, the process has no chance to perform cleanup.
- Use it only in extreme circumstances. The state of
- global data maintained by dynamic-link libraries (DLLs)
- may be compromised if TerminateProcess is used.
+ Under unix, we have terminateProcess, which does a soft
+ terminate (giving the process a chance to cleanup) and
+ killProcess, which does a hard terminate.
+ Under WIN32, both (currently) use the TerminateProcess
+ function, which unconditionally causes a process to exit.
+ I.e. under WIN32, the process has no chance to perform cleanup.
+ Use it only in extreme circumstances. The state of
+ global data maintained by dynamic-link libraries (DLLs)
+ may be compromised if TerminateProcess is used.
TODO: send it a WM_QUIT instead, to allow for proper shutdown."
%{
if (__isExternalAddressLike(processHandle) ) {
- HANDLE hProcess = _HANDLEVal(processHandle);
+ HANDLE hProcess = _HANDLEVal(processHandle);
#ifdef PROCESS1DEBUGWIN32
- console_printf("TerminateProcess handle: %x\n", hProcess);
-#endif
- if (hProcess != 0) {
- TerminateProcess(hProcess, __intVal(exitCode));
- } else {
- console_fprintf(stderr, "Win32OS [warning]: wrong hProcess in TerminateProcess\n");
- }
+ console_printf("TerminateProcess handle: %x\n", hProcess);
+#endif
+ if (hProcess != 0) {
+ TerminateProcess(hProcess, __intVal(exitCode));
+ } else {
+ console_fprintf(stderr, "Win32OS [warning]: wrong hProcess in TerminateProcess\n");
+ }
} else {
- console_fprintf(stderr, "Win32OS [warning]: wrong processHandle in TerminateProcess\n");
+ console_fprintf(stderr, "Win32OS [warning]: wrong processHandle in TerminateProcess\n");
}
%}
@@ -6114,26 +6114,26 @@
"terminate a process group.
The processes should have a chance to do some cleanup.
WIN32:
- The processGroup is terminated by sending it a CTRL-C
- using GenerateConsoleCtrlEvent."
+ The processGroup is terminated by sending it a CTRL-C
+ using GenerateConsoleCtrlEvent."
%{
if (__isExternalAddressLike(processGroupHandle) ) {
- HANDLE hProcessGroup = _HANDLEVal(processGroupHandle);
- DWORD processGroupId;
-
- if (hProcessGroup != (HANDLE)0) {
- processGroupId = __intVal( ((struct __Win32OperatingSystem__Win32ProcessHandle_struct *)(processGroupHandle))->pid );
+ HANDLE hProcessGroup = _HANDLEVal(processGroupHandle);
+ DWORD processGroupId;
+
+ if (hProcessGroup != (HANDLE)0) {
+ processGroupId = __intVal( ((struct __Win32OperatingSystem__Win32ProcessHandle_struct *)(processGroupHandle))->pid );
#ifdef PROCESS1DEBUGWIN32
- console_printf("TerminateProcessGroup processGroupHandle: %x (%d)\n", hProcessGroup, processGroupId);
-#endif
- GenerateConsoleCtrlEvent(CTRL_C_EVENT, processGroupId);
- } else {
- console_fprintf(stderr, "Win32OS [warning]: wrong hProcessGroup in TerminateProcessGroup \n");
- }
+ console_printf("TerminateProcessGroup processGroupHandle: %x (%d)\n", hProcessGroup, processGroupId);
+#endif
+ GenerateConsoleCtrlEvent(CTRL_C_EVENT, processGroupId);
+ } else {
+ console_fprintf(stderr, "Win32OS [warning]: wrong hProcessGroup in TerminateProcessGroup \n");
+ }
} else {
- console_fprintf(stderr, "Win32OS [warning]: wrong processGroupHandle in TerminateProcessGroup \n");
+ console_fprintf(stderr, "Win32OS [warning]: wrong processGroupHandle in TerminateProcessGroup \n");
}
%}
! !
@@ -6160,8 +6160,8 @@
sa.bInheritHandle = TRUE;
if( ! CreatePipe( &pipeRead, &pipeWrite, &sa, 0 ) ) {
- @global(LastErrorNumber) = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
- RETURN ( nil );
+ @global(LastErrorNumber) = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
+ RETURN ( nil );
}
#ifdef USE_HANDLES
@@ -6180,9 +6180,9 @@
#endif
%}.
(fd1 notNil and:[fd2 notNil]) ifTrue:[
- (fd1 ~~ -1 and:[fd2 ~~ -1]) ifTrue:[
- ^ Array with:fd1 with:fd2.
- ].
+ (fd1 ~~ -1 and:[fd2 ~~ -1]) ifTrue:[
+ ^ Array with:fd1 with:fd2.
+ ].
].
^ nil
! !
@@ -6193,15 +6193,15 @@
"free pid resource"
%{
if (__isExternalAddressLike(pid) ) {
- HANDLE __pid = _HANDLEVal(pid);
-
- if (__pid != 0) {
+ HANDLE __pid = _HANDLEVal(pid);
+
+ if (__pid != 0) {
#ifdef PROCESSDEBUGWIN32
- console_printf("Close ProcessHandle %x\n", __pid);
-#endif
- CloseHandle(__pid);
- _HANDLEVal(pid) = 0;
- }
+ console_printf("Close ProcessHandle %x\n", __pid);
+#endif
+ CloseHandle(__pid);
+ _HANDLEVal(pid) = 0;
+ }
}
%}.
^ true.
@@ -6238,17 +6238,17 @@
spaceForTargetHandle := ExternalLong new.
hMe := self getCurrentProcess.
rslt := self
- primDuplicateHandle_hSourcProcessHandle:hMe
- hSourceHandle:aHandle
- hTargetProcesshandle:targetProcessHandle
- lpTargetHandle:spaceForTargetHandle
- dwDesiredAccess:0
- bInheritHandle:false
- dwOptions:2 "DUPLICATE_SAME_ACCESS".
+ primDuplicateHandle_hSourcProcessHandle:hMe
+ hSourceHandle:aHandle
+ hTargetProcesshandle:targetProcessHandle
+ lpTargetHandle:spaceForTargetHandle
+ dwDesiredAccess:0
+ bInheritHandle:false
+ dwOptions:2 "DUPLICATE_SAME_ACCESS".
rslt ifFalse:[
- self primitiveFailed.
- ^ nil
+ self primitiveFailed.
+ ^ nil
].
^ ExternalAddress newAddress:(spaceForTargetHandle value).
@@ -6267,8 +6267,8 @@
getPrivateProfileString:appNameString key:keyNameString default:defaultString fileName:fileName
^ self
- getProfileString:appNameString key:keyNameString default:defaultString
- fileName:fileName private:true
+ getProfileString:appNameString key:keyNameString default:defaultString
+ fileName:fileName private:true
"Modified: / 27-07-2006 / 11:57:03 / fm"
!
@@ -6286,40 +6286,40 @@
OBJ retVal;
if (__isString(appNameString)) {
- __appNameString = __stringVal(appNameString);
+ __appNameString = __stringVal(appNameString);
} else if (appNameString != nil)
- goto primitiveFail;
+ goto primitiveFail;
if (__isString(keyNameString)) {
- __keyNameString = __stringVal(keyNameString);
+ __keyNameString = __stringVal(keyNameString);
} else if (keyNameString != nil)
- goto primitiveFail;
+ goto primitiveFail;
if (__isString(defaultString)) {
- __defaultString = __stringVal(defaultString);
+ __defaultString = __stringVal(defaultString);
} else if (defaultString != nil)
- goto primitiveFail;
+ goto primitiveFail;
do {
- nChars = GetProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize);
- if (nChars >= 0) {
- if (nChars != bufferSize-1) {
- retVal = __MKSTRING_L(usedBuffer, nChars);
- if (usedBuffer != quickBuffer) free(usedBuffer);
- RETURN (retVal);
- }
-
- {
- /* use a bigger buffer */
- char *newBuffer;
- int newBufferSize = bufferSize * 2;
-
- newBuffer = (char *)malloc( newBufferSize );
- if (usedBuffer != quickBuffer) free(usedBuffer);
- usedBuffer = newBuffer;
- bufferSize = newBufferSize;
- }
- }
+ nChars = GetProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize);
+ if (nChars >= 0) {
+ if (nChars != bufferSize-1) {
+ retVal = __MKSTRING_L(usedBuffer, nChars);
+ if (usedBuffer != quickBuffer) free(usedBuffer);
+ RETURN (retVal);
+ }
+
+ {
+ /* use a bigger buffer */
+ char *newBuffer;
+ int newBufferSize = bufferSize * 2;
+
+ newBuffer = (char *)malloc( newBufferSize );
+ if (usedBuffer != quickBuffer) free(usedBuffer);
+ usedBuffer = newBuffer;
+ bufferSize = newBufferSize;
+ }
+ }
} while (nChars > 0);
RETURN (nil);
@@ -6344,49 +6344,49 @@
OBJ retVal;
if (__isString(appNameString)) {
- __appNameString = __stringVal(appNameString);
+ __appNameString = __stringVal(appNameString);
} else if (appNameString != nil)
- goto primitiveFail;
+ goto primitiveFail;
if (__isString(keyNameString)) {
- __keyNameString = __stringVal(keyNameString);
+ __keyNameString = __stringVal(keyNameString);
} else if (keyNameString != nil)
- goto primitiveFail;
+ goto primitiveFail;
if (__isString(defaultString)) {
- __defaultString = __stringVal(defaultString);
+ __defaultString = __stringVal(defaultString);
} else if (defaultString != nil)
- goto primitiveFail;
+ goto primitiveFail;
if (private == true) {
- if (! __isString(fileName)) goto primitiveFail;
- __fileName = __stringVal(fileName);
+ if (! __isString(fileName)) goto primitiveFail;
+ __fileName = __stringVal(fileName);
}
do {
- if (private == true) {
- nChars = GetPrivateProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize, __fileName);
- } else {
- nChars = GetProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize);
- }
- if (nChars >= 0) {
- if (nChars != bufferSize-1) {
- retVal = __MKSTRING_L(usedBuffer, nChars);
- if (usedBuffer != quickBuffer) free(usedBuffer);
- RETURN (retVal);
- }
-
- {
- /* use a bigger buffer */
- char *newBuffer;
- int newBufferSize = bufferSize * 2;
-
- newBuffer = (char *)malloc( newBufferSize );
- if (usedBuffer != quickBuffer) free(usedBuffer);
- usedBuffer = newBuffer;
- bufferSize = newBufferSize;
- }
- }
+ if (private == true) {
+ nChars = GetPrivateProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize, __fileName);
+ } else {
+ nChars = GetProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize);
+ }
+ if (nChars >= 0) {
+ if (nChars != bufferSize-1) {
+ retVal = __MKSTRING_L(usedBuffer, nChars);
+ if (usedBuffer != quickBuffer) free(usedBuffer);
+ RETURN (retVal);
+ }
+
+ {
+ /* use a bigger buffer */
+ char *newBuffer;
+ int newBufferSize = bufferSize * 2;
+
+ newBuffer = (char *)malloc( newBufferSize );
+ if (usedBuffer != quickBuffer) free(usedBuffer);
+ usedBuffer = newBuffer;
+ bufferSize = newBufferSize;
+ }
+ }
} while (nChars > 0);
RETURN (nil);
@@ -6411,6 +6411,11 @@
"
!
+primCloseHandle: handle
+
+ <apicall: ulongReturn "CloseHandle" ( handle ) module: "kernel32.dll" >
+!
+
primDuplicateHandle_hSourcProcessHandle:hSourceProcess
hSourceHandle:hSourceHandle
hTargetProcesshandle:hTargetProcessHandle
@@ -6425,6 +6430,15 @@
"Created: / 18-09-2007 / 16:31:23 / cg"
!
+primGetLastError
+
+ <apicall: dword "GetLastError" () module: "kernel32.dll" >
+
+ "
+ self primGetLastError
+ "
+!
+
primWritePrivateProfileString: appName keyName: keyName profileString: profString fileName: aString
<apicall: bool "WritePrivateProfileStringA" ( lpstr lpstr lpstr lpstr ) module: "Kernel32.dll" >
@@ -6448,6 +6462,144 @@
"Modified: / 18-12-2006 / 13:20:20 / User"
! !
+!Win32OperatingSystem class methodsFor:'mutex'!
+
+createMutexNamed: name
+
+ "
+ If mutex is created, the return value is a handle to the newly created mutex object.
+ If the function fails, the return value is NULL.
+ If the mutex is a named mutex and the object existed before this function call, the return value is a handle to the existing object.
+ "
+
+ |handle|
+
+ handle := self primCreateMutex:nil initialOwner: true name: name.
+ handle isNil ifTrue:[Transcript showCR: 'OpenMutexNamed: "', name printString, '" failed'.].
+ self primGetLastError == 183 "ERROR_ALREADY_EXISTS" ifTrue:[Transcript showCR: 'Mutex already exists (GetLastError = ERROR_ALREADY_EXISTS)'.].
+ handle isValid ifFalse:[
+ Transcript showCR: 'OpenMutexNamed: "', name printString, '" failed'.
+ ^ nil.
+ ].
+ ^ handle
+
+ "
+ self createMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
+ self releaseMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
+ "
+!
+
+openMutexNamed: name
+
+ "
+ If the function succeeds, the return value is a handle to the mutex object.
+ If the function fails, the return value is NULL. To get extended error information, call GetLastError.
+ If a named mutex does not exist, the function fails and GetLastError returns ERROR_FILE_NOT_FOUND.
+ "
+
+ |handle lastErrorCode|
+
+ handle := self primOpenMutex:nil initialOwner: true name: name.
+ lastErrorCode := self primGetLastError.
+ lastErrorCode = 2 ifTrue:[Transcript showCR: 'Mutex does not exist (GetLastError = ERROR_FILE_NOT_FOUND)'.].
+ lastErrorCode = 5 ifTrue:[Transcript showCR: 'Mutex not accesible (GetLastError = ERROR_ACCESS_DENIED)'.].
+ handle isValid ifFalse:[
+ Transcript showCR: 'OpenMutexNamed: "', name printString, '" failed'.
+ ^ nil.
+ ].
+
+ ^ handle
+
+
+ "
+ self openMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
+ "
+!
+
+primCreateMutex:lpSecurityDescriptor initialOwner: bInitialOwner name: lpName
+
+ "
+ If the function succeeds, the return value is a handle to the newly created mutex object.
+ If the function fails, the return value is NULL.
+ If the mutex is a named mutex and the object existed before this function call, the return value is a handle to the existing object.
+ "
+
+
+ <apicall: handle "CreateMutexA" (lpstr bool lpstr) module: "kernel32.dll" >
+!
+
+primOpenMutex:lpSecurityDescriptor initialOwner: bInitialOwner name: lpName
+
+ "
+ If the function succeeds, the return value is a handle to the mutex object.
+ If the function fails, the return value is NULL. To get extended error information, call GetLastError.
+ If a named mutex does not exist, the function fails and GetLastError returns ERROR_FILE_NOT_FOUND.
+ "
+
+ <apicall: handle "OpenMutexA" (lpstr bool lpstr) module: "kernel32.dll" >
+!
+
+primReleaseMutex: hMutex
+
+ "
+ If the function succeeds, the return value is nonzero.
+ If the function fails, the return value is zero.
+ "
+
+ <apicall: int "ReleaseMutex" (handle) module: "kernel32.dll" >
+!
+
+releaseMutex: hMutex
+
+ "Returns true if the Mutex was released. Otherwise, returns false."
+
+ | result released|
+
+ hMutex isNil ifTrue:[
+ Transcript showCR: 'hMutex is nil - cannot release'.
+ ^ false
+ ].
+ result := self primReleaseMutex: hMutex.
+ released := result ~~ 0.
+ released ifFalse:[Transcript showCR: 'Release Mutex failed'.].
+ ^ released
+!
+
+releaseMutexNamed: name
+
+ "Returns true if the Mutex was released. Otherwise, returns false."
+
+ | hMutex |
+ hMutex := self openMutexNamed: name.
+ hMutex isNil ifTrue:[
+ Transcript showCR: 'Cannot release Mutex named: "', name printString,'"'.
+ ^ false
+ ].
+ ^ self releaseMutex: hMutex.
+!
+
+testMutex
+
+ |handle alreadyExists|
+
+ handle := self createMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'.
+ handle isNil ifTrue:[^ self].
+ alreadyExists := self primGetLastError == 183 "ERROR_ALREADY_EXISTS".
+ alreadyExists ifTrue:[
+ Transcript showCR: 'Mutex already exists!!'.
+ ^ self.
+ ].
+ Transcript showCR: 'Mutex created!!'.
+ self halt.
+ self releaseMutex: handle.
+ self primCloseHandle: handle.
+ Transcript showCR: 'Mutex closed!!'.
+
+ "
+ self testMutex
+ "
+! !
+
!Win32OperatingSystem class methodsFor:'os queries'!
executableFileExtensions
@@ -6462,66 +6614,66 @@
getDomainName
"return the domain this host is in.
Notice:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
|name idx hostName k|
DomainName notNil ifTrue:[
- ^ DomainName
+ ^ DomainName
].
name := self getEnvironment:'DOMAIN'.
name isNil ifTrue:[
- name := self getEnvironment:'DOMAINNAME'.
+ name := self getEnvironment:'DOMAINNAME'.
].
name isNil ifTrue:[
- "/ sometimes, we can extract the domainName from the hostName ...
- hostName := self primGetHostName.
- hostName notNil ifTrue:[
- idx := hostName indexOf:$..
- idx ~~ 0 ifTrue:[
- name := hostName copyFrom:idx+1.
- ]
- ].
- name isNil ifTrue:[
- "/ ok, search the registry ...
-
- "/ under NT, it is found there ...
- k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System'.
- k notNil ifTrue:[
- k subKeysDo:[:subKey |
- subKey subKeysDo:[:subSubKey |
- |tcp params|
-
- (subSubKey path asLowercase endsWith:'services') ifTrue:[
- tcp := subSubKey subKeyNamed:'tcpip'.
- tcp notNil ifTrue:[
- params := tcp subKeyNamed:'parameters'.
- params notNil ifTrue:[
- name := params valueNamed:'Domain'.
- params close.
- ].
- tcp close.
- ]
- ]
- ]
- ]
- ].
- ].
- name isNil ifTrue:[
- "/ under Win95/Win98, it is found there ...
- k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP'.
- k notNil ifTrue:[
- name := k valueNamed:'Domain'.
- k close.
- ]
- ].
-
- name isNil ifTrue:[
- 'Win32OperatingSystem [warning]: cannot find out domainname' errorPrintCR.
- name := 'unknown'.
- ]
+ "/ sometimes, we can extract the domainName from the hostName ...
+ hostName := self primGetHostName.
+ hostName notNil ifTrue:[
+ idx := hostName indexOf:$..
+ idx ~~ 0 ifTrue:[
+ name := hostName copyFrom:idx+1.
+ ]
+ ].
+ name isNil ifTrue:[
+ "/ ok, search the registry ...
+
+ "/ under NT, it is found there ...
+ k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System'.
+ k notNil ifTrue:[
+ k subKeysDo:[:subKey |
+ subKey subKeysDo:[:subSubKey |
+ |tcp params|
+
+ (subSubKey path asLowercase endsWith:'services') ifTrue:[
+ tcp := subSubKey subKeyNamed:'tcpip'.
+ tcp notNil ifTrue:[
+ params := tcp subKeyNamed:'parameters'.
+ params notNil ifTrue:[
+ name := params valueNamed:'Domain'.
+ params close.
+ ].
+ tcp close.
+ ]
+ ]
+ ]
+ ]
+ ].
+ ].
+ name isNil ifTrue:[
+ "/ under Win95/Win98, it is found there ...
+ k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP'.
+ k notNil ifTrue:[
+ name := k valueNamed:'Domain'.
+ k close.
+ ]
+ ].
+
+ name isNil ifTrue:[
+ 'Win32OperatingSystem [warning]: cannot find out domainname' errorPrintCR.
+ name := 'unknown'.
+ ]
].
DomainName := name.
^ name
@@ -6542,28 +6694,28 @@
char *env;
if (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) {
- char buff[1024];
- int nNeeded;
- OBJ ret = nil;
-
- nNeeded = GetEnvironmentVariable(__stringVal(aStringOrSymbol),
- buff,
- sizeof(buff));
- if (nNeeded > sizeof(buff)) {
- char *buff2;
-
- buff2 = (char *)malloc(nNeeded);
- GetEnvironmentVariable(__stringVal(aStringOrSymbol),
- buff2,
- nNeeded);
- ret = __MKSTRING(buff2);
- free(buff2);
- } else {
- if (nNeeded > 0) {
- ret = __MKSTRING(buff);
- }
- }
- RETURN (ret);
+ char buff[1024];
+ int nNeeded;
+ OBJ ret = nil;
+
+ nNeeded = GetEnvironmentVariable(__stringVal(aStringOrSymbol),
+ buff,
+ sizeof(buff));
+ if (nNeeded > sizeof(buff)) {
+ char *buff2;
+
+ buff2 = (char *)malloc(nNeeded);
+ GetEnvironmentVariable(__stringVal(aStringOrSymbol),
+ buff2,
+ nNeeded);
+ ret = __MKSTRING(buff2);
+ free(buff2);
+ } else {
+ if (nNeeded > 0) {
+ ret = __MKSTRING(buff);
+ }
+ }
+ RETURN (ret);
}
%}
.
@@ -6585,12 +6737,12 @@
"return the hostname we are running on - if there is
a HOST environment variable, we are much faster here ...
Notice:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
|name idx|
HostName notNil ifTrue:[
- ^ HostName
+ ^ HostName
].
name := self primGetHostName.
@@ -6599,8 +6751,8 @@
"/ decompose it here.
idx := name indexOf:$..
idx ~~ 0 ifTrue:[
- DomainName := name copyFrom:(idx+1).
- name := name copyTo:(idx-1).
+ DomainName := name copyFrom:(idx+1).
+ name := name copyTo:(idx-1).
].
HostName := name.
^ name
@@ -6618,14 +6770,14 @@
lang := self getEnvironment:'LANG'.
(lang isNil or:[lang = 'default']) ifTrue:[
- "/ ok, search the registry ...
- "/ under XP, it is found there ...
- lang := RegistryEntry
- stringValueFor:'sLanguage'
- atKey:'HKEY_CURRENT_USER\Control Panel\International'.
- lang notNil ifTrue:[
- lang := self mapLanguage:lang.
- ].
+ "/ ok, search the registry ...
+ "/ under XP, it is found there ...
+ lang := RegistryEntry
+ stringValueFor:'sLanguage'
+ atKey:'HKEY_CURRENT_USER\Control Panel\International'.
+ lang notNil ifTrue:[
+ lang := self mapLanguage:lang.
+ ].
].
^ lang
@@ -6639,42 +6791,42 @@
"return a dictionary filled with values from the locale information;
Not all fields may be present, depending on the OS's setup and capabilities.
Possible fields are:
- decimalPoint <String>
-
- thousandsSep <String>
-
- internationalCurrencySymbol <String>
-
- currencySymbol <String>
-
- monetaryDecimalPoint <String>
-
- monetaryThousandsSeparator <String>
-
- positiveSign <String>
-
- negativeSign <String>
-
- internationalFractionalDigits <Integer>
-
- fractionalDigits <Integer>
-
- positiveSignPrecedesCurrencySymbol <Boolean>
-
- negativeSignPrecedesCurrencySymbol <Boolean>
-
- positiveSignSeparatedBySpaceFromCurrencySymbol <Boolean>
-
- negativeSignSeparatedBySpaceFromCurrencySymbol <Boolean>
-
- positiveSignPosition <Symbol>
- one of: #parenthesesAround,
- #signPrecedes,
- #signSuceeds,
- #signPrecedesCurrencySymbol,
- #signSuceedsCurrencySymbol
-
- negativeSignPosition <like above>
+ decimalPoint <String>
+
+ thousandsSep <String>
+
+ internationalCurrencySymbol <String>
+
+ currencySymbol <String>
+
+ monetaryDecimalPoint <String>
+
+ monetaryThousandsSeparator <String>
+
+ positiveSign <String>
+
+ negativeSign <String>
+
+ internationalFractionalDigits <Integer>
+
+ fractionalDigits <Integer>
+
+ positiveSignPrecedesCurrencySymbol <Boolean>
+
+ negativeSignPrecedesCurrencySymbol <Boolean>
+
+ positiveSignSeparatedBySpaceFromCurrencySymbol <Boolean>
+
+ negativeSignSeparatedBySpaceFromCurrencySymbol <Boolean>
+
+ positiveSignPosition <Symbol>
+ one of: #parenthesesAround,
+ #signPrecedes,
+ #signSuceeds,
+ #signPrecedesCurrencySymbol,
+ #signSuceedsCurrencySymbol
+
+ negativeSignPosition <like above>
it is up to the application to deal with undefined values.
@@ -6685,9 +6837,9 @@
|info val|
LocaleInfo notNil ifTrue:[
- "/ return the internal info; useful on systems which do not
- "/ support this.
- ^ LocaleInfo
+ "/ return the internal info; useful on systems which do not
+ "/ support this.
+ ^ LocaleInfo
].
info := IdentityDictionary new.
@@ -6708,31 +6860,31 @@
int csNegSepBySpace; /* money: 1 if currency symbol should be separated by a space from a negative value; 0 if no space */
int csPosSignPosition; /* money: 0: ()'s around the value & currency symbol */
int csNegSignPosition; /* 1: sign precedes the value & currency symbol */
- /* 2: sign succeeds the value & currency symbol */
- /* 3: sign immediately precedes the currency symbol */
- /* 4: sign immediately suceeds the currency symbol */
+ /* 2: sign succeeds the value & currency symbol */
+ /* 3: sign immediately precedes the currency symbol */
+ /* 4: sign immediately suceeds the currency symbol */
#if defined(HAS_LOCALECONV)
struct lconv *conf;
conf = localeconv();
if (conf) {
- decimalPoint = conf->decimal_point;
- thousandsSep = conf->thousands_sep;
- intCurrencySymbol = conf->int_curr_symbol;
- currencySymbol = conf->currency_symbol;
- monDecimalPoint = conf->mon_decimal_point;
- monThousandsSep = conf->mon_thousands_sep;
- positiveSign = conf->positive_sign;
- negativeSign = conf->negative_sign;
- intFractDigits = conf->int_frac_digits;
- fractDigits = conf->frac_digits;
- csPosPrecedes = conf->p_cs_precedes;
- csNegPrecedes = conf->n_cs_precedes;
- csPosSepBySpace = conf->p_sep_by_space;
- csNegSepBySpace = conf->n_sep_by_space;
- csPosSignPosition = conf->p_sign_posn;
- csNegSignPosition = conf->n_sign_posn;
+ decimalPoint = conf->decimal_point;
+ thousandsSep = conf->thousands_sep;
+ intCurrencySymbol = conf->int_curr_symbol;
+ currencySymbol = conf->currency_symbol;
+ monDecimalPoint = conf->mon_decimal_point;
+ monThousandsSep = conf->mon_thousands_sep;
+ positiveSign = conf->positive_sign;
+ negativeSign = conf->negative_sign;
+ intFractDigits = conf->int_frac_digits;
+ fractDigits = conf->frac_digits;
+ csPosPrecedes = conf->p_cs_precedes;
+ csNegPrecedes = conf->n_cs_precedes;
+ csPosSepBySpace = conf->p_sep_by_space;
+ csNegSepBySpace = conf->n_sep_by_space;
+ csPosSignPosition = conf->p_sign_posn;
+ csNegSignPosition = conf->n_sign_posn;
}
#else
decimalPoint = (char *)0;
@@ -6753,129 +6905,129 @@
csNegSignPosition = -1;
#endif
if (decimalPoint) {
- val = __MKSTRING(decimalPoint);
- __AT_PUT_(info, @symbol(decimalPoint), val);
+ val = __MKSTRING(decimalPoint);
+ __AT_PUT_(info, @symbol(decimalPoint), val);
}
if (thousandsSep) {
- val = __MKSTRING(thousandsSep);
- __AT_PUT_(info, @symbol(thousandsSeparator), val);
+ val = __MKSTRING(thousandsSep);
+ __AT_PUT_(info, @symbol(thousandsSeparator), val);
}
if (intCurrencySymbol) {
- val = __MKSTRING(intCurrencySymbol);
- __AT_PUT_(info, @symbol(internationCurrencySymbol), val);
+ val = __MKSTRING(intCurrencySymbol);
+ __AT_PUT_(info, @symbol(internationCurrencySymbol), val);
}
if (currencySymbol) {
- val = __MKSTRING(currencySymbol);
- __AT_PUT_(info, @symbol(currencySymbol), val);
+ val = __MKSTRING(currencySymbol);
+ __AT_PUT_(info, @symbol(currencySymbol), val);
}
if (monDecimalPoint) {
- val = __MKSTRING(monDecimalPoint);
- __AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
+ val = __MKSTRING(monDecimalPoint);
+ __AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
}
if (monThousandsSep) {
- val = __MKSTRING(monThousandsSep);
- __AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
+ val = __MKSTRING(monThousandsSep);
+ __AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
}
if (positiveSign) {
- val = __MKSTRING(positiveSign);
- __AT_PUT_(info, @symbol(positiveSign), val);
+ val = __MKSTRING(positiveSign);
+ __AT_PUT_(info, @symbol(positiveSign), val);
}
if (negativeSign) {
- val = __MKSTRING(negativeSign);
- __AT_PUT_(info, @symbol(negativeSign), val);
+ val = __MKSTRING(negativeSign);
+ __AT_PUT_(info, @symbol(negativeSign), val);
}
if (intFractDigits >= 0) {
- __AT_PUT_(info, @symbol(internationalFractionalDigits), __mkSmallInteger(intFractDigits));
+ __AT_PUT_(info, @symbol(internationalFractionalDigits), __mkSmallInteger(intFractDigits));
}
if (fractDigits >= 0) {
- __AT_PUT_(info, @symbol(fractionalDigits), __mkSmallInteger(fractDigits));
+ __AT_PUT_(info, @symbol(fractionalDigits), __mkSmallInteger(fractDigits));
}
if (csPosPrecedes >= 0) {
- if (csPosPrecedes == 0) {
- val = false;
- } else {
- val = true;
- }
- __AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
+ if (csPosPrecedes == 0) {
+ val = false;
+ } else {
+ val = true;
+ }
+ __AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
}
if (csNegPrecedes >= 0) {
- if (csNegPrecedes == 0) {
- val = false;
- } else {
- val = true;
- }
- __AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
+ if (csNegPrecedes == 0) {
+ val = false;
+ } else {
+ val = true;
+ }
+ __AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
}
if (csPosSepBySpace >= 0) {
- if (csPosSepBySpace == 0) {
- val = false;
- } else {
- val = true;
- }
- __AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
+ if (csPosSepBySpace == 0) {
+ val = false;
+ } else {
+ val = true;
+ }
+ __AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
}
if (csNegSepBySpace >= 0) {
- if (csNegSepBySpace == 0) {
- val = false;
- } else {
- val = true;
- }
- __AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
+ if (csNegSepBySpace == 0) {
+ val = false;
+ } else {
+ val = true;
+ }
+ __AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
}
switch (csPosSignPosition) {
- case 0:
- val = @symbol(parenthesesAround);
- break;
-
- case 1:
- val = @symbol(signPrecedes);
- break;
-
- case 2:
- val = @symbol(signSuceeds);
- break;
-
- case 3:
- val = @symbol(signPrecedesCurrencySymbol);
- break;
-
- case 4:
- val = @symbol(signSuceedsCurrencySymbol);
- break;
-
- default:
- val = nil;
+ case 0:
+ val = @symbol(parenthesesAround);
+ break;
+
+ case 1:
+ val = @symbol(signPrecedes);
+ break;
+
+ case 2:
+ val = @symbol(signSuceeds);
+ break;
+
+ case 3:
+ val = @symbol(signPrecedesCurrencySymbol);
+ break;
+
+ case 4:
+ val = @symbol(signSuceedsCurrencySymbol);
+ break;
+
+ default:
+ val = nil;
}
if (val != nil) {
- __AT_PUT_(info, @symbol(positiveSignPosition), val);
+ __AT_PUT_(info, @symbol(positiveSignPosition), val);
}
switch (csNegSignPosition) {
- case 0:
- val = @symbol(parenthesesAround);
- break;
-
- case 1:
- val = @symbol(signPrecedes);
- break;
-
- case 2:
- val = @symbol(signSuceeds);
- break;
-
- case 3:
- val = @symbol(signPrecedesCurrencySymbol);
- break;
-
- case 4:
- val = @symbol(signSuceedsCurrencySymbol);
- break;
-
- default:
- val = nil;
+ case 0:
+ val = @symbol(parenthesesAround);
+ break;
+
+ case 1:
+ val = @symbol(signPrecedes);
+ break;
+
+ case 2:
+ val = @symbol(signSuceeds);
+ break;
+
+ case 3:
+ val = @symbol(signPrecedesCurrencySymbol);
+ break;
+
+ case 4:
+ val = @symbol(signSuceedsCurrencySymbol);
+ break;
+
+ default:
+ val = nil;
}
if (val != nil) {
- __AT_PUT_(info, @symbol(negativeSignPosition), val);
+ __AT_PUT_(info, @symbol(negativeSignPosition), val);
}
%}.
^ info
@@ -6889,8 +7041,8 @@
getNetworkMACAddresses
"return a dictionary filled with
- key -> name of interface
- value -> the MAC adress (as ByteArray)
+ key -> name of interface
+ value -> the MAC adress (as ByteArray)
for each interface
"
@@ -6919,27 +7071,27 @@
entry2 = (FARPROC) GetAdaptersInfo;
#else
if (entry2 == NULL) {
- entry2 = __get_iphlpapi_functionAddress("GetAdaptersInfo");
+ entry2 = __get_iphlpapi_functionAddress("GetAdaptersInfo");
}
#endif /* NO_NT4_0_COMPATIBILITY */
if (entry2) {
- dwStatus = (*entry2)(
- AdapterInfo, // [out] buffer to receive data
- &dwBufLen); // [in] size of receive data buffer
- if (dwStatus == ERROR_SUCCESS) {
- PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
- unsigned char *bP;
- int nA = 0;
-
- bP = __byteArrayVal(rawData);
- do {
- name = __MKSTRING(pAdapterInfo->AdapterName);
- description = __MKSTRING(pAdapterInfo->Description);
- macAddress = __MKBYTEARRAY(pAdapterInfo->Address, 6);
- ipAddress = __MKSTRING(pAdapterInfo->IpAddressList.IpAddress.String);
- ipAddressMask = __MKSTRING(pAdapterInfo->IpAddressList.IpMask.String);
- entry = __ARRAY_NEW_INT(5);
+ dwStatus = (*entry2)(
+ AdapterInfo, // [out] buffer to receive data
+ &dwBufLen); // [in] size of receive data buffer
+ if (dwStatus == ERROR_SUCCESS) {
+ PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
+ unsigned char *bP;
+ int nA = 0;
+
+ bP = __byteArrayVal(rawData);
+ do {
+ name = __MKSTRING(pAdapterInfo->AdapterName);
+ description = __MKSTRING(pAdapterInfo->Description);
+ macAddress = __MKBYTEARRAY(pAdapterInfo->Address, 6);
+ ipAddress = __MKSTRING(pAdapterInfo->IpAddressList.IpAddress.String);
+ ipAddressMask = __MKSTRING(pAdapterInfo->IpAddressList.IpMask.String);
+ entry = __ARRAY_NEW_INT(5);
/*
* back to ST/X's String definition
*/
@@ -6949,33 +7101,33 @@
# ifdef __DEF_String
# define Context __DEF_Context
# endif
- __ArrayInstPtr(entry)->a_element[0] = name; __STORE(entry, name);
- __ArrayInstPtr(entry)->a_element[1] = description; __STORE(entry, description);
- __ArrayInstPtr(entry)->a_element[2] = macAddress; __STORE(entry, macAddress);
- __ArrayInstPtr(entry)->a_element[3] = ipAddress; __STORE(entry, ipAddress);
- __ArrayInstPtr(entry)->a_element[4] = ipAddressMask; __STORE(entry, ipAddressMask);
-
- __ArrayInstPtr(rawData)->a_element[nA] = entry; __STORE(rawData, entry);
- nA++;
- pAdapterInfo = pAdapterInfo->Next;
- } while(pAdapterInfo);
- nAdapters = __mkSmallInteger(nA);
- }
+ __ArrayInstPtr(entry)->a_element[0] = name; __STORE(entry, name);
+ __ArrayInstPtr(entry)->a_element[1] = description; __STORE(entry, description);
+ __ArrayInstPtr(entry)->a_element[2] = macAddress; __STORE(entry, macAddress);
+ __ArrayInstPtr(entry)->a_element[3] = ipAddress; __STORE(entry, ipAddress);
+ __ArrayInstPtr(entry)->a_element[4] = ipAddressMask; __STORE(entry, ipAddressMask);
+
+ __ArrayInstPtr(rawData)->a_element[nA] = entry; __STORE(rawData, entry);
+ nA++;
+ pAdapterInfo = pAdapterInfo->Next;
+ } while(pAdapterInfo);
+ nAdapters = __mkSmallInteger(nA);
+ }
}
#endif /* NO_GETADAPTERSINFO */
%}.
info := Dictionary new.
nAdapters notNil ifTrue:[
- 1 to:nAdapters do:[:i |
- |entry name description macAddr ipAddr|
-
- entry := rawData at:i.
- name := entry at:1.
- "/ description := entry at:2.
- macAddr := entry at:3.
- "/ ipAddr := entry at:4.
- info at:name put:macAddr.
- ].
+ 1 to:nAdapters do:[:i |
+ |entry name description macAddr ipAddr|
+
+ entry := rawData at:i.
+ name := entry at:1.
+ "/ description := entry at:2.
+ macAddr := entry at:3.
+ "/ ipAddr := entry at:4.
+ info at:name put:macAddr.
+ ].
].
^ info
@@ -6987,14 +7139,14 @@
getNumberOfProcessors
%{
- SYSTEM_INFO sInfo;
- GetSystemInfo(&sInfo);
-
- return __mkSmallInteger(sInfo.dwNumberOfProcessors);
+ SYSTEM_INFO sInfo;
+ GetSystemInfo(&sInfo);
+
+ return __mkSmallInteger(sInfo.dwNumberOfProcessors);
%}.
"
- self getNumberOfProcessors
+ self getNumberOfProcessors
"
!
@@ -7017,7 +7169,7 @@
"if supported by the OS, return the systemID;
a unique per machine identification.
WARNING:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
%{ /* NO_CONTEXT */
#if defined(HAS_GETHOSTID)
@@ -7031,15 +7183,15 @@
#endif
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
{
- char buffer[128];
-
- buffer[0] = 0;
- if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
- buffer[127] = 0;
- if (strlen(buffer) > 0) {
- RETURN(__MKSTRING(buffer));
- }
- }
+ char buffer[128];
+
+ buffer[0] = 0;
+ if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
+ buffer[127] = 0;
+ if (strlen(buffer) > 0) {
+ RETURN(__MKSTRING(buffer));
+ }
+ }
}
#endif
%}.
@@ -7063,25 +7215,25 @@
This method is mainly provided to augment error reports with some system
information.
(in case of system/version specific OS errors, conditional workarounds and patches
- may be based upon this info).
+ may be based upon this info).
Your application should NOT depend upon this in any way.
The returned info may (or may not) contain:
- #system -> some operating system identification (irix, Linux, nt, win32s ...)
- #version -> OS version (some os version identification)
- #release -> OS release (3.5, 1.2.1 ...)
- #node -> some host identification (hostname)
- #domain -> domain name (hosts domain)
- #machine -> type of machine (i586, mips ...)
+ #system -> some operating system identification (irix, Linux, nt, win32s ...)
+ #version -> OS version (some os version identification)
+ #release -> OS release (3.5, 1.2.1 ...)
+ #node -> some host identification (hostname)
+ #domain -> domain name (hosts domain)
+ #machine -> type of machine (i586, mips ...)
win32:
- #physicalRam -> total amount of physical memory
- #freeRam -> amount of free memory
- #swapSize -> size of swapSpace (page file)
- #freeSwap -> free bytes in swapSpace
- #virtualRam -> total amount of virtual memory
- #freeVirtual -> amount of free virtual memory
- #memoryLoad -> percentage of memory usage (useless)
+ #physicalRam -> total amount of physical memory
+ #freeRam -> amount of free memory
+ #swapSize -> size of swapSpace (page file)
+ #freeSwap -> free bytes in swapSpace
+ #virtualRam -> total amount of virtual memory
+ #freeVirtual -> amount of free virtual memory
+ #memoryLoad -> percentage of memory usage (useless)
"
|sys node rel ver minorVer majorVer mach dom info arch
@@ -7107,17 +7259,17 @@
majorVer = __mkSmallInteger(verMajor);
if (HIWORD(vsn) & 0x8000) {
- s = "win95";
+ s = "win95";
} else {
- if ((verMajor > 5)
- || ((verMajor == 5) && (verMinor >= 1))) {
- s = "xp";
- if (verMajor >= 6) {
- s = "vista";
- }
- } else {
- s = "nt";
- }
+ if ((verMajor > 5)
+ || ((verMajor == 5) && (verMinor >= 1))) {
+ s = "xp";
+ if (verMajor >= 6) {
+ s = "vista";
+ }
+ } else {
+ s = "nt";
+ }
}
sys = __MKSTRING(s);
len = snprintf(vsnBuffer, sizeof(vsnBuffer), "%d.%d", verMajor, verMinor);
@@ -7144,166 +7296,166 @@
#endif
{
#ifdef PROCESSOR_ARCHITECTURE_INTEL
- case PROCESSOR_ARCHITECTURE_INTEL:
- s = "intel";
- break;
+ case PROCESSOR_ARCHITECTURE_INTEL:
+ s = "intel";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_MIPS
- case PROCESSOR_ARCHITECTURE_MIPS:
- s = "mips";
- break;
+ case PROCESSOR_ARCHITECTURE_MIPS:
+ s = "mips";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_ALPHA
- case PROCESSOR_ARCHITECTURE_ALPHA:
- s = "alpha";
- break;
+ case PROCESSOR_ARCHITECTURE_ALPHA:
+ s = "alpha";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_ALPHA64
- case PROCESSOR_ARCHITECTURE_ALPHA64:
- s = "alpha64";
- break;
+ case PROCESSOR_ARCHITECTURE_ALPHA64:
+ s = "alpha64";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_PPC
- case PROCESSOR_ARCHITECTURE_PPC:
- s = "ppc";
- break;
+ case PROCESSOR_ARCHITECTURE_PPC:
+ s = "ppc";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_ARM
- case PROCESSOR_ARCHITECTURE_ARM:
- s = "arm";
- break;
+ case PROCESSOR_ARCHITECTURE_ARM:
+ s = "arm";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_SHX
- case PROCESSOR_ARCHITECTURE_SHX:
- s = "shx";
- break;
+ case PROCESSOR_ARCHITECTURE_SHX:
+ s = "shx";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_IA64
- case PROCESSOR_ARCHITECTURE_IA64:
- s = "ia64";
- break;
+ case PROCESSOR_ARCHITECTURE_IA64:
+ s = "ia64";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_MSIL
- case PROCESSOR_ARCHITECTURE_MSIL:
- s = "msil";
- break;
-#endif
- default:
- s = "unknown";
- break;
+ case PROCESSOR_ARCHITECTURE_MSIL:
+ s = "msil";
+ break;
+#endif
+ default:
+ s = "unknown";
+ break;
}
arch = __MKSTRING(s);
switch (sysInfo.dwProcessorType) {
#ifdef PROCESSOR_INTEL_386
- case PROCESSOR_INTEL_386:
- s = "i386";
- break;
+ case PROCESSOR_INTEL_386:
+ s = "i386";
+ break;
#endif
#ifdef PROCESSOR_INTEL_486
- case PROCESSOR_INTEL_486:
- s = "i486";
- break;
+ case PROCESSOR_INTEL_486:
+ s = "i486";
+ break;
#endif
#ifdef PROCESSOR_INTEL_PENTIUM
- case PROCESSOR_INTEL_PENTIUM:
- s = "i586";
- break;
+ case PROCESSOR_INTEL_PENTIUM:
+ s = "i586";
+ break;
#endif
#ifdef PROCESSOR_INTEL_860
- case PROCESSOR_INTEL_860:
- s = "i860";
- break;
+ case PROCESSOR_INTEL_860:
+ s = "i860";
+ break;
#endif
#ifdef PROCESSOR_INTEL_IA64
- case PROCESSOR_INTEL_IA64:
- s = "ia64";
- break;
+ case PROCESSOR_INTEL_IA64:
+ s = "ia64";
+ break;
#endif
#ifdef PROCESSOR_MIPS_R2000
- case PROCESSOR_MIPS_R2000:
- s = "r2000";
- break;
+ case PROCESSOR_MIPS_R2000:
+ s = "r2000";
+ break;
#endif
#ifdef PROCESSOR_MIPS_R3000
- case PROCESSOR_MIPS_R3000:
- s = "r3000";
- break;
+ case PROCESSOR_MIPS_R3000:
+ s = "r3000";
+ break;
#endif
#ifdef PROCESSOR_MIPS_R4000
- case PROCESSOR_MIPS_R4000:
- s = "r4000";
- break;
+ case PROCESSOR_MIPS_R4000:
+ s = "r4000";
+ break;
#endif
#ifdef PROCESSOR_ALPHA_21064
- case PROCESSOR_ALPHA_21064:
- s = "alpha21064";
- break;
+ case PROCESSOR_ALPHA_21064:
+ s = "alpha21064";
+ break;
#endif
#ifdef PROCESSOR_ARM720
- case PROCESSOR_ARM720:
- s = "arm720";
- break;
+ case PROCESSOR_ARM720:
+ s = "arm720";
+ break;
#endif
#ifdef PROCESSOR_ARM820
- case PROCESSOR_ARM820:
- s = "arm820";
- break;
+ case PROCESSOR_ARM820:
+ s = "arm820";
+ break;
#endif
#ifdef PROCESSOR_ARM920
- case PROCESSOR_ARM920:
- s = "arm920";
- break;
+ case PROCESSOR_ARM920:
+ s = "arm920";
+ break;
#endif
#ifdef PROCESSOR_ARM_7TDMI
- case PROCESSOR_ARM_7TDMI:
- s = "arm70001";
- break;
+ case PROCESSOR_ARM_7TDMI:
+ s = "arm70001";
+ break;
#endif
#ifdef PROCESSOR_PPC_601
- case PROCESSOR_PPC_601:
- s = "ppc601";
- break;
+ case PROCESSOR_PPC_601:
+ s = "ppc601";
+ break;
#endif
#ifdef PROCESSOR_PPC_603
- case PROCESSOR_PPC_603:
- s = "ppc603";
- break;
+ case PROCESSOR_PPC_603:
+ s = "ppc603";
+ break;
#endif
#ifdef PROCESSOR_PPC_604
- case PROCESSOR_PPC_604:
- s = "ppc604";
- break;
+ case PROCESSOR_PPC_604:
+ s = "ppc604";
+ break;
#endif
#ifdef PROCESSOR_PPC_620
- case PROCESSOR_PPC_620:
- s = "ppc620";
- break;
-#endif
-
- default:
- sprintf(vsnBuffer, "%d", sysInfo.dwProcessorType);
- s = vsnBuffer;
- break;
+ case PROCESSOR_PPC_620:
+ s = "ppc620";
+ break;
+#endif
+
+ default:
+ sprintf(vsnBuffer, "%d", sysInfo.dwProcessorType);
+ s = vsnBuffer;
+ break;
}
mach = __MKSTRING(s);
numberOfCPUs = __MKUINT(sysInfo.dwNumberOfProcessors);
%}.
sys isNil ifTrue:[
- sys := self getSystemType.
+ sys := self getSystemType.
].
node isNil ifTrue:[
- node := self getHostName.
+ node := self getHostName.
].
dom isNil ifTrue:[
- dom := self getDomainName.
+ dom := self getDomainName.
].
mach isNil ifTrue:[
- mach := self getCPUType.
+ mach := self getCPUType.
].
arch isNil ifTrue:[
- arch := 'unknown'.
+ arch := 'unknown'.
].
info := IdentityDictionary new.
@@ -7359,7 +7511,7 @@
char buffer[MAXPATHLEN];
if (GetWindowsDirectory(buffer, MAXPATHLEN)) {
- RETURN (__MKSTRING(buffer));
+ RETURN (__MKSTRING(buffer));
}
%}.
^ nil
@@ -7380,7 +7532,7 @@
char buffer[MAXPATHLEN];
if (GetSystemDirectory(buffer, MAXPATHLEN)) {
- RETURN (__MKSTRING(buffer));
+ RETURN (__MKSTRING(buffer));
}
%}.
^ nil
@@ -7418,7 +7570,7 @@
%{ /* NOCONTEXT */
if (__isWinNT)
- RETURN(true);
+ RETURN(true);
%}.
^ false.
!
@@ -7443,11 +7595,11 @@
maxFileNameLength
"return the max number of characters in a filename.
CAVEAT:
- Actually, the following is somewhat wrong - some systems
- support different sizes, depending on the volume.
- We return a somewhat conservative number here.
- Another entry, to query for volume specific max
- will be added in the future."
+ Actually, the following is somewhat wrong - some systems
+ support different sizes, depending on the volume.
+ We return a somewhat conservative number here.
+ Another entry, to query for volume specific max
+ will be added in the future."
%{ /* NOCONTEXT */
@@ -7525,54 +7677,54 @@
DWORD (__stdcall *pfnNetWkstaGetInfo)(LPWSTR servername, DWORD level, void *bufptr);
if (hNetApi32) {
- pfnNetApiBufferFree = (DWORD (__stdcall *)(void *)) GetProcAddress(hNetApi32, "NetApiBufferFree");
- pfnNetWkstaGetInfo = (DWORD (__stdcall *)(LPWSTR, DWORD, void *)) GetProcAddress(hNetApi32, "NetWkstaGetInfo");
+ pfnNetApiBufferFree = (DWORD (__stdcall *)(void *)) GetProcAddress(hNetApi32, "NetApiBufferFree");
+ pfnNetWkstaGetInfo = (DWORD (__stdcall *)(LPWSTR, DWORD, void *)) GetProcAddress(hNetApi32, "NetWkstaGetInfo");
}
if (hNetApi32 && pfnNetWkstaGetInfo && pfnNetApiBufferFree) {
- /* this way is more reliable, in case user has a local account. */
- char dname[256];
- DWORD dnamelen = sizeof(dname);
- struct {
- DWORD wki100_platform_id;
- LPWSTR wki100_computername;
- LPWSTR wki100_langroup;
- DWORD wki100_ver_major;
- DWORD wki100_ver_minor;
- } *pwi;
-
- /* NERR_Success *is* 0*/
- if (0 == pfnNetWkstaGetInfo(NULL, 100, &pwi)) {
- if (pwi->wki100_langroup && *(pwi->wki100_langroup)) {
- WideCharToMultiByte(CP_ACP, NULL, pwi->wki100_langroup,
- -1, (LPSTR)dname, dnamelen, NULL, NULL);
- }
- else {
- WideCharToMultiByte(CP_ACP, NULL, pwi->wki100_computername,
- -1, (LPSTR)dname, dnamelen, NULL, NULL);
- }
- pfnNetApiBufferFree(pwi);
- FreeLibrary(hNetApi32);
- RETURN (__MKSTRING(dname));
- }
- FreeLibrary(hNetApi32);
+ /* this way is more reliable, in case user has a local account. */
+ char dname[256];
+ DWORD dnamelen = sizeof(dname);
+ struct {
+ DWORD wki100_platform_id;
+ LPWSTR wki100_computername;
+ LPWSTR wki100_langroup;
+ DWORD wki100_ver_major;
+ DWORD wki100_ver_minor;
+ } *pwi;
+
+ /* NERR_Success *is* 0*/
+ if (0 == pfnNetWkstaGetInfo(NULL, 100, &pwi)) {
+ if (pwi->wki100_langroup && *(pwi->wki100_langroup)) {
+ WideCharToMultiByte(CP_ACP, NULL, pwi->wki100_langroup,
+ -1, (LPSTR)dname, dnamelen, NULL, NULL);
+ }
+ else {
+ WideCharToMultiByte(CP_ACP, NULL, pwi->wki100_computername,
+ -1, (LPSTR)dname, dnamelen, NULL, NULL);
+ }
+ pfnNetApiBufferFree(pwi);
+ FreeLibrary(hNetApi32);
+ RETURN (__MKSTRING(dname));
+ }
+ FreeLibrary(hNetApi32);
} else {
- /* Win95 doesn't have NetWksta*(), so do it the old way */
- char name[256];
- DWORD size = sizeof(name);
- if (hNetApi32)
- FreeLibrary(hNetApi32);
- if (GetUserName(name,&size)) {
- char sid[1024];
- DWORD sidlen = sizeof(sid);
- char dname[256];
- DWORD dnamelen = sizeof(dname);
- SID_NAME_USE snu;
- if (LookupAccountName(NULL, name, (PSID)&sid, &sidlen,
- dname, &dnamelen, &snu)) {
- RETURN (__MKSTRING(dname)); /* all that for this */
- }
- }
+ /* Win95 doesn't have NetWksta*(), so do it the old way */
+ char name[256];
+ DWORD size = sizeof(name);
+ if (hNetApi32)
+ FreeLibrary(hNetApi32);
+ if (GetUserName(name,&size)) {
+ char sid[1024];
+ DWORD sidlen = sizeof(sid);
+ char dname[256];
+ DWORD dnamelen = sizeof(dname);
+ SID_NAME_USE snu;
+ if (LookupAccountName(NULL, name, (PSID)&sid, &sidlen,
+ dname, &dnamelen, &snu)) {
+ RETURN (__MKSTRING(dname)); /* all that for this */
+ }
+ }
}
#endif /* not needed */
%}.
@@ -7583,7 +7735,7 @@
"return the hostname we are running on - if there is
a HOST environment variable, we are much faster here ...
Notice:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
|name|
@@ -7592,29 +7744,29 @@
char buffer[256];
if (gethostname(buffer, sizeof(buffer)) == 0) {
- name = __MKSTRING(buffer);
+ name = __MKSTRING(buffer);
}
#else
char buffer[128];
DWORD buffSize = sizeof(buffer);
if (GetComputerName(buffer, &buffSize) == TRUE) {
- name = __MKSTRING(buffer);
+ name = __MKSTRING(buffer);
}
#endif
%}.
name isNil ifTrue:[
- name := self getEnvironment:'HOST'.
- name isNil ifTrue:[
- name := self getEnvironment:'HOSTNAME'.
- name isNil ifTrue:[
- name := self getEnvironment:'COMPUTERNAME'.
- name isNil ifTrue:[
- 'Win32OperatingSystem [warning]: cannot find out hostname' errorPrintCR.
- name := 'unknown'.
- ]
- ]
- ]
+ name := self getEnvironment:'HOST'.
+ name isNil ifTrue:[
+ name := self getEnvironment:'HOSTNAME'.
+ name isNil ifTrue:[
+ name := self getEnvironment:'COMPUTERNAME'.
+ name isNil ifTrue:[
+ 'Win32OperatingSystem [warning]: cannot find out hostname' errorPrintCR.
+ name := 'unknown'.
+ ]
+ ]
+ ]
].
^ name
@@ -7776,39 +7928,39 @@
pPath := super defaultPackagePath.
pkgDirPath := self stxPackageDirPath.
pkgDirPath notNil ifTrue:[
- "/ and also add the packageDirPath from the registry ...
- dirs := pkgDirPath asCollectionOfSubstringsSeparatedBy:$;.
- dirs do:[:aDir |
- (pPath includes:aDir) ifFalse:[
- pPath add:aDir.
- ]
- ]
+ "/ and also add the packageDirPath from the registry ...
+ dirs := pkgDirPath asCollectionOfSubstringsSeparatedBy:$;.
+ dirs do:[:aDir |
+ (pPath includes:aDir) ifFalse:[
+ pPath add:aDir.
+ ]
+ ]
] ifFalse:[
- #(
- '\smalltalk'
- '\programme\smalltalk'
- '\programme\eXept\smalltalk'
- '\programs\smalltalk'
- '\programs\eXept\smalltalk'
- ) do:[:d | |dd|
- dd := d asFilename constructString:'packages'.
- (pPath includes:dd) ifFalse:[
- pPath add:dd.
- ].
- dd := (d asFilename construct:Smalltalk versionString) constructString:'packages'.
- (pPath includes:dd) ifFalse:[
- pPath add:dd.
- ].
- ].
+ #(
+ '\smalltalk'
+ '\programme\smalltalk'
+ '\programme\eXept\smalltalk'
+ '\programs\smalltalk'
+ '\programs\eXept\smalltalk'
+ ) do:[:d | |dd|
+ dd := d asFilename constructString:'packages'.
+ (pPath includes:dd) ifFalse:[
+ pPath add:dd.
+ ].
+ dd := (d asFilename construct:Smalltalk versionString) constructString:'packages'.
+ (pPath includes:dd) ifFalse:[
+ pPath add:dd.
+ ].
+ ].
].
"/ under windows, the commandName includes the path - good.
p := Smalltalk commandName.
p notNil ifTrue:[
- p := p asFilename directory constructString:'packages'.
- (pPath includes:p) ifFalse:[
- pPath add:p.
- ]
+ p := p asFilename directory constructString:'packages'.
+ (pPath includes:p) ifFalse:[
+ pPath add:p.
+ ]
].
pPath := pPath select:[:p | p asFilename exists].
^ pPath
@@ -7828,31 +7980,31 @@
libDirPath := self stxLibDirPath.
libDirPath notNil ifTrue:[
- "/ and also add the libDirPath from the registry ...
- (sysPath includes:libDirPath) ifFalse:[
- sysPath add:libDirPath
- ].
+ "/ and also add the libDirPath from the registry ...
+ (sysPath includes:libDirPath) ifFalse:[
+ sysPath add:libDirPath
+ ].
].
#(
- '\programs\eXept\smalltalk'
- '\programme\eXept\smalltalk'
- '\programs\smalltalk'
- '\programme\smalltalk'
- '\smalltalk'
+ '\programs\eXept\smalltalk'
+ '\programme\eXept\smalltalk'
+ '\programs\smalltalk'
+ '\programme\smalltalk'
+ '\smalltalk'
) do:[:dir |
- |vsnDir|
-
- (dir asFilename isDirectory) ifTrue:[
- vsnDir := dir , '\' , Smalltalk versionString.
- (vsnDir asFilename isDirectory) ifTrue:[
- (sysPath includes:vsnDir) ifFalse:[
- sysPath add:vsnDir.
- ]
- ].
- (sysPath includes:dir) ifFalse:[
- sysPath add:dir.
- ].
- ]
+ |vsnDir|
+
+ (dir asFilename isDirectory) ifTrue:[
+ vsnDir := dir , '\' , Smalltalk versionString.
+ (vsnDir asFilename isDirectory) ifTrue:[
+ (sysPath includes:vsnDir) ifFalse:[
+ sysPath add:vsnDir.
+ ]
+ ].
+ (sysPath includes:dir) ifFalse:[
+ sysPath add:dir.
+ ].
+ ]
].
^ sysPath
@@ -7867,7 +8019,7 @@
k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString.
k notNil ifTrue:[
- p := k valueNamed:'BinDir'.
+ p := k valueNamed:'BinDir'.
].
^ p
@@ -7880,17 +8032,17 @@
"ask the registry for the lib directory"
(Array
- with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString)
- with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'))
+ with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString)
+ with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'))
do:[:eachKeyToTry |
- |k p|
-
- k := RegistryEntry key:eachKeyToTry.
- k notNil ifTrue:[
- p := k valueNamed:'LibDir'.
- k closeKey.
- ^ p
- ].
+ |k p|
+
+ k := RegistryEntry key:eachKeyToTry.
+ k notNil ifTrue:[
+ p := k valueNamed:'LibDir'.
+ k closeKey.
+ ^ p
+ ].
].
^ nil
@@ -7906,7 +8058,7 @@
k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString.
k notNil ifTrue:[
- p := k valueNamed:'PackageDirPath'.
+ p := k valueNamed:'PackageDirPath'.
].
^ p
@@ -7984,22 +8136,22 @@
#define DM_OUT_DEFAULT DM_UPDATE
"
nBytesNeeded := self
- primDocumentProperties:nil
- hPrinter:hPrinter
- pDeviceName: deviceName
- pDevModeOutput:nil
- pDevModeInput:nil
- fMode:0.
+ primDocumentProperties:nil
+ hPrinter:hPrinter
+ pDeviceName: deviceName
+ pDevModeOutput:nil
+ pDevModeInput:nil
+ fMode:0.
devModeOutput := DevModeStructure new:(nBytesNeeded * 2 "never trust MS !!").
rslt := self
- primDocumentProperties:nil
- hPrinter:hPrinter
- pDeviceName: deviceName
- pDevModeOutput:devModeOutput
- pDevModeInput:pDevModeInputOrNil
- fMode:4+2.
+ primDocumentProperties:nil
+ hPrinter:hPrinter
+ pDeviceName: deviceName
+ pDevModeOutput:devModeOutput
+ pDevModeInput:pDevModeInputOrNil
+ fMode:4+2.
^ devModeOutput
@@ -8064,23 +8216,23 @@
#define DM_OUT_DEFAULT DM_UPDATE
"
nBytesNeeded := self
- primDocumentProperties:nil
- hPrinter:hPrinter
- pDeviceName: deviceName
- pDevModeOutput:nil
- pDevModeInput:nil
- fMode:0.
+ primDocumentProperties:nil
+ hPrinter:hPrinter
+ pDeviceName: deviceName
+ pDevModeOutput:nil
+ pDevModeInput:nil
+ fMode:0.
nBytesNeeded < 0 ifTrue:[^nil].
devModeOutput := DevModeStructure new:(nBytesNeeded * 2 "never trust MS !!").
rslt := self
- primDocumentProperties:nil
- hPrinter:hPrinter
- pDeviceName: deviceName
- pDevModeOutput:devModeOutput
- pDevModeInput:nil
- fMode:2.
+ primDocumentProperties:nil
+ hPrinter:hPrinter
+ pDeviceName: deviceName
+ pDevModeOutput:devModeOutput
+ pDevModeInput:nil
+ fMode:2.
^ devModeOutput
@@ -8103,19 +8255,19 @@
sizeBytesArray := ByteArray new:4.
bytesNeeded := self
- primGetPrinter:hPrinter
- level:2
- informationBuffer: nil
- bufferSize: 0
- bufferNeededSize:sizeBytesArray.
+ primGetPrinter:hPrinter
+ level:2
+ informationBuffer: nil
+ bufferSize: 0
+ bufferNeededSize:sizeBytesArray.
bytesNeeded := sizeBytesArray longAt:1.
informationBuffer := PrinterInfo2Structure new: bytesNeeded.
rslt := self
- primGetPrinter:hPrinter
- level:2
- informationBuffer:informationBuffer
- bufferSize: bytesNeeded
- bufferNeededSize:sizeBytesArray.
+ primGetPrinter:hPrinter
+ level:2
+ informationBuffer:informationBuffer
+ bufferSize: bytesNeeded
+ bufferNeededSize:sizeBytesArray.
self closePrinter: printerName.
^informationBuffer
@@ -8135,47 +8287,47 @@
printerNames := self getPrintersNames.
collectedInfo := OrderedCollection new.
printerNames do:[:eachName |
- |fn vol attributes nm deviceInfo infoFields driverName|
-
- attributes := Dictionary new.
-
- fn := eachName asFilename.
- vol := fn volume.
- vol notEmptyOrNil ifTrue:[
- (vol startsWith:'\\') ifTrue:[
- "/ a remote printer
- attributes at:#isRemotePrinter put:true.
- attributes at:#remotePrinterName put:(fn baseName).
- attributes at:#remotePrinterHost put:(fn directoryName copyFrom:3).
- ] ifFalse:[
- "/ some other printer
- ].
- ] ifFalse:[
- "/ some other printer
- ].
-
- deviceInfo := self getProfileString:'PrinterPorts' key:eachName default:''.
- "gives us smething like 'winspool,Ne00:,15,45',
- which is: driverName, deviceName, ? , ?"
-
- infoFields := deviceInfo asCollectionOfSubstringsSeparatedBy:$,.
- driverName := infoFields at:1.
- 2 to: infoFields size by:3 do:[:i |
- |medium longName|
-
- medium := infoFields at:i.
- longName := eachName ,',' , driverName , ',' , medium.
- attributes at:#driverName put:driverName.
- attributes at:#longName put:longName.
- attributes at:#medium put:medium.
-
- collectedInfo add:
- (AbstractOperatingSystem::PrinterInfo new
- printerName:eachName
- attributes:attributes;
- setDocumentProperties;
- yourself)
- ].
+ |fn vol attributes nm deviceInfo infoFields driverName|
+
+ attributes := Dictionary new.
+
+ fn := eachName asFilename.
+ vol := fn volume.
+ vol notEmptyOrNil ifTrue:[
+ (vol startsWith:'\\') ifTrue:[
+ "/ a remote printer
+ attributes at:#isRemotePrinter put:true.
+ attributes at:#remotePrinterName put:(fn baseName).
+ attributes at:#remotePrinterHost put:(fn directoryName copyFrom:3).
+ ] ifFalse:[
+ "/ some other printer
+ ].
+ ] ifFalse:[
+ "/ some other printer
+ ].
+
+ deviceInfo := self getProfileString:'PrinterPorts' key:eachName default:''.
+ "gives us smething like 'winspool,Ne00:,15,45',
+ which is: driverName, deviceName, ? , ?"
+
+ infoFields := deviceInfo asCollectionOfSubstringsSeparatedBy:$,.
+ driverName := infoFields at:1.
+ 2 to: infoFields size by:3 do:[:i |
+ |medium longName|
+
+ medium := infoFields at:i.
+ longName := eachName ,',' , driverName , ',' , medium.
+ attributes at:#driverName put:driverName.
+ attributes at:#longName put:longName.
+ attributes at:#medium put:medium.
+
+ collectedInfo add:
+ (AbstractOperatingSystem::PrinterInfo new
+ printerName:eachName
+ attributes:attributes;
+ setDocumentProperties;
+ yourself)
+ ].
].
^ collectedInfo
@@ -8193,7 +8345,7 @@
|printerNames|
printerNames := (self getProfileString:'PrinterPorts' key:nil default:'')
- asCollectionOfSubstringsSeparatedBy:(Character value:0).
+ asCollectionOfSubstringsSeparatedBy:(Character value:0).
printerNames := printerNames reject:[:nm | nm isEmpty].
^printerNames
@@ -8320,12 +8472,12 @@
hPrinter := self openPrinter:'\\http://exept.exept.de:631\lj4' .
rslt := self
- primDocumentProperties:nil
- hPrinter:hPrinter
- pDeviceName: '\\http://exept.exept.de:631\lj4'
- pDevModeOutput:nil
- pDevModeInput:nil
- fMode:0.
+ primDocumentProperties:nil
+ hPrinter:hPrinter
+ pDeviceName: '\\http://exept.exept.de:631\lj4'
+ pDevModeOutput:nil
+ pDevModeInput:nil
+ fMode:0.
self halt.
"
@@ -8342,12 +8494,12 @@
hPrinter := self openPrinter:'\\http://exept.exept.de:631\lj4' .
rslt := self
- primDocumentProperties:nil
- hPrinter:hPrinter
- pDeviceName: '\\http://exept.exept.de:631\lj4'
- pDevModeOutput:nil
- pDevModeInput:nil
- fMode:0.
+ primDocumentProperties:nil
+ hPrinter:hPrinter
+ pDeviceName: '\\http://exept.exept.de:631\lj4'
+ pDevModeOutput:nil
+ pDevModeInput:nil
+ fMode:0.
self halt.
"
@@ -8364,12 +8516,12 @@
hPrinter := self openPrinter:'\\http://exept.exept.de:631\lj4' .
rslt := self
- primDocumentProperties:nil
- hPrinter:hPrinter
- pDeviceName: '\\http://exept.exept.de:631\lj4'
- pDevModeOutput:nil
- pDevModeInput:nil
- fMode:0.
+ primDocumentProperties:nil
+ hPrinter:hPrinter
+ pDeviceName: '\\http://exept.exept.de:631\lj4'
+ pDevModeOutput:nil
+ pDevModeInput:nil
+ fMode:0.
self halt.
"
@@ -8398,20 +8550,20 @@
sizeBytesArray := ByteArray new:4.
ok := self
- primGetPrinter:hPrinter
- level:2
- informationBuffer: nil
- bufferSize: 0
- bufferNeededSize:sizeBytesArray.
+ primGetPrinter:hPrinter
+ level:2
+ informationBuffer: nil
+ bufferSize: 0
+ bufferNeededSize:sizeBytesArray.
bytesNeeded := sizeBytesArray longAt:1.
informationBuffer := PrinterInfo2Structure new: bytesNeeded.
rslt := self
- primGetPrinter:hPrinter
- level:2
- informationBuffer:informationBuffer
- bufferSize: bytesNeeded
- bufferNeededSize:sizeBytesArray.
+ primGetPrinter:hPrinter
+ level:2
+ informationBuffer:informationBuffer
+ bufferSize: bytesNeeded
+ bufferNeededSize:sizeBytesArray.
self assert: rslt.
informationBuffer inspect.
self closePrinter: printerName.
@@ -8549,9 +8701,9 @@
'NON' 'no_NO'
'NOR' 'no_NO'
) pairWiseDo:[:key :mappedValue|
- key = windowsLanguageString ifTrue:[
- ^ mappedValue
- ]
+ key = windowsLanguageString ifTrue:[
+ ^ mappedValue
+ ]
].
"no mapping"
@@ -8571,24 +8723,24 @@
!Win32OperatingSystem class methodsFor:'regional settings'!
country
- "Answer the current system value for country."
+ "Answer the current system value for country."
^self queryNationalProfileString: 'iCountry' default: 0
"
- self country
+ self country
"
"Modified: / 22-12-2006 / 16:45:32 / User"
!
countryName
- "Answer the current system value for country name."
+ "Answer the current system value for country name."
^self queryNationalProfileString: 'sCountry' default: 'Deutschland'
"
- self countryName
+ self countryName
"
"Modified: / 22-12-2006 / 16:45:32 / User"
@@ -8617,49 +8769,49 @@
!
dateFormatCode
- "Answer the current system value for date format.
- Answer DfMDY = Month-Day-Year = 0
- DfDMY = Day-Month-Year = 1
- DfYMD = Year-Month-Day = 2"
+ "Answer the current system value for date format.
+ Answer DfMDY = Month-Day-Year = 0
+ DfDMY = Day-Month-Year = 1
+ DfYMD = Year-Month-Day = 2"
^self queryNationalProfileInt: 'iDate' default: 0
"
- self dateFormatCode
+ self dateFormatCode
"
"Modified: / 22-12-2006 / 16:45:53 / User"
!
dateSeparator
- "Answer the current system value for date separator."
+ "Answer the current system value for date separator."
^self queryNationalProfileString: 'sDate' default: '/'
"
- self dateSeparator
+ self dateSeparator
"
"Modified: / 22-12-2006 / 16:45:32 / User"
!
decimalSeparator
- "Answer the current system value for decimal separator."
+ "Answer the current system value for decimal separator."
^self queryNationalProfileString: 'sDecimal' default: '.'
"
- self decimalSeparator
+ self decimalSeparator
"
"Created: / 22-12-2006 / 16:45:11 / User"
!
isDateFormatDMY
- "Answer the current system value for date format.
- Answer DfMDY = Month-Day-Year
- DfDMY = Day-Month-Year
- DfYMD = Year-Month-Day."
+ "Answer the current system value for date format.
+ Answer DfMDY = Month-Day-Year
+ DfDMY = Day-Month-Year
+ DfYMD = Year-Month-Day."
^self dateFormatCode = 1
@@ -8667,10 +8819,10 @@
!
isDateFormatMDY
- "Answer the current system value for date format.
- Answer DfMDY = Month-Day-Year
- DfDMY = Day-Month-Year
- DfYMD = Year-Month-Day."
+ "Answer the current system value for date format.
+ Answer DfMDY = Month-Day-Year
+ DfDMY = Day-Month-Year
+ DfYMD = Year-Month-Day."
^self dateFormatCode = 0
@@ -8678,10 +8830,10 @@
!
isDateFormatYMD
- "Answer the current system value for date format.
- Answer DfMDY = Month-Day-Year
- DfDMY = Day-Month-Year
- DfYMD = Year-Month-Day."
+ "Answer the current system value for date format.
+ Answer DfMDY = Month-Day-Year
+ DfDMY = Day-Month-Year
+ DfYMD = Year-Month-Day."
^self dateFormatCode = 2
@@ -8689,7 +8841,7 @@
!
isTimeFormat12Hour
- "Answer whether the current system time format is 12-hour."
+ "Answer whether the current system time format is 12-hour."
^self timeFormat = 0
@@ -8730,43 +8882,43 @@
!
queryNationalProfileString: aKeyName default: defaultValue
- "Answer the string value of key aKeyName in
- the [Intl] application section of the WIN.INI profile file.
- Answer defaultValue if aKeyName cannot be found."
+ "Answer the string value of key aKeyName in
+ the [Intl] application section of the WIN.INI profile file.
+ Answer defaultValue if aKeyName cannot be found."
| extString result |
extString := String new: 80.
result := self primGetProfileString: 'Intl'
- keyName: aKeyName
- default: ''
- returnedString: extString
- size: extString size.
+ keyName: aKeyName
+ default: ''
+ returnedString: extString
+ size: extString size.
^result > 0
- ifTrue: [extString copyFrom: 1 to: result]
- ifFalse: [ defaultValue ]
+ ifTrue: [extString copyFrom: 1 to: result]
+ ifFalse: [ defaultValue ]
"Created: / 22-12-2006 / 16:13:01 / User"
!
thousandsSeparator
- "Answer the current system value
- for the thousands separator."
+ "Answer the current system value
+ for the thousands separator."
^self queryNationalProfileString: 'sThousand' default: ','
"
- self thousandsSeparator
+ self thousandsSeparator
"
"Created: / 22-12-2006 / 16:46:50 / User"
!
timeFormat
- "Answer the current system value for time format."
+ "Answer the current system value for time format."
^self queryNationalProfileInt: 'iTime' default: 0
"
- self timeFormat
+ self timeFormat
"
"Created: / 22-12-2006 / 16:48:27 / User"
@@ -8949,27 +9101,27 @@
I added this in order to be able to shutdown w95 cleanly"
confirmationMessageOrNil notNil ifTrue:[
- (Dialog confirm:confirmationMessageOrNil) ifFalse:[
- ^ false
- ].
+ (Dialog confirm:confirmationMessageOrNil) ifFalse:[
+ ^ false
+ ].
].
%{
int flag;
if (how == @symbol(shutdown)) {
- flag = EWX_SHUTDOWN;
+ flag = EWX_SHUTDOWN;
} else if (how == @symbol(reboot)) {
- flag = EWX_REBOOT;
+ flag = EWX_REBOOT;
} else if (how == @symbol(logoff)) {
- flag = EWX_LOGOFF;
+ flag = EWX_LOGOFF;
} else if (how == @symbol(forceShutdown)) {
- flag = EWX_SHUTDOWN | EWX_FORCE;
+ flag = EWX_SHUTDOWN | EWX_FORCE;
} else if (how == @symbol(forceReboot)) {
- flag = EWX_REBOOT | EWX_FORCE;
+ flag = EWX_REBOOT | EWX_FORCE;
} else if (how == @symbol(forceLogoff)) {
- flag = EWX_LOGOFF | EWX_FORCE;
+ flag = EWX_LOGOFF | EWX_FORCE;
} else {
- RETURN (false);
+ RETURN (false);
}
RETURN ((ExitWindowsEx(flag, 0) == TRUE) ? true : false);
%}
@@ -8999,25 +9151,25 @@
#else
/* be thread safe */
if (localtime_s(&tmValue, &tt) == 0)
- tmPtr = &tmValue;
+ tmPtr = &tmValue;
else
- tmPtr = NULL;
+ tmPtr = NULL;
#endif
if (tmPtr != NULL) {
- year = __mkSmallInteger(tmPtr->tm_year + 1900);
- month = __mkSmallInteger(tmPtr->tm_mon + 1);
- day = __mkSmallInteger(tmPtr->tm_mday);
+ year = __mkSmallInteger(tmPtr->tm_year + 1900);
+ month = __mkSmallInteger(tmPtr->tm_mon + 1);
+ day = __mkSmallInteger(tmPtr->tm_mday);
}
%}.
year isNil ifTrue:[
- self primitiveFailed
+ self primitiveFailed
].
aBlock value:year value:month value:day
"
OperatingSystem computeDatePartsOf:0 for:[:y :m :d |
- y printCR. m printCR. d printCR
+ y printCR. m printCR. d printCR
]
"
@@ -9036,36 +9188,36 @@
if (__bothSmallInteger(y, m)
&& __bothSmallInteger(d, h)
&& __bothSmallInteger(min, s)) {
- time_t t;
- TIME_ZONE_INFORMATION tzInfo;
- int gmtoffMinutes;
-
- if (GetTimeZoneInformation(&tzInfo) < 0) goto error;
-
- tm.tm_hour = __intVal(h);
- tm.tm_min = __intVal(min);
- tm.tm_sec = __intVal(s);
-
- tm.tm_year = __intVal(y) - 1900;
- tm.tm_mon = __intVal(m) - 1;
- tm.tm_mday = __intVal(d);
- tm.tm_isdst = -1;
-
- t = mktime(&tm);
-
- gmtoffMinutes = tzInfo.Bias;
- if (tm.tm_isdst) {
- gmtoffMinutes += tzInfo.DaylightBias;
- } else {
- gmtoffMinutes += tzInfo.StandardBias;
- }
- t = t - gmtoffMinutes*60;
- osSeconds = __MKUINT((INT)t);
+ time_t t;
+ TIME_ZONE_INFORMATION tzInfo;
+ int gmtoffMinutes;
+
+ if (GetTimeZoneInformation(&tzInfo) < 0) goto error;
+
+ tm.tm_hour = __intVal(h);
+ tm.tm_min = __intVal(min);
+ tm.tm_sec = __intVal(s);
+
+ tm.tm_year = __intVal(y) - 1900;
+ tm.tm_mon = __intVal(m) - 1;
+ tm.tm_mday = __intVal(d);
+ tm.tm_isdst = -1;
+
+ t = mktime(&tm);
+
+ gmtoffMinutes = tzInfo.Bias;
+ if (tm.tm_isdst) {
+ gmtoffMinutes += tzInfo.DaylightBias;
+ } else {
+ gmtoffMinutes += tzInfo.StandardBias;
+ }
+ t = t - gmtoffMinutes*60;
+ osSeconds = __MKUINT((INT)t);
}
error:;
%}.
osSeconds notNil ifTrue:[
- ^ osSeconds * 1000 + millis
+ ^ osSeconds * 1000 + millis
].
^ self primitiveFailed
@@ -9088,21 +9240,21 @@
if (__bothSmallInteger(y, m)
&& __bothSmallInteger(d, h)
&& __bothSmallInteger(min, s)) {
- tm.tm_hour = __intVal(h);
- tm.tm_min = __intVal(min);
- tm.tm_sec = __intVal(s);
-
- tm.tm_year = __intVal(y) - 1900;
- tm.tm_mon = __intVal(m) - 1;
- tm.tm_mday = __intVal(d);
- tm.tm_isdst = -1;
-
- t = mktime(&tm);
- osSeconds = __MKUINT((INT)t);
+ tm.tm_hour = __intVal(h);
+ tm.tm_min = __intVal(min);
+ tm.tm_sec = __intVal(s);
+
+ tm.tm_year = __intVal(y) - 1900;
+ tm.tm_mon = __intVal(m) - 1;
+ tm.tm_mday = __intVal(d);
+ tm.tm_isdst = -1;
+
+ t = mktime(&tm);
+ osSeconds = __MKUINT((INT)t);
}
%}.
osSeconds notNil ifTrue:[
- ^ osSeconds * 1000 + millis
+ ^ osSeconds * 1000 + millis
].
^ self primitiveFailed
@@ -9135,25 +9287,25 @@
#else
/* be thread safe */
if (localtime_s(&tmValue, &tt) == 0)
- tmPtr = &tmValue;
+ tmPtr = &tmValue;
else
- tmPtr = NULL;
+ tmPtr = NULL;
#endif
if (tmPtr != NULL) {
- hours = __mkSmallInteger(tmPtr->tm_hour);
- minutes = __mkSmallInteger(tmPtr->tm_min);
- seconds = __mkSmallInteger(tmPtr->tm_sec);
+ hours = __mkSmallInteger(tmPtr->tm_hour);
+ minutes = __mkSmallInteger(tmPtr->tm_min);
+ seconds = __mkSmallInteger(tmPtr->tm_sec);
}
%}.
hours isNil ifTrue:[
- self primitiveFailed
+ self primitiveFailed
].
aBlock value:hours value:minutes value:seconds value:millis
"
OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli |
- h printCR. m printCR. s printCR. millis printCR
+ h printCR. m printCR. s printCR. millis printCR
]
"
@@ -9196,18 +9348,18 @@
utcOffset = __MKINT(tmPtr->tm_gmtoff);
#else
{
- TIME_ZONE_INFORMATION tzInfo;
- int gmtoffMinutes = 0;
-
- if (GetTimeZoneInformation(&tzInfo) < 0) goto error;
- gmtoffMinutes = tzInfo.Bias;
- if (tmPtr->tm_isdst) {
- gmtoffMinutes += tzInfo.DaylightBias;
- } else {
- gmtoffMinutes += tzInfo.StandardBias;
- }
-
- utcOffset = __MKINT(gmtoffMinutes*60);
+ TIME_ZONE_INFORMATION tzInfo;
+ int gmtoffMinutes = 0;
+
+ if (GetTimeZoneInformation(&tzInfo) < 0) goto error;
+ gmtoffMinutes = tzInfo.Bias;
+ if (tmPtr->tm_isdst) {
+ gmtoffMinutes += tzInfo.DaylightBias;
+ } else {
+ gmtoffMinutes += tzInfo.StandardBias;
+ }
+
+ utcOffset = __MKINT(gmtoffMinutes*60);
}
#endif
error:;
@@ -9242,8 +9394,8 @@
Use the millisecondTimeXXX:-methods to compare and add time deltas - these know about the wrap.
BAD DESIGN:
- This should be changed to return some instance of RelativeTime,
- and these computations moved there.
+ This should be changed to return some instance of RelativeTime,
+ and these computations moved there.
Dont use this method in application code since it is an internal (private)
interface. For compatibility with ST-80, use Time millisecondClockValue.
@@ -9393,8 +9545,8 @@
%{ /* NOCONTEXT */
if (__isSmallInteger(numberOfSeconds)) {
- sleep(__intVal(numberOfSeconds));
- RETURN ( self );
+ sleep(__intVal(numberOfSeconds));
+ RETURN ( self );
}
%}.
"
@@ -9425,64 +9577,64 @@
/* try cache */
{
- OBJ lastSeconds, lastTimeInfo;
-
- lastSeconds = @global(LastTimeInfoSeconds);
- if (lastSeconds
- && (__longIntVal(lastSeconds) == t)
- && (@global(LastTimeInfoMilliseconds) == osMilliseconds)
- && (@global(LastTimeInfoIsLocal) == isLocalTime)
- ) {
- lastTimeInfo = @global(LastTimeInfo);
- if (lastTimeInfo != nil) {
- RETURN (lastTimeInfo);
- }
- }
+ OBJ lastSeconds, lastTimeInfo;
+
+ lastSeconds = @global(LastTimeInfoSeconds);
+ if (lastSeconds
+ && (__longIntVal(lastSeconds) == t)
+ && (@global(LastTimeInfoMilliseconds) == osMilliseconds)
+ && (@global(LastTimeInfoIsLocal) == isLocalTime)
+ ) {
+ lastTimeInfo = @global(LastTimeInfo);
+ if (lastTimeInfo != nil) {
+ RETURN (lastTimeInfo);
+ }
+ }
}
tt = (time_t)t;
if (isLocalTime == true) {
#ifdef __BORLANDC__
- tmPtr = localtime(&tt);
-#else
- /* be thread safe */
- if (localtime_s(&tmValue, &tt) == 0)
- tmPtr = &tmValue;
- else
- tmPtr = NULL;
-#endif
- if (tmPtr == NULL) goto error;
+ tmPtr = localtime(&tt);
+#else
+ /* be thread safe */
+ if (localtime_s(&tmValue, &tt) == 0)
+ tmPtr = &tmValue;
+ else
+ tmPtr = NULL;
+#endif
+ if (tmPtr == NULL) goto error;
#ifdef WINDOWS_IS_POSIX_CONFORM_WHICH_IT_IS_NOT
- utcOffset = __MKINT(tmPtr->tm_gmtoff);
-#else
- {
- TIME_ZONE_INFORMATION tzInfo;
- int gmtoffMinutes = 0;
-
- if (GetTimeZoneInformation(&tzInfo) < 0) goto error;
- gmtoffMinutes = tzInfo.Bias;
- if (tmPtr->tm_isdst) {
- gmtoffMinutes += tzInfo.DaylightBias;
- } else {
- gmtoffMinutes += tzInfo.StandardBias;
- }
- utcOffset = __MKINT(gmtoffMinutes*60);
- }
+ utcOffset = __MKINT(tmPtr->tm_gmtoff);
+#else
+ {
+ TIME_ZONE_INFORMATION tzInfo;
+ int gmtoffMinutes = 0;
+
+ if (GetTimeZoneInformation(&tzInfo) < 0) goto error;
+ gmtoffMinutes = tzInfo.Bias;
+ if (tmPtr->tm_isdst) {
+ gmtoffMinutes += tzInfo.DaylightBias;
+ } else {
+ gmtoffMinutes += tzInfo.StandardBias;
+ }
+ utcOffset = __MKINT(gmtoffMinutes*60);
+ }
#endif
} else {
#ifdef __BORLANDC__
- tmPtr = gmtime(&tt);
-#else
- /* be thread safe */
- if (gmtime_s(&tmValue, &tt) == 0)
- tmPtr = &tmValue;
- else
- tmPtr = NULL;
-#endif
- if (tmPtr == NULL) goto error;
- utcOffset = __mkSmallInteger(0);
+ tmPtr = gmtime(&tt);
+#else
+ /* be thread safe */
+ if (gmtime_s(&tmValue, &tt) == 0)
+ tmPtr = &tmValue;
+ else
+ tmPtr = NULL;
+#endif
+ if (tmPtr == NULL) goto error;
+ utcOffset = __mkSmallInteger(0);
}
hours = __mkSmallInteger(tmPtr->tm_hour);
@@ -9500,22 +9652,22 @@
error:;
%}.
dst isNil ifTrue:[
- ^ self primitiveFailed
+ ^ self primitiveFailed
].
info := self timeInfoClass new.
info
- year:year
- month:month
- day:day
- hours:hours
- minutes:minutes
- seconds:seconds
- milliseconds:osMilliseconds
- utcOffset:utcOffset
- dst:dst
- dayInYear:yDay
- dayInWeek:wDay.
+ year:year
+ month:month
+ day:day
+ hours:hours
+ minutes:minutes
+ seconds:seconds
+ milliseconds:osMilliseconds
+ utcOffset:utcOffset
+ dst:dst
+ dayInYear:yDay
+ dayInWeek:wDay.
LastTimeInfo := info.
LastTimeInfoSeconds := osSeconds.
@@ -9596,11 +9748,11 @@
info := self userInfoOf:userID.
(info notNil
and:[info includesKey:#gecos]) ifTrue:[
- gecos := info at:#gecos.
- (gecos includes:$,) ifTrue:[
- ^ gecos copyTo:(gecos indexOf:$,) - 1
- ].
- ^ gecos
+ gecos := info at:#gecos.
+ (gecos includes:$,) ifTrue:[
+ ^ gecos copyTo:(gecos indexOf:$,) - 1
+ ].
+ ^ gecos
].
^ self getUserNameFromID:userID
@@ -9651,18 +9803,18 @@
dir := self getEnvironment:'HOME'.
dir isNil ifTrue:[
- "for NT/WIN2K/XP users:
- if HOME is nil, try first HOMEHSARE and then HOMEDRIVE and HOMEPATH"
-
- dir := self getEnvironment:'HOMESHARE'.
- dir isNil ifTrue:[
- ((drv := self getEnvironment:'HOMEDRIVE') notNil
- and:[(path := self getEnvironment:'HOMEPATH') notNil]) ifTrue:[
- dir := drv , path
- ] ifFalse:[
- dir := '.'.
- ].
- ].
+ "for NT/WIN2K/XP users:
+ if HOME is nil, try first HOMEHSARE and then HOMEDRIVE and HOMEPATH"
+
+ dir := self getEnvironment:'HOMESHARE'.
+ dir isNil ifTrue:[
+ ((drv := self getEnvironment:'HOMEDRIVE') notNil
+ and:[(path := self getEnvironment:'HOMEPATH') notNil]) ifTrue:[
+ dir := drv , path
+ ] ifFalse:[
+ dir := '.'.
+ ].
+ ].
].
^ dir
@@ -9687,33 +9839,33 @@
char *name = (char *)0;
if (firstCall) {
- DWORD nameSize = sizeof(cachedName);
-
- if (GetUserName(cachedName, &nameSize) == TRUE) {
- name = cachedName;
- firstCall = 0;
- }
+ DWORD nameSize = sizeof(cachedName);
+
+ if (GetUserName(cachedName, &nameSize) == TRUE) {
+ name = cachedName;
+ firstCall = 0;
+ }
} else {
- name = cachedName;
+ name = cachedName;
}
/*
* try a few common environment variables ...
*/
if (! name || (name[0] == 0) ) {
- name = getenv("LOGIN");
- if (! name || (name[0] == 0) ) {
- name = getenv("LOGNAME");
- if (! name || (name[0] == 0) ) {
- name = getenv("USER");
- }
- }
+ name = getenv("LOGIN");
+ if (! name || (name[0] == 0) ) {
+ name = getenv("LOGNAME");
+ if (! name || (name[0] == 0) ) {
+ name = getenv("USER");
+ }
+ }
}
/*
* nope - I really font know who you are.
*/
if (! name || (name[0] == 0) ) {
- name = "you";
+ name = "you";
}
RETURN ( __MKSTRING(name) );
@@ -9742,7 +9894,7 @@
This is the login name, not the fullName."
aNumber == self getUserID ifTrue:[
- ^ self getLoginName
+ ^ self getLoginName
].
^ '? (' , aNumber printString , ')'
@@ -9767,19 +9919,19 @@
info := IdentityDictionary new.
name isNil ifTrue:[
- aNameOrID == self getUserID ifTrue:[
- name := self getLoginName
- ].
+ aNameOrID == self getUserID ifTrue:[
+ name := self getLoginName
+ ].
].
name notNil ifTrue:[
- info at:#name put:name.
+ info at:#name put:name.
] ifFalse:[
- info at:#name put:'unknown'
+ info at:#name put:'unknown'
].
dir isNil ifTrue:[
- aNameOrID == self getUserID ifTrue:[
- dir := self getHomeDirectory
- ]
+ aNameOrID == self getUserID ifTrue:[
+ dir := self getHomeDirectory
+ ]
].
dir notNil ifTrue:[info at:#dir put:dir].
"/ uid notNil ifTrue:[info at:#uid put:uid].
@@ -9820,63 +9972,63 @@
DWORD endStatus;
if (__isExternalAddressLike(pidToWait) ) {
- HANDLE __pidToWait = _HANDLEVal(pidToWait);
- int t;
+ HANDLE __pidToWait = _HANDLEVal(pidToWait);
+ int t;
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
- console_printf("childProcessWait %x b %d\n",__pidToWait,blocking==true);
-#endif
- t = blocking==true ? INFINITE : 0;
+ console_printf("childProcessWait %x b %d\n",__pidToWait,blocking==true);
+#endif
+ t = blocking==true ? INFINITE : 0;
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- endStatus = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, __pidToWait, t);
- } while ((endStatus < 0) && (__threadErrno == EINTR));
-#else
- endStatus = WaitForSingleObject(__pidToWait, t);
- if (endStatus < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if ( endStatus == WAIT_TIMEOUT ) {
- if (blocking==true)
- status = @symbol(timeout);
- else {
- status = @symbol(continue);
+ do {
+ __threadErrno = 0;
+ endStatus = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, __pidToWait, t);
+ } while ((endStatus < 0) && (__threadErrno == EINTR));
+#else
+ endStatus = WaitForSingleObject(__pidToWait, t);
+ if (endStatus < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if ( endStatus == WAIT_TIMEOUT ) {
+ if (blocking==true)
+ status = @symbol(timeout);
+ else {
+ status = @symbol(continue);
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
- console_printf("ret nil\n");
-#endif
- RETURN(nil);
- }
- } else {
- status = @symbol(exit);
+ console_printf("ret nil\n");
+#endif
+ RETURN(nil);
+ }
+ } else {
+ status = @symbol(exit);
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
- console_printf("exit\n");
-#endif
- if (endStatus == WAIT_OBJECT_0) {
- if (GetExitCodeProcess(__pidToWait, &endStatus)) {
- if (endStatus == STILL_ACTIVE) {
- RETURN(nil);
- }
+ console_printf("exit\n");
+#endif
+ if (endStatus == WAIT_OBJECT_0) {
+ if (GetExitCodeProcess(__pidToWait, &endStatus)) {
+ if (endStatus == STILL_ACTIVE) {
+ RETURN(nil);
+ }
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
- console_printf("exit %d\n",endStatus);
-#endif
- code = __mkSmallInteger(endStatus);
- } else {
- code = __mkSmallInteger(GetLastError());
- }
- } else {
- code = __mkSmallInteger(-1);
- }
- }
- core = false;
- pid = pidToWait;
+ console_printf("exit %d\n",endStatus);
+#endif
+ code = __mkSmallInteger(endStatus);
+ } else {
+ code = __mkSmallInteger(GetLastError());
+ }
+ } else {
+ code = __mkSmallInteger(-1);
+ }
+ }
+ core = false;
+ pid = pidToWait;
}
%}.
(status isNil or:[pid isNil]) ifTrue:[
- ^ self primitiveFailed
+ ^ self primitiveFailed
].
"/ Transcript show:'pid: '; show:pid; show:' status: '; show:status;
@@ -9930,92 +10082,92 @@
int exceptCount;
if (__isNonNilObject(readFdArray)) {
- if (! __isArrayLike(readFdArray)) goto fail;
- readCount = __arraySize(readFdArray);
+ if (! __isArrayLike(readFdArray)) goto fail;
+ readCount = __arraySize(readFdArray);
} else {
- readCount = 0;
+ readCount = 0;
}
if (__isNonNilObject(writeFdArray)) {
- if (! __isArrayLike(writeFdArray)) goto fail;
- writeCount = __arraySize(writeFdArray);
+ if (! __isArrayLike(writeFdArray)) goto fail;
+ writeCount = __arraySize(writeFdArray);
} else {
- writeCount = 0;
+ writeCount = 0;
}
if (__isNonNilObject(exceptFdArray)) {
- if (! __isArrayLike(exceptFdArray)) goto fail;
- exceptCount = __arraySize(exceptFdArray);
+ if (! __isArrayLike(exceptFdArray)) goto fail;
+ exceptCount = __arraySize(exceptFdArray);
} else {
- exceptCount = 0;
+ exceptCount = 0;
}
for (i = 0; (i < readCount) && (numHandles < MAXHANDLE);i++) {
- fd = __ArrayInstPtr(readFdArray)->a_element[i];
-
- if (fd != nil) {
- if (__isExternalAddressLike(fd)) {
- hArray [numHandles] = _HANDLEVal(fd);
- retArray[numHandles] = i;
- ++numHandles;
- } else {
- int canRead = _canReadWithoutBlocking (__intVal(fd) );
-
- if (canRead > 0 ) {
- RETURN (fd);
- } else {
- if (canRead < 0 ) {
- @global(LastErrorNumber) = __mkSmallInteger(EBADF);
- RETURN (nil);
- }
- }
- }
- }
+ fd = __ArrayInstPtr(readFdArray)->a_element[i];
+
+ if (fd != nil) {
+ if (__isExternalAddressLike(fd)) {
+ hArray [numHandles] = _HANDLEVal(fd);
+ retArray[numHandles] = i;
+ ++numHandles;
+ } else {
+ int canRead = _canReadWithoutBlocking (__intVal(fd) );
+
+ if (canRead > 0 ) {
+ RETURN (fd);
+ } else {
+ if (canRead < 0 ) {
+ @global(LastErrorNumber) = __mkSmallInteger(EBADF);
+ RETURN (nil);
+ }
+ }
+ }
+ }
}
for (i = 0; (i < writeCount) && (numHandles < MAXHANDLE);i++) {
- fd = __ArrayInstPtr(writeFdArray)->a_element[i];
-
- if (fd != nil) {
- if (__isExternalAddressLike(fd)) {
- hArray [numHandles] = _HANDLEVal(fd);
- retArray[numHandles] = i + 10000;
- ++numHandles;
- } else {
- int canWrite = _canWriteWithoutBlocking (__intVal(fd) );
-
- if (canWrite > 0 ) {
- RETURN (fd);
- } else {
- if (canWrite < 0 ) {
- @global(LastErrorNumber) = __mkSmallInteger(EBADF);
- RETURN (nil);
- }
- }
- }
- }
+ fd = __ArrayInstPtr(writeFdArray)->a_element[i];
+
+ if (fd != nil) {
+ if (__isExternalAddressLike(fd)) {
+ hArray [numHandles] = _HANDLEVal(fd);
+ retArray[numHandles] = i + 10000;
+ ++numHandles;
+ } else {
+ int canWrite = _canWriteWithoutBlocking (__intVal(fd) );
+
+ if (canWrite > 0 ) {
+ RETURN (fd);
+ } else {
+ if (canWrite < 0 ) {
+ @global(LastErrorNumber) = __mkSmallInteger(EBADF);
+ RETURN (nil);
+ }
+ }
+ }
+ }
}
for (i = 0; (i < exceptCount) && (numHandles < MAXHANDLE);i++) {
- fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
-
- if (fd != nil) {
- if (__isExternalAddressLike(fd)) {
- hArray [numHandles] = _HANDLEVal(fd);
- retArray[numHandles] = i + 20000;
- ++numHandles;
- }
- }
+ fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
+
+ if (fd != nil) {
+ if (__isExternalAddressLike(fd)) {
+ hArray [numHandles] = _HANDLEVal(fd);
+ retArray[numHandles] = i + 20000;
+ ++numHandles;
+ }
+ }
}
if (__isSmallInteger(millis)) {
- t = __intVal(millis);
-
- if (t <= 0 && numHandles == 0) {
- RETURN (nil);
- }
+ t = __intVal(millis);
+
+ if (t <= 0 && numHandles == 0) {
+ RETURN (nil);
+ }
} else {
- t = INFINITE;
+ t = INFINITE;
}
#ifdef SELECT3DEBUGWIN32
@@ -10025,111 +10177,111 @@
res = __vmWait (numHandles, hArray, MAXHANDLE, t);
if (numHandles) {
- if (res == WAIT_FAILED) {
+ if (res == WAIT_FAILED) {
#ifdef SELECT2DEBUGWIN32
- console_printf("- error %d; ret nil\n",GetLastError());
-#endif
- if (__threadErrno == EINTR) {
- __threadErrno = 0;
- @global(LastErrorNumber) = nil;
- } else {
- __threadErrno = EBADF;
- if (@global(InfoPrinting) == true) {
- console_fprintf(stderr, "Win32OS [info]: select errno = %d\n", __threadErrno);
- }
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- }
- RETURN ( nil );
- }
-
- if (res == WAIT_TIMEOUT) {
+ console_printf("- error %d; ret nil\n",GetLastError());
+#endif
+ if (__threadErrno == EINTR) {
+ __threadErrno = 0;
+ @global(LastErrorNumber) = nil;
+ } else {
+ __threadErrno = EBADF;
+ if (@global(InfoPrinting) == true) {
+ console_fprintf(stderr, "Win32OS [info]: select errno = %d\n", __threadErrno);
+ }
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ }
+ RETURN ( nil );
+ }
+
+ if (res == WAIT_TIMEOUT) {
#ifdef SELECT3DEBUGWIN32
- console_printf("- timeOut; ret nil\n" );
-#endif
- goto polling;
- }
-
- if (res == numHandles) {
- if (1 /* @global(InfoPrinting) == true */) {
- console_fprintf(stderr, "Win32OS [info]: plugIn event has been handled\n");
- }
- __threadErrno = 0;
- @global(LastErrorNumber) = nil;
- RETURN ( nil );
- }
- if ((res < 0) || (res > numHandles)) {
+ console_printf("- timeOut; ret nil\n" );
+#endif
+ goto polling;
+ }
+
+ if (res == numHandles) {
+ if (1 /* @global(InfoPrinting) == true */) {
+ console_fprintf(stderr, "Win32OS [info]: plugIn event has been handled\n");
+ }
+ __threadErrno = 0;
+ @global(LastErrorNumber) = nil;
+ RETURN ( nil );
+ }
+ if ((res < 0) || (res > numHandles)) {
#ifdef SELECTDEBUGWIN32
- console_printf("- res=%d error1 %d\n", res, GetLastError());
-#endif
- __threadErrno = 0;
- @global(LastErrorNumber) = nil;
- RETURN ( nil );
- }
-
- ret = res;
-
- if (ret < numHandles) {
- int fd = retArray[ret];
-
- @global(LastErrorNumber) = nil;
+ console_printf("- res=%d error1 %d\n", res, GetLastError());
+#endif
+ __threadErrno = 0;
+ @global(LastErrorNumber) = nil;
+ RETURN ( nil );
+ }
+
+ ret = res;
+
+ if (ret < numHandles) {
+ int fd = retArray[ret];
+
+ @global(LastErrorNumber) = nil;
#ifdef SELECTDEBUGWIN32
- if (ret) console_printf("wait Handles %d %d ret\n", ret, fd);
-#endif
- if (fd < 10000) {
- RETURN ( __ArrayInstPtr(readFdArray)->a_element[fd] );
- }
- if (fd < 20000) {
- RETURN ( __ArrayInstPtr(writeFdArray)->a_element[fd-10000] );
- }
- RETURN ( __ArrayInstPtr(exceptFdArray)->a_element[fd-20000] );
- }
- console_fprintf(stderr, "Win32OS [info]: wait Handles ret = %d error2 %d\n", ret, GetLastError());
- goto fail;
+ if (ret) console_printf("wait Handles %d %d ret\n", ret, fd);
+#endif
+ if (fd < 10000) {
+ RETURN ( __ArrayInstPtr(readFdArray)->a_element[fd] );
+ }
+ if (fd < 20000) {
+ RETURN ( __ArrayInstPtr(writeFdArray)->a_element[fd-10000] );
+ }
+ RETURN ( __ArrayInstPtr(exceptFdArray)->a_element[fd-20000] );
+ }
+ console_fprintf(stderr, "Win32OS [info]: wait Handles ret = %d error2 %d\n", ret, GetLastError());
+ goto fail;
} else {
polling:
- for (i=0; i < readCount;i++) {
- fd = __ArrayInstPtr(readFdArray)->a_element[i];
-
- if (fd != nil) {
- if (! __isExternalAddressLike(fd)) {
- int canRead = _canReadWithoutBlocking (__intVal(fd));
-
- if (canRead > 0 ) {
- RETURN (fd);
- } else {
- if (canRead < 0 ) {
- @global(LastErrorNumber) = __mkSmallInteger(EBADF);
- RETURN (nil);
- }
- }
- }
- }
- }
-
- for (i=0; i < writeCount;i++) {
- fd = __ArrayInstPtr(writeFdArray)->a_element[i];
-
- if (fd != nil) {
- if (! __isExternalAddressLike(fd)) {
- int canWrite = _canWriteWithoutBlocking (__intVal(fd));
-
- if (canWrite > 0 ) {
- RETURN (fd);
- } else {
- if (canWrite < 0 ) {
- @global(LastErrorNumber) = __mkSmallInteger(EBADF);
- RETURN (nil);
- }
- }
- }
- }
- }
-
- @global(LastErrorNumber) = nil;
- RETURN ( nil );
+ for (i=0; i < readCount;i++) {
+ fd = __ArrayInstPtr(readFdArray)->a_element[i];
+
+ if (fd != nil) {
+ if (! __isExternalAddressLike(fd)) {
+ int canRead = _canReadWithoutBlocking (__intVal(fd));
+
+ if (canRead > 0 ) {
+ RETURN (fd);
+ } else {
+ if (canRead < 0 ) {
+ @global(LastErrorNumber) = __mkSmallInteger(EBADF);
+ RETURN (nil);
+ }
+ }
+ }
+ }
+ }
+
+ for (i=0; i < writeCount;i++) {
+ fd = __ArrayInstPtr(writeFdArray)->a_element[i];
+
+ if (fd != nil) {
+ if (! __isExternalAddressLike(fd)) {
+ int canWrite = _canWriteWithoutBlocking (__intVal(fd));
+
+ if (canWrite > 0 ) {
+ RETURN (fd);
+ } else {
+ if (canWrite < 0 ) {
+ @global(LastErrorNumber) = __mkSmallInteger(EBADF);
+ RETURN (nil);
+ }
+ }
+ }
+ }
+ }
+
+ @global(LastErrorNumber) = nil;
+ RETURN ( nil );
}
fail: ;
@@ -10170,51 +10322,51 @@
INT i, count;
if (! __isArrayLike(fdOrHandleArray)) {
- goto fail;
+ goto fail;
}
count = __arraySize(fdOrHandleArray);
for (i=0; i<count; i++) {
- OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
- HANDLE h;
-
- if (__isExternalAddressLike(fdOrHandle)) {
- h = _HANDLEVal(fdOrHandle);
- } else {
- if (__isSmallInteger(fdOrHandle)) {
- h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
- } else {
- goto fail;
- }
- }
- hArray[i] = h;
+ OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
+ HANDLE h;
+
+ if (__isExternalAddressLike(fdOrHandle)) {
+ h = _HANDLEVal(fdOrHandle);
+ } else {
+ if (__isSmallInteger(fdOrHandle)) {
+ h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
+ } else {
+ goto fail;
+ }
+ }
+ hArray[i] = h;
}
if (__isSmallInteger(millis)) {
- t = __intVal(millis);
+ t = __intVal(millis);
} else {
- t = INFINITE;
+ t = INFINITE;
}
#ifdef DO_WRAP_CALLS
do {
- __threadErrno = 0;
- res = STX_API_CALL4( "WaitForMultipleObjects", WaitForMultipleObjects, count, hArray, FALSE, t);
+ __threadErrno = 0;
+ res = STX_API_CALL4( "WaitForMultipleObjects", WaitForMultipleObjects, count, hArray, FALSE, t);
} while ((res < 0) && (__threadErrno == EINTR));
#else
res = WaitForMultipleObjects(count, hArray, FALSE, t);
if (res < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
+ __threadErrno = __WIN32_ERR(GetLastError());
}
#endif
if (res == WAIT_FAILED) {
- RETURN (nil);
+ RETURN (nil);
}
if (res == WAIT_TIMEOUT) {
- RETURN (nil);
+ RETURN (nil);
}
if ((res >= WAIT_OBJECT_0) && (res < (WAIT_OBJECT_0+count))) {
- RETURN (__ArrayInstPtr(fdOrHandleArray)->a_element[res-WAIT_OBJECT_0]);
+ RETURN (__ArrayInstPtr(fdOrHandleArray)->a_element[res-WAIT_OBJECT_0]);
}
RETURN (nil);
@@ -10239,37 +10391,37 @@
HANDLE h = NULL;
if (__isExternalAddressLike(fdOrHandle)) {
- h = _HANDLEVal(fdOrHandle);
+ h = _HANDLEVal(fdOrHandle);
} else {
- if (__isSmallInteger(fdOrHandle)) {
- h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
- } else {
- goto fail;
- }
+ if (__isSmallInteger(fdOrHandle)) {
+ h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
+ } else {
+ goto fail;
+ }
}
if (__isSmallInteger(millis)) {
- t = __intVal(millis);
+ t = __intVal(millis);
} else {
- t = INFINITE;
+ t = INFINITE;
}
#ifdef DO_WRAP_CALLS
do {
- __threadErrno = 0;
- res = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, h, t);
+ __threadErrno = 0;
+ res = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, h, t);
} while ((res < 0) && (__threadErrno == EINTR));
#else
res = WaitForSingleObject(h, t);
if (res < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
+ __threadErrno = __WIN32_ERR(GetLastError());
}
#endif
if (res == WAIT_FAILED) {
- RETURN (nil);
+ RETURN (nil);
}
if (res == WAIT_TIMEOUT) {
- RETURN (nil);
+ RETURN (nil);
}
RETURN (fdOrHandle);
@@ -10464,18 +10616,18 @@
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT created:cT path:lP alternativeName:name2
^ self basicNew
- type:t mode:m uid:u gid:g size:s
- id:i accessed:aT modified:mT created:cT
- path:lP alternativeName:name2
+ type:t mode:m uid:u gid:g size:s
+ id:i accessed:aT modified:mT created:cT
+ path:lP alternativeName:name2
!
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT created:cT path:lP fullName:fullName alternativeName:name2
^ self basicNew
- type:t mode:m uid:u gid:g size:s
- id:i accessed:aT modified:mT created:cT
- path:lP
- fullName:fullName
- alternativeName:name2
+ type:t mode:m uid:u gid:g size:s
+ id:i accessed:aT modified:mT created:cT
+ path:lP
+ fullName:fullName
+ alternativeName:name2
! !
!Win32OperatingSystem::FileStatusInfo methodsFor:'accessing'!
@@ -10553,9 +10705,9 @@
"/ access lazily...
path isNil ifTrue:[
- type == #symbolicLink ifTrue:[
- path := OperatingSystem getLinkTarget:fullName.
- ]
+ type == #symbolicLink ifTrue:[
+ path := OperatingSystem getLinkTarget:fullName.
+ ]
].
^ path
@@ -10802,20 +10954,20 @@
[Instance variables:]
- pid <Integer> OS-Process identifier
-
- status <Symbol> either #exit #signal #stop #continue
-
- code <Integer> either exitcode or signalnumber
-
- core <Boolean> true if core has been dumped
+ pid <Integer> OS-Process identifier
+
+ status <Symbol> either #exit #signal #stop #continue
+
+ code <Integer> either exitcode or signalnumber
+
+ core <Boolean> true if core has been dumped
[author:]
- Stefan Vogel
+ Stefan Vogel
[see also:]
- OperatingSystem
+ OperatingSystem
"
! !
@@ -10956,24 +11108,24 @@
counterIndexTextDictionary
"
- self counterIndexTextDictionary
+ self counterIndexTextDictionary
"
CounterIndexTextDictionary isNil ifTrue:[
- self synchronized:[
- CounterIndexTextDictionary isNil ifTrue:[
- |performanceText counterIndexTextDictionary|
-
- performanceText := self getPerformanceText valueNamed:'Counter'.
- counterIndexTextDictionary := IdentityDictionary new.
-
- 1 to:performanceText size by:2 do:[:index|
- counterIndexTextDictionary at:(performanceText at:index) asInteger put:(performanceText at:index + 1).
- ].
-
- CounterIndexTextDictionary := counterIndexTextDictionary.
- ].
- ].
+ self synchronized:[
+ CounterIndexTextDictionary isNil ifTrue:[
+ |performanceText counterIndexTextDictionary|
+
+ performanceText := self getPerformanceText valueNamed:'Counter'.
+ counterIndexTextDictionary := IdentityDictionary new.
+
+ 1 to:performanceText size by:2 do:[:index|
+ counterIndexTextDictionary at:(performanceText at:index) asInteger put:(performanceText at:index + 1).
+ ].
+
+ CounterIndexTextDictionary := counterIndexTextDictionary.
+ ].
+ ].
].
^ CounterIndexTextDictionary
@@ -10982,24 +11134,24 @@
helpIndexTextDictionary
"
- self helpIndexTextDictionary
+ self helpIndexTextDictionary
"
HelpIndexTextDictionary isNil ifTrue:[
- self synchronized:[
- HelpIndexTextDictionary isNil ifTrue:[
- |performanceText helpIndexTextDictionary|
-
- performanceText := self getPerformanceText valueNamed:'Help'.
- helpIndexTextDictionary := IdentityDictionary new.
-
- 1 to:performanceText size by:2 do:[:index|
- helpIndexTextDictionary at:(performanceText at:index) asInteger put:(performanceText at:index + 1).
- ].
-
- HelpIndexTextDictionary := helpIndexTextDictionary.
- ].
- ].
+ self synchronized:[
+ HelpIndexTextDictionary isNil ifTrue:[
+ |performanceText helpIndexTextDictionary|
+
+ performanceText := self getPerformanceText valueNamed:'Help'.
+ helpIndexTextDictionary := IdentityDictionary new.
+
+ 1 to:performanceText size by:2 do:[:index|
+ helpIndexTextDictionary at:(performanceText at:index) asInteger put:(performanceText at:index + 1).
+ ].
+
+ HelpIndexTextDictionary := helpIndexTextDictionary.
+ ].
+ ].
].
^ HelpIndexTextDictionary
@@ -11124,7 +11276,7 @@
initialize
"
- self initialize
+ self initialize
"
PerformanceText := CounterIndexTextDictionary := HelpIndexTextDictionary := nil.
@@ -11135,7 +11287,7 @@
getPerformanceText
PerformanceText isNil ifTrue:[
- PerformanceText := Win32OperatingSystem registryEntry key:'HKEY_PERFORMANCE_TEXT'.
+ PerformanceText := Win32OperatingSystem registryEntry key:'HKEY_PERFORMANCE_TEXT'.
].
^ PerformanceText
@@ -11164,7 +11316,7 @@
^ (self getFreePageFileSizeInKB / 1024) asInteger
"
- self getFreePageFileSizeInMB
+ self getFreePageFileSizeInMB
"
!
@@ -11189,7 +11341,7 @@
^ (self getFreePhysicalMemoryInKB / 1024) asInteger
"
- self getFreePhysicalMemoryInMB
+ self getFreePhysicalMemoryInMB
"
!
@@ -11197,7 +11349,7 @@
^ self getPageFileSizeInMB * 1024
"
- self getPageFileSizeInKB
+ self getPageFileSizeInKB
"
!
@@ -11239,7 +11391,7 @@
^ (self getPhysicalMemoryInKB / 1024) asInteger
"
- self getPhysicalMemoryInMB
+ self getPhysicalMemoryInMB
"
!
@@ -11281,7 +11433,7 @@
^ (self getVirtualMemoryInKB / 1024) asInteger
"
- self getVirtualMemoryInMB
+ self getVirtualMemoryInMB
"
! !
@@ -11347,155 +11499,155 @@
//iterate all following objetcs
for (objectIterator=0; objectIterator<numObjectTypes; objectIterator++) {
- //add the st_perObject dictionary to st_objectArray
- st_perObject = __SSEND0(@global(Dictionary), @symbol(new), 0);
- __AT_PUT_(st_objectArray, __mkSmallInteger(objectIterator+1), st_perObject);
-
- //get the object data
- __AT_PUT_(st_perObject, @symbol(ObjectNameTitleIndex), __mkSmallInteger(perfObjectPtr->ObjectNameTitleIndex));
- __AT_PUT_(st_perObject, @symbol(DetailLevel), __mkSmallInteger(perfObjectPtr->DetailLevel));
- __AT_PUT_(st_perObject, @symbol(NumCounters), __mkSmallInteger(perfObjectPtr->NumCounters));
- __AT_PUT_(st_perObject, @symbol(NumInstances), __mkSmallInteger(perfObjectPtr->NumInstances));
-
- //setup counter array and initialize its pointer
- st_counterArray = __ARRAY_NEW_INT(perfObjectPtr->NumCounters);
- perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfObjectPtr + perfObjectPtr->HeaderLength);
-
- //add the st_counterArray to st_perObject dictionary
- __AT_PUT_(st_perObject, @symbol(Counters), st_counterArray);
-
- //iterate all following counter definition
- for (counterIterator=0; counterIterator<perfObjectPtr->NumCounters; counterIterator++) {
- //add the st_perCounter dictionary to st_counterArray
- st_perCounter = __SSEND0(@global(Dictionary), @symbol(new), 0);
- __AT_PUT_(st_counterArray, __mkSmallInteger(counterIterator+1), st_perCounter);
-
- //get the counter data
- __AT_PUT_(st_perCounter, @symbol(CounterNameTitleIndex), __mkSmallInteger(perfCounterPtr->CounterNameTitleIndex));
- __AT_PUT_(st_perCounter, @symbol(CounterTypeBits), __mkSmallInteger(perfCounterPtr->CounterType));
- __AT_PUT_(st_perCounter, @symbol(CounterSize), __mkSmallInteger(perfCounterPtr->CounterSize));
- __AT_PUT_(st_perCounter, @symbol(CounterOffset), __mkSmallInteger(perfCounterPtr->CounterOffset));
-
- //put the counter type size
- switch (perfCounterPtr->CounterType & PERF_SIZE_MASK) {
- case PERF_SIZE_DWORD:
- __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(DWORD));
- break;
- case PERF_SIZE_LARGE:
- __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(LARGE));
- break;
- case PERF_SIZE_ZERO:
- __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(ZERO));
- break;
- case PERF_SIZE_VARIABLE_LEN:
- __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(VARIABLE_LEN));
- break;
- }
- switch (perfCounterPtr->CounterType & PERF_TYPE_MASK) {
- case PERF_TYPE_NUMBER:
- __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(NUMBER));
- switch (perfCounterPtr->CounterType & PERF_NUMBERTYPE_MASK) {
- case PERF_NUMBER_HEX:
- __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(HEX));
- break;
- case PERF_NUMBER_DECIMAL:
- __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DECIMAL));
- break;
- case PERF_NUMBER_DEC_1000:
- __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DEC_1000));
- break;
- }
- break;
- case PERF_TYPE_COUNTER:
- __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(COUNTER));
- switch (perfCounterPtr->CounterType & PERF_COUNTERTYPE_MASK) {
- case PERF_COUNTER_VALUE:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(VALUE));
- break;
- case PERF_COUNTER_RATE:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(RATE));
- break;
- case PERF_COUNTER_FRACTION:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(FRACTION));
- break;
- case PERF_COUNTER_BASE:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(BASE));
- break;
- case PERF_COUNTER_ELAPSED:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(ELAPSED));
- break;
- case PERF_COUNTER_QUEUELEN:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(QUEUELEN));
- break;
- case PERF_COUNTER_HISTOGRAM:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(HISTOGRAM));
- break;
- case PERF_COUNTER_PRECISION:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(PRECISION));
- break;
- }
- break;
- case PERF_TYPE_TEXT:
- __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(TEXT));
- switch (perfCounterPtr->CounterType & PERF_TEXTTYPE_MASK) {
- case PERF_TEXT_UNICODE:
- __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(UNICODE));
- break;
- case PERF_TEXT_ASCII:
- __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(ASCII));
- break;
- }
- break;
- case PERF_TYPE_ZERO:
- __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(ZERO));
- break;
- }
-
- //setup the counter pointer to the next counter definition
- perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfCounterPtr + perfCounterPtr->ByteLength);
- }
-
- //goon dependent on the count of instances
- if (perfObjectPtr->NumInstances < 1) {
- perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfCounterPtr);
- __AT_PUT_(st_perObject, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
- } else {
- //setup the instance pointer to the end of all counters
- perfInstancePtr = (PERF_INSTANCE_DEFINITION *)(perfCounterPtr);
-
- //setup st_instanceArray and add it to st_perObject
- st_instanceArray = __ARRAY_NEW_INT(perfObjectPtr->NumInstances);
- __AT_PUT_(st_perObject, @symbol(Instances), st_instanceArray);
-
- //iterate the instances
- for (instanceIterator=0; instanceIterator<perfObjectPtr->NumInstances; instanceIterator++) {
- //setup st_perInstance and add it to st_instanceArray
- st_perInstance = __SSEND0(@global(Dictionary), @symbol(new), 0);
- __AT_PUT_(st_instanceArray, __mkSmallInteger(instanceIterator+1), st_perInstance);
-
- //get the instance data
- __AT_PUT_(st_perInstance, @symbol(Name), __MKBYTEARRAY((wchar_t *)((BYTE *)perfInstancePtr + perfInstancePtr->NameOffset),perfInstancePtr->NameLength));
- __AT_PUT_(st_perInstance, @symbol(ParentObjectTitleIndex), __mkSmallInteger(perfInstancePtr->ParentObjectTitleIndex));
- __AT_PUT_(st_perInstance, @symbol(ParentObjectInstance), __mkSmallInteger(perfInstancePtr->ParentObjectInstance));
- __AT_PUT_(st_perInstance, @symbol(NameOffset), __mkSmallInteger(perfInstancePtr->NameOffset));
- __AT_PUT_(st_perInstance, @symbol(NameLength), __mkSmallInteger(perfInstancePtr->NameLength));
-
- //setup the instance pointer to the its end
- perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfInstancePtr + perfInstancePtr->ByteLength);
-
- //setup the counter block pointer
- perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfInstancePtr);
-
- //get the instance raw data
- __AT_PUT_(st_perInstance, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
-
- //setup the instance pointer to the next instance
- perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfCounterBlockPtr + perfCounterBlockPtr->ByteLength);
- }
- }
-
- //setup the object pointer to the next object
- perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfObjectPtr + perfObjectPtr->TotalByteLength);
+ //add the st_perObject dictionary to st_objectArray
+ st_perObject = __SSEND0(@global(Dictionary), @symbol(new), 0);
+ __AT_PUT_(st_objectArray, __mkSmallInteger(objectIterator+1), st_perObject);
+
+ //get the object data
+ __AT_PUT_(st_perObject, @symbol(ObjectNameTitleIndex), __mkSmallInteger(perfObjectPtr->ObjectNameTitleIndex));
+ __AT_PUT_(st_perObject, @symbol(DetailLevel), __mkSmallInteger(perfObjectPtr->DetailLevel));
+ __AT_PUT_(st_perObject, @symbol(NumCounters), __mkSmallInteger(perfObjectPtr->NumCounters));
+ __AT_PUT_(st_perObject, @symbol(NumInstances), __mkSmallInteger(perfObjectPtr->NumInstances));
+
+ //setup counter array and initialize its pointer
+ st_counterArray = __ARRAY_NEW_INT(perfObjectPtr->NumCounters);
+ perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfObjectPtr + perfObjectPtr->HeaderLength);
+
+ //add the st_counterArray to st_perObject dictionary
+ __AT_PUT_(st_perObject, @symbol(Counters), st_counterArray);
+
+ //iterate all following counter definition
+ for (counterIterator=0; counterIterator<perfObjectPtr->NumCounters; counterIterator++) {
+ //add the st_perCounter dictionary to st_counterArray
+ st_perCounter = __SSEND0(@global(Dictionary), @symbol(new), 0);
+ __AT_PUT_(st_counterArray, __mkSmallInteger(counterIterator+1), st_perCounter);
+
+ //get the counter data
+ __AT_PUT_(st_perCounter, @symbol(CounterNameTitleIndex), __mkSmallInteger(perfCounterPtr->CounterNameTitleIndex));
+ __AT_PUT_(st_perCounter, @symbol(CounterTypeBits), __mkSmallInteger(perfCounterPtr->CounterType));
+ __AT_PUT_(st_perCounter, @symbol(CounterSize), __mkSmallInteger(perfCounterPtr->CounterSize));
+ __AT_PUT_(st_perCounter, @symbol(CounterOffset), __mkSmallInteger(perfCounterPtr->CounterOffset));
+
+ //put the counter type size
+ switch (perfCounterPtr->CounterType & PERF_SIZE_MASK) {
+ case PERF_SIZE_DWORD:
+ __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(DWORD));
+ break;
+ case PERF_SIZE_LARGE:
+ __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(LARGE));
+ break;
+ case PERF_SIZE_ZERO:
+ __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(ZERO));
+ break;
+ case PERF_SIZE_VARIABLE_LEN:
+ __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(VARIABLE_LEN));
+ break;
+ }
+ switch (perfCounterPtr->CounterType & PERF_TYPE_MASK) {
+ case PERF_TYPE_NUMBER:
+ __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(NUMBER));
+ switch (perfCounterPtr->CounterType & PERF_NUMBERTYPE_MASK) {
+ case PERF_NUMBER_HEX:
+ __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(HEX));
+ break;
+ case PERF_NUMBER_DECIMAL:
+ __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DECIMAL));
+ break;
+ case PERF_NUMBER_DEC_1000:
+ __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DEC_1000));
+ break;
+ }
+ break;
+ case PERF_TYPE_COUNTER:
+ __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(COUNTER));
+ switch (perfCounterPtr->CounterType & PERF_COUNTERTYPE_MASK) {
+ case PERF_COUNTER_VALUE:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(VALUE));
+ break;
+ case PERF_COUNTER_RATE:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(RATE));
+ break;
+ case PERF_COUNTER_FRACTION:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(FRACTION));
+ break;
+ case PERF_COUNTER_BASE:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(BASE));
+ break;
+ case PERF_COUNTER_ELAPSED:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(ELAPSED));
+ break;
+ case PERF_COUNTER_QUEUELEN:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(QUEUELEN));
+ break;
+ case PERF_COUNTER_HISTOGRAM:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(HISTOGRAM));
+ break;
+ case PERF_COUNTER_PRECISION:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(PRECISION));
+ break;
+ }
+ break;
+ case PERF_TYPE_TEXT:
+ __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(TEXT));
+ switch (perfCounterPtr->CounterType & PERF_TEXTTYPE_MASK) {
+ case PERF_TEXT_UNICODE:
+ __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(UNICODE));
+ break;
+ case PERF_TEXT_ASCII:
+ __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(ASCII));
+ break;
+ }
+ break;
+ case PERF_TYPE_ZERO:
+ __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(ZERO));
+ break;
+ }
+
+ //setup the counter pointer to the next counter definition
+ perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfCounterPtr + perfCounterPtr->ByteLength);
+ }
+
+ //goon dependent on the count of instances
+ if (perfObjectPtr->NumInstances < 1) {
+ perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfCounterPtr);
+ __AT_PUT_(st_perObject, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
+ } else {
+ //setup the instance pointer to the end of all counters
+ perfInstancePtr = (PERF_INSTANCE_DEFINITION *)(perfCounterPtr);
+
+ //setup st_instanceArray and add it to st_perObject
+ st_instanceArray = __ARRAY_NEW_INT(perfObjectPtr->NumInstances);
+ __AT_PUT_(st_perObject, @symbol(Instances), st_instanceArray);
+
+ //iterate the instances
+ for (instanceIterator=0; instanceIterator<perfObjectPtr->NumInstances; instanceIterator++) {
+ //setup st_perInstance and add it to st_instanceArray
+ st_perInstance = __SSEND0(@global(Dictionary), @symbol(new), 0);
+ __AT_PUT_(st_instanceArray, __mkSmallInteger(instanceIterator+1), st_perInstance);
+
+ //get the instance data
+ __AT_PUT_(st_perInstance, @symbol(Name), __MKBYTEARRAY((wchar_t *)((BYTE *)perfInstancePtr + perfInstancePtr->NameOffset),perfInstancePtr->NameLength));
+ __AT_PUT_(st_perInstance, @symbol(ParentObjectTitleIndex), __mkSmallInteger(perfInstancePtr->ParentObjectTitleIndex));
+ __AT_PUT_(st_perInstance, @symbol(ParentObjectInstance), __mkSmallInteger(perfInstancePtr->ParentObjectInstance));
+ __AT_PUT_(st_perInstance, @symbol(NameOffset), __mkSmallInteger(perfInstancePtr->NameOffset));
+ __AT_PUT_(st_perInstance, @symbol(NameLength), __mkSmallInteger(perfInstancePtr->NameLength));
+
+ //setup the instance pointer to the its end
+ perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfInstancePtr + perfInstancePtr->ByteLength);
+
+ //setup the counter block pointer
+ perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfInstancePtr);
+
+ //get the instance raw data
+ __AT_PUT_(st_perInstance, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
+
+ //setup the instance pointer to the next instance
+ perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfCounterBlockPtr + perfCounterBlockPtr->ByteLength);
+ }
+ }
+
+ //setup the object pointer to the next object
+ perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfObjectPtr + perfObjectPtr->TotalByteLength);
}
%}.
objectArray := st_objectArray.
@@ -11504,61 +11656,61 @@
perfTime100nSec := st_perfTime100nSec.
getNameBlock := [:i|
- self class counterIndexTextDictionary at:i ifAbsent:['<<no name>>'].
+ self class counterIndexTextDictionary at:i ifAbsent:['<<no name>>'].
].
getCounterValueBlock := [:counter :rawData|
- |offset counterValue|
-
- offset := counter at:#CounterOffset.
- offset >= rawData size ifTrue:[
- counterValue := nil.
- ] ifFalse:[
- (counter at:#SIZE) == #LARGE ifTrue:[
- counterValue := rawData unsignedLongLongAt:offset + 1 bigEndian:false.
- ] ifFalse:[
- (counter at:#SIZE) == #DWORD ifTrue:[
- counterValue := rawData unsignedLongAt:offset + 1 bigEndian:false.
- ] ifFalse:[
- self halt.
- ].
- ].
- ].
-
- counterValue
+ |offset counterValue|
+
+ offset := counter at:#CounterOffset.
+ offset >= rawData size ifTrue:[
+ counterValue := nil.
+ ] ifFalse:[
+ (counter at:#SIZE) == #LARGE ifTrue:[
+ counterValue := rawData unsignedLongLongAt:offset + 1 bigEndian:false.
+ ] ifFalse:[
+ (counter at:#SIZE) == #DWORD ifTrue:[
+ counterValue := rawData unsignedLongAt:offset + 1 bigEndian:false.
+ ] ifFalse:[
+ self halt.
+ ].
+ ].
+ ].
+
+ counterValue
].
objectArray do:[:anObject|
- "setup the object name"
- anObject at:#ObjectNameTitle put:(getNameBlock value:(anObject at:#ObjectNameTitleIndex)).
-
- "setup the name and a counter value array to each counter"
- (anObject at:#Counters) do:[:aCounter|
- aCounter at:#CounterNameTitle put:(getNameBlock value:(aCounter at:#CounterNameTitleIndex)).
- aCounter at:#CounterValueArray put:OrderedCollection new.
- ].
-
- (anObject at:#NumInstances) < 1 ifTrue:[
- |rawData|
-
- rawData := anObject at:#RawData.
-
- (anObject at:#Counters) do:[:aCounter|
- (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
- ].
- ] ifFalse:[
- (anObject at:#Instances) do:[:anInstance|
- |rawData|
-
- rawData := anInstance at:#RawData.
-
- anInstance at:#Name put:((Unicode16String fromBytes:(anInstance at:#Name) copy swapBytes) copyWithoutLast:1).
-
- (anObject at:#Counters) do:[:aCounter|
- (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
- ].
- ].
- ].
+ "setup the object name"
+ anObject at:#ObjectNameTitle put:(getNameBlock value:(anObject at:#ObjectNameTitleIndex)).
+
+ "setup the name and a counter value array to each counter"
+ (anObject at:#Counters) do:[:aCounter|
+ aCounter at:#CounterNameTitle put:(getNameBlock value:(aCounter at:#CounterNameTitleIndex)).
+ aCounter at:#CounterValueArray put:OrderedCollection new.
+ ].
+
+ (anObject at:#NumInstances) < 1 ifTrue:[
+ |rawData|
+
+ rawData := anObject at:#RawData.
+
+ (anObject at:#Counters) do:[:aCounter|
+ (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
+ ].
+ ] ifFalse:[
+ (anObject at:#Instances) do:[:anInstance|
+ |rawData|
+
+ rawData := anInstance at:#RawData.
+
+ anInstance at:#Name put:((Unicode16String fromBytes:(anInstance at:#Name) copy swapBytes) copyWithoutLast:1).
+
+ (anObject at:#Counters) do:[:aCounter|
+ (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
+ ].
+ ].
+ ].
].
^ self
@@ -11596,8 +11748,8 @@
aliveTime
"
- returns the time a data stays alive, in milliseconds
- before we push a new call and overwrite the data
+ returns the time a data stays alive, in milliseconds
+ before we push a new call and overwrite the data
"
^ self subclassResponsibility
@@ -11620,18 +11772,18 @@
data
self synchronized:[
- |lastTS|
-
- lastTS := self lastTimestamp.
- lastTS isNil ifTrue:[
- ^ self dataBasic
- ] ifFalse:[
- Timestamp now asMilliseconds - lastTS >= self aliveTime ifTrue:[
- ^ self dataBasic
- ] ifFalse:[
- ^ self lastData
- ].
- ].
+ |lastTS|
+
+ lastTS := self lastTimestamp.
+ lastTS isNil ifTrue:[
+ ^ self dataBasic
+ ] ifFalse:[
+ Timestamp now asMilliseconds - lastTS >= self aliveTime ifTrue:[
+ ^ self dataBasic
+ ] ifFalse:[
+ ^ self lastData
+ ].
+ ].
].
!
@@ -11655,9 +11807,9 @@
data := self data.
self indexedNameNumbered == 0 ifTrue:[
- object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
+ object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
] ifFalse:[
- object := data objectArray detect:[:el|(el at:#ObjectNameTitleIndex) == self indexedNameNumbered] ifNone:[self error:'counter not found'].
+ object := data objectArray detect:[:el|(el at:#ObjectNameTitleIndex) == self indexedNameNumbered] ifNone:[self error:'counter not found'].
].
^ (object at:#Counters) collect:[:el|Array with:(el at:#CounterNameTitle) with:(el at:#CounterNameTitleIndex)].
@@ -11701,15 +11853,15 @@
globalResult := Dictionary new.
values2 keysDo:[:key|
- |difference|
-
- difference := (values2 at:key) - (values1 at:key).
-
- runTimeInS = 0 ifTrue:[
- globalResult at:key put:0.
- ] ifFalse:[
- globalResult at:key put:(difference / runTimeInS) asFloat.
- ].
+ |difference|
+
+ difference := (values2 at:key) - (values1 at:key).
+
+ runTimeInS = 0 ifTrue:[
+ globalResult at:key put:0.
+ ] ifFalse:[
+ globalResult at:key put:(difference / runTimeInS) asFloat.
+ ].
].
^ globalResult
@@ -11776,22 +11928,22 @@
value2 := result2 at:#values.
value1 keysDo:[:key|
- |diff dPerSecond load1024 res|
-
- diff := (value2 at:key) - (value1 at:key).
- diff := diff bitShift:10.
-
- deltaTIn100Ns = 0 ifTrue:[
- dPerSecond := 0.
- ] ifFalse:[
- dPerSecond := (diff / deltaTIn100Ns) asFloat.
- ].
- load1024 := 1024 - dPerSecond.
-
- res := (load1024 / 1024 * 100) asFloat.
- res < 0 ifTrue:[res := 0].
-
- globalResult at:key put:res.
+ |diff dPerSecond load1024 res|
+
+ diff := (value2 at:key) - (value1 at:key).
+ diff := diff bitShift:10.
+
+ deltaTIn100Ns = 0 ifTrue:[
+ dPerSecond := 0.
+ ] ifFalse:[
+ dPerSecond := (diff / deltaTIn100Ns) asFloat.
+ ].
+ load1024 := 1024 - dPerSecond.
+
+ res := (load1024 / 1024 * 100) asFloat.
+ res < 0 ifTrue:[res := 0].
+
+ globalResult at:key put:res.
].
^ globalResult
@@ -11906,15 +12058,15 @@
|data object counter values debugBlock numInstances|
debugBlock := [:obj|
- ^ 'obj:', obj , ' this:', self printString , ' idx:', self indexedName
+ ^ 'obj:', obj , ' this:', self printString , ' idx:', self indexedName
].
data := self data.
objectIndex == 0 ifTrue:[
- object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
+ object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
] ifFalse:[
- object := data objectArray detect:[:el|(el at:#ObjectNameTitleIndex) == objectIndex] ifNone:[debugBlock value:(object at:#ObjectNameTitle)].
+ object := data objectArray detect:[:el|(el at:#ObjectNameTitleIndex) == objectIndex] ifNone:[debugBlock value:(object at:#ObjectNameTitle)].
].
counter := (object at:#Counters) detect:[:aCounter|(aCounter at:#CounterNameTitleIndex) == counterIndex] ifNone:[debugBlock value:(object at:#ObjectNameTitle)].
@@ -11923,28 +12075,28 @@
numInstances := object at:#NumInstances.
numInstances > 0 ifTrue:[
- 1 to:numInstances do:[:idx|
- |value instanceName|
-
- value := (counter at:#CounterValueArray) at:idx.
- instanceName := ((object at:#Instances) at:idx) at:#Name.
-
- values at:instanceName put:value.
- ].
+ 1 to:numInstances do:[:idx|
+ |value instanceName|
+
+ value := (counter at:#CounterValueArray) at:idx.
+ instanceName := ((object at:#Instances) at:idx) at:#Name.
+
+ values at:instanceName put:value.
+ ].
] ifFalse:[
- values at:'<<singleton>>' put:(counter at:#CounterValueArray) first.
+ values at:'<<singleton>>' put:(counter at:#CounterValueArray) first.
].
boolean ifTrue:[
- |return|
-
- return := IdentityDictionary new.
- return at:#time put:data perfTime.
- return at:#frequence put:data perfFreq.
- return at:#time100nSec put:data perfTime100nSec.
- return at:#values put:values.
-
- ^ return
+ |return|
+
+ return := IdentityDictionary new.
+ return at:#time put:data perfTime.
+ return at:#frequence put:data perfFreq.
+ return at:#time100nSec put:data perfTime100nSec.
+ return at:#values put:values.
+
+ ^ return
].
^ values
@@ -11955,7 +12107,7 @@
current
TheOneAndOnlyInstance isNil ifTrue:[
- TheOneAndOnlyInstance := self new.
+ TheOneAndOnlyInstance := self new.
].
^ TheOneAndOnlyInstance
@@ -11977,7 +12129,7 @@
^ self getValuesByCounter:218 timed:true
"
- self current diskBytes
+ self current diskBytes
"
!
@@ -11993,7 +12145,7 @@
^ self getPerSecondViaPerformBlock:[self diskBytes]
"
- self current diskBytesPerSecond
+ self current diskBytesPerSecond
"
!
@@ -12009,7 +12161,7 @@
^ self getValuesByCounter:198
"
- self current diskQueueLength
+ self current diskQueueLength
"
!
@@ -12017,7 +12169,7 @@
^ self getValuesByCounter:214 timed:true
"
- self current diskRead
+ self current diskRead
"
!
@@ -12033,7 +12185,7 @@
^ self getPerSecondViaPerformBlock:[self diskRead]
"
- self current diskReadsPerSecond
+ self current diskReadsPerSecond
"
!
@@ -12049,7 +12201,7 @@
^ self getValuesByCounter:408
"
- self current diskSpaceFreeInMegaByte
+ self current diskSpaceFreeInMegaByte
"
!
@@ -12057,7 +12209,7 @@
^ self getValuesByCounter:212 timed:true
"
- self current diskTransfers
+ self current diskTransfers
"
!
@@ -12073,7 +12225,7 @@
^ self getPerSecondViaPerformBlock:[self diskTransfers]
"
- self current diskTransfersPerSecond
+ self current diskTransfersPerSecond
"
!
@@ -12089,7 +12241,7 @@
^ self getValuesByCounter:216 timed:true
"
- self current diskWrite
+ self current diskWrite
"
!
@@ -12105,7 +12257,7 @@
^ self getPerSecondViaPerformBlock:[self diskWrite]
"
- self current diskWritesPerSecond
+ self current diskWritesPerSecond
"
!
@@ -12122,7 +12274,7 @@
current
TheOneAndOnlyInstance isNil ifTrue:[
- TheOneAndOnlyInstance := self new.
+ TheOneAndOnlyInstance := self new.
].
^ TheOneAndOnlyInstance
@@ -12151,12 +12303,12 @@
indexNameArray := OrderedCollection new.
data objectArray do:[:anObject|
- |index name|
-
- index := anObject at:#ObjectNameTitleIndex.
- name := Win32OperatingSystem::PerformanceData counterIndexTextDictionary at:index.
-
- indexNameArray add:(Array with:name with:index).
+ |index name|
+
+ index := anObject at:#ObjectNameTitleIndex.
+ name := Win32OperatingSystem::PerformanceData counterIndexTextDictionary at:index.
+
+ indexNameArray add:(Array with:name with:index).
].
^ indexNameArray
@@ -12167,7 +12319,7 @@
current
TheOneAndOnlyInstance isNil ifTrue:[
- TheOneAndOnlyInstance := self new.
+ TheOneAndOnlyInstance := self new.
].
^ TheOneAndOnlyInstance
@@ -12189,7 +12341,7 @@
^ self getValuesByCounter:1380
"
- self current availableKBytes
+ self current availableKBytes
"
!
@@ -12197,7 +12349,7 @@
^ self getValuesByCounter:1382
"
- self current availableMBytes
+ self current availableMBytes
"
! !
@@ -12206,7 +12358,7 @@
current
TheOneAndOnlyInstance isNil ifTrue:[
- TheOneAndOnlyInstance := self new.
+ TheOneAndOnlyInstance := self new.
].
^ TheOneAndOnlyInstance
@@ -12232,7 +12384,7 @@
^ self getValuesByCounter:264 timed:true
"
- self current bytesReceived
+ self current bytesReceived
"
!
@@ -12248,7 +12400,7 @@
^ self getPerSecondViaPerformBlock:[self bytesReceived]
"
- self current bytesReceivedPerSecond
+ self current bytesReceivedPerSecond
"
!
@@ -12264,7 +12416,7 @@
^ self getValuesByCounter:506 timed:true
"
- self current bytesSent
+ self current bytesSent
"
!
@@ -12280,7 +12432,7 @@
^ self getPerSecondViaPerformBlock:[self bytesSent]
"
- self current bytesSentPerSecond
+ self current bytesSentPerSecond
"
!
@@ -12298,13 +12450,13 @@
modifiedDictionary := Dictionary new.
(self getPerSecondViaPerformBlock:[self bytesReceived]) keysAndValuesDo:[:key :value|
- modifiedDictionary at:key put:(value / 1024).
+ modifiedDictionary at:key put:(value / 1024).
].
^ modifiedDictionary
"
- self current kBytesReceivedPerSecond
+ self current kBytesReceivedPerSecond
"
!
@@ -12333,13 +12485,13 @@
modifiedDictionary := Dictionary new.
(self getPerSecondViaPerformBlock:[self bytesSent]) keysAndValuesDo:[:key :value|
- modifiedDictionary at:key put:(value / 1024).
+ modifiedDictionary at:key put:(value / 1024).
].
^ modifiedDictionary
"
- self current kBytesSentPerSecond
+ self current kBytesSentPerSecond
"
!
@@ -12367,7 +12519,7 @@
current
TheOneAndOnlyInstance isNil ifTrue:[
- TheOneAndOnlyInstance := self new.
+ TheOneAndOnlyInstance := self new.
].
^ TheOneAndOnlyInstance
@@ -12389,7 +12541,7 @@
^ self getValuesByCounter:6 timed:true
"
- self current processTime
+ self current processTime
"
!
@@ -12407,13 +12559,13 @@
modifiedDictionary := Dictionary new.
(self getUsageViaPerformBlock:[self processTime]) keysAndValuesDo:[:key :value|
- modifiedDictionary at:key put:(100 - value).
+ modifiedDictionary at:key put:(100 - value).
].
^ modifiedDictionary
"
- self current processUsage
+ self current processUsage
"
!
@@ -12441,7 +12593,7 @@
^ (self data objectArray first at:#Instances) collect:[:el|el at:#Name]
"
- self current runningProcessNameList
+ self current runningProcessNameList
"
!
@@ -12450,7 +12602,7 @@
^ (self data objectArray first at:#NumInstances)
"
- self current runningProcesses
+ self current runningProcesses
"
! !
@@ -12459,7 +12611,7 @@
current
TheOneAndOnlyInstance isNil ifTrue:[
- TheOneAndOnlyInstance := self new.
+ TheOneAndOnlyInstance := self new.
].
^ TheOneAndOnlyInstance
@@ -12481,7 +12633,7 @@
^ self getValuesByCounter:148 timed:true
"
- self current interrupts
+ self current interrupts
"
!
@@ -12497,7 +12649,7 @@
^ self getPerSecondViaPerformBlock:[self interrupts]
"
- self current interruptsPerSecond
+ self current interruptsPerSecond
"
!
@@ -12513,7 +12665,7 @@
^ self getValuesByCounter:6 timed:true
"
- self current processorTime
+ self current processorTime
"
!
@@ -12555,8 +12707,8 @@
pComment := self unsignedLongAt:(20 + 1).
^ pComment == 0
- ifTrue:''
- ifFalse:[ (ExternalBytes address:pComment) stringAt:1 ]
+ ifTrue:''
+ ifFalse:[ (ExternalBytes address:pComment) stringAt:1 ]
"Created: / 01-08-2006 / 14:02:55 / fm"
"Modified: / 16-04-2007 / 13:08:39 / cg"
@@ -12581,8 +12733,8 @@
externalBytes := ExternalBytes address:pLocation.
^ externalBytes isEmpty
- ifTrue:[ nil ]
- ifFalse:[ externalBytes stringAt:1 ]
+ ifTrue:[ nil ]
+ ifFalse:[ externalBytes stringAt:1 ]
"Created: / 01-08-2006 / 14:03:21 / fm"
"Modified: / 18-10-2006 / 12:06:45 / User"
@@ -12609,13 +12761,13 @@
"returns a collection of root keyNames"
^ #(
- 'HKEY_CLASSES_ROOT'
- 'HKEY_CURRENT_USER'
- 'HKEY_LOCAL_MACHINE'
- 'HKEY_USERS'
- 'HKEY_PERFORMANCE_DATA'
- 'HKEY_CURRENT_CONFIG'
- 'HKEY_DYN_DATA'
+ 'HKEY_CLASSES_ROOT'
+ 'HKEY_CURRENT_USER'
+ 'HKEY_LOCAL_MACHINE'
+ 'HKEY_USERS'
+ 'HKEY_PERFORMANCE_DATA'
+ 'HKEY_CURRENT_CONFIG'
+ 'HKEY_DYN_DATA'
)
!
@@ -12632,149 +12784,149 @@
Interface to a WIN32 registry.
As this is a private class, access it via
- Win32OperatingSystem registryEntry
+ Win32OperatingSystem registryEntry
[author:]
- Claus Gittinger (initial version & cleanup)
+ Claus Gittinger (initial version & cleanup)
"
!
examples
"
retrieve an existing entry by key:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'
+ [exEnd]
retrieve a non-existing entry by key:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\xxx'
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\xxx'
+ [exEnd]
ask a keys value:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'.
- Transcript show:'Windows serial NR:'; showCR:(k valueNamed:'ProductId').
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
- Transcript showCR:(k valueNamed:'CurrentVersion').
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'.
+ Transcript show:'Windows serial NR:'; showCR:(k valueNamed:'ProductId').
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
+ Transcript showCR:(k valueNamed:'CurrentVersion').
+ [exEnd]
create a sub-key (if not already present):
- [exBegin]
- |k subKey|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
- subKey := k createSubKeyNamed:'RegistryDemo'
- [exEnd]
+ [exBegin]
+ |k subKey|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
+ subKey := k createSubKeyNamed:'RegistryDemo'
+ [exEnd]
change a keys value:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
- k valueNamed:'FooBarBaz' put:'a foo bar baz string'.
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
+ k valueNamed:'FooBarBaz' put:'a foo bar baz string'.
+ [exEnd]
delete a value:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
- k deleteValueNamed:'FooBarBaz'.
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
+ k deleteValueNamed:'FooBarBaz'.
+ [exEnd]
delete a key:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
- k deleteSubKeyNamed:'RegistryDemo'.
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
+ k deleteSubKeyNamed:'RegistryDemo'.
+ [exEnd]
enumerate keys:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
- k subKeysDo:[:subKey |
- Transcript showCR:subKey path
- ]
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
+ k subKeysDo:[:subKey |
+ Transcript showCR:subKey path
+ ]
+ [exEnd]
enumerate all keys (recursive):
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
- k allSubKeysDo:[:subKey |
- Transcript showCR:subKey path
- ]
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
+ k allSubKeysDo:[:subKey |
+ Transcript showCR:subKey path
+ ]
+ [exEnd]
fetch value by index:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
- Transcript showCR:(k valueNameAtIndex:0)
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
+ Transcript showCR:(k valueNameAtIndex:0)
+ [exEnd]
enumerate value names:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
- k valueNamesDo:[:nm |
- Transcript showCR:nm.
- ]
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
+ k valueNamesDo:[:nm |
+ Transcript showCR:nm.
+ ]
+ [exEnd]
enumerate values:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
- k valueNamesAndValuesDo:[:nm :val |
- Transcript showCR:(nm , ' -> ' , val storeString).
- ]
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
+ k valueNamesAndValuesDo:[:nm :val |
+ Transcript showCR:(nm , ' -> ' , val storeString).
+ ]
+ [exEnd]
search for a value (where does NT store the domain ?):
- [exBegin]
- |k|
-
- k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\System'.
- k subKeysDo:[:subKey |
- subKey subKeysDo:[:subSubKey |
- |tcp params|
-
- (subSubKey path asLowercase endsWith:'services') ifTrue:[
- tcp := subSubKey subKeyNamed:'tcpip'.
- tcp notNil ifTrue:[
- params := tcp subKeyNamed:'parameters'.
- params notNil ifTrue:[
- Transcript showCR:'Domain is found in ' , params path ,
- ' value: ' , (params valueNamed:'Domain').
- params close.
- ].
- tcp close.
- ]
- ]
- ]
- ]
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\System'.
+ k subKeysDo:[:subKey |
+ subKey subKeysDo:[:subSubKey |
+ |tcp params|
+
+ (subSubKey path asLowercase endsWith:'services') ifTrue:[
+ tcp := subSubKey subKeyNamed:'tcpip'.
+ tcp notNil ifTrue:[
+ params := tcp subKeyNamed:'parameters'.
+ params notNil ifTrue:[
+ Transcript showCR:'Domain is found in ' , params path ,
+ ' value: ' , (params valueNamed:'Domain').
+ params close.
+ ].
+ tcp close.
+ ]
+ ]
+ ]
+ ]
+ [exEnd]
"
@@ -12822,31 +12974,31 @@
HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
specialKeyStringOrSymbol = #'HKEY_CLASSES_ROOT' ifTrue:[
- ^ HKEY_CLASSES_ROOT.
+ ^ HKEY_CLASSES_ROOT.
].
specialKeyStringOrSymbol = #'HKEY_CURRENT_USER' ifTrue:[
- ^ HKEY_CURRENT_USER.
+ ^ HKEY_CURRENT_USER.
].
specialKeyStringOrSymbol = #'HKEY_LOCAL_MACHINE' ifTrue:[
- ^ HKEY_LOCAL_MACHINE.
+ ^ HKEY_LOCAL_MACHINE.
].
specialKeyStringOrSymbol = #'HKEY_USERS' ifTrue:[
- ^ HKEY_USERS.
+ ^ HKEY_USERS.
].
specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_DATA' ifTrue:[
- ^ HKEY_PERFORMANCE_DATA.
+ ^ HKEY_PERFORMANCE_DATA.
].
specialKeyStringOrSymbol = #'HKEY_CURRENT_CONFIG' ifTrue:[
- ^ HKEY_CURRENT_CONFIG.
+ ^ HKEY_CURRENT_CONFIG.
].
specialKeyStringOrSymbol = #'HKEY_DYN_DATA' ifTrue:[
- ^ HKEY_DYN_DATA.
+ ^ HKEY_DYN_DATA.
].
specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_TEXT' ifTrue:[
- ^ HKEY_PERFORMANCE_TEXT.
+ ^ HKEY_PERFORMANCE_TEXT.
].
specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_NLSTEXT' ifTrue:[
- ^ HKEY_PERFORMANCE_NLSTEXT.
+ ^ HKEY_PERFORMANCE_NLSTEXT.
].
^ nil
@@ -12859,7 +13011,7 @@
"handle image restarts and refetch registry handles"
(something == #returnFromSnapshot) ifTrue:[
- self initialize
+ self initialize
]
"Created: 15.6.1996 / 15:14:03 / cg"
@@ -12872,9 +13024,9 @@
|h newEntry|
aHandleValue isInteger ifTrue:[
- h := ExternalAddress newAddress:aHandleValue
+ h := ExternalAddress newAddress:aHandleValue
] ifFalse:[
- h := aHandleValue
+ h := aHandleValue
].
"/ rootKeys are not registered for RegClose ...
@@ -13055,7 +13207,7 @@
k := self key:'HKEY_CLASSES_ROOT\MIME\Database\Content Type\',mimeType.
k notNil ifTrue:[
- suffix := k valueNamed:'extension'.
+ suffix := k valueNamed:'extension'.
].
^ suffix
!
@@ -13069,35 +13221,35 @@
suffix isNil ifTrue:[^ nil].
(suffix startsWith:'.') ifTrue:[
- suffix := suffix copyFrom:2
+ suffix := suffix copyFrom:2
].
k := self key:'HKEY_CLASSES_ROOT\.',suffix.
k notNil ifTrue:[
- fkey := (k valueNamed:'').
+ fkey := (k valueNamed:'').
].
fkey isNil ifTrue:[
- fkey := suffix,'_auto_file'
+ fkey := suffix,'_auto_file'
].
fkey notEmptyOrNil ifTrue:[
- redirect := nil.
-
- k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , fkey , '\CurVer').
- k notNil ifTrue:[
- redirect := k defaultValue
- ].
-
- redirect isNil ifTrue:[
- k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , (fkey) , '\shell\',operation,'\command').
- ] ifFalse:[
- k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , (redirect) , '\shell\',operation,'\command').
- ].
-
- k notNil ifTrue:[
- cmd := k defaultValue
- ].
+ redirect := nil.
+
+ k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , fkey , '\CurVer').
+ k notNil ifTrue:[
+ redirect := k defaultValue
+ ].
+
+ redirect isNil ifTrue:[
+ k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , (fkey) , '\shell\',operation,'\command').
+ ] ifFalse:[
+ k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , (redirect) , '\shell\',operation,'\command').
+ ].
+
+ k notNil ifTrue:[
+ cmd := k defaultValue
+ ].
].
@@ -13122,8 +13274,8 @@
"
self
- stringValueFor:'Content Type'
- atKey:'HKEY_CLASSES_ROOT\.au'
+ stringValueFor:'Content Type'
+ atKey:'HKEY_CLASSES_ROOT\.au'
"
! !
@@ -13165,26 +13317,26 @@
if (__isExternalAddressLike(__INST(handle))
&& (__isString(subKeyString) || __isSymbol(subKeyString))) {
- myKey = (HKEY)__externalAddressVal(__INST(handle));
- if ((_retVal = RegCreateKey(myKey, __stringVal(subKeyString), &subKey)) == ERROR_SUCCESS) {
- subHandle = __MKEXTERNALADDRESS(subKey);
- } else {
- if ((_retVal != ERROR_PATH_NOT_FOUND)
- && (_retVal != ERROR_FILE_NOT_FOUND)) {
- errorNumber = __MKSMALLINT(_retVal);
- }
- }
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+ if ((_retVal = RegCreateKey(myKey, __stringVal(subKeyString), &subKey)) == ERROR_SUCCESS) {
+ subHandle = __MKEXTERNALADDRESS(subKey);
+ } else {
+ if ((_retVal != ERROR_PATH_NOT_FOUND)
+ && (_retVal != ERROR_FILE_NOT_FOUND)) {
+ errorNumber = __MKSMALLINT(_retVal);
+ }
+ }
}
%}.
subHandle notNil ifTrue:[
- newEntry := self class basicNew
- setHandle:subHandle
- path:(path , self class separator asString , subKeyString).
- newEntry registerForFinalization.
- ^ newEntry.
+ newEntry := self class basicNew
+ setHandle:subHandle
+ path:(path , self class separator asString , subKeyString).
+ newEntry registerForFinalization.
+ ^ newEntry.
].
errorNumber notNil ifTrue:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError.
].
^ nil
@@ -13208,18 +13360,18 @@
if (__isExternalAddressLike(__INST(handle))
&& (__isString(subKeyString) || __isSymbol(subKeyString))) {
- myKey = (HKEY)__externalAddressVal(__INST(handle));
- if ((_retVal = RegDeleteKey(myKey, __stringVal(subKeyString))) == ERROR_SUCCESS) {
- RETURN (true);
- }
- if ((_retVal != ERROR_PATH_NOT_FOUND)
- && (_retVal != ERROR_FILE_NOT_FOUND)) {
- errorNumber = __MKSMALLINT(_retVal);
- }
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+ if ((_retVal = RegDeleteKey(myKey, __stringVal(subKeyString))) == ERROR_SUCCESS) {
+ RETURN (true);
+ }
+ if ((_retVal != ERROR_PATH_NOT_FOUND)
+ && (_retVal != ERROR_FILE_NOT_FOUND)) {
+ errorNumber = __MKSMALLINT(_retVal);
+ }
}
%}.
errorNumber notNil ifTrue:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError.
].
^ false
@@ -13243,24 +13395,24 @@
int _retVal;
if (__isExternalAddressLike(__INST(handle)) && __isString(hostName)) {
- myKey = (HKEY)__externalAddressVal(__INST(handle));
- if ((_retVal = RegConnectRegistryA(__stringVal(hostName), myKey, &remoteKey)) == ERROR_SUCCESS) {
- remoteHandle = __MKEXTERNALADDRESS(remoteKey);
- } else {
- if ((_retVal != ERROR_PATH_NOT_FOUND)
- && (_retVal != ERROR_FILE_NOT_FOUND)) {
- errorNumber = __MKSMALLINT(_retVal);
- }
- }
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+ if ((_retVal = RegConnectRegistryA(__stringVal(hostName), myKey, &remoteKey)) == ERROR_SUCCESS) {
+ remoteHandle = __MKEXTERNALADDRESS(remoteKey);
+ } else {
+ if ((_retVal != ERROR_PATH_NOT_FOUND)
+ && (_retVal != ERROR_FILE_NOT_FOUND)) {
+ errorNumber = __MKSMALLINT(_retVal);
+ }
+ }
}
%}.
remoteHandle notNil ifTrue:[
- newEntry := self class basicNew setHandle:remoteHandle path:path.
- newEntry registerForFinalization.
- ^ newEntry.
+ newEntry := self class basicNew setHandle:remoteHandle path:path.
+ newEntry registerForFinalization.
+ ^ newEntry.
].
errorNumber notNil ifTrue:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError.
].
^ nil
@@ -13307,30 +13459,30 @@
if (__isExternalAddressLike(__INST(handle))
&& __isSmallInteger(subKeyIndex)) {
- myKey = (HKEY)__externalAddressVal(__INST(handle));
- if ((_retVal = RegEnumKeyExA(myKey, __intVal(subKeyIndex),
- nameBuffer, &nameSize,
- NULL,
- classNameBuffer, &classNameSize,
- &modificationTime)) == ERROR_SUCCESS) {
- nameBuffer[nameSize] = '\0';
- classNameBuffer[classNameSize] = '\0';
- subKeyName = __MKSTRING(nameBuffer);
- subKeyClassName = __MKSTRING(classNameBuffer);
- } else {
- if ((_retVal != ERROR_PATH_NOT_FOUND)
- && (_retVal != ERROR_FILE_NOT_FOUND)
- && (_retVal != ERROR_NO_MORE_ITEMS)) {
- errorNumber = __MKSMALLINT(_retVal);
- }
- }
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+ if ((_retVal = RegEnumKeyExA(myKey, __intVal(subKeyIndex),
+ nameBuffer, &nameSize,
+ NULL,
+ classNameBuffer, &classNameSize,
+ &modificationTime)) == ERROR_SUCCESS) {
+ nameBuffer[nameSize] = '\0';
+ classNameBuffer[classNameSize] = '\0';
+ subKeyName = __MKSTRING(nameBuffer);
+ subKeyClassName = __MKSTRING(classNameBuffer);
+ } else {
+ if ((_retVal != ERROR_PATH_NOT_FOUND)
+ && (_retVal != ERROR_FILE_NOT_FOUND)
+ && (_retVal != ERROR_NO_MORE_ITEMS)) {
+ errorNumber = __MKSMALLINT(_retVal);
+ }
+ }
}
%}.
subKeyName notNil ifTrue:[
- ^ self subKeyNamed:subKeyName.
+ ^ self subKeyNamed:subKeyName.
].
errorNumber notNil ifTrue:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError.
].
^ nil
@@ -13354,28 +13506,28 @@
if (__isExternalAddressLike(__INST(handle))
&& (__isString(subKeyString) || __isSymbol(subKeyString))) {
- myKey = (HKEY)__externalAddressVal(__INST(handle));
- _retVal = RegOpenKey(myKey, __stringVal(subKeyString), &subKey);
- if (_retVal == ERROR_SUCCESS) {
- subHandle = __MKEXTERNALADDRESS(subKey);
- } else {
- if ((_retVal != ERROR_PATH_NOT_FOUND)
- && (_retVal != ERROR_FILE_NOT_FOUND)) {
- errorNumber = __MKSMALLINT(_retVal);
- }
- }
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+ _retVal = RegOpenKey(myKey, __stringVal(subKeyString), &subKey);
+ if (_retVal == ERROR_SUCCESS) {
+ subHandle = __MKEXTERNALADDRESS(subKey);
+ } else {
+ if ((_retVal != ERROR_PATH_NOT_FOUND)
+ && (_retVal != ERROR_FILE_NOT_FOUND)) {
+ errorNumber = __MKSMALLINT(_retVal);
+ }
+ }
}
%}.
subHandle notNil ifTrue:[
- newEntry := self class basicNew
- setHandle:subHandle
- path:((path ? '?') , self class separator asString , subKeyString).
-
- newEntry registerForFinalization.
- ^ newEntry.
+ newEntry := self class basicNew
+ setHandle:subHandle
+ path:((path ? '?') , self class separator asString , subKeyString).
+
+ newEntry registerForFinalization.
+ ^ newEntry.
].
errorNumber notNil ifTrue:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError.
].
^ nil
@@ -13409,18 +13561,18 @@
if (__isExternalAddressLike(__INST(handle))
&& (__isString(aValueName) || __isSymbol(aValueName))) {
- myKey = (HKEY)__externalAddressVal(__INST(handle));
- if ((_retVal = RegDeleteValue(myKey, __stringVal(aValueName))) == ERROR_SUCCESS) {
- RETURN (true);
- }
- if ((_retVal != ERROR_PATH_NOT_FOUND)
- && (_retVal != ERROR_FILE_NOT_FOUND)) {
- errorNumber = __MKSMALLINT(_retVal);
- }
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+ if ((_retVal = RegDeleteValue(myKey, __stringVal(aValueName))) == ERROR_SUCCESS) {
+ RETURN (true);
+ }
+ if ((_retVal != ERROR_PATH_NOT_FOUND)
+ && (_retVal != ERROR_FILE_NOT_FOUND)) {
+ errorNumber = __MKSMALLINT(_retVal);
+ }
}
%}.
errorNumber notNil ifTrue:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError.
].
^ false
!
@@ -13440,24 +13592,24 @@
if (__isExternalAddressLike(__INST(handle))
&& __isSmallInteger(valueIndex)) {
- myKey = (HKEY)__externalAddressVal(__INST(handle));
- if ((_retVal = RegEnumValueA(myKey, __intVal(valueIndex),
- nameBuffer, &nameSize,
- NULL,
- &valueType,
- NULL, NULL)) == ERROR_SUCCESS) {
- nameBuffer[nameSize] = '\0';
- valueName = __MKSTRING(nameBuffer);
- } else {
- if ((_retVal != ERROR_PATH_NOT_FOUND)
- && (_retVal != ERROR_FILE_NOT_FOUND)) {
- errorNumber = __MKSMALLINT(_retVal);
- }
- }
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+ if ((_retVal = RegEnumValueA(myKey, __intVal(valueIndex),
+ nameBuffer, &nameSize,
+ NULL,
+ &valueType,
+ NULL, NULL)) == ERROR_SUCCESS) {
+ nameBuffer[nameSize] = '\0';
+ valueName = __MKSTRING(nameBuffer);
+ } else {
+ if ((_retVal != ERROR_PATH_NOT_FOUND)
+ && (_retVal != ERROR_FILE_NOT_FOUND)) {
+ errorNumber = __MKSMALLINT(_retVal);
+ }
+ }
}
%}.
errorNumber notNil ifTrue:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError.
].
^ valueName
@@ -13471,11 +13623,11 @@
valueNamed:aValueName
"retrieve a value; the returned object depends upon the type:
- REG_BINARY -> ByteArray
- REG_SZ -> String
- REG_MULTI_SZ -> Array of strings
- REG_DWORD -> Integer
- REG_NONE -> nil
+ REG_BINARY -> ByteArray
+ REG_SZ -> String
+ REG_MULTI_SZ -> Array of strings
+ REG_DWORD -> Integer
+ REG_NONE -> nil
"
|stringArray retVal errorNumber|
@@ -13484,9 +13636,9 @@
HKEY myKey;
DWORD valueType;
union {
- DWORD dWord;
- unsigned char dWordBytes[4];
- unsigned char smallDataBuffer[1024*128];
+ DWORD dWord;
+ unsigned char dWordBytes[4];
+ unsigned char smallDataBuffer[1024*128];
} quickData;
int val;
DWORD dataSize = sizeof(quickData);
@@ -13502,166 +13654,166 @@
if (__isExternalAddressLike(__INST(handle))
&& (__isString(aValueName) || __isSymbol(aValueName))) {
- int ret;
-
- myKey = (HKEY)__externalAddressVal(__INST(handle));
-
- /*
- * try to get it with one call ...
- */
- ret = RegQueryValueEx(myKey, __stringVal(aValueName),
- NULL,
- &valueType,
- (char *)&quickData,
- &dataSize);
+ int ret;
+
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+
+ /*
+ * try to get it with one call ...
+ */
+ ret = RegQueryValueEx(myKey, __stringVal(aValueName),
+ NULL,
+ &valueType,
+ (char *)&quickData,
+ &dataSize);
#if 0
- console_printf("dataSize=%d\n", dataSize);
-#endif
- while (ret == ERROR_MORE_DATA) {
+ console_printf("dataSize=%d\n", dataSize);
+#endif
+ while (ret == ERROR_MORE_DATA) {
#if 0
- console_printf("ERROR_MORE_DATA dataSize=%d\n", dataSize);
- console_printf("valueType=%d\n", valueType);
-#endif
- /*
- * nope - need another one ...
- */
- if (myKey = HKEY_PERFORMANCE_DATA) {
- dataSize = dataSize * 2;
- }
- switch (valueType) {
- case REG_BINARY:
- case REG_MULTI_SZ:
- dataBuffer = malloc(dataSize);;
- break;
- case REG_SZ:
- dataBuffer = malloc(dataSize);
- break;
- default:
- console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
- break;
- }
- if (dataBuffer) {
- ret = RegQueryValueEx(myKey, __stringVal(aValueName),
- NULL,
- &valueType,
- dataBuffer,
- &dataSize);
- } else {
- break;
- }
- if (myKey != HKEY_PERFORMANCE_DATA) {
- if (ret != ERROR_SUCCESS) break;
- }
- }
-
- if (ret == ERROR_SUCCESS) {
+ console_printf("ERROR_MORE_DATA dataSize=%d\n", dataSize);
+ console_printf("valueType=%d\n", valueType);
+#endif
+ /*
+ * nope - need another one ...
+ */
+ if (myKey = HKEY_PERFORMANCE_DATA) {
+ dataSize = dataSize * 2;
+ }
+ switch (valueType) {
+ case REG_BINARY:
+ case REG_MULTI_SZ:
+ dataBuffer = malloc(dataSize);;
+ break;
+ case REG_SZ:
+ dataBuffer = malloc(dataSize);
+ break;
+ default:
+ console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
+ break;
+ }
+ if (dataBuffer) {
+ ret = RegQueryValueEx(myKey, __stringVal(aValueName),
+ NULL,
+ &valueType,
+ dataBuffer,
+ &dataSize);
+ } else {
+ break;
+ }
+ if (myKey != HKEY_PERFORMANCE_DATA) {
+ if (ret != ERROR_SUCCESS) break;
+ }
+ }
+
+ if (ret == ERROR_SUCCESS) {
#if 0
- console_printf("ERROR_SUCCESS dataSize=%d\n", dataSize);
- console_printf("valueType=%d\n", valueType);
-#endif
- switch (valueType) {
- case REG_NONE:
- /* RETURN (@symbol(none)); */
- retVal = nil;
- break;
-
- case REG_BINARY:
- retVal = __MKBYTEARRAY(dataBuffer ? dataBuffer : quickData.smallDataBuffer, dataSize);
- break;
-
- case REG_SZ:
- case REG_EXPAND_SZ:
+ console_printf("ERROR_SUCCESS dataSize=%d\n", dataSize);
+ console_printf("valueType=%d\n", valueType);
+#endif
+ switch (valueType) {
+ case REG_NONE:
+ /* RETURN (@symbol(none)); */
+ retVal = nil;
+ break;
+
+ case REG_BINARY:
+ retVal = __MKBYTEARRAY(dataBuffer ? dataBuffer : quickData.smallDataBuffer, dataSize);
+ break;
+
+ case REG_SZ:
+ case REG_EXPAND_SZ:
#ifdef USE_UNICODE
- retVal = __MKU16STRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
-#else
- retVal = __MKSTRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
-#endif
- break;
+ retVal = __MKU16STRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
+#else
+ retVal = __MKSTRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
+#endif
+ break;
#if 0
- case REG_DWORD:
- /* int in native format */
- retVal = __MKUINT(quickData.dWord);
- break;
-#endif
- case REG_DWORD_LITTLE_ENDIAN:
- val = quickData.dWordBytes[3];
- val = (val << 8) | quickData.dWordBytes[2];
- val = (val << 8) | quickData.dWordBytes[1];
- val = (val << 8) | quickData.dWordBytes[0];
- retVal = __MKUINT(val);
- break;
-
- case REG_DWORD_BIG_ENDIAN:
- val = quickData.dWordBytes[0];
- val = (val << 8) | quickData.dWordBytes[1];
- val = (val << 8) | quickData.dWordBytes[2];
- val = (val << 8) | quickData.dWordBytes[3];
- retVal = __MKUINT(val);
- break;
-
- case REG_MULTI_SZ:
- {
- CHAR *cp, *cp0;
- int ns, i;
-
- cp0 = dataBuffer ? dataBuffer : quickData.smallDataBuffer;
+ case REG_DWORD:
+ /* int in native format */
+ retVal = __MKUINT(quickData.dWord);
+ break;
+#endif
+ case REG_DWORD_LITTLE_ENDIAN:
+ val = quickData.dWordBytes[3];
+ val = (val << 8) | quickData.dWordBytes[2];
+ val = (val << 8) | quickData.dWordBytes[1];
+ val = (val << 8) | quickData.dWordBytes[0];
+ retVal = __MKUINT(val);
+ break;
+
+ case REG_DWORD_BIG_ENDIAN:
+ val = quickData.dWordBytes[0];
+ val = (val << 8) | quickData.dWordBytes[1];
+ val = (val << 8) | quickData.dWordBytes[2];
+ val = (val << 8) | quickData.dWordBytes[3];
+ retVal = __MKUINT(val);
+ break;
+
+ case REG_MULTI_SZ:
+ {
+ CHAR *cp, *cp0;
+ int ns, i;
+
+ cp0 = dataBuffer ? dataBuffer : quickData.smallDataBuffer;
#if 0
- console_printf("**************\n");
- for (i=0;i<50;i++) {
- console_printf("%x ", cp0[i]);
- }
- console_printf("\n");
- for (i=0;i<50;i++) {
- if (cp0[i] == 0)
- console_printf("\n");
- else
- console_printf("%c", cp0[i]);
- }
- console_printf("\n");
- console_printf("**************\n");
-#endif
- cp = cp0;
- ns = 0;
- while (*cp) {
- while (*cp++) ;;
- ns++;
- }
- stringArray = __ARRAY_NEW_INT(ns);
-
- i = 0;
- while (*cp0) {
- OBJ s;
- CHAR *cp;
-
- cp = cp0;
- while (*cp++) ;;
+ console_printf("**************\n");
+ for (i=0;i<50;i++) {
+ console_printf("%x ", cp0[i]);
+ }
+ console_printf("\n");
+ for (i=0;i<50;i++) {
+ if (cp0[i] == 0)
+ console_printf("\n");
+ else
+ console_printf("%c", cp0[i]);
+ }
+ console_printf("\n");
+ console_printf("**************\n");
+#endif
+ cp = cp0;
+ ns = 0;
+ while (*cp) {
+ while (*cp++) ;;
+ ns++;
+ }
+ stringArray = __ARRAY_NEW_INT(ns);
+
+ i = 0;
+ while (*cp0) {
+ OBJ s;
+ CHAR *cp;
+
+ cp = cp0;
+ while (*cp++) ;;
#ifdef USE_UNICODE
- s = __MKU16STRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
-#else
- s = __MKSTRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
-#endif
- cp0 = cp;
- i++;
- }
- retVal = stringArray;
- break;
- }
- default:
- console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
- break;
- }
- } else {
- if ((ret != ERROR_PATH_NOT_FOUND)
- && (ret != ERROR_FILE_NOT_FOUND)) {
- errorNumber = __MKSMALLINT(ret);
- }
- }
+ s = __MKU16STRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
+#else
+ s = __MKSTRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
+#endif
+ cp0 = cp;
+ i++;
+ }
+ retVal = stringArray;
+ break;
+ }
+ default:
+ console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
+ break;
+ }
+ } else {
+ if ((ret != ERROR_PATH_NOT_FOUND)
+ && (ret != ERROR_FILE_NOT_FOUND)) {
+ errorNumber = __MKSMALLINT(ret);
+ }
+ }
}
if (dataBuffer) free(dataBuffer);
%}.
errorNumber notNil ifTrue:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError.
].
^ retVal
@@ -13676,11 +13828,11 @@
valueNamed:aValueName put:datum
"store a value; the value type depends upon the stored value:
- ByteArray -> REG_BINARY
- String -> REG_SZ
- Array of string -> REG_MULTI_SZ
- Integer -> REG_DWORD
- nil -> REG_NONE
+ ByteArray -> REG_BINARY
+ String -> REG_SZ
+ Array of string -> REG_MULTI_SZ
+ Integer -> REG_DWORD
+ nil -> REG_NONE
"
|data stringArray errorNumber|
@@ -13694,99 +13846,99 @@
if (__isExternalAddressLike(__INST(handle))
&& (__isString(aValueName) || __isSymbol(aValueName))) {
- int ret;
- OBJ cls;
-
- myKey = (HKEY)__externalAddressVal(__INST(handle));
-
- if (datum == nil) {
- valueType = REG_NONE;
- dataSize = 0;
- } else if (__isSmallInteger(datum)) {
- valueType = REG_DWORD;
- val = __intVal(datum);
- dataPointer = (unsigned char *)(&val);
- dataSize = sizeof(val);
- } else if (__isString(datum) || __isSymbol(datum)) {
- valueType = REG_SZ;
- dataPointer = __stringVal(datum);
- dataSize = __stringSize(datum) + 1;
- } else if (__Class(datum) == ByteArray) {
- valueType = REG_BINARY;
- dataPointer = __ByteArrayInstPtr(datum)->ba_element;
- dataSize = __byteArraySize(datum);
- } else if (__Class(datum) == LargeInteger) {
- valueType = REG_DWORD;
- val = __longIntVal(datum);
- if (val) {
- dataPointer = (unsigned char *)(&val);
- dataSize = sizeof(val);
- } else {
- datumOk = 0;
- }
- } else if (__Class(datum) == Array) {
- int i = 0, ns = 0, totalSize = 0;
-
- valueType = REG_MULTI_SZ;
-
- /*
- * must allocate a local buffer
- * find size ...
- */
- for (i=0; i<__arraySize(datum); i++) {
- OBJ s = __ArrayInstPtr(datum)->a_element[i];
-
- if (__isString(s) || __isSymbol(s)) {
- totalSize += __stringSize(s) + 1;
- } else {
- datumOk = 0;
- break;
- }
- ns++;
- }
- if (datumOk) {
- char *cp;
-
- /*
- * allocate and fill...
- */
- totalSize ++;
- dataPointer = (char *)(malloc(totalSize));
- mustFreeData = 1;
- cp = dataPointer;
- for (i=0; i<__arraySize(datum); i++) {
- OBJ s = __ArrayInstPtr(datum)->a_element[i];
-
- strcpy(cp, __stringVal(s));
- cp += __stringSize(s);
- *cp++ = '\0';
- }
- *cp++ = '\0';
- dataSize = totalSize;
- }
- } else {
- datumOk = 0;
- }
-
- if (datumOk) {
- ret = RegSetValueExA(myKey, __stringVal(aValueName),
- 0, valueType,
- dataPointer, dataSize);
- if (mustFreeData) {
- free(dataPointer);
- }
- if (ret == ERROR_SUCCESS) {
- RETURN (true);
- }
- if ((ret != ERROR_PATH_NOT_FOUND)
- && (ret != ERROR_FILE_NOT_FOUND)) {
- errorNumber = __MKSMALLINT(ret);
- }
- }
+ int ret;
+ OBJ cls;
+
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+
+ if (datum == nil) {
+ valueType = REG_NONE;
+ dataSize = 0;
+ } else if (__isSmallInteger(datum)) {
+ valueType = REG_DWORD;
+ val = __intVal(datum);
+ dataPointer = (unsigned char *)(&val);
+ dataSize = sizeof(val);
+ } else if (__isString(datum) || __isSymbol(datum)) {
+ valueType = REG_SZ;
+ dataPointer = __stringVal(datum);
+ dataSize = __stringSize(datum) + 1;
+ } else if (__Class(datum) == ByteArray) {
+ valueType = REG_BINARY;
+ dataPointer = __ByteArrayInstPtr(datum)->ba_element;
+ dataSize = __byteArraySize(datum);
+ } else if (__Class(datum) == LargeInteger) {
+ valueType = REG_DWORD;
+ val = __longIntVal(datum);
+ if (val) {
+ dataPointer = (unsigned char *)(&val);
+ dataSize = sizeof(val);
+ } else {
+ datumOk = 0;
+ }
+ } else if (__Class(datum) == Array) {
+ int i = 0, ns = 0, totalSize = 0;
+
+ valueType = REG_MULTI_SZ;
+
+ /*
+ * must allocate a local buffer
+ * find size ...
+ */
+ for (i=0; i<__arraySize(datum); i++) {
+ OBJ s = __ArrayInstPtr(datum)->a_element[i];
+
+ if (__isString(s) || __isSymbol(s)) {
+ totalSize += __stringSize(s) + 1;
+ } else {
+ datumOk = 0;
+ break;
+ }
+ ns++;
+ }
+ if (datumOk) {
+ char *cp;
+
+ /*
+ * allocate and fill...
+ */
+ totalSize ++;
+ dataPointer = (char *)(malloc(totalSize));
+ mustFreeData = 1;
+ cp = dataPointer;
+ for (i=0; i<__arraySize(datum); i++) {
+ OBJ s = __ArrayInstPtr(datum)->a_element[i];
+
+ strcpy(cp, __stringVal(s));
+ cp += __stringSize(s);
+ *cp++ = '\0';
+ }
+ *cp++ = '\0';
+ dataSize = totalSize;
+ }
+ } else {
+ datumOk = 0;
+ }
+
+ if (datumOk) {
+ ret = RegSetValueExA(myKey, __stringVal(aValueName),
+ 0, valueType,
+ dataPointer, dataSize);
+ if (mustFreeData) {
+ free(dataPointer);
+ }
+ if (ret == ERROR_SUCCESS) {
+ RETURN (true);
+ }
+ if ((ret != ERROR_PATH_NOT_FOUND)
+ && (ret != ERROR_FILE_NOT_FOUND)) {
+ errorNumber = __MKSMALLINT(ret);
+ }
+ }
}
%}.
errorNumber notNil ifTrue:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError.
].
^ false
@@ -13807,14 +13959,14 @@
idx := 0.
[true] whileTrue:[
- subEntry := self subKeyAtIndex:idx.
- subEntry isNil ifTrue:[
- ^self
- ].
- aBlock value:subEntry.
- subEntry allSubKeysDo:aBlock.
- subEntry close.
- idx := idx + 1.
+ subEntry := self subKeyAtIndex:idx.
+ subEntry isNil ifTrue:[
+ ^self
+ ].
+ aBlock value:subEntry.
+ subEntry allSubKeysDo:aBlock.
+ subEntry close.
+ idx := idx + 1.
]
"
@@ -13822,7 +13974,7 @@
top := self key:'HKEY_LOCAL_MACHINE'.
top allSubKeysDo:[:subEntry |
- Transcript showCR:subEntry path
+ Transcript showCR:subEntry path
]
"
!
@@ -13854,13 +14006,13 @@
idx := 0.
[true] whileTrue:[
- subEntry := self subKeyAtIndex:idx.
- subEntry isNil ifTrue:[
- ^self
- ].
- aBlock value:subEntry.
- subEntry close.
- idx := idx + 1.
+ subEntry := self subKeyAtIndex:idx.
+ subEntry isNil ifTrue:[
+ ^self
+ ].
+ aBlock value:subEntry.
+ subEntry close.
+ idx := idx + 1.
]
"
@@ -13868,7 +14020,7 @@
top := self key:'HKEY_LOCAL_MACHINE'.
top subKeysDo:[:subEntry |
- Transcript showCR:subEntry path
+ Transcript showCR:subEntry path
]
"
!
@@ -13877,7 +14029,7 @@
"evaluate aBlock for all value names"
self valueNamesDo:[:nm |
- aBlock value:nm value:(self valueNamed:nm)
+ aBlock value:nm value:(self valueNamed:nm)
]
"
@@ -13885,7 +14037,7 @@
key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
key valueNamesAndValuesDo:[:nm :val |
- Transcript showCR:(nm , ' -> ' , val storeString).
+ Transcript showCR:(nm , ' -> ' , val storeString).
]
"
!
@@ -13897,12 +14049,12 @@
idx := 0.
[true] whileTrue:[
- valueName := self valueNameAtIndex:idx.
- valueName isNil ifTrue:[
- ^self
- ].
- aBlock value:valueName.
- idx := idx + 1.
+ valueName := self valueNameAtIndex:idx.
+ valueName isNil ifTrue:[
+ ^self
+ ].
+ aBlock value:valueName.
+ idx := idx + 1.
]
! !
@@ -13922,9 +14074,9 @@
HKEY myKey;
if (__isExternalAddressLike(__INST(handle))) {
- myKey = (HKEY)(__externalAddressVal(__INST(handle)));
- __INST(handle) = nil;
- RegCloseKey(myKey);
+ myKey = (HKEY)(__externalAddressVal(__INST(handle)));
+ __INST(handle) = nil;
+ RegCloseKey(myKey);
}
%}
!
@@ -13937,7 +14089,7 @@
"some entry has been collected - close it"
handle notNil ifTrue:[
- self closeKey.
+ self closeKey.
]
"Created: / 19.5.1999 / 22:39:52 / cg"
@@ -13964,7 +14116,7 @@
key = __longIntVal(integerHandleValue);
if (! key) {
- RETURN (nil);
+ RETURN (nil);
}
t = __MKEXTERNALADDRESS(key); __INST(handle) = t; __STORE(self, t);
@@ -14046,88 +14198,88 @@
BOOL ok;
if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
- errSym = @symbol(errorNotOpen);
- goto bad;
+ errSym = @symbol(errorNotOpen);
+ goto bad;
}
if (! __bothSmallInteger(count, firstIndex)) {
- errSym = @symbol(badArgument);
- goto bad;
+ errSym = @symbol(badArgument);
+ goto bad;
}
cntWanted = __smallIntegerVal(count);
if (cntWanted <= 0) {
- errSym = @symbol(badCount);
- goto bad;
+ errSym = @symbol(badCount);
+ goto bad;
}
offs = __smallIntegerVal(firstIndex) - 1;
if (offs < 0) {
- errSym = @symbol(badOffset);
- goto bad;
+ errSym = @symbol(badOffset);
+ goto bad;
}
bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
if (! bufferIsExternalBytes) {
- if (__isByteArray(aByteBuffer)) {
- bufferSize = __byteArraySize(aByteBuffer);
- } else if (__isString(aByteBuffer)) {
- bufferSize = __stringSize(aByteBuffer);
- } else {
- errSym = @symbol(badBuffer);
- goto bad;
- }
- if (bufferSize < (cntWanted + offs)) {
- errSym = @symbol(badBufferSize);
- goto bad;
- }
- if (cntWanted <= sizeof(miniBuffer)) {
- extPtr = miniBuffer;
- } else {
- extPtr = malloc(cntWanted);
- mustFreeBuffer = 1;
- }
+ if (__isByteArray(aByteBuffer)) {
+ bufferSize = __byteArraySize(aByteBuffer);
+ } else if (__isString(aByteBuffer)) {
+ bufferSize = __stringSize(aByteBuffer);
+ } else {
+ errSym = @symbol(badBuffer);
+ goto bad;
+ }
+ if (bufferSize < (cntWanted + offs)) {
+ errSym = @symbol(badBufferSize);
+ goto bad;
+ }
+ if (cntWanted <= sizeof(miniBuffer)) {
+ extPtr = miniBuffer;
+ } else {
+ extPtr = malloc(cntWanted);
+ mustFreeBuffer = 1;
+ }
} else {
- OBJ sz;
-
- extPtr = (char *)(__externalBytesAddress(aByteBuffer));
- sz = __externalBytesSize(aByteBuffer);
- if (! __isSmallInteger(sz)) {
- errSym = @symbol(badBufferSize);
- goto bad;
- }
- bufferSize = __smallIntegerVal(sz);
- if (bufferSize < (cntWanted + offs)) {
- errSym = @symbol(badBufferSize);
- goto bad;
- }
- extPtr = extPtr + offs;
+ OBJ sz;
+
+ extPtr = (char *)(__externalBytesAddress(aByteBuffer));
+ sz = __externalBytesSize(aByteBuffer);
+ if (! __isSmallInteger(sz)) {
+ errSym = @symbol(badBufferSize);
+ goto bad;
+ }
+ bufferSize = __smallIntegerVal(sz);
+ if (bufferSize < (cntWanted + offs)) {
+ errSym = @symbol(badBufferSize);
+ goto bad;
+ }
+ extPtr = extPtr + offs;
}
do {
- __threadErrno = 0;
- ok = STX_API_CALL5( "ReadFile", ReadFile, hFile, extPtr, cntWanted, &cntRead, 0 /* lpOverlapped */);
+ __threadErrno = 0;
+ ok = STX_API_CALL5( "ReadFile", ReadFile, hFile, extPtr, cntWanted, &cntRead, 0 /* lpOverlapped */);
} while(__threadErrno == EINTR);
if (ok == TRUE) {
- if (! bufferIsExternalBytes) {
- /* copy over */
- memcpy(__byteArrayVal(aByteBuffer)+offs, extPtr, cntRead);
- if (mustFreeBuffer) {
- free(extPtr);
- }
- }
- RETURN (__mkSmallInteger(cntRead));
+ if (! bufferIsExternalBytes) {
+ /* copy over */
+ memcpy(__byteArrayVal(aByteBuffer)+offs, extPtr, cntRead);
+ if (mustFreeBuffer) {
+ free(extPtr);
+ }
+ }
+ RETURN (__mkSmallInteger(cntRead));
}
errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
bad: ;
if (mustFreeBuffer) {
- free(extPtr);
+ free(extPtr);
}
%}.
errorNumber isNil ifTrue:[
- self error:'invalid argument(s): ', errSym.
+ self error:'invalid argument(s): ', errSym.
] ifFalse:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError
].
"
@@ -14151,48 +14303,48 @@
INT t;
if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
- errSym = @symbol(errorNotOpen);
- goto bad;
+ errSym = @symbol(errorNotOpen);
+ goto bad;
}
#if 0
if (ioctlsocket((SOCKET)hFile, FIONREAD, &res)==0) {
- /* its a socket */
- if (res > 0) {
- RETURN ( false );
- }
+ /* its a socket */
+ if (res > 0) {
+ RETURN ( false );
+ }
}
if (PeekNamedPipe(hFile, 0, 0, 0, &res, 0)) {
- /* its a namedPipe */
- if (res > 0) {
- RETURN ( false );
- }
+ /* its a namedPipe */
+ if (res > 0) {
+ RETURN ( false );
+ }
}
#endif
if (__isSmallInteger(millis)) {
- t = __intVal(millis);
+ t = __intVal(millis);
} else {
- t = INFINITE;
+ t = INFINITE;
}
do {
- __threadErrno = 0;
- res = WaitForSingleObject(hFile, t);
+ __threadErrno = 0;
+ res = WaitForSingleObject(hFile, t);
} while (__threadErrno == EINTR);
switch (res) {
- case WAIT_OBJECT_0:
- /* signalled */
- RETURN ( false );
-
- case WAIT_TIMEOUT:
- /* signalled */
- RETURN ( true );
-
- default:
- case WAIT_ABANDONED:
- errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
- goto bad;
+ case WAIT_OBJECT_0:
+ /* signalled */
+ RETURN ( false );
+
+ case WAIT_TIMEOUT:
+ /* signalled */
+ RETURN ( true );
+
+ default:
+ case WAIT_ABANDONED:
+ errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
+ goto bad;
}
bad: ;
@@ -14207,9 +14359,9 @@
seekTo:newPosition from:whence
"whence is one of:
- #begin
- #current
- #end
+ #begin
+ #current
+ #end
"
|errSym errorNumber|
@@ -14221,42 +14373,42 @@
__uint64__ pos64, newPos64;
if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
- errSym = @symbol(errorNotOpen);
- goto bad;
+ errSym = @symbol(errorNotOpen);
+ goto bad;
}
if (whence == @symbol(begin)) {
- moveHow = FILE_BEGIN;
+ moveHow = FILE_BEGIN;
} else if (whence == @symbol(current)) {
- moveHow = FILE_CURRENT;
+ moveHow = FILE_CURRENT;
} else if (whence == @symbol(end)) {
- moveHow = FILE_END;
+ moveHow = FILE_END;
} else {
- errSym = @symbol(badArgument2);
- goto bad;
+ errSym = @symbol(badArgument2);
+ goto bad;
}
if (__signedLong64IntVal(newPosition, &pos64) == 0) {
- errSym = @symbol(badArgument);
- goto bad;
+ errSym = @symbol(badArgument);
+ goto bad;
}
posLo = pos64.lo;
posHi = pos64.hi;
posLo = SetFilePointer(hFile, posLo, &posHi, moveHow);
if (posLo == 0xFFFFFFFF) {
- int lastError;
-
- /* can be either an error, or a valid low-word */
- lastError = GetLastError();
- if (lastError != NO_ERROR) {
- errorNumber = __mkSmallInteger( __WIN32_ERR(lastError) );
- goto bad;
- }
+ int lastError;
+
+ /* can be either an error, or a valid low-word */
+ lastError = GetLastError();
+ if (lastError != NO_ERROR) {
+ errorNumber = __mkSmallInteger( __WIN32_ERR(lastError) );
+ goto bad;
+ }
}
if (posHi == 0) {
- RETURN (__MKUINT( posLo ));
+ RETURN (__MKUINT( posLo ));
}
newPos64.lo = posLo;
newPos64.hi = posHi;
@@ -14267,9 +14419,9 @@
%}.
errorNumber isNil ifTrue:[
- self error:'invalid argument(s): ', errSym.
+ self error:'invalid argument(s): ', errSym.
] ifFalse:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError
].
!
@@ -14290,82 +14442,82 @@
BOOL ok;
if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
- errSym = @symbol(errorNotOpen);
- goto bad;
+ errSym = @symbol(errorNotOpen);
+ goto bad;
}
if (! __bothSmallInteger(count, firstIndex)) {
- errSym = @symbol(badArgument);
- goto bad;
+ errSym = @symbol(badArgument);
+ goto bad;
}
cntWanted = __smallIntegerVal(count);
if (cntWanted <= 0) {
- errSym = @symbol(badCount);
- goto bad;
+ errSym = @symbol(badCount);
+ goto bad;
}
offs = __smallIntegerVal(firstIndex) - 1;
if (offs < 0) {
- errSym = @symbol(badOffset);
- goto bad;
+ errSym = @symbol(badOffset);
+ goto bad;
}
bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
if (! bufferIsExternalBytes) {
- if (__isByteArray(aByteBuffer)) {
- bufferSize = __byteArraySize(aByteBuffer);
- } else if (__isString(aByteBuffer)) {
- bufferSize = __stringSize(aByteBuffer);
- } else {
- errSym = @symbol(badBuffer);
- goto bad;
- }
- if (bufferSize < (cntWanted + offs)) {
- errSym = @symbol(badBufferSize);
- goto bad;
- }
- if (cntWanted <= sizeof(miniBuffer)) {
- extPtr = miniBuffer;
- } else {
- extPtr = malloc(cntWanted);
- mustFreeBuffer = 1;
- }
- memcpy(extPtr, __byteArrayVal(aByteBuffer)+offs, cntWanted);
+ if (__isByteArray(aByteBuffer)) {
+ bufferSize = __byteArraySize(aByteBuffer);
+ } else if (__isString(aByteBuffer)) {
+ bufferSize = __stringSize(aByteBuffer);
+ } else {
+ errSym = @symbol(badBuffer);
+ goto bad;
+ }
+ if (bufferSize < (cntWanted + offs)) {
+ errSym = @symbol(badBufferSize);
+ goto bad;
+ }
+ if (cntWanted <= sizeof(miniBuffer)) {
+ extPtr = miniBuffer;
+ } else {
+ extPtr = malloc(cntWanted);
+ mustFreeBuffer = 1;
+ }
+ memcpy(extPtr, __byteArrayVal(aByteBuffer)+offs, cntWanted);
} else {
- extPtr = (char *)(__externalBytesAddress(aByteBuffer));
- bufferSize = __externalBytesSize(aByteBuffer);
- if (! __isSmallInteger(bufferSize)) {
- errSym = @symbol(badBufferSize);
- goto bad;
- }
- bufferSize = __smallIntegerVal(bufferSize);
- if (bufferSize < (cntWanted + offs)) {
- errSym = @symbol(badBufferSize);
- goto bad;
- }
- extPtr = extPtr + offs;
+ extPtr = (char *)(__externalBytesAddress(aByteBuffer));
+ bufferSize = __externalBytesSize(aByteBuffer);
+ if (! __isSmallInteger(bufferSize)) {
+ errSym = @symbol(badBufferSize);
+ goto bad;
+ }
+ bufferSize = __smallIntegerVal(bufferSize);
+ if (bufferSize < (cntWanted + offs)) {
+ errSym = @symbol(badBufferSize);
+ goto bad;
+ }
+ extPtr = extPtr + offs;
}
do {
- __threadErrno = 0;
- ok = STX_API_CALL5( "WriteFile", WriteFile, hFile, extPtr, cntWanted, &cntWritten, 0 /* lpOverlapped */);
+ __threadErrno = 0;
+ ok = STX_API_CALL5( "WriteFile", WriteFile, hFile, extPtr, cntWanted, &cntWritten, 0 /* lpOverlapped */);
} while(__threadErrno == EINTR);
if (ok == TRUE) {
- if (mustFreeBuffer) {
- free(extPtr);
- }
- RETURN (__mkSmallInteger(cntWritten));
+ if (mustFreeBuffer) {
+ free(extPtr);
+ }
+ RETURN (__mkSmallInteger(cntWritten));
}
errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
bad: ;
if (mustFreeBuffer) {
- free(extPtr);
+ free(extPtr);
}
%}.
errorNumber isNil ifTrue:[
- self error:'invalid argument(s): ', errSym.
+ self error:'invalid argument(s): ', errSym.
] ifFalse:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError
].
"
@@ -14394,8 +14546,8 @@
HANDLE h = (HANDLE)(__externalAddressVal(self));
if (h) {
- __externalAddressVal(self) = (HANDLE)0;
- CloseHandle(h);
+ __externalAddressVal(self) = (HANDLE)0;
+ CloseHandle(h);
}
%}.
! !
@@ -14404,7 +14556,7 @@
closeHandle
self address ~~ 0 ifTrue:[
- OperatingSystem primClosePrinter:self.
+ OperatingSystem primClosePrinter:self.
]
"Created: / 27-07-2006 / 14:48:37 / fm"
@@ -14419,9 +14571,9 @@
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'opening'!
open:portName baudRate:baudRate stopBitsType:stopBitsType
- parityType:parityType dataBits:dataBits
- inFlowCtrl:inFlowCtrlType outFlowCtrl:outFlowCtrlType
- xOnChar:xOnChar xOffChar:xOffChar
+ parityType:parityType dataBits:dataBits
+ inFlowCtrl:inFlowCtrlType outFlowCtrl:outFlowCtrlType
+ xOnChar:xOnChar xOffChar:xOffChar
"portName: COM%d
baudRate: Integer
stopBitsType: #stop1, #stop2 or #stop1_5
@@ -14440,13 +14592,13 @@
DCB dcb;
char *__portName;
int __setBaudRate = 1,
- __setDataBits = 1,
- __setXOnChar = 1,
- __setXOffChar = 1,
- __setInFlowCtrl = 1,
- __setOutFlowCtrl = 1,
- __setStopBits = 1,
- __setParityType = 1;
+ __setDataBits = 1,
+ __setXOnChar = 1,
+ __setXOffChar = 1,
+ __setInFlowCtrl = 1,
+ __setOutFlowCtrl = 1,
+ __setStopBits = 1,
+ __setParityType = 1;
int __baudRate, __dataBits;
int __xOnChar, __xOffChar;
int __inFlowCtrl, __outFlowCtrl;
@@ -14461,90 +14613,90 @@
# define NONE 3
if (__isString(portName)) {
- __portName = __stringVal(portName);
+ __portName = __stringVal(portName);
} else {
- goto failure;
+ goto failure;
}
if (__isSmallInteger(baudRate)) {
- __baudRate = __intVal(baudRate);
+ __baudRate = __intVal(baudRate);
} else if (baudRate == nil) {
- __setBaudRate = 0;
+ __setBaudRate = 0;
} else {
- goto failure;
+ goto failure;
}
if (__isSmallInteger(dataBits)) {
- __dataBits = __intVal(dataBits);
+ __dataBits = __intVal(dataBits);
} else if (dataBits == nil) {
- __setDataBits = 0;
+ __setDataBits = 0;
} else {
- goto failure;
+ goto failure;
}
if (__isSmallInteger(xOnChar)) {
- __xOnChar = __intVal(xOnChar);
+ __xOnChar = __intVal(xOnChar);
} else if (__isCharacter(xOnChar)) {
- __xOnChar = __intVal(_characterVal(xOnChar));
+ __xOnChar = __intVal(_characterVal(xOnChar));
} else if (xOnChar == nil) {
- __setXOnChar = 0;
+ __setXOnChar = 0;
} else {
- goto failure;
+ goto failure;
}
if (__isSmallInteger(xOffChar)) {
- __xOffChar = __intVal(xOffChar);
+ __xOffChar = __intVal(xOffChar);
} else if (__isCharacter(xOffChar)) {
- __xOffChar = __intVal(_characterVal(xOffChar));
+ __xOffChar = __intVal(_characterVal(xOffChar));
} else if (xOffChar == nil) {
- __setXOffChar = 0;
+ __setXOffChar = 0;
} else {
- goto failure;
+ goto failure;
}
if (inFlowCtrlType == @symbol(xOnOff)) {
- __inFlowCtrl = XONOFF;
+ __inFlowCtrl = XONOFF;
} else if (inFlowCtrlType == @symbol(hardware)) {
- __inFlowCtrl = HARDWARE;
+ __inFlowCtrl = HARDWARE;
} else if (inFlowCtrlType == nil) {
- __setInFlowCtrl = 0;
+ __setInFlowCtrl = 0;
} else {
- goto failure;
+ goto failure;
}
if (outFlowCtrlType == @symbol(xOnOff)) {
- __outFlowCtrl = XONOFF;
+ __outFlowCtrl = XONOFF;
} else if (outFlowCtrlType == @symbol(hardware)) {
- __outFlowCtrl = HARDWARE;
+ __outFlowCtrl = HARDWARE;
} else if (outFlowCtrlType == nil) {
- __setOutFlowCtrl = 0;
+ __setOutFlowCtrl = 0;
} else {
- goto failure;
+ goto failure;
}
if (stopBitsType == @symbol(stop1)) {
- __stopBits = STOP1;
+ __stopBits = STOP1;
} else if (stopBitsType == @symbol(stop2)) {
- __stopBits = STOP2;
+ __stopBits = STOP2;
} else if (stopBitsType == @symbol(stop1_5)) {
- __stopBits = STOP1_5;
+ __stopBits = STOP1_5;
} else if (stopBitsType == nil) {
- __setStopBits = 0;
+ __setStopBits = 0;
} else {
- goto failure;
+ goto failure;
}
port = CreateFile(__portName,
- GENERIC_READ | GENERIC_WRITE,
- 0, /* comm devices must be opened with exclusive access */
- NULL, /* no security attrs */
- OPEN_EXISTING, /* comm devices must use OPEN_EXISTING */
- 0, /* no overlapped I/O */
- NULL /* hTemplate must be NULL for comm devices */
- );
+ GENERIC_READ | GENERIC_WRITE,
+ 0, /* comm devices must be opened with exclusive access */
+ NULL, /* no security attrs */
+ OPEN_EXISTING, /* comm devices must use OPEN_EXISTING */
+ 0, /* no overlapped I/O */
+ NULL /* hTemplate must be NULL for comm devices */
+ );
if (port == INVALID_HANDLE_VALUE) {
- console_fprintf(stderr, "Win32OS [info]: serial port open failed\n");
- errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
- goto failure;
+ console_fprintf(stderr, "Win32OS [info]: serial port open failed\n");
+ errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
+ goto failure;
}
/* Flush the driver */
PurgeComm( port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
@@ -14571,42 +14723,42 @@
if (__setXOffChar) dcb.XoffChar = __xOffChar;
if (__setStopBits) {
- /* set stop bits */
- switch(__stopBits) {
- case STOP1_5: dcb.StopBits = 1; break; /* 1.5 stop bits */
- case STOP1: dcb.StopBits = 0; break; /* 1 stop bit */
- case STOP2: dcb.StopBits = 2; break; /* 2 stop bits */
- default: goto errExit;
- }
+ /* set stop bits */
+ switch(__stopBits) {
+ case STOP1_5: dcb.StopBits = 1; break; /* 1.5 stop bits */
+ case STOP1: dcb.StopBits = 0; break; /* 1 stop bit */
+ case STOP2: dcb.StopBits = 2; break; /* 2 stop bits */
+ default: goto errExit;
+ }
}
if (__setParityType) {
- /* set parity */
- switch(__parityType) {
- case NONE: dcb.Parity = NOPARITY; break;
- case ODD: dcb.Parity = ODDPARITY; break;
- case EVEN: dcb.Parity = EVENPARITY; break;
- default: goto errExit;
- }
+ /* set parity */
+ switch(__parityType) {
+ case NONE: dcb.Parity = NOPARITY; break;
+ case ODD: dcb.Parity = ODDPARITY; break;
+ case EVEN: dcb.Parity = EVENPARITY; break;
+ default: goto errExit;
+ }
}
if (__setInFlowCtrl) {
- /* set control flow */
- dcb.fInX = FALSE;
- dcb.fDtrControl = FALSE;
- if (__inFlowCtrl == XONOFF) dcb.fInX = TRUE; /* XOn/XOff handshaking */
- if (__inFlowCtrl == HARDWARE) dcb.fDtrControl = TRUE; /* hardware handshaking */
+ /* set control flow */
+ dcb.fInX = FALSE;
+ dcb.fDtrControl = FALSE;
+ if (__inFlowCtrl == XONOFF) dcb.fInX = TRUE; /* XOn/XOff handshaking */
+ if (__inFlowCtrl == HARDWARE) dcb.fDtrControl = TRUE; /* hardware handshaking */
}
if (__setOutFlowCtrl) {
- dcb.fOutX = FALSE;
- dcb.fOutxCtsFlow = FALSE;
-
- if (__outFlowCtrl == XONOFF) dcb.fOutX = TRUE; /* XOn/XOff handshaking */
- if (__outFlowCtrl == HARDWARE) dcb.fOutxCtsFlow = TRUE; /* hardware handshaking */
+ dcb.fOutX = FALSE;
+ dcb.fOutxCtsFlow = FALSE;
+
+ if (__outFlowCtrl == XONOFF) dcb.fOutX = TRUE; /* XOn/XOff handshaking */
+ if (__outFlowCtrl == HARDWARE) dcb.fOutxCtsFlow = TRUE; /* hardware handshaking */
}
if (SetCommState(port, &dcb)) {
- RETURN( true );
+ RETURN( true );
}
console_fprintf(stderr, "Win32OS [info]: serial port comm-setup failed\n");
@@ -14626,9 +14778,9 @@
# undef NONE
%}.
errorNumber isNil ifTrue:[
- self error:'invalid argument(s)'.
+ self error:'invalid argument(s)'.
] ifFalse:[
- (OperatingSystem errorHolderForNumber:errorNumber) reportError
+ (OperatingSystem errorHolderForNumber:errorNumber) reportError
].
! !
@@ -14641,9 +14793,9 @@
HANDLE port = (HANDLE)(__externalAddressVal(self));
if (port) {
- __externalAddressVal(self) = (HANDLE)0;
- PurgeComm( port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
- CloseHandle(port);
+ __externalAddressVal(self) = (HANDLE)0;
+ PurgeComm( port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
+ CloseHandle(port);
}
%}.
! !
@@ -14656,18 +14808,18 @@
if (port
&& __isSmallInteger(newRate)) {
- DCB dcb;
-
- ZeroMemory(&dcb, sizeof(dcb));
- dcb.DCBlength = sizeof(dcb);
- GetCommState(port, &dcb);
-
- dcb.BaudRate = __intVal(newRate);
-
- if (! SetCommState(port, &dcb)) {
- RETURN(false);
- }
- RETURN(true);
+ DCB dcb;
+
+ ZeroMemory(&dcb, sizeof(dcb));
+ dcb.DCBlength = sizeof(dcb);
+ GetCommState(port, &dcb);
+
+ dcb.BaudRate = __intVal(newRate);
+
+ if (! SetCommState(port, &dcb)) {
+ RETURN(false);
+ }
+ RETURN(true);
}
%}.
self primitiveFailed.
@@ -14679,18 +14831,18 @@
if (port
&& __isSmallInteger(newNumberOfBits)) {
- DCB dcb;
-
- ZeroMemory(&dcb, sizeof(dcb));
- dcb.DCBlength = sizeof(dcb);
- GetCommState(port, &dcb);
-
- dcb.ByteSize = __intVal(newNumberOfBits);
-
- if (! SetCommState(port, &dcb)) {
- RETURN(false);
- }
- RETURN(true);
+ DCB dcb;
+
+ ZeroMemory(&dcb, sizeof(dcb));
+ dcb.DCBlength = sizeof(dcb);
+ GetCommState(port, &dcb);
+
+ dcb.ByteSize = __intVal(newNumberOfBits);
+
+ if (! SetCommState(port, &dcb)) {
+ RETURN(false);
+ }
+ RETURN(true);
}
%}.
self primitiveFailed.
@@ -14703,27 +14855,27 @@
HANDLE port = (HANDLE)(__externalAddressVal(self));
if (port) {
- DCB dcb;
-
- ZeroMemory(&dcb, sizeof(dcb));
- dcb.DCBlength = sizeof(dcb);
- GetCommState(port, &dcb);
-
-
- if ((newParityTypeSymbol == nil) || (newParityTypeSymbol == @symbol(none))) {
- dcb.Parity = NOPARITY;
- } else if (newParityTypeSymbol == @symbol(odd)) {
- dcb.Parity = ODDPARITY;
- } else if (newParityTypeSymbol == @symbol(even)) {
- dcb.Parity = EVENPARITY;
- } else {
- goto failure;
- }
-
- if (! SetCommState(port, &dcb)) {
- RETURN(false);
- }
- RETURN(true);
+ DCB dcb;
+
+ ZeroMemory(&dcb, sizeof(dcb));
+ dcb.DCBlength = sizeof(dcb);
+ GetCommState(port, &dcb);
+
+
+ if ((newParityTypeSymbol == nil) || (newParityTypeSymbol == @symbol(none))) {
+ dcb.Parity = NOPARITY;
+ } else if (newParityTypeSymbol == @symbol(odd)) {
+ dcb.Parity = ODDPARITY;
+ } else if (newParityTypeSymbol == @symbol(even)) {
+ dcb.Parity = EVENPARITY;
+ } else {
+ goto failure;
+ }
+
+ if (! SetCommState(port, &dcb)) {
+ RETURN(false);
+ }
+ RETURN(true);
}
failure: ;
%}.
@@ -14736,26 +14888,26 @@
HANDLE port = (HANDLE)(__externalAddressVal(self));
if (port) {
- DCB dcb;
-
- ZeroMemory(&dcb, sizeof(dcb));
- dcb.DCBlength = sizeof(dcb);
- GetCommState(port, &dcb);
-
- if (newStopBitsSymbol == @symbol(stop1)) {
- dcb.Parity = 0 /* STOP1 */;
- } else if (newStopBitsSymbol == @symbol(stop2)) {
- dcb.Parity = 2 /* STOP2 */;
- } else if (newStopBitsSymbol == @symbol(stop1_5)) {
- dcb.Parity = 1 /* STOP1_5 */;
- } else {
- goto failure;
- }
-
- if (! SetCommState(port, &dcb)) {
- RETURN(false);
- }
- RETURN(true);
+ DCB dcb;
+
+ ZeroMemory(&dcb, sizeof(dcb));
+ dcb.DCBlength = sizeof(dcb);
+ GetCommState(port, &dcb);
+
+ if (newStopBitsSymbol == @symbol(stop1)) {
+ dcb.Parity = 0 /* STOP1 */;
+ } else if (newStopBitsSymbol == @symbol(stop2)) {
+ dcb.Parity = 2 /* STOP2 */;
+ } else if (newStopBitsSymbol == @symbol(stop1_5)) {
+ dcb.Parity = 1 /* STOP1_5 */;
+ } else {
+ goto failure;
+ }
+
+ if (! SetCommState(port, &dcb)) {
+ RETURN(false);
+ }
+ RETURN(true);
}
failure: ;
%}.
@@ -15220,20 +15372,20 @@
int nInstBytes, sockAddrSize;
if (wantHostName == true) {
- hp = host;
- hsz = sizeof(host);
+ hp = host;
+ hsz = sizeof(host);
}
if (wantServiceName == true) {
- sp = service;
- ssz = sizeof(service);
+ sp = service;
+ ssz = sizeof(service);
}
if (hp == 0 && sp == 0) {
- error = @symbol(badArgument);
- goto err;
+ error = @symbol(badArgument);
+ goto err;
}
if (!__isBytes(socketAddress)) {
- error = @symbol(badArgument1);
- goto err;
+ error = @symbol(badArgument1);
+ goto err;
}
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(socketAddress))->c_ninstvars));
@@ -15241,176 +15393,176 @@
sockAddrSize -= nInstBytes;
if (!__isSmallInteger(flags)) {
- error = @symbol(badArgument5);
- goto err;
+ error = @symbol(badArgument5);
+ goto err;
}
__flags = __intVal(flags);
#if defined(NI_NUMERICHOST)
if (useDatagram == true) {
- __flags |= NI_DGRAM;
+ __flags |= NI_DGRAM;
}
{
- bp = (char *)(__byteArrayVal(socketAddress));
- bp += nInstBytes;
- __BEGIN_INTERRUPTABLE__
- ret = getnameinfo((struct sockaddr *)bp, sockAddrSize,
- hp, hsz, sp, ssz, __flags);
- __END_INTERRUPTABLE__
+ bp = (char *)(__byteArrayVal(socketAddress));
+ bp += nInstBytes;
+ __BEGIN_INTERRUPTABLE__
+ ret = getnameinfo((struct sockaddr *)bp, sockAddrSize,
+ hp, hsz, sp, ssz, __flags);
+ __END_INTERRUPTABLE__
} while (ret == EAI_SYSTEM && errno == EINTR);
if (ret != 0) {
- switch (ret) {
- case EAI_FAMILY:
- error = @symbol(badProtocol);
- break;
- case EAI_SOCKTYPE:
- error = @symbol(badSocketType);
- break;
- case EAI_BADFLAGS:
- error = @symbol(badFlags);
- break;
- case EAI_NONAME:
- error = @symbol(unknownHost);
- break;
- case EAI_SERVICE:
- error = @symbol(unknownService);
- break;
- case EAI_ADDRFAMILY :
- error = @symbol(unknownHostForProtocol);
- break;
- case EAI_NODATA:
- error = @symbol(noAddress);
- break;
- case EAI_MEMORY:
- error = @symbol(allocationFailure);
- break;
- case EAI_FAIL:
- error = @symbol(permanentFailure);
- break;
- case EAI_AGAIN:
- error = @symbol(tryAgain);
- break;
- case EAI_SYSTEM:
- error = @symbol(systemError);
- break;
- default:
- error = @symbol(unknownError);
- }
- errorString = __MKSTRING(gai_strerror(ret));
- goto err;
+ switch (ret) {
+ case EAI_FAMILY:
+ error = @symbol(badProtocol);
+ break;
+ case EAI_SOCKTYPE:
+ error = @symbol(badSocketType);
+ break;
+ case EAI_BADFLAGS:
+ error = @symbol(badFlags);
+ break;
+ case EAI_NONAME:
+ error = @symbol(unknownHost);
+ break;
+ case EAI_SERVICE:
+ error = @symbol(unknownService);
+ break;
+ case EAI_ADDRFAMILY :
+ error = @symbol(unknownHostForProtocol);
+ break;
+ case EAI_NODATA:
+ error = @symbol(noAddress);
+ break;
+ case EAI_MEMORY:
+ error = @symbol(allocationFailure);
+ break;
+ case EAI_FAIL:
+ error = @symbol(permanentFailure);
+ break;
+ case EAI_AGAIN:
+ error = @symbol(tryAgain);
+ break;
+ case EAI_SYSTEM:
+ error = @symbol(systemError);
+ break;
+ default:
+ error = @symbol(unknownError);
+ }
+ errorString = __MKSTRING(gai_strerror(ret));
+ goto err;
}
# else /* ! NI_NUMERICHOST */
{
- /*
- * Do it using gethostbyaddr()
- */
- struct sockaddr_in *sa;
-
- if (sockAddrSize < sizeof(*sa)) {
- error = @symbol(badArgument1);
- goto err;
- }
- bp = (char *)(__byteArrayVal(socketAddress));
- bp += nInstBytes;
- sa = (struct sockaddr_in *)bp;
-
- if (sp) {
- struct servent *servp;
- char *__proto = 0;
-
- __proto = (useDatagram == true ? "udp" : "tcp");
-
- servp = getservbyport(sa->sin_port, __proto);
- if (servp) {
- sp = servp->s_name;
- }
- }
- if (hp) {
- struct hostent *hostp;
+ /*
+ * Do it using gethostbyaddr()
+ */
+ struct sockaddr_in *sa;
+
+ if (sockAddrSize < sizeof(*sa)) {
+ error = @symbol(badArgument1);
+ goto err;
+ }
+ bp = (char *)(__byteArrayVal(socketAddress));
+ bp += nInstBytes;
+ sa = (struct sockaddr_in *)bp;
+
+ if (sp) {
+ struct servent *servp;
+ char *__proto = 0;
+
+ __proto = (useDatagram == true ? "udp" : "tcp");
+
+ servp = getservbyport(sa->sin_port, __proto);
+ if (servp) {
+ sp = servp->s_name;
+ }
+ }
+ if (hp) {
+ struct hostent *hostp;
# ifdef USE_H_ERRNO
- do {
- /* must refetch in loop */
- bp = (char *)(__byteArrayVal(socketAddress));
- bp += nInstBytes;
- sa = (struct sockaddr_in *)bp;
- /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname uses a static data area
- */
- hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
- /* __END_INTERRUPTABLE__ */
- } while ((hostp == NULL)
- && ((h_errno == TRY_AGAIN)
- || errno == EINTR
+ do {
+ /* must refetch in loop */
+ bp = (char *)(__byteArrayVal(socketAddress));
+ bp += nInstBytes;
+ sa = (struct sockaddr_in *)bp;
+ /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname uses a static data area
+ */
+ hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
+ /* __END_INTERRUPTABLE__ */
+ } while ((hostp == NULL)
+ && ((h_errno == TRY_AGAIN)
+ || errno == EINTR
# ifdef IRIX5_3
- || (errno == ECONNREFUSED)
+ || (errno == ECONNREFUSED)
# endif
- )
- );
- if (hostp == 0) {
- switch (h_errno) {
- case HOST_NOT_FOUND:
- errorString = @symbol(unknownHost);
- break;
- case NO_ADDRESS:
- errorString = @symbol(noAddress);
- break;
- case NO_RECOVERY:
- errorString = @symbol(permanentFailure);
- break;
- case TRY_AGAIN:
- errorString = @symbol(tryAgain);
- break;
- default:
- errorString = @symbol(unknownError);
- break;
- }
- error = __mkSmallInteger(h_errno);
- goto err;
- }
+ )
+ );
+ if (hostp == 0) {
+ switch (h_errno) {
+ case HOST_NOT_FOUND:
+ errorString = @symbol(unknownHost);
+ break;
+ case NO_ADDRESS:
+ errorString = @symbol(noAddress);
+ break;
+ case NO_RECOVERY:
+ errorString = @symbol(permanentFailure);
+ break;
+ case TRY_AGAIN:
+ errorString = @symbol(tryAgain);
+ break;
+ default:
+ errorString = @symbol(unknownError);
+ break;
+ }
+ error = __mkSmallInteger(h_errno);
+ goto err;
+ }
# else /* !USE_H_ERRNO */
- hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
- if (hostp == 0) {
- errorString = @symbol(unknownHost);
- error = __mkSmallInteger(-1);
- goto err;
- }
+ hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
+ if (hostp == 0) {
+ errorString = @symbol(unknownHost);
+ error = __mkSmallInteger(-1);
+ goto err;
+ }
# endif /* !USE_H_ERRNO*/
- hp = hostp->h_name;
- }
+ hp = hostp->h_name;
+ }
}
# endif /* ! NI_NUMERICHOST */
if (hp)
- hostName = __MKSTRING(hp);
+ hostName = __MKSTRING(hp);
if (sp)
- serviceName = __MKSTRING(sp);
+ serviceName = __MKSTRING(sp);
err:;
#else
error = @symbol(notImplemented);
#endif
%}.
error notNil ifTrue:[
- ^ (HostAddressLookupError new
- parameter:error;
- messageText:' - ', errorString;
- request:thisContext message) raiseRequest.
+ ^ (HostAddressLookupError new
+ parameter:error;
+ messageText:' - ', errorString;
+ request:thisContext message) raiseRequest.
].
^ Array with:hostName with:serviceName
"
self getNameInfo:
- (self getAddressInfo:'localhost' serviceName:'echo'
- domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
- wantHostName:true wantServiceName:true datagram:false flags:0
+ (self getAddressInfo:'localhost' serviceName:'echo'
+ domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
+ wantHostName:true wantServiceName:true datagram:false flags:0
self getNameInfo:
- (self getAddressInfo:'exept.exept.de' serviceName:'echo'
- domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
- wantHostName:true wantServiceName:true datagram:false flags:0
+ (self getAddressInfo:'exept.exept.de' serviceName:'echo'
+ domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
+ wantHostName:true wantServiceName:true datagram:false flags:0
self getNameInfo:#[1 2 3 4]
- wantHostName:true wantServiceName:true datagram:false flags:0
+ wantHostName:true wantServiceName:true datagram:false flags:0
"
! !
@@ -15433,35 +15585,35 @@
!Win32OperatingSystem::WinPointStructure methodsFor:'accessing'!
asPoint
- "Private - Answer the receiver as a Point."
+ "Private - Answer the receiver as a Point."
^self x @ self y
"Created: / 03-08-2006 / 10:45:55 / fm"
!
x
- "Private - Answer the x coordinate of the point."
+ "Private - Answer the x coordinate of the point."
^self longAt: 0 + 1
"Created: / 03-08-2006 / 10:46:11 / fm"
!
x: anInteger
- "Private - Set the x coordinate of the point."
+ "Private - Set the x coordinate of the point."
self longAt: 0 + 1 put: anInteger
"Created: / 03-08-2006 / 10:46:41 / fm"
!
y
- "Private - Answer the y coordinate of the point."
+ "Private - Answer the y coordinate of the point."
^self longAt: 4 + 1
"Created: / 03-08-2006 / 10:46:26 / fm"
!
y: anInteger
- "Private - Set the y coordinate of the point."
+ "Private - Set the y coordinate of the point."
self longAt: 4 + 1 put: anInteger
"Created: / 03-08-2006 / 10:46:56 / fm"
@@ -15470,7 +15622,7 @@
!Win32OperatingSystem::WinPointStructure methodsFor:'printing'!
printOn: aStream
- "Append a textual representation of the receiver to aStream."
+ "Append a textual representation of the receiver to aStream."
aStream nextPutAll: self class name, ' { ', self asPoint printString, ' } '
"Created: / 03-08-2006 / 10:45:40 / fm"
@@ -15479,7 +15631,7 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.331 2008-06-03 09:30:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.332 2008-07-21 10:48:57 fm Exp $'
! !
Win32OperatingSystem initialize!